Skip to content

refactor(storage): rename BlockSignatures to BlockProof - #553

Merged
MegaRedHand merged 5 commits into
lambdaclass:mainfrom
dicethedev:fix/rename-block-proof
Aug 5, 2026
Merged

refactor(storage): rename BlockSignatures to BlockProof#553
MegaRedHand merged 5 commits into
lambdaclass:mainfrom
dicethedev:fix/rename-block-proof

Conversation

@dicethedev

Copy link
Copy Markdown
Contributor

🗒️ Description / Motivation

This PR renames the storage table previously called BlockSignatures to BlockProof.

The table stores the merged block proof (MultiMessageAggregate), not individual block signatures, so the old name was misleading. This makes the storage API, RocksDB column-family name, pruning helpers, tests, and docs match the data that is actually stored.

What Changed

  • Updated crates/storage/src/api/tables.rs

    • Renamed Table::BlockSignatures to Table::BlockProof.
    • Renamed the table label from block_signatures to block_proof.
  • Updated crates/storage/src/store.rs

    • Replaced Table::BlockSignatures usages with Table::BlockProof.
    • Renamed block proof pruning helpers and tests.
    • Updated comments around signed block reconstruction and proof pruning.
  • Updated crates/storage/src/backend/rocksdb.rs

    • Added compatibility handling for legacy DBs that still contain the old block_signatures column family.
  • Updated docs and comments

    • Refreshed storage docs and architecture references to use BlockProof.

Correctness / Behavior Guarantees

  • No block/proof encoding behavior changes.
  • The table still uses the same slot || root key format.
  • Genesis/anchor behavior is preserved: get_signed_block still synthesizes an empty proof only for slot 0.
  • Finalized block proofs are still pruned by the same retention rule, now via prune_old_block_proofs.

Tests Added / Run

cargo fmt --all -- --check
cargo test -p ethlambda-storage --lib --offline block_proof
cargo test -p ethlambda-storage --lib --offline prune_old_block_proofs
cargo test -p ethlambda-storage --lib --offline get_signed_block
make lint
git diff --check

Related Issues / PRs

✅ Verification Checklist

  • Ran make fmt — clean
  • Ran make lint (clippy with -D warnings) — clean
  • Ran make test (cargo test --workspace --profile release-fast) — all passing

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consistently renames block-signature storage concepts to block proofs across the API, pruning helpers, documentation, and RocksDB schema.

  • Renames Table::BlockSignatures and its column-family label to BlockProof and block_proof.
  • Updates Store reads, writes, pruning helpers, tests, comments, RPC references, and architecture documentation.
  • Adds RocksDB detection so databases containing the legacy column family can still be opened.

Confidence Score: 4/5

The legacy proof records must be migrated or read through a fallback before this PR is safe to merge.

Existing databases open both column families, but all signed-block reads target only the newly created block_proof family, making previously persisted non-genesis proofs unavailable.

Files Needing Attention: crates/storage/src/backend/rocksdb.rs, crates/storage/src/api/tables.rs, crates/storage/src/store.rs

Important Files Changed

Filename Overview
crates/storage/src/backend/rocksdb.rs Adds legacy-CF opening compatibility, but leaves all records in that family inaccessible after upgrading.
crates/storage/src/api/tables.rs Renames the public table variant and physical column-family label, creating the need for a real data migration or fallback.
crates/storage/src/store.rs Consistently adopts the new naming, but reads only the new table and therefore cannot reconstruct blocks backed by legacy proof records.
docs/data_storage.md Updates the storage documentation and table count consistently with the renamed table.
docs/infographics/ethlambda_architecture.html Updates the architecture table label without changing executable behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Existing RocksDB] --> B[legacy block_signatures CF]
  A --> C[RocksDBBackend::open]
  C --> D[Open legacy CF descriptor]
  C --> E[Create/open block_proof CF]
  F[Store reads Table::BlockProof] --> E
  B -. no migration or fallback .-> F
  E --> G[Missing legacy proofs]
Loading
Prompt To Fix All With AI
### Issue 1
crates/storage/src/backend/rocksdb.rs:62-72
**Legacy proofs become inaccessible**

When a node upgrades with an existing `block_signatures` column family, this code opens that family but neither migrates its records nor makes reads fall back to it. All non-genesis proofs are instead read from the newly created, empty `block_proof` family, causing previously stored signed blocks to return `None`, disappear from block responses, or trigger callers that require the persisted block to panic.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "refactor(storage): rename BlockSignature..." | Re-trigger Greptile

Comment thread crates/storage/src/backend/rocksdb.rs Outdated
Comment thread crates/storage/src/backend/rocksdb.rs Outdated

@MegaRedHand MegaRedHand left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. However, please drop the BlockSignatures -> BlockProof migration logic, since we don't want backwards compatibility during devnets

Comment thread docs/data_storage.md Outdated
@dicethedev
dicethedev requested a review from MegaRedHand August 5, 2026 11:25
Comment thread crates/storage/src/store.rs
The merge with main resolved the BlockSignatures -> BlockProof rename by
keeping the pre-lambdaclass#548 body: a full-table scan collecting keys below the
cutoff plus a delete_batch. That scan's cost tracks chain height instead
of the handful of keys leaving the retention window, since every pass
re-seeks past the tombstones the previous passes left behind, which is
what lambdaclass#548 removed.

Reapply the range delete on the renamed table: the delete_range plumbing
survived the merge, only its caller was lost. Prune again returns the
exclusive slot it pruned below (0 = nothing pruned), which a range delete
can report without reading the table back, and returns early when the
cutoff saturates to 0 so a young chain writes no empty tombstone.

@MegaRedHand MegaRedHand left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MegaRedHand
MegaRedHand merged commit 89b3d6e into lambdaclass:main Aug 5, 2026
5 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.

Rename BlockSignatures to BlockProof

2 participants