Skip to content

Protocol key for Multi and Genesis signature #1124

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 9 commits into from
Aug 1, 2023

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Aug 1, 2023

Content

This PR replace most use of hex encoded keys for multi & genesis signatures with a ProtocolKey on the concrete crypto type.

In order to do so the Certificate entity had to be adapted since it had two mutually excluding string fields (the exclusion was done manually without compiler help), one for the genesis the other for multi-signatures.
This was done by adding a new type, CertificateSignature an enum with a variant for both cases.

Since the genesis signature doesn't use the "json hex" encoding for serialization, contrary to all the previous types converted to a ProtocolKey, the ProtocolKey add to be modified to allow to change the inner encoding that it use.
This was done with a new trait, ProtocolKeyCodec, that define how a ProtocolKey is encoded or decoded to strings or to using serde.

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

Comments

The hash changes were done before making the genesis & multi signatures into a protocol key (meaning that they did not changes afterward, ensuring backward compatibility), the changes were necessary because of the change to the Certificate structure.

Issue(s)

Relates to #668

@Alenar Alenar requested a review from jpraynaud August 1, 2023 14:26
@Alenar Alenar force-pushed the djo/668/protocol_key_for_multi_and_genesis_signature branch 2 times, most recently from e6fe01c to 724ab94 Compare August 1, 2023 14:37
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

Test Results

    3 files  ±0    16 suites  ±0   5m 29s ⏱️ - 1m 49s
646 tests +3  646 ✔️ +3  0 💤 ±0  0 ±0 
684 runs  +3  684 ✔️ +3  0 💤 ±0  0 ±0 

Results for commit a0a17c5. ± Comparison against base commit 616e2f9.

♻️ This comment has been updated with latest results.

@Alenar Alenar temporarily deployed to testing-preview August 1, 2023 15:02 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/668/protocol_key_for_multi_and_genesis_signature branch from 724ab94 to 463f798 Compare August 1, 2023 15:06
@jpraynaud
Copy link
Member

I have a question regarding the Certificate hash computation that changed:
do we need to recompute hashes when merging this PR?

@Alenar
Copy link
Collaborator Author

Alenar commented Aug 1, 2023

I have a question regarding the Certificate hash computation that changed: do we need to recompute hashes when merging this PR?

No, as I said in the PR we are backward compatible, I made the changes to the hashes before migrating to ProtocolKeys (changes because of the updated Certificate structure). By the way the golden test for the certificate record was not impacted :).

@Alenar Alenar temporarily deployed to testing-preview August 1, 2023 15:15 — with GitHub Actions Inactive
Alenar added 7 commits August 1, 2023 17:23
- In order to split them between "classic" and genesis certificate since
the upcoming design won't allow to represent certificates that are both.
- Add 'fake keys' for multi signatures & genesis signatures & use them
were needed.
A blanket implementation is available using the json hex format.
@Alenar Alenar force-pushed the djo/668/protocol_key_for_multi_and_genesis_signature branch from 463f798 to fe7d24b Compare August 1, 2023 15:23
@Alenar Alenar temporarily deployed to testing-preview August 1, 2023 15:33 — 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 temporarily deployed to testing-preview August 1, 2023 16:33 — with GitHub Actions Inactive
@Alenar Alenar merged commit 894501d into main Aug 1, 2023
@Alenar Alenar deleted the djo/668/protocol_key_for_multi_and_genesis_signature branch August 1, 2023 16:38
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