Conversation
The metadata table only tracked latest_block, which is trivially derivable from the headers table. Remove it from all three backends (in-memory, MDBX, SQL) and derive get_latest_block from headers directly. Additionally consolidate SQL queries in the cold-sql backend: - get_transaction: use JOINs to fetch tx + block_hash in one query - get_receipt: use JOINs to fetch receipt + block_hash in one query - get_receipts_in_block: fix N+1 by batch-fetching all logs for a block instead of per-receipt - Remove 5 dead helper methods made redundant by the consolidation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metadatatable from all three cold storage backends (in-memory, MDBX, SQL). It only trackedlatest_block/earliest_block, which are trivially derivable from theheaderstable. This was dead weight left over from the BlockTag removal in e5f3e05.signet-cold-sql:get_transaction: 3 sequential queries → 1 JOIN queryget_receipt: 4 sequential queries → 2 (JOIN for receipt+block_hash, separate for logs)get_receipts_in_block: N+1 queries → 2 (batch-fetch all logs for a block)resolve_tx_spec,resolve_receipt_spec,fetch_tx_by_location,fetch_block_hash,fetch_receipt_by_location)Net: -235 lines
Test plan
cargo +nightly fmtcargo clippywith--all-featuresand--no-default-featuresforsignet-cold,signet-cold-mdbx,signet-cold-sqlcargo t -p signet-cold— in-memory conformance passescargo t -p signet-cold-mdbx --all-features— MDBX conformance passescargo t -p signet-cold-sql --all-features— SQLite conformance passes./scripts/test-postgres.sh— PostgreSQL conformance passes🤖 Generated with Claude Code