IntersectMBO / cardano-ledger

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

`CurrentTreasuryFieldNotSupported` when building/submitting certain tx with Plutus V1 and V2 scripts #4470

Closed mkoura closed 1 day ago

mkoura commented 5 days ago

With node pre-release 9.0.0, I'm getting lot of errors that looks like comming from ledger:

Command failed: transaction build  Error: The following scripts have execution failures:
the script for policyId 0 (in ascending order of the PolicyIds) failed with:
Error translating the transaction context: CurrentTreasuryFieldNotSupported (Coin 141903887384608)

or

Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (CollectErrors [BadTranslation (CurrentTreasuryFieldNotSupported (Coin 19439421515646))]))) :| []))

E.g. when building a tx with V2 minting script:

cardano-cli conway transaction build --mint-script-file cardano_node_tests/tests/data/plutus/v2/anyone-can-mint.plutus --mint-redeemer-file cardano_node_tests/tests/data/plutus/42.redeemer --tx-in-collateral "8b4865d1fdc846f60ecfc182ffcf0882d90a29d340b4d7f85e5fb8bded19efc8#2" --tx-in-collateral "8b4865d1fdc846f60ecfc182ffcf0882d90a29d340b4d7f85e5fb8bded19efc8#1" --tx-in "8b4865d1fdc846f60ecfc182ffcf0882d90a29d340b4d7f85e5fb8bded19efc8#0" --tx-out "addr_test1vrzyc59sj2fpfrln2d9ztvf4nn8tez29jsrq2sww8yvfn3spsvftw+2000000+5 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.7161636f696e7877667a" --mint "5 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.7161636f696e7877667a" --change-address addr_test1vqaxd4h9p0fswyjgxn97u7vdwl9vd75t4d9exaea8wupg6qasw00l --out-file "test_minting_one_token[plutus_v2-submit_cli]_ci0_ehi_step2_tx.body" --testnet-magic 42

Files used for building the transaction: treasury_issue.tar.gz

cc @Jimbo4350

CarlosLopezDeLara commented 5 days ago

@smelc probably related to the treasury donation / current treasury fields on txbody?

Edit: yeah it looks like CLI build is populating the field on every transaction. This is problematic. its causing pv1/pv2 txs to fail.

It can also be problematic at epoch boundaries for normal transactions. i.e. when the transaction is generated on one epoch and submitted on the next.

We should only populate this field when it is strictly needed. i.e. only on treasury donations (I think that is the only time the field is needed).

tx.signed.txt tx.view.txt

CarlosLopezDeLara commented 5 days ago

@mkoura could you also share the generated tx.body please?

lehins commented 1 day ago

Yes, this issue is not for ledger, since the behavior is as expected: whenever treasury donation field is present in the transaction, then PlutusV1 and PlutusV2 scripts can't be used in that transaction. Same applies to all other features that were added to a transaction in Conway