Skip to content

Commit 3086f53

Browse files
authored
[Config] Revamp Shannon config example (#70)
* Update `Shannon` config example `cmd/.config.shannon_example.yaml` to comply with the new parser. * Fix `Gateway` and `Application` config entry names `*_hex_private_key` -> `*_private_key_hex` * Fix test config indentation.
1 parent 8533ee8 commit 3086f53

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed

cmd/.config.shannon_example.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ shannon_config:
22
full_node_config:
33
rpc_url: https://example_full_node_rpc_url.your_domain # replace with your full node rpc url
44
grpc_config:
5-
host_port: example_fullnode_grpc.your_domain:443 # replace with your full node grpc host/port
6-
gateway_address: "example_gateway_address_pokt1710ed9a8d0986d8" # replace with your gateway address
7-
gateway_private_key: "example_gateway_private_key_52734539d033e35c6e6d1ce5ad96bcacb911" # replace with your gateway private key
8-
delegated_app_addresses: # replace with delegated app addresses
9-
- "example_delegated_app_address_pokt1a3b8ef9b"
5+
host_port: example_fullnode_grpc.your_domain:443 # replace with your full node grpc host:port
6+
lazy_mode: false # set to true to disable PATH caching mechanism
7+
gateway_config:
8+
gateway_mode: centralized # replace with your gateway mode centralized|delegated|trusted
9+
gateway_address: example_gateway_address_pokt1710ed9a8d0986d8 # replace with your gateway address
10+
gateway_private_key_hex: example_gateway_private_key_52734539d033e35c6e6d1ce5ad96bcacb911 # replace with your gateway private key
11+
# Not applicable for delegated gateway mode
12+
owned_apps_private_keys_hex: # replace with delegated app addresses
13+
- example_owned_app_private_key_pokt1a3b8ef9b
1014

1115
services:
1216
"F00C":

config/config.schema.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,18 @@ properties:
128128
required:
129129
- gateway_mode
130130
- gateway_address
131-
- gateway_hex_private_key
132-
- owned_apps_hex_private_keys
131+
- gateway_private_key_hex
133132
properties:
134133
gateway_mode:
135134
type: string
136135
pattern: "^[a-zA-Z0-9]+$"
137136
gateway_address:
138137
type: string
139138
pattern: "^pokt1[0-9a-zA-Z]{38}$" # 43 total characters
140-
gateway_hex_private_key:
139+
gateway_private_key_hex:
141140
type: string
142141
pattern: "^[0-9a-fA-F]{64}$"
143-
owned_apps_hex_private_keys:
142+
owned_apps_private_keys_hex: # Not required in delegated gateway mode
144143
type: array
145144
items:
146145
type: string

config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ func Test_LoadGatewayConfigFromYAML(t *testing.T) {
135135
grpc_url: "grpcs://grpc-url.io"
136136
gateway_config:
137137
gateway_address: "invalid_gateway_address"
138-
gateway_hex_private_key: "d5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
139-
gateway_mode: "delegated"
138+
gateway_private_key_hex: "d5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
139+
gateway_mode: "delegated"
140140
`,
141141
wantErr: true,
142142
},

config/testdata/shannon.example.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ shannon_config:
66
host_port: "grpc-url.io:443"
77
gateway_config:
88
gateway_address: "pokt1710ed9a8d0986d808e607c5815cc5a13f15dba"
9-
gateway_hex_private_key: "d5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
9+
gateway_private_key_hex: "d5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
1010
gateway_mode: "centralized"
11-
owned_apps_hex_private_keys:
11+
owned_apps_private_keys_hex:
1212
- "e5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
1313
- "f5fcbfb894059a21e914a2d6bf1508319ce2b1b8878f15aa0c1cdf883feb018d"
1414

e2e/scripts/update_shannon_config_from_secrets.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ update_shannon_config_from_env() {
1919
fi
2020

2121
yq -i '
22-
.shannon_config.gateway_config.gateway_hex_private_key = env(SHANNON_GATEWAY_PRIVATE_KEY) |
23-
.shannon_config.gateway_config.owned_apps_hex_private_keys= env(SHANNON_OWNED_APPS_PRIVATE_KEYS)
22+
.shannon_config.gateway_config.gateway_private_key_hex = env(SHANNON_GATEWAY_PRIVATE_KEY) |
23+
.shannon_config.gateway_config.owned_apps_private_keys_hex = env(SHANNON_OWNED_APPS_PRIVATE_KEYS)
2424
' $CONFIG_FILE
2525
}
2626

e2e/shannon.example.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ shannon_config:
1111
host_port: testnet-validated-validator-grpc.poktroll.com:443
1212
gateway_config:
1313
gateway_mode: "centralized"
14-
# NOTE: gateway_hex_private_key must be replaced with the correct gateway private key secret
15-
gateway_hex_private_key: cf09805c952fa999e9a63a9f434147b0a5abfd10f268879694c6b5a70e1ae177
14+
# NOTE: gateway_private_key_hex must be replaced with the correct gateway private key secret
15+
gateway_private_key_hex: cf09805c952fa999e9a63a9f434147b0a5abfd10f268879694c6b5a70e1ae177
1616
# do not change gateway_address
1717
gateway_address: pokt1up7zlytnmvlsuxzpzvlrta95347w322adsxslw
18-
owned_apps_hex_private_keys:
18+
owned_apps_private_keys_hex:
1919
# NOTE: the application private key must be replaced with the correct application private key secret
2020
- cf09805c952fa999e9a63a9f434147b0a5abfd10f268879694c6b5a70e1ae177
2121
services:

protocol/shannon/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ type (
4444
GatewayConfig struct {
4545
GatewayMode protocol.GatewayMode `yaml:"gateway_mode"`
4646
GatewayAddress string `yaml:"gateway_address"`
47-
GatewayPrivateKeyHex string `yaml:"gateway_hex_private_key"`
48-
OwnedAppsPrivateKeysHex []string `yaml:"owned_apps_hex_private_keys"`
47+
GatewayPrivateKeyHex string `yaml:"gateway_private_key_hex"`
48+
OwnedAppsPrivateKeysHex []string `yaml:"owned_apps_private_keys_hex"`
4949
}
5050

5151
// TODO_TECHDEBT(@adshmh): Move this and related helpers into a new `grpc` package.

0 commit comments

Comments
 (0)