Skip to content

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

Open
dicethedev wants to merge 1 commit into
lambdaclass:mainfrom
dicethedev:fix/rename-block-proof
Open

refactor(storage): rename BlockSignatures to BlockProof#553
dicethedev wants to merge 1 commit 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 on lines +62 to +72
if path.exists()
&& DBWithThreadMode::<MultiThreaded>::list_cf(&opts, path)
.is_ok_and(|cfs| cfs.iter().any(|cf| cf == LEGACY_BLOCK_SIGNATURES_CF))
{
let mut cf_opts = Options::default();
cf_opts.set_block_based_table_factory(&block_opts);
cf_descriptors.push(ColumnFamilyDescriptor::new(
LEGACY_BLOCK_SIGNATURES_CF,
cf_opts,
));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 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.

Knowledge Base Used: Storage (ethlambda_storage)

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/storage/src/backend/rocksdb.rs
Line: 62-72

Comment:
**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.

**Knowledge Base Used:** [Storage (`ethlambda_storage`)](https://app.greptile.com/lambdaclass/-/custom-context/knowledge-base/lambdaclass/ethlambda/-/docs/storage.md)

---

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

use std::path::Path;
use std::sync::Arc;

const LEGACY_BLOCK_SIGNATURES_CF: &str = "block_signatures";

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.

No need for backwards compatibility

@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
Comment on lines +158 to +161
`slot ‖ root → MultiMessageAggregate`. This table stores the block's **merged
aggregate proof blob**, not individual signatures. It is keyed by `slot ‖ root`
(not plain root) precisely so that pruning can scan in slot order and stop
early.

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.

Suggested change
`slot ‖ root → MultiMessageAggregate`. This table stores the block's **merged
aggregate proof blob**, not individual signatures. It is keyed by `slot ‖ root`
(not plain root) precisely so that pruning can scan in slot order and stop
early.
`slot ‖ root → MultiMessageAggregate`. This table stores the block's **merged
aggregate proof blob**. It is keyed by `slot ‖ root` so that pruning can scan in
slot order and stop early.

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