Skip to content

fix(rpc): consolidate hot storage reads and document consistency model#118

Merged
prestwich merged 4 commits intodevelopfrom
prestwich/eng-1901-rpc-consistency-docs
Mar 24, 2026
Merged

fix(rpc): consolidate hot storage reads and document consistency model#118
prestwich merged 4 commits intodevelopfrom
prestwich/eng-1901-rpc-consistency-docs

Conversation

@prestwich
Copy link
Member

Summary

  • Consolidate hot_reader_at_block to single MDBX transaction — state query endpoints (getBalance, getStorageAt, getCode, getTransactionCount) now resolve block IDs and query data within the same MDBX read transaction, eliminating a race where a reorg between two transactions could produce inconsistent results
  • Consolidate resolve_evm_block to single MDBX transaction — EVM execution endpoints (eth_call, estimateGas, createAccessList) now fetch the header and construct the revm database from the same MDBX snapshot, following the same pattern used by the block-processor crate
  • Document consistency model — comprehensive rustdoc on StorageRpcCtx explaining the two-tier architecture, query routing, cold lag, and deferred hash-based verification; ordering-guarantee rustdoc on BlockTags explaining atomic ordering, update/rewind safety, and race windows

Closes ENG-1901.

Test plan

  • cargo t -p signet-rpc — all 55 tests pass
  • cargo clippy -p signet-rpc --all-features --all-targets — clean
  • cargo doc -p signet-rpc --no-deps — docs render cleanly
  • cargo +nightly fmt — formatted

🤖 Generated with Claude Code

prestwich and others added 3 commits March 24, 2026 11:26
Opens the read transaction before resolving the block ID so that
hash→number lookup and subsequent data query share the same MDBX
snapshot. Eliminates a race where a reorg between the two
transactions could produce inconsistent results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Header lookup and RevmRead construction now share one MDBX read
transaction. This eliminates a race where a reorg between two
separate transactions could yield a header from one fork and EVM
state from another. Follows the same pattern used by the
block-processor crate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds module-level and struct-level rustdoc explaining Acquire/Release
ordering, multi-tag update order, rewind safety, and the race window
between tag resolution and storage queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich requested a review from a team as a code owner March 24, 2026 15:26
Adds module-level and struct-level rustdoc explaining the two-tier
architecture, query routing table, resolve-then-query pattern,
cold lag characteristics, and deferred hash-based verification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich force-pushed the prestwich/eng-1901-rpc-consistency-docs branch from 2c59169 to c9559ee Compare March 24, 2026 15:39
@prestwich prestwich merged commit 6ab1327 into develop Mar 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants