From 5ad835e05ea40d067affaf99874cbdb7d462abe9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 22 Feb 2023 14:22:28 +0100 Subject: [PATCH 01/21] chore: add `hostname` p2p config field --- build/config/config1.json | 1 + build/config/config2.json | 1 + build/config/config3.json | 1 + build/config/config4.json | 1 + runtime/configs/proto/p2p_config.proto | 15 ++++++++------- runtime/manager_test.go | 3 +++ 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/build/config/config1.json b/build/config/config1.json index a4c548cce..012c2dfe8 100644 --- a/build/config/config1.json +++ b/build/config/config1.json @@ -28,6 +28,7 @@ "health_check_period": "5m" }, "p2p": { + "hostname": "node1.consensus", "consensus_port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, diff --git a/build/config/config2.json b/build/config/config2.json index 0483e0a99..7786b48ed 100644 --- a/build/config/config2.json +++ b/build/config/config2.json @@ -28,6 +28,7 @@ "health_check_period": "5m" }, "p2p": { + "hostname": "node2.consensus", "consensus_port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, diff --git a/build/config/config3.json b/build/config/config3.json index 500ed7145..4150dce5d 100644 --- a/build/config/config3.json +++ b/build/config/config3.json @@ -28,6 +28,7 @@ "health_check_period": "5m" }, "p2p": { + "hostname": "node3.consensus", "consensus_port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, diff --git a/build/config/config4.json b/build/config/config4.json index a5a56843a..c621fb568 100644 --- a/build/config/config4.json +++ b/build/config/config4.json @@ -28,6 +28,7 @@ "health_check_period": "5m" }, "p2p": { + "hostname": "node4.consensus", "consensus_port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, diff --git a/runtime/configs/proto/p2p_config.proto b/runtime/configs/proto/p2p_config.proto index 171bc2db8..f801c41c3 100644 --- a/runtime/configs/proto/p2p_config.proto +++ b/runtime/configs/proto/p2p_config.proto @@ -7,11 +7,12 @@ import "connection.proto"; option go_package = "github.com/pokt-network/pocket/runtime/configs"; message P2PConfig { - string private_key = 1; - uint32 consensus_port = 2; - bool use_rain_tree = 3; - conn.ConnectionType connection_type = 4; - uint64 max_mempool_count = 5; // this is used to limit the number of nonces that can be stored in the mempool, after which a FIFO mechanism is used to remove the oldest nonces and make space for the new ones - bool is_client_only = 6; - string bootstrap_nodes_csv = 7; // string in the format "http://somenode:50832,http://someothernode:50832". Refer to `p2p/module_test.go` for additional details. + string private_key = 1; // hex encoded + string hostname = 2; + uint32 consensus_port = 3; + bool use_rain_tree = 4; + conn.ConnectionType connection_type = 5; + uint64 max_mempool_count = 6; // this is used to limit the number of nonces that can be stored in the mempool, after which a FIFO mechanism is used to remove the oldest nonces and make space for the new ones + bool is_client_only = 7; + string bootstrap_nodes_csv = 8; // string in the format "http://somenode:50832,http://someothernode:50832". Refer to `p2p/module_test.go` for additional details. } diff --git a/runtime/manager_test.go b/runtime/manager_test.go index 3073fc287..43d01bd1e 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4209,6 +4209,7 @@ func TestNewManagerFromReaders(t *testing.T) { }, P2P: &configs.P2PConfig{ PrivateKey: "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", + Hostname: "node1.consensus", ConsensusPort: 8080, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, @@ -4243,6 +4244,7 @@ func TestNewManagerFromReaders(t *testing.T) { args: args{ configReader: strings.NewReader(string(`{ "p2p": { + "hostname": "node1.consensus", "consensus_port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, @@ -4255,6 +4257,7 @@ func TestNewManagerFromReaders(t *testing.T) { config: &configs.Config{ P2P: &configs.P2PConfig{ PrivateKey: "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", + Hostname: "node1.consensus", ConsensusPort: 8080, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, From e8934a7521e6f3fb45b7e416896d216a82b44f8a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 22 Feb 2023 14:47:34 +0100 Subject: [PATCH 02/21] chore: rename `consensus_port` config option to `port` --- build/config/config1.json | 2 +- build/config/config2.json | 2 +- build/config/config3.json | 2 +- build/config/config4.json | 2 +- p2p/transport/transport.go | 2 +- p2p/utils_test.go | 2 +- runtime/configs/config.go | 2 +- runtime/configs/proto/p2p_config.proto | 2 +- runtime/defaults/defaults.go | 2 +- runtime/manager_test.go | 6 +++--- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build/config/config1.json b/build/config/config1.json index 012c2dfe8..5a04ababf 100644 --- a/build/config/config1.json +++ b/build/config/config1.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node1.consensus", - "consensus_port": 8080, + "port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", diff --git a/build/config/config2.json b/build/config/config2.json index 7786b48ed..ceb98a07d 100644 --- a/build/config/config2.json +++ b/build/config/config2.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node2.consensus", - "consensus_port": 8080, + "port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "ba81e6e56d293895b299bc495ae75d490644429a5e0028fabeb5e1871c1098e7eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", diff --git a/build/config/config3.json b/build/config/config3.json index 4150dce5d..56f94a8e3 100644 --- a/build/config/config3.json +++ b/build/config/config3.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node3.consensus", - "consensus_port": 8080, + "port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "25b385b367a827eaafcdb1003bd17a25f2ecc0d10d41f138846f52ae1015aa941041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", diff --git a/build/config/config4.json b/build/config/config4.json index c621fb568..12af5301d 100644 --- a/build/config/config4.json +++ b/build/config/config4.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node4.consensus", - "consensus_port": 8080, + "port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", diff --git a/p2p/transport/transport.go b/p2p/transport/transport.go index c080b8d1e..c9a22f85c 100644 --- a/p2p/transport/transport.go +++ b/p2p/transport/transport.go @@ -45,7 +45,7 @@ type tcpConn struct { } func createTCPListener(cfg *configs.P2PConfig) (*tcpConn, error) { - addr, err := net.ResolveTCPAddr(TCPNetworkLayerProtocol, fmt.Sprintf(":%d", cfg.ConsensusPort)) + addr, err := net.ResolveTCPAddr(TCPNetworkLayerProtocol, fmt.Sprintf(":%d", cfg.Port)) if err != nil { return nil, err } diff --git a/p2p/utils_test.go b/p2p/utils_test.go index 205142842..89633996b 100644 --- a/p2p/utils_test.go +++ b/p2p/utils_test.go @@ -118,7 +118,7 @@ func createMockRuntimeMgrs(t *testing.T, numValidators int) []modules.RuntimeMgr PrivateKey: valKeys[i].String(), P2P: &configs.P2PConfig{ PrivateKey: valKeys[i].String(), - ConsensusPort: 8080, + Port: 8080, UseRainTree: true, ConnectionType: types.ConnectionType_EmptyConnection, }, diff --git a/runtime/configs/config.go b/runtime/configs/config.go index 44af2c544..8be608514 100644 --- a/runtime/configs/config.go +++ b/runtime/configs/config.go @@ -36,7 +36,7 @@ func NewDefaultConfig(options ...func(*Config)) *Config { BlockStorePath: defaults.DefaultPersistenceBlockStorePath, }, P2P: &P2PConfig{ - ConsensusPort: defaults.DefaultP2PConsensusPort, + Port: defaults.DefaultP2PPort, UseRainTree: defaults.DefaultP2PUseRainTree, ConnectionType: defaults.DefaultP2PConnectionType, MaxMempoolCount: defaults.DefaultP2PMaxMempoolCount, diff --git a/runtime/configs/proto/p2p_config.proto b/runtime/configs/proto/p2p_config.proto index f801c41c3..d679e74b5 100644 --- a/runtime/configs/proto/p2p_config.proto +++ b/runtime/configs/proto/p2p_config.proto @@ -9,7 +9,7 @@ option go_package = "github.com/pokt-network/pocket/runtime/configs"; message P2PConfig { string private_key = 1; // hex encoded string hostname = 2; - uint32 consensus_port = 3; + uint32 port = 3; bool use_rain_tree = 4; conn.ConnectionType connection_type = 5; uint64 max_mempool_count = 6; // this is used to limit the number of nonces that can be stored in the mempool, after which a FIFO mechanism is used to remove the oldest nonces and make space for the new ones diff --git a/runtime/defaults/defaults.go b/runtime/defaults/defaults.go index b074bddfc..1e442e2ce 100644 --- a/runtime/defaults/defaults.go +++ b/runtime/defaults/defaults.go @@ -32,7 +32,7 @@ var ( DefaultPersistencePostgresUrl = "postgres://postgres:postgres@pocket-db:5432/postgres" DefaultPersistenceBlockStorePath = "/var/blockstore" // p2p - DefaultP2PConsensusPort = uint32(8080) + DefaultP2PPort = uint32(8080) DefaultP2PUseRainTree = true DefaultP2PConnectionType = types.ConnectionType_TCPConnection DefaultP2PMaxMempoolCount = uint64(1e5) diff --git a/runtime/manager_test.go b/runtime/manager_test.go index 43d01bd1e..dc484a0fd 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4210,7 +4210,7 @@ func TestNewManagerFromReaders(t *testing.T) { P2P: &configs.P2PConfig{ PrivateKey: "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", Hostname: "node1.consensus", - ConsensusPort: 8080, + Port: defaults.DefaultP2PPort, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, MaxMempoolCount: 1e5, @@ -4245,7 +4245,7 @@ func TestNewManagerFromReaders(t *testing.T) { configReader: strings.NewReader(string(`{ "p2p": { "hostname": "node1.consensus", - "consensus_port": 8080, + "port": 8080, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45" @@ -4258,7 +4258,7 @@ func TestNewManagerFromReaders(t *testing.T) { P2P: &configs.P2PConfig{ PrivateKey: "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", Hostname: "node1.consensus", - ConsensusPort: 8080, + Port: 8080, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, MaxMempoolCount: defaults.DefaultP2PMaxMempoolCount, From a350c20af96bd343479aead2ca19a75767996372 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 22 Feb 2023 14:51:49 +0100 Subject: [PATCH 03/21] chore: update default port number to 42069 --- build/config/config1.json | 2 +- build/config/config2.json | 2 +- build/config/config3.json | 2 +- build/config/config4.json | 2 +- build/config/genesis.json | 12 ++++++------ build/deployments/docker-compose.yaml | 16 ++++++++-------- build/localnet/cluster-manager/main.go | 3 ++- p2p/utils_test.go | 4 ++-- runtime/defaults/defaults.go | 2 +- runtime/manager_test.go | 12 ++++++------ runtime/test_artifacts/defaults.go | 2 +- 11 files changed, 30 insertions(+), 29 deletions(-) diff --git a/build/config/config1.json b/build/config/config1.json index 5a04ababf..f174ea84d 100644 --- a/build/config/config1.json +++ b/build/config/config1.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node1.consensus", - "port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", diff --git a/build/config/config2.json b/build/config/config2.json index ceb98a07d..dc5de3b9c 100644 --- a/build/config/config2.json +++ b/build/config/config2.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node2.consensus", - "port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "ba81e6e56d293895b299bc495ae75d490644429a5e0028fabeb5e1871c1098e7eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", diff --git a/build/config/config3.json b/build/config/config3.json index 56f94a8e3..5b44e1b9e 100644 --- a/build/config/config3.json +++ b/build/config/config3.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node3.consensus", - "port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "25b385b367a827eaafcdb1003bd17a25f2ecc0d10d41f138846f52ae1015aa941041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", diff --git a/build/config/config4.json b/build/config/config4.json index 12af5301d..5593c3660 100644 --- a/build/config/config4.json +++ b/build/config/config4.json @@ -29,7 +29,7 @@ }, "p2p": { "hostname": "node4.consensus", - "port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", diff --git a/build/config/genesis.json b/build/config/genesis.json index 0835757c5..32f1264b2 100755 --- a/build/config/genesis.json +++ b/build/config/genesis.json @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/build/deployments/docker-compose.yaml b/build/deployments/docker-compose.yaml index 417ecaab5..e9d3f7395 100755 --- a/build/deployments/docker-compose.yaml +++ b/build/deployments/docker-compose.yaml @@ -37,13 +37,13 @@ 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_8081:-0.0.0.0:42070}:42069" - "${NODE1_PORT_9081:-0.0.0.0:9081}:9080" - "${NODE1_PORT_50832:-0.0.0.0:50832}:50832" volumes: @@ -68,13 +68,13 @@ 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_8081:-0.0.0.0:42071}:42069" - "${NODE2_PORT_9081:-0.0.0.0:9082}:9080" - "${NODE2_PORT_50832:-0.0.0.0:50833}:50832" volumes: @@ -96,13 +96,13 @@ 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_8081:-0.0.0.0:42072}:42069" - "${NODE3_PORT_9081:-0.0.0.0:9083}:9080" - "${NODE3_PORT_50832:-0.0.0.0:50834}:50832" volumes: @@ -124,13 +124,13 @@ 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_8081:-0.0.0.0:42073}:42069" - "${NODE4_PORT_9081:-0.0.0.0:9084}:9080" - "${NODE4_PORT_50832:-0.0.0.0:50835}:50832" volumes: diff --git a/build/localnet/cluster-manager/main.go b/build/localnet/cluster-manager/main.go index 14214bd6a..1830eaf81 100644 --- a/build/localnet/cluster-manager/main.go +++ b/build/localnet/cluster-manager/main.go @@ -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: diff --git a/p2p/utils_test.go b/p2p/utils_test.go index 89633996b..26afd8115 100644 --- a/p2p/utils_test.go +++ b/p2p/utils_test.go @@ -28,7 +28,7 @@ import ( // ~~~~~~ RainTree Unit Test Configurations ~~~~~~ const ( - serviceUrlFormat = "node%d.consensus:8080" + serviceUrlFormat = "node%d.consensus:42069" eventsChannelSize = 10000 // Since we simulate up to a 27 node network, we will pre-generate a n >= 27 number of keys to avoid generation // every time. The genesis config seed start is set for deterministic key generation and 42 was chosen arbitrarily. @@ -118,7 +118,7 @@ func createMockRuntimeMgrs(t *testing.T, numValidators int) []modules.RuntimeMgr PrivateKey: valKeys[i].String(), P2P: &configs.P2PConfig{ PrivateKey: valKeys[i].String(), - Port: 8080, + Port: 42069, UseRainTree: true, ConnectionType: types.ConnectionType_EmptyConnection, }, diff --git a/runtime/defaults/defaults.go b/runtime/defaults/defaults.go index 1e442e2ce..fb35ed60a 100644 --- a/runtime/defaults/defaults.go +++ b/runtime/defaults/defaults.go @@ -32,7 +32,7 @@ var ( DefaultPersistencePostgresUrl = "postgres://postgres:postgres@pocket-db:5432/postgres" DefaultPersistenceBlockStorePath = "/var/blockstore" // p2p - DefaultP2PPort = uint32(8080) + DefaultP2PPort = uint32(42069) DefaultP2PUseRainTree = true DefaultP2PConnectionType = types.ConnectionType_TCPConnection DefaultP2PMaxMempoolCount = uint64(1e5) diff --git a/runtime/manager_test.go b/runtime/manager_test.go index dc484a0fd..57dec5e25 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4079,7 +4079,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00104055c00bed7c983a48aac7dc6335d7c607a7", PublicKey: "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", Chains: nil, - GenericParam: "node1.consensus:8080", + GenericParam: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4090,7 +4090,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00204737d2a165ebe4be3a7d5b0af905b0ea91d8", PublicKey: "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", Chains: nil, - GenericParam: "node2.consensus:8080", + GenericParam: "node2.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4101,7 +4101,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00304d0101847b37fd62e7bebfbdddecdbb7133e", PublicKey: "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", Chains: nil, - GenericParam: "node3.consensus:8080", + GenericParam: "node3.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4112,7 +4112,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00404a570febd061274f72b50d0a37f611dfe339", PublicKey: "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", Chains: nil, - GenericParam: "node4.consensus:8080", + GenericParam: "node4.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4125,7 +4125,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "43d9ea9d9ad9c58bb96ec41340f83cb2cabb6496", PublicKey: "16cd0a304c38d76271f74dd3c90325144425d904ef1b9a6fbab9b201d75a998b", Chains: []string{"0001"}, - GenericParam: "node1.consensus:8080", + GenericParam: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4138,7 +4138,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "9ba047197ec043665ad3f81278ab1f5d3eaf6b8b", PublicKey: "68efd26af01692fcd77dc135ca1de69ede464e8243e6832bd6c37f282db8c9cb", Chains: []string{"0001"}, - GenericParam: "node1.consensus:8080", + GenericParam: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, diff --git a/runtime/test_artifacts/defaults.go b/runtime/test_artifacts/defaults.go index 4419a29d6..cdd566faf 100644 --- a/runtime/test_artifacts/defaults.go +++ b/runtime/test_artifacts/defaults.go @@ -18,6 +18,6 @@ var ( DefaultPauseHeight = int64(-1) DefaultUnstakingHeight = int64(-1) DefaultChainID = "testnet" - ServiceUrlFormat = "node%d.consensus:8080" + ServiceUrlFormat = "node%d.consensus:42069" DefaultMaxBlockBytes = uint64(4000000) ) From e903a7c0a53dd19591b72b93ac3472bbb86ca3d1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 22 Feb 2023 14:58:48 +0100 Subject: [PATCH 04/21] chore: add `use_libp2p` config field --- build/config/config1.json | 1 + build/config/config2.json | 1 + build/config/config3.json | 1 + build/config/config4.json | 1 + runtime/configs/config.go | 2 ++ runtime/defaults/defaults.go | 1 + runtime/manager_test.go | 1 + 7 files changed, 8 insertions(+) diff --git a/build/config/config1.json b/build/config/config1.json index f174ea84d..9d5eec7f1 100644 --- a/build/config/config1.json +++ b/build/config/config1.json @@ -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": { diff --git a/build/config/config2.json b/build/config/config2.json index dc5de3b9c..2e3dd51b5 100644 --- a/build/config/config2.json +++ b/build/config/config2.json @@ -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": { diff --git a/build/config/config3.json b/build/config/config3.json index 5b44e1b9e..a7e2033db 100644 --- a/build/config/config3.json +++ b/build/config/config3.json @@ -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": { diff --git a/build/config/config4.json b/build/config/config4.json index 5593c3660..bf0ac6b4d 100644 --- a/build/config/config4.json +++ b/build/config/config4.json @@ -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": { diff --git a/runtime/configs/config.go b/runtime/configs/config.go index 8be608514..b1317e135 100644 --- a/runtime/configs/config.go +++ b/runtime/configs/config.go @@ -6,6 +6,7 @@ type Config struct { RootDirectory string `json:"root_directory"` PrivateKey string `json:"private_key"` // INVESTIGATE(#150): better architecture for key management (keybase, keyfiles, etc.) ClientDebugMode bool `json:"client_debug_mode"` + UseLibP2P bool `json:"use_lib_p2p"` // Determines if `root/libp2p` or `root/p2p` should be used as the p2p module Consensus *ConsensusConfig `json:"consensus"` Utility *UtilityConfig `json:"utility"` @@ -19,6 +20,7 @@ type Config struct { func NewDefaultConfig(options ...func(*Config)) *Config { cfg := &Config{ RootDirectory: "/go/src/github.com/pocket-network", + UseLibP2P: defaults.DefaultUseLibp2p, Consensus: &ConsensusConfig{ MaxMempoolBytes: defaults.DefaultConsensusMaxMempoolBytes, PacemakerConfig: &PacemakerConfig{ diff --git a/runtime/defaults/defaults.go b/runtime/defaults/defaults.go index fb35ed60a..7f56b4757 100644 --- a/runtime/defaults/defaults.go +++ b/runtime/defaults/defaults.go @@ -18,6 +18,7 @@ const ( var ( DefaultRemoteCLIURL = fmt.Sprintf("http://%s:%s", DefaultRPCHost, DefaultRPCPort) + DefaultUseLibp2p = false // consensus DefaultConsensusMaxMempoolBytes = uint64(500000000) diff --git a/runtime/manager_test.go b/runtime/manager_test.go index 57dec5e25..22c0db67e 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4181,6 +4181,7 @@ func TestNewManagerFromReaders(t *testing.T) { config: &configs.Config{ RootDirectory: "/go/src/github.com/pocket-network", PrivateKey: "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", + UseLibP2P: false, Consensus: &configs.ConsensusConfig{ PrivateKey: "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", MaxMempoolBytes: 500000000, From 4b37d9858b0b46fa1802820a4a559cca3a31f1e6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 23 Feb 2023 09:54:40 +0100 Subject: [PATCH 05/21] chore: update persistence state hash test --- persistence/test/state_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/persistence/test/state_test.go b/persistence/test/state_test.go index 53bc0d415..c64cd6cda 100644 --- a/persistence/test/state_test.go +++ b/persistence/test/state_test.go @@ -46,9 +46,9 @@ func TestStateHash_DeterministicStateWhenUpdatingAppStake(t *testing.T) { // logic changes, these hashes will need to be updated based on the test output. // TODO: Add an explicit updateSnapshots flag to the test to make this more clear. stateHashes := []string{ - "4e781020ad767db9bedc9d64bb30c69a5f1d94a57049c74a6f6e26d8ff3046bc", - "01786ad7ebd82641b5fa040798edf9eaebc07ac34bdcbd7e089c75ef09f730ee", - "fa3682d967de200686d0567ff2ab3568372decd91a7a94112d0c1ce493eee2c0", + "76843ece29fa23e53ece84ae9960f3be1cb8c882fb56f2ac9d83eac109d0ef75", + "c0bc334153d879e6569f29a2da1825cfdf1efeebe4cf09850c66452d034dfa6e", + "5f7f394ce2e68e76542e6db28966c0be0eda5fdb205a6ebe43a8fe57c4234327", } stakeAmount := initialStakeAmount From 0ef658280822e39d438719b38866d369dd1a601c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 24 Feb 2023 13:37:16 +0100 Subject: [PATCH 06/21] fix: docker composition / .env ports --- build/deployments/.env.example | 8 ++++---- build/deployments/docker-compose.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build/deployments/.env.example b/build/deployments/.env.example index 0785b0ea7..7d06705c2 100644 --- a/build/deployments/.env.example +++ b/build/deployments/.env.example @@ -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 diff --git a/build/deployments/docker-compose.yaml b/build/deployments/docker-compose.yaml index e9d3f7395..d44f71faf 100755 --- a/build/deployments/docker-compose.yaml +++ b/build/deployments/docker-compose.yaml @@ -43,8 +43,8 @@ services: - "50832" ports: - "${NODE1_PORT_7081:-0.0.0.0:7081}:7081" - - "${NODE1_PORT_8081:-0.0.0.0:42070}:42069" - "${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 @@ -74,8 +74,8 @@ services: - "50832" ports: - "${NODE2_PORT_7081:-0.0.0.0:7082}:7081" - - "${NODE2_PORT_8081:-0.0.0.0:42071}:42069" - "${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 @@ -102,8 +102,8 @@ services: - "50832" ports: - "${NODE3_PORT_7081:-0.0.0.0:7083}:7081" - - "${NODE3_PORT_8081:-0.0.0.0:42072}:42069" - "${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 @@ -130,8 +130,8 @@ services: - "50832" ports: - "${NODE4_PORT_7081:-0.0.0.0:7084}:7081" - - "${NODE4_PORT_8081:-0.0.0.0:42073}:42069" - "${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 From 0df649a7c78bfb2f3455abfe301af0c9641110dc Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 24 Feb 2023 14:52:14 +0100 Subject: [PATCH 07/21] chore: update k8s manifests p2p config port --- build/localnet/manifests/cli-client.yaml | 2 +- build/localnet/manifests/cluster-manager.yaml | 2 +- build/localnet/manifests/configs.yaml | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build/localnet/manifests/cli-client.yaml b/build/localnet/manifests/cli-client.yaml index f848b4a5b..3d3e77cbb 100644 --- a/build/localnet/manifests/cli-client.yaml +++ b/build/localnet/manifests/cli-client.yaml @@ -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 diff --git a/build/localnet/manifests/cluster-manager.yaml b/build/localnet/manifests/cluster-manager.yaml index 31845897e..83c1d8fa2 100644 --- a/build/localnet/manifests/cluster-manager.yaml +++ b/build/localnet/manifests/cluster-manager.yaml @@ -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 diff --git a/build/localnet/manifests/configs.yaml b/build/localnet/manifests/configs.yaml index 93e949b0f..b3944abb7 100644 --- a/build/localnet/manifests/configs.yaml +++ b/build/localnet/manifests/configs.yaml @@ -34,7 +34,7 @@ data: "health_check_period": "5m" }, "p2p": { - "consensus_port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", @@ -4102,7 +4102,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, @@ -4113,7 +4113,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, @@ -4124,7 +4124,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, @@ -4135,7 +4135,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, @@ -4161,7 +4161,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, @@ -4174,7 +4174,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, From bf58cc5db789c374b7e140c7ccd1267abe1d71ac Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 22 Feb 2023 19:50:53 +0100 Subject: [PATCH 08/21] chore: update changelogs --- build/docs/CHANGELOG.md | 7 +++++++ p2p/CHANGELOG.md | 5 +++++ persistence/docs/CHANGELOG.md | 4 ++++ runtime/docs/CHANGELOG.md | 7 +++++++ 4 files changed, 23 insertions(+) diff --git a/build/docs/CHANGELOG.md b/build/docs/CHANGELOG.md index 4b77a21f7..40d89d673 100644 --- a/build/docs/CHANGELOG.md +++ b/build/docs/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.0.19] - 2023-02-24 + +- 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 + ## [0.0.0.18] - 2023-02-21 - Rename ServiceNode Actor Type Name to Servicer diff --git a/p2p/CHANGELOG.md b/p2p/CHANGELOG.md index 5f35a5c2e..7f131c020 100644 --- a/p2p/CHANGELOG.md +++ b/p2p/CHANGELOG.md @@ -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-24 + +- 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 diff --git a/persistence/docs/CHANGELOG.md b/persistence/docs/CHANGELOG.md index 4ead54401..d070f5ab0 100644 --- a/persistence/docs/CHANGELOG.md +++ b/persistence/docs/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.0.39] - 2023-02-24 + +- Update state hash test after modifying genesis (updated port numbers) + ## [0.0.0.38] - 2023-02-24 - Update logger value references with pointers diff --git a/runtime/docs/CHANGELOG.md b/runtime/docs/CHANGELOG.md index 033fbbf8d..90216157a 100644 --- a/runtime/docs/CHANGELOG.md +++ b/runtime/docs/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.0.24] - 2023-02-24 + +- 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 + ## [0.0.0.23] - 2023-02-21 - Rename ServiceNode Actor Type Name to Servicer From 4c19fbbe4324067b953928b78d9dd18fbfe32b9d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 24 Feb 2023 15:11:11 +0100 Subject: [PATCH 09/21] fix: update port numbers in tests --- p2p/module_test.go | 2 +- runtime/manager_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/p2p/module_test.go b/p2p/module_test.go index cd8af1258..7e79d5653 100644 --- a/p2p/module_test.go +++ b/p2p/module_test.go @@ -83,7 +83,7 @@ func Test_Create_configureBootstrapNodes(t *testing.T) { { name: "negative port number yields an error and empty list of bootstrap nodes", args: args{ - initialBootstrapNodesCsv: "udp://somenode:-8080", + initialBootstrapNodesCsv: "udp://somenode:-42069", }, wantBootstrapNodes: []string(nil), wantErr: true, diff --git a/runtime/manager_test.go b/runtime/manager_test.go index 22c0db67e..4e3383833 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4246,7 +4246,7 @@ func TestNewManagerFromReaders(t *testing.T) { configReader: strings.NewReader(string(`{ "p2p": { "hostname": "node1.consensus", - "port": 8080, + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45" @@ -4259,7 +4259,7 @@ func TestNewManagerFromReaders(t *testing.T) { P2P: &configs.P2PConfig{ PrivateKey: "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", Hostname: "node1.consensus", - Port: 8080, + Port: 42069, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, MaxMempoolCount: defaults.DefaultP2PMaxMempoolCount, From 2a379c38e75cfe7c5de93893f5058a42f0f61659 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 24 Feb 2023 15:13:51 +0100 Subject: [PATCH 10/21] chore: add `use_libp2p` to k8s configs --- build/localnet/manifests/configs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/build/localnet/manifests/configs.yaml b/build/localnet/manifests/configs.yaml index b3944abb7..a5fd68515 100644 --- a/build/localnet/manifests/configs.yaml +++ b/build/localnet/manifests/configs.yaml @@ -8,6 +8,7 @@ data: { "root_directory": "/go/src/github.com/pocket-network", "private_key": "", + "use_libp2p": false, "consensus": { "max_mempool_bytes": 500000000, "pacemaker_config": { From 8643a0a20689036c038ef344c06c577e230ebf9a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 24 Feb 2023 15:21:21 +0100 Subject: [PATCH 11/21] chore: update k8s validator template --- build/localnet/templates/v1-validator-template.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/localnet/templates/v1-validator-template.yaml.tpl b/build/localnet/templates/v1-validator-template.yaml.tpl index 7f0b38086..b7600dd07 100644 --- a/build/localnet/templates/v1-validator-template.yaml.tpl +++ b/build/localnet/templates/v1-validator-template.yaml.tpl @@ -29,7 +29,7 @@ spec: - -config=/configs/config.json - -genesis=/genesis.json ports: - - containerPort: 8080 + - containerPort: 42069 name: consensus - containerPort: 50832 name: rpc @@ -106,7 +106,7 @@ metadata: v1-purpose: validator spec: ports: - - port: 8080 + - port: 42069 name: consensus - port: 50832 name: rpc From 7eb373c3d942de9a57ec4109e5fb753ed349f1e7 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 27 Feb 2023 11:00:01 +0100 Subject: [PATCH 12/21] chore: make ConfigMap a template --- build/localnet/Tiltfile | 6 +++++- .../localnet/templates/v1-validator-configs-template.sh | 9 +++++++++ .../v1-validator-configs.yaml.tpl} | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 build/localnet/templates/v1-validator-configs-template.sh rename build/localnet/{manifests/configs.yaml => templates/v1-validator-configs.yaml.tpl} (99%) diff --git a/build/localnet/Tiltfile b/build/localnet/Tiltfile index e682fa4d2..ec9edc4ba 100644 --- a/build/localnet/Tiltfile +++ b/build/localnet/Tiltfile @@ -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", @@ -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, + ), ] ) diff --git a/build/localnet/templates/v1-validator-configs-template.sh b/build/localnet/templates/v1-validator-configs-template.sh new file mode 100755 index 000000000..841fee8c7 --- /dev/null +++ b/build/localnet/templates/v1-validator-configs-template.sh @@ -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 diff --git a/build/localnet/manifests/configs.yaml b/build/localnet/templates/v1-validator-configs.yaml.tpl similarity index 99% rename from build/localnet/manifests/configs.yaml rename to build/localnet/templates/v1-validator-configs.yaml.tpl index a5fd68515..e046dcd30 100644 --- a/build/localnet/manifests/configs.yaml +++ b/build/localnet/templates/v1-validator-configs.yaml.tpl @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: v1-validator-default-config + name: v1-validator-${VALIDATOR_NUMBER}-config namespace: default data: config.json: | From 5b7c47720e9a50718d5487beb5e8d8a4e703f625 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 27 Feb 2023 11:01:46 +0100 Subject: [PATCH 13/21] chore: add hostname to ConfigMap --- build/localnet/templates/v1-validator-configs.yaml.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/build/localnet/templates/v1-validator-configs.yaml.tpl b/build/localnet/templates/v1-validator-configs.yaml.tpl index e046dcd30..359961175 100644 --- a/build/localnet/templates/v1-validator-configs.yaml.tpl +++ b/build/localnet/templates/v1-validator-configs.yaml.tpl @@ -35,6 +35,7 @@ data: "health_check_period": "5m" }, "p2p": { + "hostname": "v1-validator${VALIDATOR_NUMBER}", "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, From a01610ff7d847f4a3ba2da6386795c52d6cb15ce Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 27 Feb 2023 11:25:47 +0100 Subject: [PATCH 14/21] chore: update changelog --- build/docs/CHANGELOG.md | 3 ++- p2p/CHANGELOG.md | 2 +- persistence/docs/CHANGELOG.md | 2 +- runtime/docs/CHANGELOG.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/docs/CHANGELOG.md b/build/docs/CHANGELOG.md index 40d89d673..d87a974ea 100644 --- a/build/docs/CHANGELOG.md +++ b/build/docs/CHANGELOG.md @@ -7,12 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.19] - 2023-02-24 +## [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 diff --git a/p2p/CHANGELOG.md b/p2p/CHANGELOG.md index 7f131c020..b34494b2a 100644 --- a/p2p/CHANGELOG.md +++ b/p2p/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.30] - 2023-02-24 +## [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` diff --git a/persistence/docs/CHANGELOG.md b/persistence/docs/CHANGELOG.md index d070f5ab0..751325509 100644 --- a/persistence/docs/CHANGELOG.md +++ b/persistence/docs/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.39] - 2023-02-24 +## [0.0.0.39] - 2023-02-27 - Update state hash test after modifying genesis (updated port numbers) diff --git a/runtime/docs/CHANGELOG.md b/runtime/docs/CHANGELOG.md index 90216157a..6e855309d 100644 --- a/runtime/docs/CHANGELOG.md +++ b/runtime/docs/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.24] - 2023-02-24 +## [0.0.0.24] - 2023-02-27 - replace `consensus_port` with `port` in P2P config - update default P2P config `port` to from `8080` to `42069` From a073faec9643d17b9189838c4013284aded7c97d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 11:11:40 +0100 Subject: [PATCH 15/21] Revert "chore: make ConfigMap a template" This reverts commit 7eb373c3d942de9a57ec4109e5fb753ed349f1e7. --- build/localnet/Tiltfile | 6 +----- .../configs.yaml} | 2 +- .../localnet/templates/v1-validator-configs-template.sh | 9 --------- 3 files changed, 2 insertions(+), 15 deletions(-) rename build/localnet/{templates/v1-validator-configs.yaml.tpl => manifests/configs.yaml} (99%) delete mode 100755 build/localnet/templates/v1-validator-configs-template.sh diff --git a/build/localnet/Tiltfile b/build/localnet/Tiltfile index ec9edc4ba..e682fa4d2 100644 --- a/build/localnet/Tiltfile +++ b/build/localnet/Tiltfile @@ -161,6 +161,7 @@ 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", @@ -179,11 +180,6 @@ k8s_yaml( % localnet_config["validators"]["count"], quiet=True, ), - local( - "templates/v1-validator-configs-template.sh %s" - % localnet_config["validators"]["count"], - quiet=True, - ), ] ) diff --git a/build/localnet/templates/v1-validator-configs.yaml.tpl b/build/localnet/manifests/configs.yaml similarity index 99% rename from build/localnet/templates/v1-validator-configs.yaml.tpl rename to build/localnet/manifests/configs.yaml index 359961175..7c0687899 100644 --- a/build/localnet/templates/v1-validator-configs.yaml.tpl +++ b/build/localnet/manifests/configs.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: v1-validator-${VALIDATOR_NUMBER}-config + name: v1-validator-default-config namespace: default data: config.json: | diff --git a/build/localnet/templates/v1-validator-configs-template.sh b/build/localnet/templates/v1-validator-configs-template.sh deleted file mode 100755 index 841fee8c7..000000000 --- a/build/localnet/templates/v1-validator-configs-template.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/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 From fae0410335a2050105d9e2dba9f6795ed871c1f1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 11:20:07 +0100 Subject: [PATCH 16/21] chore: add localnet hostname via env var --- build/localnet/manifests/configs.yaml | 1 - build/localnet/templates/v1-validator-template.yaml.tpl | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/localnet/manifests/configs.yaml b/build/localnet/manifests/configs.yaml index 7c0687899..a5fd68515 100644 --- a/build/localnet/manifests/configs.yaml +++ b/build/localnet/manifests/configs.yaml @@ -35,7 +35,6 @@ data: "health_check_period": "5m" }, "p2p": { - "hostname": "v1-validator${VALIDATOR_NUMBER}", "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, diff --git a/build/localnet/templates/v1-validator-template.yaml.tpl b/build/localnet/templates/v1-validator-template.yaml.tpl index b7600dd07..bbcb1b480 100644 --- a/build/localnet/templates/v1-validator-template.yaml.tpl +++ b/build/localnet/templates/v1-validator-template.yaml.tpl @@ -63,6 +63,8 @@ spec: value: "postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)" - name: POCKET_PERSISTENCE_NODE_SCHEMA value: validator${VALIDATOR_NUMBER} + - name: POCKET_P2P_HOSTNAME + value: "v1-validator${VALIDATOR_NUMBER}" volumeMounts: - name: config-volume mountPath: /configs From 7e79a335759910aa560c70ce9714df15918d0065 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 11:21:59 +0100 Subject: [PATCH 17/21] chore: update changelog --- build/docs/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/docs/CHANGELOG.md b/build/docs/CHANGELOG.md index d87a974ea..fb1de9ea5 100644 --- a/build/docs/CHANGELOG.md +++ b/build/docs/CHANGELOG.md @@ -7,13 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.19] - 2023-02-27 +## [0.0.0.19] - 2023-02-28 - 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 From 743d5cb0c9ecdc133bca0950830a0ae724007307 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 15:25:30 +0100 Subject: [PATCH 18/21] test: replace literal with constant --- p2p/utils_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/p2p/utils_test.go b/p2p/utils_test.go index 26afd8115..4e3d9fa7b 100644 --- a/p2p/utils_test.go +++ b/p2p/utils_test.go @@ -9,20 +9,22 @@ import ( "time" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/pokt-network/pocket/p2p/providers/addrbook_provider" "github.com/pokt-network/pocket/p2p/providers/current_height_provider" typesP2P "github.com/pokt-network/pocket/p2p/types" mocksP2P "github.com/pokt-network/pocket/p2p/types/mocks" "github.com/pokt-network/pocket/runtime" "github.com/pokt-network/pocket/runtime/configs" - types "github.com/pokt-network/pocket/runtime/configs/types" + "github.com/pokt-network/pocket/runtime/configs/types" + "github.com/pokt-network/pocket/runtime/defaults" "github.com/pokt-network/pocket/runtime/genesis" coreTypes "github.com/pokt-network/pocket/shared/core/types" cryptoPocket "github.com/pokt-network/pocket/shared/crypto" "github.com/pokt-network/pocket/shared/modules" mockModules "github.com/pokt-network/pocket/shared/modules/mocks" "github.com/pokt-network/pocket/telemetry" - "github.com/stretchr/testify/require" ) // ~~~~~~ RainTree Unit Test Configurations ~~~~~~ @@ -118,7 +120,7 @@ func createMockRuntimeMgrs(t *testing.T, numValidators int) []modules.RuntimeMgr PrivateKey: valKeys[i].String(), P2P: &configs.P2PConfig{ PrivateKey: valKeys[i].String(), - Port: 42069, + Port: defaults.DefaultP2PPort, UseRainTree: true, ConnectionType: types.ConnectionType_EmptyConnection, }, From 4278b651bf2fe22e0c40b9fb4ec98e2c41e1cdc9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 15:37:24 +0100 Subject: [PATCH 19/21] chore: update changelog --- p2p/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/CHANGELOG.md b/p2p/CHANGELOG.md index b34494b2a..4dd3393ad 100644 --- a/p2p/CHANGELOG.md +++ b/p2p/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.30] - 2023-02-27 +## [0.0.0.30] - 2023-02-28 - replace `consensus_port` with `port` in P2P config - update default P2P config `port` to from `8080` to `42069` From 06979c16396c92bda6238b45991af1d6032513cc Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 28 Feb 2023 20:45:32 +0100 Subject: [PATCH 20/21] chore: update changelog --- persistence/docs/CHANGELOG.md | 2 +- runtime/docs/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence/docs/CHANGELOG.md b/persistence/docs/CHANGELOG.md index 751325509..a922f4ad1 100644 --- a/persistence/docs/CHANGELOG.md +++ b/persistence/docs/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.39] - 2023-02-27 +## [0.0.0.39] - 2023-02-28 - Update state hash test after modifying genesis (updated port numbers) diff --git a/runtime/docs/CHANGELOG.md b/runtime/docs/CHANGELOG.md index 6e855309d..6f9234d49 100644 --- a/runtime/docs/CHANGELOG.md +++ b/runtime/docs/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.0.24] - 2023-02-27 +## [0.0.0.24] - 2023-02-28 - replace `consensus_port` with `port` in P2P config - update default P2P config `port` to from `8080` to `42069` From a931eb03a0a91715016b0a8a3ddbd2e962cfdade Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 1 Mar 2023 11:15:02 +0100 Subject: [PATCH 21/21] fix: state hash test post-merge --- persistence/test/state_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/persistence/test/state_test.go b/persistence/test/state_test.go index 4cb77f4c3..275eb1005 100644 --- a/persistence/test/state_test.go +++ b/persistence/test/state_test.go @@ -46,9 +46,9 @@ func TestStateHash_DeterministicStateWhenUpdatingAppStake(t *testing.T) { // logic changes, these hashes will need to be updated based on the test output. // TODO: Add an explicit updateSnapshots flag to the test to make this more clear. stateHashes := []string{ - "3c2ed817d9311d95f083ae8422ead660cf2dd56505cfd332bb0b56449791d3dc", - "b8d57c4c41eb37862673f6203a6fe87dd17d4036f5d87b8f34dca921f8a05e9a", - "4e6cee965c48678acc30ac714c317bac5f1ce8f876a97dc32d7673b7ccf105f0", + "86fa89b366aaa42685122d019071377cec8de3cc9f436895307dda937090edf5", + "8d1447be2b5ed72c84c6351a6ebc47c49c7a00f27e362e506fe15e7fd069ff8c", + "c62ccfc48106161930b9d0f64ef2b5885dabaae9f2a34728de28b0e80530fb15", } stakeAmount := initialStakeAmount