Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion cmd/zetaclientd/initconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type initializeConfigOptions struct {
peer string
publicIP string
publicDNS string
logFormat string
logSampler bool
preParamsPath string
Expand Down Expand Up @@ -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
Expand All @@ -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)")
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion contrib/localnet/scripts/start-zetaclientd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
1 change: 1 addition & 0 deletions zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
22 changes: 22 additions & 0 deletions zetaclient/metrics/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")

Expand Down
5 changes: 3 additions & 2 deletions zetaclient/tss/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Comment on lines +210 to 212
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Require at least one of PublicIP/PublicDNS; fail fast.

Starting TSS without an externally reachable address will produce unreachable peers. Make this a hard error instead of a warning.

-  case cfg.PublicIP == "" && cfg.PublicDNS == "":
-    logger.Warn().Msg("no public IP or DNS is provided")
+  case cfg.PublicIP == "" && cfg.PublicDNS == "":
+    return nil, errors.New("no public IP or DNS provided; set --public-ip or --public-dns")

Also good to log both when set:

logger.Info().Str("external_ip", cfg.PublicIP).Str("external_dns", cfg.PublicDNS).Msg("tss external addressing")

Also applies to: 228-229

🤖 Prompt for AI Agents
In zetaclient/tss/setup.go around lines 210-212 (and similarly at 228-229),
change the warning for missing external addressing to a hard error that stops
startup: check if both cfg.PublicIP and cfg.PublicDNS are empty and return/log a
fatal error (or return an error from this function) instead of logger.Warn();
additionally, when either or both are set log them with logger.Info including
structured fields "external_ip" and "external_dns" as suggested to make the
configured external addressing explicit.


tssPath, err := resolveTSSPath(cfg.TssPath, logger)
Expand All @@ -225,6 +225,7 @@ func NewServer(
PreParamTimeout: 5 * time.Minute,
},
ExternalIP: cfg.PublicIP,
ExternalDNS: cfg.PublicDNS,
Port: Port,
BootstrapPeers: bootstrapPeers,
WhitelistedPeers: whitelistPeers,
Expand Down