From f8e429a73c33768f2367d4b604ce3b2e63bc4bfb Mon Sep 17 00:00:00 2001 From: Kelvin Steiner Date: Fri, 3 Jan 2025 16:16:16 -0300 Subject: [PATCH] chore: add bootnodes support to spec file adjustment script; adjust testnet bootnodes --- data/testnet/spec.json | 8 ++++++- justfile | 1 + scripts/adjust-spec-file.py | 45 ++++++++++++++++++------------------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/data/testnet/spec.json b/data/testnet/spec.json index 076c46c..6a4504b 100644 --- a/data/testnet/spec.json +++ b/data/testnet/spec.json @@ -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": { diff --git a/justfile b/justfile index 797781a..5e11fb7 100644 --- a/justfile +++ b/justfile @@ -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" diff --git a/scripts/adjust-spec-file.py b/scripts/adjust-spec-file.py index 1e165c3..b2a5546 100755 --- a/scripts/adjust-spec-file.py +++ b/scripts/adjust-spec-file.py @@ -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) @@ -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)