-
Notifications
You must be signed in to change notification settings - Fork 721
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] - Possible corruption of datum by CLI #4433
Comments
The initial version uses fixed length arrays, whilst the dbsync version uses variable length arrays with explicit "stop" markers. The data contained in both is identical. I haven't looked to much further into why this happens, but my assumption is that the underlying CBOR library being used wants to make streaming data possible and therefore uses variable length arrays everywhere when serialising data to CBOR. Personally, I don't think this is a "real" bug with the CLI. This is morally equivalent to you supplying |
Actually, perhaps it is a real issue. Let me see how much work is involved to fix it. |
after the fix db-sync does no serialization, it uses the bytes as they come from the wire. On the other end, cli should do no serialization as weill, when dealing with CBOR file inputs. It should get the bytes as they come from the file. Otherwise, even though the Datum is the same, it can cause hash mismatches from that the user expects. |
I came across this bug in building a transaction with cardano-cli. In order to sign a plutus transaction with a hardware device like ledger, the cbor MUST be canonical. cardano-hw-cli will decline to sign it if it is not. A transaction built by cardano-cli will produce a variable length array no matter what.
The underscore represents a variable length array. The json datum file that produced this is
To get around this and have cardano-cli use a fixed-length array so I can sign the transaction with a ledger hardware device, I attempted to pass in the data as cbor with This cbor file is clearly using a fixed-length array as there is no underscore in the array.
Even in this circumstance, cardano-cli manipulated my input data and creates an indeterminate-length array in the final transaction. |
Here's the reference bug I opened on the VacuumLabs side. Basically, either IOG or VL needs to fix it. Either IOG needs to output canonical cbor that the VL code will choose to leave alone, or the VL code needs to be smarter and ignore any un-canonical cbor outside of the txBody. Either way, this is frustrating as a user stuck between two companies. This isn't the first time we've had a disconnect between them over canonical cbor in transactions. |
Related: IntersectMBO/cardano-ledger#2943 |
4831: Refactor `genesis create` command usage in cardano testnet r=Jimbo4350 a=Jimbo4350 Implement the following three modules: 1. Testnet.Commands.Genesis - Houses the refactoring of cli commands concerning genesis generation 2. Testnet.Commands.Governance - Houses the refactoring of cli commands concerning governance 3. Testnet.Options - Module that will house all the different `TestnetOptions` types. The aim is to only have one `TestnetOptions` type in the future. 4886: Preserve `ScriptData` bytes with `HashableScriptData` r=Jimbo4350 a=Jimbo4350 Resolves: #4433 Co-authored-by: Jordan Millar <[email protected]>
Internal/External
Internal
Area
cardano-cli
- Tx with datum.Summary
Originally this bug was opened in
cardano-db-sync
repository:IntersectMBO/cardano-db-sync#1214
The observed errors could be caused by a CLI issue. It looks like Tx is created with the wrong Datum and db-sync does the correct thing of extracting the bytes as they are.
The test is defined here:
https://github.com/input-output-hk/cardano-node-tests/blob/master/cardano_node_tests/tests/test_plutus_v2_spend_raw.py#L375
it fails with:
Files attached (added
txt
extension because GH blocked the upload)original_cbor.txt
dbsync_cbor.txt
@kderme wrote unit tests for this that fail without the fix IntersectMBO/cardano-db-sync#1255 and create the tx programmaticaly, without cli.
System info (please complete the following information):
1.35.3
1.35.3
The text was updated successfully, but these errors were encountered: