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

PlutusData::to_cardano_node_format() #357

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

rooooooooob
Copy link
Contributor

Returns the same datum but with the encoding details changed so that it will match cardano-node/CSL/Lucid

This is only in cases where dealing in raw bytes and/or from_cbor_bytes() is somehow not possible, as that solution is 100% fool-proof with any tool always for calculating hashes.

Fixes #356

Returns the same datum but with the encoding details changed so that it
will match cardano-node/CSL/Lucid

This is only in cases where dealing in raw bytes and/or
`from_cbor_bytes()` is somehow not possible, as that solution is 100%
fool-proof with any tool always for calculating hashes.

Fixes #356
@rooooooooob rooooooooob merged commit 7a6fc38 into develop Sep 4, 2024
1 check passed
@SebastienGllmt
Copy link
Contributor

Perhaps this should be mentioned in the docs if we think this is a common issue?

@rooooooooob
Copy link
Contributor Author

@SebastienGllmt I'm not sure if we should be encouraging this in situations where it's avoidable. It's not good practice to hope that every little bit will line up when creating datums from scratch using a specific tool. It's much better to use PlutusData::from_cbor_bytes() on the bytes created with whatever other tool/on-chain data you're working with and know for sure you won't run into issues regardless of the tool. We already have a CBOR section in the docs as of #345. I could expand upon it if needed or put even more emphasis on from_cbor_bytes(). It already mentions how it can make the hash change if 1 thing is encoded differently and that using types created from the cbor bytes using CML avoids these issues.

rooooooooob added a commit that referenced this pull request Sep 10, 2024
* Mentions `PlutusData::to_cardano_node_format()`

* Concrete example using other tool and why working from bytes is
  strongly advised

* Should address discussion from #356 / #357 more directly
rooooooooob added a commit that referenced this pull request Sep 11, 2024
* Mentions `PlutusData::to_cardano_node_format()`

* Concrete example using other tool and why working from bytes is
  strongly advised

* Should address discussion from #356 / #357 more directly
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

Successfully merging this pull request may close these issues.

Non-canonical CBOR Serialization (Optional)
2 participants