From 750722dd75c0a0852e930148334a2c7cb98fc46d Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Fri, 26 May 2023 10:03:49 +0200 Subject: [PATCH] advance FC time if block/attestation is early (#4992) When processing blocks/attestations that are slightly early, within the spec allowed `MAXIMUM_GOSSIP_CLOCK_DISPARITY`, bump FC time accordingly. --- beacon_chain/fork_choice/fork_choice.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon_chain/fork_choice/fork_choice.nim b/beacon_chain/fork_choice/fork_choice.nim index fd4e59efe..b481d49ab 100644 --- a/beacon_chain/fork_choice/fork_choice.nim +++ b/beacon_chain/fork_choice/fork_choice.nim @@ -215,7 +215,7 @@ proc on_attestation*( attesting_indices: openArray[ValidatorIndex], wallTime: BeaconTime ): FcResult[void] = - ? self.update_time(dag, wallTime) + ? self.update_time(dag, max(wallTime, attestation_slot.start_beacon_time)) if beacon_block_root.isZero: return ok() @@ -266,7 +266,7 @@ proc process_block*(self: var ForkChoice, unrealized: FinalityCheckpoints, blck: ForkyTrustedBeaconBlock, wallTime: BeaconTime): FcResult[void] = - ? update_time(self, dag, wallTime) + ? update_time(self, dag, max(wallTime, blckRef.slot.start_beacon_time)) for attester_slashing in blck.body.attester_slashings: for idx in getValidatorIndices(attester_slashing):