From 968a5b3bec210b58547bd44c12ba46b7fa3ead20 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 26 Oct 2021 18:42:48 +0000 Subject: [PATCH] some spec refs to v1.1.3 (#3032) --- beacon_chain/spec/beaconstate.nim | 6 +++--- beacon_chain/spec/datatypes/base.nim | 2 +- beacon_chain/spec/datatypes/merge.nim | 2 +- beacon_chain/spec/helpers.nim | 4 ++-- beacon_chain/spec/light_client_sync.nim | 2 +- beacon_chain/spec/signatures.nim | 2 +- beacon_chain/spec/state_transition_block.nim | 8 ++++---- beacon_chain/spec/state_transition_epoch.nim | 2 +- beacon_chain/spec/validator.nim | 4 ++-- docs/attestation_flow.md | 2 +- docs/block_flow.md | 2 +- .../consensus_spec/altair/test_fixture_sync_protocol.nim | 2 +- tests/mocking/mock_blocks.nim | 2 +- tests/testblockutil.nim | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 8dc7457d1..2506822b5 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -44,8 +44,8 @@ func decrease_balance*( if delta != 0: # avoid dirtying the balance cache if not needed decrease_balance(state.balances[index], delta) -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#deposits -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/beacon-chain.md#modified-process_deposit +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#deposits +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#modified-process_deposit func get_validator_from_deposit*(deposit: DepositData): Validator = let @@ -710,7 +710,7 @@ proc get_next_sync_committee*(state: altair.BeaconState | merge.BeaconState): res.aggregate_pubkey = finish(attestersAgg).toPubKey() res -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/fork.md#upgrading-the-state +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/fork.md#upgrading-the-state func translate_participation( state: var altair.BeaconState, pending_attestations: openArray[phase0.PendingAttestation]) = diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index eb978a41f..8691051c4 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -344,7 +344,7 @@ type message*: VoluntaryExit signature*: TrustedSig - # https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#beaconblockheader + # https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#beaconblockheader BeaconBlockHeader* = object slot*: Slot proposer_index*: uint64 diff --git a/beacon_chain/spec/datatypes/merge.nim b/beacon_chain/spec/datatypes/merge.nim index 74bf0dd47..419a1b6fc 100644 --- a/beacon_chain/spec/datatypes/merge.nim +++ b/beacon_chain/spec/datatypes/merge.nim @@ -94,7 +94,7 @@ type total_difficulty*: Eth2Digest # uint256 difficulty*: Eth2Digest # uint256 - # https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#beaconstate + # https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/beacon-chain.md#beaconstate BeaconState* = object # Versioning genesis_time*: uint64 diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index d4633f9f0..6ebb625fe 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -24,7 +24,7 @@ import export phase0, altair, eth2_merkleization, ssz_codec -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#integer_squareroot +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/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 @@ -299,7 +299,7 @@ func is_valid_merkle_branch*(leaf: Eth2Digest, branch: openArray[Eth2Digest], value = eth2digest(buf) value == root -# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/tests/core/pyspec/eth2spec/test/helpers/merkle.py#L4-L21 +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/helpers/merkle.py#L4-L21 func build_proof_impl(anchor: object, leaf_index: uint64, proof: var openArray[Eth2Digest]) = let diff --git a/beacon_chain/spec/light_client_sync.nim b/beacon_chain/spec/light_client_sync.nim index 1e11d2ad0..19f1c5acf 100644 --- a/beacon_chain/spec/light_client_sync.nim +++ b/beacon_chain/spec/light_client_sync.nim @@ -74,7 +74,7 @@ proc apply_light_client_update(snapshot: var LightClientSnapshot, update: LightC snapshot.next_sync_committee = update.next_sync_committee snapshot.header = update.header -# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.3/specs/altair/sync-protocol.md#process_light_client_update +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/sync-protocol.md#process_light_client_update proc process_light_client_update*(store: var LightClientStore, update: LightClientUpdate, current_slot: Slot, diff --git a/beacon_chain/spec/signatures.nim b/beacon_chain/spec/signatures.nim index ab97f6197..1f3632b8b 100644 --- a/beacon_chain/spec/signatures.nim +++ b/beacon_chain/spec/signatures.nim @@ -82,7 +82,7 @@ func compute_block_root*( fork, DOMAIN_BEACON_PROPOSER, epoch, genesis_validators_root) compute_signing_root(root, domain) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#signature +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#signature func get_block_signature*( fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot, root: Eth2Digest, privkey: ValidatorPrivKey): CookedSig = diff --git a/beacon_chain/spec/state_transition_block.nim b/beacon_chain/spec/state_transition_block.nim index 5fc93cea9..d7f37aed5 100644 --- a/beacon_chain/spec/state_transition_block.nim +++ b/beacon_chain/spec/state_transition_block.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. # State transition - block processing, as described in -# https://github.com/ethereum/consensus-specs/blob/master/specs/core/0_beacon-chain.md#beacon-chain-state-transition-function +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#block-processing # # The entry point is `process_block` which is at the bottom of this file. # @@ -191,7 +191,7 @@ func is_slashable_attestation_data( (data_1.source.epoch < data_2.source.epoch and data_2.target.epoch < data_1.target.epoch) -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#attester-slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#attester-slashings proc check_attester_slashing*( state: var SomeBeaconState, attester_slashing: SomeAttesterSlashing, @@ -377,7 +377,7 @@ proc process_voluntary_exit*( cache) ok() -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#operations +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#operations proc process_operations(cfg: RuntimeConfig, state: var SomeBeaconState, body: SomeSomeBeaconBlockBody, @@ -501,7 +501,7 @@ func is_valid_gas_limit( true -# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#process_execution_payload +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/merge/beacon-chain.md#process_execution_payload proc process_execution_payload*( state: var merge.BeaconState, payload: ExecutionPayload, execute_payload: ExecutePayload): Result[void, cstring] {.nbench.} = diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index c5e550f92..19080e8d7 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -795,7 +795,7 @@ func process_registry_updates*( compute_activation_exit_epoch(get_current_epoch(state)) # https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#slashings -# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/altair/beacon-chain.md#slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/altair/beacon-chain.md#slashings func process_slashings*(state: var SomeBeaconState, total_balance: Gwei) {.nbench.} = let epoch = get_current_epoch(state) diff --git a/beacon_chain/spec/validator.nim b/beacon_chain/spec/validator.nim index 7bcc0099d..7a2cde9c0 100644 --- a/beacon_chain/spec/validator.nim +++ b/beacon_chain/spec/validator.nim @@ -239,7 +239,7 @@ func compute_committee_len*( (slice.b - slice.a + 1).uint64 -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_beacon_committee +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#get_beacon_committee iterator get_beacon_committee*( state: SomeBeaconState, slot: Slot, index: CommitteeIndex, cache: var StateCache): ValidatorIndex = @@ -346,7 +346,7 @@ func compute_proposer_index(state: SomeBeaconState, return some(candidate_index) i += 1 -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#get_beacon_proposer_index +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#get_beacon_proposer_index func get_beacon_proposer_index*( state: SomeBeaconState, cache: var StateCache, slot: Slot): Option[ValidatorIndex] = diff --git a/docs/attestation_flow.md b/docs/attestation_flow.md index 9bbe66e86..c5d032262 100644 --- a/docs/attestation_flow.md +++ b/docs/attestation_flow.md @@ -7,7 +7,7 @@ This is a WIP document to explain the attestation flows. It is important to distinguish attestation `validation` from attestation `verification`. - Attestation `validation` is defined in the P2P specs. Validated attestations can be forwarded on GossipSub. - Aggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof - - Unaggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id + - Unaggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id - Attestation `verification` is defined in the consensus specs. Verified attestations can affect fork choice and may be included in a block. - https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#attestations diff --git a/docs/block_flow.md b/docs/block_flow.md index d9653e617..5bdc31121 100644 --- a/docs/block_flow.md +++ b/docs/block_flow.md @@ -9,7 +9,7 @@ Important distinction: https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/p2p-interface.md#beacon_block. A validated block can be forwarded on gossipsub. - and we distinguish `verification` which is defined in consensus specs: - https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#block-processing + https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/beacon-chain.md#block-processing A block needs to be verified to enter fork choice, the DAG and the BeaconChainDB In particular in terms of costly checks validating a block only requires checking: diff --git a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim index ecf0be958..7ab6f23bc 100644 --- a/tests/consensus_spec/altair/test_fixture_sync_protocol.nim +++ b/tests/consensus_spec/altair/test_fixture_sync_protocol.nim @@ -207,7 +207,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.0/tests/core/pyspec/eth2spec/test/altair/unittests/test_sync_protocol.py#L150-L221 + # https://github.com/ethereum/consensus-specs/blob/v1.1.3/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 diff --git a/tests/mocking/mock_blocks.nim b/tests/mocking/mock_blocks.nim index 0156a524e..91baa79b4 100644 --- a/tests/mocking/mock_blocks.nim +++ b/tests/mocking/mock_blocks.nim @@ -32,7 +32,7 @@ func apply_randao_reveal( blck.message.slot.compute_epoch_at_slot, privkey).toValidatorSig() -# https://github.com/ethereum/consensus-specs/blob/v1.1.2/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54 +# https://github.com/ethereum/consensus-specs/blob/v1.1.3/tests/core/pyspec/eth2spec/test/helpers/block.py#L38-L54 func sign_block( state: SomeBeaconState, blck: var (phase0.SignedBeaconBlock | altair.SignedBeaconBlock | diff --git a/tests/testblockutil.nim b/tests/testblockutil.nim index 71d123beb..2f2285266 100644 --- a/tests/testblockutil.nim +++ b/tests/testblockutil.nim @@ -169,7 +169,7 @@ func makeAttestationData*( "Computed epoch was " & $slot.compute_epoch_at_slot & " while the state current_epoch was " & $current_epoch - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#attestation-data + # https://github.com/ethereum/consensus-specs/blob/v1.1.3/specs/phase0/validator.md#attestation-data AttestationData( slot: slot, index: committee_index.uint64,