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

Use static arrays in FerveoPublicKey serialization #136

Merged
merged 4 commits into from
Jul 5, 2023

Conversation

piotr-roslaniec
Copy link
Member

@piotr-roslaniec piotr-roslaniec commented Jul 3, 2023

Type of PR:

  • Feature

Required reviews:

  • 2

What this does:

  • Implement static array serialization shortening serialized size of FerveoPublicKey from 104 bytes to 96 bytes

Issues fixed/closed:

Why it's needed:

  • Reduce the on-chain footprint of DKG participants

Notes for reviewers:

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2023

Codecov Report

Merging #136 (3bc28d7) into development (8dc57d3) will increase coverage by 0.15%.
The diff coverage is 12.50%.

@@               Coverage Diff               @@
##           development     #136      +/-   ##
===============================================
+ Coverage        78.66%   78.82%   +0.15%     
===============================================
  Files               24       24              
  Lines             4880     4912      +32     
===============================================
+ Hits              3839     3872      +33     
+ Misses            1041     1040       -1     
Impacted Files Coverage Δ
ferveo-common/src/lib.rs 6.66% <0.00%> (-93.34%) ⬇️
ferveo/src/bindings_python.rs 53.95% <0.00%> (-0.34%) ⬇️
ferveo/src/bindings_wasm.rs 0.00% <0.00%> (ø)
ferveo-common/src/keypair.rs 72.43% <8.33%> (-2.40%) ⬇️
ferveo/src/api.rs 93.69% <71.42%> (+4.90%) ⬆️

def test_public_key_serialization():
pk = make_pk()
serialized = bytes(pk)
assert len(serialized) == FerveoPublicKey.serialized_size()
Copy link
Member

@derekpierre derekpierre Jul 4, 2023

Choose a reason for hiding this comment

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

Is it possible to also use from_bytes(...) in the test and compare the deserialized object to the original? So not just the serialization, but the deserialization as well.

Same for L59 as well.

def make_pk():
return Keypair.random().public_key()


Copy link
Member

Choose a reason for hiding this comment

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

Can the commented-out TODOs in this test file now be uncommented due to the updated bindings?

Copy link
Member Author

@piotr-roslaniec piotr-roslaniec Jul 5, 2023

Choose a reason for hiding this comment

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

I've tried to update some of these tests but I didn't implement __richcmp__ for all types involved, so I'm going to cut some corners here. Ideally, we would have all class methods implemented, but that's a bit of work and not really worth the effort at this point IMHO.

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

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

🎸

@piotr-roslaniec piotr-roslaniec merged commit 2b64c2e into development Jul 5, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

None yet

3 participants