Skip to content

Commit

Permalink
chore: remove trusted setups (paradigmxyz#7274)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackG-eth authored Mar 21, 2024
1 parent f4b5000 commit 6eb7397
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 43 deletions.
6 changes: 0 additions & 6 deletions bin/reth/src/commands/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ pub struct NodeCommand<Ext: clap::Args + fmt::Debug = NoArgs> {
#[arg(long, conflicts_with = "instance", global = true)]
pub with_unused_ports: bool,

/// Overrides the KZG trusted setup by reading from the supplied file.
#[arg(long, value_name = "PATH")]
pub trusted_setup_file: Option<PathBuf>,

/// All networking related arguments
#[command(flatten)]
pub network: NetworkArgs,
Expand Down Expand Up @@ -150,7 +146,6 @@ impl<Ext: clap::Args + fmt::Debug> NodeCommand<Ext> {
config,
chain,
metrics,
trusted_setup_file,
instance,
with_unused_ports,
network,
Expand All @@ -170,7 +165,6 @@ impl<Ext: clap::Args + fmt::Debug> NodeCommand<Ext> {
chain,
metrics,
instance,
trusted_setup_file,
network,
rpc,
txpool,
Expand Down
16 changes: 3 additions & 13 deletions crates/node-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ use reth_node_core::{
primitives::{kzg::KzgSettings, Head},
utils::write_peers_to_file,
};
use reth_primitives::{
constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP},
format_ether, ChainSpec,
};
use reth_primitives::{constants::eip4844::MAINNET_KZG_TRUSTED_SETUP, format_ether, ChainSpec};
use reth_provider::{providers::BlockchainProvider, ChainSpecProvider, ProviderFactory};
use reth_prune::PrunerBuilder;
use reth_revm::EvmProcessorFactory;
Expand Down Expand Up @@ -1104,16 +1101,9 @@ impl<Node: FullNodeTypes> BuilderContext<Node> {
self.config().txpool.pool_config()
}

/// Loads the trusted setup params from a given file path or falls back to
/// `MAINNET_KZG_TRUSTED_SETUP`.
/// Loads `MAINNET_KZG_TRUSTED_SETUP`.
pub fn kzg_settings(&self) -> eyre::Result<Arc<KzgSettings>> {
if let Some(ref trusted_setup_file) = self.config().trusted_setup_file {
let trusted_setup = KzgSettings::load_trusted_setup_file(trusted_setup_file)
.map_err(LoadKzgSettingsError::KzgError)?;
Ok(Arc::new(trusted_setup))
} else {
Ok(Arc::clone(&MAINNET_KZG_TRUSTED_SETUP))
}
Ok(Arc::clone(&MAINNET_KZG_TRUSTED_SETUP))
}

/// Returns the config for payload building.
Expand Down
29 changes: 5 additions & 24 deletions crates/node-core/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ use reth_network::{
};
use reth_node_api::ConfigureEvm;
use reth_primitives::{
constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP},
kzg::KzgSettings,
stage::StageId,
constants::eip4844::MAINNET_KZG_TRUSTED_SETUP, kzg::KzgSettings, stage::StageId,
BlockHashOrNumber, BlockNumber, ChainSpec, Head, SealedHeader, TxHash, B256, MAINNET,
};
use reth_provider::{
Expand Down Expand Up @@ -169,9 +167,6 @@ pub struct NodeConfig {
/// - WS_RPC_PORT: default + `instance` * 2 - 2
pub instance: u16,

/// Overrides the KZG trusted setup by reading from the supplied file.
pub trusted_setup_file: Option<PathBuf>,

/// All networking related arguments
pub network: NetworkArgs,

Expand Down Expand Up @@ -235,12 +230,6 @@ impl NodeConfig {
self
}

/// Set the trusted setup file for the node
pub fn with_trusted_setup_file(mut self, trusted_setup_file: impl Into<PathBuf>) -> Self {
self.trusted_setup_file = Some(trusted_setup_file.into());
self
}

/// Set the network args for the node
pub fn with_network(mut self, network: NetworkArgs) -> Self {
self.network = network;
Expand Down Expand Up @@ -594,16 +583,9 @@ impl NodeConfig {
Ok(pipeline)
}

/// Loads the trusted setup params from a given file path or falls back to
/// `MAINNET_KZG_TRUSTED_SETUP`.
/// Loads 'MAINNET_KZG_TRUSTED_SETUP'
pub fn kzg_settings(&self) -> eyre::Result<Arc<KzgSettings>> {
if let Some(ref trusted_setup_file) = self.trusted_setup_file {
let trusted_setup = KzgSettings::load_trusted_setup_file(trusted_setup_file)
.map_err(LoadKzgSettingsError::KzgError)?;
Ok(Arc::new(trusted_setup))
} else {
Ok(Arc::clone(&MAINNET_KZG_TRUSTED_SETUP))
}
Ok(Arc::clone(&MAINNET_KZG_TRUSTED_SETUP))
}

/// Installs the prometheus recorder.
Expand Down Expand Up @@ -729,7 +711,7 @@ impl NodeConfig {
// try to look up the header in the database
if let Some(header) = header {
info!(target: "reth::cli", ?tip, "Successfully looked up tip block in the database");
return Ok(header.number)
return Ok(header.number);
}

Ok(self.fetch_tip_from_network(client, tip.into()).await?.number)
Expand All @@ -751,7 +733,7 @@ impl NodeConfig {
match get_single_header(&client, tip).await {
Ok(tip_header) => {
info!(target: "reth::cli", ?tip, "Successfully fetched tip");
return Ok(tip_header)
return Ok(tip_header);
}
Err(error) => {
error!(target: "reth::cli", %error, "Failed to fetch the tip. Retrying...");
Expand Down Expand Up @@ -924,7 +906,6 @@ impl Default for NodeConfig {
chain: MAINNET.clone(),
metrics: None,
instance: 1,
trusted_setup_file: None,
network: NetworkArgs::default(),
rpc: RpcServerArgs::default(),
txpool: TxPoolArgs::default(),
Expand Down

0 comments on commit 6eb7397

Please sign in to comment.