Skip to content

fix(store/loader): cross-check blockchain MMR consistency with latest block header#2247

Open
kkovaacs wants to merge 3 commits into
nextfrom
krisztian/check-mmr-chain-commitment-consistency
Open

fix(store/loader): cross-check blockchain MMR consistency with latest block header#2247
kkovaacs wants to merge 3 commits into
nextfrom
krisztian/check-mmr-chain-commitment-consistency

Conversation

@kkovaacs

Copy link
Copy Markdown
Contributor

Summary

chain_commitment in the latest header at height N should be consistent with the
MMR peaks at height N (block chain state before block N).

This is enforced by apply_block when applying a new block. This PR adds a
check so that we also enforce this when loading the store. The check compares the loaded MMR at the latest header’s checkpoint:

chain_mmr.peaks_at(latest_header.block_num())?.hash_peaks()

against:

latest_header.chain_commitment()

Closes #2241

Changelog

changelog = "none"
reason    = "Internal change only."

kkovaacs added 2 commits June 12, 2026 08:32
block header

`chain_commitment` in the latest header at height N should be consistent
with the
MMR peaks at height N (block chain state before block N).

This is enforced by `apply_block` when applying a new block. This commit
adds a
check so that we also enforce this when loading the store.
Comment thread crates/store/src/state/loader.rs
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.

store: loaded chain MMR is never cross-checked against the latest header's chain_commitment

2 participants