Expand description
Script budgets measured inside the wallet, with Aiken’s uplc, instead of
asking Ogmios (through Koios) to evaluate a draft.
The answer has the shape of Ogmios’s evaluateTransaction answer, so
crate::build::Budgets::from_ogmios reads either, and a failed script is
put in words the same way.
Evaluating locally is what lets a chain of transactions be built before any
of it is on chain: a transaction can spend the outputs of one that hasn’t
been sent yet, since the wallet hands the evaluator every UTxO itself
(resolve_outputs). uplc 1.1.23 matched the chain’s budgets exactly on
recorded preprod transactions (Seedelf spends, and Lovejoin’s mixes and
withdraws) under both the 297- and 350-parameter V3 cost models; 1.1.21
didn’t, which is why it must be kept current across hard forks.
Structs§
- Resolved
- A UTxO the evaluator can see: where it is, and its output’s CBOR.
Functions§
- declared_
covers - Whether the budgets
tx_cbordeclares cover whatanswermeasured (Ogmios’sevaluateTransactionanswer, orevaluate’s), redeemer by redeemer; the reason when they don’t, a failed script included. - evaluate
- Measures every script in
tx_cboragainstknown, the UTxOs it spends and reads (from Koios rows, earlier transactions of a chain, or the bundled references). Answers as Ogmios does:{ result: [{ validator: { purpose, index }, budget: { memory, cpu } }] }, or{ error: … }naming the script that failed. - ogmios_
utxos - A built transaction’s outputs as Ogmios v6 UTxOs, for
evaluateTransaction’sadditionalUtxo: with them the network’s own evaluator can measure a transaction whose parents aren’t on chain yet (a chain’s first mix, on its unsent deposit). That’s the check that the wallet’s evaluator still costs scripts as the network does. - refusal
- Why the evaluator can’t take
row, in words, orNonewhen it can. A reference script on the row isn’t carried over, so such a row is refused rather than evaluated wrongly; anyone can send one, to a Seedelf too. So is a row whose datum is nested pastcbor::MAX_DEPTH: the evaluator’s decoder would overflow the stack on it. Nothing measured in the wallet (a Seedelf spend, a session’s merged return, Lovejoin) can spend such a UTxO. - resolve_
outputs - Every output of a built transaction, as UTxOs a later transaction in the same chain can spend before this one is on chain.
- resolve_
row - A Koios UTxO row as the evaluator needs it, unless it’s one the evaluator
can’t take (
refusal). - seedelf_
references - The Seedelf contracts’ reference UTxOs on a network (
trueis preprod, as everywhere in the workspace). - slot_at
- The slot
unix_ms(milliseconds since 1970) falls in, on preprod (network_flag) or mainnet: what a transaction’s validity interval is counted in. A time before the Shelley era gives its first slot.