Skip to content
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

Plutus predicate failure to use Plutus error instead of string #2513

Open
JaredCorduan opened this issue Oct 8, 2021 · 2 comments
Open

Plutus predicate failure to use Plutus error instead of string #2513

JaredCorduan opened this issue Oct 8, 2021 · 2 comments
Labels
💳 technical-debt Issues related to technical debt we introduced dijkstra Ledger era that will follow after Conway

Comments

@JaredCorduan
Copy link
Contributor

It would be helpful to downstream libraries if the plutus script predicate returned the actual plutus error instead of a string:

https://github.com/input-output-hk/cardano-ledger-specs/blob/8ef01f28e31789503879f1391b230aa1e50c6ab2/eras/alonzo/impl/src/Cardano/Ledger/Alonzo/TxInfo.hs#L632

@JaredCorduan JaredCorduan added 💳 technical-debt Issues related to technical debt we introduced babbage labels Oct 8, 2021
@MaximilianAlgehed
Copy link
Collaborator

MaximilianAlgehed commented Oct 11, 2021

I agree that this is a problem. We've bumped into issues / warts / frustrations related to this when implementing testing tools for Plutus contracts. For example over at IntersectMBO/plutus#4023.

As for solutions I don't know what's best but the information that's needed by downstream code is at least:

  1. What term caused the error (in the case of e.g. builtins failing)
  2. What error message did the contract developer intend to throw. Right now this information is propagated via the log but in a perfect world the interpreter would put this error in the datastructure it returns when a computation fails.

@JaredCorduan
Copy link
Contributor Author

We unfortunately cannot run Plutus scripts in verbose mode inside the node, but there will soon be two ways to see the verbose logs.

  • The CLI will soon be using the newer version of evaluateTransactionExecutionUnits when building transactions, so that when a Plutus scripts fails it can return the logs.
  • When the node returns the predicate failure for a failed script, in addition to the show e that is inside the Text, there is debug information in the ByteString. I believe our plan is to make using the debug information to retrieve the verbose logs available from the CLI. This is just a matter of running debugPutus with the information from the predicate failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💳 technical-debt Issues related to technical debt we introduced dijkstra Ledger era that will follow after Conway
Projects
None yet
Development

No branches or pull requests

3 participants