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

fix: the transaction id computation now accounts for serialization round trip errors #771

Merged
merged 2 commits into from
Jun 20, 2023

Conversation

AngelCastilloB
Copy link
Member

Context

Because of how CBOR works. There are multiple ways in CBOR to represent the same data. Unfortunately right now the CML doesn't maintain the serialization format upon using from_bytes so if cardano-cli uses non-canonical CBOR this will result in different hashes.

Proposed Solution

Maintain the original the serialized bytes of the body, and use that to compute the hash instead of re serializing (when possible).

Important Changes Introduced

Added a new method to the transaction class 'getId' which always compute the hash of the transaction body using the original bytes found in the transaction (if available). Please note that if changes to the transaction body are made, this cache will be invalidated.

@AngelCastilloB AngelCastilloB requested a review from a team June 19, 2023 04:19
@AngelCastilloB AngelCastilloB requested a review from a team June 20, 2023 07:43
Copy link
Collaborator

@mirceahasegan mirceahasegan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🚀

@rhyslbw rhyslbw merged commit 55e96c0 into master Jun 20, 2023
@rhyslbw rhyslbw deleted the ADP-3070-fix-transaction-id-computation branch June 20, 2023 11:11
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.

4 participants