Skip to content

Conversation

@yongkangc
Copy link
Member

@yongkangc yongkangc commented Dec 21, 2025

Summary

Complete RocksDB integration for history tables by wiring everything together. Closes #20388

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

Depends on: #20543#20542

Review focus

This is where behavior changes. Key areas:

  1. Correctness: Do RocksDB history lookups match MDBX semantics?
  2. Batch handling: Is the shared batch + last-shard cache correct?
  3. Deduplication: Unwind uses dedup for RocksDB's "last write wins" semantics

Changes

EitherWriter / EitherReader

  • Add account_history_info() and storage_history_info() methods to EitherReader
  • Add read_account_history_shards() and read_storage_history_shards() methods
  • Change RocksDB variant to borrow batch (&mut RocksDBBatch) for shared batch commits

HistoricalStateProviderRef

  • Update account_history_lookup() to use EitherReader with RocksDB support
  • Update storage_history_lookup() to use EitherReader with RocksDB support
  • Add RocksDBProviderFactory + StorageSettingsCache + NodePrimitivesProvider trait bounds

DatabaseProvider

  • Add pending_rocks_batch field for shared RocksDB batch
  • Add pending_history_index_last_shards cache for read-modify-write operations
  • Add append_account_history_index_rocksdb() and append_storage_history_index_rocksdb()
  • Add unwind_account_history_indices_rocksdb() and unwind_storage_history_indices_rocksdb()
  • Update HistoryWriter impl to route to RocksDB when configured
  • Flush RocksDB batch on commit()

tx_lookup.rs

  • Wire EitherWriter for transaction hash numbers

Stack

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Dec 21, 2025
@yongkangc yongkangc changed the title feat(storage): wire RocksDB into history lookups and HistoryWriter feat(storage): wire RocksDB into history lookups and HistoryWriter [3/3] Dec 21, 2025
@yongkangc yongkangc changed the title feat(storage): wire RocksDB into history lookups and HistoryWriter [3/3] feat(storage): wire RocksDB into DB Provider And Historical Provider Dec 21, 2025
@yongkangc yongkangc force-pushed the yk/pr3-rocksdb-history-routing branch from 3fe37d1 to 75a5a5d Compare December 21, 2025 00:20
@yongkangc yongkangc force-pushed the yk/pr2-rocksdb-infrastructure branch from e45acf9 to 40f84f2 Compare December 21, 2025 02:12
@yongkangc yongkangc force-pushed the yk/pr3-rocksdb-history-routing branch from 75a5a5d to 28e5af4 Compare December 21, 2025 02:12
@yongkangc yongkangc changed the title feat(storage): wire RocksDB into DB Provider And Historical Provider feat(storage): wire RocksDB into DB Provider And Historical Provider [3/3] Dec 21, 2025
@yongkangc yongkangc force-pushed the yk/pr3-rocksdb-history-routing branch from de43672 to 9e5131e Compare December 22, 2025 03:01
@yongkangc yongkangc force-pushed the yk/pr2-rocksdb-infrastructure branch from 7b937ec to 9aefeba Compare December 22, 2025 03:05
Complete RocksDB integration for history tables:

EitherWriter/EitherReader:
- Add account_history_info() and storage_history_info() methods
- Add read_account_history_shards() and read_storage_history_shards()
- Change RocksDB variant to borrow batch (&mut RocksDBBatch)

HistoricalStateProvider:
- Update account_history_lookup() to use EitherReader with RocksDB
- Update storage_history_lookup() to use EitherReader with RocksDB
- Add RocksDBProviderFactory + StorageSettingsCache trait bounds

DatabaseProvider:
- Add pending_rocks_batch and pending_history_index_last_shards fields
- Add append_account_history_index_rocksdb() method
- Add append_storage_history_index_rocksdb() method
- Add unwind_account/storage_history_indices_rocksdb() methods
- Update HistoryWriter impl to route to RocksDB when configured

tx_lookup stage:
- Wire EitherWriter for transaction hash numbers

Tests:
- Add RocksDB-specific history index tests
- Fix test transaction uniqueness
@yongkangc yongkangc force-pushed the yk/pr3-rocksdb-history-routing branch from 9e5131e to 27ea434 Compare December 22, 2025 03:10
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.

2 participants