diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index f00abdcde1..2d021fd30d 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -13,10 +13,13 @@ import ( "time" "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/davecgh/go-spew/spew" + "github.com/libp2p/go-libp2p/core/peer" maddr "github.com/multiformats/go-multiaddr" "github.com/pkg/errors" "github.com/rs/zerolog/log" "github.com/spf13/cobra" + "gitlab.com/thorchain/tss/go-tss/conversion" "github.com/zeta-chain/node/pkg/authz" "github.com/zeta-chain/node/pkg/chains" @@ -205,7 +208,16 @@ func start(_ *cobra.Command, _ []string) error { telemetryServer.SetIPAddress(cfg.PublicIP) // Create TSS server - server, err := mc.SetupTSSServer(peers, priKey, preParams, appContext.Config(), tssKeyPass, true) + 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) + } + server, err := mc.SetupTSSServer(peers, priKey, preParams, appContext.Config(), tssKeyPass, true, whitelistedPeers) if err != nil { return fmt.Errorf("SetupTSSServer error: %w", err) } @@ -221,6 +233,17 @@ func start(_ *cobra.Command, _ []string) error { masterLogger.Info().Msg("TSS listener received an action to shutdown zetaclientd.") signalChannel <- syscall.SIGTERM }) + // debug: printout connected peers + go func() { + for { + time.Sleep(10 * time.Second) + peers := server.GetKnownPeers() + for _, p := range peers { + log.Info().Msgf("Connected peer(%d)", len(peers)) + spew.Dump(p) + } + } + }() // Generate a new TSS if keygen is set and add it into the tss server // If TSS has already been generated, and keygen was successful ; we use the existing TSS diff --git a/go.mod b/go.mod index 67112a1ead..6be7ebac55 100644 --- a/go.mod +++ b/go.mod @@ -368,5 +368,6 @@ 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.10.26-spc 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-20241023185909-85fd6808d9fb + gitlab.com/thorchain/tss/go-tss => github.com/zeta-chain/go-tss v0.0.0-20241025022814-d69c70db51bc +//gitlab.com/thorchain/tss/go-tss => ../go-tss ) diff --git a/go.sum b/go.sum index 1340fc6ce8..24690b5528 100644 --- a/go.sum +++ b/go.sum @@ -4206,8 +4206,8 @@ github.com/zeta-chain/go-ethereum v1.10.26-spc h1:NvY4rR9yw52wfxWt7YoFsWbaIwVMyO github.com/zeta-chain/go-ethereum v1.10.26-spc/go.mod h1:/6CsT5Ceen2WPLI/oCA3xMcZ5sWMF/D46SjM/ayY0Oo= 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-20241023185909-85fd6808d9fb h1:mO/e5wIB79UTAEU7WPtTy76vljmnIC1/pgqy+0HSPC8= -github.com/zeta-chain/go-tss v0.0.0-20241023185909-85fd6808d9fb/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc= +github.com/zeta-chain/go-tss v0.0.0-20241025022814-d69c70db51bc h1:8X5jIUKr/5Qkd8aGiacMJ0oB819xFLDEaLRLxfsMUmo= +github.com/zeta-chain/go-tss v0.0.0-20241025022814-d69c70db51bc/go.mod h1:B1FDE6kHs8hozKSX1/iXgCdvlFbS6+FeAupoBHDK0Cc= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 h1:vck/FcIIpFOvpBUm0NO17jbEtmSz/W/a5Y4jRuSJl6I= github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138/go.mod h1:U494OsZTWsU75hqoriZgMdSsgSGP1mUL1jX+wN/Aez8= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241021075719-d40d2e28467c h1:ZoFxMMZtivRLquXVq1sEVlT45UnTPMO1MSXtc88nDv4= diff --git a/zetaclient/tss/tss_signer.go b/zetaclient/tss/tss_signer.go index 0c7daa98e7..594784797c 100644 --- a/zetaclient/tss/tss_signer.go +++ b/zetaclient/tss/tss_signer.go @@ -148,6 +148,7 @@ func SetupTSSServer( cfg config.Config, tssPassword string, enableMonitor bool, + whitelistedPeers []gopeer.ID, ) (*tss.TssServer, error) { bootstrapPeers := peer log.Info().Msgf("Peers AddrList %v", bootstrapPeers) @@ -185,6 +186,7 @@ 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")