Skip to content

Commit

Permalink
chore: use rebased go-tss library (#2514)
Browse files Browse the repository at this point in the history
* chore: use rebased go-tss library

* fix lint
  • Loading branch information
gartnera authored Jul 19, 2024
1 parent 3ad6f99 commit 129c99b
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 37 deletions.
2 changes: 1 addition & 1 deletion cmd/zetaclientd/gen_pre_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 4 additions & 5 deletions cmd/zetaclientd/p2p_diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -28,7 +27,7 @@ import (

func RunDiagnostics(
startLogger zerolog.Logger,
peers p2p.AddrList,
peers []maddr.Multiaddr,
hotkeyPk cryptotypes.PrivKey,
cfg config.Config,
) error {
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}),
Expand Down
10 changes: 3 additions & 7 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
9 changes: 5 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion x/observer/client/cli/tx_vote_blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion x/observer/types/utils.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion x/observer/types/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/interfaces/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/testutils/mocks/zetacore_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions zetaclient/tss/tss_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/zetacore/client_vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/zetacore/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 129c99b

Please sign in to comment.