fix(service): generate and seal keys only after the round is verified on-chain - #98
Merged
Merged
Conversation
… on-chain GenerateAndSealKey minted sealed key files before checking that the requested round exists, so requests carrying arbitrary round numbers created key files without bound. Fetch and verify the round's DKG network first; the key material and quote contents are unchanged.
0xHansLee
requested review from
barry-peng-story,
jdubpark,
lucas2brh,
stevemilk,
wo-o and
yingyangxu2026
as code owners
August 4, 2026 03:15
|
The change correctly re-orders operations so that Review iteration 1 · Commit 6bdb340 · 2026-08-04T03:16:04Z |
wo-o
approved these changes
Aug 4, 2026
wo-o
left a comment
Collaborator
There was a problem hiding this comment.
No issues found — see summary comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GenerateAndSealKeymints sealed key files before checking that the requested round exists, so requests carrying arbitrary round numbers create key files on disk without bound.Fix
Fetch the round's
DKGNetworkand runverifyDKGStartBlockbeforeLoadOrGenerate{Ed25519,Secp256k1}Key. Key material, report data, and quote contents are unchanged, and the load-or-generate path stays idempotent, so retried calls converge on the same sealed keys.Context
Best merged together with #97: alone on
main, the (unchanged) no-retry network read fails before key generation during a round-boundary light-client lag — functionally fine (the per-block session resume converges) but with avoidableMarkFailedchurn.Tests
No new tests — no behavior change for legitimate flows; existing
servicesuite passes.issue: none