refactor(chain): commit block digest over a transaction root#131
Open
erenyegit wants to merge 1 commit into
Open
refactor(chain): commit block digest over a transaction root#131erenyegit wants to merge 1 commit into
erenyegit wants to merge 1 commit into
Conversation
Fold a block's transactions into a domain-separated transaction-root commitment and commit the block digest over that root instead of inlining every transaction. This lets a compact BlockHeader reproduce and check the block digest without carrying the transactions, then read the authenticated state_root/state_range out of it — the foundation the bridge's certified checkpoint needs to authenticate a foreign state root from a finalization certificate. Add BlockHeader (every non-transaction digest field plus the transaction root), Block::header(), and BlockHeader::digest(), which reproduces the source block's digest exactly. The transaction root is a sequential-hash commitment, not a Merkle tree: it authenticates the exact ordered transaction list (count, order, and bytes) but does not support per-transaction inclusion proofs. BREAKING: this changes every block's digest and is consensus-breaking; it must land before testnet.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
Fold a block's transactions into a domain-separated transaction root and
commit the block digest over that root instead of inlining every transaction.
Add a compact, digest-authenticated
BlockHeaderthat carries everynon-transaction digest field plus the transaction root, so a verifier can
reproduce and check a block's digest without the full block, then read the
authenticated
state_root/state_rangeout of it.This is the foundation the bridge's certified checkpoint needs: to authenticate
a foreign chain's state root from a finalization certificate (which signs a
block digest), the verifier must recompute that digest from a compact header
rather than the entire block.
Changes
the ordered transaction list.
block_digest), not the inlined transactions.BlockHeader<Ext>— context, parent, height, timestamp, transaction_root,reshare_log, extension, state_root, state_range + codec.
Block::header()andBlockHeader::digest()(reproduces the source block'sdigest exactly).
Consensus-breaking
This changes every block's digest and must land before testnet.
Note on naming
The transaction root is a sequential-hash commitment, not a Merkle tree: it
authenticates the exact ordered transaction list (count, order, and bytes all
matter) but does not support per-transaction inclusion proofs.
Tests (
chain/tests/block_header.rs)block.header().digest() == block.digest()state_root/state_rangechanges the header digestFollow-up
The bridge certified-checkpoint PR builds on this: the consensus extension will
verify a foreign finalization certificate against a
BlockHeaderand storecheckpoint_id -> state_root + state_range.