Skip to content

Commit

Permalink
feat: implement function for create raw build spec for parachain (#38)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
shanithkk and shreyasbhat0 authored Nov 3, 2023
1 parent ec618bc commit e81f4e8
Showing 1 changed file with 35 additions and 0 deletions.
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)

0 comments on commit e81f4e8

Please sign in to comment.