IntersectMBO / cardano-cli

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

Error decoding redeemer when rendering transaction using cardano-cli #886

Open ilap opened 2 months ago

ilap commented 2 months ago

Description

When attempting to render the redeemer of a transaction using cardano-cli with the command: cardano-cli debug transaction view --output-json --tx-file ample.tx

The CLI shows the following error message: Error decoding redeemer: unexpected CBOR token type for a JSON value: TypeTag

Note: It also fails rendering with --output-yaml too.

Expected result: The redeemer should be rendered as part of the transaction data in JSON format.

Steps to Reproduce

  1. Create a transaction that includes a redeemer.
  2. Run the cardano-cli with the following command: cardano-cli debug transaction view --output-json --tx-file <path-to-tx-file>
  3. Observe the error Error decoding redeemer: unexpected CBOR token type for a JSON value: TypeTag.

Additional Context

The error appears to occur while decoding the CBOR representation of the redeemer, where the redeemer's Plutus data contains tags. The decoding works correctly for redeemers using the Bigint Plutus type, such as [ 0, 0, 0, [123, 234]].

However, it fails when the redeemer contains tag-based Plutus types, such as [0, 0, 121([]), [123, 234]].

Cardano CLI version: 9.x.y.z (probably earlier are affected too). Operating System: Ubuntu 22.04]

Possible Solution

A potential solution could involve reviewing the CBOR decoding logic to properly handle tags within redeemer data types.

carbolymer commented 2 months ago

Would you mind attaching a failing transaction to the issue?

ilap commented 2 months ago

Would you mind attaching a failing transaction to the issue?

Here comes, but any tx with a redeemer contains a constructor (e.g. 121([]) ) would do: tx_with_redeemer.json

nabinpkl commented 1 month ago

Cardano-cli just outputs null in the case of a redeemer containing a constructor (e.g. 121([]) ). But we can verify that it indeed has a redeemer from manually decoding transaction cbor using https://cbor.me. The transaction decoding part should be looked into to facilitate tag-based plutus types.

github-actions[bot] commented 3 weeks 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.