Expand description
Incremental construction of crate::Checkpoint for an L2 epoch (CKP-006).
§Requirements trace
- CKP-006 —
CheckpointBuilder:new,add_block,set_state_root,add_withdrawal,build. - NORMATIVE § CKP-006 — builder obligations for epoch summaries.
- SPEC §6.6 — checkpoint builder in block production.
- Merkle roots:
CheckpointBuilder::builduses the crate-internalmerkle_tree_roothelper — same tagged binary Merkle tree ascrate::L2Block::compute_spends_root/crate::L2Block::compute_slash_proposals_root(BLK-004, HSH-007 viachia_sdk_types::MerkleTree). Empty leaf lists →crate::EMPTY_ROOT(CKP-006 implementation notes). - HSH-002 —
crate::Checkpoint::hashapplies once the builtCheckpointis complete.
§Rationale
- Consuming
build:CheckpointBuilder::buildtakesselfby value so a finalizedcrate::Checkpointcannot be accidentally extended (CKP-006 implementation notes). - Ordered leaves: Block hashes and withdrawal hashes are Merkle leaves in append order — matches
CheckpointBuilder::add_block/CheckpointBuilder::add_withdrawalcall order during the epoch. - State root: Defaults to
Bytes32::defaultuntilCheckpointBuilder::set_state_rootruns; production code should set the post-epoch trie root before signing.
Structs§
- Checkpoint
Builder - Accumulates per-epoch block hashes, fees, tx counts, and withdrawal commitments.