diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index c5c4673300..6071bff389 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -212,7 +212,7 @@ template validateBeaconBlockBellatrix( of BeaconBlockFork.Altair: false of BeaconBlockFork.Bellatrix: - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#process_execution_payload + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#process_execution_payload # shows how this gets folded into the state each block; checking this # is equivalent, without ever requiring state replay or any similarly # expensive computation. diff --git a/beacon_chain/spec/datatypes/altair.nim b/beacon_chain/spec/datatypes/altair.nim index d3eff3e20e..427beb6ff7 100644 --- a/beacon_chain/spec/datatypes/altair.nim +++ b/beacon_chain/spec/datatypes/altair.nim @@ -64,7 +64,7 @@ const INACTIVITY_SCORE_BIAS* = 4 INACTIVITY_SCORE_RECOVERY_RATE* = 16 - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#misc + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#misc # MIN_SYNC_COMMITTEE_PARTICIPANTS defined in presets UPDATE_TIMEOUT* = SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD @@ -152,7 +152,7 @@ type ### Modified/overloaded - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#lightclientupdate + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#lightclientupdate LightClientUpdate* = object attested_header*: BeaconBlockHeader ##\ ## The beacon block header that is attested to by the sync committee @@ -167,12 +167,12 @@ type finality_branch*: array[log2trunc(FINALIZED_ROOT_INDEX), Eth2Digest] # Sync committee aggregate signature - sync_committee_aggregate*: SyncAggregate + sync_aggregate*: SyncAggregate fork_version*: Version ##\ ## Fork version for the aggregate signature - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#lightclientstore + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#lightclientstore LightClientStore* = object finalized_header*: BeaconBlockHeader ##\ ## Beacon block header that is finalized diff --git a/beacon_chain/spec/light_client_sync.nim b/beacon_chain/spec/light_client_sync.nim index 5fd2baa243..6c914d4337 100644 --- a/beacon_chain/spec/light_client_sync.nim +++ b/beacon_chain/spec/light_client_sync.nim @@ -3,7 +3,7 @@ import datatypes/altair, helpers -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#get_active_header +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#get_active_header func get_active_header(update: LightClientUpdate): BeaconBlockHeader = # The "active header" is the header that the update is trying to convince # us to accept. If a finalized header is present, it's the finalized @@ -13,7 +13,7 @@ func get_active_header(update: LightClientUpdate): BeaconBlockHeader = else: update.attested_header -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#validate_light_client_update +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#validate_light_client_update proc validate_light_client_update*(store: LightClientStore, update: LightClientUpdate, current_slot: Slot, @@ -60,7 +60,7 @@ proc validate_light_client_update*(store: LightClientStore, return false unsafeAddr store.next_sync_committee - template sync_aggregate(): auto = update.sync_committee_aggregate + template sync_aggregate(): auto = update.sync_aggregate let sync_committee_participants_count = countOnes(sync_aggregate.sync_committee_bits) # Verify sync committee has sufficient participants @@ -81,7 +81,7 @@ proc validate_light_client_update*(store: LightClientStore, blsFastAggregateVerify( participant_pubkeys, signing_root.data, sync_aggregate.sync_committee_signature) -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#apply_light_client_update +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#apply_light_client_update func apply_light_client_update( store: var LightClientStore, update: LightClientUpdate) = let @@ -93,14 +93,14 @@ func apply_light_client_update( store.next_sync_committee = update.next_sync_committee store.finalized_header = active_header -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#get_safety_threshold +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#get_safety_threshold func get_safety_threshold(store: LightClientStore): uint64 = max( store.previous_max_active_participants, store.current_max_active_participants ) div 2 -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/sync-protocol.md#process_light_client_update +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/altair/sync-protocol.md#process_light_client_update proc process_light_client_update*(store: var LightClientStore, update: LightClientUpdate, current_slot: Slot, @@ -110,14 +110,14 @@ proc process_light_client_update*(store: var LightClientStore, return false let - sync_committee_bits = update.sync_committee_aggregate.sync_committee_bits + sync_committee_bits = update.sync_aggregate.sync_committee_bits sum_sync_committee_bits = countOnes(sync_committee_bits) # Update the best update in case we have to force-update to it if the # timeout elapses if store.best_valid_update.isNone or sum_sync_committee_bits > countOnes( - store.best_valid_update.get.sync_committee_aggregate.sync_committee_bits): + store.best_valid_update.get.sync_aggregate.sync_committee_bits): store.best_valid_update = some(update) # Track the maximum number of active participants in the committee signatures diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 80a490aca9..19042b90ff 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -27,7 +27,7 @@ const TTFB_TIMEOUT* = 5.seconds RESP_TIMEOUT* = 10.seconds - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/p2p-interface.md#configuration + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/p2p-interface.md#configuration GOSSIP_MAX_SIZE_BELLATRIX* = 10 * 1024 * 1024 # bytes MAX_CHUNK_SIZE_BELLATRIX* = 10 * 1024 * 1024 # bytes diff --git a/beacon_chain/spec/state_transition_block.nim b/beacon_chain/spec/state_transition_block.nim index 44451a8fff..8aef72aef4 100644 --- a/beacon_chain/spec/state_transition_block.nim +++ b/beacon_chain/spec/state_transition_block.nim @@ -496,10 +496,10 @@ proc process_sync_aggregate*( ok() -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#process_execution_payload +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#process_execution_payload proc process_execution_payload*( state: var bellatrix.BeaconState, payload: ExecutionPayload, - execute_payload: ExecutePayload): Result[void, cstring] = + notify_new_payload: ExecutePayload): Result[void, cstring] = ## Verify consistency of the parent hash with respect to the previous ## execution payload header if is_merge_transition_complete(state): @@ -516,7 +516,7 @@ proc process_execution_payload*( return err("process_execution_payload: invalid timestamp") # Verify the execution payload is valid - if not execute_payload(payload): + if not notify_new_payload(payload): return err("process_execution_payload: execution payload invalid") # Cache execution payload header diff --git a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim index 4cd60632e5..35de3f1f2f 100644 --- a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim +++ b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim @@ -92,7 +92,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): res genesisState = newClone(initGenesisState(cfg = cfg)) - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L36-L90 + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L36-L90 test "test_process_light_client_update_not_timeout": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data @@ -116,7 +116,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): sync_committee_bits = full_sync_committee_bits sync_committee_signature = compute_aggregate_sync_committee_signature( forked[], committee) - sync_committee_aggregate = SyncAggregate( + sync_aggregate = SyncAggregate( sync_committee_bits: sync_committee_bits, sync_committee_signature: sync_committee_signature) @@ -137,7 +137,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): next_sync_committee_branch: next_sync_committee_branch, finalized_header: finality_header, finality_branch: finality_branch, - sync_committee_aggregate: sync_committee_aggregate, + sync_aggregate: sync_aggregate, fork_version: state.fork.current_version) check: @@ -149,7 +149,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): store.finalized_header == pre_store_finalized_header store.best_valid_update.get == update - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L93-L154 + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L93-L154 test "process_light_client_update_timeout": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data @@ -182,7 +182,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): sync_committee_bits = full_sync_committee_bits sync_committee_signature = compute_aggregate_sync_committee_signature( forked[], committee, block_root = block_header.hash_tree_root()) - sync_committee_aggregate = SyncAggregate( + sync_aggregate = SyncAggregate( sync_committee_bits: sync_committee_bits, sync_committee_signature: sync_committee_signature) @@ -202,7 +202,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): next_sync_committee_branch: next_sync_committee_branch, finalized_header: finality_header, finality_branch: finality_branch, - sync_committee_aggregate: sync_committee_aggregate, + sync_aggregate: sync_aggregate, fork_version: state.fork.current_version) check: @@ -215,7 +215,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): store.best_valid_update.get == update store.finalized_header == pre_store_finalized_header - # https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L157-L224 + # https://github.com/ethereum/consensus-specs/blob/v1.1.9/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L157-L224 test "process_light_client_update_finality_updated": var forked = assignClone(genesisState[]) template state: untyped {.inject.} = forked[].altairData.data @@ -277,7 +277,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): sync_committee_bits = full_sync_committee_bits sync_committee_signature = compute_aggregate_sync_committee_signature( forked[], committee, block_root = block_header.hash_tree_root()) - sync_committee_aggregate = SyncAggregate( + sync_aggregate = SyncAggregate( sync_committee_bits: sync_committee_bits, sync_committee_signature: sync_committee_signature) @@ -287,7 +287,7 @@ suite "EF - Altair - Unittests - Sync protocol" & preset(): next_sync_committee_branch: next_sync_committee_branch, finalized_header: finalized_block_header, finality_branch: finality_branch, - sync_committee_aggregate: sync_committee_aggregate, + sync_aggregate: sync_aggregate, fork_version: state.fork.current_version) check: diff --git a/tests/mocking/mock_blocks.nim b/tests/mocking/mock_blocks.nim index c023bd3b99..f8fee24656 100644 --- a/tests/mocking/mock_blocks.nim +++ b/tests/mocking/mock_blocks.nim @@ -43,7 +43,7 @@ func sign_block(state: ForkyBeaconState, blck: var ForkySignedBeaconBlock) = blck.root, privkey).toValidatorSig() -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31 +# https://github.com/ethereum/consensus-specs/blob/v1.1.9/tests/core/pyspec/eth2spec/test/helpers/execution_payload.py#L1-L31 func build_empty_execution_payload(state: bellatrix.BeaconState): ExecutionPayload = ## Assuming a pre-state of the same slot, build a valid ExecutionPayload ## without any transactions.