Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
b685f48
feat: pre-warming cache to build Keyset for all the transactions in m…
defistar Jan 30, 2026
dd18231
feat: worker-pool sub-module for transaction-simulation trigger
defistar Jan 31, 2026
c88eaae
feat: integrate worker-pool in to pool crate
defistar Jan 31, 2026
ea5e001
fix: fix broken unit tests for pre-warming cache updater
defistar Jan 31, 2026
8c6dae8
feat: pre-warming feature changes
defistar Feb 2, 2026
531b29b
feat: enhance unbounded-queue to bounded-queue for pre-warming worker…
defistar Feb 2, 2026
6ebb0fc
feat: worker-pool for prewarming cache builder - enhanced to use try_…
defistar Feb 3, 2026
8442569
feat: pre-warming feature changes
defistar Feb 3, 2026
a54b59a
feat: add TODO comments for update_snapshot function in worker_pool w…
defistar Feb 3, 2026
229e5bc
feat: pre-warming feature macro added to payload crate
defistar Feb 3, 2026
8b27c8d
feat: migrate parallel prefetch of values from mdbx from rayon to tokio
defistar Feb 3, 2026
05d6b1b
fix: snapshotState enhancements and unit tests
defistar Feb 4, 2026
de7f038
feat: unit,integration and benchmark tests for pre-warming module
defistar Feb 4, 2026
a20056d
feat: increase test coverage for simulator, snapshot-state and worker…
defistar Feb 4, 2026
ccaa8b4
feat: pre-warming metrics
defistar Feb 5, 2026
ed49e89
fix compile issue in the txpool
Vui-Chee Feb 5, 2026
cf07cfa
link up pre-warming feats across crates
Vui-Chee Feb 5, 2026
f644305
feat: logging added to print pre-warming ENABLED feature
defistar Feb 5, 2026
63bad22
fix: ClapAction to set pre-warming enable flag
defistar Feb 5, 2026
b8a2b33
feat: call initialize-prewarming-config in optimism node
defistar Feb 5, 2026
400f7b9
fix: initialize-prewarming config in optimism.node
defistar Feb 6, 2026
eb73920
fix: pre-warming feature specific code in optimism node
defistar Feb 6, 2026
3c156b0
cherry picked jovian fix
xzav3r Feb 5, 2026
afaeb88
one shot cleanup unused
Vui-Chee Feb 6, 2026
9a762e4
fix: resolve conflicts on node-builder cargo.toml
defistar Feb 12, 2026
17af54a
fix: cached_reats made mutable
defistar Feb 12, 2026
b6352ae
feat: Wire pre-warming feature into Optimism payload builder and add …
defistar Feb 13, 2026
d8464d2
fix: remove obselete file
defistar Feb 13, 2026
98fabfb
fix: pre-warm cache keys not loading to global-cache
defistar Feb 23, 2026
959d9e5
feat: logging enhancements pre-fetch values
defistar Feb 24, 2026
c36220c
feat: metric capture code for pre-fetch
defistar Feb 24, 2026
3f5d071
feat: capture metrics for cache-hit and cache-miss for pre-warming an…
defistar Feb 25, 2026
5a5afa9
feat: script to validate and benchmark the pre-warming and pre-fetch …
defistar Feb 25, 2026
7655c94
feat: pre-warming improvements for evm simulator
defistar Mar 2, 2026
13d5482
fix: race condition issue during pre-warming
defistar Mar 2, 2026
e607fdc
feart: benchmarking script enhancement for pre-warming feature
defistar Mar 2, 2026
2ec87c5
feat: storage-slot caching for pre-warming
defistar Mar 2, 2026
ee95697
feat: simualtor metric logging updated
defistar Mar 3, 2026
b193650
feat(txpool): change default pre-warming workers from CPUs/2 to all CPUs
defistar Mar 3, 2026
b4fd701
feat(pre-warming): add devnet metrics scripts and benchmark improvements
defistar Mar 3, 2026
277dc34
feat(pre-warming): make prefetch threads configurable via CLI
defistar Mar 3, 2026
ef9c923
fix: pre-earming unit test failing fixes
defistar Mar 3, 2026
e2aecde
feat: add dedicated configuration variable pre-fetch-worker
defistar Mar 3, 2026
45d19a1
feat: simulator heuristics optimisation
defistar Mar 3, 2026
713207a
feat: optimise transaction-simulation heuristics
defistar Mar 3, 2026
4bf66a0
feat: optimise simulator and monitoring guide for pre-warming metrics
defistar Mar 4, 2026
c3e95c5
feat: metrics to capture the cache hit rate
defistar Mar 5, 2026
2ef5728
fix: full-load pre-warming simulation test script
defistar Mar 5, 2026
3247fce
feat: enhance report generation for pre-warming benchmark test scripts
defistar Mar 5, 2026
27cb5b5
fix: pre-warming benchmark report metric script and cahce hit correct…
defistar Mar 5, 2026
3c44629
fix: default parallelism set for worker-pool in prefetch
defistar Mar 5, 2026
8f4e280
fix: optimise TPS for pre-warming benchmark testing
defistar Mar 6, 2026
e12207e
feat: pre-warming and map optimisations
defistar Mar 10, 2026
a3a7e50
feat: TPS optimisation for pre-warming
defistar Mar 11, 2026
72c49b1
feat: simulation optimisation
defistar Mar 11, 2026
a3abda0
feat: batch-writes for pre-warm cache
defistar Mar 11, 2026
7f04cdf
feat: simulator optimisation for pre-warming feature
defistar Mar 13, 2026
0beea6b
fix: downgrade hot-path simulation logs from warn/info to trace
defistar Mar 13, 2026
8956d97
fix: isolate pre-warming simulations to dedicated rayon thread pool
defistar Mar 13, 2026
f281cda
chore: add pre-warming test and benchmark artifacts to .gitignore
defistar Mar 13, 2026
2837674
feat: pre-warming core module refactor and optimisations
defistar Mar 13, 2026
4d7ecbb
feat: wire pre-warming into node, payload builder and CLI args
defistar Mar 13, 2026
9e893c7
fix: replace worker_loop with semaphore-bounded drain_loop to prevent…
defistar Mar 13, 2026
3ff43e7
perf: simulation & prefetch targeted optimisations
defistar Mar 13, 2026
6858bbe
fix: use unbounded channel to eliminate simulation drops
defistar Mar 13, 2026
68e26e8
fix: harden pre-warming simulator and prefetch against edge cases
defistar Mar 13, 2026
fa679f5
perf: replace RwLock<AHashMap> with DashMap + double-check locking in…
defistar Mar 13, 2026
8c519c8
perf: eliminate prefetch overhead causing 37% TPS regression
defistar Mar 13, 2026
4696c2d
fix: enable PreWarmedCache eviction to prevent memory explosion
defistar Mar 13, 2026
168b5fd
fix: restore ~98% cache hit rate by prefetching full mempool instead …
defistar Mar 13, 2026
36a6a20
fix: audit fixes — correct snapshot reuse, full mempool coverage, and…
defistar Mar 13, 2026
9f9dcb3
fix: restore warm simulation snapshot for prefetch — remove stale has…
defistar Mar 13, 2026
70737cd
perf: incremental DashMap invalidation on snapshot rotation
defistar Mar 13, 2026
5512a47
perf: pause simulation workers during block build to eliminate CPU co…
defistar Mar 13, 2026
a687c8c
Revert "perf: pause simulation workers during block build to eliminat…
defistar Mar 13, 2026
e8e3a31
perf: deduplicate prefetch keys to eliminate O(mempool) redundant que…
defistar Mar 13, 2026
1b8ea6d
perf: cap prefetch at 4,000 TXs to eliminate block-slot misses
defistar Mar 13, 2026
c4d2d2b
perf: gas-price ordered prefetch — target top-priority TXs within cap
defistar Mar 13, 2026
c4322ad
perf: increase PREFETCH_TX_CAP 4,000 → 8,000 for full block coverage
defistar Mar 13, 2026
8c15ce1
feat: TX arrival-to-inclusion latency metric + EIP-2930 access list s…
defistar Mar 14, 2026
ef2452f
perf: priority-ordered simulation queue + basefee tx filter
defistar Mar 14, 2026
be98e77
perf: lower simulation thread CPU priority via nice(10) on Linux
defistar Mar 14, 2026
411f866
perf: rayon par_iter prefetch + pause simulation during block build
defistar Mar 15, 2026
0de7cb8
chore: update Cargo.lock after release build
defistar Mar 15, 2026
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
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,55 @@ __pycache__/
# direnv
.envrc
.direnv/

# Pre-warming benchmark and test artifacts
.devnet-sim-v2-*/
.devnet-simulation-*/
.benchmark-*/
.high-load-benchmark-*/
.realistic-benchmark-*/
.reliable-bench-*/
.prod-bench-*/
.tps-test-*/
.quick-test-*/
.max-workers-test*/
.worker-test/
.chain-id-test/
.eoa-debug/
.final-test/
.test-*/
.load_test_results
.multi_sender_benchmark_results
.prod_benchmark_results
.reliable_benchmark_results
.sustained_benchmark_results
.tps_results

# Benchmark/test log files
*.log
benchmark_*.txt
benchmark_report*.txt
benchmark_summary.txt
build_final.log
build_output.txt
debug_output.txt
prod_bench_output.txt
test_output.txt
test_final_result.txt
validation_results.txt
op-reth.pid

# Test capture files
test_capture*.json

# Misc test scripts not meant for repo
diagnose-prewarming.sh
test-prewarming-*.sh
test-prewarming-*.py
.devnet-test/
JIRA_FULL_EVM_SIMULATION.md
benchmark_report.md
continuous_benchmark_report.md
docs/profiling-prewarming/
my-docs/
run-docs/
15 changes: 11 additions & 4 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ snmalloc-rs = { version = "0.3.7", features = ["build_cc"] }
aes = "0.8.1"
ahash = "0.8"
anyhow = "1.0"
nohash-hasher = "0.2"
bindgen = { version = "0.71", default-features = false }
block-padding = "0.3.2"
cc = "1.2.15"
Expand Down
41 changes: 0 additions & 41 deletions HARDFORK-CHECKLIST.md

This file was deleted.

7 changes: 7 additions & 0 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ js-tracer = [

dev = ["reth-ethereum-cli/dev"]

# Pre-warming cache for transaction simulation
# Extracts state keys via simulation before execution, batch-fetches to reduce I/O
pre-warming = [
"reth-transaction-pool/pre-warming",
"reth-node-core/pre-warming",
]

asm-keccak = [
"reth-node-core/asm-keccak",
"reth-primitives/asm-keccak",
Expand Down
2 changes: 0 additions & 2 deletions crates/engine/local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ eyre.workspace = true
tracing.workspace = true

op-alloy-rpc-types-engine = { workspace = true, optional = true }
reth-optimism-chainspec = { workspace = true, optional = true }

[lints]
workspace = true

[features]
op = [
"dep:op-alloy-rpc-types-engine",
"dep:reth-optimism-chainspec",
"reth-payload-primitives/op",
"reth-primitives-traits/op",
]
43 changes: 35 additions & 8 deletions crates/engine/local/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,44 @@ where
&self,
parent: &SealedHeader<ChainSpec::Header>,
) -> op_alloy_rpc_types_engine::OpPayloadAttributes {
use alloy_primitives::B64;
use reth_chainspec::BaseFeeParams;
use std::env;
/// Dummy system transaction for dev mode.
/// OP Mainnet transaction at index 0 in block 124665056.
///
/// <https://optimistic.etherscan.io/tx/0x312e290cf36df704a2217b015d6455396830b0ce678b860ebfcc30f41403d7b1>
const TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056: [u8; 251] = alloy_primitives::hex!(
"7ef8f8a0683079df94aa5b9cf86687d739a60a9b4f0835e520ec4d664e2e415dca17a6df94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e200000146b000f79c500000000000000040000000066d052e700000000013ad8a3000000000000000000000000000000000000000000000000000000003ef1278700000000000000000000000000000000000000000000000000000000000000012fdf87b89884a61e74b322bbcf60386f543bfae7827725efaaf0ab1de2294a590000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985"
);

// Configure EIP-1559 parameters for dev mode. These can be overridden via environment
// variables (OP_DEV_EIP1559_DENOMINATOR, OP_DEV_EIP1559_ELASTICITY, OP_DEV_GAS_LIMIT),
// otherwise defaults from Optimism's BaseFeeParams are used. The parameters are encoded
// as an 8-byte value (denominator + elasticity) required by Optimism's Jovian fork.
let default_eip_1559_params = BaseFeeParams::optimism();
let denominator = env::var("OP_DEV_EIP1559_DENOMINATOR")
.ok()
.and_then(|v| v.parse::<u32>().ok())
.unwrap_or(default_eip_1559_params.max_change_denominator as u32);
let elasticity = env::var("OP_DEV_EIP1559_ELASTICITY")
.ok()
.and_then(|v| v.parse::<u32>().ok())
.unwrap_or(default_eip_1559_params.elasticity_multiplier as u32);
let gas_limit = env::var("OP_DEV_GAS_LIMIT").ok().and_then(|v| v.parse::<u64>().ok());

let mut eip1559_bytes = [0u8; 8];
eip1559_bytes[0..4].copy_from_slice(&denominator.to_be_bytes());
eip1559_bytes[4..8].copy_from_slice(&elasticity.to_be_bytes());
let eip_1559_params = Some(B64::from(eip1559_bytes));

op_alloy_rpc_types_engine::OpPayloadAttributes {
payload_attributes: self.build(parent),
// Add dummy system transaction
transactions: Some(vec![
reth_optimism_chainspec::constants::TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056
.into(),
]),
transactions: Some(vec![TX_SET_L1_BLOCK_OP_MAINNET_BLOCK_124665056.into()]),
no_tx_pool: None,
gas_limit: None,
eip_1559_params: None,
min_base_fee: None,
gas_limit,
eip_1559_params,
min_base_fee: Some(0),
}
}
}
1 change: 0 additions & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,6 @@ where
self.canonical_in_memory_state.set_pending_block(block.clone());
}

let insert_tree_start = Instant::now();
self.state.tree_state.insert_executed(block.clone());
self.payload_validator.on_inserted_executed_block(block.clone());
self.metrics.engine.inserted_already_executed_blocks.increment(1);
Expand Down
22 changes: 11 additions & 11 deletions crates/engine/tree/src/tree/payload_processor/multiproof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ impl From<StateChangeSource> for Source {
}
}

/// Maximum number of targets to batch together for prefetch batching.
/// Maximum number of targets to batch together for prefetch pre-warming.
/// Prefetches are just proof requests (no state merging), so we allow a higher cap than state
/// updates
const PREFETCH_MAX_BATCH_TARGETS: usize = 512;

/// Maximum number of prefetch messages to batch together.
/// Prevents excessive batching even with small messages.
/// Prevents excessive pre-warming even with small messages.
const PREFETCH_MAX_BATCH_MESSAGES: usize = 16;

/// The default max targets, for limiting the number of account and storage proof targets to be
Expand Down Expand Up @@ -815,11 +815,11 @@ impl MultiProofTask {
.filter(|proof| !proof.is_empty())
}

/// Processes a multiproof message, batching consecutive prefetch messages.
/// Processes a multiproof message, pre-warming consecutive prefetch messages.
///
/// For prefetch messages, drains queued prefetch messages and merges them into one batch before
/// processing, storing one pending message (different type or over-cap) to handle on the next
/// iteration. State updates are processed directly without batching.
/// iteration. State updates are processed directly without pre-warming.
///
/// Returns `true` if done, `false` to continue.
fn process_multiproof_message<P>(
Expand Down Expand Up @@ -851,7 +851,7 @@ impl MultiProofTask {

// Batch consecutive prefetch messages up to limits.
// EmptyProof messages are handled inline since they're very fast (~100ns)
// and shouldn't interrupt batching.
// and shouldn't interrupt pre-warming.
while accumulated_count < PREFETCH_MAX_BATCH_TARGETS &&
ctx.accumulated_prefetch_targets.len() < PREFETCH_MAX_BATCH_MESSAGES
{
Expand All @@ -867,7 +867,7 @@ impl MultiProofTask {
ctx.accumulated_prefetch_targets.push(next_targets);
}
Ok(MultiProofMessage::EmptyProof { sequence_number, state }) => {
// Handle inline - very fast, don't break batching
// Handle inline - very fast, don't break pre-warming
batch_metrics.proofs_processed += 1;
if let Some(combined_update) = self.on_proof(
sequence_number,
Expand Down Expand Up @@ -1177,14 +1177,14 @@ impl MultiProofTask {
}
}

/// Context for multiproof message batching loop.
/// Context for multiproof message pre-warming loop.
///
/// Contains processing state that persists across loop iterations.
///
/// Used by `process_multiproof_message` to batch consecutive prefetch messages received via
/// `try_recv` for efficient processing.
struct MultiproofBatchCtx {
/// Buffers a non-matching message type encountered during batching.
/// Buffers a non-matching message type encountered during pre-warming.
/// Processed first in next iteration to preserve ordering while allowing same-type
/// messages to batch.
pending_msg: Option<MultiProofMessage>,
Expand All @@ -1195,7 +1195,7 @@ struct MultiproofBatchCtx {
/// Timestamp when state updates finished. `Some` indicates all state updates have been
/// received.
updates_finished_time: Option<Instant>,
/// Reusable buffer for accumulating prefetch targets during batching.
/// Reusable buffer for accumulating prefetch targets during pre-warming.
accumulated_prefetch_targets: Vec<MultiProofTargets>,
}

Expand Down Expand Up @@ -1759,7 +1759,7 @@ mod tests {

let proofs_requested =
if let Ok(MultiProofMessage::PrefetchProofs(targets)) = task.rx.recv() {
// simulate the batching logic
// simulate the pre-warming logic
let mut merged_targets = targets;
let mut num_batched = 1;
while let Ok(MultiProofMessage::PrefetchProofs(next_targets)) = task.rx.try_recv() {
Expand Down Expand Up @@ -1971,7 +1971,7 @@ mod tests {
assert!(matches!(pending, MultiProofMessage::StateUpdate(_, _)));

// Pending message should be handled before the next select loop.
// StateUpdate is processed directly without batching.
// StateUpdate is processed directly without pre-warming.
assert!(!task.process_multiproof_message(
pending,
&mut ctx,
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/tree/payload_processor/prewarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,8 @@ where
let saved_cache = saved_cache.expect("BAL prewarm should only run with cache");
let caches = saved_cache.cache().clone();
let cache_metrics = saved_cache.metrics().clone();
let state_provider = CachedStateProvider::new(state_provider, caches, cache_metrics);
let state_provider =
CachedStateProvider::new(state_provider, caches, cache_metrics).prewarm();

let start = Instant::now();

Expand Down
1 change: 0 additions & 1 deletion crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ reth-ethereum-primitives.workspace = true
revm.workspace = true
reth-evm.workspace = true
reth-storage-errors.workspace = true
reth-node-metrics.workspace = true

# Alloy
alloy-primitives.workspace = true
Expand Down
Loading