mpcium icon indicating copy to clipboard operation
mpcium copied to clipboard

Unused bool states of tss message

Open nann-cheng opened this issue 1 year ago • 3 comments

Going through the whole system, IsToOldCommittee() and IsToOldAndNewCommittees() are never used in the resharing process

Message interface {
		// Type is encoded in the protobuf Any structure
		Type() string
		// The set of parties that this message should be sent to
		GetTo() []*PartyID
		// The party that this message is from
		GetFrom() *PartyID
		// Indicates whether the message should be broadcast to other participants
		IsBroadcast() bool
		// Indicates whether the message is to the old committee during re-sharing; used mainly in tests
		IsToOldCommittee() bool
		// Indicates whether the message is to both committees during re-sharing; used mainly in tests
		IsToOldAndNewCommittees() bool
		// Returns the encoded inner message bytes to send over the wire along with metadata about how the message should be delivered
		WireBytes() ([]byte, *MessageRouting, error)
		// Returns the protobuf message wrapper struct
		// Only its inner content should be sent over the wire, not this struct itself
		WireMsg() *MessageWrapper
		String() string
	}

Could this be a problem?

nann-cheng avatar Aug 11 '25 13:08 nann-cheng

hi @vietddude , do you have an answer ? thanks

anhthii avatar Aug 11 '25 13:08 anhthii

It’s not really an issue for our setup. Those methods are mostly used in the upstream TSS code for tests or in cases where the routing layer doesn’t already know which committee to target. In our case, we figure out exactly who to send to based on the moniker in PartyID, so we already know if a node is in the old or new committee before sending. That’s why IsToOldCommittee() and IsToOldAndNewCommittees() never get called in our flow — the logic they’d handle is basically covered here:


// createPartyID creates a new party ID for the given node ID, label and version
// It returns the party ID: random string
// Moniker: for routing messages (label field)
// Key: for mpc internal use (need persistent storage)
func createPartyID(nodeID string, label string, version int) *tss.PartyID {
	partyID := uuid.NewString()
	var key *big.Int
	if version == BackwardCompatibleVersion {
		key = big.NewInt(0).SetBytes([]byte(nodeID))
	} else {
		key = big.NewInt(0).SetBytes([]byte(nodeID + ":" + strconv.Itoa(version)))
	}
	return tss.NewPartyID(partyID, label, key)
}

func (p *Node) Close() {
	err := p.peerRegistry.Resign()
	if err != nil {
		logger.Error("Resign failed", err)
	}
}

vietddude avatar Aug 11 '25 14:08 vietddude

Clear enough for me, thank you! I will close this issue.

nann-cheng avatar Aug 11 '25 14:08 nann-cheng