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.
This commit is contained in:
Etan Kissling 2023-05-26 10:03:49 +02:00 committed by GitHub
parent 1f535336da
commit 750722dd75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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):