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: Transformation causes serialization mismatch for conway-era transactions #186

Closed
fallen-icarus opened this issue Sep 20, 2024 · 12 comments

Comments

@fallen-icarus
Copy link

The new conway era requires using conway flags with cardano-cli. For example, cardano-cli transaction build is now cardano-cli conway transaction build. If you build a transaction with the new conway flags and then transform the transaction, trying to sign with the hardware wallet results in Tx serialization mismatch. This issue even occurs for transactions without any plutus scripts. This was not an issue before the conway era.

$ cardano-hw-cli version
Cardano HW CLI Tool version 1.16.0-rc.1
Commit hash: e7225d91e0ddc6152ad973ba803d6c016cb14d7e
@fallen-icarus
Copy link
Author

I am able to sign and submit a transformed conway transaction using cardano-cli generated keys so perhaps the cardano-hw-cli TxSerializationMismatchError check is incorrect.

@fallen-icarus
Copy link
Author

I'm not sure if this github discussion is related. It mentions never trying to re-serialize to the same result.

@codybutz
Copy link

@fallen-icarus - We have experienced issues with the cardano-cli wrapping the inputs with a CBOR tag 258_1. To get around this, we create the transaction using the cardano-cli with the conway flag, then manually remove the d90102 in the CBOR before inputs.

I believe that cardano-hw-cli will need to be extended to include this transformation, but for now maybe this will help you get over whatever hurdle you're tackling, if this is the issue you're tackling.

@fallen-icarus
Copy link
Author

@codybutz Thanks for the tip! This isn't my most pressing issue, but when the time comes, if cardano-hw-cli still hasn't been fixed, I'll definitely try that out!

@gitmachtl
Copy link
Contributor

gitmachtl commented Sep 24, 2024

latest versions of hw-cli and the cardano-app should not have a problem with the tag 258. i had it in my scripts during the testing/dev period, but i removed it later on. so i am not sure if this is the issue in your case tbh.

i removed it like: https://github.com/gitmachtl/scripts/blob/f9f8e8297a93a92143d4e8b38827a52e3892f604/cardano/mainnet/01_sendLovelaces.sh#L588-L589

maybe there is a problem with cardano-cli itself and not producing consisdent 258 tags under some circumstances. because if you use the tage once, you have to use it everywhere in the cbor.

@fallen-icarus can you post a demo tx that is causing this issue?

@fallen-icarus
Copy link
Author

@gitmachtl Here is the tx.body file contents:

{
    "type": "Unwitnessed Tx ConwayEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a300d901028182582023a6d72a828bcf2ccbd2dcc6871a8d7187e4b3342e1dde1116a20007a6d37a5e000181825839004b03bd62f7e2d36d157620dd25d3960dc073fa71346a05cb29efbbc9efc7915da7275cfcf0b33909f390d5a2e71e9f1ebc9deaeb503e95bb821a00d210f7a1581cc0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561da24a54657374546f6b656e310a4b4f74686572546f6b656e0a1896021a00028f99a0f5f6"
}

It was generated with these commands:

cardano-cli conway transaction build-raw \
  --tx-in 23a6d72a828bcf2ccbd2dcc6871a8d7187e4b3342e1dde1116a20007a6d37a5e#0 \
  --tx-out "addr_test1qp9s80tz7l3dxmg4wcsd6fwnjcxuqul6wy6x5pwt98hmhj00c7g4mfe8tn70pveep8eep4dzuu0f784unh4wk5p7jkasa3cym4 13766903 lovelace + 150 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.4f74686572546f6b656e0a + 10 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.54657374546f6b656e31" \
  --protocol-params-file params.json \
  --fee 167833 \
  --out-file tx.body

cardano-hw-cli transaction transform \
  --tx-file tx.body \
  --out-file tx.body

@fallen-icarus
Copy link
Author

maybe there is a problem with cardano-cli itself and not producing consisdent 258 tags under some circumstances. because if you use the tage once, you have to use it everywhere in the cbor.

I have yet to build a transaction that actually succeeds so I'm skeptical of the idea there is an inconsistency somewhere.

@gitmachtl
Copy link
Contributor

Can you do a simple lovelace transaction without anthing else?

@fallen-icarus
Copy link
Author

That doesn't work either.

{
    "type": "Unwitnessed Tx ConwayEra",
    "description": "Ledger Cddl Format",
    "cborHex": "84a300d9010281825820538b8143099d84f5e5e21064377f66370f11ae457f7d1b3f8f76fa0d2291117f000181825839004b03bd62f7e2d36d157620dd25d3960dc073fa71346a05cb29efbbc9efc7915da7275cfcf0b33909f390d5a2e71e9f1ebc9deaeb503e95bb1a00aaf13e021a00028575a0f5f6"
}
cardano-cli conway transaction build-raw \
  --tx-in 538b8143099d84f5e5e21064377f66370f11ae457f7d1b3f8f76fa0d2291117f#0 \
  --tx-out "addr_test1qp9s80tz7l3dxmg4wcsd6fwnjcxuqul6wy6x5pwt98hmhj00c7g4mfe8tn70pveep8eep4dzuu0f784unh4wk5p7jkasa3cym4 11202878 lovelace " \
  --protocol-params-file params.json \
  --fee 165237 \
  --out-file tx.body

cardano-hw-cli transaction transform \
  --tx-file tx.body \
  --out-file tx.body

@gitmachtl
Copy link
Contributor

gitmachtl commented Sep 24, 2024

You are missing the time to live in your transaction build-raw command.
--invalid-hereafter ${ttl}

@fallen-icarus
Copy link
Author

I figured it out: I wasn't using the latest version of the cardano app on my ledger device 🙃. Both of the prior transactions are working now.

@fallen-icarus
Copy link
Author

I appreciate the help @codybutz and @gitmachtl

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

No branches or pull requests

3 participants