Skip to content

fix(engine): send correct transaction index in prewarm task#22223

Merged
DaniPopes merged 1 commit intomainfrom
danipopes/fix-prewarm-tx-index
Feb 16, 2026
Merged

fix(engine): send correct transaction index in prewarm task#22223
DaniPopes merged 1 commit intomainfrom
danipopes/fix-prewarm-tx-index

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 16, 2026

Summary

Fixes incorrect transaction index in prewarm task (first part of #20431, supersedes #20911).

Motivation

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 — giving wrong indices.

Changes

  • spawn_tx_iterator: send (idx, tx) tuples through the prewarm channel in both sequential and parallel paths
  • PrewarmMode::Transactions: updated to Receiver<(usize, Tx)>
  • spawn_all: use received index instead of local counter
  • spawn_caching_with: updated receiver type

Testing

cargo check -p reth-engine-tree and cargo clippy -p reth-engine-tree pass clean.

Prompted by: DaniPopes

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>
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Feb 16, 2026
@gakonst gakonst added the A-engine Related to the engine implementation label Feb 16, 2026
@github-actions
Copy link
Contributor

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
reth-engine-tree: patch
---

Fixed transaction index tracking in prewarm task to correctly send the original block transaction index instead of the worker iteration count.

Add changelog to commit this to your branch.

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Feb 16, 2026
@DaniPopes DaniPopes enabled auto-merge February 16, 2026 04:52
@DaniPopes DaniPopes added this pull request to the merge queue Feb 16, 2026
Merged via the queue into main with commit f0c4be1 Feb 16, 2026
45 of 50 checks passed
@DaniPopes DaniPopes deleted the danipopes/fix-prewarm-tx-index branch February 16, 2026 06:29
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-engine Related to the engine implementation

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants