IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
251 stars 157 forks source link

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

Open JaredCorduan opened 2 years ago

JaredCorduan commented 2 years ago

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

MaximilianAlgehed commented 2 years ago

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 https://github.com/input-output-hk/plutus/pull/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 commented 2 years ago

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