From 754d65c15994f1c792042cb03d0a2f06059b6ec8 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 12 Nov 2020 15:29:32 +0000 Subject: [PATCH] non-spec aggregate validation check now in spec; update genesis times (#2001) --- beacon_chain/attestation_aggregation.nim | 14 ++++++++------ beacon_chain/spec/presets.nim | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/beacon_chain/attestation_aggregation.nim b/beacon_chain/attestation_aggregation.nim index 1ef3e6643..768946d48 100644 --- a/beacon_chain/attestation_aggregation.nim +++ b/beacon_chain/attestation_aggregation.nim @@ -291,7 +291,7 @@ proc validateAttestation*( ok(attesting_indices) -# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0-rc.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof +# https://github.com/ethereum/eth2.0-specs/blob/v1.0.0/specs/phase0/p2p-interface.md#beacon_aggregate_and_proof proc validateAggregate*( pool: var AttestationPool, signedAggregateAndProof: SignedAggregateAndProof, wallTime: BeaconTime): @@ -300,17 +300,19 @@ proc validateAggregate*( aggregate_and_proof = signedAggregateAndProof.message aggregate = aggregate_and_proof.aggregate - block: - let v = check_attestation_slot_target(aggregate.data) # Not in spec - if v.isErr(): - return err((ValidationResult.Ignore, v.error)) - # [IGNORE] aggregate.data.slot is within the last # ATTESTATION_PROPAGATION_SLOT_RANGE slots (with a # MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) -- i.e. aggregate.data.slot + # ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= aggregate.data.slot ? check_propagation_slot_range(aggregate.data, wallTime) # [IGNORE] + # [REJECT] The aggregate attestation's epoch matches its target -- i.e. + # `aggregate.data.target.epoch == compute_epoch_at_slot(aggregate.data.slot)` + block: + let v = check_attestation_slot_target(aggregate.data) + if v.isErr(): + return err((ValidationResult.Reject, v.error)) + # [IGNORE] The valid aggregate attestation defined by # hash_tree_root(aggregate) has not already been seen (via aggregate gossip, # within a verified block, or through the creation of an equivalent aggregate diff --git a/beacon_chain/spec/presets.nim b/beacon_chain/spec/presets.nim index 15cefe53a..946682ccb 100644 --- a/beacon_chain/spec/presets.nim +++ b/beacon_chain/spec/presets.nim @@ -135,7 +135,7 @@ when ETH2_SPEC == "v0.12.3": else: const mainnetRuntimePreset* = RuntimePreset( MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384, - MIN_GENESIS_TIME: 1578009600, + MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 0], GENESIS_DELAY: 604800, ETH1_FOLLOW_DISTANCE: 2048) @@ -143,7 +143,7 @@ else: const minimalRuntimePreset* = RuntimePreset( MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64, - MIN_GENESIS_TIME: 1578009600, + MIN_GENESIS_TIME: 1606824000, # Dec 1, 2020, 12pm UTC GENESIS_FORK_VERSION: Version [byte 0, 0, 0, 1], GENESIS_DELAY: 300, ETH1_FOLLOW_DISTANCE: 16)