Merge pull request #564 from status-im/ggr

use bounded List[] SSZ type for more hashing consistency with spec
This commit is contained in:
Dustin Brody 2019-11-18 09:39:51 +00:00 committed by GitHub
commit 3744ba3a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 14 deletions

View File

@ -97,6 +97,7 @@ type
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.1/specs/core/0_beacon-chain.md#indexedattestation # https://github.com/ethereum/eth2.0-specs/blob/v0.9.1/specs/core/0_beacon-chain.md#indexedattestation
IndexedAttestation* = object IndexedAttestation* = object
# TODO ValidatorIndex, but that doesn't serialize properly
attesting_indices*: List[uint64, MAX_VALIDATORS_PER_COMMITTEE] attesting_indices*: List[uint64, MAX_VALIDATORS_PER_COMMITTEE]
data*: AttestationData data*: AttestationData
signature*: ValidatorSig signature*: ValidatorSig
@ -205,25 +206,17 @@ type
## Needed to process attestations, older to newer ## Needed to process attestations, older to newer
state_roots*: array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest] state_roots*: array[SLOTS_PER_HISTORICAL_ROOT, Eth2Digest]
historical_roots*: List[Eth2Digest, HISTORICAL_ROOTS_LIMIT]
historical_roots*: seq[Eth2Digest] ##\
## model List with HISTORICAL_ROOTS_LIMIT limit as seq
## TODO bound explicitly somewhere
# Eth1 # Eth1
eth1_data*: Eth1Data eth1_data*: Eth1Data
eth1_data_votes*: List[Eth1Data, SLOTS_PER_ETH1_VOTING_PERIOD]
eth1_data_votes*: seq[Eth1Data] ##\
## As with `hitorical_roots`, this is a `List`. TODO bound explicitly.
eth1_deposit_index*: uint64 eth1_deposit_index*: uint64
# Registry # Registry
# TODO List[] won't construct due to VALIDATOR_REGISTRY_LIMIT > high(int)
validators*: seq[Validator] validators*: seq[Validator]
balances*: seq[uint64] ##\ balances*: seq[uint64]
## Validator balances in Gwei!
## Also more `List`s which need to be bounded explicitly at
## VALIDATOR_REGISTRY_LIMIT
# Shuffling # Shuffling
randao_mixes*: array[EPOCHS_PER_HISTORICAL_VECTOR, Eth2Digest] randao_mixes*: array[EPOCHS_PER_HISTORICAL_VECTOR, Eth2Digest]
@ -233,8 +226,10 @@ type
## Per-epoch sums of slashed effective balances ## Per-epoch sums of slashed effective balances
# Attestations # Attestations
previous_epoch_attestations*: seq[PendingAttestation] previous_epoch_attestations*:
current_epoch_attestations*: seq[PendingAttestation] List[PendingAttestation, MAX_ATTESTATIONS * SLOTS_PER_EPOCH]
current_epoch_attestations*:
List[PendingAttestation, MAX_ATTESTATIONS * SLOTS_PER_EPOCH]
# Finality # Finality
justification_bits*: uint8 ##\ justification_bits*: uint8 ##\