diff --git a/lib/lambda_ethereum_consensus/beacon/store_setup.ex b/lib/lambda_ethereum_consensus/beacon/store_setup.ex index f9c1f17d0..154392966 100644 --- a/lib/lambda_ethereum_consensus/beacon/store_setup.ex +++ b/lib/lambda_ethereum_consensus/beacon/store_setup.ex @@ -38,7 +38,7 @@ defmodule LambdaEthereumConsensus.Beacon.StoreSetup do end @doc """ - Gets a {store, genesis_validators_root} tuple with the configured strategy. + Gets a store with the configured strategy. """ @spec setup!() :: Store.t() def setup!(), do: setup!(get_strategy!()) diff --git a/lib/lambda_ethereum_consensus/beacon/sync_blocks.ex b/lib/lambda_ethereum_consensus/beacon/sync_blocks.ex index 169993dcb..6050bbb73 100644 --- a/lib/lambda_ethereum_consensus/beacon/sync_blocks.ex +++ b/lib/lambda_ethereum_consensus/beacon/sync_blocks.ex @@ -8,7 +8,6 @@ defmodule LambdaEthereumConsensus.Beacon.SyncBlocks do alias LambdaEthereumConsensus.ForkChoice alias LambdaEthereumConsensus.Libp2pPort alias LambdaEthereumConsensus.P2P.BlockDownloader - alias LambdaEthereumConsensus.StateTransition.Misc @blocks_per_chunk 16 @retries 50 @@ -23,9 +22,8 @@ defmodule LambdaEthereumConsensus.Beacon.SyncBlocks do """ @spec run() :: non_neg_integer() def run() do - # Initial sleep for faster app start - checkpoint = ForkChoice.get_finalized_checkpoint() - initial_slot = Misc.compute_start_slot_at_epoch(checkpoint.epoch) + 1 + %{head_slot: head_slot} = ForkChoice.get_current_status_message() + initial_slot = head_slot + 1 last_slot = ForkChoice.get_current_chain_slot() # If we're around genesis, we consider ourselves synced diff --git a/lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex b/lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex index 3bb4015df..ad0ee36ad 100644 --- a/lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex +++ b/lib/lambda_ethereum_consensus/fork_choice/fork_choice.ex @@ -176,7 +176,7 @@ defmodule LambdaEthereumConsensus.ForkChoice do Logger.info("Pruning states before slot #{new_finalized_epoch}") new_finalized_slot = - new_finalized_epoch * ChainSpec.get("SLOTS_PER_EPOCH") + Misc.compute_start_slot_at_epoch(new_finalized_epoch) Task.Supervisor.start_child( PruneStatesSupervisor,