Skip to content

Cmp prot#26

Closed
jonathanMweiss wants to merge 7 commits intoschnorrfrom
cmp-prot
Closed

Cmp prot#26
jonathanMweiss wants to merge 7 commits intoschnorrfrom
cmp-prot

Conversation

@jonathanMweiss
Copy link
Copy Markdown

No description provided.

@jonathanMweiss jonathanMweiss self-assigned this Oct 30, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for CMP (ECDSA) protocol alongside the existing FROST protocol in the TSS (Threshold Signature Scheme) implementation. The changes enable the system to handle multiple cryptographic protocols for key generation and signing.

  • Adds CMP/ECDSA protocol support while maintaining backward compatibility with FROST
  • Updates serialization from encoding/gob to CBOR for improved cross-language compatibility
  • Extends round messages from 3 to 5 rounds to accommodate CMP protocol requirements
  • Updates test data with new guardian configurations and key material

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
node/pkg/tss/util.go Adds imports for CMP protocol types, extends signing rounds to 5, adds broadcast/unicast type checking for CMP messages
node/pkg/tss/parse.go Updates function names and error messages for broadcast type checking
node/pkg/tss/cnfgs.go Migrates from gob to CBOR encoding, adds ECDSA config storage and validation
node/pkg/tss/api.go Updates API to require protocol type parameter for public key/address queries
node/pkg/tss/implementation.go Adds ECDSA chain support, protocol selection logic, and updates engine initialization
node/pkg/tss/internal/cmd/dkg/server.go Adds protocol parameter to DKG, supports merging existing TSS secrets, implements FROST validation
node/pkg/tss/internal/cmd/scripts_test.go Updates test configuration to support protocol selection and loading existing secrets
node/pkg/tss/internal/cmd/lkg/local_key_generation.go Migrates from gob to CBOR for marshaling
node/pkg/tss/implementation_test.go Adds ECDSA signature test, updates all signing tasks with protocol type
node/go.mod, node/go.sum Updates dependencies for multi-party-sig, tss-lib, and fxamacker/cbor
node/pkg/internal/testutils/testdata/tss5/*.json Updates test guardian configurations with new keys and CBOR-encoded secrets
Comments suppressed due to low confidence (1)

node/pkg/tss/util.go:273

  • The intToRound function checks if i > 2 but the system now supports 5 rounds (round4Message and round5Message were added). This condition should be updated to i > 5 or use len(_intToRoundArr) to be more maintainable.
	if i < 0 || i > 2 {
		return ""
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

a.NoError(engine.Start(ctx))
}

fmt.Println("msgHandler settup:")
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'settup' to 'setup'.

Suggested change
fmt.Println("msgHandler settup:")
fmt.Println("msgHandler setup:")

Copilot uses AI. Check for mistakes.
Comment on lines +172 to +173
lg.Info("loading existing GuardianStorage from file", zap.String("file", *existingPath))
tmp, err := engine.NewGuardianStorageFromFile(*existingPath)
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

The log message uses *existingPath but the function parameter is prms.existingPath. The dereference operator is incorrect here since prms.existingPath is already a string. This should be zap.String(\"file\", prms.existingPath).

Suggested change
lg.Info("loading existing GuardianStorage from file", zap.String("file", *existingPath))
tmp, err := engine.NewGuardianStorageFromFile(*existingPath)
lg.Info("loading existing GuardianStorage from file", zap.String("file", prms.existingPath))
tmp, err := engine.NewGuardianStorageFromFile(prms.existingPath)

Copilot uses AI. Check for mistakes.
Base automatically changed from flag-remove to schnorr November 2, 2025 05:37
@@ -340,7 +342,7 @@ func (p *Processor) handleInboundSignedVAAWithQuorum(m *gossipv1.SignedVAAWithQu

var verificationPublic vaa.PublicKeys = keys
if v.Version == vaa.TSSVaaVersion {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Probably better to rename this constant now to FrostVaaVersion

return nil, fmt.Errorf("failed to parse default port: %w", err)
}

port = p
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: can assign directly port, err = strconv.Atoi(tss.DefaultPort)

// attemptMergingTssSecretsToOld tries to load existing TSSSecrets from an old GuardianStorage file
// and merge them into the new TSSSecrets generated by the DKG process.
// This is useful to preserve existing keys for other protocols when only one protocol's keys are being generated.
func attemptMergingTssSecretsToOld(lg *zap.Logger, prms runParams, tssConfigs *party.TSSSecrets) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this function could fail to merge, it should return some error to the caller

Comment thread node/pkg/tss/util.go

func isBroadcastMsg(m common.ParsedMessage) bool {
// ensures content of a known broadcast type.
func isKnownBroadcastType(m common.ParsedMessage) bool {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: I think this func can be more simply isBroadcast, no?

Comment thread node/pkg/tss/util.go
}
}

func isKnownUnicastType(m common.ParsedMessage) bool {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same here

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.

3 participants