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

Update kes #674

Merged
merged 7 commits into from Jan 4, 2023
Merged

Update kes #674

merged 7 commits into from Jan 4, 2023

Conversation

iquerejeta
Copy link
Contributor

@iquerejeta iquerejeta commented Jan 3, 2023

Content

This PR adapts the code to the new version of the KES library. Signatures and Public keys are compatible with older versions. However, secret keys are not. This should not be a backwards compatibility problem, as new nodes will still be compatible with older versions of the protocol and viceversa. However, secret keys serialised with the current library cannot be deserialised with an old version (or by the haskell node). The opposite, however, does work. New nodes will be able to deserialise previous file formats (or ones generated by the haskell node).

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • 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

@github-actions
Copy link

github-actions bot commented Jan 3, 2023

Test Results

    3 files  ±0    28 suites  ±0   5m 18s ⏱️ + 2m 44s
384 tests +3  384 ✔️ +3  0 💤 ±0  0 ±0 
445 runs  +3  445 ✔️ +3  0 💤 ±0  0 ±0 

Results for commit b592b22. ± Comparison against base commit a43b1b8.

This pull request removes 1 and adds 4 tests. Note that renamed tests count towards both.
multi_sig::tests ‑ serialize_deserialize_pk
crypto_helper::cardano::codec::test ‑ compat_with_shelly_format
multi_sig::tests ‑ batch_verify
multi_sig::tests ‑ serialize_deserialize_vk
stm::tests ‑ batch_verify

♻️ This comment has been updated with latest results.

@iquerejeta iquerejeta temporarily deployed to testing-preview January 3, 2023 11:31 — with GitHub Actions Inactive
@iquerejeta iquerejeta temporarily deployed to testing-preview January 4, 2023 09:19 — 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 👍

Comment on lines 128 to 142
if kes_sk_period <= provided_period {
// We need to perform the evolutions
for period in kes_sk_period..provided_period {
kes_sk
.update()
.map_err(|_| ProtocolInitializerErrorWrapper::KesUpdate(period))?;
}

Some(kes_sk.sign(&stm_initializer.verification_key().to_bytes()))
Some(kes_sk.sign(&stm_initializer.verification_key().to_bytes()))
} else {
return Err(ProtocolInitializerErrorWrapper::KesMismatch(
kes_sk_period,
provided_period,
));
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you could first check that the periods don't mismatch for readability:

if kes_sk_period > provided_period {
  return Err(ProtocolInitializerErrorWrapper::KesMismatch(
      kes_sk_period,
      provided_period,
  ));
}

// We need to perform the evolutions
for period in kes_sk_period..provided_period {
    kes_sk
        .update()
        .map_err(|_| ProtocolInitializerErrorWrapper::KesUpdate(period))?;
}

Some(kes_sk.sign(&stm_initializer.verification_key().to_bytes()))

@iquerejeta iquerejeta temporarily deployed to testing-preview January 4, 2023 10:14 — with GitHub Actions Inactive
@iquerejeta iquerejeta temporarily deployed to testing-preview January 4, 2023 13:29 — with GitHub Actions Inactive
@iquerejeta iquerejeta merged commit 697b10e into main Jan 4, 2023
@iquerejeta iquerejeta deleted the iquerejeta/update-kes branch January 4, 2023 13:40
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.

None yet

2 participants