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

[BUG] - re-encoded redeemer and datum values don't correspond to original value #4924

Closed
mkoura opened this issue Mar 1, 2023 · 1 comment · Fixed by #4926
Closed

[BUG] - re-encoded redeemer and datum values don't correspond to original value #4924

mkoura opened this issue Mar 1, 2023 · 1 comment · Fixed by #4926
Assignees
Labels
bug Something isn't working comp: plutus era: babbage type: bug Something is not working user type: internal Created by an IOG employee

Comments

@mkoura
Copy link
Contributor

mkoura commented Mar 1, 2023

Internal

Area
Plutus Related to Plutus Scripts (Alonzo).

Summary
Re-encoded redeemer and datum values don't correspond to original values. Building (or submitting) transaction fails:

cardano-cli transaction build --tx-in "17444ecd796a4f239553f386621ac14c592c3df6bc8745d3a98045b73885d317#0" --tx-in-script-file cardano_node_tests/tests/data/plutus/v1/guess-42-datum-42-txin.plutus --tx-in-datum-file cardano_node_tests/tests/data/plutus/42.datum --tx-in-redeemer-file cardano-node-tests/cardano_node_tests/tests/data/plutus/42.redeemer --tx-in-collateral "17444ecd796a4f239553f386621ac14c592c3df6bc8745d3a98045b73885d317#1" --tx-out "addr_test1vql37sw7p3f9y7ecz4l9af293l5slrgh3wg038xq20exktcwgmtvr+2000000" --change-address addr_test1vz5e2pyw4yqvnwhavwgk5xmr26qa9jvtg4cwxw5a5yg294stapktp --out-file test_guessing_game_ci0_lcr_plutus_v1-untyped_json-datum_step2_tx.body --babbage-era --testnet-magic 42

fails with

          Command failed: transaction build  Error: The following scripts have execution failures:
          the script for transaction input 0 (in the order of the TxIds) failed with:
          The Plutus script evaluation failed: An error has occurred:  User error:
          The machine terminated because of an error, either from a built-in function or from an explicit use of 'error'.
          Script debugging logs: Incorrect datum. Expected 42.

The content of file 42.datum

{"int":42}

When using inline datum, the UTxO looks like

{
    "8114f9753e67fa7ea7af55e44c9456c40e0f0340e98af59ba8e3e91f34724ddc#0": {
        "address": "addr_test1wr89mr6dyfztwf7pt5jr0pmd7ezhnenunzs0md956y08qlg0at2g8",
        "datum": null,
        "inlineDatum": {
            "map": [
                {
                    "k": {
                        "bytes": "696e74"
                    },
                    "v": {
                        "int": 42
                    }
                }
            ]
        },
        "inlineDatumhash": "f45c25573f6406a6d1c7587c1583fd4ae99adb78122f66f765bb12982656ae80",
        "referenceScript": null,
        "value": {
            "lovelace": 200000000
        }
    }
}

for datum

{"int":42}

and

{
    "a7ddc005513fc82001001a88ea02cb5f9ea4561629ae828498383602e766f0e8#0": {
        "address": "addr_test1wr89mr6dyfztwf7pt5jr0pmd7ezhnenunzs0md956y08qlg0at2g8",
        "datum": null,
        "inlineDatum": {
            "map": [
                {
                    "k": {
                        "bytes": "636f6e7374727563746f72"
                    },
                    "v": {
                        "int": 0
                    }
                },
                {
                    "k": {
                        "bytes": "6669656c6473"
                    },
                    "v": {
                        "list": [
                            {
                                "map": [
                                    {
                                        "k": {
                                            "bytes": "696e74"
                                        },
                                        "v": {
                                            "int": 42
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                }
            ]
        },
        "inlineDatumhash": "0d396169c1f63f0cd24bf336141f0460504739888d49c328ccd283b0ba3468ad",
        "referenceScript": null,
        "value": {
            "lovelace": 200000000
        }
    }
}

for typed datum

{"constructor":0,"fields":[{"int":42}]}

The issue seems to be caused by #4886

System info:

@mkoura mkoura added type: bug Something is not working bug Something isn't working user type: internal Created by an IOG employee era: babbage comp: plutus labels Mar 1, 2023
@catch-21
Copy link
Contributor

catch-21 commented Mar 1, 2023

Nice catch.
Does it also break script data value cli flags or just file?
and does it definitely affect redeemer in the same way?

Jimbo4350 added a commit that referenced this issue Mar 2, 2023
was introduced by #4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
Jimbo4350 added a commit that referenced this issue Mar 3, 2023
was introduced by #4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
@newhoggy newhoggy self-assigned this Mar 3, 2023
Jimbo4350 added a commit that referenced this issue Mar 6, 2023
was introduced by #4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
Jimbo4350 added a commit that referenced this issue Mar 6, 2023
was introduced by #4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
Jimbo4350 added a commit that referenced this issue Mar 6, 2023
was introduced by #4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
mkoura added a commit to IntersectMBO/cardano-node-tests that referenced this issue Mar 7, 2023
newhoggy pushed a commit to IntersectMBO/cardano-api that referenced this issue May 23, 2023
was introduced by IntersectMBO/cardano-node#4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
newhoggy pushed a commit to IntersectMBO/cardano-cli that referenced this issue May 24, 2023
was introduced by IntersectMBO/cardano-node#4886

readScriptDataOrFile was reverted to read ScriptData json with the detailed schema format (ScriptDataJsonDetailedSchema)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp: plutus era: babbage type: bug Something is not working user type: internal Created by an IOG employee
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants