IntersectMBO / cardano-cli

This repository contains sources for the command-line interface (CLI) tool for interacting with the Cardano blockchain.
Apache License 2.0
39 stars 15 forks source link

The `build` command calculates insufficient Plutus script cost in Conway #650

Closed mkoura closed 3 weeks ago

mkoura commented 7 months ago

Description

In Conway era, Plutus script cost increased in a situation where two certificate scripts are used in single tx. I'm not sure if that is an issue or not. The build command however computes lower cost than is needed, and tx submit fails.

The build command:

cardano-cli conway transaction build --certificate-file "test_delegate_deregister[script_file-build-plutus_v2]_ci0_wld_addr0_stake_reg.cert" --certificate-script-file cardano_node_tests/tests/data/plutus/v2/stake-script.plutus --certificate-redeemer-file cardano_node_tests/tests/data/plutus/42.redeemer --certificate-file "test_delegate_deregister[script_file-build-plutus_v2]_ci0_wld_addr0_stake_deleg.cert" --certificate-script-file cardano_node_tests/tests/data/plutus/v2/stake-script.plutus --certificate-redeemer-file cardano_node_tests/tests/data/plutus/42.redeemer --tx-in-collateral "bf5e9f38e6c967984ff911c502d4601bd4a4129cfc1a0b8a02483ddb4e522d06#0" --tx-in "bf5e9f38e6c967984ff911c502d4601bd4a4129cfc1a0b8a02483ddb4e522d06#3" --change-address addr_test1yr52d4pz2jjz6f5ephlglr627ljrrq99hua8jmllme7tn0yu36w607q78j5sfp0n96l0exqn0j9vyc9qw2sqcj40zsksgwdtn2 --witness-override 1 --out-file "test_delegate_deregister[script_file-build-plutus_v2]_ci0_wld_reg_deleg_tx.body" --testnet-magic 42

Tx submit fails with (shortened error):

The plutus evaluation error is: CekError An error has occurred: User error:\nThe machine terminated part way through evaluation due to overspending the budget.\nThe budget when the machine terminated was:\n({cpu: -570964\n| mem: 28})\nNegative numbers indicate the overspent budget; note that this only indicates the budget that was needed for the next step, not to run the program to completion

When increasing the execution units, I'm able to build the tx using transaction build-raw and submit it successfully.

cardano-cli conway transaction build-raw --fee 500000 --out-file "test_delegate_deregister[script_file-build_raw-plutus_v2]_ci0_ahh_reg_deleg_tx.body" --certificate-file "test_delegate_deregister[script_file-build_raw-plutus_v2]_ci0_ahh_addr0_stake_reg.cert" --certificate-script-file cardano_node_tests/tests/data/plutus/v2/stake-script.plutus --certificate-execution-units "(240000000,790000)" --certificate-redeemer-file cardano_node_tests/tests/data/plutus/42.redeemer --certificate-file "test_delegate_deregister[script_file-build_raw-plutus_v2]_ci0_ahh_addr0_stake_deleg.cert" --certificate-script-file cardano_node_tests/tests/data/plutus/v2/stake-script.plutus --certificate-execution-units "(240000000,790000)" --certificate-redeemer-file cardano_node_tests/tests/data/plutus/42.redeemer --tx-in-collateral "c7ae98f5711ee9cee74d0f603e09ce1baa5e6d0fef9786be48558e70b6558e8f#0" --protocol-params-file pparams-eret.json --tx-in "c7ae98f5711ee9cee74d0f603e09ce1baa5e6d0fef9786be48558e70b6558e8f#3" --tx-out "addr_test1yp9dc3vuht93r28v0fz3q2clpn7s998ck9ekcpweefc7pxvu36w607q78j5sfp0n96l0exqn0j9vyc9qw2sqcj40zsksdwm4xm+1499100000"

The scripts cost reported by transaction build:

[{'executionUnits': {'memory': 613680, 'steps': 196655766},
  'lovelaceCost': 49589,
  'scriptHash': '9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d'},
 {'executionUnits': {'memory': 616152, 'steps': 197801730},
  'lovelaceCost': 49814,
  'scriptHash': '9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d'}]

In previous node releases, we were able to submit the tx in Conway with execution units (218855869, 686154). We still are able to use these execution units in Babbage.

Steps to Reproduce

  1. build the tx using transaction build
  2. submit the tx
  3. see the error

Additional Context

Files used to build the tx and full error message: issue_delegation_plutus.tar.gz

Tested on Linux with cardano-node / cardano-cli from node 8.9.0 release.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

CarlosLopezDeLara commented 3 months ago

The issue is still present. This time it hit when running the Guardrails script.

cardano-cli conway governance action create-protocol-parameters-update \
--testnet --governance-action-deposit 50000000000 \
--deposit-return-stake-verification-key-file keys/stake.vkey \
--anchor-url https://tinyurl.com/3wrwb2as \
--anchor-data-hash 52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2 \
--constitution-script-hash edcd84c10e36ae810dc50847477083069db796219b39ccde790484e0 \
--governance-action-lifetime 15 --out-file transactions/pparams.action

cardano-cli conway transaction build --proposal-script-file guardrails-script.plutus \
--tx-in-collateral 092f39232236a9833d01e2590a7665b1f4586f59e22e5c66864fc48152e6b557#0 \
--proposal-redeemer-value '{}' \
--tx-in f2d3df12fb3caab1690c5afa6a6273f1dcaa0d73f594018cd0d36527dd83560e#0 \
--change-address addr_test1qp39w0fa0ccdc4gmg87puydf2kxt5mgt0vteq4a22ktrcssg7ysmx64l90xa0k4z25wpuejngya833qeu9cdxvveynfscsskf5 
--proposal-file transactions/pparams.action --out-file transactions/pparams-tx.raw
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly (PlutusFailure "
The PlutusV3 script failed:
Base64-encoded script bytes:
...
...
The script hash is:ScriptHash \"edcd84c10e36ae810dc50847477083069db796219b39ccde790484e0\"
The plutus evaluation error is: CekError An error has occurred:
The machine terminated part way through evaluation due to overspending the budget.
The budget when the machine terminated was:
({cpu: -100
| mem: -100})
Negative numbers indicate the overspent budget; note that this only indicates the budget that was needed for the next step, not to run the program to completion.
The protocol version is: Version 10
github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

Jimbo4350 commented 2 months ago

Resolved by:

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

smelc commented 1 month ago

@CarlosLopezDeLara> can you check if the issue is still there? I believe not.