Skip to content

Commit

Permalink
Merge remote-tracking branch 'pokt/main' into refactor/peerstore-prov…
Browse files Browse the repository at this point in the history
…ider

* pokt/main:
  Consensus/readme (#777)
  chore: add `--build-tags` flag to `go_lint` make target (#807)
  [Core] Deploying all-the-protocol-actors (#710)
  Add github wiki tag to devlog8
  Add README for Devlog8 for iteration17 (#805)
  • Loading branch information
bryanchriswhite committed Jun 8, 2023
2 parents 9cee9dd + f72e1f0 commit 2489b92
Show file tree
Hide file tree
Showing 72 changed files with 2,608 additions and 393 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/var
.idea
.vscode
.github
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ go_clean_deps: ## Runs `go mod tidy` && `go mod vendor`

.PHONY: go_lint
go_lint: ## Run all linters that are triggered by the CI pipeline
docker run -t --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.51.1 golangci-lint run -v --timeout 2m
docker run -t --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.51.1 golangci-lint run -v --timeout 2m --build-tags "test"

.PHONY: go_imports
go_imports: ## Group imports using rinchsan/gosimports
Expand Down Expand Up @@ -164,11 +164,11 @@ build_and_watch: ## Continous build Pocket's main entrypoint as files change
# TODO(olshansky): Need to think of a Pocket related name for `compose_and_watch`, maybe just `pocket_watch`?
.PHONY: compose_and_watch
compose_and_watch: docker_check db_start monitoring_start ## Run a localnet composed of 4 consensus validators w/ hot reload & debugging
${docker-compose} up --force-recreate node1.consensus node2.consensus node3.consensus node4.consensus
${docker-compose} up --force-recreate validator1 validator2 validator3 validator4 servicer1 fisherman1

.PHONY: rebuild_and_compose_and_watch
rebuild_and_compose_and_watch: docker_check db_start monitoring_start ## Rebuilds the container from scratch and launches compose_and_watch
${docker-compose} up --build --force-recreate node1.consensus node2.consensus node3.consensus node4.consensus
${docker-compose} up --build --force-recreate validator1 validator2 validator3 validator4 servicer1 fisherman1

.PHONY: db_start
db_start: docker_check ## Start a detached local postgres and admin instance; compose_and_watch is responsible for instantiating the actual schemas
Expand All @@ -179,7 +179,7 @@ db_cli: ## Open a CLI to the local containerized postgres instance
echo "View schema by running 'SELECT schema_name FROM information_schema.schemata;'"
docker exec -it pocket-db bash -c "psql -U postgres"

psqlSchema ?= node1
psqlSchema ?= validator1

.PHONY: db_cli_node
db_cli_node: ## Open a CLI to the local containerized postgres instance for a specific node
Expand Down Expand Up @@ -320,10 +320,11 @@ generate_rpc_openapi: go_oapi-codegen ## (Re)generates the RPC server and client
oapi-codegen --config ./rpc/client.gen.config.yml ./rpc/v1/openapi.yaml > ./rpc/client.gen.go
echo "OpenAPI client and server generated"

SWAGGER_PORT=127.0.0.1:8080
.PHONY: swagger-ui
swagger-ui: ## Starts a local Swagger UI instance for the RPC API
echo "Attempting to start Swagger UI at http://localhost:8080"
docker run -p 8080:8080 -e SWAGGER_JSON=/v1/openapi.yaml -v $(shell pwd)/rpc/v1:/v1 swaggerapi/swagger-ui
docker run --name pocket-swagger-ui --rm -p $(SWAGGER_PORT):8080 -e SWAGGER_JSON=/v1/openapi.yaml -v $(shell pwd)/rpc/v1:/v1 swaggerapi/swagger-ui

.PHONY: generate_cli_commands_docs
generate_cli_commands_docs: ## (Re)generates the CLI commands docs (this is meant to be called by CI)
Expand Down Expand Up @@ -571,4 +572,4 @@ search_interfaces: ## Greps and outputs all of the structs in the project (exclu

.PHONY: search_protos
search_protos: ## Finds all of the proto files in the project (excluding vendor)
find . -name "*.proto" -not -path "./vendor/*"
find . -name "*.proto" -not -path "./vendor/*"
4 changes: 2 additions & 2 deletions app/client/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func NewDebugCommand() *cobra.Command {
// persistentPreRun is called by both debug and debug sub-commands before runs
func persistentPreRun(cmd *cobra.Command, _ []string) {
// TECHDEBT: this is to keep backwards compatibility with localnet
configPath = runtime.GetEnv("CONFIG_PATH", "build/config/config1.json")
configPath = runtime.GetEnv("CONFIG_PATH", "build/config/config.validator1.json")
rpcURL := fmt.Sprintf("http://%s:%s", rpcHost, defaults.DefaultRPCPort)

runtimeMgr := runtime.NewManagerFromFiles(
Expand Down Expand Up @@ -257,7 +257,7 @@ func broadcastDebugMessage(cmd *cobra.Command, debugMsg *messaging.DebugMessage)

// TODO(olshansky): Once we implement the cleanup layer in RainTree, we'll be able to use
// broadcast. The reason it cannot be done right now is because this client is not in the
// address book of the actual validator nodes, so `node1.consensus` never receives the message.
// address book of the actual validator nodes, so `validator1` never receives the message.
// p2pMod.Broadcast(anyProto)

pstore, err := fetchPeerstore(cmd)
Expand Down
27 changes: 27 additions & 0 deletions app/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,33 @@ func queryCommands() []*cobra.Command {
return rpcResponseCodeUnhealthy(statusCode, resp)
},
},
{
Use: "NodeRoles",
Short: "Get current the node roles",
Long: "Queries the node RPC to returns the type of utility actor(s) running on the node",
Aliases: []string{"noderoles"},
RunE: func(cmd *cobra.Command, args []string) error {
client, err := rpc.NewClientWithResponses(remoteCLIURL)
if err != nil {
return err
}
response, err := client.PostV1QueryNodeRoles(cmd.Context())
if err != nil {
return unableToConnectToRpc(err)
}
statusCode := response.StatusCode
body, err := io.ReadAll(response.Body)
if err != nil {
fmt.Fprintf(os.Stderr, "❌ Error reading response body: %s\n", err.Error())
return err
}
if statusCode == http.StatusOK {
fmt.Println(string(body))
return nil
}
return rpcResponseCodeUnhealthy(statusCode, body)
},
},
}
return cmds
}
5 changes: 5 additions & 0 deletions app/docs/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.8] - 2023-06-06

- Adds `query nodeRoles` sub-command the client CLI
- Renames config file

## [0.0.0.7] - 2023-04-28

- Adds debug sub-commands to the debug CLI and appropriate documentation
Expand Down
56 changes: 56 additions & 0 deletions build/config/config.fisherman1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "90ccfd6ba76d876e02ba09440af67582e0f4a37cbda2ce4c30b251132b670eda2777a49cdfde21867a538ddcfca05002f0115b1955a75b80e965ed63fc95f809",
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
"timeout_msec": 10000,
"manual": true,
"debug_time_between_steps_msec": 1000
},
"private_key": "90ccfd6ba76d876e02ba09440af67582e0f4a37cbda2ce4c30b251132b670eda2777a49cdfde21867a538ddcfca05002f0115b1955a75b80e965ed63fc95f809",
"server_mode_enabled": true
},
"utility": {
"max_mempool_transaction_bytes": 1073741824,
"max_mempool_transactions": 9000
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "fisherman1",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
"max_conns_count": 50,
"min_conns_count": 1,
"max_conn_lifetime": "5m",
"max_conn_idle_time": "1m",
"health_check_period": "30s"
},
"p2p": {
"hostname": "fisherman1",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "90ccfd6ba76d876e02ba09440af67582e0f4a37cbda2ce4c30b251132b670eda2777a49cdfde21867a538ddcfca05002f0115b1955a75b80e965ed63fc95f809",
"max_mempool_count": 100000
},
"telemetry": {
"enabled": true,
"address": "0.0.0.0:9000",
"endpoint": "/metrics"
},
"logger": {
"level": "debug",
"format": "pretty"
},
"rpc": {
"enabled": true,
"port": 50832,
"timeout": 30000,
"use_cors": false
},
"fisherman": {
"enabled": true
}
}
57 changes: 57 additions & 0 deletions build/config/config.servicer1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "e4ad8d293ebf5287e2403e6483ecb6c4e80b22b2d3effc8698dfe34eb35fc9466ac62bddc541432cff818a02bab732f815ef2e6f7099e7dddc793d62d482b451",
"consensus": {
"max_mempool_bytes": 500000000,
"pacemaker_config": {
"timeout_msec": 10000,
"manual": true,
"debug_time_between_steps_msec": 1000
},
"private_key": "e4ad8d293ebf5287e2403e6483ecb6c4e80b22b2d3effc8698dfe34eb35fc9466ac62bddc541432cff818a02bab732f815ef2e6f7099e7dddc793d62d482b451",
"server_mode_enabled": true
},
"utility": {
"max_mempool_transaction_bytes": 1073741824,
"max_mempool_transactions": 9000
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "servicer1",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
"max_conns_count": 50,
"min_conns_count": 1,
"max_conn_lifetime": "5m",
"max_conn_idle_time": "1m",
"health_check_period": "30s"
},
"p2p": {
"hostname": "servicer1",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
"private_key": "e4ad8d293ebf5287e2403e6483ecb6c4e80b22b2d3effc8698dfe34eb35fc9466ac62bddc541432cff818a02bab732f815ef2e6f7099e7dddc793d62d482b451",
"max_mempool_count": 100000
},
"telemetry": {
"enabled": true,
"address": "0.0.0.0:9000",
"endpoint": "/metrics"
},
"logger": {
"level": "debug",
"format": "pretty"
},
"rpc": {
"enabled": true,
"port": 50832,
"timeout": 30000,
"use_cors": false
},
"servicer": {
"enabled": true,
"chains": ["0001"]
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "0ca1a40ddecdab4f5b04fa0bfed1d235beaa2b8082e7554425607516f0862075dfe357de55649e6d2ce889acf15eb77e94ab3c5756fe46d3c7538d37f27f115e",
"use_lib_p2p": false,
"network_id": "localnet",
"consensus": {
"max_mempool_bytes": 500000000,
Expand All @@ -19,7 +18,7 @@
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "node1",
"node_schema": "validator1",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
Expand All @@ -30,7 +29,7 @@
"health_check_period": "30s"
},
"p2p": {
"hostname": "node1.consensus",
"hostname": "validator1",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
Expand All @@ -51,5 +50,12 @@
"port": "50832",
"timeout": 30000,
"use_cors": false
},
"validator": {
"enabled": true
},
"servicer": {
"enabled": true,
"chains": ["0001"]
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "ba81e6e56d293895b299bc495ae75d490644429a5e0028fabeb5e1871c1098e7eb2c78364525a210d994a83e02d18b4287ab81f6670cf4510ab6c9f51e296d91",
"use_lib_p2p": false,
"network_id": "localnet",
"consensus": {
"max_mempool_bytes": 500000000,
Expand All @@ -19,7 +18,7 @@
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "node2",
"node_schema": "validator2",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
Expand All @@ -30,7 +29,7 @@
"health_check_period": "30s"
},
"p2p": {
"hostname": "node2.consensus",
"hostname": "validator2",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "25b385b367a827eaafcdb1003bd17a25f2ecc0d10d41f138846f52ae1015aa941041a9c76539791fef9bee5b4fcd5bf4a1a489e0790c44cbdfa776b901e13b50",
"use_lib_p2p": false,
"network_id": "localnet",
"consensus": {
"max_mempool_bytes": 500000000,
Expand All @@ -19,7 +18,7 @@
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "node3",
"node_schema": "validator3",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
Expand All @@ -30,7 +29,7 @@
"health_check_period": "30s"
},
"p2p": {
"hostname": "node3.consensus",
"hostname": "validator3",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"root_directory": "/go/src/github.com/pocket-network",
"private_key": "4ff3292ff14213149446f8208942b35439cb4b2c5e819f41fb612e880b5614bdd6cea8706f6ee6672c1e013e667ec8c46231e0e7abcf97ba35d89fceb8edae45",
"use_lib_p2p": false,
"network_id": "localnet",
"consensus": {
"max_mempool_bytes": 500000000,
Expand All @@ -19,7 +18,7 @@
},
"persistence": {
"postgres_url": "postgres://postgres:postgres@pocket-db:5432/postgres",
"node_schema": "node4",
"node_schema": "validator4",
"block_store_path": "/var/blockstore",
"tx_indexer_path": "/var/txindexer",
"trees_store_dir": "/var/trees",
Expand All @@ -30,7 +29,7 @@
"health_check_period": "30s"
},
"p2p": {
"hostname": "node4.consensus",
"hostname": "validator4",
"port": 42069,
"use_rain_tree": true,
"is_empty_connection_type": false,
Expand Down
Loading

0 comments on commit 2489b92

Please sign in to comment.