Repository navigation
Complete Plutus V4 support and remove Conway hardcodes #1452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
.changes/20261015_120100_cardano-cli_mateusz.galazyn_read-any-script-hash.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project: cardano-cli | ||
| pr: 1452 | ||
| kind: | ||
| - refactoring | ||
| description: | | ||
| Add `readAnyScriptHash` to `Cardano.CLI.Read`, which returns the hash of a script file in any script language cardano-api supports, including Plutus V4. Add `MainnetEra` to `Cardano.CLI.EraBased.Option`, the era used by the `latest` command group and the top-level `node` and `query` commands. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project: cardano-cli | ||
| pr: 1452 | ||
| kind: | ||
| - bugfix | ||
| description: | | ||
| `CARDANO_ERA` now accepts every era cardano-api supports, including `dijkstra`, in any letter case, and an unknown value stops the command with an error that lists the valid eras. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project: cardano-cli | ||
| pr: 1452 | ||
| kind: | ||
| - bugfix | ||
| description: | | ||
| `transaction policyid` and `address build` with `--payment-script-file` or `--stake-script-file` now accept Plutus V4 scripts, instead of failing with "Plutus language PlutusScriptV4 is not supported in the Conway era". They also accept simple scripts with a `guard`, which used to crash them. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project: cardano-cli | ||
| pr: 1452 | ||
| kind: | ||
| - test | ||
| description: | | ||
| Add golden tests for Plutus V4 scripts: script files as direct witnesses for every script purpose in `dijkstra transaction build-raw`, `hash script`, `transaction policyid`, `address build` with payment and stake scripts, and the error for a V4 reference script in a Conway transaction. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project: cardano-cli | ||
| pr: 1452 | ||
| kind: | ||
| - bugfix | ||
| description: | | ||
| A transaction output whose reference script is written in a Plutus language not supported by the transaction's era now makes the command fail with a clear error, instead of silently building the transaction with that reference script dropped from the output. |
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
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
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
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
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
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
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
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
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
43 changes: 43 additions & 0 deletions
43
cardano-cli/test/cardano-cli-golden/Test/Golden/Conway/Transaction/ReferenceScript.hs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| {-# LANGUAGE OverloadedStrings #-} | ||
|
|
||
| module Test.Golden.Conway.Transaction.ReferenceScript where | ||
|
|
||
| import GHC.IO.Exception (ExitCode (ExitFailure)) | ||
|
|
||
| import Test.Cardano.CLI.Util | ||
|
|
||
| import Hedgehog (Property, (===)) | ||
| import Hedgehog.Extras.Test qualified as H | ||
|
|
||
| -- A reference script in a Plutus language the era does not support must fail | ||
| -- the command instead of being silently dropped from the output. | ||
|
|
||
| -- | Execute me with: | ||
| -- @cabal test cardano-cli-golden --test-options '-p "/golden conway build raw reference script unsupported language/"'@ | ||
| hprop_golden_conway_build_raw_reference_script_unsupported_language :: Property | ||
| hprop_golden_conway_build_raw_reference_script_unsupported_language = | ||
| watchdogProp . propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do | ||
| outFile <- noteTempFile tempDir "out.json" | ||
|
|
||
| (exitCode, _stdout, stderr) <- | ||
| execDetailCardanoCLI | ||
| [ "conway" | ||
| , "transaction" | ||
| , "build-raw" | ||
| , "--tx-in" | ||
| , "f62cd7bc15d8c6d2c8519fb8d13c57c0157ab6bab50af62bc63706feb966393d#0" | ||
| , "--tx-out" | ||
| , "addr_test1qpmxr8d8jcl25kyz2tz9a9sxv7jxglhddyf475045y8j3zxjcg9vquzkljyfn3rasfwwlkwu7hhm59gzxmsyxf3w9dps8832xh+5000000" | ||
| , "--tx-out-reference-script-file" | ||
| , "test/cardano-cli-golden/files/input/dijkstra/plutus/v4-always-succeeds.plutus" | ||
| , "--fee" | ||
| , "166777" | ||
| , "--out-file" | ||
| , outFile | ||
| ] | ||
|
|
||
| exitCode === ExitFailure 1 | ||
|
|
||
| H.diffVsGoldenFileExcludeTrace | ||
| stderr | ||
| "test/cardano-cli-golden/files/golden/conway/transaction/build-raw-reference-script-unsupported-language.out" |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rejection itself is correct: a native script with a guard is only valid from Dijkstra onwards, so a Conway output cannot carry it, and the transaction is rejected at build time.
The message names the script language because cardano-api's
toScriptInEraonly returnsNothing, and itssimpleScriptHasGuardcheck is not exported.A guard-specific message is better added in cardano-api than by copying that traversal into cardano-cli, so I'm leaving it as is here.