Skip to content

Commit

Permalink
Use uint64 for GeneralizedIndex (#13)
Browse files Browse the repository at this point in the history
To support adressing any nimbus-eth2 `BeaconState` member, 32-bit wide
indices are not enough. `BeaconState` requires 5 levels of depth;
`VALIDATOR_REGISTRY_LIMIT` for the `validators` array requires 40 levels
for the contents plus 2 levels for `len` and the root. Another 4 levels
are required for `Validator`. This means that 52-bit indices are needed.
Extending to `uint64` should provide enough leeway without requiring
further implementation adjustments.
  • Loading branch information
etan-status authored Jun 23, 2022
1 parent da3c08c commit 9e754ec
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ssz_serialization/types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const
bytesPerChunk* = 32

type
# TODO Figure out what would be the right type for this.
# It probably fits in uint16 for all practical purposes.
GeneralizedIndex* = uint32
GeneralizedIndex* = uint64

UintN* = SomeUnsignedInt|UInt128|UInt256
BasicType* = bool|UintN
Expand Down

0 comments on commit 9e754ec

Please sign in to comment.