aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
474 stars 92 forks source link

tx simulate - fatal error #993

Closed boemekeld closed 2 months ago

boemekeld commented 2 months ago

Description: Encountered a fatal error while running "aiken tx simulate".

Error Details:

Steps to Reproduce:

  1. Run the command aiken tx simulate transaction.txt input.txt output.txt with the provided input files.

Input files: transaction.txt input.txt output.txt

KtorZ commented 2 months ago

The issue seems to be an invalid address in one of your payload that failed to be decoded. Digging in a bit, I found two addresses in your outputs, which serializes down to:

Which is invalid, as the first byte indicates an address of type-0, which must have both a payment part and a delegation part (see: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L1). You could switch to the following type-6 address instead:

output.patched.txt ``` 83A300581D70F1E27A25DB3FD1319480E41A181A7585C9C7DA1EDB2F08D57EA3B61F028201D8185826D8799F5820AA8878DF7C4E519C1224150AF0FC1A4ABE874BFE77989ACD28910CB412C8384DFF011A00B71B00A200581D608F44DD942A3BCC1A7D6EA1F8BDDC0912CC1C4C6E7743254DC3DF0250011A95E65DF0A200581D608F44DD942A3BCC1A7D6EA1F8BDDC0912CC1C4C6E7743254DC3DF0250011ADCE0E091 ```

Which then evaluates successfully to:

❯ aiken tx simulate /tmp/transaction.cbor /tmp/inputs.cbor /tmp/outputs.cbor
      Parsing script context
   Simulating 15ac7e53589d3f6f797188d32523b730e6e964954293efa2496b9941d9ae5a92
     Redeemer Spend → 0

[
  {
    "mem": 2033050,
    "cpu": 1145591298
  }
]

Note: this group of commands is under rework, and need some love indeed to provide better feedback and interfaces.