Skip to content

test(js): cover Plutus/script paths (lock fixture + DevKit mint round-trip)#5

Merged
matiwinnetou merged 5 commits into
developfrom
feature/js-plutus-script-tests
Jun 26, 2026
Merged

test(js): cover Plutus/script paths (lock fixture + DevKit mint round-trip)#5
matiwinnetou merged 5 commits into
developfrom
feature/js-plutus-script-tests

Conversation

@matiwinnetou

@matiwinnetou matiwinnetou commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Closes the JS test gap for the script/Plutus paths (TODO §3).

Note: the original §3 item is stale — it names the fluent ScriptTxBuilder / collectFromScript / mintPlutusAssets / readFrom API, which the TxPlan refactor (#1) deleted. Script/Plutus paths are now TxPlan YAML fixtures, and intents.e2e.test.js (added in that refactor) already covered the top-level intents plus Plutus mint/spend. So this PR closes the remaining genuine gaps rather than building from zero — and updates the TODO item to reflect reality.

What changed

Offline — test/intents.e2e.test.js (runs in normal CI, :wrappers:js:test):

  • plutus/plutus_lock.yaml is now built — the one Plutus fixture not previously exercised in JS (pay-to-script-address with a datum hash; no exec units, since no script runs).
  • Plutus mint/spend assertions deepened to non-empty CBOR + 64-char hash + positive fee via a shared assertBuilt helper (mirrors Python's _assert_built), keeping the existing "exec units required → build throws without them" negative checks.
  • New invariant: plutus.dataHash("182a") reproduces the lock fixture's datum hash 9e1199…, tying the primitive to the on-fixture value.

Integration — test/quicktx.integration.test.js (DevKit job, :wrappers:js:integrationTest):

  • A Plutus-mint round-trip: build (with exec units) → sign (payment key) → submit → assert the minted asset landed on-chain, mirroring Go's TestIntegrationPlutusMint. Skip-gated on DevKit availability like the existing integration tests.

Verification

  • Offline suite green locally against the built native lib: bun test test/intents.e2e.test.js → 24 pass / 0 fail.
  • Integration file parses and skips cleanly without DevKit (4 tests skip). The DevKit round-trip is exercised by the "Integration Tests (DevKit)" CI job.

Mateusz Czeladka and others added 5 commits June 26, 2026 14:55
…-trip)

The §3 TODO item predates the TxPlan refactor, which deleted the fluent
ScriptTxBuilder/collectFromScript/mintPlutusAssets/readFrom API it referenced;
script/Plutus paths are now TxPlan YAML fixtures. intents.e2e.test.js already
covered the top-level intents + Plutus mint/spend; this closes the remaining
gaps:

- Build the previously-untested plutus/plutus_lock.yaml (pay-to-script with a
  datum hash; no exec units).
- Deepen the Plutus mint/spend assertions to non-empty CBOR + 64-char hash +
  positive fee (shared assertBuilt helper, mirroring Python's _assert_built),
  keeping the exec-units-required negative checks.
- Assert plutus.dataHash('182a') reproduces the lock fixture's datum hash,
  tying the primitive to the on-fixture value.
- Add a DevKit integration round-trip for a Plutus mint: build with exec units
  -> sign (payment) -> submit -> assert the minted asset landed on-chain,
  mirroring Go's TestIntegrationPlutusMint (skip-gated like the others).

Update the TODO item to reflect the refactor and mark it done.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Plutus mint round-trip failed in CI: it ran 4th in the describe, on a devnet
already mutated by the three payment tests, and never reset — unlike the Go
suite's buildSignSubmit, which resets immediately before building. The submit was
rejected but the helper returns the response body on any status, so the truthy
txHash check passed and only the later 'asset landed' assert failed, masking the
cause.

Reset + wait before funding the fixed fixture account (mirroring Go), and assert
the submit returns a real 64-char tx hash so a rejected Plutus validation
surfaces at submit rather than as a missing asset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The DevKit Plutus-mint round-trip is rejected by the node with PPViewHashesDontMatch:
the cost models marshalled from /epochs/parameters don't reproduce the node's
script-integrity hash, so the built tx's script-data hash mismatches. The Go suite
submits the same fixture successfully, so this is a JS-side protocol-params/cost-model
serialization subtlety — and node-level Plutus acceptance is the Go suite's job by
design anyway (only Go submits the intent set to DevKit; the other wrappers have build
E2E parity).

Revert quicktx.integration.test.js to develop and keep the build-level additions
(plutus_lock, deepened mint/spend assertions, datum-hash invariant). Record the JS
Plutus-submit round-trip as a P2 follow-up needing a live DevKit to debug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diagnostic CI cycle for the PPViewHashesDontMatch rejection: log the cost-model
shape DevKit's /epochs/parameters returns, and try dropping the fetched cost
models so the native lib uses its built-in standard Conway cost models (which
should match the devnet node). The CI log will confirm whether the fallback is
accepted; if not, the logged cost-model shape drives the real fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The diagnostic run confirmed the root cause: DevKit's /epochs/parameters returns
cost models as a map keyed by zero-padded indices, and JS's JSON parse reorders
the non-padded integer-like keys ahead of the padded ones, scrambling cost-model
order and producing PPViewHashesDontMatch on submit. Build without the fetched
cost models so the lib uses its built-in standard Conway set (which the devnet
runs); the submit is accepted and the minted asset lands on-chain.

Document the underlying JS cost-model key-ordering bug as a P1 follow-up (it will
bite the §2c provider helpers, which fetch and pass these params).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matiwinnetou matiwinnetou merged commit 746b51a into develop Jun 26, 2026
6 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.

1 participant