Skip to content

Commit 996219d

Browse files
authored
Update parachain registration script to new extrinsic (#252)
* Update parachain registration script to new extrinsic * Update parachain registration script
1 parent f27b7ac commit 996219d

File tree

2 files changed

+77
-19
lines changed

2 files changed

+77
-19
lines changed

cumulus/scripts/register_parachain.sh

+13-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
usage() {
44
echo Usage:
5-
echo "$0 <url> <seed> <wasm> <genesis> <parachain-id> <tokens> <account>"
5+
echo "$0 <url> <seed> <wasm> <genesis> <parachain-id> <types>"
66
exit 1
77
}
88

@@ -11,46 +11,40 @@ seed=$2
1111
wasm=$3
1212
genesis=$4
1313
parachain_id=$5
14-
tokens=$6
15-
account=$7
14+
types=$6 # we can remove this once parachain types are included in polkadot-js-api
1615

1716
[ -z "$url" ] && usage
1817
[ -z "$seed" ] && usage
1918
[ -z "$wasm" ] && usage
19+
[ -z "$types" ] && usage
2020
[ -z "$genesis" ] && usage
2121
[ -z "$parachain_id" ] && usage
22-
[ -z "$tokens" ] && usage
23-
[ -z "$account" ] && usage
2422
if ! [ -r "$wasm" ]; then
2523
echo "Could not read: $wasm"
2624
exit 1
2725
fi
26+
if ! [ -r "$types" ]; then
27+
echo "Could not read: $types"
28+
exit 1
29+
fi
2830

2931
if ! which polkadot-js-api &> /dev/null; then
3032
echo 'command `polkadot-js-api` not in PATH'
31-
echo "npm install -g @polkadot/api-cli"
33+
echo "npm install -g @polkadot/api-cli@beta"
3234
exit 1
3335
fi
3436

3537
set -e -x
3638

3739
test -f "$seed" && seed="$(cat "$seed")"
3840

39-
polkadot-js-api \
40-
--ws "${url?}" \
41-
--sudo \
42-
--seed "${seed?}" \
43-
tx.registrar.registerPara \
44-
"${parachain_id?}" \
45-
'{"scheduling":"Always"}' \
46-
@"${wasm?}" \
47-
"${genesis?}"
41+
wasm=$(cat $wasm)
4842

4943
polkadot-js-api \
5044
--ws "${url?}" \
5145
--sudo \
5246
--seed "${seed?}" \
53-
tx.balances.setBalance \
54-
"${account?}" \
55-
$((tokens * 10 ** 12)) \
56-
0
47+
--types "${types?}" \
48+
tx.parasSudoWrapper.sudoScheduleParaInitialize \
49+
"${parachain_id?}" \
50+
"{ \"genesisHead\":\"${genesis?}\", \"validationCode\":\"${wasm?}\", \"parachain\": true }" \
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"HrmpChannelId": {
3+
"sender": "u32",
4+
"receiver": "u32"
5+
},
6+
"SignedAvailabilityBitfield": {
7+
"payload": "BitVec",
8+
"validator_index": "u32",
9+
"signature": "Signature"
10+
},
11+
"SignedAvailabilityBitfields": "Vec<SignedAvailabilityBitfield>",
12+
"ValidatorSignature": "Signature",
13+
"HeadData": "Vec<u8>",
14+
"CandidateDescriptor": {
15+
"para_id": "u32",
16+
"relay_parent": "Hash",
17+
"collator_id": "Hash",
18+
"persisted_validation_data_hash": "Hash",
19+
"pov_hash": "Hash",
20+
"erasure_root": "Hash",
21+
"signature": "Signature"
22+
},
23+
"CandidateReceipt": {
24+
"descriptor": "CandidateDescriptor",
25+
"commitments_hash": "Hash"
26+
},
27+
"UpwardMessage": "Vec<u8>",
28+
"OutboundHrmpMessage": {
29+
"recipient": "u32",
30+
"data": "Vec<u8>"
31+
},
32+
"ValidationCode": "Vec<u8>",
33+
"CandidateCommitments": {
34+
"upward_messages": "Vec<UpwardMessage>",
35+
"horizontal_messages": "Vec<OutboundHrmpMessage>",
36+
"new_validation_code": "Option<ValidationCode>",
37+
"head_data": "HeadData",
38+
"processed_downward_messages": "u32",
39+
"hrmp_watermark": "BlockNumber"
40+
},
41+
"CommittedCandidateReceipt": {
42+
"descriptor": "CandidateDescriptor",
43+
"commitments": "CandidateCommitments"
44+
},
45+
"ValidityAttestation": {
46+
"_enum": {
47+
"DummyOffsetBy1": "Raw",
48+
"Implicit": "ValidatorSignature",
49+
"Explicit": "ValidatorSignature"
50+
}
51+
},
52+
"BackedCandidate": {
53+
"candidate": "CommittedCandidateReceipt",
54+
"validity_votes": "Vec<ValidityAttestation>",
55+
"validator_indices": "BitVec"
56+
},
57+
"CandidatePendingAvailablility": {
58+
"core": "u32",
59+
"descriptor": "CandidateDescriptor",
60+
"availability_votes": "BitVec",
61+
"relay_parent_number": "BlockNumber",
62+
"backed_in_number": "BlockNumber"
63+
}
64+
}

0 commit comments

Comments
 (0)