From 382f835c14a1b58bac32b9ec1b15d939d1271421 Mon Sep 17 00:00:00 2001 From: lucky1024 <45564985+lucky1024@users.noreply.github.com> Date: Sun, 31 Dec 2023 11:03:52 +0800 Subject: [PATCH] Fix issue #114 (ChainKey is not saved at the end of Frost keygen) --- protocols/frost/keygen/keygen_test.go | 4 ++++ protocols/frost/keygen/round3.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/protocols/frost/keygen/keygen_test.go b/protocols/frost/keygen/keygen_test.go index 851a5db3..969fc131 100644 --- a/protocols/frost/keygen/keygen_test.go +++ b/protocols/frost/keygen/keygen_test.go @@ -45,6 +45,8 @@ func checkOutput(t *testing.T, rounds []round.Session, parties party.IDSlice) { actualPublicKey := privateKey.ActOnBase() + require.True(t, len(chainKey) > 0, "chainKey is empty") + require.True(t, publicKey.Equal(actualPublicKey)) shares := make(map[party.ID]curve.Scalar) @@ -128,6 +130,8 @@ func checkOutputTaproot(t *testing.T, rounds []round.Session, parties party.IDSl require.True(t, actualPublicKey.Equal(effectivePublic)) + require.True(t, len(chainKey) > 0, "chainKey is empty") + shares := make(map[party.ID]curve.Scalar) for _, result := range results { shares[result.ID] = result.PrivateShare diff --git a/protocols/frost/keygen/round3.go b/protocols/frost/keygen/round3.go index 80188269..6871a562 100644 --- a/protocols/frost/keygen/round3.go +++ b/protocols/frost/keygen/round3.go @@ -162,6 +162,7 @@ func (r *round3) Finalize(chan<- *round.Message) (round.Session, error) { Threshold: r.threshold, PrivateShare: r.privateShare.(*curve.Secp256k1Scalar), PublicKey: YSecp.XBytes()[:], + ChainKey: ChainKey, VerificationShares: secpVerificationShares, }), nil } @@ -171,6 +172,7 @@ func (r *round3) Finalize(chan<- *round.Message) (round.Session, error) { Threshold: r.threshold, PrivateShare: r.privateShare, PublicKey: r.publicKey, + ChainKey: ChainKey, VerificationShares: party.NewPointMap(r.verificationShares), }), nil }