Skip to content

Support resharing#45

Merged
anhthii merged 25 commits intomasterfrom
reshare
Jul 4, 2025
Merged

Support resharing#45
anhthii merged 25 commits intomasterfrom
reshare

Conversation

@vietddude
Copy link
Collaborator

  1. Resharing is available for both ECDSA (secp256k1) and EdDSA (ed25519) key types.
  2. Initiators can specify a custom set of peer IDs (available) to participate in the new committee.
  3. Backward compatibility

@anhthii
Copy link
Contributor

anhthii commented Jul 2, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@anhthii
Copy link
Contributor

anhthii commented Jul 3, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@socket-security
Copy link

socket-security bot commented Jul 3, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License

View full report

@anhthii
Copy link
Contributor

anhthii commented Jul 3, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@anhthii
Copy link
Contributor

anhthii commented Jul 3, 2025

Fix #25 with commit 0d99150

@anhthii
Copy link
Contributor

anhthii commented Jul 3, 2025

bugbot run

@anhthii
Copy link
Contributor

anhthii commented Jul 4, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@anhthii
Copy link
Contributor

anhthii commented Jul 4, 2025

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: JSON Unmarshaling Errors Mask Important Data

When JSON unmarshaling fails for GenerateKeyMessage or ResharingMessage, the uninitialized (zero-valued) fields of the msg struct are subsequently passed to their respective error handling functions. This results in incomplete and misleading error logs, as identifiers like WalletID, KeyType, or NewThreshold will be empty or zero.

pkg/eventconsumer/event_consumer.go#L482-L487

var msg types.ResharingMessage
if err := json.Unmarshal(natMsg.Data, &msg); err != nil {
logger.Error("Failed to unmarshal resharing message", err)
ec.handleReshareSessionError(msg.WalletID, msg.KeyType, msg.NewThreshold, err, "Failed to unmarshal resharing message")
return
}

pkg/eventconsumer/event_consumer.go#L124-L127

var msg types.GenerateKeyMessage
if err := json.Unmarshal(raw, &msg); err != nil {
logger.Error("Failed to unmarshal keygen message", err)
ec.handleKeygenSessionError(msg.WalletID, err, "Failed to unmarshal keygen message")

Fix in CursorFix in Web


Bug: Server Crashes on Unknown Session Type

The getVersion function calls logger.Fatal when an unknown session type is encountered, causing the server to crash. This violates PR guidelines against panicking in production and should be replaced with an error return.

pkg/mpc/node.go#L503-L505

mpcium/pkg/mpc/node.go

Lines 503 to 505 in e808958

default:
logger.Fatal("Unknown session type", errors.New("Unknown session type"))
}

Fix in CursorFix in Web


Bug: Reshare Session Fails for New Peers

The ensureNodeIsParticipant check in CreateReshareSession is incorrectly applied to new peers (isNewPeer=true) during resharing. New peers are not part of the old committee, but the check validates against oldKeyInfo.ParticipantPeerIDs, preventing them from participating.

pkg/mpc/node.go#L339-L343

mpcium/pkg/mpc/node.go

Lines 339 to 343 in e808958

if err := p.ensureNodeIsParticipant(oldKeyInfo); err != nil {
return nil, err
}

Fix in CursorFix in Web


Bug: Signing Event Handling Fails to Acknowledge Messages

When handleSigningEvent detects insufficient peers to process a signing request, it returns without acknowledging or negatively acknowledging the JetStream message. This leaves the message unacknowledged, potentially causing redelivery loops, timeouts, or queue blocking.

pkg/eventconsumer/sign_consumer.go#L133-L140

if readyPeers < requiredPeers {
logger.Warn("SigningConsumer: Not enough peers to process signing request, rejecting message",
"ready", readyPeers,
"required", requiredPeers)
return
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@anhthii anhthii changed the title Reshare Support resharing Jul 4, 2025
@anhthii anhthii merged commit 2f52434 into master Jul 4, 2025
4 checks passed
@anhthii anhthii deleted the reshare branch July 4, 2025 15:29
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

Comments