test: regression for #402 — RawPlutusData inline datum CBOR round-trip#493
Open
OscarOzaine wants to merge 1 commit into
Open
Conversation
…CBOR round-trip Adds test_sign_dex_transaction_with_raw_plutus_data_inline_datum using the Liqwid DEX fixture (Conway era, two outputs with complex inline Plutus datums). Asserts full CBOR round-trip, stable tx.id, and that a signature over the body hash verifies correctly — the exact sequence that broke before fixes Python-Cardano#474 and Python-Cardano#479. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
What this does
Adds a regression test that guards against issue #402: unsigned DEX transactions exported by wallets (e.g. Eternl) were getting corrupted when PyCardano decoded and re-encoded them.
Why it matters
These transactions contain outputs with inline Plutus datums encoded as indefinite-length CBOR. Before the fixes in #474 and #479, decoding and re-serializing such a transaction changed the body bytes. Since a transaction's id is the blake2b hash of those bytes, the id changed too — which made any externally-computed signature invalid and caused nodes to reject the transaction.
This test makes sure that bug can't quietly come back.
What the test checks
Using a real Liqwid DEX transaction (Conway era, two outputs with complex inline datums) as a fixture, it verifies:
from_cbor()→to_cbor_hex()returns the original bytes.nacl).Scope
Test-only change — one new test in
test/pycardano/test_transaction.py. No library code is touched.