diff --git a/changelog.md b/changelog.md index ffbfc74c0f..eb025aa153 100644 --- a/changelog.md +++ b/changelog.md @@ -18,6 +18,7 @@ by calling `updateAdditionalActionFee` admin function. * [4157](https://github.com/zeta-chain/node/pull/4157) - multiple evm calls in single tx * [4211](https://github.com/zeta-chain/node/pull/4211) - provide error information in cctx when Bitcoin deposit fail * [4218](https://github.com/zeta-chain/node/pull/4218) - enable NoAssetCall from Bitcoin chain +* [4234](https://github.com/zeta-chain/node/pull/4234) - add additional support for zetaclient public DNS name ### Refactor diff --git a/cmd/zetaclientd/initconfig.go b/cmd/zetaclientd/initconfig.go index c5d4be9f4d..2b97852737 100644 --- a/cmd/zetaclientd/initconfig.go +++ b/cmd/zetaclientd/initconfig.go @@ -14,6 +14,7 @@ import ( type initializeConfigOptions struct { peer string publicIP string + publicDNS string logFormat string logSampler bool preParamsPath string @@ -50,6 +51,7 @@ func setupInitializeConfigOptions() { f.StringVar(&cfg.peer, "peer", "", usagePeer) f.StringVar(&cfg.publicIP, "public-ip", "", "public ip address") + f.StringVar(&cfg.publicDNS, "public-dns", "", "public dns name (alternative to public-ip)") f.StringVar(&cfg.preParamsPath, "pre-params", "~/preParams.json", "pre-params file path") f.StringVar(&cfg.chainID, "chain-id", "athens_7001-1", "chain id") // support both old argument name 'zetacore-url' and new argument name 'zetacore-ip' for backward compatibility @@ -60,7 +62,7 @@ func setupInitializeConfigOptions() { "zetacore node gRPC URL (e.g., zetachain.node-provider.com:433)") f.StringVar(&cfg.zetacoreWSSURL, "zetacore-wss-url", "", "zetacore node websocket URL (e.g., wss://node-provider.com:433/zetachain/websocket)") - f.StringVar(&cfg.authzGranter, "operator", "", "granter for the authorization , this should be operator address") + f.StringVar(&cfg.authzGranter, "operator", "", "granter for the authorization, this should be operator address") f.StringVar(&cfg.authzHotkey, "hotkey", "hotkey", usageHotKey) f.Int8Var(&cfg.level, "log-level", int8(zerolog.InfoLevel), usageLogLevel) f.StringVar(&cfg.logFormat, "log-format", "json", "log format (json, test)") @@ -91,6 +93,7 @@ func InitializeConfig(_ *cobra.Command, _ []string) error { // Populate new struct with cli arguments configData.Peer = initializeConfigOpts.peer configData.PublicIP = opts.publicIP + configData.PublicDNS = opts.publicDNS configData.PreParamsPath = opts.preParamsPath configData.ChainID = opts.chainID configData.ZetacoreIP = opts.zetacoreIP diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 48b023aedc..6890a007f4 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -224,6 +224,7 @@ func startTelemetry(ctx context.Context, cfg config.Config) (*metrics.TelemetryS // 3. Init telemetry server telemetry := metrics.NewTelemetryServer() telemetry.SetIPAddress(cfg.PublicIP) + telemetry.SetDNSName(cfg.PublicDNS) // 4. Add services to the process graceful.AddStarter(ctx, pprofServer) diff --git a/contrib/localnet/docker-compose.yml b/contrib/localnet/docker-compose.yml index a8074af01c..f3848a4d2e 100644 --- a/contrib/localnet/docker-compose.yml +++ b/contrib/localnet/docker-compose.yml @@ -107,6 +107,8 @@ services: networks: mynetwork: ipv4_address: 172.20.0.21 + extra_hosts: + - "zetaclient0.com:172.20.0.21" entrypoint: /root/start-zetaclientd.sh environment: - ETHDEV_ENDPOINT=http://eth:8545 @@ -128,6 +130,8 @@ services: networks: mynetwork: ipv4_address: 172.20.0.22 + extra_hosts: + - "zetaclient1.com:172.20.0.22" entrypoint: /root/start-zetaclientd.sh environment: - ETHDEV_ENDPOINT=http://eth:8545 @@ -148,6 +152,8 @@ services: networks: mynetwork: ipv4_address: 172.20.0.23 + extra_hosts: + - "zetaclient2.com:172.20.0.23" entrypoint: /root/start-zetaclientd.sh environment: - HOTKEY_BACKEND=file @@ -166,6 +172,8 @@ services: networks: mynetwork: ipv4_address: 172.20.0.24 + extra_hosts: + - "zetaclient3.com:172.20.0.24" entrypoint: /root/start-zetaclientd.sh environment: - HOTKEY_BACKEND=file diff --git a/contrib/localnet/scripts/start-zetaclientd.sh b/contrib/localnet/scripts/start-zetaclientd.sh index 1ac2d636af..3424284346 100755 --- a/contrib/localnet/scripts/start-zetaclientd.sh +++ b/contrib/localnet/scripts/start-zetaclientd.sh @@ -104,7 +104,11 @@ if [[ $HOSTNAME != "zetaclient0" && ! -f ~/.zetacored/config/zetaclient_config.j num=$(echo $HOSTNAME | tr -dc '0-9') node="zetacore$num" fi - zetaclientd init --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH" + + # use alternative DNS name (instead of IP) for other zetaclients (DNS should work as well) + zetaclientd init --zetacore-url "$node" --chain-id athens_101-1 \ + --operator "$operatorAddress" --log-format=text --public-dns "$HOSTNAME.com" \ + --keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH" # import relayer private key for zetaclient{$num} import_relayer_key "${num}" diff --git a/go.mod b/go.mod index 18205a12f5..748b45af52 100644 --- a/go.mod +++ b/go.mod @@ -306,7 +306,7 @@ require ( github.com/showa-93/go-mask v0.6.2 github.com/test-go/testify v1.1.4 github.com/tonkeeper/tongo v1.16.4 - github.com/zeta-chain/go-tss v0.6.3 + github.com/zeta-chain/go-tss v0.6.4-0.20250923180519-1bbb3ac2ff31 github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20250409230544-d88f214f6f46 go.uber.org/mock v0.5.2 ) diff --git a/go.sum b/go.sum index e8b3f6ebfa..49c4939d2c 100644 --- a/go.sum +++ b/go.sum @@ -1965,6 +1965,8 @@ github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 h1:FmO3HfVdZ7 github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4/go.mod h1:TBv5NY/CqWYIfUstXO1fDWrt4bDoqgCw79yihqBspg8= github.com/zeta-chain/go-tss v0.6.3 h1:c/zSEvI0h7MJ+xxu42M58uBdEWrlzfD3NI1kP/FlWBE= github.com/zeta-chain/go-tss v0.6.3/go.mod h1:xLssidNiAP/fcdcw+cUPA2VS7Td2bnPMS/8x0jnde8w= +github.com/zeta-chain/go-tss v0.6.4-0.20250923180519-1bbb3ac2ff31 h1:78J7NoSjhrq3joMoDUhi+5rMfXL8ckhRuO4BFIL3Q0o= +github.com/zeta-chain/go-tss v0.6.4-0.20250923180519-1bbb3ac2ff31/go.mod h1:xLssidNiAP/fcdcw+cUPA2VS7Td2bnPMS/8x0jnde8w= github.com/zeta-chain/protocol-contracts v0.0.0-20250909184950-6034c08e5870 h1:G0l52EwS5U7f5eOcQR0kD2tNE2BJtUsKlk9hFtYW7nc= github.com/zeta-chain/protocol-contracts v0.0.0-20250909184950-6034c08e5870/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20250409230544-d88f214f6f46 h1:xbgrVDXWkZaWhMAuD3Q5A13jmRKYQbjZMPBaCkv3cns= diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go index edb48e57a0..8f97040d7a 100644 --- a/zetaclient/config/types.go +++ b/zetaclient/config/types.go @@ -98,6 +98,7 @@ type ComplianceConfig struct { type Config struct { Peer string `json:"Peer"` PublicIP string `json:"PublicIP"` + PublicDNS string `json:"PublicDNS"` LogFormat string `json:"LogFormat"` LogLevel int8 `json:"LogLevel"` LogSampler bool `json:"LogSampler"` diff --git a/zetaclient/metrics/telemetry.go b/zetaclient/metrics/telemetry.go index 603a7e93bf..dad2c29063 100644 --- a/zetaclient/metrics/telemetry.go +++ b/zetaclient/metrics/telemetry.go @@ -30,6 +30,7 @@ type TelemetryServer struct { lastStartTimestamp time.Time status types.Status ipAddress string + dnsName string HotKeyBurnRate *BurnRate connectedPeers []peer.AddrInfo rtt map[peer.ID]int64 @@ -107,6 +108,20 @@ func (t *TelemetryServer) GetIPAddress() string { return t.ipAddress } +// SetDNSName sets p2p dns name +func (t *TelemetryServer) SetDNSName(dns string) { + t.mu.Lock() + defer t.mu.Unlock() + t.dnsName = dns +} + +// GetDNSName gets p2p dns name +func (t *TelemetryServer) GetDNSName() string { + t.mu.Lock() + defer t.mu.Unlock() + return t.dnsName +} + // GetLastStartTimestamp returns last start timestamp func (t *TelemetryServer) GetLastStartTimestamp() time.Time { t.mu.Lock() @@ -180,6 +195,7 @@ func (t *TelemetryServer) Handlers() http.Handler { router.Handle("/lastcoreblock", http.HandlerFunc(t.lastCoreBlockHandler)).Methods(http.MethodGet) router.Handle("/status", http.HandlerFunc(t.statusHandler)).Methods(http.MethodGet) router.Handle("/ip", http.HandlerFunc(t.ipHandler)).Methods(http.MethodGet) + router.Handle("/dns", http.HandlerFunc(t.dnsHandler)).Methods(http.MethodGet) router.Handle("/hotkeyburnrate", http.HandlerFunc(t.hotKeyFeeBurnRate)).Methods(http.MethodGet) router.Handle("/connectedpeers", http.HandlerFunc(t.connectedPeersHandler)).Methods(http.MethodGet) router.Handle("/pingrtt", http.HandlerFunc(t.pingRTTHandler)).Methods(http.MethodGet) @@ -232,6 +248,12 @@ func (t *TelemetryServer) ipHandler(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, "%s", t.GetIPAddress()) } +// dnsHandler returns the dns name +func (t *TelemetryServer) dnsHandler(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + fmt.Fprintf(w, "%s", t.GetDNSName()) +} + func (t *TelemetryServer) lastScannedBlockHandler(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") diff --git a/zetaclient/tss/setup.go b/zetaclient/tss/setup.go index bc29c05cf7..3cedae2304 100644 --- a/zetaclient/tss/setup.go +++ b/zetaclient/tss/setup.go @@ -207,8 +207,8 @@ func NewServer( return nil, errors.New("tss password is empty") case privateKey == nil: return nil, errors.New("private key is nil") - case cfg.PublicIP == "": - logger.Warn().Msg("public IP is empty") + case cfg.PublicIP == "" && cfg.PublicDNS == "": + logger.Warn().Msg("no public IP or DNS is provided") } tssPath, err := resolveTSSPath(cfg.TssPath, logger) @@ -225,6 +225,7 @@ func NewServer( PreParamTimeout: 5 * time.Minute, }, ExternalIP: cfg.PublicIP, + ExternalDNS: cfg.PublicDNS, Port: Port, BootstrapPeers: bootstrapPeers, WhitelistedPeers: whitelistPeers,