fix(engine): send correct transaction index in prewarm task#22223
Merged
fix(engine): send correct transaction index in prewarm task#22223
Conversation
The parallel path in spawn_tx_iterator sends transactions to the prewarm channel out of order via rayon's parallel map. The prewarm task's spawn_all then assigned indices using a local counter based on arrival order, resulting in incorrect transaction indices. Send (index, tx) tuples through the prewarm channel so the original block position is preserved regardless of arrival order. Closes #20431 (first part) Amp-Thread-ID: https://ampcode.com/threads/T-019c646c-6046-711e-863a-41c5ea608e19 Co-authored-by: Amp <amp@ampcode.com>
Contributor
|
DaniPopes
approved these changes
Feb 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes incorrect transaction index in prewarm task (first part of #20431, supersedes #20911).
Motivation
The parallel path in
spawn_tx_iteratorsends transactions to the prewarm channel out of order via rayon's parallel.map(). The prewarm task'sspawn_allthen assigned indices using a local counter based on arrival order — giving wrong indices.Changes
spawn_tx_iterator: send(idx, tx)tuples through the prewarm channel in both sequential and parallel pathsPrewarmMode::Transactions: updated toReceiver<(usize, Tx)>spawn_all: use received index instead of local counterspawn_caching_with: updated receiver typeTesting
cargo check -p reth-engine-treeandcargo clippy -p reth-engine-treepass clean.Prompted by: DaniPopes