fix(service): re-emit stored responses when ProcessDeals dedups retried deals#87
Conversation
…ed deals When a story->kernel ProcessDeals call times out, the kernel still processes the deals but the generated responses die with the disconnected call; the story-side retry then hit the idempotent-dedup branch, which returned nothing and lost the verifier's approvals network-wide. ProcessDeals now persists each generated response in a new OwnResponses field alongside its deal via a single atomic AddProcessedDeals write, and on re-submission re-emits the stored response for the matching dealer index. OwnResponses is kept separate from Responses so replay and rebuild paths are unaffected.
|
Verified the fix on a SGX devnet by injecting a ProcessDeals timeout (SIGSTOP the kernel mid-dealing past the story→kernel gRPC deadline); the round recovered black-box, so the re-emit logic works. Two things worth addressing: The If Also: the re-emit branch ( |
|
The core logic —
Review iteration 2 · Commit d4867bb · 2026-07-22T07:24:14Z |
Problem
When a story→kernel
ProcessDealscall times out, the kernel keeps processing and generates the verifier's responses, but they die with the disconnected call. The story-side retry then hits the idempotent-dedup branch, which returned nothing — so the verifier's approvals are lost network-wide.GenerateDealsis retry-safe (it regenerates from sealed coeffs);ProcessDealswas not.Fix
AddProcessedDealsinto a newEmittedResponsesfield, kept separate from peers'Responsesso replay/rebuild are unaffected). On a retried deal kyber already absorbed, re-emit the stored response instead of dropping it.ProcessDeals/ProcessResponses/ProcessJustification) per round with a shareddkgMutationMu: a client timeout leaves the abandoned handler running, and its retry (or an adjacent RPC) must not mutate the shared, unsynchronizedDistKeyGeneratorconcurrently. Held across process+persist so the retry re-emits deterministically.Tests
TestApplyDeals_ReemitsStoredResponsesOnResubmitTestApplyDeals_EmittedResponsesStoredSeparatelyTestApplyDeals_MissingEmittedResponsesSilentlySkipsTestProcessDeals_ConcurrentRoundSerialized(-race)issue: #84