Repository navigation
Conversation
A test suite could only build spending contexts at a placeholder script address. Six additions, all opt-in, so the htlc and linear_vesting contexts stay byte for byte the same: - `set_script_info` switches a context to the minting or the rewarding purpose and keeps the transaction, so one transaction can be evaluated under each purpose it triggers. - `set_mint` sets the mint field through the same PlutusCore.Value path as `buildValue`: sorted, signed quantities, no ADA entry. - `add_input_utxo` takes an optional `address`. - `script_hash` and `pubkey_hash` resolve an @reference to its bytes. A literal stays raw ASCII. - An address takes an optional `staking` credential. - A `utxo_ref` whose transaction id starts with `#` is hex. Also: the schema now matches the parser (only the `spending` baseline exists, asset fields take `B #hex` literals), `cape submission verify` validates the scenario suite against it, and a shared script context that fails to parse is no longer reported as "not found".
… and reference scripts The builder left `txInfoFee` at 0, `txInfoRedeemers` empty and `txInfoId` at a 64-byte placeholder, and every output had no reference script. A validator that decodes the whole context pays for the redeemers map on chain, so a context without it measures less than the ledger charges. Four more opt-in additions: - `set_fee` sets the transaction fee. - `set_tx_id` sets the transaction id, in the two forms of `utxo_ref`. - `set_redeemers` sets the redeemers of the transaction, in the given order. It is independent of `set_redeemer`, the redeemer of the script under test. - `add_input_utxo` and `add_output_utxo` take an optional `reference_script` hash.
Records why the test format grows by patches on the one spending baseline instead of a second baseline, and what each of the ten additions does.
`measure` ran the CEK machine without an emitter, so the messages of the `trace` builtin were lost. A submitter who debugs a failing test, or who wants to see which check of a validator rejects a transaction, had to rebuild the applied program for another evaluator. With `--debug-trace` every test prints one `DEBUG_TRACE[<test>]: <message>` line per log entry, in the order the program emitted them. The log also holds the diagnostic of a builtin that fails, for example `unIData` on a value that is not an integer; the machine does not mark which entry is which. Without the option the machine runs as before, and the budget is the same in both modes.
This branch has not been deployed
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.
A
cape-tests.jsonsuite could only build a spending context at a placeholder script address, with an empty mint field, no redeemers and 64-byte transaction ids. This PR adds ten opt-in fields and patches, so a suite can describe a script that has a minting and a spending purpose, in a context the ledger could have built. A suite that does not use them builds the same bytes as before: thehtlcandlinear_vestingcontexts are identical under the production and the preview evaluator.set_script_infomintingorrewardingand keeps the transaction, so one transaction can run under each purpose it triggers.set_minttxInfoMintthrough thePlutusCore.Valuepath thatbuildValuetakes: sorted, signed quantities, no ADA entry.set_fee,set_tx_id,set_redeemerstxInfoFee,txInfoIdandtxInfoRedeemers.addressonadd_input_utxoreference_scriptonadd_input_utxoandadd_output_utxostakingin an address@referenceinscript_hashB #hexvalue, aspubkey_hashalready did.#before the transaction id inutxo_refHash literals and transaction ids without
#keep their old reading as raw ASCII bytes.Three fixes touch the same files. The schema now matches the parser: only the
spendingbaseline exists, and asset fields takeB #hexliterals.cape submission verifyvalidates the scenario suite against that schema. The loader now reports the parse error of a shared script context; it used to say "not found".measurealso gets a--debug-traceoption. The evaluator used to drop the messages of thetracebuiltin; with the option each test prints them, so a submitter can see which check of a validator rejects a transaction.The ADR
doc/adr/20261113-script-contexts-for-scripts-with-several-purposes.mdrecords the decision and the rejected alternatives. Revision 2 oftwo_party_escrowfor #272 needs these additions and follows in a separate PR.