Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Core] Deploying all-the-protocol-actors #710

Merged
merged 33 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9ba8871
📝 🧬🎣🚪 all actor configs
0xBigBoss Apr 14, 2023
1d79321
Add /v1/query/nodeRoles RPC endpoint and localnet updates
0xBigBoss Apr 29, 2023
9603a6f
update docs
0xBigBoss Apr 30, 2023
e3ba3f0
add mock servicer relay rpc
0xBigBoss May 2, 2023
0e20307
rebased, minor improvements for docker compose
0xBigBoss May 5, 2023
a76188d
clean up configs for docker compose
0xBigBoss May 6, 2023
2302776
clean up and addressing feedback
0xBigBoss May 7, 2023
a82d65b
clean up docker compose, genesis, localnet
0xBigBoss May 7, 2023
eabd0e2
bit of clean up
0xBigBoss May 14, 2023
9e2ca7d
add fishermen keys
0xBigBoss May 14, 2023
548d4b7
Merge remote-tracking branch upstream/main into 0xbigboss/dw-1860/cor…
0xBigBoss May 26, 2023
5019123
fix the tests
0xBigBoss May 26, 2023
3d89907
add generated helm docs
invalid-email-address May 26, 2023
a0e2ebb
add missing compose services
0xBigBoss May 27, 2023
8539e8e
golint
0xBigBoss May 27, 2023
1d7d0ae
clean up names and configs
0xBigBoss Jun 2, 2023
0273210
squash lil 🐛 and tidy up code 🧹
0xBigBoss Jun 2, 2023
4feeb78
clean up and refactor actor modules
0xBigBoss Jun 2, 2023
6e20fa6
Merge remote-tracking branch 'upstream/main' into 0xbigboss/dw-1860/c…
0xBigBoss Jun 2, 2023
cc8d3f6
merge in upstream/main
0xBigBoss Jun 2, 2023
b61f894
clean up docker compose, new line
0xBigBoss Jun 2, 2023
71880bd
fix localnet
0xBigBoss Jun 2, 2023
06af3ef
clean up actor numbers
0xBigBoss Jun 2, 2023
4b0eaf8
fix panic, pass by cfg by ref
0xBigBoss Jun 2, 2023
cd5942d
merge service and servicer modules
0xBigBoss Jun 6, 2023
ebdf98c
check if cast works
0xBigBoss Jun 6, 2023
d222dba
clean up get modules
0xBigBoss Jun 6, 2023
ec97a7f
fix the interfaces
0xBigBoss Jun 6, 2023
025b4ed
clean up utility and servicer module
0xBigBoss Jun 6, 2023
e1fb8f6
fallback to client context namespace
0xBigBoss Jun 6, 2023
4302a8f
changelogs
0xBigBoss Jun 6, 2023
452e7f5
Merge remote-tracking branch 'upstream/main' into 0xbigboss/dw-1860/c…
0xBigBoss Jun 6, 2023
fe90c0d
rm ./var directory
0xBigBoss Jun 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/var
.idea
.vscode
.github
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
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
0xBigBoss marked this conversation as resolved.
Show resolved Hide resolved

.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())
0xBigBoss marked this conversation as resolved.
Show resolved Hide resolved
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