From e81f4e8c1562f49f2aa86a5ecbbe3215b6923514 Mon Sep 17 00:00:00 2001 From: SHANiTH K K <59169878+shanithkk@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:02:45 +0530 Subject: [PATCH] feat: implement function for create raw build spec for parachain (#38) * chore: implement function for creating build spec of parachain * chore: implement function for create raw build spec for parachain * chore: removed raw build spec function * style: code fromat * fix: remove undefined function in create parachain build spec function * chore: implement function for create raw build spec for parachain --------- Co-authored-by: Shreyas S Bhat <35568964+shreyasbhat0@users.noreply.github.com> --- parachain/parachain.star | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/parachain/parachain.star b/parachain/parachain.star index 003b6d1..8408bbe 100644 --- a/parachain/parachain.star +++ b/parachain/parachain.star @@ -14,3 +14,38 @@ def create_parachain_build_spec_with_para_id(plan, image, binary, chain_name, pa "sed -e 's/\"parachainId\": *[0-9]\\+/\"parachainId\": {0}/' -e 's/\"para_id\": [0-9]*,/\"para_id\": {0},/' -e 's/\"paraId\": [0-9]*,/\"paraId\": {0},/' /build/{1}.json > /tmp/{1}.json".format(para_id, chain_name), ]) build_spec.create_edit_and_build_spec(plan, constant.EDIT_BUILD_SPEC, constant.CURL_JQ_IMAGE, chain_name, command, constant.PLAIN_BUILD_SPEC) + create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_name, constant.EDIT_BUILD_SPEC) + +def create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_name, build_file): + build_spec.create_service_for_build_spec(plan, constant.RAW_BUILD_SPEC, 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), + ]) + plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command) + + command = ExecRecipe(command = [ + "bin/sh", + "-c", + "{0} export-genesis-wasm --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-wasm".format(binary, chain_name), + ]) + plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command) + + command = ExecRecipe(command = [ + "bin/sh", + "-c", + "{0} export-genesis-state --chain=/tmp/{1}-raw.json > /tmp/{1}-genesis-state".format(binary, chain_name), + ]) + plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command) + + command = ExecRecipe(command = [ + "bin/sh", + "-c", + "cp /build/{0}.json /tmp/{0}.json".format(chain_name), + ]) + plan.exec(service_name = constant.RAW_BUILD_SPEC, recipe = command) + + plan.store_service_files(service_name = constant.RAW_BUILD_SPEC, src = "/tmp/*", name = constant.RAW_BUILD_SPEC) + plan.stop_service(constant.RAW_BUILD_SPEC)