diff --git a/bin/tempo/src/defaults.rs b/bin/tempo/src/defaults.rs index f6a4a6cd80..08a039f810 100644 --- a/bin/tempo/src/defaults.rs +++ b/bin/tempo/src/defaults.rs @@ -212,6 +212,7 @@ fn init_engine_defaults() { // Defer persistence I/O during active payload builds. .with_suppress_persistence_during_build(true) .with_share_sparse_trie_with_payload_builder(true) + .with_share_execution_cache_with_payload_builder(true) .try_init() .expect("failed to initialize engine defaults"); } diff --git a/bin/tempo/src/lib.rs b/bin/tempo/src/lib.rs index 33a2d4e527..82854b8b58 100644 --- a/bin/tempo/src/lib.rs +++ b/bin/tempo/src/lib.rs @@ -71,6 +71,17 @@ use tempo_node::{ use tokio::sync::oneshot; use tracing::{debug, info, info_span, warn, warn_span}; +fn apply_tempo_cli_overrides(cli: &mut TempoCli) { + if let Commands::Node(node_cmd) = &mut cli.command + && node_cmd + .ext + .node_args + .engine_disable_execution_cache_sharing_with_builder + { + node_cmd.engine.share_execution_cache_with_payload_builder = false; + } +} + /// Runs the Tempo node CLI. pub fn tempo_main() -> eyre::Result<()> { install_crypto_provider(); @@ -144,6 +155,8 @@ pub fn tempo_main() -> eyre::Result<()> { Err(err) => err.exit(), }; + apply_tempo_cli_overrides(&mut cli); + if let Commands::Node(node_cmd) = &cli.command && node_cmd.engine.share_sparse_trie_with_payload_builder && node_cmd.builder.max_payload_tasks != 1 @@ -527,7 +540,7 @@ mod tests { use clap::Parser; - use super::{TempoCli, defaults, follow::FollowMode}; + use super::{TempoCli, apply_tempo_cli_overrides, defaults, follow::FollowMode}; use reth_ethereum::cli::Commands; fn init_defaults_once() { @@ -572,7 +585,15 @@ mod tests { panic!("expected node command"); }; assert!(node_cmd.engine.share_sparse_trie_with_payload_builder); + assert!( + !node_cmd + .ext + .node_args + .engine_disable_execution_cache_sharing_with_builder + ); assert_eq!(node_cmd.builder.max_payload_tasks, 1); + assert!(!node_cmd.ext.node_args.builder_disable_prewarming); + assert!(node_cmd.ext.node_args.builder_enable_prewarming); assert_eq!( node_cmd.ext.consensus.target_block_time.into_duration(), Duration::from_millis(550) @@ -587,6 +608,25 @@ mod tests { ); assert_eq!(node_cmd.ext.node_args.builder_build_time_multiplier, 1.35); + let mut cli = TempoCli::try_parse_from([ + "tempo", + "node", + "--dev", + "--engine.disable-execution-cache-sharing-with-builder", + ]) + .unwrap(); + apply_tempo_cli_overrides(&mut cli); + let Commands::Node(node_cmd) = cli.command else { + panic!("expected node command"); + }; + assert!( + node_cmd + .ext + .node_args + .engine_disable_execution_cache_sharing_with_builder + ); + assert!(!node_cmd.engine.share_execution_cache_with_payload_builder); + let cli = TempoCli::try_parse_from([ "tempo", "node", @@ -609,5 +649,34 @@ mod tests { node_cmd.ext.consensus.network_budget.into_duration(), Duration::from_millis(50) ); + + let cli = + TempoCli::try_parse_from(["tempo", "node", "--dev", "--builder.disable-prewarming"]) + .unwrap(); + let Commands::Node(node_cmd) = cli.command else { + panic!("expected node command"); + }; + assert!(node_cmd.ext.node_args.builder_disable_prewarming); + + let cli = TempoCli::try_parse_from([ + "tempo", + "node", + "--dev", + "--builder.enable-prewarming", + "--builder.disable-prewarming", + ]) + .unwrap(); + let Commands::Node(node_cmd) = cli.command else { + panic!("expected node command"); + }; + assert!(node_cmd.ext.node_args.builder_enable_prewarming); + assert!(node_cmd.ext.node_args.builder_disable_prewarming); + assert!( + !node_cmd + .ext + .node_args + .payload_builder_builder() + .enable_prewarming + ); } } diff --git a/crates/node/src/node.rs b/crates/node/src/node.rs index dcd70f333b..f5dc3c4051 100644 --- a/crates/node/src/node.rs +++ b/crates/node/src/node.rs @@ -69,10 +69,21 @@ pub struct TempoNodeArgs { #[arg(long = "builder.state-provider-metrics", default_value_t = false)] pub builder_state_provider_metrics: bool, - /// Enable prewarming for the payload builder. - #[arg(long = "builder.enable-prewarming", default_value_t = false)] + /// Disable prewarming for the payload builder. + #[arg(long = "builder.disable-prewarming", default_value_t = false)] + pub builder_disable_prewarming: bool, + + /// No-op legacy flag for payload builder prewarming. + #[arg(long = "builder.enable-prewarming", default_value_t = true)] pub builder_enable_prewarming: bool, + /// Disable sharing the execution cache with the payload builder. + #[arg( + long = "engine.disable-execution-cache-sharing-with-builder", + default_value_t = false + )] + pub engine_disable_execution_cache_sharing_with_builder: bool, + /// Initial estimate of total replayable payload build work divided by work /// at transaction cutoff. /// @@ -91,7 +102,9 @@ impl Default for TempoNodeArgs { aa_valid_after_max_secs: DEFAULT_AA_VALID_AFTER_MAX_SECS, max_tempo_authorizations: DEFAULT_MAX_TEMPO_AUTHORIZATIONS, builder_state_provider_metrics: false, - builder_enable_prewarming: false, + builder_disable_prewarming: false, + builder_enable_prewarming: true, + engine_disable_execution_cache_sharing_with_builder: false, builder_build_time_multiplier: DEFAULT_BUILD_TIME_MULTIPLIER, } } @@ -110,7 +123,7 @@ impl TempoNodeArgs { pub fn payload_builder_builder(&self) -> TempoPayloadBuilderBuilder { TempoPayloadBuilderBuilder { state_provider_metrics: self.builder_state_provider_metrics, - enable_prewarming: self.builder_enable_prewarming, + enable_prewarming: !self.builder_disable_prewarming, build_time_multiplier: self.builder_build_time_multiplier, } } @@ -551,7 +564,7 @@ impl Default for TempoPayloadBuilderBuilder { fn default() -> Self { Self { state_provider_metrics: false, - enable_prewarming: false, + enable_prewarming: true, build_time_multiplier: DEFAULT_BUILD_TIME_MULTIPLIER, } } diff --git a/crates/payload/builder/src/lib.rs b/crates/payload/builder/src/lib.rs index 7dc0f37880..0d38a67bbe 100644 --- a/crates/payload/builder/src/lib.rs +++ b/crates/payload/builder/src/lib.rs @@ -137,7 +137,7 @@ impl Default for TempoPayloadBuilderConfig { Self { is_dev: false, state_provider_metrics: false, - enable_prewarming: false, + enable_prewarming: true, build_time_multiplier: DEFAULT_BUILD_TIME_MULTIPLIER, } } diff --git a/crates/payload/builder/src/prewarming.rs b/crates/payload/builder/src/prewarming.rs index ccd6463a41..9ed2fe91ba 100644 --- a/crates/payload/builder/src/prewarming.rs +++ b/crates/payload/builder/src/prewarming.rs @@ -672,7 +672,8 @@ fn is_invalidated_buffered_transaction( .zip(invalid.transaction.aa_transaction_id()) .is_some_and(|(candidate_id, invalid_id)| candidate_id.seq_id() == invalid_id.seq_id()) } else { - candidate.transaction.sender() == invalid.transaction.sender() + !candidate.transaction.is_aa_2d() + && candidate.transaction.sender() == invalid.transaction.sender() } }