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

Implement fast unstable comparisons #517

Closed

Conversation

tcharding
Copy link
Member

Builds on top of #515

We recently improved the comparison implementations to be stable across library versions by first serializing the data types before comparing them instead of just comparing the inner bytes. This had the downside that the comparisons are now slower.

Add public methods cmp_fast_unstable and eq_fast_unstable to each of the types that wraps an FFI type.

Currently we are deriving various traits that call down to the traits
implemented in secp265k1-sys that in turn call down to implementations
on the inner byte array. Since we cannot guarantee the inner byte arrays
in secp256k1-sys this results in trait implementations that may not be
stable across versions of the library.

For `XOnlyPublicKey`, `KeyPair`, and `ecdsa::Signature` manually
implement `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` by first
converting the type into a form that is guaranteed to be stable across
library versions e.g., by serializing it to a known format.
We recently improved the comparison implementations to be stable across
library versions by first serializing the data types before comparing
them instead of just comparing the inner bytes. This had the downside
that the comparisons are now slower.

Add public methods `cmp_fast_unstable` and `eq_fast_unstable` to each
of the types that wraps an FFI type.
@tcharding
Copy link
Member Author

Ah actually I'm going to put this on #515

@tcharding tcharding closed this Nov 16, 2022
@tcharding tcharding deleted the 11-17-unstable-comparisons branch October 9, 2023 22:10
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

1 participant