@@ -182,10 +182,14 @@ defmodule LambdaEthereumConsensus.ForkChoice.Handlers do
182182 # Add new block and state to the store
183183 BlockStates . store_state ( block_root , state )
184184
185+ is_first_block = store . proposer_boost_root == << 0 :: 256 >>
186+ # TODO: store block timeliness data?
187+ is_timely = Store . get_current_slot ( store ) == block . slot and is_before_attesting_interval
188+
185189 store
186190 |> Store . store_block ( block_root , signed_block )
187191 |> if_then_update (
188- is_before_attesting_interval and Store . get_current_slot ( store ) == block . slot ,
192+ is_timely and is_first_block ,
189193 & % Store { & 1 | proposer_boost_root: block_root }
190194 )
191195 # Update checkpoints in store if necessary
@@ -254,7 +258,7 @@ defmodule LambdaEthereumConsensus.ForkChoice.Handlers do
254258 def compute_pulled_up_tip ( % Store { } = store , block_root , block , state ) do
255259 with { :ok , state } <- EpochProcessing . process_justification_and_finalization ( state ) do
256260 block_epoch = Misc . compute_epoch_at_slot ( block . slot )
257- current_epoch = store |> Store . get_current_slot ( ) |> Misc . compute_epoch_at_slot ( )
261+ current_epoch = Store . get_current_epoch ( store )
258262
259263 unrealized_justifications =
260264 Map . put ( store . unrealized_justifications , block_root , state . current_justified_checkpoint )
@@ -355,7 +359,7 @@ defmodule LambdaEthereumConsensus.ForkChoice.Handlers do
355359 target = attestation . data . target
356360
357361 # Attestations must be from the current or previous epoch
358- current_epoch = store |> Store . get_current_slot ( ) |> Misc . compute_epoch_at_slot ( )
362+ current_epoch = Store . get_current_epoch ( store )
359363 # Use GENESIS_EPOCH for previous when genesis to avoid underflow
360364 previous_epoch = max ( current_epoch - 1 , Constants . genesis_epoch ( ) )
361365
0 commit comments