Skip to content

Commit 80035f3

Browse files
bdchathamclaude
andcommitted
feat: add PortREST constant and NodePortsForMode lookup
Add REST (1317) to the canonical port set in NodePorts() and add NodePortsForMode() which returns only the ports actually served by a given node mode: - validator: p2p, metrics - full/archive: all 7 ports (evm-rpc, evm-ws, grpc, rest, p2p, rpc, metrics) - seed: nil (not used in production Sei infrastructure) This lets the controller derive which ports to open from the mode rather than requiring manual port selection in the CRD. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dffee90 commit 80035f3

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

config.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
PortEVMHTTP int32 = 8545
2020
PortEVMWS int32 = 8546
2121
PortGRPC int32 = 9090
22+
PortREST int32 = 1317
2223
PortP2P int32 = 26656
2324
PortRPC int32 = 26657
2425
PortMetrics int32 = 26660
@@ -38,12 +39,37 @@ func NodePorts() []NodePort {
3839
{"evm-rpc", PortEVMHTTP},
3940
{"evm-ws", PortEVMWS},
4041
{"grpc", PortGRPC},
42+
{"rest", PortREST},
4143
{"p2p", PortP2P},
4244
{"rpc", PortRPC},
4345
{"metrics", PortMetrics},
4446
}
4547
}
4648

49+
// NodePortsForMode returns the ports that are actually served by a node
50+
// running in the given mode.
51+
func NodePortsForMode(mode NodeMode) []NodePort {
52+
switch mode {
53+
case ModeValidator:
54+
return []NodePort{
55+
{"p2p", PortP2P},
56+
{"metrics", PortMetrics},
57+
}
58+
case ModeFull, ModeArchive:
59+
return []NodePort{
60+
{"evm-rpc", PortEVMHTTP},
61+
{"evm-ws", PortEVMWS},
62+
{"grpc", PortGRPC},
63+
{"rest", PortREST},
64+
{"p2p", PortP2P},
65+
{"rpc", PortRPC},
66+
{"metrics", PortMetrics},
67+
}
68+
default:
69+
return nil
70+
}
71+
}
72+
4773
// Pruning strategy constants.
4874
const (
4975
PruningDefault = "default"

0 commit comments

Comments
 (0)