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

Cleanup address deserialization #3218

Merged
merged 15 commits into from Dec 20, 2022
Merged

Conversation

lehins
Copy link
Contributor

@lehins lehins commented Dec 16, 2022

Description

Currently there are 4 separate implementations for deserializing an Addr. I am not gonna go into history why this is the case, but this PR moves old implementations into tests and uses them for ensuring that deserialization doesn't break accidentally over time and also as a baseline for checking performance. Summary:

  • There is now one single deserialization implementation for both CompactAddr and Addr
  • Constructor for CompactAddr is no longer exposed, making it impossible to create invalid and dangerous binary representations for addresses
  • Combines Cardano.Ledger.CompactAddress into Cardano.Ledger.Address, while preserving git history
  • There is no longer a need to supply a version for rountrip tests, they will iterate through all versions of serialization, since that property must hold for all versions
  • Switch to fromCBOR in BabbageTxBody and BabbagetxOut for address. Now possible thanks to versioned deserialization

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with ormolu (which can be run with scripts/ormolise.sh
  • Self-reviewed the diff

@lehins lehins force-pushed the lehins/cleanup-address-deserialization branch 4 times, most recently from bc1ccbd to f3b7266 Compare December 17, 2022 11:05
@lehins lehins force-pushed the lehins/cleanup-address-deserialization branch from f3b7266 to 52f1426 Compare December 19, 2022 18:58
@lehins lehins force-pushed the lehins/cleanup-address-deserialization branch from 52f1426 to 487e4b5 Compare December 19, 2022 19:01
@lehins lehins force-pushed the lehins/cleanup-address-deserialization branch from 487e4b5 to f071445 Compare December 19, 2022 20:52
Copy link
Contributor

@teodanciu teodanciu left a comment

Choose a reason for hiding this comment

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

Looks good to me.
First two commits could be probably squashed into one, to make each remaining commit work correctly, and same with next two commits, but don't think it matters too much, with all the moving around.

@lehins lehins force-pushed the lehins/cleanup-address-deserialization branch from f071445 to 7236776 Compare December 20, 2022 10:35
@lehins
Copy link
Contributor Author

lehins commented Dec 20, 2022

First two commits could be probably squashed into one, to make each remaining commit work correctly, and same with next two commits

I was unable to squash last two commits, since we then loose git history, however squashing the subsequent two worked out fine.

@lehins lehins merged commit 4dfa33c into master Dec 20, 2022
@iohk-bors iohk-bors bot deleted the lehins/cleanup-address-deserialization branch December 20, 2022 14:03
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.

None yet

2 participants