Skip to content

Common protocol key type for serialization of Stm types #1108

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

Merged
merged 6 commits into from
Jul 28, 2023

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Jul 28, 2023

Content

This PR defines a new type in the common: ProtocolKey. This allow to replace previously hex encoded stm types to use the wrapped concrete types without changes to the (de)serialization of the parent types.

The implementation of the two fist types that we worked on, ProtocolSignerVerificationKey & ProtocolSingleSignature, is replaced with a simple type alias.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • No clippy warnings in the CI
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)

Limitation

We can't implement toProtocolKey From/To String (and &str) alongside the already defined From/To T where T is (de)serilizable by serde. This is because String and &str are (de)serilizable by serde so the compiler can't decide which implementation to use if we define both.

To circumvent that we implemented one 'genericly' (the conversion to from strings) and the other conversion is implemented manually for each types, the later operation is made trivial by defining a dedicated macro.

Issue(s)

Relates to #668

@Alenar Alenar requested review from ghubertpalo and jpraynaud July 28, 2023 07:50
@Alenar Alenar changed the title Common protocol key type for serilization of Stm types Common protocol key type for serialization of Stm types Jul 28, 2023
@github-actions
Copy link

github-actions bot commented Jul 28, 2023

Test Results

    3 files    16 suites   6m 0s ⏱️
639 tests 639 ✔️ 0 💤 0
677 runs  677 ✔️ 0 💤 0

Results for commit d465e56.

♻️ This comment has been updated with latest results.

@Alenar Alenar temporarily deployed to testing-preview July 28, 2023 07:58 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/668/common_protocol_key_type branch from 5ba030f to 08ff25f Compare July 28, 2023 08:09
@Alenar Alenar temporarily deployed to testing-preview July 28, 2023 08:16 — with GitHub Actions Inactive
Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Alenar Alenar force-pushed the djo/668/common_protocol_key_type branch from 08ff25f to d465e56 Compare July 28, 2023 08:39
@Alenar Alenar temporarily deployed to testing-preview July 28, 2023 08:49 — with GitHub Actions Inactive
@Alenar Alenar merged commit 44557d7 into main Jul 28, 2023
@Alenar Alenar deleted the djo/668/common_protocol_key_type branch July 28, 2023 08:51
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.

2 participants