Skip to content

Commit

Permalink
refactor: add beacon node supervisor. (#566)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Paulucci <mpaulucci@Martins-MacBook-Pro.local>
  • Loading branch information
mpaulucci and Martin Paulucci authored Jan 4, 2024
1 parent 7e5273c commit f288571
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 1 addition & 5 deletions lib/lambda_ethereum_consensus/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ defmodule LambdaEthereumConsensus.Application do
{LambdaEthereumConsensus.Libp2pPort, libp2p_opts},
{LambdaEthereumConsensus.Store.Db, []},
{LambdaEthereumConsensus.P2P.Peerbook, []},
{LambdaEthereumConsensus.ForkChoice, [checkpoint_sync]},
{LambdaEthereumConsensus.P2P.IncomingRequests, []},
{LambdaEthereumConsensus.Beacon.PendingBlocks, []},
{LambdaEthereumConsensus.Beacon.SyncBlocks, []},
{LambdaEthereumConsensus.P2P.GossipSub, []},
{LambdaEthereumConsensus.Beacon.BeaconNode, [checkpoint_sync]},
{BeaconApi.Endpoint, []}
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
defmodule LambdaEthereumConsensus.ForkChoice do
defmodule LambdaEthereumConsensus.Beacon.BeaconNode do
@moduledoc false

use Supervisor
require Logger

alias LambdaEthereumConsensus.ForkChoice.CheckpointSync
alias LambdaEthereumConsensus.Beacon.CheckpointSync
alias LambdaEthereumConsensus.StateTransition.Cache
alias LambdaEthereumConsensus.Store.{BlockStore, StateStore}

Expand Down Expand Up @@ -60,7 +60,10 @@ defmodule LambdaEthereumConsensus.ForkChoice do

children = [
{LambdaEthereumConsensus.ForkChoice.Store, {anchor_state, anchor_block}},
{LambdaEthereumConsensus.ForkChoice.Tree, []}
{LambdaEthereumConsensus.Beacon.PendingBlocks, []},
{LambdaEthereumConsensus.Beacon.SyncBlocks, []},
{LambdaEthereumConsensus.P2P.IncomingRequests, []},
{LambdaEthereumConsensus.P2P.GossipSub, []}
]

Supervisor.init(children, strategy: :one_for_all)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule LambdaEthereumConsensus.ForkChoice.CheckpointSync do
defmodule LambdaEthereumConsensus.Beacon.CheckpointSync do
@moduledoc """
Functions related to checkpoint-sync.
"""
Expand Down

0 comments on commit f288571

Please sign in to comment.