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

Add ed25519 public key bytes wrapper #221

Merged

Conversation

DaughterOfMars
Copy link
Collaborator

@DaughterOfMars DaughterOfMars commented Jan 16, 2024

Description of change

This PR adds a public key bytes wrapper that does not require validation to exist.

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Modified a few existing tests to use the new type.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@semenov-vladyslav
Copy link
Collaborator

What is the purpose of such wrapper? In which way the wrapper "does not require validation"?

In my opinion, it adds extra code duplication without clear benefits. Could you please provide a non-trivial use-case example demonstrating benefits of the wrapper?

@DaughterOfMars
Copy link
Collaborator Author

It does not require validation of bytes for the type to be constructed, unlike PublicKey. This allows us to unpack a public key without guaranteeing anything other than the length of the bytes. We need this in shimmer because currently invalid bytes are allowed syntactically (something we hope to change for 2.0).

Cargo.toml Outdated Show resolved Hide resolved
src/hashes/ternary/kerl/bigint/i384/mod.rs Show resolved Hide resolved
src/signatures/ed25519.rs Outdated Show resolved Hide resolved
tests/ed25519.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@semenov-vladyslav semenov-vladyslav 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.

@thibault-martinez thibault-martinez merged commit 65c49a4 into iotaledger:dev Jan 16, 2024
6 of 7 checks passed
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.

3 participants