Skip to content

perf: reuse transaction cursor and batch fetch block indices in Transactions segment (no mapping)#19200

Closed
aleexeyy wants to merge 2 commits intoparadigmxyz:mainfrom
aleexeyy:aleexeyy/batch-block-indices-fetching-no-map-clean
Closed

perf: reuse transaction cursor and batch fetch block indices in Transactions segment (no mapping)#19200
aleexeyy wants to merge 2 commits intoparadigmxyz:mainfrom
aleexeyy:aleexeyy/batch-block-indices-fetching-no-map-clean

Conversation

@aleexeyy
Copy link

This PR addresses the same issue as #19079, but corrects a misunderstanding from my previous PR.

In my first PR (#19196) I explicitly mapped BlockBodyIndices to BlockNumbers, thinking it was necessary to preserve the mapping. After further investigation, it turns out this is unnecessary, because the block_body_indices_range method already returns indices sequentially and stops at the first missing block. Therefore, we can implement the optimization without introducing a new API method.

Note: I have a concern about using usize to enumerate a u64..u64 range. On 32-bit systems, if the range is very large, it could potentially overflow. I need to get your opinion on that, maybe I am wrong.

Changes in this PR

  • Reuse the transaction cursor across all blocks in the Transactions segment.
  • Batch fetch block body indices for all blocks in the range.
  • Consume transactions only up to the last transaction number of the current block.

Expected Benefits

  • Reduced overhead during static file writes, especially for large block ranges.
  • Simpler implementation without an extra mapping step.

References

@shekhirin
Copy link
Member

We decided to remove the transactions segment altogether, as it's unused now #19209

@shekhirin shekhirin closed this Oct 22, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Reth Tracker Oct 22, 2025
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.

2 participants