Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change ports #733

Merged
merged 2 commits into from
Jun 21, 2022
Merged
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
2 changes: 1 addition & 1 deletion cmd/bootnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func newBootnodeCmd(runFunc func(context.Context, BootnodeConfig) error) *cobra.
}

func bindBootnodeFlag(flags *pflag.FlagSet, config *BootnodeConfig) {
flags.StringVar(&config.HTTPAddr, "bootnode-http-address", "127.0.0.1:16005", "Listening address (ip and port) for the bootnode http server serving runtime ENR")
flags.StringVar(&config.HTTPAddr, "bootnode-http-address", "127.0.0.1:3640", "Listening address (ip and port) for the bootnode http server serving runtime ENR")
flags.BoolVar(&config.AutoP2PKey, "auto-p2pkey", true, "Automatically create a p2pkey (ecdsa private key used for p2p authentication and ENR) if none found in data directory")
flags.BoolVar(&config.P2PRelay, "p2p-relay", true, "Enable libp2p tcp host providing circuit relay to charon clusters")
flags.IntVar(&config.MaxResPerPeer, "max-reservations", 30, "Updates max circuit reservations per peer (each valid for 30min)")
Expand Down
12 changes: 6 additions & 6 deletions cmd/cmd_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func TestCmdFlags(t *testing.T) {
},
P2P: p2p.Config{
UDPBootnodes: []string{"http://bootnode.gcp.obol.tech:16000/enr"},
UDPAddr: "127.0.0.1:16004",
TCPAddrs: []string{"127.0.0.1:16003"},
UDPAddr: "127.0.0.1:3630",
TCPAddrs: []string{"127.0.0.1:3600"},
Allowlist: "",
Denylist: "",
},
Expand All @@ -81,8 +81,8 @@ func TestCmdFlags(t *testing.T) {
},
LockFile: ".charon/cluster-lock.json",
DataDir: "from_env",
MonitoringAddr: "127.0.0.1:16001",
ValidatorAPIAddr: "127.0.0.1:16002",
MonitoringAddr: "127.0.0.1:3620",
ValidatorAPIAddr: "127.0.0.1:3610",
BeaconNodeAddr: "http://localhost/",
JaegerAddr: "",
JaegerService: "charon",
Expand All @@ -94,8 +94,8 @@ func TestCmdFlags(t *testing.T) {
Datadir: ".charon",
P2PConfig: &p2p.Config{
UDPBootnodes: []string{"http://bootnode.gcp.obol.tech:16000/enr"},
UDPAddr: "127.0.0.1:16004",
TCPAddrs: []string{"127.0.0.1:16003"},
UDPAddr: "127.0.0.1:3630",
TCPAddrs: []string{"127.0.0.1:3600"},
Allowlist: "",
Denylist: "",
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func newRunCmd(runFunc func(context.Context, app.Config) error) *cobra.Command {
func bindRunFlags(flags *pflag.FlagSet, config *app.Config) {
flags.StringVar(&config.LockFile, "lock-file", ".charon/cluster-lock.json", "The path to the cluster lock file defining distributed validator cluster")
flags.StringVar(&config.BeaconNodeAddr, "beacon-node-endpoint", "http://localhost/", "Beacon node endpoint URL")
flags.StringVar(&config.ValidatorAPIAddr, "validator-api-address", "127.0.0.1:16002", "Listening address (ip and port) for validator-facing traffic proxying the beacon-node API")
flags.StringVar(&config.MonitoringAddr, "monitoring-address", "127.0.0.1:16001", "Listening address (ip and port) for the monitoring API (prometheus, pprof)")
flags.StringVar(&config.ValidatorAPIAddr, "validator-api-address", "127.0.0.1:3610", "Listening address (ip and port) for validator-facing traffic proxying the beacon-node API")
flags.StringVar(&config.MonitoringAddr, "monitoring-address", "127.0.0.1:3620", "Listening address (ip and port) for the monitoring API (prometheus, pprof)")
flags.StringVar(&config.JaegerAddr, "jaeger-address", "", "Listening address for jaeger tracing")
flags.StringVar(&config.JaegerService, "jaeger-service", "charon", "Service name used for jaeger tracing")
flags.BoolVar(&config.SimnetBMock, "simnet-beacon-mock", false, "Enables an internal mock beacon node for running a simnet.")
Expand All @@ -77,10 +77,10 @@ func bindP2PFlags(flags *pflag.FlagSet, config *p2p.Config) {
flags.StringSliceVar(&config.UDPBootnodes, "p2p-bootnodes", []string{"http://bootnode.gcp.obol.tech:16000/enr"}, "Comma-separated list of discv5 bootnode URLs or ENRs.")
flags.BoolVar(&config.BootnodeRelay, "p2p-bootnode-relay", false, "Enables using bootnodes as libp2p circuit relays. Useful if some charon nodes are not have publicly accessible.")
flags.BoolVar(&config.UDPBootLock, "p2p-bootnodes-from-lockfile", false, "Enables using cluster lock ENRs as discv5 bootnodes. Allows skipping explicit bootnodes if key generation ceremony included correct IPs.")
flags.StringVar(&config.UDPAddr, "p2p-udp-address", "127.0.0.1:16004", "Listening UDP address (ip and port) for discv5 discovery.")
flags.StringVar(&config.UDPAddr, "p2p-udp-address", "127.0.0.1:3630", "Listening UDP address (ip and port) for discv5 discovery.")
flags.StringVar(&config.ExternalIP, "p2p-external-ip", "", "The IP address advertised by libp2p. This may be used to advertise an external IP.")
flags.StringVar(&config.ExternalHost, "p2p-external-hostname", "", "The DNS hostname advertised by libp2p. This may be used to advertise an external DNS.")
flags.StringSliceVar(&config.TCPAddrs, "p2p-tcp-address", []string{"127.0.0.1:16003"}, "Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic.")
flags.StringSliceVar(&config.TCPAddrs, "p2p-tcp-address", []string{"127.0.0.1:3600"}, "Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic.")
flags.StringVar(&config.Allowlist, "p2p-allowlist", "", "Comma-separated list of CIDR subnets for allowing only certain peer connections. Example: 192.168.0.0/16 would permit connections to peers on your local network only. The default is to accept all connections.")
flags.StringVar(&config.Denylist, "p2p-denylist", "", "Comma-separated list of CIDR subnets for disallowing certain peer connections. Example: 192.168.0.0/16 would disallow connections to peers on your local network. The default is to accept all connections.")
}
Expand Down
8 changes: 4 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ Flags:
--lock-file string The path to the cluster lock file defining distributed validator cluster (default ".charon/cluster-lock.json")
--log-format string Log format; console, logfmt or json (default "console")
--log-level string Log level; debug, info, warn or error (default "info")
--monitoring-address string Listening address (ip and port) for the monitoring API (prometheus, pprof) (default "127.0.0.1:16001")
--monitoring-address string Listening address (ip and port) for the monitoring API (prometheus, pprof) (default "127.0.0.1:3620")
--p2p-allowlist string Comma-separated list of CIDR subnets for allowing only certain peer connections. Example: 192.168.0.0/16 would permit connections to peers on your local network only. The default is to accept all connections.
--p2p-bootnode-relay Enables using bootnodes as libp2p circuit relays. Useful if some charon nodes are not have publicly accessible.
--p2p-bootnodes strings Comma-separated list of discv5 bootnode URLs or ENRs. (default [http://bootnode.gcp.obol.tech:16000/enr])
--p2p-bootnodes-from-lockfile Enables using cluster lock ENRs as discv5 bootnodes. Allows skipping explicit bootnodes if key generation ceremony included correct IPs.
--p2p-denylist string Comma-separated list of CIDR subnets for disallowing certain peer connections. Example: 192.168.0.0/16 would disallow connections to peers on your local network. The default is to accept all connections.
--p2p-external-hostname string The DNS hostname advertised by libp2p. This may be used to advertise an external DNS.
--p2p-external-ip string The IP address advertised by libp2p. This may be used to advertise an external IP.
--p2p-tcp-address strings Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic. (default [127.0.0.1:16003])
--p2p-udp-address string Listening UDP address (ip and port) for discv5 discovery. (default "127.0.0.1:16004")
--p2p-tcp-address strings Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic. (default [127.0.0.1:3600])
--p2p-udp-address string Listening UDP address (ip and port) for discv5 discovery. (default "127.0.0.1:3630")
--simnet-beacon-mock Enables an internal mock beacon node for running a simnet.
--simnet-validator-mock Enables an internal mock validator client when running a simnet. Requires simnet-beacon-mock.
--validator-api-address string Listening address (ip and port) for validator-facing traffic proxying the beacon-node API (default "127.0.0.1:16002")
--validator-api-address string Listening address (ip and port) for validator-facing traffic proxying the beacon-node API (default "127.0.0.1:3610")

````
<!-- Code above generated by cmd/cmd_internal_test.go#TestConfigReference. DO NOT EDIT -->
6 changes: 3 additions & 3 deletions testutil/compose/docker-compose.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ services:
command: bootnode
depends_on: []
environment:
CHARON_BOOTNODE_HTTP_ADDRESS: 0.0.0.0:16000
CHARON_BOOTNODE_HTTP_ADDRESS: 0.0.0.0:3640
CHARON_DATA_DIR: /compose/bootnode
CHARON_P2P_BOOTNODES: ""
CHARON_P2P_EXTERNAL_HOSTNAME: bootnode
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630
{{end -}}
{{- range $i, $vc := .VCs}}
{{- if $vc.Label}}
Expand Down
10 changes: 5 additions & 5 deletions testutil/compose/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ func newNodeEnvs(index int, validatorMock bool, conf Config) []kv {
{"jaeger-address", "jaeger:6831"},
{"definition-file", "/compose/cluster-definition.json"},
{"lock-file", lockFile},
{"monitoring-address", "0.0.0.0:16001"},
{"validator-api-address", "0.0.0.0:16002"},
{"monitoring-address", "0.0.0.0:3620"},
{"validator-api-address", "0.0.0.0:3610"},
{"p2p-external-hostname", fmt.Sprintf("node%d", index)},
{"p2p-tcp-address", "0.0.0.0:16003"},
{"p2p_udp_address", "0.0.0.0:16004"},
{"p2p-bootnodes", "http://bootnode:16000/enr"},
{"p2p-tcp-address", "0.0.0.0:3600"},
{"p2p_udp_address", "0.0.0.0:3630"},
{"p2p-bootnodes", "http://bootnode:3640/enr"},
{"beacon-node-endpoint", beaconNode},
{"simnet-validator-mock", fmt.Sprintf(`"%v"`, validatorMock)},
{"simnet-beacon_mock", fmt.Sprintf(`"%v"`, beaconMock)},
Expand Down
2 changes: 1 addition & 1 deletion testutil/compose/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func getVC(typ VCType, nodeIdx int, numVals int) (vc, error) {
Command: `|
validator-client
--network=auto
--beacon-node-api-endpoint="http://node{{.NodeIdx}}:16002"
--beacon-node-api-endpoint="http://node{{.NodeIdx}}:3610"
{{range .TekuKeys}}--validator-keys="{{.}}"
{{end -}}
--validators-proposer-default-fee-recipient="0x0000000000000000000000000000000000000000"`,
Expand Down
8 changes: 4 additions & 4 deletions testutil/compose/static/lighthouse/run.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash

while ! curl "http://${NODE}:16002/up" 2>/dev/null; do
echo "Waiting for http://${NODE}:16002/up to become available..."
while ! curl "http://${NODE}:3610/up" 2>/dev/null; do
echo "Waiting for http://${NODE}:3610/up to become available..."
sleep 5
done

echo "Creating testnet config"
rm -rf /tmp/testnet || true
mkdir /tmp/testnet/
curl "http://${NODE}:16002/eth/v1/config/spec" | jq -r .data | yq -P > /tmp/testnet/config.yaml
curl "http://${NODE}:3610/eth/v1/config/spec" | jq -r .data | yq -P > /tmp/testnet/config.yaml
echo "0" > /tmp/testnet/deploy_block.txt

for f in /compose/"${NODE}"/validator_keys/keystore-*.json; do
Expand All @@ -23,5 +23,5 @@ done
echo "Starting lighthouse validator client for ${NODE}"
exec lighthouse validator \
--testnet-dir "/tmp/testnet" \
--beacon-node "http://${NODE}:16002" \
--beacon-node "http://${NODE}:3610" \
--suggested-fee-recipient "0x0000000000000000000000000000000000000000"
8 changes: 4 additions & 4 deletions testutil/compose/static/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ global:
scrape_configs:
- job_name: 'node0'
static_configs:
- targets: ['node0:16001']
- targets: ['node0:3620']
- job_name: 'node1'
static_configs:
- targets: ['node1:16001']
- targets: ['node1:3620']
- job_name: 'node2'
static_configs:
- targets: ['node2:16001']
- targets: ['node2:3620']
- job_name: 'node3'
static_configs:
- targets: ['node3:16001']
- targets: ['node3:3620']

rule_files:
- /etc/prometheus/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@
},
{
"Key": "monitoring-address",
"Value": "0.0.0.0:16001"
"Value": "0.0.0.0:3620"
},
{
"Key": "validator-api-address",
"Value": "0.0.0.0:16002"
"Value": "0.0.0.0:3610"
},
{
"Key": "p2p-external-hostname",
"Value": "node0"
},
{
"Key": "p2p-tcp-address",
"Value": "0.0.0.0:16003"
"Value": "0.0.0.0:3600"
},
{
"Key": "p2p_udp_address",
"Value": "0.0.0.0:16004"
"Value": "0.0.0.0:3630"
},
{
"Key": "p2p-bootnodes",
"Value": "http://bootnode:16000/enr"
"Value": "http://bootnode:3640/enr"
},
{
"Key": "beacon-node-endpoint",
Expand Down Expand Up @@ -101,27 +101,27 @@
},
{
"Key": "monitoring-address",
"Value": "0.0.0.0:16001"
"Value": "0.0.0.0:3620"
},
{
"Key": "validator-api-address",
"Value": "0.0.0.0:16002"
"Value": "0.0.0.0:3610"
},
{
"Key": "p2p-external-hostname",
"Value": "node1"
},
{
"Key": "p2p-tcp-address",
"Value": "0.0.0.0:16003"
"Value": "0.0.0.0:3600"
},
{
"Key": "p2p_udp_address",
"Value": "0.0.0.0:16004"
"Value": "0.0.0.0:3630"
},
{
"Key": "p2p-bootnodes",
"Value": "http://bootnode:16000/enr"
"Value": "http://bootnode:3640/enr"
},
{
"Key": "beacon-node-endpoint",
Expand Down Expand Up @@ -172,27 +172,27 @@
},
{
"Key": "monitoring-address",
"Value": "0.0.0.0:16001"
"Value": "0.0.0.0:3620"
},
{
"Key": "validator-api-address",
"Value": "0.0.0.0:16002"
"Value": "0.0.0.0:3610"
},
{
"Key": "p2p-external-hostname",
"Value": "node2"
},
{
"Key": "p2p-tcp-address",
"Value": "0.0.0.0:16003"
"Value": "0.0.0.0:3600"
},
{
"Key": "p2p_udp_address",
"Value": "0.0.0.0:16004"
"Value": "0.0.0.0:3630"
},
{
"Key": "p2p-bootnodes",
"Value": "http://bootnode:16000/enr"
"Value": "http://bootnode:3640/enr"
},
{
"Key": "beacon-node-endpoint",
Expand Down Expand Up @@ -243,27 +243,27 @@
},
{
"Key": "monitoring-address",
"Value": "0.0.0.0:16001"
"Value": "0.0.0.0:3620"
},
{
"Key": "validator-api-address",
"Value": "0.0.0.0:16002"
"Value": "0.0.0.0:3610"
},
{
"Key": "p2p-external-hostname",
"Value": "node3"
},
{
"Key": "p2p-tcp-address",
"Value": "0.0.0.0:16003"
"Value": "0.0.0.0:3600"
},
{
"Key": "p2p_udp_address",
"Value": "0.0.0.0:16004"
"Value": "0.0.0.0:3630"
},
{
"Key": "p2p-bootnodes",
"Value": "http://bootnode:16000/enr"
"Value": "http://bootnode:3640/enr"
},
{
"Key": "beacon-node-endpoint",
Expand Down
46 changes: 23 additions & 23 deletions testutil/compose/testdata/TestDockerCompose_lock_dkg_yml.golden
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ services:
CHARON_JAEGER_ADDRESS: jaeger:6831
CHARON_DEFINITION_FILE: /compose/cluster-definition.json
CHARON_LOCK_FILE: /compose/node0/cluster-lock.json
CHARON_MONITORING_ADDRESS: 0.0.0.0:16001
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:16002
CHARON_MONITORING_ADDRESS: 0.0.0.0:3620
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:3610
CHARON_P2P_EXTERNAL_HOSTNAME: node0
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_BOOTNODES: http://bootnode:16000/enr
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630
CHARON_P2P_BOOTNODES: http://bootnode:3640/enr
CHARON_BEACON_NODE_ENDPOINT:
CHARON_SIMNET_VALIDATOR_MOCK: "true"
CHARON_SIMNET_BEACON_MOCK: "true"
Expand All @@ -39,12 +39,12 @@ services:
CHARON_JAEGER_ADDRESS: jaeger:6831
CHARON_DEFINITION_FILE: /compose/cluster-definition.json
CHARON_LOCK_FILE: /compose/node1/cluster-lock.json
CHARON_MONITORING_ADDRESS: 0.0.0.0:16001
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:16002
CHARON_MONITORING_ADDRESS: 0.0.0.0:3620
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:3610
CHARON_P2P_EXTERNAL_HOSTNAME: node1
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_BOOTNODES: http://bootnode:16000/enr
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630
CHARON_P2P_BOOTNODES: http://bootnode:3640/enr
CHARON_BEACON_NODE_ENDPOINT:
CHARON_SIMNET_VALIDATOR_MOCK: "true"
CHARON_SIMNET_BEACON_MOCK: "true"
Expand All @@ -60,12 +60,12 @@ services:
CHARON_JAEGER_ADDRESS: jaeger:6831
CHARON_DEFINITION_FILE: /compose/cluster-definition.json
CHARON_LOCK_FILE: /compose/node2/cluster-lock.json
CHARON_MONITORING_ADDRESS: 0.0.0.0:16001
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:16002
CHARON_MONITORING_ADDRESS: 0.0.0.0:3620
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:3610
CHARON_P2P_EXTERNAL_HOSTNAME: node2
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_BOOTNODES: http://bootnode:16000/enr
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630
CHARON_P2P_BOOTNODES: http://bootnode:3640/enr
CHARON_BEACON_NODE_ENDPOINT:
CHARON_SIMNET_VALIDATOR_MOCK: "true"
CHARON_SIMNET_BEACON_MOCK: "true"
Expand All @@ -81,12 +81,12 @@ services:
CHARON_JAEGER_ADDRESS: jaeger:6831
CHARON_DEFINITION_FILE: /compose/cluster-definition.json
CHARON_LOCK_FILE: /compose/node3/cluster-lock.json
CHARON_MONITORING_ADDRESS: 0.0.0.0:16001
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:16002
CHARON_MONITORING_ADDRESS: 0.0.0.0:3620
CHARON_VALIDATOR_API_ADDRESS: 0.0.0.0:3610
CHARON_P2P_EXTERNAL_HOSTNAME: node3
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_BOOTNODES: http://bootnode:16000/enr
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630
CHARON_P2P_BOOTNODES: http://bootnode:3640/enr
CHARON_BEACON_NODE_ENDPOINT:
CHARON_SIMNET_VALIDATOR_MOCK: "true"
CHARON_SIMNET_BEACON_MOCK: "true"
Expand All @@ -98,12 +98,12 @@ services:
command: bootnode
depends_on: []
environment:
CHARON_BOOTNODE_HTTP_ADDRESS: 0.0.0.0:16000
CHARON_BOOTNODE_HTTP_ADDRESS: 0.0.0.0:3640
CHARON_DATA_DIR: /compose/bootnode
CHARON_P2P_BOOTNODES: ""
CHARON_P2P_EXTERNAL_HOSTNAME: bootnode
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:16003
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:16004
CHARON_P2P_TCP_ADDRESS: 0.0.0.0:3600
CHARON_P2P_UDP_ADDRESS: 0.0.0.0:3630

networks:
compose:
Loading