Add a missing covarage for issuance and improve tests#241
Merged
Conversation
This change refactors Orchard issuance and burn validation so Zebra can reuse it for its issued_assets global state and checkpoint handling. - Add derives and a few new error variants for issuance and burn so Zebra can surface state-related failures explicitly. - Change state lookup callbacks to FnMut to allow caching on the Zebra side. - Split verify_issue_bundle into signature checking plus a verify_trusted_issue_bundle variant for checkpointed blocks. - Make burn validation state-aware and return updated AssetRecord values, symmetric to issuance.
…hout_sighash in issuance
…0.115 requires MSRV 1.71" This reverts commit c8ba08c.
…s required by Zebra’s AssetStateError
…s so Zebra tests can reuse Orchard’s reference-note construction when building mock AssetRecords
…: add create_test_reference_note wrapper for Zebra tests
Add asset_desc_hash, sign_bundle, and new_signed_bundle test helpers to reduce boilerplate
Add tests for untested error paths and consensus rules: - MissingReferenceNoteOnFirstIssuance - Successful subsequent issuance (supply accumulation) - ValueOverflow on supply accumulation - IssueActionWithoutNoteNotFinalized - CannotBeFirstIssuance - InvalidIssueValidatingKey Remove unused InvalidIssueAuthKey error variant.
dmidem
approved these changes
Feb 18, 2026
dmidem
left a comment
There was a problem hiding this comment.
Looks good to me overall. One remark about reference note creation in two tests (see comments below).
src/issuance.rs
Outdated
| let signed = sign_bundle(bundle, ¶ms); | ||
|
|
||
| let mut rng = OsRng; | ||
| let ref_note = Note::new_issue_note(params.recipient, NoteValue::zero(), asset, &mut rng); |
There was a problem hiding this comment.
You construct ref_note with Note::new_issue_note(...) instead of create_reference_note(...) (does the same but uses ReferenceKeys::recipient() as the recipient). Is this intentional? Same remark for ref_note creation in issue_bundle_verify_fail_value_overflow test (see comment below).
Collaborator
Author
There was a problem hiding this comment.
It's a mistake. fixed
src/issuance.rs
Outdated
| let signed = sign_bundle(bundle, ¶ms); | ||
|
|
||
| let mut rng = OsRng; | ||
| let ref_note = Note::new_issue_note(params.recipient, NoteValue::zero(), asset, &mut rng); |
There was a problem hiding this comment.
See my previous comment (on issue_bundle_verify_subsequent_issuance).
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.
Compact and add missing covarage
Add tests for untested error paths and consensus rules: