From cae1c0fd1abd42fa279912dc8ba907ac97f1bf11 Mon Sep 17 00:00:00 2001 From: Dustin Brody Date: Mon, 16 Mar 2020 11:01:36 +0100 Subject: [PATCH] address beacon_node TODO regarding missing proposer index; mark initiate_validator_exit(...), is_eligible_for_activation_queue(...), Attestation, DepositMessage, BeaconBlockBody, PendingAttestation, Eth1Data, and integer_squareroot(...) as 0.11.0 --- beacon_chain/beacon_node.nim | 3 +-- beacon_chain/spec/beaconstate.nim | 6 +++--- beacon_chain/spec/datatypes.nim | 10 +++++----- beacon_chain/spec/helpers.nim | 2 +- beacon_chain/spec/state_transition_epoch.nim | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index 55df871c9..cd8555e4f 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -408,8 +408,7 @@ proc proposeBlock(node: BeaconNode, var cache = get_empty_per_epoch_cache() let proposer_index = get_beacon_proposer_index(state, cache) if proposer_index.isNone: - # TODO? - discard + doAssert false, "proposeBlock: missing proposer index" var newBlock = SignedBeaconBlock( diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 76e6816d1..6e056fbb2 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -112,7 +112,7 @@ func get_validator_churn_limit(state: BeaconState): uint64 = max(MIN_PER_EPOCH_CHURN_LIMIT, len(active_validator_indices) div CHURN_LIMIT_QUOTIENT).uint64 -# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#initiate_validator_exit +# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#initiate_validator_exit func initiate_validator_exit*(state: var BeaconState, index: ValidatorIndex) = # Initiate the exit of the validator with index ``index``. @@ -297,13 +297,13 @@ func get_total_balance*(state: BeaconState, validators: auto): Gwei = # XXX: Move to state_transition_epoch.nim? -# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue +# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue func is_eligible_for_activation_queue(validator: Validator): bool = # Check if ``validator`` is eligible to be placed into the activation queue. validator.activation_eligibility_epoch == FAR_FUTURE_EPOCH and validator.effective_balance == MAX_EFFECTIVE_BALANCE -# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#is_eligible_for_activation +# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#is_eligible_for_activation func is_eligible_for_activation(state: BeaconState, validator: Validator): bool = # Check if ``validator`` is eligible for activation. diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index bf1a56dfc..6f0cb0efa 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -133,7 +133,7 @@ type CommitteeValidatorsBits* = BitList[MAX_VALIDATORS_PER_COMMITTEE] - # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#attestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#attestation Attestation* = object aggregation_bits*: CommitteeValidatorsBits data*: AttestationData @@ -169,7 +169,7 @@ type data*: DepositData - # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#depositmessage + # https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#depositmessage DepositMessage* = object pubkey*: ValidatorPubKey withdrawal_credentials*: Eth2Digest @@ -216,7 +216,7 @@ type state_root*: Eth2Digest body_root*: Eth2Digest - # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#beaconblockbody + # https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#beaconblockbody BeaconBlockBody* = object randao_reveal*: ValidatorSig eth1_data*: Eth1Data @@ -305,7 +305,7 @@ type withdrawable_epoch*: Epoch ##\ ## When validator can withdraw or transfer funds - # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#pendingattestation + # https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#pendingattestation PendingAttestation* = object aggregation_bits*: CommitteeValidatorsBits data*: AttestationData @@ -330,7 +330,7 @@ type epoch*: Epoch ##\ ## Epoch of latest fork - # https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#eth1data + # https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#eth1data Eth1Data* = object deposit_root*: Eth2Digest deposit_count*: uint64 diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index 300837cd3..97588dc53 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -15,7 +15,7 @@ import # Internal ./datatypes, ./digest, ../ssz -# https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#integer_squareroot +# https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#integer_squareroot func integer_squareroot*(n: SomeInteger): SomeInteger = # Return the largest integer ``x`` such that ``x**2 <= n``. doAssert n >= 0'u64 diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index db0f5f9e2..2c34da407 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -144,7 +144,7 @@ proc process_justification_and_finalization*( ## and `get_matching_source_attestations(...)` via ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#helper-functions-1 ## and - ## https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#final-updates + ## https://github.com/ethereum/eth2.0-specs/blob/v0.11.0/specs/phase0/beacon-chain.md#final-updates ## after which the state.previous_epoch_attestations is replaced. trace "Non-attesting indices in previous epoch", missing_all_validators=