-
Notifications
You must be signed in to change notification settings - Fork 3
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 to create build spec for parachain #36
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
158a3fe
chore: implement function for creating build spec of parachain
shanithkk c299880
chore: implement function for create raw build spec for parachain
shanithkk 6b8af71
chore: removed raw build spec function
shanithkk efc5b0f
style: code fromat
shanithkk 3310955
fix: remove undefined function in create parachain build spec function
shanithkk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
|
||
"para": { | ||
"acala": { | ||
"id": 2000, | ||
"nodes": [ | ||
{ | ||
"name": "alice", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
parachain = import_module("./parachain/parachain.star") | ||
relay_chain = import_module("./relaychain/relay-chain.star") | ||
litentry = import_module("./parachain/litentry.star") | ||
clover = import_module("./parachain/clover.star") | ||
|
||
def run(plan, args): | ||
plan.upload_files(src = "./parachain/static_files/configs", name = "configs") | ||
service_details = {"relaychains": {}, "parachains": {}} | ||
if args["chain-type"] == "local": | ||
service_details["relaychains"] = relay_chain.start_relay_chains_local(plan, args) | ||
service_details["parachains"] = clover.run_clover(plan) | ||
|
||
|
||
image = "bifrostnetwork/bifrost:bifrost-v0.9.66" | ||
binary = "/usr/local/bin/bifrost" | ||
chain_name = "bifrost-local" | ||
parachain.create_parachain_build_spec_with_para_id(plan, image, binary, chain_name, para_id = 200) | ||
|
||
else: | ||
relay_chain.start_relay_chain(plan, args) | ||
|
||
return service_details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
def create_service_for_build_spec(plan, service_name, image, build_file): | ||
files = { | ||
"/app": "configs", | ||
} | ||
if build_file != None: | ||
files["/build"] = build_file | ||
|
||
plan.add_service( | ||
name = service_name, | ||
config = ServiceConfig( | ||
image = image, | ||
files = files, | ||
entrypoint = ["bin/sh"], | ||
), | ||
) | ||
|
||
def create_edit_and_build_spec(plan, service_name, image, chain_name, command, build_file): | ||
create_service_for_build_spec(plan, service_name, image, build_file) | ||
|
||
plan.exec(service_name = service_name, recipe = command) | ||
|
||
plan.store_service_files(service_name = service_name, src = "/tmp/{0}.json".format(chain_name), name = service_name) | ||
|
||
plan.stop_service(service_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PLAIN_BUILD_SPEC = "plain-build-spec" | ||
RAW_BUILD_SPEC = "raw-build-spec" | ||
EDIT_BUILD_SPEC = "edit-build-spec" | ||
CURL_JQ_IMAGE = "badouralix/curl-jq" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
def run(plan, args): | ||
plan.print("hello") | ||
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, para_id): | ||
command = ExecRecipe(command = ["bin/sh", "-c", "{0} build-spec --chain={1} --disable-default-bootnode > /tmp/{1}.json".format(binary, chain_name)]) | ||
|
||
build_spec.create_edit_and_build_spec(plan, constant.PLAIN_BUILD_SPEC, 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},/' /build/{1}.json > /tmp/{1}.json".format(para_id, chain_name)]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. formating |
||
|
||
build_spec.create_edit_and_build_spec(plan, constant.EDIT_BUILD_SPEC, constant.CURL_JQ_IMAGE, chain_name, command, constant.PLAIN_BUILD_SPEC) | ||
shanithkk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
create_raw_build_spec_genisis_state_genisis_wasm(plan, binary, image, chain_name, constant.EDIT_BUILD_SPEC) |
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formating