Skip to content

Commit 50a2a56

Browse files
committed
feat: add well-known port constants and NodePorts()
Exposes canonical Sei node port numbers (RPC, P2P, gRPC, EVM, metrics, sidecar) as typed int32 constants so consumers like sei-k8s-controller don't need to maintain their own copies. Also adds NodePorts() which returns the name→port pairs for container/service port generation. The EVM defaults in baseDefaults() now reference PortEVMHTTP/PortEVMWS instead of bare literals.
1 parent 579f7ee commit 50a2a56

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

config.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@ const CurrentVersion = 1
1414
// creation interval (in blocks) used when snapshot generation is enabled.
1515
const DefaultSnapshotInterval = 2000
1616

17+
// Well-known default ports for Sei node services and the sidecar.
18+
const (
19+
PortEVMHTTP int32 = 8545
20+
PortEVMWS int32 = 8546
21+
PortGRPC int32 = 9090
22+
PortP2P int32 = 26656
23+
PortRPC int32 = 26657
24+
PortMetrics int32 = 26660
25+
PortSidecar int32 = 7777
26+
)
27+
28+
// NodePort pairs a human-readable service name with its default port number.
29+
type NodePort struct {
30+
Name string
31+
Port int32
32+
}
33+
34+
// NodePorts returns the canonical set of ports exposed by a Sei node (seid).
35+
// The sidecar port is excluded; use PortSidecar directly.
36+
func NodePorts() []NodePort {
37+
return []NodePort{
38+
{"evm-rpc", PortEVMHTTP},
39+
{"evm-ws", PortEVMWS},
40+
{"grpc", PortGRPC},
41+
{"p2p", PortP2P},
42+
{"rpc", PortRPC},
43+
{"metrics", PortMetrics},
44+
}
45+
}
46+
1747
// Pruning strategy constants.
1848
const (
1949
PruningDefault = "default"

defaults.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ func baseDefaults() *SeiConfig {
139139

140140
EVM: EVMConfig{
141141
HTTPEnabled: true,
142-
HTTPPort: 8545,
142+
HTTPPort: int(PortEVMHTTP),
143143
WSEnabled: true,
144-
WSPort: 8546,
144+
WSPort: int(PortEVMWS),
145145
ReadTimeout: Dur(30 * time.Second),
146146
ReadHeaderTimeout: Dur(30 * time.Second),
147147
WriteTimeout: Dur(30 * time.Second),

0 commit comments

Comments
 (0)