diff --git a/lib/lambda_ethereum_consensus/p2p/blob_downloader.ex b/lib/lambda_ethereum_consensus/p2p/blob_downloader.ex index 81877f045..3b761c0ec 100644 --- a/lib/lambda_ethereum_consensus/p2p/blob_downloader.ex +++ b/lib/lambda_ethereum_consensus/p2p/blob_downloader.ex @@ -62,7 +62,11 @@ defmodule LambdaEthereumConsensus.P2P.BlobDownloader do P2P.Peerbook.penalize_peer(peer_id) if retries > 0 do - Logger.info("Retrying request for #{count} blobs, reason: #{inspect(reason)} in 2 second", slot: slot) + Logger.info( + "Retrying request for #{count} blobs, reason: #{inspect(reason)} in 2 second", + slot: slot + ) + Process.sleep(2000) request_blobs_by_range(slot, count, on_blobs, retries - 1) {:ok, store} @@ -124,9 +128,6 @@ defmodule LambdaEthereumConsensus.P2P.BlobDownloader do defp get_some_peer() do case P2P.Peerbook.get_some_peer() do nil -> - stacktrace = Process.info(self(), :current_stacktrace) - IO.inspect(stacktrace, label: "Current stacktrace") - Process.sleep(100) get_some_peer() diff --git a/lib/lambda_ethereum_consensus/p2p/block_downloader.ex b/lib/lambda_ethereum_consensus/p2p/block_downloader.ex index 6438ccfd1..6910d4a77 100644 --- a/lib/lambda_ethereum_consensus/p2p/block_downloader.ex +++ b/lib/lambda_ethereum_consensus/p2p/block_downloader.ex @@ -173,7 +173,11 @@ defmodule LambdaEthereumConsensus.P2P.BlockDownloader do if retries > 0 do :telemetry.execute([:network, :request], %{blocks: 0}, Map.put(tags, :result, "retry")) pretty_roots = Enum.map_join(roots, ", ", &Base.encode16/1) - Logger.debug("Retrying request (reason: #{inspect(reason)}) for blocks with roots #{pretty_roots}, in 2 second") + + Logger.debug( + "Retrying request (reason: #{inspect(reason)}) for blocks with roots #{pretty_roots}, in 2 second" + ) + Process.sleep(2000) request_blocks_by_root(roots, on_blocks, retries - 1) {:ok, store} @@ -187,9 +191,6 @@ defmodule LambdaEthereumConsensus.P2P.BlockDownloader do defp get_some_peer() do case P2P.Peerbook.get_some_peer() do nil -> - stacktrace = Process.info(self(), :current_stacktrace) - IO.inspect(stacktrace, label: "Current stacktrace") - Process.sleep(100) get_some_peer() diff --git a/lib/lambda_ethereum_consensus/p2p/peerbook.ex b/lib/lambda_ethereum_consensus/p2p/peerbook.ex index 500a21e3d..d0dd89bcb 100644 --- a/lib/lambda_ethereum_consensus/p2p/peerbook.ex +++ b/lib/lambda_ethereum_consensus/p2p/peerbook.ex @@ -58,7 +58,10 @@ defmodule LambdaEthereumConsensus.P2P.Peerbook do end def penalize_peer(peer_id) do - Logger.debug("Penalizing peer: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}") + Logger.debug( + "Penalizing peer: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}" + ) + peer_score = fetch_peerbook!() |> Map.get(peer_id) case peer_score do @@ -66,7 +69,10 @@ defmodule LambdaEthereumConsensus.P2P.Peerbook do :ok score when score - @penalize <= 0 -> - Logger.info("Removing peer: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}") + Logger.info( + "Removing peer: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}" + ) + fetch_peerbook!() |> Map.delete(peer_id) |> store_peerbook() @@ -80,7 +86,10 @@ defmodule LambdaEthereumConsensus.P2P.Peerbook do def handle_new_peer(peer_id) do peerbook = fetch_peerbook!() - Logger.debug("New peer connected: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}") + + Logger.debug( + "New peer connected: #{inspect(LambdaEthereumConsensus.Utils.format_shorten_binary(peer_id))}" + ) if not Map.has_key?(peerbook, peer_id) do :telemetry.execute([:peers, :connection], %{id: peer_id}, %{result: "success"}) diff --git a/lib/types/store.ex b/lib/types/store.ex index 0641db94d..00276ee62 100644 --- a/lib/types/store.ex +++ b/lib/types/store.ex @@ -3,7 +3,6 @@ defmodule Types.Store do The Store struct is used to track information required for the fork choice algorithm. """ - alias LambdaEthereumConsensus.ForkChoice alias LambdaEthereumConsensus.ForkChoice.Head alias LambdaEthereumConsensus.ForkChoice.Simple.Tree alias LambdaEthereumConsensus.StateTransition @@ -246,15 +245,9 @@ defmodule Types.Store do end end - @spec update_head_info(t()) :: t() - def update_head_info(store) do + defp update_head_info(store) do {:ok, head_root} = Head.get_head(store) %{slot: head_slot} = Blocks.get_block!(head_root) - update_head_info(store, head_slot, head_root) - end - - @spec update_head_info(t(), Types.slot(), Types.root()) :: t() - def update_head_info(store, head_slot, head_root) do %{store | head_root: head_root, head_slot: head_slot} end