Skip to content

perf(engine): txpool prewarming#26378

Merged
pepyakin merged 33 commits into
mainfrom
alexey/txpool-prewarm
Jul 23, 2026
Merged

perf(engine): txpool prewarming#26378
pepyakin merged 33 commits into
mainfrom
alexey/txpool-prewarm

Conversation

@shekhirin

Copy link
Copy Markdown
Member

No description provided.

@shekhirin

Copy link
Copy Markdown
Member Author

cyclops audit

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

cc @shekhirin

Cyclops audit event published. View workflow run

Config: config: default, iterations: default, hours: default

@tempoxyz-bot tempoxyz-bot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️ Cyclops Review — No actionable findings.

The parent-state read invariant was traced through REVM execution, snapshot publication, payload validation, and the BAL state-root consumer. Speculative writes remain isolated in REVM state, and the current validator path only attaches snapshots tagged for the payload parent.

Reviewer Callouts
  • Per-parent cache growth and retained high-water allocation (crates/engine/execution-cache/src/txpool.rs:26-30, crates/engine/tree/src/tree/txpool_prewarm.rs:514-519, crates/engine/tree/src/tree/txpool_prewarm.rs:628-632): Refresh limits do not cap unique state entries accumulated during one parent; each wave clones the full maps, and clear() retains capacity. Please confirm memory and clone cost under a long head stall plus txpool churn, or add an entry/byte budget.
  • Synchronous Engine API wait (crates/engine/tree/src/tree/txpool_prewarm.rs:322-325, crates/engine/tree/src/tree/txpool_prewarm.rs:800-805, crates/engine/tree/src/tree/mod.rs:1760-1769): RethNewPayload can wait through the current gas-bounded EVM transaction because cancellation is checked between transactions. Please confirm this fits the latency budget.
  • Attributes-free FCU error propagation (crates/engine/tree/src/tree/mod.rs:1269-1277): Enabling canonical-head notifications makes an already-canonical FCU without payload attributes perform a fallible header lookup and propagate its error. Confirm that the opt-in performance feature should alter this hot-path behavior; otherwise make notification failure best-effort.
  • Future snapshot concurrency (crates/engine/execution-cache/src/txpool.rs:33-43): The three maps are cloned under independent locks. The current single-writer wave boundary is safe, but preserve/enforce quiescence or add aggregate synchronization before parallelizing cache writers.

@shekhirin
shekhirin force-pushed the alexey/txpool-prewarm branch 3 times, most recently from 13c289a to b58e867 Compare July 16, 2026 15:27
@pepyakin
pepyakin force-pushed the alexey/txpool-prewarm branch 2 times, most recently from 24319ab to 57332d5 Compare July 17, 2026 20:44
@pepyakin

Copy link
Copy Markdown
Member

cyclops audit

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

cc @pepyakin

Cyclops audit event published. View workflow run

Config: config: default, iterations: default, hours: default

@tempoxyz-bot

tempoxyz-bot commented Jul 17, 2026

Copy link
Copy Markdown
Member

👁️ Cyclops Security Review

57332d5

🧭 Verifying · mode=normal · workers 3/3 done (0 left) · verify pending 1 · ending soon

Worker Engine Latest Status Status
pr-26378-w1 claude-opus-4-8 ✅ Iteration 3 · Audit Done
pr-26378-w2 gpt-5.5 ✅ Iteration 3 · Audit Done
pr-26378-w3 gpt-5.6-sol ⏰ Iteration 3 · Audit Done

Findings

# Finding Severity Status
1 Unbounded txpool-prewarm cache enables memory-exhaustion DoS (feature-gated) Medium Iteration 1 · Audit
2 Cyclops invariant review — PR #26378 Unknown Iteration 1 · Verify
⚙️ Controls
  • 🚀 Keep only 1 remaining iteration per worker after the current work finishes.
  • 👀 Keep only 2 remaining iterations per worker after the current work finishes.
  • ❤️ Let only worker 1 continue; other workers skip queued iterations.
  • 😄 Let only worker 2 continue; other workers skip queued iterations.
  • 🎉 End faster by skipping queued iterations and moving toward consolidation.
  • 😕 Stop active workers/verifiers now and start consolidation immediately.

📜 26 events

🔍 pr-26378-w1 iter 1/3 [audit-general.md]
🔍 pr-26378-w2 iter 1/3 [audit-ripple.md]
🔍 pr-26378-w3 iter 1/3 [audit-invariants.md]
🛡️ pr-26378-w1 iter 1 — defense-in-depth
🚨 Finding: Unbounded txpool-prewarm cache enables memory-exhaustion DoS (feature-gated) (Medium)
🔍 pr-26378-w1 iter 2/3 [audit-invariants.md]
pr-26378-w2 iter 1 — clear
🔍 pr-26378-w2 iter 2/3 [audit-ripple.md]
pr-26378-w1 iter 2 — clear
🔍 pr-26378-w1 iter 3/3 [audit-invariants.md]
pr-26378-w1 iter 3 — clear
🏁 pr-26378-w1 done
🚨 pr-26378-w3 iter 1 — finding
🚨 Finding: Cyclops invariant review — PR #26378 (Unknown)
🔍 pr-26378-w3 iter 2/3 [audit-ripple.md]
🔬 Verifying: Cyclops invariant review — PR #26378
pr-26378-w2 iter 2 — clear
🔍 pr-26378-w2 iter 3/3 [audit-invariants.md]
📋 Verify: Cyclops invariant review — PR #26378 → ✅ Verified
pr-26378-w2 iter 3 — clear
🏁 pr-26378-w2 done
pr-26378-w3 iter 2 — timeout
🔍 pr-26378-w3 iter 3/3 [audit-ripple.md]
pr-26378-w3 iter 3 — timeout
⚠️ Worker 3 completed partially (1 usable, 2 failed); continuing with available reports
🏁 pr-26378-w3 done

@pepyakin
pepyakin force-pushed the alexey/txpool-prewarm branch from 75062ab to e7192f4 Compare July 20, 2026 09:21
@pepyakin
pepyakin marked this pull request as ready for review July 20, 2026 09:38
@github-project-automation github-project-automation Bot moved this from Backlog to In Progress in Reth Tracker Jul 20, 2026
Comment thread crates/evm/evm/src/lib.rs Outdated
Comment thread crates/node/builder/src/txpool_prewarm.rs Outdated
Comment thread crates/engine/tree/src/tree/txpool_prewarm/cache.rs Outdated
Comment thread crates/engine/tree/src/tree/txpool_prewarm/worker.rs Outdated
@pepyakin
pepyakin force-pushed the alexey/txpool-prewarm branch from a95fcd2 to 724b684 Compare July 21, 2026 12:09
@pepyakin

Copy link
Copy Markdown
Member

derek bench mode=rpc metrics=true

@decofe

decofe commented Jul 21, 2026

Copy link
Copy Markdown
Member

cc @pepyakin

⚠️ Benchmark cancelled. View logs

pepyakin and others added 8 commits July 21, 2026 14:55
Removes the ConfigureEvm::txpool_prewarm_env hook whose Ok(None) default
made txpool prewarming a silent no-op for non-ethereum nodes. The worker
now reuses the canonical head's own EVM env and additionally disables the
basefee check: the predicted attributes were mocked anyway, and fee
viability is the pool's concern, not the warmer's.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the hand-rolled read-through cache and its EvmStateProvider
wrapper with reth-revm's CachedReads, layered under revm State via
as_db_mut. The published snapshot keeps its lookup API but wraps
Arc<CachedReads>, so cache-tier consumers are unchanged. Publication is
gated on entry-count growth, which replaces the dirty flag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pepyakin
pepyakin force-pushed the alexey/txpool-prewarm branch from c160707 to d1672b5 Compare July 23, 2026 10:53

@mattsse mattsse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One configuration guard to add.

Comment thread crates/node/core/src/args/engine.rs Outdated
pepyakin and others added 2 commits July 23, 2026 18:23
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

@mattsse mattsse left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pepyakin
pepyakin added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 1c2942a Jul 23, 2026
34 checks passed
@pepyakin
pepyakin deleted the alexey/txpool-prewarm branch July 23, 2026 17:28
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Reth Tracker Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants