diff --git a/Cargo.lock b/Cargo.lock index 3c7fd9a5cb..3b610a789b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11704,7 +11704,6 @@ dependencies = [ "pyroscope", "pyroscope_pprofrs", "rand 0.8.5", - "reth-cli-commands", "reth-cli-runner", "reth-cli-util", "reth-ethereum", @@ -12036,6 +12035,7 @@ dependencies = [ "p256", "rand 0.9.2", "reqwest 0.13.2", + "reth-cli-commands", "reth-e2e-test-utils", "reth-engine-local", "reth-errors", diff --git a/bin/tempo/Cargo.toml b/bin/tempo/Cargo.toml index 18d33e5118..6b18d7bc7b 100644 --- a/bin/tempo/Cargo.toml +++ b/bin/tempo/Cargo.toml @@ -45,7 +45,6 @@ serde_json.workspace = true tempo-alloy.workspace = true tempo-contracts.workspace = true tempo-dkg-onchain-artifacts.workspace = true -reth-cli-commands.workspace = true reth-cli-runner.workspace = true reth-cli-util.workspace = true rustls.workspace = true diff --git a/bin/tempo/src/defaults.rs b/bin/tempo/src/defaults.rs index 6f04c52478..7566c2dd8e 100644 --- a/bin/tempo/src/defaults.rs +++ b/bin/tempo/src/defaults.rs @@ -1,14 +1,9 @@ use base64::{Engine, prelude::BASE64_STANDARD}; use eyre::Context as _; use jiff::SignedDuration; -use reth_cli_commands::download::DownloadDefaults; -use reth_ethereum::node::core::args::{DefaultPayloadBuilderValues, DefaultTxPoolValues}; -use std::{borrow::Cow, str::FromStr, time::Duration}; -use tempo_chainspec::hardfork::TempoHardfork; +use std::str::FromStr; use url::Url; -pub(crate) const DEFAULT_DOWNLOAD_URL: &str = "https://snapshots.tempoxyz.dev/4217"; - /// Default OTLP logs filter level for telemetry. const DEFAULT_LOGS_OTLP_FILTER: &str = "debug"; @@ -119,58 +114,3 @@ pub(crate) struct TelemetryConfig { /// Authorization header for metrics push pub(crate) metrics_auth_header: Option, } - -fn init_download_urls() { - let download_defaults = DownloadDefaults { - available_snapshots: vec![ - Cow::Owned(format!("{DEFAULT_DOWNLOAD_URL} (mainnet)")), - Cow::Borrowed("https://snapshots.tempoxyz.dev/42431 (moderato)"), - Cow::Borrowed("https://snapshots.tempoxyz.dev/42429 (andantino)"), - ], - default_base_url: Cow::Borrowed(DEFAULT_DOWNLOAD_URL), - default_chain_aware_base_url: None, - long_help: None, - }; - - download_defaults - .try_init() - .expect("failed to initialize download URLs"); -} - -fn init_payload_builder_defaults() { - DefaultPayloadBuilderValues::default() - .with_interval(Duration::from_millis(100)) - .with_max_payload_tasks(16) - .with_deadline(4) - .try_init() - .expect("failed to initialize payload builder defaults"); -} - -fn init_txpool_defaults() { - DefaultTxPoolValues::default() - .with_pending_max_count(50000) - .with_basefee_max_count(50000) - .with_queued_max_count(50000) - .with_pending_max_size(100) - .with_basefee_max_size(100) - .with_queued_max_size(100) - .with_no_locals(true) - .with_max_queued_lifetime(Duration::from_secs(120)) - .with_max_new_pending_txs_notifications(150000) - .with_max_account_slots(150000) - .with_pending_tx_listener_buffer_size(50000) - .with_new_tx_listener_buffer_size(50000) - .with_disable_transactions_backup(true) - .with_additional_validation_tasks(8) - .with_minimal_protocol_basefee(TempoHardfork::default().base_fee()) - .with_minimum_priority_fee(Some(0)) - .with_max_batch_size(50000) - .try_init() - .expect("failed to initialize txpool defaults"); -} - -pub(crate) fn init_defaults() { - init_download_urls(); - init_payload_builder_defaults(); - init_txpool_defaults(); -} diff --git a/bin/tempo/src/main.rs b/bin/tempo/src/main.rs index 55e5262429..7f400126bf 100644 --- a/bin/tempo/src/main.rs +++ b/bin/tempo/src/main.rs @@ -131,7 +131,7 @@ fn main() -> eyre::Result<()> { } tempo_node::init_version_metadata(); - defaults::init_defaults(); + tempo_node::init_defaults(); let mut cli = Cli::< TempoChainSpecParser, diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 8cc88d9461..fa6de5b5da 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -23,6 +23,7 @@ tempo-primitives = { workspace = true, features = ["default"] } thiserror.workspace = true +reth-cli-commands.workspace = true reth-errors.workspace = true reth-ethereum = { workspace = true, features = ["node", "rpc"] } reth-primitives-traits = { workspace = true, features = ["secp256k1", "rayon"] } diff --git a/crates/node/src/defaults.rs b/crates/node/src/defaults.rs new file mode 100644 index 0000000000..ba2890c166 --- /dev/null +++ b/crates/node/src/defaults.rs @@ -0,0 +1,61 @@ +use reth_cli_commands::download::DownloadDefaults; +use reth_ethereum::node::core::args::{DefaultPayloadBuilderValues, DefaultTxPoolValues}; +use std::{borrow::Cow, time::Duration}; +use tempo_chainspec::hardfork::TempoHardfork; + +pub const DEFAULT_DOWNLOAD_URL: &str = "https://snapshots.tempoxyz.dev/4217"; + +fn init_download_urls() { + let download_defaults = DownloadDefaults { + available_snapshots: vec![ + Cow::Owned(format!("{DEFAULT_DOWNLOAD_URL} (mainnet)")), + Cow::Borrowed("https://snapshots.tempoxyz.dev/42431 (moderato)"), + Cow::Borrowed("https://snapshots.tempoxyz.dev/42429 (andantino)"), + ], + default_base_url: Cow::Borrowed(DEFAULT_DOWNLOAD_URL), + default_chain_aware_base_url: None, + long_help: None, + }; + + download_defaults + .try_init() + .expect("failed to initialize download URLs"); +} + +fn init_payload_builder_defaults() { + DefaultPayloadBuilderValues::default() + .with_interval(Duration::from_millis(100)) + .with_max_payload_tasks(16) + .with_deadline(4) + .try_init() + .expect("failed to initialize payload builder defaults"); +} + +fn init_txpool_defaults() { + DefaultTxPoolValues::default() + .with_pending_max_count(50000) + .with_basefee_max_count(50000) + .with_queued_max_count(50000) + .with_pending_max_size(100) + .with_basefee_max_size(100) + .with_queued_max_size(100) + .with_no_locals(true) + .with_max_queued_lifetime(Duration::from_secs(120)) + .with_max_new_pending_txs_notifications(150000) + .with_max_account_slots(150000) + .with_pending_tx_listener_buffer_size(50000) + .with_new_tx_listener_buffer_size(50000) + .with_disable_transactions_backup(true) + .with_additional_validation_tasks(8) + .with_minimal_protocol_basefee(TempoHardfork::default().base_fee()) + .with_minimum_priority_fee(Some(0)) + .with_max_batch_size(50000) + .try_init() + .expect("failed to initialize txpool defaults"); +} + +pub fn init_defaults() { + init_download_urls(); + init_payload_builder_defaults(); + init_txpool_defaults(); +} diff --git a/crates/node/src/lib.rs b/crates/node/src/lib.rs index e8069a2f66..af2ed38851 100644 --- a/crates/node/src/lib.rs +++ b/crates/node/src/lib.rs @@ -3,6 +3,7 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg))] +pub use defaults::init_defaults; pub use tempo_payload_types::{TempoExecutionData, TempoPayloadTypes}; pub use version::{init_version_metadata, version_metadata}; @@ -12,6 +13,7 @@ use reth_ethereum::provider::db::DatabaseEnv; use reth_node_builder::{FullNode, NodeAdapter, RethFullAdapter}; pub use tempo_transaction_pool::validator::DEFAULT_AA_VALID_AFTER_MAX_SECS; +pub mod defaults; pub mod engine; pub mod node; pub mod rpc;