Skip to content

Commit b8d1b18

Browse files
committed
build: merge 942057 into master
2 parents 0a1a3b4 + 807186d commit b8d1b18

199 files changed

Lines changed: 7981 additions & 4465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/Dockerfile-parachain-upgrade-data.j2

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ARG PROFILE=release
2525
WORKDIR /unique_parachain
2626

2727
RUN git clone https://github.com/UniqueNetwork/unique-chain.git -b {{ MAINNET_BRANCH }} . && \
28-
cargo build --features={{ NETWORK }}-runtime --$PROFILE
28+
cargo build --features={{ NETWORK }}-runtime --$PROFILE
2929

3030
# ===== BUILD target version ======
3131
FROM rust-builder as builder-unique-target
@@ -35,43 +35,52 @@ ARG PROFILE=release
3535
COPY . /unique_parachain
3636
WORKDIR /unique_parachain
3737

38-
RUN cargo build --features={{ NETWORK }}-runtime --$PROFILE
38+
RUN cargo build --features={{ NETWORK }}-runtime{{ EXTRA_FEATURES }} --$PROFILE
3939

4040
# ===== RUN ======
4141
FROM ubuntu:22.04
4242

43+
ENV RELAY_CHAIN_TYPE={{ RELAY_CHAIN_TYPE }}
4344
ENV REPLICA_FROM={{ REPLICA_FROM }}
45+
ENV DESTINATION_SPEC_VERSION={{ DESTINATION_SPEC_VERSION }}
46+
ENV NEW_PARA_BIN=/unique-chain/target/release/unique-collator
47+
ENV NEW_PARA_WASM=/unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm
4448

4549
RUN apt-get -y update && \
4650
apt-get -y install curl git && \
4751
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
4852
export NVM_DIR="$HOME/.nvm" && \
4953
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
50-
nvm install v16.16.0 && \
51-
nvm use v16.16.0
54+
nvm install v18.16.0 && \
55+
nvm use v18.16.0
5256

53-
RUN git clone https://github.com/uniquenetwork/polkadot-launch.git -b {{ POLKADOT_LAUNCH_BRANCH }}
54-
55-
RUN export NVM_DIR="$HOME/.nvm" && \
56-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
57-
cd /polkadot-launch && \
58-
npm install --global yarn && \
59-
yarn install
57+
RUN env
6058

6159
COPY --from=builder-unique-current /unique_parachain/target/release/unique-collator /unique-chain/current/release/
6260
COPY --from=builder-unique-target /unique_parachain/target/release/unique-collator /unique-chain/target/release/
6361
COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm
6462

65-
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/launch-config-forkless-data.json /polkadot-launch/launch-config.json
66-
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/fork.jsonnet /polkadot-launch/fork.jsonnet
67-
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/typeNames.jsonnet /polkadot-launch/typeNames.jsonnet
63+
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/zombienet-forkless-data.toml /unique-chain/tests/zombienet-forkless.toml
64+
COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/fork.jsonnet /unique-chain/tests/fork.jsonnet
65+
COPY --from=builder-unique-target /unique_parachain/tests/ /unique-chain/tests/
6866

6967
COPY --from=uniquenetwork/builder-chainql:{{ CHAINQL }} /chainql/target/release/chainql /chainql/target/release/
7068

7169
COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
7270
COPY --from=polkadot /unique_parachain/polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm /polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm
71+
COPY --from=polkadot /unique_parachain/polkadot/target/release/wbuild/rococo-runtime/rococo_runtime.compact.compressed.wasm /polkadot/target/release/wbuild/rococo-runtime/rococo_runtime.compact.compressed.wasm
7372

74-
CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" REPLICA_FROM && \
73+
EXPOSE 33044
74+
EXPOSE 33055
75+
EXPOSE 33066
76+
EXPOSE 33077
77+
EXPOSE 33088
78+
EXPOSE 33144
79+
EXPOSE 33155
80+
81+
CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" REPLICA_FROM NEW_PARA_BIN NEW_PARA_WASM RELAY_CHAIN_TYPE DESTINATION_SPEC_VERSION && \
7582
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
76-
cd /polkadot-launch && \
77-
yarn start launch-config.json --test-upgrade-parachains
83+
cd /unique-chain/tests && \
84+
npm install --global yarn && \
85+
yarn install && \
86+
export DEBUG=zombie::metrics && yarn frankenstein zombienet-forkless.toml

.docker/docker-compose.forkless-data.j2

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@ version: "3.5"
33
services:
44
forkless-data:
55
image: uniquenetwork/ci-forkless-data-local:{{ NETWORK }}-{{ BUILD_TAG }}
6-
container_name: forkless-data
6+
container_name: forkless-data-{{ NETWORK }}
77
expose:
88
- 9944
99
- 9933
10+
- 33044
11+
- 33055
12+
- 33066
13+
- 33077
14+
- 33088
15+
- 33144
16+
- 33155
1017
ports:
1118
- 127.0.0.1:9944:9944
1219
- 127.0.0.1:9933:9933
20+
- 127.0.0.1:33044:33044
21+
- 127.0.0.1:33055:33055
22+
- 127.0.0.1:33066:33066
23+
- 127.0.0.1:33077:33077
24+
- 127.0.0.1:33088:33088
25+
- 127.0.0.1:33144:33144
26+
- 127.0.0.1:33155:33155

.docker/forkless-config/fork.jsonnet

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,52 @@
1+
// Get live chain data on the URL provided with `forkFrom`, and
2+
// insert the necessary data into a chain spec to launch a new chain with.
3+
//
4+
// ### Arguments
5+
// - `rawSpec`: Path to the raw chain spec to modify
6+
// - `forkFrom`: URL of the chain's WS port to get the data from
7+
//
8+
// ### Usage
9+
// `chainql --tla-code=rawSpec="import 'parachain-spec-raw.json'" --tla-str=forkFrom="wss://some-parachain.node:443" fork.jsonnet`
110

211
function(rawSpec, forkFrom)
3-
local sourceChain = cql.chain(forkFrom).latest;
12+
local sourceChainState = cql.chain(forkFrom).latest;
413

5-
local raw = local sourceRaw = sourceChain._raw._preloadKeys; {
14+
local raw = local sourceRaw = sourceChainState._raw._preloadKeys; {
615
[key]: cql.toHex(sourceRaw[key])
716
for key in std.objectFields(sourceRaw)
817
if sourceRaw[key] != null
918
};
1019

11-
local typeNames = (import './typeNames.jsonnet')(sourceChain);
12-
1320
local
1421
auraKeys = [
15-
// AuraExt.Authorities, we don't have aura pallet enabled for some reason, to refer using cql api
16-
'0x3c311d57d4daf52904616cf69648081e5e0621c4869aa60c02be9adcc98a0d1d',
17-
// Aura.Authorities
18-
'0x57f8dc2f5ab09467896f47300f0424385e0621c4869aa60c02be9adcc98a0d1d',
19-
],
22+
sourceChainState.AuraExt._key.Authorities,
23+
sourceChainState.Aura._key.Authorities,
24+
] + (if 'CollatorSelection' in sourceChainState then [
25+
sourceChainState.CollatorSelection._key.Candidates,
26+
sourceChainState.CollatorSelection._key.Invulnerables,
27+
] else []),
2028

2129
// Keys, which should be migrated from passed spec, rather than from forked chain
2230
wantedKeys = [
23-
sourceChain.ParachainInfo._key.ParachainId,
24-
sourceChain.Sudo._key.Key,
25-
sourceChain.System.BlockHash._key['0'],
26-
sourceChain.System._key.ParentHash,
31+
sourceChainState.ParachainInfo._key.ParachainId,
32+
sourceChainState.Sudo._key.Key,
33+
sourceChainState.System.BlockHash._key['0'],
34+
// Always [69, 69, 69, ..., 69, 69, 69]
35+
sourceChainState.System._key.ParentHash,
2736
] + auraKeys,
28-
2937
// Keys to remove from original chain
3038
unwantedPrefixes = [
31-
// Aura.CurrentSlot
32-
'0x57f8dc2f5ab09467896f47300f04243806155b3cd9a8c9e5e9a23fd5dc13a5ed',
39+
sourceChainState.Aura._key.CurrentSlot,
3340
// Ensure there will be no panics caused by unexpected kept state
34-
sourceChain.ParachainSystem._key.ValidationData,
35-
sourceChain.ParachainSystem._key.RelayStateProof,
36-
sourceChain.ParachainSystem._key.HostConfiguration,
37-
sourceChain.ParachainSystem._key.LastDmqMqcHead,
41+
sourceChainState.ParachainSystem._key.ValidationData,
42+
sourceChainState.ParachainSystem._key.RelayStateProof,
43+
sourceChainState.ParachainSystem._key.HostConfiguration,
44+
sourceChainState.ParachainSystem._key.LastRelayChainBlockNumber,
45+
sourceChainState.ParachainSystem._key.LastDmqMqcHead,
3846
// Part of head
39-
sourceChain.System._key.BlockHash,
40-
sourceChain.System._key.Number,
41-
sourceChain.System._key.Digest,
47+
sourceChainState.System._key.BlockHash,
48+
sourceChainState.System._key.Number,
49+
sourceChainState.System._key.Digest,
4250
] + auraKeys,
4351

4452
cleanupRaw(raw) = {
@@ -61,33 +69,37 @@ local outSpec = rawSpec {
6169
},
6270
};
6371

72+
local pow10(n) = std.foldl(function(a, _) a * std.bigint('10'), std.range(0, n), std.bigint('1'));
73+
6474
local
65-
aliceAccount = sourceChain.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),
66-
totalIssuance = sourceChain.Balances._encodeKey.TotalIssuance([]),
67-
unique = cql.calc(["10", "18", "**"]),
68-
Munique = cql.calc([unique, "10", "6", "**", "*"]),
75+
aliceAccount = sourceChainState.System._encodeKey.Account(['0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d']),
76+
totalIssuance = sourceChainState.Balances._encodeKey.TotalIssuance([]),
77+
Munique = pow10(6 + 18),
6978
;
7079

7180
outSpec {
7281
genesis+: {
7382
raw+: {
7483
top+: {
75-
[totalIssuance]: cql.calc([
76-
Munique,
77-
if std.objectHas(super, totalIssuance) then sourceChain._decode(typeNames.u128, super[totalIssuance]) else '0',
78-
if std.objectHas(super, aliceAccount) then sourceChain._decode(typeNames.AccountInfo, super[aliceAccount]).data.free else '0',
79-
'-', '+',
80-
]),
81-
[aliceAccount]: sourceChain._encode(typeNames.AccountInfo, {
84+
[totalIssuance]: sourceChainState.Balances._encodeValue.TotalIssuance(
85+
if std.objectHas(super, totalIssuance)
86+
then sourceChainState.Balances._decodeValue.TotalIssuance(super[totalIssuance])
87+
else std.bigint(0)
88+
- if std.objectHas(super, aliceAccount)
89+
then sourceChainState.System._decodeValue.Account(super[aliceAccount]).data.free
90+
else std.bigint(0)
91+
+ Munique
92+
),
93+
[aliceAccount]: sourceChainState.System._encodeValue.Account({
8294
nonce: 0,
8395
consumers: 3,
8496
providers: 1,
8597
sufficients: 0,
8698
data: {
8799
free: Munique,
88-
reserved: "0",
89-
misc_frozen: "0",
90-
fee_frozen: "0",
100+
reserved: std.bigint('0'),
101+
misc_frozen: std.bigint('0'),
102+
fee_frozen: std.bigint('0'),
91103
},
92104
},)
93105
},

.docker/forkless-config/launch-config-forkless-data.j2

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)