Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
fix refresh 0*G not in curve
Browse files Browse the repository at this point in the history
  • Loading branch information
yong.huang committed Aug 28, 2023
1 parent 48a3350 commit 1685ec2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tss/key/reshare/update_round3.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (info *RefreshInfo) DKGStep3(msgs []*tss.Message) (*tss.KeyStep3Data, error
xi.Y = new(big.Int).Add(xi.Y, content.Share.Y)

ujPoint := verifiers[msg.From][0]
// filter 0*G
if ujPoint.X.Cmp(big.NewInt(0)) == 0 || ujPoint.Y.Cmp(big.NewInt(0)) == 0 {
continue
}
point, err := curves.NewECPoint(curve, ujPoint.X, ujPoint.Y)
if err != nil {
return nil, err
Expand All @@ -74,6 +78,9 @@ func (info *RefreshInfo) DKGStep3(msgs []*tss.Message) (*tss.KeyStep3Data, error
v[j] = curves.ScalarToPoint(curve, big.NewInt(0))

for _, verifier := range verifiers {
if !verifier[j].IsOnCurve() {
continue
}
v[j], err = v[j].Add(verifier[j])
if err != nil {
return nil, err
Expand Down
5 changes: 3 additions & 2 deletions tss/key/reshare/update_round_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package reshare
import (
"crypto/elliptic"
"fmt"
"github.com/decred/dcrd/dcrec/edwards/v2"
"github.com/decred/dcrd/dcrec/secp256k1/v2"
"github.com/okx/threshold-lib/tss"
"github.com/okx/threshold-lib/tss/key/dkg"
"testing"
)

func TestRefresh(t *testing.T) {
curve := edwards.Edwards()
// curve := edwards.Edwards()
curve := secp256k1.S256()
p1Data, p2Data, p3Data := KeyGen(curve)
// Reset private key share by 1, 3
devoteList := [2]int{1, 3}
Expand Down

0 comments on commit 1685ec2

Please sign in to comment.