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!: Remove deprecated_serialize_commitment from API #85

Merged
merged 3 commits into from
Feb 17, 2024

Conversation

kevaundray
Copy link
Contributor

@kevaundray kevaundray commented Feb 17, 2024

Rationale

TLDR: Imagine you were using a cryptography library which exposed two methods hash1 and hash2 where the difference between the two of them is that hash1 uses keccak256 and hash2 uses sha256. From the callers perspective you get a 32 byte slice regardless, so having both of these in the API does not add any extra functionality. We can therefore remove one.

The existence of deprecated_serialize_commitment on the API allows downstream users to serialize a commitment to a 32 byte array. hash_commitment holds the same functionality, with the exception that the 32 byte array represents a field element. From the perspective of the verkle trie library, these two methods provide the same functionality.

Having two ways to convert a commitment to a 32 byte array, where they are used in different places in the code allows for footguns and confusions especially when trying to decide which one to use. Using one in place of the other in the public API, makes it seem like one of them is more special than the other.

See #86

@kevaundray kevaundray merged commit eac18c4 into master Feb 17, 2024
6 checks passed
@kevaundray
Copy link
Contributor Author

Reverting this because serialize is used to serialize the root node, mapToScalarField is not reversible unfortunately

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.

1 participant