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

[P2P, Runtime] Update P2P & base config (part 2) #535

Merged
merged 22 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5ad835e
chore: add `hostname` p2p config field
bryanchriswhite Feb 22, 2023
e8934a7
chore: rename `consensus_port` config option to `port`
bryanchriswhite Feb 22, 2023
a350c20
chore: update default port number to 42069
bryanchriswhite Feb 22, 2023
e903a7c
chore: add `use_libp2p` config field
bryanchriswhite Feb 22, 2023
4b37d98
chore: update persistence state hash test
bryanchriswhite Feb 23, 2023
0ef6582
fix: docker composition / .env ports
bryanchriswhite Feb 24, 2023
0df649a
chore: update k8s manifests p2p config port
bryanchriswhite Feb 24, 2023
bf58cc5
chore: update changelogs
bryanchriswhite Feb 22, 2023
4c19fbb
fix: update port numbers in tests
bryanchriswhite Feb 24, 2023
2a379c3
chore: add `use_libp2p` to k8s configs
bryanchriswhite Feb 24, 2023
8643a0a
chore: update k8s validator template
bryanchriswhite Feb 24, 2023
7eb373c
chore: make ConfigMap a template
bryanchriswhite Feb 27, 2023
5b7c477
chore: add hostname to ConfigMap
bryanchriswhite Feb 27, 2023
a01610f
chore: update changelog
bryanchriswhite Feb 27, 2023
a073fae
Revert "chore: make ConfigMap a template"
bryanchriswhite Feb 28, 2023
fae0410
chore: add localnet hostname via env var
bryanchriswhite Feb 28, 2023
7e79a33
chore: update changelog
bryanchriswhite Feb 28, 2023
743d5cb
test: replace literal with constant
bryanchriswhite Feb 28, 2023
4278b65
chore: update changelog
bryanchriswhite Feb 28, 2023
06979c1
chore: update changelog
bryanchriswhite Feb 28, 2023
75e529d
Merge branch 'main' into chore/config
bryanchriswhite Mar 1, 2023
a931eb0
fix: state hash test post-merge
bryanchriswhite Mar 1, 2023
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
4 changes: 3 additions & 1 deletion build/config/config1.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
"use_lib_p2p": false,
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
Expand Down Expand Up @@ -28,7 +29,8 @@
"health_check_period": "5m"
},
"p2p": {
"consensus_port": 8080,
"hostname": "node1.consensus",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
Expand Down
4 changes: 3 additions & 1 deletion build/config/config2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "ba81e6e56d293895b299bc495ae75d490644429a5e0028fabeb5e1871c1098e7eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91",
"use_lib_p2p": false,
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
Expand Down Expand Up @@ -28,7 +29,8 @@
"health_check_period": "5m"
},
"p2p": {
"consensus_port": 8080,
"hostname": "node2.consensus",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "ba81e6e56d293895b299bc495ae75d490644429a5e0028fabeb5e1871c1098e7eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91",
Expand Down
4 changes: 3 additions & 1 deletion build/config/config3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "25b385b367a827eaafcdb1003bd17a25f2ecc0d10d41f138846f52ae1015aa941041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50",
"use_lib_p2p": false,
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
Expand Down Expand Up @@ -28,7 +29,8 @@
"health_check_period": "5m"
},
"p2p": {
"consensus_port": 8080,
"hostname": "node3.consensus",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "25b385b367a827eaafcdb1003bd17a25f2ecc0d10d41f138846f52ae1015aa941041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50",
Expand Down
4 changes: 3 additions & 1 deletion build/config/config4.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45",
"use_lib_p2p": false,
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
Expand Down Expand Up @@ -28,7 +29,8 @@
"health_check_period": "5m"
},
"p2p": {
"consensus_port": 8080,
"hostname": "node4.consensus",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45",
Expand Down
12 changes: 6 additions & 6 deletions build/config/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -4040,7 +4040,7 @@
"address": "00104055c00bed7c983a48aac7dc6335d7c607a7",
"public_key": "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
"chains": null,
"generic_param": "node1.consensus:8080",
"generic_param": "node1.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4051,7 +4051,7 @@
"address": "00204737d2a165ebe4be3a7d5b0af905b0ea91d8",
"public_key": "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91",
"chains": null,
"generic_param": "node2.consensus:8080",
"generic_param": "node2.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4062,7 +4062,7 @@
"address": "00304d0101847b37fd62e7bebfbdddecdbb7133e",
"public_key": "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50",
"chains": null,
"generic_param": "node3.consensus:8080",
"generic_param": "node3.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4073,7 +4073,7 @@
"address": "00404a570febd061274f72b50d0a37f611dfe339",
"public_key": "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45",
"chains": null,
"generic_param": "node4.consensus:8080",
"generic_param": "node4.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand Down Expand Up @@ -4103,7 +4103,7 @@
"chains": [
"0001"
],
"generic_param": "node1.consensus:8080",
"generic_param": "node1.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4118,7 +4118,7 @@
"chains": [
"0001"
],
"generic_param": "node1.consensus:8080",
"generic_param": "node1.consensus:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand Down
8 changes: 4 additions & 4 deletions build/deployments/.env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# docker compose stuff
# override with your own values if the default host port mappings in docker-compose do not suit you
# NODE1_PORT_7081=127.0.0.1:7081
# NODE1_PORT_8081=127.0.0.1:8081
# NODE1_PORT_9081=127.0.0.1:9081
# NODE1_PORT_42070=127.0.0.1:42070
# NODE1_PORT_50832=127.0.0.1:50832
# NODE2_PORT_7081=127.0.0.1:7082
# NODE2_PORT_8081=127.0.0.1:8082
# NODE2_PORT_9081=127.0.0.1:9082
# NODE2_PORT_42070=127.0.0.1:42071
# NODE2_PORT_50832=127.0.0.1:50833
# NODE3_PORT_7081=127.0.0.1:7083
# NODE3_PORT_8081=127.0.0.1:8083
# NODE3_PORT_9081=127.0.0.1:9083
# NODE3_PORT_42070=127.0.0.1:42072
# NODE3_PORT_50832=127.0.0.1:50834
# NODE4_PORT_7081=127.0.0.1:7084
# NODE4_PORT_8081=127.0.0.1:8084
# NODE4_PORT_9081=127.0.0.1:9084
# NODE4_PORT_42070=127.0.0.1:42073
# NODE4_PORT_50832=127.0.0.1:50835
16 changes: 8 additions & 8 deletions build/deployments/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ services:
dockerfile: ./build/Dockerfile.localdev
expose:
- "7080" # dlv debug
- "8080"
- "9080"
- "9000"
- "42069"
- "50832"
ports:
- "${NODE1_PORT_7081:-0.0.0.0:7081}:7081"
- "${NODE1_PORT_8081:-0.0.0.0:8081}:8080"
- "${NODE1_PORT_9081:-0.0.0.0:9081}:9080"
- "${NODE1_PORT_42070:-0.0.0.0:42070}:42069"
- "${NODE1_PORT_50832:-0.0.0.0:50832}:50832"
volumes:
- ${PWD}:/go/src/github.com/pocket-network
Expand All @@ -68,14 +68,14 @@ services:
dockerfile: ./build/Dockerfile.localdev
expose:
- "7082" # dlv debug
- "8080"
- "42069"
- "9080"
- "9000"
- "50832"
ports:
- "${NODE2_PORT_7081:-0.0.0.0:7082}:7081"
- "${NODE2_PORT_8081:-0.0.0.0:8082}:8080"
- "${NODE2_PORT_9081:-0.0.0.0:9082}:9080"
- "${NODE2_PORT_42070:-0.0.0.0:42071}:42069"
- "${NODE2_PORT_50832:-0.0.0.0:50833}:50832"
volumes:
- ${PWD}:/go/src/github.com/pocket-network
Expand All @@ -96,14 +96,14 @@ services:
dockerfile: ./build/Dockerfile.localdev
expose:
- "7083" # dlv debug
- "8080"
- "42069"
- "9080"
- "9000"
- "50832"
ports:
- "${NODE3_PORT_7081:-0.0.0.0:7083}:7081"
- "${NODE3_PORT_8081:-0.0.0.0:8083}:8080"
- "${NODE3_PORT_9081:-0.0.0.0:9083}:9080"
- "${NODE3_PORT_42070:-0.0.0.0:42072}:42069"
- "${NODE3_PORT_50832:-0.0.0.0:50834}:50832"
volumes:
- ${PWD}:/go/src/github.com/pocket-network
Expand All @@ -124,14 +124,14 @@ services:
dockerfile: ./build/Dockerfile.localdev
expose:
- "7084" # dlv debug
- "8080"
- "42069"
- "9080"
- "9000"
- "50832"
ports:
- "${NODE4_PORT_7081:-0.0.0.0:7084}:7081"
- "${NODE4_PORT_8081:-0.0.0.0:8084}:8080"
- "${NODE4_PORT_9081:-0.0.0.0:9084}:9080"
- "${NODE4_PORT_42070:-0.0.0.0:42073}:42069"
- "${NODE4_PORT_50832:-0.0.0.0:50835}:50832"
volumes:
- ${PWD}:/go/src/github.com/pocket-network
Expand Down
8 changes: 8 additions & 0 deletions build/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.19] - 2023-02-27

- replace `consensus_port` with `port` in P2P config
- update default P2P config `port` to from `8080` to `42069`
- add `use_libp2p` field to base config
- add `hostname` field to P2P config
- move `v1-validator-default-config` to a template

## [0.0.0.18] - 2023-02-21

- Rename ServiceNode Actor Type Name to Servicer
Expand Down
6 changes: 5 additions & 1 deletion build/localnet/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ COPY bin/client-linux /usr/local/bin/client
k8s_yaml(
[
"manifests/private-keys.yaml",
"manifests/configs.yaml",
"manifests/network.yaml",
"manifests/roles.yaml",
"manifests/service-accounts.yaml",
Expand All @@ -180,6 +179,11 @@ k8s_yaml(
% localnet_config["validators"]["count"],
quiet=True,
),
local(
"templates/v1-validator-configs-template.sh %s"
% localnet_config["validators"]["count"],
quiet=True,
),
]
)

Expand Down
3 changes: 2 additions & 1 deletion build/localnet/cluster-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func main() {
case watch.Added:
logger.Info().Str("validator", service.Name).Msg("Validator added to the cluster")
// TODO: consolidate args into constants
if err := stakeValidator(privateKey, "150000000001", []string{"0001"}, fmt.Sprintf("v1-validator%s:8080", validatorId)); err != nil {
validatorServiceUrl := fmt.Sprintf("v1-validator%s:%d", validatorId, defaults.DefaultP2PPort)
if err := stakeValidator(privateKey, "150000000001", []string{"0001"}, validatorServiceUrl); err != nil {
logger.Err(err).Msg("Error staking validator")
}
case watch.Deleted:
Expand Down
2 changes: 1 addition & 1 deletion build/localnet/manifests/cli-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
[
"sh",
"-c",
"until nc -z v1-validator001 8080; do echo waiting for v1-validator001...; sleep 2; done;",
"until nc -z v1-validator001 42069; do echo waiting for v1-validator001...; sleep 2; done;",
]
containers:
- name: pocket
Expand Down
2 changes: 1 addition & 1 deletion build/localnet/manifests/cluster-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
[
"sh",
"-c",
"until nc -z v1-validator001 8080; do echo waiting for v1-validator001...; sleep 2; done;",
"until nc -z v1-validator001 42069; do echo waiting for v1-validator001...; sleep 2; done;",
]
containers:
- name: cluster-manager
Expand Down
9 changes: 9 additions & 0 deletions build/localnet/templates/v1-validator-configs-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Usage: v1-validator-template.sh number_of_validators

set -Eeuo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)

for ((i = 1; i <= $1; i++)); do
VALIDATOR_NUMBER=$(printf "%03d" $i) envsubst <"$script_dir/v1-validator-configs.yaml.tpl"
done
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: v1-validator-default-config
bryanchriswhite marked this conversation as resolved.
Show resolved Hide resolved
name: v1-validator-${VALIDATOR_NUMBER}-config
namespace: default
data:
config.json: |
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "",
"use_libp2p": false,
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
Expand All @@ -34,7 +35,8 @@ data:
"health_check_period": "5m"
},
"p2p": {
"consensus_port": 8080,
"hostname": "v1-validator${VALIDATOR_NUMBER}",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
Expand Down Expand Up @@ -4102,7 +4104,7 @@ data:
"address": "00104055c00bed7c983a48aac7dc6335d7c607a7",
"public_key": "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
"chains": null,
"generic_param": "v1-validator001:8080",
"generic_param": "v1-validator001:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4113,7 +4115,7 @@ data:
"address": "00204737d2a165ebe4be3a7d5b0af905b0ea91d8",
"public_key": "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91",
"chains": null,
"generic_param": "v1-validator002:8080",
"generic_param": "v1-validator002:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4124,7 +4126,7 @@ data:
"address": "00304d0101847b37fd62e7bebfbdddecdbb7133e",
"public_key": "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50",
"chains": null,
"generic_param": "v1-validator003:8080",
"generic_param": "v1-validator003:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4135,7 +4137,7 @@ data:
"address": "00404a570febd061274f72b50d0a37f611dfe339",
"public_key": "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45",
"chains": null,
"generic_param": "v1-validator004:8080",
"generic_param": "v1-validator004:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4161,7 +4163,7 @@ data:
"address": "43d9ea9d9ad9c58bb96ec41340f83cb2cabb6496",
"public_key": "16cd0a304c38d76271f74dd3c90325144425d904ef1b9a6fbab9b201d75a998b",
"chains": ["0001"],
"generic_param": "v1-validator001:8080",
"generic_param": "v1-validator001:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand All @@ -4174,7 +4176,7 @@ data:
"address": "9ba047197ec043665ad3f81278ab1f5d3eaf6b8b",
"public_key": "68efd26af01692fcd77dc135ca1de69ede464e8243e6832bd6c37f282db8c9cb",
"chains": ["0001"],
"generic_param": "v1-validator001:8080",
"generic_param": "v1-validator001:42069",
"staked_amount": "1000000000000",
"paused_height": -1,
"unstaking_height": -1,
Expand Down
4 changes: 2 additions & 2 deletions build/localnet/templates/v1-validator-template.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
- -config=/configs/config.json
- -genesis=/genesis.json
ports:
- containerPort: 8080
- containerPort: 42069
name: consensus
- containerPort: 50832
name: rpc
bryanchriswhite marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -106,7 +106,7 @@ metadata:
v1-purpose: validator
spec:
ports:
- port: 8080
- port: 42069
name: consensus
- port: 50832
name: rpc
Expand Down
5 changes: 5 additions & 0 deletions p2p/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.30] - 2023-02-27

- replace `consensus_port` with `port` in P2P config
- update default P2P config `port` to from `8080` to `42069`

## [0.0.0.29] - 2023-02-24

- Update logger value references with pointers
Expand Down
Loading