diff --git a/build/config/config1.json b/build/config/config1.json index a4c548cce..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": { @@ -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", diff --git a/build/config/config2.json b/build/config/config2.json index 0483e0a99..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": { @@ -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", diff --git a/build/config/config3.json b/build/config/config3.json index 500ed7145..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": { @@ -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", diff --git a/build/config/config4.json b/build/config/config4.json index a5a56843a..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": { @@ -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", diff --git a/build/config/genesis.json b/build/config/genesis.json index 2f02e8fd6..1d9f36931 100755 --- a/build/config/genesis.json +++ b/build/config/genesis.json @@ -4040,7 +4040,7 @@ "address": "00104055c00bed7c983a48aac7dc6335d7c607a7", "public_key": "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", "chains": null, - "service_url": "node1.consensus:8080", + "service_url": "node1.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4051,7 +4051,7 @@ "address": "00204737d2a165ebe4be3a7d5b0af905b0ea91d8", "public_key": "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", "chains": null, - "service_url": "node2.consensus:8080", + "service_url": "node2.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4062,7 +4062,7 @@ "address": "00304d0101847b37fd62e7bebfbdddecdbb7133e", "public_key": "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", "chains": null, - "service_url": "node3.consensus:8080", + "service_url": "node3.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4073,7 +4073,7 @@ "address": "00404a570febd061274f72b50d0a37f611dfe339", "public_key": "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", "chains": null, - "service_url": "node4.consensus:8080", + "service_url": "node4.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4098,7 +4098,7 @@ "address": "43d9ea9d9ad9c58bb96ec41340f83cb2cabb6496", "public_key": "16cd0a304c38d76271f74dd3c90325144425d904ef1b9a6fbab9b201d75a998b", "chains": ["0001"], - "service_url": "node1.consensus:8080", + "service_url": "node1.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4111,7 +4111,7 @@ "address": "9ba047197ec043665ad3f81278ab1f5d3eaf6b8b", "public_key": "68efd26af01692fcd77dc135ca1de69ede464e8243e6832bd6c37f282db8c9cb", "chains": ["0001"], - "service_url": "node1.consensus:8080", + "service_url": "node1.consensus:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, 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 417ecaab5..d44f71faf 100755 --- a/build/deployments/docker-compose.yaml +++ b/build/deployments/docker-compose.yaml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/build/docs/CHANGELOG.md b/build/docs/CHANGELOG.md index 8e70e2aad..f06bda3a2 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.20] - 2023-03-01 + +- 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.19] - 2023-02-28 - Renamed `generic_param` to `service_url` in the config files diff --git a/build/localnet/cluster-manager/main.go b/build/localnet/cluster-manager/main.go index 25b6a4c4f..9ab008c06 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/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 117ccc5c4..e0067d019 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": { @@ -34,7 +35,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 +4103,7 @@ data: "address": "00104055c00bed7c983a48aac7dc6335d7c607a7", "public_key": "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", "chains": null, - "service_url": "v1-validator001:8080", + "service_url": "v1-validator001:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4113,7 +4114,7 @@ data: "address": "00204737d2a165ebe4be3a7d5b0af905b0ea91d8", "public_key": "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", "chains": null, - "service_url": "v1-validator002:8080", + "service_url": "v1-validator002:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4124,7 +4125,7 @@ data: "address": "00304d0101847b37fd62e7bebfbdddecdbb7133e", "public_key": "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", "chains": null, - "service_url": "v1-validator003:8080", + "service_url": "v1-validator003:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4135,7 +4136,7 @@ data: "address": "00404a570febd061274f72b50d0a37f611dfe339", "public_key": "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", "chains": null, - "service_url": "v1-validator004:8080", + "service_url": "v1-validator004:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4160,7 +4161,7 @@ data: "address": "43d9ea9d9ad9c58bb96ec41340f83cb2cabb6496", "public_key": "16cd0a304c38d76271f74dd3c90325144425d904ef1b9a6fbab9b201d75a998b", "chains": ["0001"], - "service_url": "v1-validator001:8080", + "service_url": "v1-validator001:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, @@ -4173,7 +4174,7 @@ data: "address": "9ba047197ec043665ad3f81278ab1f5d3eaf6b8b", "public_key": "68efd26af01692fcd77dc135ca1de69ede464e8243e6832bd6c37f282db8c9cb", "chains": ["0001"], - "service_url": "v1-validator001:8080", + "service_url": "v1-validator001:42069", "staked_amount": "1000000000000", "paused_height": -1, "unstaking_height": -1, diff --git a/build/localnet/templates/v1-validator-template.yaml.tpl b/build/localnet/templates/v1-validator-template.yaml.tpl index 7f0b38086..bbcb1b480 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 @@ -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 @@ -106,7 +108,7 @@ metadata: v1-purpose: validator spec: ports: - - port: 8080 + - port: 42069 name: consensus - port: 50832 name: rpc diff --git a/p2p/CHANGELOG.md b/p2p/CHANGELOG.md index 1ee783378..8d72cd114 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.31] - 2023-03-01 + +- replace `consensus_port` with `port` in P2P config +- update default P2P config `port` to from `8080` to `42069` + ## [0.0.0.30] - 2023-02-28 - Renamed package names and parameters to reflect changes in the rest of the codebase @@ -64,7 +69,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.0.19] - 2023-01-19 - Rewrite `interface{}` to `any` - ## [0.0.0.18] - 2023-01-11 - Add a lock to the mempool to avoid parallel messages which has caused the node to crash in the past 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/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 6859cada2..7668b530c 100644 --- a/p2p/utils_test.go +++ b/p2p/utils_test.go @@ -9,13 +9,16 @@ 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" "github.com/pokt-network/pocket/runtime/test_artifacts" coreTypes "github.com/pokt-network/pocket/shared/core/types" @@ -23,13 +26,12 @@ import ( "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 ~~~~~~ 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. @@ -119,7 +121,7 @@ func createMockRuntimeMgrs(t *testing.T, numValidators int) []modules.RuntimeMgr PrivateKey: valKeys[i].String(), P2P: &configs.P2PConfig{ PrivateKey: valKeys[i].String(), - ConsensusPort: 8080, + Port: defaults.DefaultP2PPort, UseRainTree: true, ConnectionType: types.ConnectionType_EmptyConnection, }, diff --git a/persistence/docs/CHANGELOG.md b/persistence/docs/CHANGELOG.md index 125284a7f..c5bd89e74 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.40] - 2023-03-01 + +- Update state hash test after modifying genesis (updated port numbers) + ## [0.0.0.39] - 2023-02-28 - Renamed package names and parameters to reflect changes in the rest of the codebase 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 diff --git a/runtime/configs/config.go b/runtime/configs/config.go index b7cd5a51b..018a3ac67 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{ @@ -36,7 +38,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 171bc2db8..d679e74b5 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 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/defaults/defaults.go b/runtime/defaults/defaults.go index a17bb03c8..131d3b6eb 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) @@ -32,7 +33,7 @@ var ( DefaultPersistencePostgresURL = "postgres://postgres:postgres@pocket-db:5432/postgres" DefaultPersistenceBlockStorePath = "/var/blockstore" // p2p - DefaultP2PConsensusPort = uint32(8080) + DefaultP2PPort = uint32(42069) DefaultP2PUseRainTree = true DefaultP2PConnectionType = types.ConnectionType_TCPConnection DefaultP2PMaxMempoolCount = uint64(1e5) diff --git a/runtime/docs/CHANGELOG.md b/runtime/docs/CHANGELOG.md index 88408fae3..af8b89759 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.25] - 2023-03-01 + +- 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.24] - 2023-02-28 - Rename `app_staking_adjustment` to `app_session_tokens_multiplier` diff --git a/runtime/manager_test.go b/runtime/manager_test.go index 98d9b705f..b9f3873f5 100644 --- a/runtime/manager_test.go +++ b/runtime/manager_test.go @@ -4078,7 +4078,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00104055c00bed7c983a48aac7dc6335d7c607a7", PublicKey: "dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", Chains: nil, - ServiceUrl: "node1.consensus:8080", + ServiceUrl: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4089,7 +4089,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00204737d2a165ebe4be3a7d5b0af905b0ea91d8", PublicKey: "eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91", Chains: nil, - ServiceUrl: "node2.consensus:8080", + ServiceUrl: "node2.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4100,7 +4100,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00304d0101847b37fd62e7bebfbdddecdbb7133e", PublicKey: "1041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50", Chains: nil, - ServiceUrl: "node3.consensus:8080", + ServiceUrl: "node3.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4111,7 +4111,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "00404a570febd061274f72b50d0a37f611dfe339", PublicKey: "d6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", Chains: nil, - ServiceUrl: "node4.consensus:8080", + ServiceUrl: "node4.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4124,7 +4124,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "43d9ea9d9ad9c58bb96ec41340f83cb2cabb6496", PublicKey: "16cd0a304c38d76271f74dd3c90325144425d904ef1b9a6fbab9b201d75a998b", Chains: []string{"0001"}, - ServiceUrl: "node1.consensus:8080", + ServiceUrl: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4137,7 +4137,7 @@ var expectedGenesis = &genesis.GenesisState{ Address: "9ba047197ec043665ad3f81278ab1f5d3eaf6b8b", PublicKey: "68efd26af01692fcd77dc135ca1de69ede464e8243e6832bd6c37f282db8c9cb", Chains: []string{"0001"}, - ServiceUrl: "node1.consensus:8080", + ServiceUrl: "node1.consensus:42069", StakedAmount: "1000000000000", PausedHeight: -1, UnstakingHeight: -1, @@ -4180,6 +4180,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, @@ -4208,7 +4209,8 @@ func TestNewManagerFromReaders(t *testing.T) { }, P2P: &configs.P2PConfig{ PrivateKey: "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e", - ConsensusPort: 8080, + Hostname: "node1.consensus", + Port: defaults.DefaultP2PPort, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, MaxMempoolCount: 1e5, @@ -4242,7 +4244,8 @@ func TestNewManagerFromReaders(t *testing.T) { args: args{ configReader: strings.NewReader(string(`{ "p2p": { - "consensus_port": 8080, + "hostname": "node1.consensus", + "port": 42069, "use_rain_tree": true, "is_empty_connection_type": false, "private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45" @@ -4254,7 +4257,8 @@ func TestNewManagerFromReaders(t *testing.T) { config: &configs.Config{ P2P: &configs.P2PConfig{ PrivateKey: "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45", - ConsensusPort: 8080, + Hostname: "node1.consensus", + Port: 42069, UseRainTree: true, ConnectionType: configTypes.ConnectionType_TCPConnection, MaxMempoolCount: defaults.DefaultP2PMaxMempoolCount, diff --git a/runtime/test_artifacts/defaults.go b/runtime/test_artifacts/defaults.go index 6f64e25f3..64258dd04 100644 --- a/runtime/test_artifacts/defaults.go +++ b/runtime/test_artifacts/defaults.go @@ -16,6 +16,6 @@ var ( DefaultPauseHeight = int64(-1) DefaultUnstakingHeight = int64(-1) DefaultChainID = "testnet" - ServiceURLFormat = "node%d.consensus:8080" + ServiceURLFormat = "node%d.consensus:42069" DefaultMaxBlockBytes = uint64(4000000) )