diff --git a/beacon_chain/eth1/eth1_monitor.nim b/beacon_chain/eth1/eth1_monitor.nim index 40c71b28e..10e97f2f9 100644 --- a/beacon_chain/eth1/eth1_monitor.nim +++ b/beacon_chain/eth1/eth1_monitor.nim @@ -297,7 +297,7 @@ template toGaugeValue(x: Quantity): int64 = func compute_time_at_slot(genesis_time: uint64, slot: Slot): uint64 = genesis_time + slot * SECONDS_PER_SLOT -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#get_eth1_data +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/validator.md#get_eth1_data func voting_period_start_time(state: ForkedHashedBeaconState): uint64 = let eth1_voting_period_start_slot = getStateField(state, slot) - getStateField(state, slot) mod @@ -305,7 +305,7 @@ func voting_period_start_time(state: ForkedHashedBeaconState): uint64 = compute_time_at_slot( getStateField(state, genesis_time), eth1_voting_period_start_slot) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#get_eth1_data +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/validator.md#get_eth1_data func is_candidate_block(cfg: RuntimeConfig, blk: Eth1Block, period_start: uint64): bool = @@ -712,7 +712,7 @@ template trackFinalizedState*(m: Eth1Monitor, finalizedStateDepositIndex: uint64): bool = trackFinalizedState(m.depositsChain, finalizedEth1Data, finalizedStateDepositIndex) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#get_eth1_data +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/validator.md#get_eth1_data proc getBlockProposalData*(chain: var Eth1Chain, state: ForkedHashedBeaconState, finalizedEth1Data: Eth1Data, diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index 0f0a9097d..969e8b77d 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -848,7 +848,7 @@ proc validateSyncCommitteeMessage*( return ok((positionsInSubcommittee, sig)) -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/altair/p2p-interface.md#sync_committee_contribution_and_proof +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/altair/p2p-interface.md#sync_committee_contribution_and_proof proc validateContribution*( dag: ChainDAGRef, batchCrypto: ref BatchCrypto, diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index eb1f50722..e0bf22851 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -314,7 +314,7 @@ func get_initial_beacon_block*(state: altair.HashedBeaconState): altair.TrustedSignedBeaconBlock( message: message, root: hash_tree_root(message)) -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#testing +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#testing func get_initial_beacon_block*(state: merge.HashedBeaconState): merge.TrustedSignedBeaconBlock = # The genesis block is implicitly trusted diff --git a/beacon_chain/spec/datatypes/altair.nim b/beacon_chain/spec/datatypes/altair.nim index 076e3fbda..402d17c8f 100644 --- a/beacon_chain/spec/datatypes/altair.nim +++ b/beacon_chain/spec/datatypes/altair.nim @@ -52,7 +52,7 @@ const TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE* = 16 SYNC_COMMITTEE_SUBNET_COUNT* = 4 - # https://github.com/ethereum/consensus-specs/blob/v1.1.3/setup.py#L478-L479 + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/setup.py#L478-L479 FINALIZED_ROOT_INDEX* = 105.GeneralizedIndex NEXT_SYNC_COMMITTEE_INDEX* = 55.GeneralizedIndex diff --git a/beacon_chain/spec/datatypes/merge.nim b/beacon_chain/spec/datatypes/merge.nim index 34c95736b..29ef9e8c0 100644 --- a/beacon_chain/spec/datatypes/merge.nim +++ b/beacon_chain/spec/datatypes/merge.nim @@ -89,7 +89,7 @@ type parent_hash*: Eth2Digest total_difficulty*: Eth2Digest # uint256 - # https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/beacon-chain.md#beaconstate + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#beaconstate BeaconState* = object # Versioning genesis_time*: uint64 @@ -218,7 +218,7 @@ type state_root*: Eth2Digest ##\ body*: TrustedBeaconBlockBody - # https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#beaconblockbody + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#beaconblockbody BeaconBlockBody* = object randao_reveal*: ValidatorSig eth1_data*: Eth1Data ##\ diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index 66f568d78..edfd72444 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -66,7 +66,7 @@ template generalized_index_parent*( index: GeneralizedIndex): GeneralizedIndex = index shr 1 -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/ssz/merkle-proofs.md#merkle-multiproofs +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs iterator get_branch_indices*( tree_index: GeneralizedIndex): GeneralizedIndex = ## Get the generalized indices of the sister chunks along the path @@ -76,7 +76,7 @@ iterator get_branch_indices*( yield generalized_index_sibling(index) index = generalized_index_parent(index) -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/ssz/merkle-proofs.md#merkle-multiproofs +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs iterator get_path_indices*( tree_index: GeneralizedIndex): GeneralizedIndex = ## Get the generalized indices of the chunks along the path @@ -107,7 +107,7 @@ func get_helper_indices*( res.sort(SortOrder.Descending) res -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/ssz/merkle-proofs.md#merkle-multiproofs +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/ssz/merkle-proofs.md#merkle-multiproofs func check_multiproof_acceptable*( indices: openArray[GeneralizedIndex]): Result[void, string] = # Check that proof verification won't allocate excessive amounts of memory. @@ -369,7 +369,7 @@ func is_active_validator*(validator: Validator, epoch: Epoch): bool = ## Check if ``validator`` is active validator.activation_epoch <= epoch and epoch < validator.exit_epoch -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_active_validator_indices +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#get_active_validator_indices iterator get_active_validator_indices*(state: ForkyBeaconState, epoch: Epoch): ValidatorIndex = for idx in 0..= GENESIS_SLOT, $state.slot compute_epoch_at_slot(state.slot) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_current_epoch +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#get_current_epoch func get_current_epoch*(state: ForkedHashedBeaconState): Epoch = ## Return the current epoch. withState(state): state.data.slot.epoch @@ -510,20 +510,20 @@ func get_subtree_index*(idx: GeneralizedIndex): uint64 = func is_merge_transition_complete*(state: merge.BeaconState): bool = state.latest_execution_payload_header != default(ExecutionPayloadHeader) -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_merge_block -func is_merge_block( +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#is_merge_transition_block +func is_merge_transition_block( state: merge.BeaconState, body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody | merge.SigVerifiedBeaconBlockBody): bool = not is_merge_transition_complete(state) and body.execution_payload != default(merge.ExecutionPayload) -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#is_execution_enabled +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#is_execution_enabled func is_execution_enabled*( state: merge.BeaconState, body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody | merge.SigVerifiedBeaconBlockBody): bool = - is_merge_block(state, body) or is_merge_transition_complete(state) + is_merge_transition_block(state, body) or is_merge_transition_complete(state) # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/beacon-chain.md#compute_timestamp_at_slot func compute_timestamp_at_slot*(state: ForkyBeaconState, slot: Slot): uint64 = diff --git a/beacon_chain/spec/presets/mainnet/merge_preset.nim b/beacon_chain/spec/presets/mainnet/merge_preset.nim index 95a90ea95..e6a61e903 100644 --- a/beacon_chain/spec/presets/mainnet/merge_preset.nim +++ b/beacon_chain/spec/presets/mainnet/merge_preset.nim @@ -1,5 +1,5 @@ # Mainnet preset - Merge -# https://github.com/ethereum/consensus-specs/blob/v1.1.4/presets/mainnet/merge.yaml +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/presets/mainnet/merge.yaml const # Updated penalty values # --------------------------------------------------------------- diff --git a/beacon_chain/spec/presets/mainnet/phase0_preset.nim b/beacon_chain/spec/presets/mainnet/phase0_preset.nim index 629298f6e..59e79e203 100644 --- a/beacon_chain/spec/presets/mainnet/phase0_preset.nim +++ b/beacon_chain/spec/presets/mainnet/phase0_preset.nim @@ -1,5 +1,5 @@ # Mainnet preset - Phase0 -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/presets/mainnet/phase0.yaml +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/presets/mainnet/phase0.yaml const # diff --git a/beacon_chain/spec/presets/minimal/phase0_preset.nim b/beacon_chain/spec/presets/minimal/phase0_preset.nim index b5d0df9d1..83d51690c 100644 --- a/beacon_chain/spec/presets/minimal/phase0_preset.nim +++ b/beacon_chain/spec/presets/minimal/phase0_preset.nim @@ -1,5 +1,5 @@ # Minimal preset - Phase0 -# https://github.com/ethereum/consensus-specs/blob/v1.1.5/presets/minimal/phase0.yaml +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/presets/minimal/phase0.yaml const # diff --git a/beacon_chain/spec/state_transition_block.nim b/beacon_chain/spec/state_transition_block.nim index b2dac9e5f..6324de39d 100644 --- a/beacon_chain/spec/state_transition_block.nim +++ b/beacon_chain/spec/state_transition_block.nim @@ -322,7 +322,7 @@ proc process_deposit*(cfg: RuntimeConfig, ok() -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#voluntary-exits +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#voluntary-exits proc check_voluntary_exit*( cfg: RuntimeConfig, state: ForkyBeaconState, diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index 4c8132f4c..a5130cdf9 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -990,7 +990,6 @@ proc process_epoch*( init(info, state) info.process_attestations(state, cache) - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#justification-and-finalization process_justification_and_finalization(state, info.balances, flags) # state.slot hasn't been incremented yet. @@ -1003,31 +1002,14 @@ proc process_epoch*( # the finalization rules triggered. doAssert state.finalized_checkpoint.epoch + 3 >= currentEpoch - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#rewards-and-penalties-1 process_rewards_and_penalties(state, info) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#registry-updates process_registry_updates(cfg, state, cache) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#slashings process_slashings(state, info.balances.current_epoch) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#eth1-data-votes-updates process_eth1_data_reset(state) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#effective-balances-updates process_effective_balance_updates(state) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#slashings-balances-updates process_slashings_reset(state) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#randao-mixes-updates process_randao_mixes_reset(state) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#historical-roots-updates process_historical_roots_update(state) - - # https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#participation-records-rotation process_participation_record_updates(state) func init*( diff --git a/beacon_chain/validators/action_tracker.nim b/beacon_chain/validators/action_tracker.nim index e49fd415a..abec8b03d 100644 --- a/beacon_chain/validators/action_tracker.nim +++ b/beacon_chain/validators/action_tracker.nim @@ -64,7 +64,7 @@ type func hash*(x: AggregatorDuty): Hash = hashAllFields(x) -# https://github.com/ethereum/consensus-specs/blob/v1.1.4/specs/phase0/validator.md#phase-0-attestation-subnet-stability +# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/validator.md#phase-0-attestation-subnet-stability func randomStabilitySubnet*( self: ActionTracker, epoch: Epoch): tuple[subnet_id: SubnetId, expiration: Epoch] = ( diff --git a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim index 3ff9d8557..2efd69f93 100644 --- a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim +++ b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim @@ -80,7 +80,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset(): res genesisState = newClone(initGenesisState(cfg = cfg)) - # https://github.com/ethereum/consensus-specs/blob/v1.1.4/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L22-L78 + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L22-L78 test "process_light_client_update_not_updated": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data @@ -135,7 +135,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset(): store.valid_updates.pop() == update store.snapshot == pre_snapshot - # https://github.com/ethereum/consensus-specs/blob/v1.1.5/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L81-L144 + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L81-L144 test "process_light_client_update_timeout": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data @@ -200,7 +200,7 @@ suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset(): len(store.valid_updates) == 0 store.snapshot.header == update.header - # https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L150-L218 + # https://github.com/ethereum/consensus-specs/blob/v1.1.6/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L150-L218 test "process_light_client_update_finality_updated": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data