Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 47 additions & 35 deletions .maintain/reset-spec/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import typing
import logging
import tempfile
import shutil

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,6 +46,8 @@ def run_check_process(cmd: typing.List[str]):
def make_custom_spec(tmp_dir, docker_img, plain_file, out_file, update_spec, spec, runtime=None):
"""Build a custom spec by exporting a chain spec and customize it using a python script.
"""
logger.debug("using directory '%s'", tmp_dir)

cmd_plain_spec = base_docker_run_cmd() + [docker_img, "build-spec",
"--chain", spec, "--disable-default-bootnode"]

Expand All @@ -55,6 +58,12 @@ def make_custom_spec(tmp_dir, docker_img, plain_file, out_file, update_spec, spe

in_json = json.loads(process.stdout)

if args.debug:
with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8", suffix=".json", delete=False) as tf:
json.dump(in_json, tf, indent=" ")
tf_name = tf.name
logger.debug("Writing unmodified spec to '%s'", tf_name)

try:
update_spec(in_json)
except KeyError as e:
Expand Down Expand Up @@ -117,17 +126,17 @@ def make_native(docker_img, out_file, chain, runtime):
import peregrine_stg_kilt
import peregrine_stg_relay

logging.basicConfig(format='%(asctime)s:%(levelname)s: %(message)s',
datefmt='%m-%d-%Y %H:%M:%S', level=logging.DEBUG)
logging.basicConfig(format="%(asctime)s:%(levelname)s: %(message)s",
datefmt="%m-%d-%Y %H:%M:%S", level=logging.DEBUG)

parser = argparse.ArgumentParser(
description=("Reset the chainspec for our networks."
"VERIFY THAT THE SPEC IS CORRECT AFTER USE!!"
"Make sure that the current directory is the project root."),
epilog="")
parser.add_argument('-v', '--verbose', action='count', default=0)
# parser.add_argument('-d', '--debug', action='store_true',
# default=False, help="enable debug mode, don't delete tmp files.")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-d", "--debug", action="store_true", dest="debug",
default=False, help="enable debug mode, don't delete tmp files.")

parser.add_argument("--image", "-i", dest="image", required=True,
help="docker image to use for building chain spec")
Expand Down Expand Up @@ -167,43 +176,46 @@ def make_native(docker_img, out_file, chain, runtime):
make_native(args.image, SPIRITNET_KILT, "spiritnet-new", "spiritnet")

if args.peregrine:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_kilt.plain.json",
PERE_KILT, peregrine_kilt.update_spec, "peregrine-new", "peregrine"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine")
make_custom_spec(
tmpdirname, args.image, "peregrine_kilt.plain.json",
PERE_KILT, peregrine_kilt.update_spec, "peregrine-new", "peregrine"
)

if args.peregrine_relay:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_relay.plain.json",
PERE_RELAY, peregrine_relay.update_spec, "westend-local"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine_relay")
make_custom_spec(
tmpdirname, args.image, "peregrine_relay.plain.json",
PERE_RELAY, peregrine_relay.update_spec, "westend-local"
)

if args.peregrine_dev:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_dev_kilt.plain.json",
PERE_DEV_KILT, peregrine_dev_kilt.update_spec, "peregrine-new", "peregrine"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine_dev")
make_custom_spec(
tmpdirname, args.image, "peregrine_dev_kilt.plain.json",
PERE_DEV_KILT, peregrine_dev_kilt.update_spec, "peregrine-new", "peregrine"
)

if args.peregrine_relay_dev:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_dev_relay.plain.json",
PERE_DEV_RELAY, peregrine_dev_relay.update_spec, "westend-local"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine_relay_dev")
make_custom_spec(
tmpdirname, args.image, "peregrine_dev_relay.plain.json",
PERE_DEV_RELAY, peregrine_dev_relay.update_spec, "westend-local"
)

if args.peregrine_stg:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_stg.plain.json",
PERE_STG_KILT, peregrine_stg_kilt.update_spec, "peregrine-new", "peregrine"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine_stg")
make_custom_spec(
tmpdirname, args.image, "peregrine_stg.plain.json",
PERE_STG_KILT, peregrine_stg_kilt.update_spec, "peregrine-new", "peregrine"
)

if args.peregrine_relay_stg:
with tempfile.TemporaryDirectory() as tmpdirname:
make_custom_spec(
tmpdirname, args.image, "peregrine_stg_relay.plain.json",
PERE_STG_RELAY, peregrine_stg_relay.update_spec, "westend-local"
)
tmpdirname = tempfile.mkdtemp(suffix="peregrine_relay_stg")
make_custom_spec(
tmpdirname, args.image, "peregrine_stg_relay.plain.json",
PERE_STG_RELAY, peregrine_stg_relay.update_spec, "westend-local"
)

if tmpdirname is not None and not args.debug:
shutil.rmtree(tmpdirname)
2 changes: 1 addition & 1 deletion .maintain/reset-spec/peregrine_dev_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def update_spec(input: typing.Dict):
"max_upward_message_size": 51200,
"max_upward_message_num_per_candidate": 10,
"hrmp_max_message_num_per_candidate": 10,
"validation_upgrade_frequency": 240,
"validation_upgrade_cooldown": 240,
"validation_upgrade_delay": 120,
"max_pov_size": 5242880,
"max_downward_message_size": 51200,
Expand Down
4 changes: 2 additions & 2 deletions .maintain/reset-spec/peregrine_stg_kilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def update_spec(input: typing.Dict):
"/dns4/eyrie-1.kilt.io/tcp/30345/p2p/12D3KooWR2wXmkcnQHZCLEpC9GJLtDJTYRoaMMcJrE6Xc8LioZtH",
],
"chainType": "Live",
"name": "KILT Peregrine Stagenet",
"name": "KILT Peregrine-stg",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, this will "break" the custom styling of our Stagenet in the Polkadot Apps. So we need to make a PR to fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they don't take the ID?

"id": "peregrine_stg_kilt",
"protocolId": "pkilt2",
"protocolId": "pkilt4",
"para_id": para_id,
"telemetryEndpoints": [
[
Expand Down
136 changes: 93 additions & 43 deletions .maintain/reset-spec/peregrine_stg_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ def update_spec(input: typing.Dict):
acc_bob = "5DL9V1dmkuZnzRD9R3cwdzowim3sBZZvz1iJhNxC5QjofikK"
acc_charlie = "5DcKRxsjojmbJW7Scxnu7Ck5zXfpg1RxtrcyVjaMRx5YFWUR"
acc_dave = "5E4ZYy9tTPpJPoScqm6PvLtr1MjsBEjbDufJQYhcuBtk6rNa"
acc_eve = "5ELCvQBGu8ur9UDSMAiqB4PrYXTnLGwcaUg63gtkxWtScEYm"
acc_ferdie = "5G6ThxmfSbHVt2u8WmZmTH3xeKBckFFDGA69E6cSXtYPaiwT"

input.update({
"bootNodes": [
Expand All @@ -17,8 +19,9 @@ def update_spec(input: typing.Dict):
"/dns4/eyrie-3.kilt.io/tcp/30386/p2p/12D3KooWH65w2LXz8pTLZkdzU5YCocKbhs19a4i9aJp8EEs4fzbq",
],
"chainType": "Live",
"name": "Peregrine Westend-Relay Stagenet",
"id": "westend_peregrine_relay_stagenet",
"name": "Peregrine-stg Westend-Relay",
"id": "westend_peregrine_stg_relay",
"protocolId": "Rkilt4",
"telemetryEndpoints": [
[
"/dns/telemetry-backend.kilt.io/tcp/8080/x-parity-wss/%2Fsubmit",
Expand All @@ -29,19 +32,27 @@ def update_spec(input: typing.Dict):
input["genesis"]["runtime"]["balances"]["balances"] = [
[
acc_alice,
10000000000000000000000000000
1000000000000000000
],
[
acc_bob,
10000000000000000000000000000
1000000000000000000
],
[
acc_charlie,
10000000000000000000000000000
1000000000000000000
],
[
acc_dave,
10000000000000000000000000000
1000000000000000000
],
[
acc_eve,
1000000000000000000
],
[
acc_ferdie,
1000000000000000000
],
]
input["genesis"]["runtime"]["session"]["keys"] = [
Expand Down Expand Up @@ -92,80 +103,119 @@ def update_spec(input: typing.Dict):
"para_assignment": "5FxM6yYBFvMeX3C2QrQDXJ8LhhzG5sPjgUtX77cX1wihHhVq",
"authority_discovery": "5FxM6yYBFvMeX3C2QrQDXJ8LhhzG5sPjgUtX77cX1wihHhVq"
}
],
[
acc_eve,
acc_eve,
{
"grandpa": "5GnPNFKvLRy9FF8N1G9YjGmjJA4cUsUC7WgEx3rDeMFnZsXk",
"babe": "5GKaEkaA8NVdpsruRcnpeLBNGzMcFsEfwEY3Jq7Vmw9brztR",
"im_online": "5GKaEkaA8NVdpsruRcnpeLBNGzMcFsEfwEY3Jq7Vmw9brztR",
"para_validator": "5GKaEkaA8NVdpsruRcnpeLBNGzMcFsEfwEY3Jq7Vmw9brztR",
"para_assignment": "5GKaEkaA8NVdpsruRcnpeLBNGzMcFsEfwEY3Jq7Vmw9brztR",
"authority_discovery": "5GKaEkaA8NVdpsruRcnpeLBNGzMcFsEfwEY3Jq7Vmw9brztR"
}
],
[
acc_ferdie,
acc_ferdie,
{
"grandpa": "5CPW6uFwdjoHTj14C1VWiK96Cj2sJBALbC964zHaGAni3J2S",
"babe": "5CSYQMyi7iGVuHLgLNDXcpPXZgvWWrP7mqd1sHdBUSeafXf5",
"im_online": "5CSYQMyi7iGVuHLgLNDXcpPXZgvWWrP7mqd1sHdBUSeafXf5",
"para_validator": "5CSYQMyi7iGVuHLgLNDXcpPXZgvWWrP7mqd1sHdBUSeafXf5",
"para_assignment": "5CSYQMyi7iGVuHLgLNDXcpPXZgvWWrP7mqd1sHdBUSeafXf5",
"authority_discovery": "5CSYQMyi7iGVuHLgLNDXcpPXZgvWWrP7mqd1sHdBUSeafXf5"
}
]
]
input["genesis"]["runtime"]["sudo"]["key"] = acc_alice
input["genesis"]["runtime"]["staking"].update({
"validatorCount": 4,
"validatorCount": 6,
"stakers": [
[
acc_alice,
acc_alice,
1000000000000,
1000000000000000,
"Validator"
],
[
acc_bob,
acc_bob,
1000000000000,
1000000000000000,
"Validator"
],
[
acc_charlie,
acc_charlie,
1000000000000,
1000000000000000,
"Validator"
],
[
acc_dave,
acc_dave,
1000000000000,
1000000000000000,
"Validator"
],
[
acc_eve,
acc_eve,
1000000000000000,
"Validator"
],
[
acc_ferdie,
acc_ferdie,
1000000000000000,
"Validator"
]
]
})
input["genesis"]["runtime"]["configuration"]["config"].update(
{
"max_code_size": 3145728,
"max_head_data_size": 20480,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default values where taken expect for validation_upgrade_delay and validation_upgrade_cooldown

"max_upward_queue_count": 10,
"max_upward_queue_size": 51200,
"max_upward_message_size": 51200,
"max_upward_message_num_per_candidate": 10,
"hrmp_max_message_num_per_candidate": 10,
"validation_upgrade_frequency": 240,
"validation_upgrade_delay": 120,
"max_head_data_size": 32768,
"max_upward_queue_count": 8,
"max_upward_queue_size": 1048576,
"max_upward_message_size": 1048576,
"max_upward_message_num_per_candidate": 5,
"hrmp_max_message_num_per_candidate": 5,
"validation_upgrade_cooldown": 20,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

"validation_upgrade_delay": 10,
"max_pov_size": 5242880,
"max_downward_message_size": 51200,
"preferred_dispatchable_upward_messages_step_weight": 100000000000,
"hrmp_max_parachain_outbound_channels": 10,
"hrmp_max_parathread_outbound_channels": 0,
"hrmp_open_request_ttl": 2,
"hrmp_sender_deposit": 1009100000000000,
"hrmp_recipient_deposit": 1009100000000000,
"hrmp_channel_max_capacity": 1000,
"hrmp_channel_max_total_size": 102400,
"hrmp_max_parachain_inbound_channels": 10,
"hrmp_max_parathread_inbound_channels": 0,
"hrmp_channel_max_message_size": 102400,
"code_retention_period": 28800,
"max_downward_message_size": 1048576,
"ump_service_total_weight": 100000000000,
"hrmp_max_parachain_outbound_channels": 4,
"hrmp_max_parathread_outbound_channels": 4,
"hrmp_sender_deposit": 0,
"hrmp_recipient_deposit": 0,
"hrmp_channel_max_capacity": 8,
"hrmp_channel_max_total_size": 8192,
"hrmp_max_parachain_inbound_channels": 4,
"hrmp_max_parathread_inbound_channels": 4,
"hrmp_channel_max_message_size": 1048576,
"code_retention_period": 1200,
"parathread_cores": 0,
"parathread_retries": 0,
"group_rotation_frequency": 10,
"chain_availability_period": 5,
"thread_availability_period": 5,
"scheduling_lookahead": 1,
"max_validators_per_core": 5,
"max_validators": 200,
"group_rotation_frequency": 20,
"chain_availability_period": 4,
"thread_availability_period": 4,
"scheduling_lookahead": 0,
"max_validators_per_core": None,
"max_validators": None,
"dispute_period": 6,
"dispute_post_conclusion_acceptance_period": 600,
"dispute_post_conclusion_acceptance_period": 100,
"dispute_max_spam_slots": 2,
"dispute_conclusion_by_time_out_period": 600,
"dispute_conclusion_by_time_out_period": 200,
"no_show_slots": 2,
"n_delay_tranches": 40,
"n_delay_tranches": 25,
"zeroth_delay_tranche_width": 0,
"needed_approvals": 15,
"relay_vrf_modulo_samples": 1
"needed_approvals": 2,
"relay_vrf_modulo_samples": 2,
"ump_max_individual_weight": 20000000000,
"pvf_checking_enabled": False,
"pvf_voting_ttl": 2,
"minimum_validation_upgrade_delay": 5
}
)

Expand Down
2 changes: 1 addition & 1 deletion .maintain/reset-spec/westend_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def update_spec(input: typing.Dict):
"max_upward_message_size": 51200,
"max_upward_message_num_per_candidate": 10,
"hrmp_max_message_num_per_candidate": 10,
"validation_upgrade_frequency": 120,
"validation_upgrade_cooldown": 120,
"validation_upgrade_delay": 60,
"max_pov_size": 5242880,
"max_downward_message_size": 51200,
Expand Down
Loading