use `GeneralizedIndex` type for spec constants (#3026)

Spec constants currently use `uint16` instead of `GeneralizedIndex` to
define generalized indices in a merkle tree. Adjusted to use the latter
instead to avoid problems when adjusting `GeneralizedIndex`'s bit width.
This commit is contained in:
Etan Kissling 2021-10-26 14:30:36 +02:00 committed by GitHub
parent 07e4dd5f23
commit d32c25ea32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -33,6 +33,9 @@ import
import ./base, ./phase0 import ./base, ./phase0
export base export base
from ../../ssz/merkleization import GeneralizedIndex
export merkleization.GeneralizedIndex
const const
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/beacon-chain.md#incentivization-weights # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/beacon-chain.md#incentivization-weights
TIMELY_SOURCE_WEIGHT* = 14 TIMELY_SOURCE_WEIGHT* = 14
@ -49,9 +52,9 @@ const
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16 TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16
SYNC_COMMITTEE_SUBNET_COUNT* = 4 SYNC_COMMITTEE_SUBNET_COUNT* = 4
# https://github.com/ethereum/consensus-specs/blob/v1.1.2/setup.py#L478-L479 # https://github.com/ethereum/consensus-specs/blob/v1.1.3/setup.py#L478-L479
FINALIZED_ROOT_INDEX* = 105'u16 FINALIZED_ROOT_INDEX* = 105.GeneralizedIndex
NEXT_SYNC_COMMITTEE_INDEX* = 55'u16 NEXT_SYNC_COMMITTEE_INDEX* = 55.GeneralizedIndex
# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#participation-flag-indices # https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#participation-flag-indices
TIMELY_SOURCE_FLAG_INDEX* = 0 TIMELY_SOURCE_FLAG_INDEX* = 0