From 129c99b933b75228518cd0585c9daa51f4952832 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 19 Jul 2024 09:23:32 -0700 Subject: [PATCH] chore: use rebased go-tss library (#2514) * chore: use rebased go-tss library * fix lint --- cmd/zetaclientd/gen_pre_params.go | 2 +- cmd/zetaclientd/keygen_tss.go | 6 +++--- cmd/zetaclientd/main.go | 2 +- cmd/zetaclientd/p2p_diagnostics.go | 9 ++++----- cmd/zetaclientd/start.go | 10 +++------- 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, 35 insertions(+), 37 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..dc8a98621d 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -19,7 +19,6 @@ import ( dutil "github.com/libp2p/go-libp2p/p2p/discovery/util" 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 +27,7 @@ import ( func RunDiagnostics( startLogger zerolog.Logger, - peers p2p.AddrList, + 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 fef035aee5..37251c04af 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -15,12 +15,10 @@ import ( "github.com/cometbft/cometbft/crypto/secp256k1" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/libp2p/go-libp2p/core" 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" @@ -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) (p2p.AddrList, error) { - var peers p2p.AddrList +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 p2p.AddrList{}, err + return []maddr.Multiaddr{}, err } peers = append(peers, address) } diff --git a/go.mod b/go.mod index 8bd9e6992e..8547f9a94b 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,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 @@ -67,6 +66,7 @@ require ( github.com/nanmu42/etherscan-api v1.10.0 github.com/near/borsh-go v0.3.1 github.com/onrik/ethrpc v1.2.0 + gitlab.com/thorchain/tss/tss-lib v0.2.0 go.nhat.io/grpcmock v0.25.0 ) @@ -120,6 +120,7 @@ require ( github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // 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 @@ -347,7 +348,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 @@ -363,3 +363,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 9cb5c7d214..cae8e37049 100644 --- a/go.sum +++ b/go.sum @@ -1623,6 +1623,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= @@ -1737,8 +1738,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= @@ -1748,8 +1749,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 6964aac3b4..f0da266759 100644 --- a/zetaclient/chains/interfaces/interfaces.go +++ b/zetaclient/chains/interfaces/interfaces.go @@ -18,7 +18,7 @@ import ( solrpc "github.com/gagliardetto/solana-go/rpc" "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"