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

Cannot create UTxO with datum hash using Alonzo era Tx #501

Closed
mkoura opened this issue Dec 5, 2023 · 2 comments · Fixed by #507
Closed

Cannot create UTxO with datum hash using Alonzo era Tx #501

mkoura opened this issue Dec 5, 2023 · 2 comments · Fixed by #507

Comments

@mkoura
Copy link
Contributor

mkoura commented Dec 5, 2023

Description

When building Alonzo era Tx, datum seems to be ignored. Resulting UTxO is missing datum hash.

This can lead to unspendable UTxOs.

Babbage era transactions are ok.

Steps to Reproduce

  1. create UTxO with datum

cardano-cli transaction build-raw --fee 206493 --out-file "test_txout_locking[plutus_v1]_ci0_wvv_step1_tx.body" --tx-in "4704d8ca62202aa08430f4646a369b5e4a4edb0b253b3c73a703306144153b94#0" --tx-out "addr_test1wpnlxv2xv9a9ucvnvzqakwepzl9ltx7jzgm53av2e9ncv4sysemm8+2400250" --tx-out-datum-hash-file typed-42.datum --tx-out "addr_test1vqywhyg482c5pmex624cdtslx2tm3ghgd9zwqkgauzjc69s98xmzl+2000000" --tx-out "addr_test1vrgc5nsf857gs5qm0j6j3xvekmzpljedd8y6207z6lh5rms4695pq+2995393257" --alonzo-era

cardano-cli transaction sign --tx-body-file "test_txout_locking[plutus_v1]_ci0_wvv_step1_tx.body" --testnet-magic 42 --signing-key-file "test_txout_locking[plutus_v1]_ci0_hpl_payment_addr_0.skey" --out-file "test_txout_locking[plutus_v1]_ci0_wvv_step1_tx.signed

cardano-cli transaction submit --testnet-magic 42 --tx-file "test_txout_locking[plutus_v1]_ci0_wvv_step1_tx.signed

  1. check the UTxO that should have the datum

cardano-cli query utxo --out-file /dev/stdout --tx-in "828a33d6087af73412bc307f84223690cfae853b341f19990ed86e0606d8e593#0" --testnet-magic 42

{
    "828a33d6087af73412bc307f84223690cfae853b341f19990ed86e0606d8e593#0": {
        "address": "addr_test1wpnlxv2xv9a9ucvnvzqakwepzl9ltx7jzgm53av2e9ncv4sysemm8",
        "datum": null,
        "datumhash": null,
        "inlineDatum": null,
        "referenceScript": null,
        "value": {
            "lovelace": 2400250
        }
    }
}

See that the datum is missing, even though it should be there.

  1. try to spend the locked UTxO

cardano-cli transaction build-raw --fee 400250 --out-file "test_txout_locking[plutus_v1]_ci0_wvv_step2_tx.body" --tx-in "828a33d6087af73412bc307f84223690cfae853b341f19990ed86e0606d8e593#0" --tx-in-script-file always-succeeds-spending.plutus --tx-in-execution-units "(368100,1700)" --tx-in-datum-file typed-42.datum --tx-in-redeemer-cbor-file 42.redeemer.cbor --tx-in-collateral "828a33d6087af73412bc307f84223690cfae853b341f19990ed86e0606d8e593#1" --protocol-params-file pparams-tmcc.json --tx-out "addr_test1vqywhyg482c5pmex624cdtslx2tm3ghgd9zwqkgauzjc69s98xmzl+2000000" --alonzo-era

cardano-cli transaction sign --tx-body-file "test_txout_locking[plutus_v1]_ci0_wvv_step2_tx.body" --testnet-magic 42 --signing-key-file "test_txout_locking[plutus_v1]_ci0_hpl_payment_addr_1.skey" --out-file "test_txout_locking[plutus_v1]_ci0_wvv_step2_tx.signed

cardano-cli transaction submit --testnet-magic 42 --tx-file "test_txout_locking[plutus_v1]_ci0_wvv_step2_tx.signed

See an error

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (AlonzoInBabbageUtxowPredFailure (UnspendableUTxONoDatumHash (fromList [TxIn (TxId {unTxId = SafeHash "828a33d6087af73412bc307f84223690cfae853b341f19990ed86e0606d8e593"}) (TxIx 0)]))),UtxowFailure (AlonzoInBabbageUtxowPredFailure (NotAllowedSupplementalDatums (fromList [SafeHash "fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273"]) (fromList [])))])

The UTxO is unspendable.

Files used for building the Tx: alonzo_tx.tar.gz

Additional Context

Tested with cardano-node 8.7.1-pre

@carbolymer
Copy link
Contributor

carbolymer commented Dec 6, 2023

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (AlonzoInBabbageUtxowPredFailure (UnspendableUTxONoDatumHash (fromList [TxIn (TxId {unTxId = SafeHash "17d680bf9d7173a8e55b81e6d1c42aab490603bcebaf9f33d46c3478085881a8"}) (TxIx 0)]))),UtxowFailure (AlonzoInBabbageUtxowPredFailure (NotAllowedSupplementalDatums (fromList [SafeHash "fcaa61fb85676101d9e3398a484674e71c45c3fd41b492682f3b0054f4cf3273"]) (fromList [])))])

@Jimbo4350
Copy link
Contributor

Fixed by IntersectMBO/cardano-api#398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants