Skip to content

test(state): align auth-data-root tests with trusted precomputed root semantics#418

Merged
p0mvn merged 1 commit into
ironwood-mainfrom
fix/auth-root-test-semantics
Jul 2, 2026
Merged

test(state): align auth-data-root tests with trusted precomputed root semantics#418
p0mvn merged 1 commit into
ironwood-mainfrom
fix/auth-root-test-semantics

Conversation

@p0mvn

@p0mvn p0mvn commented Jul 2, 2026

Copy link
Copy Markdown

Motivation

ironwood-main CI is red: the "revert v12" that merged with #411 changed check.rs to 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 strict InvalidAuthDataRoot rejection merged unchanged and now fail:

  • check::tests::vectors::block_commitment_binds_precomputed_auth_data_root_to_block_body
  • prop::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.

  • The vectors test is renamed to block_commitment_uses_the_precomputed_auth_data_root and asserts the exact commitment-mismatch error, including the recomputed hash from the forged root.
  • The prop test's bad-auth-root case matches InvalidChainHistoryBlockTxAuthCommitment instead of InvalidAuthDataRoot, 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 on ironwood-main, so the field is currently pub. If we want the type-level guarantee back, that is a separate change.

Tests

  • The two previously failing tests now pass; cargo test -p zebra-state is fully green (265 + 2), cargo fmt --all -- --check and cargo clippy -p zebra-state --all-targets -- -D warnings pass.

AI Disclosure

  • AI tools were used: Claude for the test updates and PR description.

PR Checklist

  • The PR title follows conventional commits format: type(scope): description
  • The PR follows the contribution guidelines.
  • This change was discussed in an issue or with the team beforehand.
  • The solution is tested.
  • The documentation and changelogs are up to date.

@v12-auditor

v12-auditor Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

No auditable source files found in this PR's diff.

@p0mvn
p0mvn merged commit 1a11b74 into ironwood-main Jul 2, 2026
36 of 37 checks passed
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.

1 participant