Skip to content

Use exact ExpectedTranscriptError in Orchard ZSA workflow block tests (#133 alternative)#142

Open
dmidem wants to merge 18 commits into
zsa1from
expected-transcript-error-v2
Open

Use exact ExpectedTranscriptError in Orchard ZSA workflow block tests (#133 alternative)#142
dmidem wants to merge 18 commits into
zsa1from
expected-transcript-error-v2

Conversation

@dmidem

@dmidem dmidem commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This is an alternative to #133.

PR #133 replaces the is_valid: bool field in OrchardWorkflowBlock with Result<(), ExpectedTranscriptError>, but keeps block 5 as Err(ExpectedTranscriptError::Any). That version checks that block 5 fails, but still does not check the exact reason.

This PR keeps the same typed expected-result direction, but also maps the expected failure for block 5 to ExpectedTranscriptError::Exact(...).

The exact check verifies that the block is rejected because it tries to issue an asset after issuance was finalized. This is closer to the original goal from issue #116.

The downside is that the checker is more complex. In particular, CommitSemanticallyVerifiedError hides its inner CommitBlockError, so the test can type-check the public wrapper but has to inspect the specific inner InvalidIssuedAsset(Issue(IssueActionPreviouslyFinalizedAssetBase)) error via Debug output.

So the trade-off is:

@dmidem dmidem requested a review from PaulLaux June 9, 2026 08:42
Comment on lines +63 to +85

- name: Install cargo-nextest
uses: taiki-e/install-action@nextest

- name: Run regular tests
run: |
timeout --preserve-status 1h \
cargo nextest run --workspace --locked \
-E 'not package(zebra-network) and not binary(acceptance)'

- name: Run zebra-network tests
run: |
timeout --preserve-status 30m \
cargo nextest run -p zebra-network --locked \
--retries 3

- name: Run zebrad acceptance tests
run: |
timeout --preserve-status 1h \
cargo nextest run -p zebrad --test acceptance --locked \
--retries 3 \
--test-threads 4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These changes seem to be unrelated to the "[Use exact ExpectedTranscriptError in Orchard ZSA workflow block tests (#133 alternative)]" PR

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agree. I had to do this to restore the CI workflow. I have now prepared a special PR to fix the CI issue (#132). We can review and merge that one first, then pull those changes into this PR. What do you think?

@PaulLaux PaulLaux left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like this approch better then #133 . Consider merging https://github.com/QED-it/zebra/pull/143/changes to get rid of the debug and clean up `ci-basic.yml' from unrelated changes.

@dmidem

dmidem commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

I like this approch better then #133 . Consider merging https://github.com/QED-it/zebra/pull/143/changes to get rid of the debug and clean up `ci-basic.yml' from unrelated changes.

Just merged #143 (it definitely makes sense).

Do we now need to update (possibly even remove) the comment in zebra-consensus/src/orchard_zsa/tests.rs that came from #143 (as it explains the fix of my original approach and looks obsolete after the merge)? I mean this one:

// The commit-error wrapper hides its inner error, but every layer derives
// `Error::source()`, so we can walk the chain down to the public leaf
// `AssetStateError` and match the exact variant instead of its Debug output.
if matches!(
    err.downcast_ref::<AssetStateError>(),
    Some(AssetStateError::Issue(
    orchard::issuance::Error::IssueActionPreviouslyFinalizedAssetBase
    ))
) {
    return true;
}

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