From b45de824a4aac9d3950615766649cc298daf34e7 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 28 Jul 2020 14:55:46 +0000 Subject: [PATCH] convert 22 v0.12.1 spec refs to v0.12.2 and remove 1 unnecessary spec ref (#1384) --- beacon_chain/attestation_aggregation.nim | 4 ++-- beacon_chain/beacon_node.nim | 1 - beacon_chain/spec/datatypes.nim | 6 +++--- beacon_chain/spec/keystore.nim | 2 +- beacon_chain/spec/network.nim | 9 ++++----- beacon_chain/spec/presets/v0_12_2/mainnet.nim | 6 +++--- beacon_chain/spec/presets/v0_12_2/minimal.nim | 10 +++++----- beacon_chain/ssz/merkleization.nim | 2 +- beacon_chain/ssz/ssz_serialization.nim | 2 +- .../src/03_nbc_nimbus_beacon_chain.md | 4 ++-- 10 files changed, 22 insertions(+), 24 deletions(-) diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index 4b99f7eb6..5ff69a00a 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -32,7 +32,7 @@ proc aggregate_attestations*( cache: var StateCache): Option[AggregateAndProof] = doAssert state.slot >= trailing_distance - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#configuration + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#configuration doAssert trailing_distance <= ATTESTATION_PROPAGATION_SLOT_RANGE let @@ -65,7 +65,7 @@ proc aggregate_attestations*( for attestation in getAttestationsForBlock(pool, state): # getAttestationsForBlock(...) already aggregates if attestation.data == attestation_data: - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregateandproof return some(AggregateAndProof( aggregator_index: index.uint64, aggregate: attestation, diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index a22f95715..e80ab16bd 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -731,7 +731,6 @@ proc installAttestationHandlers(node: BeaconNode) = proc attestationValidator(attestation: Attestation, committeeIndex: uint64): bool = - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#attestation-subnets let (afterGenesis, slot) = node.beaconClock.now().toSlot() if not afterGenesis: return false diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index 8d0ed60dd..1b4b68115 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -391,7 +391,7 @@ type deposit_count*: uint64 block_hash*: Eth2Digest - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#eth1block + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#eth1block Eth1Block* = object timestamp*: uint64 deposit_root*: Eth2Digest @@ -421,13 +421,13 @@ type message*: BeaconBlockHeader signature*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregateandproof AggregateAndProof* = object aggregator_index*: uint64 aggregate*: Attestation selection_proof*: ValidatorSig - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#signedaggregateandproof + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#signedaggregateandproof SignedAggregateAndProof* = object message*: AggregateAndProof signature*: ValidatorSig diff --git a/beacon_chain/spec/keystore.nim b/beacon_chain/spec/keystore.nim index 6100bc903..e42c60c3b 100644 --- a/beacon_chain/spec/keystore.nim +++ b/beacon_chain/spec/keystore.nim @@ -456,7 +456,7 @@ proc createWalletContent*(T: type[KdfParams], T, rng, mnemonic, name, salt, iv, password, nextAccount, pretty) (wallet.uuid, WalletContent Json.encode(wallet, pretty = pretty)) -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/deposit-contract.md#withdrawal-credentials +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/deposit-contract.md#withdrawal-credentials proc makeWithdrawalCredentials*(k: ValidatorPubKey): Eth2Digest = var bytes = eth2digest(k.toRaw()) bytes.data[0] = BLS_WITHDRAWAL_PREFIX.uint8 diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 10da4ed2f..a65e2d6f0 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -12,14 +12,14 @@ import ./datatypes, ./helpers, ./validator const - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#topics-and-messages + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#topics-and-messages topicBeaconBlocksSuffix* = "beacon_block/ssz" topicVoluntaryExitsSuffix* = "voluntary_exit/ssz" topicProposerSlashingsSuffix* = "proposer_slashing/ssz" topicAttesterSlashingsSuffix* = "attester_slashing/ssz" topicAggregateAndProofsSuffix* = "beacon_aggregate_and_proof/ssz" - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#misc + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#misc ATTESTATION_SUBNET_COUNT* = 64 defaultEth2TcpPort* = 9000 @@ -57,8 +57,7 @@ func getAggregateAndProofsTopic*(forkDigest: ForkDigest): string = except ValueError as e: raiseAssert e.msg -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#broadcast-attestation -# https://github.com/ethereum/eth2.0-specs/pull/1876 +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#broadcast-attestation func compute_subnet_for_attestation*( committees_per_slot: uint64, slot: Slot, committee_index: CommitteeIndex): uint64 = @@ -73,7 +72,7 @@ func compute_subnet_for_attestation*( (committees_since_epoch_start + committee_index.uint64) mod ATTESTATION_SUBNET_COUNT -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#broadcast-attestation +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#broadcast-attestation func getAttestationTopic*(forkDigest: ForkDigest, subnetIndex: uint64): string = # This is for subscribing or broadcasting manually to a known index. diff --git a/beacon_chain/spec/presets/v0_12_2/mainnet.nim b/beacon_chain/spec/presets/v0_12_2/mainnet.nim index ce03a5b52..f8ce21495 100644 --- a/beacon_chain/spec/presets/v0_12_2/mainnet.nim +++ b/beacon_chain/spec/presets/v0_12_2/mainnet.nim @@ -61,7 +61,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L70 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L73 BLS_WITHDRAWAL_PREFIX*: byte = 0 # Time parameters @@ -113,7 +113,7 @@ const # State vector lengths # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L105 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L108 EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 65536 ##\ ## epochs (~0.8 years) @@ -128,7 +128,7 @@ const # Reward and penalty quotients # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L117 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L120 BASE_REWARD_FACTOR*: uint64 = 2'u64^6 WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9 PROPOSER_REWARD_QUOTIENT*: uint64 = 2'u64^3 diff --git a/beacon_chain/spec/presets/v0_12_2/minimal.nim b/beacon_chain/spec/presets/v0_12_2/minimal.nim index 2fe70d166..da966a10d 100644 --- a/beacon_chain/spec/presets/v0_12_2/minimal.nim +++ b/beacon_chain/spec/presets/v0_12_2/minimal.nim @@ -47,7 +47,7 @@ const # Initial values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L70 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L73 BLS_WITHDRAWAL_PREFIX*: byte = 0 @@ -87,7 +87,7 @@ const # State vector lengths # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L105 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L108 # Changed EPOCHS_PER_HISTORICAL_VECTOR*: uint64 = 64 @@ -99,7 +99,7 @@ const # Reward and penalty quotients # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L117 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L120 BASE_REWARD_FACTOR*: uint64 = 2'u64^6 WHISTLEBLOWER_REWARD_QUOTIENT*: uint64 = 2'u64^9 @@ -109,7 +109,7 @@ const # Max operations per block # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L131 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L134 MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4 MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1 @@ -127,7 +127,7 @@ const # Fork choice # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L32 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L32 # Changed SAFE_SLOTS_TO_UPDATE_JUSTIFIED*: uint64 = 2 diff --git a/beacon_chain/ssz/merkleization.nim b/beacon_chain/ssz/merkleization.nim index 10cef46bc..d0d6b6f8d 100644 --- a/beacon_chain/ssz/merkleization.nim +++ b/beacon_chain/ssz/merkleization.nim @@ -7,7 +7,7 @@ # This module contains the parts necessary to create a merkle hash from the core # SSZ types outlined in the spec: -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/ssz/simple-serialize.md#merkleization +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#merkleization {.push raises: [Defect].} diff --git a/beacon_chain/ssz/ssz_serialization.nim b/beacon_chain/ssz/ssz_serialization.nim index d0af092b2..4991b83fa 100644 --- a/beacon_chain/ssz/ssz_serialization.nim +++ b/beacon_chain/ssz/ssz_serialization.nim @@ -4,7 +4,7 @@ {.pragma: raisesssz, raises: [Defect, MalformedSszError, SszSizeMismatchError].} ## SSZ serialiazation for core SSZ types, as specified in: -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/ssz/simple-serialize.md#serialization +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/ssz/simple-serialize.md#serialization import typetraits, options, diff --git a/docs/the_auditors_handbook/src/03_nbc_nimbus_beacon_chain.md b/docs/the_auditors_handbook/src/03_nbc_nimbus_beacon_chain.md index dea5117c5..3a7e41bd1 100644 --- a/docs/the_auditors_handbook/src/03_nbc_nimbus_beacon_chain.md +++ b/docs/the_auditors_handbook/src/03_nbc_nimbus_beacon_chain.md @@ -51,8 +51,8 @@ TODO ## Specifications -We target v0.12.1 phase0 of [https://github.com/ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs) -- [https://github.com/ethereum/eth2.0-specs/tree/v0.12.1/specs/phase0](https://github.com/ethereum/eth2.0-specs/tree/v0.12.1/specs/phase0) +We target v0.12.2 phase0 of [https://github.com/ethereum/eth2.0-specs](https://github.com/ethereum/eth2.0-specs) +- [https://github.com/ethereum/eth2.0-specs/tree/v0.12.2/specs/phase0](https://github.com/ethereum/eth2.0-specs/tree/v0.12.2/specs/phase0) The p2p-interface specs in particular describe the subset of libp2p spec that are used to implement Ethereum 2