From a07dab300cfe9c332a3025d1712a4acc19396f5a Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 28 Jul 2020 17:35:32 +0000 Subject: [PATCH] verifyFinalization checks for justification being consistent with later finalization (#1386) --- beacon_chain/spec/state_transition_epoch.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index 0e5af2686..ac3706ce8 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -500,6 +500,9 @@ proc process_epoch*(state: var BeaconState, updateFlags: UpdateFlags, process_justification_and_finalization(state, per_epoch_cache, updateFlags) # state.slot hasn't been incremented yet. + if verifyFinalization in updateFlags and currentEpoch >= 2: + doAssert state.current_justified_checkpoint.epoch + 2 >= currentEpoch + if verifyFinalization in updateFlags and currentEpoch >= 3: # Rule 2/3/4 finalization results in the most pessimal case. The other # three finalization rules finalize more quickly as long as the any of