From 6a279c8e80be002ed7750a88458d1d5d9ed3958e Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 25 Nov 2024 10:25:19 -0800 Subject: [PATCH] chore: revert go-tss to v21/v22 version --- cmd/zetaclientd/start.go | 53 +++++++----------------------------- go.mod | 2 +- go.sum | 4 +-- zetaclient/tss/tss_signer.go | 3 +- 4 files changed, 14 insertions(+), 48 deletions(-) diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 0ac52f0690..6d71d8b05e 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -11,19 +11,18 @@ import ( "os/signal" "path/filepath" "strings" - "sync" "syscall" "time" ecdsakeygen "github.com/bnb-chain/tss-lib/ecdsa/keygen" "github.com/cometbft/cometbft/crypto/secp256k1" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-libp2p/p2p/protocol/ping" maddr "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" "github.com/rs/zerolog/log" + "github.com/samber/lo" "github.com/spf13/cobra" - "gitlab.com/thorchain/tss/go-tss/conversion" + "gitlab.com/thorchain/tss/go-tss/tss" "github.com/zeta-chain/node/pkg/authz" "github.com/zeta-chain/node/pkg/chains" @@ -192,14 +191,6 @@ func Start(_ *cobra.Command, _ []string) error { telemetryServer.SetIPAddress(cfg.PublicIP) keygen := appContext.GetKeygen() - whitelistedPeers := []peer.ID{} - for _, pk := range keygen.GranteePubkeys { - pid, err := conversion.Bech32PubkeyToPeerID(pk) - if err != nil { - return err - } - whitelistedPeers = append(whitelistedPeers, pid) - } // Create TSS server tssServer, err := mc.SetupTSSServer( @@ -209,7 +200,6 @@ func Start(_ *cobra.Command, _ []string) error { appContext.Config(), tssKeyPass, true, - whitelistedPeers, ) if err != nil { return fmt.Errorf("SetupTSSServer error: %w", err) @@ -225,37 +215,14 @@ func Start(_ *cobra.Command, _ []string) error { go func() { for { time.Sleep(30 * time.Second) - ps := tssServer.GetKnownPeers() - metrics.NumConnectedPeers.Set(float64(len(ps))) - telemetryServer.SetConnectedPeers(ps) - } - }() - go func() { - host := tssServer.GetP2PHost() - pingRTT := make(map[peer.ID]int64) - pingRTTLock := sync.Mutex{} - for { - var wg sync.WaitGroup - for _, p := range whitelistedPeers { - wg.Add(1) - go func(p peer.ID) { - defer wg.Done() - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - defer cancel() - result := <-ping.Ping(ctx, host, p) - pingRTTLock.Lock() - defer pingRTTLock.Unlock() - if result.Error != nil { - masterLogger.Error().Err(result.Error).Msg("ping error") - pingRTT[p] = -1 // RTT -1 indicate ping error - return - } - pingRTT[p] = result.RTT.Nanoseconds() - }(p) - } - wg.Wait() - telemetryServer.SetPingRTT(pingRTT) - time.Sleep(30 * time.Second) + knownPeersTss := tssServer.GetKnownPeers() + metrics.NumConnectedPeers.Set(float64(len(knownPeersTss))) + knownPeersAddrInfo := lo.Map(knownPeersTss, func(p tss.PeerInfo, _ int) peer.AddrInfo { + return peer.AddrInfo{ + ID: peer.ID(p.ID), + } + }) + telemetryServer.SetConnectedPeers(knownPeersAddrInfo) } }() // pprof http server diff --git a/go.mod b/go.mod index 34a5ace653..79755063be 100644 --- a/go.mod +++ b/go.mod @@ -371,5 +371,5 @@ replace ( github.com/bnb-chain/tss-lib => github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901 github.com/ethereum/go-ethereum => github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc github.com/libp2p/go-libp2p => github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 - gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20241115165301-8535262eb16f + gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20241028192852-b5233fc8c2b3 ) diff --git a/go.sum b/go.sum index f55f4033cf..72767c59d3 100644 --- a/go.sum +++ b/go.sum @@ -1527,8 +1527,8 @@ github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc h1:FVOt github.com/zeta-chain/go-ethereum v1.13.16-0.20241022183758-422c6ef93ccc/go.mod h1:MgO2/CmxFnj6W7v/5hrz3ypco3kHkb8856pRnFkY4xQ= 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.0.0-20241115165301-8535262eb16f h1:zKBTanf2jf/oyr3f27GgvibSdVThmCdcV9sc5/6uOyQ= -github.com/zeta-chain/go-tss v0.0.0-20241115165301-8535262eb16f/go.mod h1:nqelgf4HKkqlXaVg8X38a61WfyYB+ivCt6nnjoTIgCc= +github.com/zeta-chain/go-tss v0.0.0-20241028192852-b5233fc8c2b3 h1:IecdEwyguY3dtI7xRT+yW6ml/Z9cfIVHiB4q6huBhc4= +github.com/zeta-chain/go-tss v0.0.0-20241028192852-b5233fc8c2b3/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241021075719-d40d2e28467c h1:ZoFxMMZtivRLquXVq1sEVlT45UnTPMO1MSXtc88nDv4= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241021075719-d40d2e28467c/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20241108171442-e48d82f94892 h1:oI5qCrw2SXDf2a2UYAn0tpaKHbKpJcR+XDtceyY00wE= diff --git a/zetaclient/tss/tss_signer.go b/zetaclient/tss/tss_signer.go index bb887d9380..a2366ba12c 100644 --- a/zetaclient/tss/tss_signer.go +++ b/zetaclient/tss/tss_signer.go @@ -150,7 +150,6 @@ func SetupTSSServer( cfg config.Config, tssPassword string, enableMonitor bool, - whitelistedPeers []gopeer.ID, ) (*tss.TssServer, error) { bootstrapPeers := peer log.Info().Msgf("Peers AddrList %v", bootstrapPeers) @@ -176,6 +175,7 @@ func SetupTSSServer( bootstrapPeers, 6668, privkey, + "MetaMetaOpenTheDoor", tsspath, thorcommon.TssConfig{ EnableMonitor: enableMonitor, @@ -187,7 +187,6 @@ func SetupTSSServer( preParams, // use pre-generated pre-params if non-nil IP, // for docker test tssPassword, - whitelistedPeers, ) if err != nil { log.Error().Err(err).Msg("NewTSS error")