Skip to content

Commit

Permalink
fix spec file adjustment script + testnet and mainnet spec files (#54)
Browse files Browse the repository at this point in the history
- **chore: include `testnet` branch on `build-docker` workflow**
- **chore: generating testnet spec file**
- **fix: remove bootnodes from spec file**
- **move testnet spec**
- **chore: add testnet data: aura and gran keys, bootnodes**
- **fix: update authorities on testnet spec file**
- **chore: add bootnodes support to spec file adjustment script; adjust
testnet bootnodes**
  • Loading branch information
Kelvin Steiner authored Jan 3, 2025
1 parent d7fde40 commit f30b016
Show file tree
Hide file tree
Showing 11 changed files with 5,206 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and push Docker image

on:
push:
branches: [main, github-ci-test]
branches: [main, testnet, github-ci-test]
tags:
- "*"

Expand Down
23 changes: 23 additions & 0 deletions data/mainnet/aura.pub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
"5FAHNw7kdqkJotQ8yXF21iSmxhSzbwzJkVogrZH3MvypHy1D",
"5Gv1CAGk3aRWvZs5LdP9ta9kVm23dfYopaJyXTZMavQNwZbm",
"5G4JMqfNRJqpzuvXkbaxfhyX4MyeWgh7Tm1K88yNwnSRVyDY",
"5HGNHGa1CVgDtYqcarFvtTS5foKyjqbM4NX5FYv1MLKkdKUG",
"5HnB7htLFzaMAbqgzE66EVgUmJCACVQ1tvZUdDyAAFD71Evq",
"5D5DFRxoSt27NJFEJpTvpyFMfZCf2jRvosKJ2QWQEQs6twnX",
"5EFmiWRcZVEFYj3k1w6rHjieP6yE9YFFPiHDAX5iXAFLhgXv",
"5CRwJKcr8pQ4CZ8wUrSDCGo2aFKqVXHFpsjHmbTERQNQbCQL",
"5DAgeVS3gsVUMUDASy3d5YPasbTQQU7gDkGijF8S3iKGdWjR",
"5G6hp8fP6E89R51cA4Dy8qgae3VsAYFBN4DGZDS2BMnhgRCc",
"5GZEpLT7CfVhJC2aYmULUSzXnCuzWg1VrZij2dQTAQrokm4g",
"5FADATJkVq4Tt6gcaqD5a9rVF6sx6Pc5C9WzRaZG71M4JszX",
"5FZ7dvAYCi5yLiDnFerKqSK3Mo8VNiheTXphrRhZ5m1z8rr1",
"5FRXa3cRPqsAVeNt3AZa2pywF3TEoh51d3fDCvwfgSzTHj8V",
"5EA27GYEXcsdRN9QqdDxEAB8soH8AkqLdWq34fuxwPwGy4hu",
"5CyuGBohZaiQf5rfMnbUjcVrbjATmjrx6ZEKBPP7aWFjx7mX",
"5DMMrzgJ9WnEJH35xivLQ9nuByTrZ3uXHwPQWg2BBXN914fH",
"5CcbfWfBNC5LwZaseEFrrraWkXc6ZLPBBe8PMowSDFmEsKss",
"5Di2kW4nTNkVjphyHjvB67YVaaCoxd5k6quXuAQeRQxwJ8Ad",
"5HVuVMnEPYMCKGuzPighADMzKgVm2swZTUPB1cLtLPSbpunZ",
"5CcaizfVSsdv5AJDqDrGvu1fb6ndNJpQ8RgXNGuCPYfYsVSG"
]
23 changes: 23 additions & 0 deletions data/mainnet/bootnodes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
"/dns4/validator-0.nodes.torus.network/tcp/30333/p2p/12D3KooWMusxwQjbKYf4oXDciA7maVUWoBHw5im6dzi9vDj5M4QD",
"/dns4/validator-1.nodes.torus.network/tcp/30333/p2p/12D3KooWG2nfpHqsoRH5obvN9AtDYbwEQB9ruhFb7fU318VqRKWo",
"/dns4/validator-2.nodes.torus.network/tcp/30333/p2p/12D3KooWGGcQJ4Jk9J9uUVzUwwqVTa1m5vkWina8mRyNZKHpdfBG",
"/dns4/validator-3.nodes.torus.network/tcp/30333/p2p/12D3KooWKv797oXFbuWxv4zGJ3KFzpv3CJwGngXpZnFD5WcctsB4",
"/dns4/validator-4.nodes.torus.network/tcp/30333/p2p/12D3KooWPjuSYUJjroaWjLjExMmHukKGX6fQQjgu3dNavYFXudxE",
"/dns4/validator-5.nodes.torus.network/tcp/30333/p2p/12D3KooWBuydmvQtS8BCWKBnntA31r2Z3PiAiE3FNDX8NnSubFHQ",
"/dns4/validator-6.nodes.torus.network/tcp/30333/p2p/12D3KooWF5fnR9N325nTg9QoEGxvH3AqeonE38DAMDvPLsLXV4Vd",
"/dns4/validator-7.nodes.torus.network/tcp/30333/p2p/12D3KooWPkRzoDMRq3iGSkCbkfSLQEb6DUizQThsiJssjeeeTtey",
"/dns4/validator-8.nodes.torus.network/tcp/30333/p2p/12D3KooWLfxSBtAvkJUK4KYBSaVyhq6rtg4PVNvGC8xNE9a4Adnj",
"/dns4/validator-9.nodes.torus.network/tcp/30333/p2p/12D3KooWQmFzuMt3LWHo97E857yUWGfgcgzWuDEaQZ4aEvdjf1db",
"/dns4/validator-10.nodes.torus.network/tcp/30333/p2p/12D3KooWJt9jbAEDXwiSUs14fRUDxNbnmvo8iAiP354x6D8vFZRq",
"/dns4/validator-11.nodes.torus.network/tcp/30333/p2p/12D3KooWGrKbSLuxyPstp8xyyJdfi4pSMAYJPxX9Z3xzFCNrTrtW",
"/dns4/validator-12.nodes.torus.network/tcp/30333/p2p/12D3KooWGZhYejc8cDvJBFyU6PbKWigeZLRocs28AmJhtMB3JGDt",
"/dns4/validator-13.nodes.torus.network/tcp/30333/p2p/12D3KooWH9AvU5N8qEPHKwqd1QsnqoEZZLn9saEpuQeJpmbfrKMw",
"/dns4/validator-14.nodes.torus.network/tcp/30333/p2p/12D3KooWMoEV8Rg8sqY2yfAiwSxHyp7cajYZpiDoCbNCp4SeYeBA",
"/dns4/validator-15.nodes.torus.network/tcp/30333/p2p/12D3KooWRyfEqB9F8Xg2s2VPnPJ5PxQzZ4qjGvS72sShipZBqtUp",
"/dns4/validator-16.nodes.torus.network/tcp/30333/p2p/12D3KooWDqswAykVFcavDwnk7sepZDuKnr4QCis5SQ8yiCngxBbL",
"/dns4/validator-17.nodes.torus.network/tcp/30333/p2p/12D3KooWHb7J3sUTWJY7nUWmKA7GF4cy2FSjD9Qc6aGuP8WtWKct",
"/dns4/validator-18.nodes.torus.network/tcp/30333/p2p/12D3KooWGoGk99jsq6gBp9BsH5Gfuv5sbDzCxavG5rhQy2QQ2Q1U",
"/dns4/validator-19.nodes.torus.network/tcp/30333/p2p/12D3KooWMVdvhywxVp3k1WrX6FGqfLWTpuSa3HgLFpjC3QsNX1Cn",
"/dns4/validator-20.nodes.torus.network/tcp/30333/p2p/12D3KooWPuQ4BMgeqmoMJ8WKDsFiazWxWAtNsmnAnEAJqzMt9FVq"
]
86 changes: 86 additions & 0 deletions data/mainnet/gran.pub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
[
"5GMXEvALNWNDxTyEcoDje7BLWTDULLnMiDcgGNAAqARoorAQ",
1
],
[
"5C6F9jugYXyFrmAiVgwnnVdk61bo2Z1mHdvDPPPBUHJ945rU",
1
],
[
"5Ec72auaTFKnBfSjVJ2AzYJu1difirGrtuoK75J3NqkL7Se5",
1
],
[
"5CfqBtvZQZSU2hofUD3dCxka1kyXEZHmJFSqru9NXZJnfU15",
1
],
[
"5CbP8wXa2LDfaDwuyK4gJG3xn1MoVVRafogTC2uq9KwU8coC",
1
],
[
"5DbmvGs5STwgo4mkQSG46cbnY3WvQkpuJjmvq8sVKEwyjAXB",
1
],
[
"5G8wJKMug3FAF3Xmt79q1FkQ6vbkSyFBHBQCThJVexQF6U2t",
1
],
[
"5DgKEtseBx4ypcjLMTDZKyt1NvXWJuRXZXJVdZdyVA36iciA",
1
],
[
"5DDw6pdWf1r82jaY2m1Do8qw1e2rHTzTsLtz8fRGKHt7ja2L",
1
],
[
"5Fh8Reu8XyvimqPrQ5Mmf5kaR54WhhobRT9EhUjRNJ4ojMkE",
1
],
[
"5FEktJzcgo2wqbMfMYnHHxSvH9LuTcnzszkvE9ubdw3vqEDq",
1
],
[
"5DFf7EeCt6nDEhrvMQEZrByuHU1KGrZ5yo7bLobPiUHSMsvC",
1
],
[
"5GJx6hfASXLaYU9F9kJfh59QDRnMqWh982WuDbNuhcy5TmSD",
1
],
[
"5DLJczfZQo9zeUCCUekr1HxrtHz9uAGGvYh7j5jrQjyDUuK8",
1
],
[
"5FJQKLMBhYze3EhPidCgqMJ8frpPCQKW6sStToReASg3j3dZ",
1
],
[
"5FoirCgSYsa5eHcAAHrSMuJ1WDHZdz4WWdx4VqwY3cAfzHYv",
1
],
[
"5Dngmp9arbJ4Yjarfm5AoSKGVk6SSPrvGhiasLxppEhUdy4K",
1
],
[
"5GpGEtdru4eNKnKzCgNAZnHMmRWudEyEsGmJJeaib5Jr3F3U",
1
],
[
"5F9G2dhk18oSQyJJ34QXuqBdSHiF4ff4qKkbB4F4PvW2oX3d",
1
],
[
"5G9hFMqTb3YcZ8An46fLUrjReNx3p8pdTWatz8XPmPWutmyi",
1
],
[
"5Fen622mpK7xg9n4it3Hav4PBjZnFtg1Uc464rPDWGM8Lzsp",
1
]
]
2,530 changes: 2,530 additions & 0 deletions data/mainnet/spec.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions data/testnet/aura.pub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"5HgqdQWjhW6DNAwFuR9QyXPT2X8sMcPbfkqhhDMcZTtzrg6G",
"5CZg4dpW13JvjMo61xEgrYDkVW4R9i4HYMpLEpaa9CMfHfmt",
"5Gut8yb1HHw4ro9BEH3o44XgVDgXkJTWRNxEp4a1bvGr9tws",
"5HKQ3mwPR7oppkb957YyTBRMR4iLVjF27mdPx7a9EkBBinFN"
]
6 changes: 6 additions & 0 deletions data/testnet/bootnodes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"/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"
]
18 changes: 18 additions & 0 deletions data/testnet/gran.pub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
[
"5CwLdPUxBiCUCVZ3w5dvhWztXEZ58ijXG7jD6F3QY8SfZwj1",
1
],
[
"5FuTB4GLFdxX2Ee8Wz69qA6M8GtHzxy6jGVLQoDJXTRKAv4o",
1
],
[
"5CUnFDtwqd2feHwqGuojjQX4z9eBnJqZBdWo1xY8b26rEUyN",
1
],
[
"5D2LyEr5wvkWrVAWrM3ThpipxPDDdN6deaweLjMKitrBH9BT",
1
]
]
2,484 changes: 2,484 additions & 0 deletions data/testnet/spec.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ gen-base-spec:
gen-spec-file env: gen-base-spec
mkdir -p tmp/spec

node_version=$(cargo run -p torus-node -- --version) \
node_version=$(cargo run -p torus-node --release -- --version) \
&& scripts/adjust-spec-file.py "{{env}}" "{{base_spec_path}}" \
--balances-file data/torus-genesis-balances.json \
--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
48 changes: 25 additions & 23 deletions scripts/adjust-spec-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,34 @@ 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)

# Node config / metadata
# == Node config / metadata ==

if node_env == "mainnet":
spec_data['chainType'] = "Live"
Expand All @@ -55,12 +55,14 @@ def load_json(path: str):
if args.name:
spec_data['name'] = args.name

# Runtime values patch
if bootnodes_path:
# Inject bootnodes
bootnodes = load_json(bootnodes_path)
spec_data['bootNodes'] = bootnodes

patch_obj = spec_data['genesis']['runtimeGenesis']['patch']
# == Runtime values patch ==

aura_list_path = args.aura_list_file
gran_list_path = args.gran_list_file
patch_obj = spec_data['genesis']['runtimeGenesis']['patch']

if aura_list_path:
# Inject AURA authority pub key list
Expand Down

0 comments on commit f30b016

Please sign in to comment.