Skip to content

Commit

Permalink
chore: add bootnodes support to spec file adjustment script; adjust t…
Browse files Browse the repository at this point in the history
…estnet bootnodes
  • Loading branch information
steinerkelvin committed Jan 3, 2025
1 parent 2e8c072 commit f8e429a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
8 changes: 7 additions & 1 deletion data/testnet/spec.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "Torus testnet torus-node 0.1.0-57d73b95194",
"name": "Torus testnet torus-node 0.1.0-2e8c072ef91",
"id": "torus-testnet",
"chainType": "Development",
"bootNodes": [
"/dns4/validator-0.nodes.testnet.torus.network/tcp/30333/p2p/12D3KooWMxgfPZQ7AmTnSKbPmBrQuJ9UXwsXP98g578MdJFy5cHm",
"/dns4/validator-1.nodes.testnet.torus.network/tcp/30333/p2p/12D3KooWRsZYrkFuGxTbZbEnH2A2KDT3dKAcx6EUBCTykEpvKvpN",
"/dns4/validator-2.nodes.testnet.torus.network/tcp/30333/p2p/12D3KooWP8PQjwAGPGtm6QRcwNhMuv4PDNHUKp8rD6gZfgdpAByx",
"/dns4/validator-3.nodes.testnet.torus.network/tcp/30333/p2p/12D3KooWKCdLiV4gapVCtbkTNxCboMR1Mg1YvjbM8ZNKDpxQRvPB"
],
"telemetryEndpoints": null,
"protocolId": "torus",
"properties": {
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gen-spec-file env: gen-base-spec
--merge-balances \
--aura-list-file "data/{{env}}/aura.pub.json" \
--gran-list-file "data/{{env}}/gran.pub.json" \
--bootnodes-file "data/{{env}}/bootnodes.json" \
--name "Torus {{env}} $node_version" \
> "tmp/spec/{{env}}.json"

Expand Down
45 changes: 22 additions & 23 deletions scripts/adjust-spec-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ def load_json(path: str):

parser = argparse.ArgumentParser(
description='Adjust chain spec file with node configuration')
arg = parser.add_argument

parser.add_argument(
'node_env', help='Node environment (e.g. mainnet, testnet)', type=str)
parser.add_argument(
'spec_file', help='Path to the input chain spec file', type=str)

parser.add_argument(
"--aura-list-file", help="Path to the aura list file (JSON)", type=str)
parser.add_argument(
"--gran-list-file", help="Path to the gran list file (JSON)", type=str)
parser.add_argument(
"--balances-file", help="Path to the balances file (JSON)", type=str)
parser.add_argument(
"--merge-balances", help="Merge external balances with the spec file balances", action="store_true")

parser.add_argument(
"--sudo-key", help="Sudo key to use", type=str)
parser.add_argument(
"--name", help="Node name", type=str, default="Torus")
arg('node_env', help='Node environment (e.g. mainnet, testnet)', type=str)
arg('spec_file', help='Path to the input chain spec file', type=str)

arg("--bootnodes-file", help="Path to the bootnodes file (JSON)", type=str)
arg("--aura-list-file", help="Path to the aura list file (JSON)", type=str)
arg("--gran-list-file", help="Path to the gran list file (JSON)", type=str)
arg("--balances-file", help="Path to the balances file (JSON)", type=str)

arg("--merge-balances",
help="Merge external balances with the spec file balances", action="store_true")

arg("--sudo-key", help="Sudo key to use", type=str)
arg("--name", help="Node name", type=str, default="Torus")

args = parser.parse_args()

node_env = args.node_env
base_spec_file = args.spec_file
bootnodes_path = args.bootnodes_file
aura_list_path = args.aura_list_file
gran_list_path = args.gran_list_file


spec_data = load_json(base_spec_file)
Expand All @@ -55,16 +55,15 @@ def load_json(path: str):
if args.name:
spec_data['name'] = args.name

# Removing bootnodes list
del spec_data['bootNodes']
if bootnodes_path:
# Inject bootnodes
bootnodes = load_json(bootnodes_path)
spec_data['bootNodes'] = bootnodes

# == Runtime values patch ==

patch_obj = spec_data['genesis']['runtimeGenesis']['patch']

aura_list_path = args.aura_list_file
gran_list_path = args.gran_list_file

if aura_list_path:
# Inject AURA authority pub key list
aura_list = load_json(aura_list_path)
Expand Down

0 comments on commit f8e429a

Please sign in to comment.