From fd6e6d5d40e3477f4307af3b99dde4ea1df8d547 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 21 Nov 2019 11:16:16 +1100 Subject: [PATCH] Allow attestations to genesis block --- beacon_node/beacon_chain/src/beacon_chain.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index c050077094..10951f54f2 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -852,13 +852,18 @@ impl BeaconChain { result }; - if block.slot <= finalized_epoch.start_slot(T::EthSpec::slots_per_epoch()) { + if block.slot > 0 + && (block.slot <= finalized_epoch.start_slot(T::EthSpec::slots_per_epoch())) + { // Ignore any attestation where the slot of `data.beacon_block_root` is equal to or // prior to the finalized epoch. // // For any valid attestation if the `beacon_block_root` is prior to finalization, then // all other parameters (source, target, etc) must all be prior to finalization and // therefore no longer interesting. + // + // We allow the case where the block is the genesis block. Without this, all + // attestations prior to the first block being produced would be invalid. Ok(AttestationProcessingOutcome::FinalizedSlot { attestation: block.slot.epoch(T::EthSpec::slots_per_epoch()), finalized: finalized_epoch,