From 6cc8757930c82d4c807b6b2b82d91c7f6a177467 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 14 Oct 2021 06:30:21 +0000 Subject: [PATCH] update 18 spec URLs to v1.1.2; switch from eth2.0-specs to consensus-specs (#2990) --- beacon_chain/beacon_chain_db_immutable.nim | 4 ++-- .../consensus_object_pools/attestation_pool.nim | 4 ++-- beacon_chain/consensus_object_pools/spec_cache.nim | 10 +++++----- beacon_chain/networking/eth2_network.nim | 4 ++-- beacon_chain/spec/beaconstate.nim | 4 ++-- beacon_chain/spec/crypto.nim | 6 +++--- beacon_chain/spec/datatypes/altair.nim | 4 ++-- beacon_chain/spec/datatypes/base.nim | 2 +- beacon_chain/spec/forks.nim | 6 +++--- beacon_chain/spec/helpers.nim | 4 ++-- beacon_chain/spec/network.nim | 2 +- beacon_chain/spec/presets.nim | 2 +- beacon_chain/spec/validator.nim | 2 +- docs/attestation_flow.md | 2 +- docs/the_nimbus_book/src/intro.md | 2 +- docs/the_nimbus_book/src/prater.md | 2 +- tests/mocking/mock_deposits.nim | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) diff --git a/beacon_chain/beacon_chain_db_immutable.nim b/beacon_chain/beacon_chain_db_immutable.nim index 6db99bfcd..d6d154c85 100644 --- a/beacon_chain/beacon_chain_db_immutable.nim +++ b/beacon_chain/beacon_chain_db_immutable.nim @@ -15,7 +15,7 @@ import ./spec/[eth2_ssz_serialization, eth2_merkleization] type - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#beaconstate + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#beaconstate # Memory-representation-equivalent to a phase0 BeaconState for in-place SSZ reading and writing BeaconStateNoImmutableValidators* = object # Versioning @@ -131,7 +131,7 @@ type current_sync_committee*: SyncCommittee # [New in Altair] next_sync_committee*: SyncCommittee # [New in Altair] - # 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.2/specs/merge/beacon-chain.md#beaconstate # Memory-representation-equivalent to a Merge BeaconState for in-place SSZ # reading and writing MergeBeaconStateNoImmutableValidators* = object diff --git a/beacon_chain/consensus_object_pools/attestation_pool.nim b/beacon_chain/consensus_object_pools/attestation_pool.nim index 5c1ca0cec..b8e0b0b84 100644 --- a/beacon_chain/consensus_object_pools/attestation_pool.nim +++ b/beacon_chain/consensus_object_pools/attestation_pool.nim @@ -457,7 +457,7 @@ proc getAttestationsForBlock*(pool: var AttestationPool, cache: var StateCache): seq[Attestation] = ## Retrieve attestations that may be added to a new block at the slot of the ## given state - ## https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#attestations + ## https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#attestations let newBlockSlot = state.data.slot.uint64 if newBlockSlot < MIN_ATTESTATION_INCLUSION_DELAY: @@ -635,7 +635,7 @@ proc getAggregatedAttestation*(pool: var AttestationPool, index: CommitteeIndex): Option[Attestation] = ## Select the attestation that has the most votes going for it in the given ## slot/index - ## https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/validator.md#construct-aggregate + ## https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#construct-aggregate let candidateIdx = pool.candidateIdx(slot) if candidateIdx.isNone: diff --git a/beacon_chain/consensus_object_pools/spec_cache.nim b/beacon_chain/consensus_object_pools/spec_cache.nim index b7b9b6343..859da7e49 100644 --- a/beacon_chain/consensus_object_pools/spec_cache.nim +++ b/beacon_chain/consensus_object_pools/spec_cache.nim @@ -33,7 +33,7 @@ iterator get_committee_indices*(epochRef: EpochRef): CommitteeIndex = # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_beacon_committee iterator get_beacon_committee*( epochRef: EpochRef, slot: Slot, index: CommitteeIndex): ValidatorIndex = - # Return the beacon committee at ``slot`` for ``index``. + ## Return the beacon committee at ``slot`` for ``index``. let committees_per_slot = get_committee_count_per_slot(epochRef) for idx in compute_committee( @@ -46,7 +46,7 @@ iterator get_beacon_committee*( # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#get_beacon_committee func get_beacon_committee*( epochRef: EpochRef, slot: Slot, index: CommitteeIndex): seq[ValidatorIndex] = - # Return the beacon committee at ``slot`` for ``index``. + ## Return the beacon committee at ``slot`` for ``index``. let committees_per_slot = get_committee_count_per_slot(epochRef) compute_committee( @@ -56,10 +56,10 @@ func get_beacon_committee*( committees_per_slot * SLOTS_PER_EPOCH ) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_beacon_committee +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#get_beacon_committee func get_beacon_committee_len*( epochRef: EpochRef, slot: Slot, index: CommitteeIndex): uint64 = - # Return the number of members in the beacon committee at ``slot`` for ``index``. + ## Return the number of members in the beacon committee at ``slot`` for ``index``. let committees_per_slot = get_committee_count_per_slot(epochRef) @@ -159,7 +159,7 @@ func makeAttestationData*( doAssert current_epoch == epochRef.epoch - # https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/validator.md#attestation-data + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/validator.md#attestation-data AttestationData( slot: slot, index: committee_index.uint64, diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 762b2fee0..27d93bc59 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -2079,12 +2079,12 @@ proc unsubscribeAttestationSubnets*(node: Eth2Node, subnets: BitArray[ATTESTATIO proc updateStabilitySubnetMetadata*( node: Eth2Node, attnets: BitArray[ATTESTATION_SUBNET_COUNT]) = - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#metadata + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/p2p-interface.md#metadata node.metadata.seq_number += 1 node.metadata.attnets = attnets # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/validator.md#phase-0-attestation-subnet-stability - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#attestation-subnet-bitfield + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/p2p-interface.md#attestation-subnet-bitfield let res = node.discovery.updateRecord({ enrAttestationSubnetsField: SSZ.encode(node.metadata.attnets) }) diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 6ba9e419a..574cd00f0 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -359,7 +359,7 @@ func is_eligible_for_activation*(state: SomeBeaconState, validator: Validator): # Has not yet been activated validator.activation_epoch == FAR_FUTURE_EPOCH -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/phase0/beacon-chain.md#is_valid_indexed_attestation +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#is_valid_indexed_attestation proc is_valid_indexed_attestation*( state: SomeBeaconState, indexed_attestation: SomeIndexedAttestation, flags: UpdateFlags): Result[void, cstring] = @@ -449,7 +449,7 @@ proc is_valid_indexed_attestation*( # Attestation validation # ------------------------------------------------------------------------------------------ -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#attestations +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#attestations # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id func check_attestation_slot_target*(data: AttestationData): Result[void, cstring] = diff --git a/beacon_chain/spec/crypto.nim b/beacon_chain/spec/crypto.nim index 7994efd71..5026df871 100644 --- a/beacon_chain/spec/crypto.nim +++ b/beacon_chain/spec/crypto.nim @@ -83,7 +83,7 @@ export # API # ---------------------------------------------------------------------- -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures func toPubKey*(privkey: ValidatorPrivKey): CookedPubKey = ## Derive a public key from a private key @@ -191,7 +191,7 @@ func finish*(agg: AggregateSignature): CookedSig {.inline.} = sig.finish(agg) CookedSig(sig) -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures proc blsVerify*( pubkey: CookedPubKey, message: openArray[byte], signature: CookedSig): bool = @@ -204,7 +204,7 @@ proc blsVerify*( ## to enforce correct usage. PublicKey(pubkey).verify(message, blscurve.Signature(signature)) -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#bls-signatures proc blsVerify*( pubkey: ValidatorPubKey, message: openArray[byte], signature: CookedSig): bool = diff --git a/beacon_chain/spec/datatypes/altair.nim b/beacon_chain/spec/datatypes/altair.nim index a59f8f4a4..2b4d309a0 100644 --- a/beacon_chain/spec/datatypes/altair.nim +++ b/beacon_chain/spec/datatypes/altair.nim @@ -102,7 +102,7 @@ type signature*: ValidatorSig ##\ ## Signature by the validator over the block root of `slot` - # https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/validator.md#synccommitteecontribution + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/validator.md#synccommitteecontribution SyncCommitteeAggregationBits* = BitArray[SYNC_SUBCOMMITTEE_SIZE] @@ -371,7 +371,7 @@ type # [New in Altair] sync_aggregate*: SyncAggregate - # https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/p2p-interface.md#metadata + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/p2p-interface.md#metadata MetaData* = object seq_number*: uint64 attnets*: BitArray[ATTESTATION_SUBNET_COUNT] diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index 7539147bb..e8b3c3858 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -307,7 +307,7 @@ type withdrawable_epoch*: Epoch ##\ ## When validator can withdraw or transfer funds - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#pendingattestation + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#pendingattestation PendingAttestation* = object aggregation_bits*: CommitteeValidatorsBits data*: AttestationData diff --git a/beacon_chain/spec/forks.nim b/beacon_chain/spec/forks.nim index c0b6078a9..e66ae477d 100644 --- a/beacon_chain/spec/forks.nim +++ b/beacon_chain/spec/forks.nim @@ -268,7 +268,7 @@ func get_shuffled_active_validator_indices*( withState(state): cache.get_shuffled_active_validator_indices(state.data, epoch) -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_block_root_at_slot +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_block_root_at_slot func get_block_root_at_slot*(state: ForkedHashedBeaconState, slot: Slot): Eth2Digest = ## Return the block root at a recent ``slot``. @@ -320,12 +320,12 @@ func stateForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): BeaconStateFork = elif epoch >= cfg.ALTAIR_FORK_EPOCH: forkAltair else: forkPhase0 -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_current_epoch +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_current_epoch func get_current_epoch*(x: ForkedHashedBeaconState): Epoch = ## Return the current epoch. withState(x): state.data.slot.epoch -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_previous_epoch +# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#get_previous_epoch func get_previous_epoch*(stateData: ForkedHashedBeaconState): Epoch = ## Return the previous epoch (unless the current epoch is ``GENESIS_EPOCH``). let current_epoch = get_current_epoch(stateData) diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index b4c663282..980a145ac 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -287,7 +287,7 @@ func has_flag*(flags: ParticipationFlags, flag_index: int): bool = let flag = ParticipationFlags(1'u8 shl flag_index) (flags and flag) == flag -# https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/altair/sync-protocol.md#get_subtree_index +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/altair/sync-protocol.md#get_subtree_index func get_subtree_index*(idx: GeneralizedIndex): uint64 = doAssert idx > 0 uint64(idx mod (type(idx)(1) shl log2trunc(idx))) @@ -296,7 +296,7 @@ func get_subtree_index*(idx: GeneralizedIndex): uint64 = func is_merge_complete*(state: merge.BeaconState): bool = state.latest_execution_payload_header != default(ExecutionPayloadHeader) -# https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#is_merge_block +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/merge/beacon-chain.md#is_merge_block func is_merge_block( state: merge.BeaconState, body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody | diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index c6eb9f441..146ec053b 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -14,7 +14,7 @@ import export base const - # https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/p2p-interface.md#topics-and-messages + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/p2p-interface.md#topics-and-messages topicBeaconBlocksSuffix* = "beacon_block/ssz" topicVoluntaryExitsSuffix* = "voluntary_exit/ssz" topicProposerSlashingsSuffix* = "proposer_slashing/ssz" diff --git a/beacon_chain/spec/presets.nim b/beacon_chain/spec/presets.nim index ee9c56344..ee6424d62 100644 --- a/beacon_chain/spec/presets.nim +++ b/beacon_chain/spec/presets.nim @@ -157,7 +157,7 @@ when const_preset == "mainnet": # TODO Move this to RuntimeConfig const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 12 - # https://github.com/ethereum/consensus-specs/blob/v1.1.1/configs/mainnet.yaml + # https://github.com/ethereum/consensus-specs/blob/v1.1.2/configs/mainnet.yaml # TODO Read these from yaml file const defaultRuntimeConfig* = RuntimeConfig( PRESET_BASE: "mainnet", diff --git a/beacon_chain/spec/validator.nim b/beacon_chain/spec/validator.nim index fa58fc7c3..a6ecb2d55 100644 --- a/beacon_chain/spec/validator.nim +++ b/beacon_chain/spec/validator.nim @@ -195,7 +195,7 @@ func get_previous_epoch*(state: SomeBeaconState): Epoch = # Return the previous epoch (unless the current epoch is ``GENESIS_EPOCH``). get_previous_epoch(get_current_epoch(state)) -# https://github.com/ethereum/consensus-specs/blob/v1.0.1/specs/phase0/beacon-chain.md#compute_committee +# https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#compute_committee func compute_committee_slice*( active_validators, index, count: uint64): Slice[int] = doAssert active_validators <= ValidatorIndex.high.uint64 diff --git a/docs/attestation_flow.md b/docs/attestation_flow.md index 7caf8fd9e..9adfa7b17 100644 --- a/docs/attestation_flow.md +++ b/docs/attestation_flow.md @@ -9,7 +9,7 @@ It is important to distinguish attestation `validation` from attestation `verifi - Aggregated: https://github.com/ethereum/consensus-specs/blob/v1.1.2/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 - 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.0/specs/phase0/beacon-chain.md#attestations + - https://github.com/ethereum/consensus-specs/blob/v1.1.2/specs/phase0/beacon-chain.md#attestations From the specs it seems like gossip attestation `validation` is a superset of consensus attestation `verification`. diff --git a/docs/the_nimbus_book/src/intro.md b/docs/the_nimbus_book/src/intro.md index c37b6afec..c0b8a3f1c 100644 --- a/docs/the_nimbus_book/src/intro.md +++ b/docs/the_nimbus_book/src/intro.md @@ -21,7 +21,7 @@ This book explains the ways in which you can use Nimbus to either monitor the et ### Helpful resources - [nimbus-eth2 repository](https://github.com/status-im/nimbus-eth2) -- [eth2 specification](https://github.com/ethereum/eth2.0-specs/tree/v1.0.1#phase-0) +- [eth2 specification](https://github.com/ethereum/consensus-specs/tree/v1.0.1#phase-0) - [Ben Edgington's annotated spec](https://benjaminion.xyz/eth2-annotated-spec/phase0/beacon-chain/) - [Vitalik's annotated spec](https://github.com/ethereum/annotated-spec/blob/master/phase0/beacon-chain.md) diff --git a/docs/the_nimbus_book/src/prater.md b/docs/the_nimbus_book/src/prater.md index cb6c92176..39a79688f 100644 --- a/docs/the_nimbus_book/src/prater.md +++ b/docs/the_nimbus_book/src/prater.md @@ -22,7 +22,7 @@ Prater's objective is to ensure that the network remains stable under a higher l To elaborate a little, we want to make sure that the network is able to function properly with considerably more validators: increasing the number of validators increases the state size, increases the amount of work done to process that state, and increases the number of messages being gossipped on the network; blocks also become fuller, which explores a new kind of constraint as clients need to optimise better for attestation inclusion. -Both Pyrmont and Prater will co-exist for the foreseeable future (we will be testing the [Altair](https://github.com/ethereum/eth2.0-specs/releases/tag/v1.1.0-alpha.1) fork on Pyrmont, for example). However, in the medium term we expect Prater to replace Pyrmont. +Both Pyrmont and Prater will co-exist for the foreseeable future (we will be testing the [Altair](https://github.com/ethereum/consensus-specs/releases/tag/v1.1.2) fork on Pyrmont, for example). However, in the medium term we expect Prater to replace Pyrmont. If you're already validating with Nimbus, you should start thinking about transitioning from Pyrmont to Prater at some point over the next few weeks. However, there is no immediate rush, so please do so at your own convenience. If you're new to Nimbus then you could try starting directly with Prater. diff --git a/tests/mocking/mock_deposits.nim b/tests/mocking/mock_deposits.nim index f7e169527..bb132628c 100644 --- a/tests/mocking/mock_deposits.nim +++ b/tests/mocking/mock_deposits.nim @@ -129,7 +129,7 @@ proc mockUpdateStateForNewDeposit*[T]( attachMerkleProofs(result_seq) result.proof = result_seq[0].proof - # TODO: this logic from the eth2.0-specs test suite seems strange + # TODO: this logic from the consensus-specs test suite seems strange # but confirmed by running it state.eth1_deposit_index = 0 state.eth1_data.deposit_root =