Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #270

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions crypto/ckd/child_key_derivation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

"github.com/bnb-chain/tss-lib/v2/common"
"github.com/bnb-chain/tss-lib/v2/crypto"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btcutil/base58"
"golang.org/x/crypto/ripemd160"
)
Expand Down Expand Up @@ -106,13 +106,15 @@ func NewExtendedKeyFromString(key string, curve elliptic.Curve) (*ExtendedKey, e
var pubKey ecdsa.PublicKey

if c, ok := curve.(*btcec.KoblitzCurve); ok {
// Ensure the public key parses correctly and is actually on the
// secp256k1 curve.
pk, err := btcec.ParsePubKey(keyData, c)
pk, err := btcec.ParsePubKey(keyData)
if err != nil {
return nil, err
}
pubKey = ecdsa.PublicKey(*pk)
pubKey = ecdsa.PublicKey{
Curve: c,
X: pk.X(),
Y: pk.Y(),
}
} else {
px, py := elliptic.Unmarshal(curve, keyData)
pubKey = ecdsa.PublicKey{
Expand Down
2 changes: 1 addition & 1 deletion crypto/ckd/child_key_derivation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

. "github.com/bnb-chain/tss-lib/v2/crypto/ckd"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
)

func TestPublicDerivation(t *testing.T) {
Expand Down
7 changes: 4 additions & 3 deletions crypto/ecpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"reflect"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/decred/dcrd/dcrec/edwards/v2"
"github.com/stretchr/testify/assert"

Expand Down Expand Up @@ -126,10 +126,11 @@ func TestS256EcpointJsonSerialization(t *testing.T) {

pubKeyBytes, err := hex.DecodeString("03935336acb03b2b801d8f8ac5e92c56c4f6e93319901fdfffba9d340a874e2879")
assert.NoError(t, err)
pbk, err := btcec.ParsePubKey(pubKeyBytes, btcec.S256())
// pbk, err := btcec.ParsePubKey(pubKeyBytes, btcec.S256())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dead code

pbk, err := btcec.ParsePubKey(pubKeyBytes)
assert.NoError(t, err)

point, err := NewECPoint(ec, pbk.X, pbk.Y)
point, err := NewECPoint(ec, pbk.X(), pbk.Y())
assert.NoError(t, err)
bz, err := json.Marshal(point)
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions ecdsa/keygen/local_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type (

// outbound messaging
out chan<- tss.Message
end chan<- LocalPartySaveData
end chan<- *LocalPartySaveData
}

localMessageStore struct {
Expand Down Expand Up @@ -60,7 +60,7 @@ type (
func NewLocalParty(
params *tss.Parameters,
out chan<- tss.Message,
end chan<- LocalPartySaveData,
end chan<- *LocalPartySaveData,
optionalPreParams ...LocalPreParams,
) tss.Party {
partyCount := params.PartyCount()
Expand Down
4 changes: 2 additions & 2 deletions ecdsa/keygen/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestE2EConcurrentAndSaveFixtures(t *testing.T) {

errCh := make(chan *tss.Error, len(pIDs))
outCh := make(chan tss.Message, len(pIDs))
endCh := make(chan LocalPartySaveData, len(pIDs))
endCh := make(chan *LocalPartySaveData, len(pIDs))

updater := test.SharedPartyUpdater

Expand Down Expand Up @@ -243,7 +243,7 @@ keygen:
// .. here comes a workaround to recover this party's index (it was removed from save data)
index, err := save.OriginalIndex()
assert.NoErrorf(t, err, "should not be an error getting a party's index from save data")
tryWriteTestFixtureFile(t, index, save)
tryWriteTestFixtureFile(t, index, *save)

atomic.AddInt32(&ended, 1)
if atomic.LoadInt32(&ended) == int32(len(pIDs)) {
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/keygen/round_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
)

// round 1 represents round 1 of the keygen part of the GG18 ECDSA TSS spec (Gennaro, Goldfeder; 2018)
func newRound1(params *tss.Parameters, save *LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- LocalPartySaveData) tss.Round {
func newRound1(params *tss.Parameters, save *LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- *LocalPartySaveData) tss.Round {
return &round1{
&base{params, save, temp, out, end, make([]bool, len(params.Parties().IDs())), false, 1}}
}
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/keygen/round_4.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (round *round4) Start() *tss.Error {
return round.WrapError(errors.New("paillier verify failed"), culprits...)
}

round.end <- *round.save
round.end <- round.save

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/keygen/rounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type (
save *LocalPartySaveData
temp *localTempData
out chan<- tss.Message
end chan<- LocalPartySaveData
end chan<- *LocalPartySaveData
ok []bool // `ok` tracks parties which have been verified by Update()
started bool
number int
Expand Down
4 changes: 2 additions & 2 deletions ecdsa/resharing/local_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type (

// outbound messaging
out chan<- tss.Message
end chan<- keygen.LocalPartySaveData
end chan<- *keygen.LocalPartySaveData
}

localMessageStore struct {
Expand Down Expand Up @@ -72,7 +72,7 @@ func NewLocalParty(
params *tss.ReSharingParameters,
key keygen.LocalPartySaveData,
out chan<- tss.Message,
end chan<- keygen.LocalPartySaveData,
end chan<- *keygen.LocalPartySaveData,
) tss.Party {
oldPartyCount := len(params.OldParties().IDs())
subset := key
Expand Down
4 changes: 2 additions & 2 deletions ecdsa/resharing/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestE2EConcurrent(t *testing.T) {

errCh := make(chan *tss.Error, bothCommitteesPax)
outCh := make(chan tss.Message, bothCommitteesPax)
endCh := make(chan keygen.LocalPartySaveData, bothCommitteesPax)
endCh := make(chan *keygen.LocalPartySaveData, bothCommitteesPax)

updater := test.SharedPartyUpdater

Expand Down Expand Up @@ -140,7 +140,7 @@ func TestE2EConcurrent(t *testing.T) {
if save.Xi != nil {
index, err := save.OriginalIndex()
assert.NoErrorf(t, err, "should not be an error getting a party's index from save data")
newKeys[index] = save
newKeys[index] = *save
} else {
endedOldCommittee++
}
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/resharing/round_1_old_step_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// round 1 represents round 1 of the keygen part of the GG18 ECDSA TSS spec (Gennaro, Goldfeder; 2018)
func newRound1(params *tss.ReSharingParameters, input, save *keygen.LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- keygen.LocalPartySaveData) tss.Round {
func newRound1(params *tss.ReSharingParameters, input, save *keygen.LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- *keygen.LocalPartySaveData) tss.Round {
return &round1{
&base{params, temp, input, save, out, end, make([]bool, len(params.OldParties().IDs())), make([]bool, len(params.NewParties().IDs())), false, 1}}
}
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/resharing/round_5_new_step_3.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (round *round5) Start() *tss.Error {
round.input.Xi.SetInt64(0)
}

round.end <- *round.save
round.end <- round.save
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion ecdsa/resharing/rounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type (
temp *localTempData
input, save *keygen.LocalPartySaveData
out chan<- tss.Message
end chan<- keygen.LocalPartySaveData
end chan<- *keygen.LocalPartySaveData
oldOK, // old committee "ok" tracker
newOK []bool // `ok` tracks parties which have been verified by Update(); this one is for the new committee
started bool
Expand Down
2 changes: 1 addition & 1 deletion ecdsa/signing/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"sync/atomic"
"testing"

"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/btcec/v2"
"github.com/ipfs/go-log"
"github.com/stretchr/testify/assert"

Expand Down
4 changes: 2 additions & 2 deletions eddsa/keygen/local_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type (

// outbound messaging
out chan<- tss.Message
end chan<- LocalPartySaveData
end chan<- *LocalPartySaveData
}

localMessageStore struct {
Expand Down Expand Up @@ -61,7 +61,7 @@ type (
func NewLocalParty(
params *tss.Parameters,
out chan<- tss.Message,
end chan<- LocalPartySaveData,
end chan<- *LocalPartySaveData,
) tss.Party {
partyCount := params.PartyCount()
data := NewLocalPartySaveData(partyCount)
Expand Down
4 changes: 2 additions & 2 deletions eddsa/keygen/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestE2EConcurrentAndSaveFixtures(t *testing.T) {

errCh := make(chan *tss.Error, len(pIDs))
outCh := make(chan tss.Message, len(pIDs))
endCh := make(chan LocalPartySaveData, len(pIDs))
endCh := make(chan *LocalPartySaveData, len(pIDs))

updater := test.SharedPartyUpdater

Expand Down Expand Up @@ -108,7 +108,7 @@ keygen:
// .. here comes a workaround to recover this party's index (it was removed from save data)
index, err := save.OriginalIndex()
assert.NoErrorf(t, err, "should not be an error getting a party's index from save data")
tryWriteTestFixtureFile(t, index, save)
tryWriteTestFixtureFile(t, index, *save)

atomic.AddInt32(&ended, 1)
if atomic.LoadInt32(&ended) == int32(len(pIDs)) {
Expand Down
2 changes: 1 addition & 1 deletion eddsa/keygen/round_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
)

// round 1 represents round 1 of the keygen part of the EDDSA TSS spec
func newRound1(params *tss.Parameters, save *LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- LocalPartySaveData) tss.Round {
func newRound1(params *tss.Parameters, save *LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- *LocalPartySaveData) tss.Round {
return &round1{
&base{params, save, temp, out, end, make([]bool, len(params.Parties().IDs())), false, 1}}
}
Expand Down
2 changes: 1 addition & 1 deletion eddsa/keygen/round_3.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (round *round3) Start() *tss.Error {
// PRINT public key & private share
common.Logger.Debugf("%s public key: %x", round.PartyID(), eddsaPubKey)

round.end <- *round.save
round.end <- round.save
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion eddsa/keygen/rounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type (
save *LocalPartySaveData
temp *localTempData
out chan<- tss.Message
end chan<- LocalPartySaveData
end chan<- *LocalPartySaveData
ok []bool // `ok` tracks parties which have been verified by Update()
started bool
number int
Expand Down
4 changes: 2 additions & 2 deletions eddsa/resharing/local_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type (

// outbound messaging
out chan<- tss.Message
end chan<- keygen.LocalPartySaveData
end chan<- *keygen.LocalPartySaveData
}

localMessageStore struct {
Expand Down Expand Up @@ -67,7 +67,7 @@ func NewLocalParty(
params *tss.ReSharingParameters,
key keygen.LocalPartySaveData,
out chan<- tss.Message,
end chan<- keygen.LocalPartySaveData,
end chan<- *keygen.LocalPartySaveData,
) tss.Party {
oldPartyCount := len(params.OldParties().IDs())
subset := key
Expand Down
4 changes: 2 additions & 2 deletions eddsa/resharing/local_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestE2EConcurrent(t *testing.T) {

errCh := make(chan *tss.Error, bothCommitteesPax)
outCh := make(chan tss.Message, bothCommitteesPax)
endCh := make(chan keygen.LocalPartySaveData, bothCommitteesPax)
endCh := make(chan *keygen.LocalPartySaveData, bothCommitteesPax)

updater := test.SharedPartyUpdater

Expand Down Expand Up @@ -129,7 +129,7 @@ func TestE2EConcurrent(t *testing.T) {
if save.Xi != nil {
index, err := save.OriginalIndex()
assert.NoErrorf(t, err, "should not be an error getting a party's index from save data")
newKeys[index] = save
newKeys[index] = *save
} else {
endedOldCommittee++
}
Expand Down
2 changes: 1 addition & 1 deletion eddsa/resharing/round_1_old_step_1.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

// round 1 represents round 1 of the keygen part of the EDDSA TSS spec
func newRound1(params *tss.ReSharingParameters, input, save *keygen.LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- keygen.LocalPartySaveData) tss.Round {
func newRound1(params *tss.ReSharingParameters, input, save *keygen.LocalPartySaveData, temp *localTempData, out chan<- tss.Message, end chan<- *keygen.LocalPartySaveData) tss.Round {
return &round1{
&base{params, temp, input, save, out, end, make([]bool, len(params.OldParties().IDs())), make([]bool, len(params.NewParties().IDs())), false, 1}}
}
Expand Down
2 changes: 1 addition & 1 deletion eddsa/resharing/round_5_new_step_3.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (round *round5) Start() *tss.Error {
round.input.Xi.SetInt64(0)
}

round.end <- *round.save
round.end <- round.save
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion eddsa/resharing/rounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type (
temp *localTempData
input, save *keygen.LocalPartySaveData
out chan<- tss.Message
end chan<- keygen.LocalPartySaveData
end chan<- *keygen.LocalPartySaveData
oldOK, // old committee "ok" tracker
newOK []bool // `ok` tracks parties which have been verified by Update(); this one is for the new committee
started bool
Expand Down
28 changes: 12 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ module github.com/bnb-chain/tss-lib/v2
go 1.16

require (
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.0
github.com/hashicorp/go-multierror v1.0.0
github.com/ipfs/go-log v0.0.1
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/otiai10/mint v1.2.4 // indirect
github.com/otiai10/primes v0.0.0-20180210170552-f6d2a1ba97c4
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.3.0
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect
google.golang.org/protobuf v1.27.1
github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12
github.com/btcsuite/btcd v0.23.4
github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/btcsuite/btcutil v1.0.2
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3
github.com/hashicorp/go-multierror v1.1.1
github.com/ipfs/go-log v1.0.5
github.com/otiai10/primes v0.0.0-20210501021515-f1b2be525a11
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.13.0
google.golang.org/protobuf v1.31.0
)

replace github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43
Loading