Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ nybbles = { version = "0.4.2", default-features = false }
once_cell = { version = "1.19", default-features = false, features = ["critical-section"] }
parking_lot = "0.12"
paste = "1.0"
prost = "0.13"
rand = "0.9"
rayon = "1.7"
rustc-hash = { version = "2.0", default-features = false }
Expand Down Expand Up @@ -659,6 +660,7 @@ hyper-util = "0.1.5"
pin-project = "1.0.12"
reqwest = { version = "0.12", default-features = false }
tracing-futures = "0.2"
tonic = { version = "0.12", default-features = false }
tower = "0.5"
tower-http = "0.6"

Expand Down
77 changes: 50 additions & 27 deletions bin/seismic-reth/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
#![allow(missing_docs)]

use clap::Parser;
use reth_node_core::args::{EnclaveArgs, ScreeningArgs};
use reth_seismic_cli::{chainspec::SeismicChainSpecParser, Cli};
use reth_seismic_node::{enclave::boot_enclave_and_fetch_keys, node::SeismicNode};
use reth_seismic_rpc::ext::{EthApiExt, EthApiOverrideServer, SeismicApi, SeismicApiServer};
use reth_tracing::tracing::*;

/// Combined CLI extension args for the Seismic node.
///
/// Wraps both enclave and address screening configuration.
#[derive(Debug, Clone, clap::Args)]
struct SeismicExtArgs {
/// Enclave configuration.
#[command(flatten)]
enclave: EnclaveArgs,
/// Address screening configuration.
#[command(flatten)]
screening: ScreeningArgs,
}

impl AsRef<EnclaveArgs> for SeismicExtArgs {
fn as_ref(&self) -> &EnclaveArgs {
&self.enclave
}
}

fn main() {
// Enable backtraces unless we explicitly set RUST_BACKTRACE
if std::env::var_os("RUST_BACKTRACE").is_none() {
Expand All @@ -14,33 +34,36 @@ fn main() {

reth_cli_util::sigsegv_handler::install();

if let Err(err) = Cli::<SeismicChainSpecParser>::parse().run(|builder, encl| async move {
// Boot enclave and fetch purpose keys BEFORE building node components
let purpose_keys = boot_enclave_and_fetch_keys(&encl).await;

// Store purpose keys in global static storage before building the node
reth_seismic_node::purpose_keys::init_purpose_keys(purpose_keys.clone());

// building additional endpoints seismic api
let seismic_api = SeismicApi::new(purpose_keys.clone());

let node = builder
.node(SeismicNode::default())
.extend_rpc_modules(move |ctx| {
// replace eth_ namespace
ctx.modules.replace_configured(
EthApiExt::new(ctx.registry.eth_api().clone(), purpose_keys.clone()).into_rpc(),
)?;

// add seismic_ namespace
ctx.modules.merge_configured(seismic_api.into_rpc())?;
info!(target: "reth::cli", "seismic api configured");
Ok(())
})
.launch_with_debug_capabilities()
.await?;
node.node_exit_future.await
}) {
if let Err(err) =
Cli::<SeismicChainSpecParser, SeismicExtArgs>::parse().run(|builder, ext| async move {
// Boot enclave and fetch purpose keys BEFORE building node components
let purpose_keys = boot_enclave_and_fetch_keys(&ext).await;

// Store purpose keys in global static storage before building the node
reth_seismic_node::purpose_keys::init_purpose_keys(purpose_keys.clone());

// building additional endpoints seismic api
let seismic_api = SeismicApi::new(purpose_keys.clone());

let node = builder
.node(SeismicNode::new(Some(ext.screening)))
.extend_rpc_modules(move |ctx| {
// replace eth_ namespace
ctx.modules.replace_configured(
EthApiExt::new(ctx.registry.eth_api().clone(), purpose_keys.clone())
.into_rpc(),
)?;

// add seismic_ namespace
ctx.modules.merge_configured(seismic_api.into_rpc())?;
info!(target: "reth::cli", "seismic api configured");
Ok(())
})
.launch_with_debug_capabilities()
.await?;
node.node_exit_future.await
})
{
eprintln!("Error: {err:?}");
std::process::exit(1);
}
Expand Down
4 changes: 4 additions & 0 deletions crates/node/core/src/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
mod enclave;
pub use enclave::EnclaveArgs;

/// ScreeningArgs struct for configuring address screening
mod screening;
pub use screening::ScreeningArgs;

/// NetworkArg struct for configuring the network
mod network;
pub use network::{DiscoveryArgs, NetworkArgs};
Expand Down
Loading
Loading