From ec0a9f9563d9f5e4888e8014f8a449f36a9706f3 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 18 Jul 2024 13:43:16 -0700 Subject: [PATCH 1/2] chore: use rebased go-tss library --- cmd/zetaclientd/gen_pre_params.go | 2 +- cmd/zetaclientd/keygen_tss.go | 6 +++--- cmd/zetaclientd/main.go | 2 +- cmd/zetaclientd/p2p_diagnostics.go | 4 ++-- cmd/zetaclientd/start.go | 8 ++++---- go.mod | 8 +++++--- go.sum | 9 +++++---- x/observer/client/cli/tx_vote_blame.go | 2 +- x/observer/types/utils.go | 2 +- x/observer/types/utils_test.go | 2 +- zetaclient/chains/interfaces/interfaces.go | 2 +- zetaclient/testutils/mocks/zetacore_client.go | 2 +- zetaclient/tss/tss_signer.go | 12 ++++++------ zetaclient/zetacore/client_vote.go | 2 +- zetaclient/zetacore/tx_test.go | 2 +- 15 files changed, 34 insertions(+), 31 deletions(-) diff --git a/cmd/zetaclientd/gen_pre_params.go b/cmd/zetaclientd/gen_pre_params.go index 7837867b74..4bf3e759f8 100644 --- a/cmd/zetaclientd/gen_pre_params.go +++ b/cmd/zetaclientd/gen_pre_params.go @@ -6,8 +6,8 @@ import ( "os" "time" - "github.com/binance-chain/tss-lib/ecdsa/keygen" "github.com/spf13/cobra" + "gitlab.com/thorchain/tss/tss-lib/ecdsa/keygen" ) func init() { diff --git a/cmd/zetaclientd/keygen_tss.go b/cmd/zetaclientd/keygen_tss.go index 8d677a2680..bf6be65e67 100644 --- a/cmd/zetaclientd/keygen_tss.go +++ b/cmd/zetaclientd/keygen_tss.go @@ -9,9 +9,9 @@ import ( "time" "github.com/rs/zerolog" - tsscommon "github.com/zeta-chain/go-tss/common" - "github.com/zeta-chain/go-tss/keygen" - "github.com/zeta-chain/go-tss/tss" + tsscommon "gitlab.com/thorchain/tss/go-tss/common" + "gitlab.com/thorchain/tss/go-tss/keygen" + "gitlab.com/thorchain/tss/go-tss/tss" "golang.org/x/crypto/sha3" "github.com/zeta-chain/zetacore/pkg/chains" diff --git a/cmd/zetaclientd/main.go b/cmd/zetaclientd/main.go index b0b8ffb0e1..128b92972e 100644 --- a/cmd/zetaclientd/main.go +++ b/cmd/zetaclientd/main.go @@ -5,10 +5,10 @@ import ( "os" "time" - ecdsakeygen "github.com/binance-chain/tss-lib/ecdsa/keygen" "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/cosmos-sdk/types" + ecdsakeygen "gitlab.com/thorchain/tss/tss-lib/ecdsa/keygen" "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd" diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go index 330f520013..8c8bb5582b 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -17,9 +17,9 @@ import ( "github.com/libp2p/go-libp2p/core/protocol" drouting "github.com/libp2p/go-libp2p/p2p/discovery/routing" dutil "github.com/libp2p/go-libp2p/p2p/discovery/util" + "github.com/multiformats/go-multiaddr" maddr "github.com/multiformats/go-multiaddr" "github.com/rs/zerolog" - "github.com/zeta-chain/go-tss/p2p" "github.com/zeta-chain/zetacore/pkg/cosmos" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -28,7 +28,7 @@ import ( func RunDiagnostics( startLogger zerolog.Logger, - peers p2p.AddrList, + peers []multiaddr.Multiaddr, hotkeyPk cryptotypes.PrivKey, cfg config.Config, ) error { diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index fef035aee5..ee912a7220 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -16,11 +16,11 @@ import ( "github.com/cometbft/cometbft/crypto/secp256k1" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/libp2p/go-libp2p/core" + "github.com/multiformats/go-multiaddr" maddr "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/spf13/cobra" - "github.com/zeta-chain/go-tss/p2p" "github.com/zeta-chain/zetacore/pkg/authz" "github.com/zeta-chain/zetacore/pkg/chains" @@ -361,14 +361,14 @@ func start(_ *cobra.Command, _ []string) error { return nil } -func initPeers(peer string) (p2p.AddrList, error) { - var peers p2p.AddrList +func initPeers(peer string) ([]multiaddr.Multiaddr, error) { + var peers []multiaddr.Multiaddr if peer != "" { address, err := maddr.NewMultiaddr(peer) if err != nil { log.Error().Err(err).Msg("NewMultiaddr error") - return p2p.AddrList{}, err + return []multiaddr.Multiaddr{}, err } peers = append(peers, address) } diff --git a/go.mod b/go.mod index c730cd2222..729ce23679 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + gitlab.com/thorchain/tss/go-tss v1.6.5 google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/grpc v1.60.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c @@ -39,7 +40,6 @@ require ( github.com/frumioj/crypto11 v1.2.5-0.20210823151709-946ce662cc0e github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 - github.com/zeta-chain/go-tss v0.1.1-0.20240711225655-6ab1e42a0dee github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2 github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240418181724-c222fd3ae1f5 google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 @@ -57,7 +57,6 @@ require ( require ( cosmossdk.io/simapp v0.0.0-20230608160436-666c345ad23d cosmossdk.io/tools/rosetta v0.2.1 - github.com/binance-chain/tss-lib v0.0.0-20201118045712-70b2cb4bf916 github.com/btcsuite/btcd/btcutil v1.1.3 github.com/cockroachdb/errors v1.10.0 github.com/cometbft/cometbft v0.37.4 @@ -66,6 +65,7 @@ require ( github.com/huandu/skiplist v1.2.0 github.com/nanmu42/etherscan-api v1.10.0 github.com/onrik/ethrpc v1.2.0 + gitlab.com/thorchain/tss/tss-lib v0.2.0 go.nhat.io/grpcmock v0.25.0 ) @@ -109,6 +109,7 @@ require ( github.com/sergi/go-diff v1.3.1 // indirect github.com/swaggest/assertjson v1.9.0 // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect + github.com/tendermint/btcd v0.1.1 // indirect github.com/thales-e-security/pool v0.0.2 // indirect github.com/tidwall/gjson v1.14.4 // indirect github.com/tidwall/match v1.1.1 // indirect @@ -334,7 +335,6 @@ require ( replace ( github.com/agl/ed25519 => github.com/binance-chain/edwards25519 v0.0.0-20200305024217-f36fc4b53d43 - github.com/binance-chain/tss-lib => gitlab.com/thorchain/tss/tss-lib v0.1.5 github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.3 github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 @@ -350,3 +350,5 @@ replace github.com/cometbft/cometbft-db => github.com/notional-labs/cometbft-db replace github.com/evmos/ethermint => github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 replace github.com/libp2p/go-libp2p => github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 + +replace gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20240718213003-31767e0c90ba diff --git a/go.sum b/go.sum index 7003b25c27..69fcad546e 100644 --- a/go.sum +++ b/go.sum @@ -1598,6 +1598,7 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= @@ -1705,8 +1706,8 @@ github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94 h1:M54ljayJvy github.com/zeta-chain/ethermint v0.0.0-20240531172701-61d040058c94/go.mod h1:s1zA6OpXv3Tb5I0M6M6j5fo/AssaZL/pgkc7G0W2kN8= github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 h1:FmO3HfVdZ7LzxBUfg6sVzV7ilKElQU2DZm8PxJ7KcYI= github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4/go.mod h1:TBv5NY/CqWYIfUstXO1fDWrt4bDoqgCw79yihqBspg8= -github.com/zeta-chain/go-tss v0.1.1-0.20240711225655-6ab1e42a0dee h1:6/Pjh9eTfdKebYDi4jn5n0UcmzVwLjJuF733AA3kRaQ= -github.com/zeta-chain/go-tss v0.1.1-0.20240711225655-6ab1e42a0dee/go.mod h1:yphhJIacmFEAUxAwyRI4HR2pPt6Gk0jl2m7PD+1OwTM= +github.com/zeta-chain/go-tss v0.0.0-20240718213003-31767e0c90ba h1:7Qcc2uQq2Tp1OSRMiJA7GRZr+PV6Le0a1TGw3q/8Vho= +github.com/zeta-chain/go-tss v0.0.0-20240718213003-31767e0c90ba/go.mod h1:LN1IBRN8xQkKgdgLhl5BDGZyPm70QOTbVLejdS2FVpo= github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2 h1:gd2uE0X+ZbdFJ8DubxNqLbOVlCB12EgWdzSNRAR82tM= github.com/zeta-chain/keystone/keys v0.0.0-20231105174229-903bc9405da2/go.mod h1:x7Bkwbzt2W2lQfjOirnff0Dj+tykdbTG1FMJPVPZsvE= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20240418181724-c222fd3ae1f5 h1:ljM7xka3WZvth9k1uYxrG3/FKQQTkR96FZlIjUKOoYw= @@ -1716,8 +1717,8 @@ github.com/zondax/hid v0.9.2 h1:WCJFnEDMiqGF64nlZz28E9qLVZ0KSJ7xpc5DLEyma2U= github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= -gitlab.com/thorchain/tss/tss-lib v0.1.5 h1:L9MD+E3B4lJmadso69lTIP6s2Iks24fS7Ancs62LTZo= -gitlab.com/thorchain/tss/tss-lib v0.1.5/go.mod h1:pEM3W/1inIzmdQn9IY9pA0MkG1bTGKhsSivxizeyyt4= +gitlab.com/thorchain/tss/tss-lib v0.2.0 h1:xMZdCe9b/nQ+KvTg3QOc8hzGyeLrd+agVQ4AXMGHfvY= +gitlab.com/thorchain/tss/tss-lib v0.2.0/go.mod h1:O9vom2mu4IGAx3+6G3+NJdYRTyWK9Q2zRe3YXhnGqVs= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= diff --git a/x/observer/client/cli/tx_vote_blame.go b/x/observer/client/cli/tx_vote_blame.go index 4dec44f845..7406359c10 100644 --- a/x/observer/client/cli/tx_vote_blame.go +++ b/x/observer/client/cli/tx_vote_blame.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/zeta-chain/go-tss/blame" + "gitlab.com/thorchain/tss/go-tss/blame" "github.com/zeta-chain/zetacore/x/observer/types" ) diff --git a/x/observer/types/utils.go b/x/observer/types/utils.go index c83fb11b67..009b419168 100644 --- a/x/observer/types/utils.go +++ b/x/observer/types/utils.go @@ -1,6 +1,6 @@ package types -import "github.com/zeta-chain/go-tss/blame" +import "gitlab.com/thorchain/tss/go-tss/blame" func ConvertNodes(n []blame.Node) (nodes []*Node) { for _, node := range n { diff --git a/x/observer/types/utils_test.go b/x/observer/types/utils_test.go index d68c3de792..26a9867d2e 100644 --- a/x/observer/types/utils_test.go +++ b/x/observer/types/utils_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/go-tss/blame" + "gitlab.com/thorchain/tss/go-tss/blame" "github.com/zeta-chain/zetacore/x/observer/types" ) diff --git a/zetaclient/chains/interfaces/interfaces.go b/zetaclient/chains/interfaces/interfaces.go index 5d6fa4f56f..e5d176767a 100644 --- a/zetaclient/chains/interfaces/interfaces.go +++ b/zetaclient/chains/interfaces/interfaces.go @@ -16,7 +16,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/onrik/ethrpc" "github.com/rs/zerolog" - "github.com/zeta-chain/go-tss/blame" + "gitlab.com/thorchain/tss/go-tss/blame" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" diff --git a/zetaclient/testutils/mocks/zetacore_client.go b/zetaclient/testutils/mocks/zetacore_client.go index 0dc6b8996d..f1e0b7fc3e 100644 --- a/zetaclient/testutils/mocks/zetacore_client.go +++ b/zetaclient/testutils/mocks/zetacore_client.go @@ -3,7 +3,7 @@ package mocks import ( - blame "github.com/zeta-chain/go-tss/blame" + blame "gitlab.com/thorchain/tss/go-tss/blame" chains "github.com/zeta-chain/zetacore/pkg/chains" context "context" diff --git a/zetaclient/tss/tss_signer.go b/zetaclient/tss/tss_signer.go index 7db6f27a8e..3219752173 100644 --- a/zetaclient/tss/tss_signer.go +++ b/zetaclient/tss/tss_signer.go @@ -14,19 +14,19 @@ import ( "strings" "time" - "github.com/binance-chain/tss-lib/ecdsa/keygen" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcutil" tmcrypto "github.com/cometbft/cometbft/crypto" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" gopeer "github.com/libp2p/go-libp2p/core/peer" + "github.com/multiformats/go-multiaddr" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - thorcommon "github.com/zeta-chain/go-tss/common" - "github.com/zeta-chain/go-tss/keysign" - "github.com/zeta-chain/go-tss/p2p" - "github.com/zeta-chain/go-tss/tss" + thorcommon "gitlab.com/thorchain/tss/go-tss/common" + "gitlab.com/thorchain/tss/go-tss/keysign" + "gitlab.com/thorchain/tss/go-tss/tss" + "gitlab.com/thorchain/tss/tss-lib/ecdsa/keygen" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/cosmos" @@ -148,7 +148,7 @@ func NewTSS( // SetupTSSServer creates a new TSS server // TODO(revamp): move to TSS server file func SetupTSSServer( - peer p2p.AddrList, + peer []multiaddr.Multiaddr, privkey tmcrypto.PrivKey, preParams *keygen.LocalPreParams, cfg config.Config, diff --git a/zetaclient/zetacore/client_vote.go b/zetaclient/zetacore/client_vote.go index b9c0e0432a..a8d406d177 100644 --- a/zetaclient/zetacore/client_vote.go +++ b/zetaclient/zetacore/client_vote.go @@ -4,7 +4,7 @@ import ( "context" "github.com/pkg/errors" - "github.com/zeta-chain/go-tss/blame" + "gitlab.com/thorchain/tss/go-tss/blame" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" diff --git a/zetaclient/zetacore/tx_test.go b/zetaclient/zetacore/tx_test.go index 0ad9c0edf7..66ee46c337 100644 --- a/zetaclient/zetacore/tx_test.go +++ b/zetaclient/zetacore/tx_test.go @@ -19,8 +19,8 @@ import ( "github.com/rs/zerolog" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/zeta-chain/go-tss/blame" zctx "github.com/zeta-chain/zetacore/zetaclient/context" + "gitlab.com/thorchain/tss/go-tss/blame" "go.nhat.io/grpcmock" "go.nhat.io/grpcmock/planner" From 0057453736db24e03725953524c05a53ee8c3cbe Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 18 Jul 2024 14:55:58 -0700 Subject: [PATCH 2/2] fix lint --- cmd/zetaclientd/p2p_diagnostics.go | 9 ++++----- cmd/zetaclientd/start.go | 10 +++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go index 8c8bb5582b..dc8a98621d 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -17,7 +17,6 @@ import ( "github.com/libp2p/go-libp2p/core/protocol" drouting "github.com/libp2p/go-libp2p/p2p/discovery/routing" dutil "github.com/libp2p/go-libp2p/p2p/discovery/util" - "github.com/multiformats/go-multiaddr" maddr "github.com/multiformats/go-multiaddr" "github.com/rs/zerolog" @@ -28,7 +27,7 @@ import ( func RunDiagnostics( startLogger zerolog.Logger, - peers []multiaddr.Multiaddr, + peers []maddr.Multiaddr, hotkeyPk cryptotypes.PrivKey, cfg config.Config, ) error { @@ -60,7 +59,7 @@ func RunDiagnostics( if len(IP) == 0 { startLogger.Warn().Msg("empty env MYIP") } - var externalAddr Multiaddr + var externalAddr maddr.Multiaddr if len(IP) != 0 { externalAddr, err = maddr.NewMultiaddr(fmt.Sprintf("/ip4/%s/tcp/%d", IP, 6668)) if err != nil { @@ -72,9 +71,9 @@ func RunDiagnostics( host, err := libp2p.New( libp2p.ListenAddrs(listenAddress), libp2p.Identity(p2pPriKey), - libp2p.AddrsFactory(func(addrs []Multiaddr) []Multiaddr { + libp2p.AddrsFactory(func(addrs []maddr.Multiaddr) []maddr.Multiaddr { if externalAddr != nil { - return []Multiaddr{externalAddr} + return []maddr.Multiaddr{externalAddr} } return addrs }), diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index ee912a7220..37251c04af 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -15,8 +15,6 @@ import ( "github.com/cometbft/cometbft/crypto/secp256k1" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/libp2p/go-libp2p/core" - "github.com/multiformats/go-multiaddr" maddr "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" "github.com/rs/zerolog/log" @@ -34,8 +32,6 @@ import ( mc "github.com/zeta-chain/zetacore/zetaclient/tss" ) -type Multiaddr = core.Multiaddr - var StartCmd = &cobra.Command{ Use: "start", Short: "Start ZetaClient Observer", @@ -361,14 +357,14 @@ func start(_ *cobra.Command, _ []string) error { return nil } -func initPeers(peer string) ([]multiaddr.Multiaddr, error) { - var peers []multiaddr.Multiaddr +func initPeers(peer string) ([]maddr.Multiaddr, error) { + var peers []maddr.Multiaddr if peer != "" { address, err := maddr.NewMultiaddr(peer) if err != nil { log.Error().Err(err).Msg("NewMultiaddr error") - return []multiaddr.Multiaddr{}, err + return []maddr.Multiaddr{}, err } peers = append(peers, address) }