Skip to content

test: regression for #402 — RawPlutusData inline datum CBOR round-trip#493

Open
OscarOzaine wants to merge 1 commit into
Python-Cardano:mainfrom
OscarOzaine:test/regression-402-raw-plutus-inline-datum
Open

test: regression for #402 — RawPlutusData inline datum CBOR round-trip#493
OscarOzaine wants to merge 1 commit into
Python-Cardano:mainfrom
OscarOzaine:test/regression-402-raw-plutus-inline-datum

Conversation

@OscarOzaine

@OscarOzaine OscarOzaine commented Jun 6, 2026

Copy link
Copy Markdown

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:

  1. Byte-exact round-tripfrom_cbor()to_cbor_hex() returns the original bytes.
  2. Both inline datums survive — both outputs still carry their datum after decode.
  3. Stable transaction id — the recomputed id matches the known-good value.
  4. Signature stays valid — signing the body hash produces a signature that verifies (checked directly with nacl).

Scope

Test-only change — one new test in test/pycardano/test_transaction.py. No library code is touched.

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

1 participant