diff --git a/crates/rbuilder/src/backtest/backtest_build_block.rs b/crates/rbuilder/src/backtest/backtest_build_block.rs index 5d0953bb..1df7b2ba 100644 --- a/crates/rbuilder/src/backtest/backtest_build_block.rs +++ b/crates/rbuilder/src/backtest/backtest_build_block.rs @@ -88,7 +88,7 @@ where print_order_and_timestamp(&block_data.available_orders, &block_data); } - let provider_factory = config.base_config().create_provider_factory()?; + let provider_factory = config.base_config().create_provider_factory(true)?; let chain_spec = config.base_config().chain_spec()?; if cli.sim_landed_block { diff --git a/crates/rbuilder/src/backtest/backtest_build_range.rs b/crates/rbuilder/src/backtest/backtest_build_range.rs index da96d7f3..15398294 100644 --- a/crates/rbuilder/src/backtest/backtest_build_range.rs +++ b/crates/rbuilder/src/backtest/backtest_build_range.rs @@ -111,7 +111,7 @@ where result }; - let provider_factory = config.base_config().create_provider_factory()?; + let provider_factory = config.base_config().create_provider_factory(true)?; let chain_spec = config.base_config().chain_spec()?; let mut profits = Vec::new(); diff --git a/crates/rbuilder/src/backtest/redistribute/cli/mod.rs b/crates/rbuilder/src/backtest/redistribute/cli/mod.rs index 215b7b78..8bf59bd7 100644 --- a/crates/rbuilder/src/backtest/redistribute/cli/mod.rs +++ b/crates/rbuilder/src/backtest/redistribute/cli/mod.rs @@ -56,7 +56,7 @@ where let mut historical_data_storage = HistoricalDataStorage::new_from_path(&config.base_config().backtest_fetch_output_file) .await?; - let provider = config.base_config().create_provider_factory()?; + let provider = config.base_config().create_provider_factory(true)?; let mut csv_writer = cli .csv .map(|path| -> io::Result<_> { CSVResultWriter::new(path) }) diff --git a/crates/rbuilder/src/bin/debug-bench-machine.rs b/crates/rbuilder/src/bin/debug-bench-machine.rs index 2f7c1f1e..dec269f7 100644 --- a/crates/rbuilder/src/bin/debug-bench-machine.rs +++ b/crates/rbuilder/src/bin/debug-bench-machine.rs @@ -43,7 +43,7 @@ async fn main() -> eyre::Result<()> { let chain_spec = config.base_config().chain_spec()?; - let provider_factory = config.base_config().create_provider_factory()?; + let provider_factory = config.base_config().create_provider_factory(true)?; let last_block = provider_factory.last_block_number()?; diff --git a/crates/rbuilder/src/live_builder/base_config.rs b/crates/rbuilder/src/live_builder/base_config.rs index 1e45f454..2e990b6e 100644 --- a/crates/rbuilder/src/live_builder/base_config.rs +++ b/crates/rbuilder/src/live_builder/base_config.rs @@ -230,8 +230,10 @@ impl BaseConfig { } /// Open reth db and DB should be opened once per process but it can be cloned and moved to different threads. + /// skip_root_hash -> will create a mock roothasher. Used on backtesting since reth can't compute roothashes on the past. pub fn create_provider_factory( &self, + skip_root_hash: bool, ) -> eyre::Result>>> { create_provider_factory( @@ -240,7 +242,11 @@ impl BaseConfig { self.reth_static_files_path.as_deref(), self.chain_spec()?, false, - Some(self.live_root_hash_config()?), + if skip_root_hash { + None + } else { + Some(self.live_root_hash_config()?) + }, ) } diff --git a/crates/rbuilder/src/live_builder/cli.rs b/crates/rbuilder/src/live_builder/cli.rs index 5bde1f7d..5484ffdb 100644 --- a/crates/rbuilder/src/live_builder/cli.rs +++ b/crates/rbuilder/src/live_builder/cli.rs @@ -120,7 +120,7 @@ where config.base_config().log_enable_dynamic, ) .await?; - let provider = config.base_config().create_provider_factory()?; + let provider = config.base_config().create_provider_factory(false)?; let builder = config.new_builder(provider, cancel.clone()).await?; let ctrlc = tokio::spawn(async move {