docs: add pre-Canopy consensus check audit#10441
Open
zmanian wants to merge 4 commits intoZcashFoundation:mainfrom
Open
docs: add pre-Canopy consensus check audit#10441zmanian wants to merge 4 commits intoZcashFoundation:mainfrom
zmanian wants to merge 4 commits intoZcashFoundation:mainfrom
Conversation
Add comprehensive unit tests for policy functions added in ZcashFoundation#10314: - count_script_push_ops: PUSHDATA1/2/4, mixed types, truncated scripts - extract_p2sh_redeemed_script: existing + edge cases - script_sig_args_expected: P2PK, multisig via script classification - are_inputs_standard: P2PKH accept/reject, wrong stack depth, non-standard spent outputs, P2SH with standard/non-standard redeemed scripts, sigops boundary, multi-input rejection - p2sh_sigop_count: P2SH/non-P2SH/multi-input summation Also adds defensive improvements: - saturating_add for sigop count arithmetic - debug_assert_eq for input/spent_output alignment - Expanded doc comments with correctness notes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unnecessary Hash derive from NonStandardTransactionError - Move p2pkh_lock_script, p2sh_lock_script, p2pk_lock_script to module level in policy.rs as #[cfg(test)] pub(super) functions, eliminating duplication between policy::tests and tests::vectors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Systematic audit of consensus checks in zebra-consensus and zebra-state that are not enforced for pre-Canopy blocks due to mandatory checkpoint verification. Key findings: - 12 upgrade-gated or semantic-only checks documented - 2 explicitly documented validation gaps (pre-Heartwood coinbase Output descriptions, block header commitment contextual equality) - Checkpoint verifier covers PoW, Merkle root, and tx consistency - Risk assessment and future-change concerns for custom testnets Closes ZcashFoundation#10184
Contributor
Author
|
@conradoplg This is ready for review — CI workflows need maintainer approval to run (fork PR). Could you approve the Actions runs when you get a chance? Thanks! |
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
Closes #10184
As Zebra becomes the single Zcash node implementation, it is important to explicitly document which consensus rules are not enforced for pre-Canopy blocks (which rely on mandatory checkpoint verification).
Solution
Added
pre-canopy-check-audit.mdwith a systematic audit of all upgrade-gated and semantic-only consensus checks acrosszebra-consensus,zebra-state, andzebra-chain.Key Findings
Methodology
zebra-consensus/src/andzebra-state/src/service/check.rsforNetworkUpgradecomparisons, height-gated logic, and checkpoint vs semantic verification pathscheckpoint.rs:579-633) to distinguish checks that ARE enforced from those that are notAI Disclosure
Used Claude Code for codebase search and initial finding enumeration. All findings were cross-referenced against source code and reviewed with multiple rounds of code review (both automated and manual).