From 99f2d8e06c10646cfbac26c20e0144389ad77e3d Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 30 Jul 2020 09:47:57 +0000 Subject: [PATCH] update 14 v0.12.1 spec refs to v0.12.2 (#1400) --- beacon_chain/attestation_aggregation.nim | 2 +- beacon_chain/block_pools/clearance.nim | 2 +- beacon_chain/eth2_network.nim | 2 +- beacon_chain/mainchain_monitor.nim | 2 +- beacon_chain/spec/beaconstate.nim | 7 +------ beacon_chain/spec/presets/v0_12_2/mainnet.nim | 6 +++--- beacon_chain/spec/presets/v0_12_2/minimal.nim | 4 ++-- beacon_chain/spec/signatures.nim | 2 +- beacon_chain/time.nim | 2 +- beacon_chain/validator_client.nim | 2 +- beacon_chain/validator_duties.nim | 3 +-- beacon_chain/validator_pool.nim | 2 +- 12 files changed, 15 insertions(+), 21 deletions(-) diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index 5ff69a00a..b4aa7419e 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -18,7 +18,7 @@ import logScope: topics = "att_aggr" -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregation-selection +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregation-selection func is_aggregator(state: BeaconState, slot: Slot, index: CommitteeIndex, slot_signature: ValidatorSig, cache: var StateCache): bool = let diff --git a/beacon_chain/block_pools/clearance.nim b/beacon_chain/block_pools/clearance.nim index d34055f40..7551aee00 100644 --- a/beacon_chain/block_pools/clearance.nim +++ b/beacon_chain/block_pools/clearance.nim @@ -292,7 +292,7 @@ proc isValidBeaconBlock*( # for the slot, signed_beacon_block.message.slot. # # While this condition is similar to the proposer slashing condition at - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#proposer-slashing + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#proposer-slashing # it's not identical, and this check does not address slashing: # # (1) The beacon blocks must be conflicting, i.e. different, for the same diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index 06e7da539..755dc56fb 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -194,7 +194,7 @@ const HandshakeTimeout = FaultOrError # Spec constants - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#eth2-network-interaction-domains + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/p2p-interface.md#eth2-network-interaction-domains MAX_CHUNK_SIZE* = 1 * 1024 * 1024 # bytes GOSSIP_MAX_SIZE* = 1 * 1024 * 1024 # bytes TTFB_TIMEOUT* = 5.seconds diff --git a/beacon_chain/mainchain_monitor.nim b/beacon_chain/mainchain_monitor.nim index 4c33ee563..72565c746 100644 --- a/beacon_chain/mainchain_monitor.nim +++ b/beacon_chain/mainchain_monitor.nim @@ -109,7 +109,7 @@ const func compute_time_at_slot(state: BeaconState, slot: Slot): uint64 = state.genesis_time + slot * SECONDS_PER_SLOT -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#get_eth1_data +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#get_eth1_data func voting_period_start_time*(state: BeaconState): uint64 = let eth1_voting_period_start_slot = state.slot - state.slot mod SLOTS_PER_ETH1_VOTING_PERIOD.uint64 diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 3a874c616..068c3e2cf 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -202,12 +202,7 @@ proc slash_validator*(state: var BeaconState, slashed_index: ValidatorIndex, state, whistleblower_index, whistleblowing_reward - proposer_reward) func genesis_time_from_eth1_timestamp*(preset: RuntimePreset, eth1_timestamp: uint64): uint64 = - # TODO: remove once we switch completely to v0.12.1 - when SPEC_VERSION == "0.12.1": - eth1_timestamp + preset.GENESIS_DELAY - else: - const SECONDS_PER_DAY = uint64(60*60*24) - eth1_timestamp + 2'u64 * SECONDS_PER_DAY - (eth1_timestamp mod SECONDS_PER_DAY) + eth1_timestamp + preset.GENESIS_DELAY # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/beacon-chain.md#genesis proc initialize_beacon_state_from_eth1*( diff --git a/beacon_chain/spec/presets/v0_12_2/mainnet.nim b/beacon_chain/spec/presets/v0_12_2/mainnet.nim index b527e2a73..8bd35ca7c 100644 --- a/beacon_chain/spec/presets/v0_12_2/mainnet.nim +++ b/beacon_chain/spec/presets/v0_12_2/mainnet.nim @@ -16,7 +16,7 @@ import const # Misc # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L6 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L6 MAX_COMMITTEES_PER_SLOT* {.intdefine.}: uint64 = 64 @@ -66,7 +66,7 @@ const # Time parameters # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L77 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L80 SECONDS_PER_SLOT* {.intdefine.}: uint64 = 12'u64 # Compile with -d:SECONDS_PER_SLOT=1 for 12x faster slots ## TODO consistent time unit across projects, similar to C++ chrono? @@ -137,7 +137,7 @@ const # Max operations per block # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/mainnet.yaml#L131 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/mainnet/phase0.yaml#L134 MAX_PROPOSER_SLASHINGS*: uint64 = 2'u64 ^ 4 MAX_ATTESTER_SLASHINGS*: uint64 = 2'u64 ^ 1 MAX_ATTESTATIONS*: uint64 = 2'u64 ^ 7 diff --git a/beacon_chain/spec/presets/v0_12_2/minimal.nim b/beacon_chain/spec/presets/v0_12_2/minimal.nim index da966a10d..c3a5aaf81 100644 --- a/beacon_chain/spec/presets/v0_12_2/minimal.nim +++ b/beacon_chain/spec/presets/v0_12_2/minimal.nim @@ -16,7 +16,7 @@ import const # Misc # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L4 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L4 # Changed MAX_COMMITTEES_PER_SLOT*: uint64 = 4 @@ -37,7 +37,7 @@ const # Gwei values # --------------------------------------------------------------- - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/configs/minimal.yaml#L58 + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/configs/minimal/phase0.yaml#L61 # Unchanged MIN_DEPOSIT_AMOUNT*: uint64 = 2'u64^0 * 10'u64^9 diff --git a/beacon_chain/spec/signatures.nim b/beacon_chain/spec/signatures.nim index 79a01f55b..44793349e 100644 --- a/beacon_chain/spec/signatures.nim +++ b/beacon_chain/spec/signatures.nim @@ -17,7 +17,7 @@ template withTrust(sig: SomeSig, body: untyped): bool = else: body -# https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#aggregation-selection +# https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#aggregation-selection func get_slot_signature*( fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot, privkey: ValidatorPrivKey): ValidatorSig = diff --git a/beacon_chain/time.nim b/beacon_chain/time.nim index 857ac420c..73baece16 100644 --- a/beacon_chain/time.nim +++ b/beacon_chain/time.nim @@ -16,7 +16,7 @@ type ## which blocks are valid - in particular, blocks are not valid if they ## come from the future as seen from the local clock. ## - ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/fork-choice.md#fork-choice + ## https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/fork-choice.md#fork-choice ## # TODO replace time in chronos with a proper unit type, then this code can # follow: diff --git a/beacon_chain/validator_client.nim b/beacon_chain/validator_client.nim index c087b5ada..763ed7096 100644 --- a/beacon_chain/validator_client.nim +++ b/beacon_chain/validator_client.nim @@ -146,7 +146,7 @@ proc onSlotStart(vc: ValidatorClient, lastSlot, scheduledSlot: Slot) {.gcsafe, a discard await vc.client.post_v1_validator_block(newBlock) - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#attesting + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#attesting # A validator should create and broadcast the attestation to the associated # attestation subnet when either (a) the validator has received a valid # block from the expected block proposer for the assigned slot or diff --git a/beacon_chain/validator_duties.nim b/beacon_chain/validator_duties.nim index ca9181edb..efc0c65c5 100644 --- a/beacon_chain/validator_duties.nim +++ b/beacon_chain/validator_duties.nim @@ -102,7 +102,6 @@ proc sendAttestation*( node: BeaconNode, attestation: Attestation, num_active_validators: uint64) = logScope: pcs = "send_attestation" - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/p2p-interface.md#attestations-and-aggregation node.network.broadcast( getAttestationTopic(node.forkDigest, attestation, num_active_validators), attestation) @@ -476,7 +475,7 @@ proc handleValidatorDuties*( # with any clock discrepancies once only, at the start of slot timer # processing.. - # https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md#attesting + # https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md#attesting # A validator should create and broadcast the attestation to the associated # attestation subnet when either (a) the validator has received a valid # block from the expected block proposer for the assigned slot or diff --git a/beacon_chain/validator_pool.nim b/beacon_chain/validator_pool.nim index 2fec69509..101f504f4 100644 --- a/beacon_chain/validator_pool.nim +++ b/beacon_chain/validator_pool.nim @@ -24,7 +24,7 @@ func getValidator*(pool: ValidatorPool, validatorKey: ValidatorPubKey): AttachedValidator = pool.validators.getOrDefault(validatorKey) -# TODO: Honest validator - https://github.com/ethereum/eth2.0-specs/blob/v0.12.1/specs/phase0/validator.md +# TODO: Honest validator - https://github.com/ethereum/eth2.0-specs/blob/v0.12.2/specs/phase0/validator.md proc signBlockProposal*(v: AttachedValidator, fork: Fork, genesis_validators_root: Eth2Digest, slot: Slot, blockRoot: Eth2Digest): Future[ValidatorSig] {.async.} =