Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement function for create raw build spec for parachain #38

Merged
merged 8 commits into from
Nov 3, 2023
35 changes: 35 additions & 0 deletions parachain/parachain.star
Original file line number Diff line number Diff line change
Expand Up @@ -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)