fix(mpc): return error instead of panic when publicKey is nil in BroadcastPublicKey#159
Open
SAY-5 wants to merge 1 commit intofystack:masterfrom
Open
fix(mpc): return error instead of panic when publicKey is nil in BroadcastPublicKey#159SAY-5 wants to merge 1 commit intofystack:masterfrom
SAY-5 wants to merge 1 commit intofystack:masterfrom
Conversation
…dcastPublicKey registerReadyPairs spawns a goroutine that calls triggerECDHExchange -> BroadcastPublicKey. If the peer restarts between scheduling and the goroutine reading the local publicKey, e.publicKey is nil and crypto/ecdh.(*PublicKey).Bytes panics with 'invalid memory address or nil pointer dereference', killing the goroutine and forcing a container restart+rejoin cycle of ~10-15s per occurrence. Nil-check the receiver and e.publicKey at the top of BroadcastPublicKey and return a descriptive error so the caller's ECDH retrigger logic takes over instead of a panic propagating to stderr. Refs fystack/mpcium issue 158. Signed-off-by: SAY-5 <say.apm35@gmail.com>
|
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.



Fixes #158.
Problem
registerReadyPairsschedulestriggerECDHExchange→BroadcastPublicKeyfrom a goroutine. If the peer restarts between scheduling and reading the local publicKey,e.publicKeyis nil andcrypto/ecdh.(*PublicKey).Bytespanics:It self-heals via container restart + ECDH retrigger but each hit adds ~10-15s before the node rejoins quorum during rolling restarts, and the stderr panics pollute log shipping.
Fix
Nil-check the receiver and
e.publicKeyat the top ofBroadcastPublicKey. Return a descriptive error so the caller's retrigger path handles it cleanly instead of a panic propagating to stderr.Test
go build ./...andgo test ./pkg/mpc/...pass locally.