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

chore!: clean up ExtensionDegree #85

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

AaronFeickert
Copy link
Contributor

@AaronFeickert AaronFeickert commented Sep 21, 2023

Currently, ExtensionDegree discriminants are represented as isize by the compiler. The enumeration implements TryFrom<usize> via a wrapper to a public function ExtensionDegreee::try_from_size that is used in the library. This is inelegant, makes deserialization (which acts on bytes) more awkward, and introduces the possibility that a future enumeration update could overflow u8 and cause serialization problems.

This PR moves the functionality of ExtensionDegree::try_from_size into a TryFrom<u8> implementation, and implements TryFrom<usize> as a wrapper. It changes the discriminant representation to u8, which will ensure that any future change to ExtensionDegree that could overflow will be caught by the compiler.

BREAKING CHANGE: Introduces a change to the ExtensionDegree public API.

@AaronFeickert AaronFeickert changed the title chore: clean up ExtensionDegree chore!: clean up ExtensionDegree Sep 21, 2023
@AaronFeickert AaronFeickert force-pushed the extension-degree-cleanup branch 3 times, most recently from aad4e64 to 42b38bf Compare September 21, 2023 18:09
@CjS77 CjS77 merged commit da57859 into tari-project:main Oct 20, 2023
6 checks passed
@AaronFeickert AaronFeickert deleted the extension-degree-cleanup branch October 20, 2023 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants