test(js): cover Plutus/script paths (lock fixture + DevKit mint round-trip)#5
Merged
Merged
Conversation
…-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>
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.
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/readFromAPI, which the TxPlan refactor (#1) deleted. Script/Plutus paths are now TxPlan YAML fixtures, andintents.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.yamlis 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).assertBuilthelper (mirrors Python's_assert_built), keeping the existing "exec units required → build throws without them" negative checks.plutus.dataHash("182a")reproduces the lock fixture's datum hash9e1199…, tying the primitive to the on-fixture value.Integration —
test/quicktx.integration.test.js(DevKit job,:wrappers:js:integrationTest):TestIntegrationPlutusMint. Skip-gated on DevKit availability like the existing integration tests.Verification
bun test test/intents.e2e.test.js→ 24 pass / 0 fail.