diff --git a/parachain/build-spec.star b/parachain/build-spec.star index 802f53b..5c10b95 100644 --- a/parachain/build-spec.star +++ b/parachain/build-spec.star @@ -2,55 +2,6 @@ build_spec = import_module("../package_io/build-spec.star") constant = import_module("../package_io/constant.star") def create_parachain_build_spec_with_para_id(plan, image, binary, chain_name, chain_base, para_id): - command = ExecRecipe(command = [ - "/bin/sh", - "-c", - "{0} build-spec --chain={1} --disable-default-bootnode > /tmp/{2}.json".format(binary, chain_base, chain_name), - ]) - build_spec.create_edit_and_build_spec(plan, chain_name + "plain", image, chain_name, command, build_file = None) - command = ExecRecipe(command = [ - "/bin/sh", - "-c", - "sed -e 's/\"parachainId\": *[0-9]\\+/\"parachainId\": {0}/' -e 's/\"para_id\": [0-9]*,/\"para_id\": {0},/' -e 's/\"paraId\": [0-9]*,/\"paraId\": {0},/' -e 's/\"parachain_id\": [0-9]*,/\"parachain_id\": {0},/' /build/{1}.json > /tmp/{1}.json".format(para_id, chain_name), - ]) - build_spec.create_edit_and_build_spec(plan, chain_name + "edit", constant.CURL_JQ_IMAGE, chain_name, command, chain_name + "plain") - raw_service = create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_name, chain_name + "edit") - - return raw_service - -def create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_name, build_file): - raw_service = build_spec.create_service_for_build_spec(plan, chain_name + "raw", image, build_file) - - command = ExecRecipe(command = [ - "/bin/sh", - "-c", - "{0} build-spec --chain=/build/{1}.json --raw --disable-default-bootnode > /tmp/{1}-raw.json".format(binary, chain_name), - ]) - result = plan.exec(service_name = chain_name + "raw", recipe = command) - plan.verify(result["code"], "==", 0) - - command = ExecRecipe(command = [ - "/bin/sh", - "-c", - "{0} export-genesis-wasm --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-wasm".format(binary, chain_name), - ]) - result = plan.exec(service_name = chain_name + "raw", recipe = command) - plan.verify(result["code"], "==", 0) - - command = ExecRecipe(command = [ - "/bin/sh", - "-c", - "{0} export-genesis-state --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-state".format(binary, chain_name), - ]) - result = plan.exec(service_name = chain_name + "raw", recipe = command) - plan.verify(result["code"], "==", 0) - - plan.store_service_files(service_name = chain_name + "raw", src = "/tmp/*", name = chain_name + "raw") - plan.stop_service(chain_name + "raw") - - return raw_service - -def create_parachain_build_spec_with_para_ids(plan, image, binary, chain_name, chain_base, para_id): files = { "/app": "configs", } diff --git a/parachain/parachain.star b/parachain/parachain.star index 166a233..b06fd76 100644 --- a/parachain/parachain.star +++ b/parachain/parachain.star @@ -22,7 +22,7 @@ def start_local_parachain_node(plan, chain_type, parachain, para_id): image = parachain_details["image"] binary = parachain_details["entrypoint"] chain_base = parachain_details["base"][0] - raw_service = build_spec.create_parachain_build_spec_with_para_ids(plan, image, binary, chain_name, chain_base, para_id) + raw_service = build_spec.create_parachain_build_spec_with_para_id(plan, image, binary, chain_name, chain_base, para_id) parachain_final = {} @@ -89,9 +89,9 @@ def start_nodes(plan, chain_type, parachains, relay_chain_ip): final_parachain_details = {} for parachain in parachains: - para_id = register_para_slot.register_para_ids(plan, relay_chain_ip) + para_id = register_para_slot.register_para_id(plan, relay_chain_ip) parachain_details = start_local_parachain_node(plan, chain_type, parachain, para_id) - register_para_slot.run_onboard_genesis_state_and_wasm(plan, para_id, parachain["name"], relay_chain_ip) + register_para_slot.onboard_genesis_state_and_wasm(plan, para_id, parachain["name"], relay_chain_ip) final_parachain_details.update(parachain_details) return final_parachain_details diff --git a/parachain/register-para-id.star b/parachain/register-para-id.star index 1576bc3..013b2f8 100644 --- a/parachain/register-para-id.star +++ b/parachain/register-para-id.star @@ -2,38 +2,6 @@ build_spec = import_module("../package_io/build-spec.star") constant = import_module("../package_io/constant.star") def register_para_id(plan, alice_ip): - test = build_spec.create_service_for_build_spec(plan, constant.PARA_SLOT_REGISTER_SERVICE_NAME, constant.NODE_IMAGE, "javascript") - result = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && npm i "])) - plan.verify(result["code"], "==", 0) - result = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /build && node register ws://{0}:9944 //Alice ".format(alice_ip)])) - plan.verify(result["code"], "==", 0) - para_id = plan.exec(service_name = test.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cat /tmp/para.json | tr -d '\n\r'"])) - plan.verify(para_id["code"], "==", 0) - plan.remove_service(test.name) - return para_id["output"] - -def onboard_genesis_state_and_wasm(plan, para_id, chain_name, alice_ip): - service = plan.add_service( - name = "upload-{}-genesis-file".format(chain_name), - config = ServiceConfig( - image = constant.NODE_IMAGE, - files = { - "/app": "configs", - "/build": chain_name + "raw", - "/javascript": "javascript", - }, - entrypoint = ["/bin/sh"], - ), - ) - - result = plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && npm i "])) - plan.verify(result["code"], "==", 0) - result = plan.exec(service_name = service.name, recipe = ExecRecipe(command = ["/bin/sh", "-c", "cd /javascript && node onboard ws://{0}:9944 //Alice {1} /build/{2}-genesis-state /build/{2}-genesis-wasm".format(alice_ip, para_id, chain_name)])) - plan.verify(result["code"], "==", 0) - - plan.remove_service(service.name) - -def register_para_ids(plan, alice_ip): files = { "/app": "configs", "/build": "javascript", @@ -55,7 +23,7 @@ def register_para_ids(plan, alice_ip): ) return id.output -def run_onboard_genesis_state_and_wasm(plan, para_id, chain_name, alice_ip): +def onboard_genesis_state_and_wasm(plan, para_id, chain_name, alice_ip): files = { "/app": "configs", "/build": chain_name + "raw", diff --git a/testdata/chain_value.csv b/testdata/chain_value.csv index a56dda8..9045427 100644 --- a/testdata/chain_value.csv +++ b/testdata/chain_value.csv @@ -1,7 +1,6 @@ acala,Polkadot bifrost,Polkadot clover,Polkadot -integritee,Polkadot kilt,Polkadot moonbeam,Polkadot litentry,Polkadot