Skip to content

Expose top-level native and Plutus V4 transaction guards - #1477

Open
Jimbo4350 wants to merge 4 commits into
masterfrom
feature/dijkstra-top-level-guards
Open

Jimbo4350 wants to merge 4 commits into
masterfrom
feature/dijkstra-top-level-guards

Conversation

@Jimbo4350

@Jimbo4350 Jimbo4350 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Dijkstra's top-level transaction builders could not supply native or Plutus script guard witnesses. Add guard options to transaction build, build-raw, and build-estimate, supporting inline and reference scripts, Plutus V4 guarding redeemers, and automatic or explicit execution budgets.

The builders populate guard credentials and witnesses, collect guard reference inputs, and render guarding redeemers in transaction views. Add regression tests for guard serialization, redeemer indexing and integrity hashing, validation, era gating, and offline fee estimation, plus updated help goldens.

Rebased onto master at 7c04e3f9b and uses published cardano-api 11.11.0.0 from CHaP. The temporary source-repository-package has been removed. Builders carry required key signatures and script guards through one era-indexed parameter, backed by a single validated TxGuards collection in Dijkstra; Conway retains its required-signer representation.

Validation against released cardano-api 11.11.0.0 (GHC 9.12.4): CLI and both test executables built successfully; all 54 selected guard, sub-transaction, direct-deposit, and script-validity regression tests passed, including required-signer file/hash equivalence, duplicate key requirements, and signing key guards. All 7 selected help and Conway transaction-view goldens passed. Fourmolu, HLint, and whitespace checks passed. Online execution-unit evaluation was not exercised against a running node.

Changelog

- description: Add native and Plutus V4 script guards to Dijkstra transaction build, build-raw, and build-estimate, with inline or reference scripts, guarding redeemers, and automatic or explicit execution budgets.
  type:
    - feature

@Jimbo4350
Jimbo4350 force-pushed the feature/dijkstra-top-level-guards branch 7 times, most recently from 500b206 to faaaed3 Compare October 28, 2026 19:43
@Jimbo4350
Jimbo4350 force-pushed the feature/dijkstra-top-level-guards branch 2 times, most recently from 3bd2822 to 54dc1b0 Compare October 28, 2026 20:58
@Jimbo4350
Jimbo4350 force-pushed the feature/dijkstra-top-level-guards branch from 54dc1b0 to 6ea3d63 Compare October 28, 2026 21:07
@Jimbo4350
Jimbo4350 marked this pull request as ready for review October 28, 2026 21:09
Copilot AI balanced review requested due to automatic review settings October 28, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@palas palas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

Comment on lines +106 to +108
, maybe
(Exp.NativeGuardWitness (Exp.SReferenceScript input))
(uncurry $ plutusWitness (P.PReferenceScript input))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that is a bit unfriendly to users is that if you fail to provide a redeemer (when using ref scripts) it will only fail when you submit the transaction. At least for transaction build, we could check this. The other way around has a similar problem.

On the other hand, while it is nice that the number of flags is small because we reuse, if we had different flags for native and Plutus we could catch this even in build-raw

"Plutus guard "
<> pretty (L.credToText credential)
<> " requires --guard-redeemer-* and --guard-execution-units."
<> " requires --guard-redeemer-* and --guard-execution-units (transaction build calculates execution units automatically)."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<> " requires --guard-redeemer-* and --guard-execution-units (transaction build calculates execution units automatically)."
<> " requires --guard-redeemer-* and --guard-execution-units (except for transaction build, which calculates execution units automatically)."

Maybe clearer. Alternatively, we can customise the error depending on the command that issued it. For example, by passing an enum like (AutoBalance / ManualBalance)

fileArgs = ["--required-signer", keyFile]
hashArgs = ["--required-signer-hash", Text.unpack $ serialiseToRawBytesHexText keyHash]
forM_ [fileArgs, hashArgs, fileArgs ++ hashArgs] $ \args -> do
void $ execCardanoCLI $ transactionArgs "conway" ++ args ++ ["--out-file", bodyFile]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should be removing the output file between iterations to make sure the command does something in every case

input <-
H.evalEither $
deserialiseFromRawBytesHex "63e6a9a8e58e48cc025cae04daaed9d36fc7b70bc292721d9f5057ae37b24981"
forM_ [[], ["--guard-redeemer-value", "42", "--guard-execution-units", "(3,4)"]] $ \redeemer -> do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

This branch has not been deployed

No deployments
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.

3 participants