Skip to content

Commit

Permalink
fix: Node uses optimism beacon consensus for op chains
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianBland committed May 29, 2024
1 parent 42667e1 commit a8ad8eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ optimism = [
"reth-beacon-consensus/optimism",
"reth-blockchain-tree/optimism",
"dep:reth-node-optimism",
"reth-node-builder/optimism",
"reth-node-core/optimism",
]

Expand Down
14 changes: 14 additions & 0 deletions crates/node/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ tokio = { workspace = true, features = [
] }
tokio-stream.workspace = true

# Optimism
reth-optimism-consensus = { workspace = true, features = ["optimism"] }

## misc
aquamarine.workspace = true
eyre.workspace = true
Expand All @@ -60,3 +63,14 @@ rayon.workspace = true

[dev-dependencies]
tempfile.workspace = true

[features]
optimism = [
"reth-primitives/optimism",
"reth-rpc/optimism",
"reth-provider/optimism",
"reth-beacon-consensus/optimism",
"reth-blockchain-tree/optimism",
"reth-node-core/optimism",
"reth-optimism-consensus/optimism",
]
6 changes: 6 additions & 0 deletions crates/node/builder/src/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ use reth_node_core::{
version::{CARGO_PKG_VERSION, CLIENT_CODE, NAME_CLIENT, VERGEN_GIT_SHA},
};
use reth_node_events::{cl::ConsensusLayerHealthEvents, node};

#[cfg(feature = "optimism")]
use reth_optimism_consensus::OptimismBeaconConsensus;

use reth_primitives::format_ether;
use reth_provider::{providers::BlockchainProvider, CanonStateSubscriptions};
use reth_rpc_engine_api::EngineApi;
Expand Down Expand Up @@ -116,6 +120,8 @@ where
// setup the consensus instance
let consensus: Arc<dyn Consensus> = if ctx.is_dev() {
Arc::new(AutoSealConsensus::new(ctx.chain_spec()))
} else if cfg!(feature = "optimism") && ctx.chain_spec().is_optimism() {
Arc::new(OptimismBeaconConsensus::new(ctx.chain_spec()))
} else {
Arc::new(EthBeaconConsensus::new(ctx.chain_spec()))
};
Expand Down

0 comments on commit a8ad8eb

Please sign in to comment.