Skip to content

Conversation

@yongkangc
Copy link
Member

@yongkangc yongkangc commented Dec 21, 2025

Summary

Extract the history lookup algorithm into a reusable function that can be shared between MDBX and RocksDB backends.

This is PR 1/3 of a stacked PR series that splits #20412 for easier review. Closes #20388

Review focus

  • Verify find_changeset_block_from_index correctly captures the original algorithm
  • Check documentation on HistoryInfo variants is accurate

Changes

  • Add HistoryInfo enum with detailed documentation explaining each variant
  • Extract find_changeset_block_from_index() function containing the core rank/select algorithm
  • Refactor HistoricalStateProviderRef::history_info() to use the shared function
  • Move the function below the impl block for better code organization
  • Export HistoryInfo and find_changeset_block_from_index from providers module

Stack

Add HistoryInfo enum with documentation and extract the shared
rank/select algorithm into history_info_from_shard function.

This prepares for RocksDB integration by making the history lookup
algorithm reusable across different storage backends (MDBX, RocksDB).

Changes:
- Add HistoryInfo enum with detailed doc comments
- Add history_info_from_shard function with the core algorithm
- Refactor history_info method to use the shared function
- Export HistoryInfo and history_info_from_shard from providers module
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Dec 21, 2025
@yongkangc yongkangc changed the title refactor(storage): extract shared history_info_from_shard algorithm refactor(storage): extract shared history_info_from_shard algorithm [1/3] Dec 21, 2025
…_index

The new name better describes the function's purpose: given a history
index shard, find which changeset block contains the historical value
for a target block.

Also moved the function below the impl block for better code organization.
@yongkangc yongkangc force-pushed the yk/pr1-history-info-abstraction branch from 6f8341e to 244c864 Compare December 22, 2025 03:04
@yongkangc yongkangc changed the title refactor(storage): extract shared history_info_from_shard algorithm [1/3] refactor(storage): extract shared find_changeset_block_from_index algorithm [1/3] Dec 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: Backlog

Development

Successfully merging this pull request may close these issues.

Use EitherReader/EitherWriter in DatabaseProvider and HistoricalStateProvider

2 participants