Skip to content

Add a missing covarage for issuance and improve tests#241

Merged
PaulLaux merged 28 commits intozsa1from
compact-issue-tests
Feb 18, 2026
Merged

Add a missing covarage for issuance and improve tests#241
PaulLaux merged 28 commits intozsa1from
compact-issue-tests

Conversation

@PaulLaux
Copy link
Collaborator

@PaulLaux PaulLaux commented Feb 18, 2026

Compact and add missing covarage

Add tests for untested error paths and consensus rules:

  • MissingReferenceNoteOnFirstIssuance
  • Successful subsequent issuance (supply accumulation)
  • ValueOverflow on supply accumulation
  • IssueActionWithoutNoteNotFinalized
  • CannotBeFirstIssuance
  • InvalidIssueValidatingKey

dmidem and others added 25 commits November 26, 2025 07:15
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.
…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.
@PaulLaux PaulLaux changed the title Compact issue tests Add a missing covarage for issuance and improve tests Feb 18, 2026
Copy link

@dmidem dmidem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, &params);

let mut rng = OsRng;
let ref_note = Note::new_issue_note(params.recipient, NoteValue::zero(), asset, &mut rng);
Copy link

@dmidem dmidem Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a mistake. fixed

src/issuance.rs Outdated
let signed = sign_bundle(bundle, &params);

let mut rng = OsRng;
let ref_note = Note::new_issue_note(params.recipient, NoteValue::zero(), asset, &mut rng);
Copy link

@dmidem dmidem Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my previous comment (on issue_bundle_verify_subsequent_issuance).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@PaulLaux PaulLaux merged commit c76a09b into zsa1 Feb 18, 2026
30 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.

2 participants