non-spec aggregate validation check now in spec; update genesis times (#2001)

This commit is contained in:
tersec 2020-11-12 15:29:32 +00:00 committed by GitHub
parent a0621d52f6
commit 754d65c159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -291,7 +291,7 @@ proc validateAttestation*(
ok(attesting_indices) 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*( proc validateAggregate*(
pool: var AttestationPool, pool: var AttestationPool,
signedAggregateAndProof: SignedAggregateAndProof, wallTime: BeaconTime): signedAggregateAndProof: SignedAggregateAndProof, wallTime: BeaconTime):
@ -300,17 +300,19 @@ proc validateAggregate*(
aggregate_and_proof = signedAggregateAndProof.message aggregate_and_proof = signedAggregateAndProof.message
aggregate = aggregate_and_proof.aggregate 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 # [IGNORE] aggregate.data.slot is within the last
# ATTESTATION_PROPAGATION_SLOT_RANGE slots (with a # ATTESTATION_PROPAGATION_SLOT_RANGE slots (with a
# MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) -- i.e. aggregate.data.slot + # MAXIMUM_GOSSIP_CLOCK_DISPARITY allowance) -- i.e. aggregate.data.slot +
# ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= aggregate.data.slot # ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= aggregate.data.slot
? check_propagation_slot_range(aggregate.data, wallTime) # [IGNORE] ? 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 # [IGNORE] The valid aggregate attestation defined by
# hash_tree_root(aggregate) has not already been seen (via aggregate gossip, # hash_tree_root(aggregate) has not already been seen (via aggregate gossip,
# within a verified block, or through the creation of an equivalent aggregate # within a verified block, or through the creation of an equivalent aggregate

View File

@ -135,7 +135,7 @@ when ETH2_SPEC == "v0.12.3":
else: else:
const mainnetRuntimePreset* = RuntimePreset( const mainnetRuntimePreset* = RuntimePreset(
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 16384, 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_FORK_VERSION: Version [byte 0, 0, 0, 0],
GENESIS_DELAY: 604800, GENESIS_DELAY: 604800,
ETH1_FOLLOW_DISTANCE: 2048) ETH1_FOLLOW_DISTANCE: 2048)
@ -143,7 +143,7 @@ else:
const const
minimalRuntimePreset* = RuntimePreset( minimalRuntimePreset* = RuntimePreset(
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 64, 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_FORK_VERSION: Version [byte 0, 0, 0, 1],
GENESIS_DELAY: 300, GENESIS_DELAY: 300,
ETH1_FOLLOW_DISTANCE: 16) ETH1_FOLLOW_DISTANCE: 16)