test(state): align auth-data-root tests with trusted precomputed root semantics#418
Merged
Merged
Conversation
|
Warning No auditable source files found in this PR's diff. |
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.
Motivation
ironwood-mainCI is red: the "revert v12" that merged with #411 changedcheck.rsto trust a supplied precomputed auth-data root (precomputed_auth_data_root.unwrap_or_else(|| block.auth_data_root())) instead of re-deriving and comparing it, but two tests asserting the old strictInvalidAuthDataRootrejection merged unchanged and now fail:check::tests::vectors::block_commitment_binds_precomputed_auth_data_root_to_block_bodyprop::all_upgrades_and_wrong_commitments_with_fake_activation_heights(the bad-auth-root case)Solution
Test-only change: align both tests with the trust semantics. Under trust, a forged precomputed root on an otherwise-valid header surfaces as
InvalidChainHistoryBlockTxAuthCommitment(the header committed to the real root; the check recomputed the commitment from the forged one) — which still proves the supplied value is the one bound into the check, so the block is rejected either way.block_commitment_uses_the_precomputed_auth_data_rootand asserts the exact commitment-mismatch error, including the recomputed hash from the forged root.InvalidChainHistoryBlockTxAuthCommitmentinstead ofInvalidAuthDataRoot, with a comment explaining why.Note for reviewers: trusting the cache is only as strong as the writers of
SemanticallyVerifiedBlock::auth_data_root; the crate-privacy hardening for that field from the (dropped) precompute branch is not onironwood-main, so the field is currentlypub. If we want the type-level guarantee back, that is a separate change.Tests
cargo test -p zebra-stateis fully green (265 + 2),cargo fmt --all -- --checkandcargo clippy -p zebra-state --all-targets -- -D warningspass.AI Disclosure
PR Checklist
type(scope): description