-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a98cd78
commit f84cd5d
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
polkadot/scripts/build-fast-rococo-and-update-chain-spec.sh
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,39 @@ | ||
#!/bin/bash -eux | ||
|
||
CURRENT_DIR=$(pwd) | ||
|
||
#directory were polkadot-sdk is checked out | ||
POLKADOT_SDK_DIR=/home/miszka/parity/10-genesis-config/polkadot-sdk-rococo | ||
|
||
# required epoch duration: | ||
EPOCH_DURATION_IN_BLOCK=6 | ||
|
||
# polkadot command: | ||
DOCKER_IMAGE=paritypr/polkadot-debug:1539-2085d3f0 | ||
POLKADOT_CMD="docker run --rm -v $CURRENT_DIR:/dir -w /dir $DOCKER_IMAGE" | ||
# POLKADOT_CMD=$POLKADOT_SDK_DIR/target/release/polkadot | ||
|
||
# path to built rococo runtime: | ||
WASM_RUNTIME_BLOB_PATH=$POLKADOT_SDK_DIR/target/release/wbuild/rococo-runtime/rococo_runtime.compact.compressed.wasm | ||
|
||
# build rococo runtime with adjusted epoch diration | ||
pushd $POLKADOT_SDK_DIR | ||
ROCOCO_EPOCH_DURATION=$EPOCH_DURATION_IN_BLOCK cargo build --features fast-runtime --release -p rococo-runtime | ||
popd | ||
|
||
# do hexdump of runtime: | ||
hexdump -v -e '/1 "%02x"' $WASM_RUNTIME_BLOB_PATH > ./runtime.hex | ||
|
||
# get westend spec: | ||
$POLKADOT_CMD build-spec --chain westend-staging > $CURRENT_DIR/wococo-source.json | ||
|
||
# replace runtime in chainspec with newly built runtime with overwritten epoch duration: | ||
jq --rawfile code runtime.hex '.genesis.runtime.system.code = "0x" + $code' > $CURRENT_DIR/chainspec-nonraw.json < $CURRENT_DIR/wococo-source.json | ||
|
||
# jq will write numbers in compact way with 1e+18, substrtate json parser dont support it. | ||
sed 's/1e+18/1000000000000000000/' -i $CURRENT_DIR/chainspec-nonraw.json | ||
|
||
# generate raw | ||
$POLKADOT_CMD build-spec --chain ./chainspec-nonraw.json --raw > $CURRENT_DIR/chainspec-raw.json | ||
|
||
|