Skip to content

Commit

Permalink
Elastic scaling: add e2e test (paritytech#3929)
Browse files Browse the repository at this point in the history
On top of paritytech#3879

I've also moved the previous test where we ensure multiple cores per
para doesn't break non elastic parachains.

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Co-authored-by: Javier Viola <363911+pepoviola@users.noreply.github.com>
  • Loading branch information
sandreim and pepoviola authored Apr 5, 2024
1 parent 5fb4397 commit 0dc0d40
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 7 deletions.
14 changes: 11 additions & 3 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,21 @@ zombienet-polkadot-functional-0011-async-backing-6-seconds-rate:
--local-dir="${LOCAL_DIR}/functional"
--test="0011-async-backing-6-seconds-rate.zndsl"

zombienet-polkadot-functional-0012-elastic-scaling-mvp:
zombienet-polkadot-elastic-scaling-0001-basic-3cores-6s-blocks:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/functional"
--test="0012-elastic-scaling-mvp.zndsl"
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0001-basic-3cores-6s-blocks.zndsl"

zombienet-polkadot-elastic-scaling-0002-elastic-scaling-doesnt-break-parachains:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0002-elastic-scaling-doesnt-break-parachains.zndsl"

zombienet-polkadot-smoke-0001-parachains-smoke-test:
extends:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[settings]
timeout = 1000

[relaychain.genesis.runtimeGenesis.patch.configuration.config.async_backing_params]
max_candidate_depth = 6
allowed_ancestry_len = 2

[relaychain.genesis.runtimeGenesis.patch.configuration.config.scheduler_params]
max_validators_per_core = 1
scheduling_lookahead = 2
num_cores = 3

[relaychain.genesis.runtimeGenesis.patch.configuration.config.approval_voting_params]
needed_approvals = 3
max_approval_coalesce_count = 5

[relaychain]
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
chain = "rococo-local"
default_command = "polkadot"

[relaychain.default_resources]
limits = { memory = "4G", cpu = "2" }
requests = { memory = "2G", cpu = "1" }

[[relaychain.node_groups]]
name = "elastic-validator"
count = 5
args = [ "-lparachain=debug,parachain::candidate-backing=trace,parachain::provisioner=trace,parachain::prospective-parachains=trace,runtime=debug"]

{% for id in range(2000,2002) %}
[[parachains]]
id = {{id}}
addToGenesis = true

[parachains.collator]
name = "some-parachain"
image = "{{COL_IMAGE}}"
command = "adder-collator"
args = ["-lparachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug"]
{% endfor %}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Description: Test with adder collator using 3 cores and async backing
Network: ./0001-basic-3cores-6s-blocks.toml
Creds: config

# Check authority status.
elastic-validator-0: reports node_roles is 4
elastic-validator-1: reports node_roles is 4
elastic-validator-2: reports node_roles is 4
elastic-validator-3: reports node_roles is 4
elastic-validator-4: reports node_roles is 4


# Register 2 extra cores to this some-parachain.
elastic-validator-0: js-script ./assign-core.js with "2000,0" return is 0 within 600 seconds
elastic-validator-0: js-script ./assign-core.js with "2000,1" return is 0 within 600 seconds

# Wait for 10 relay chain blocks
elastic-validator-0: reports substrate_block_height{status="best"} is at least 20 within 120 seconds

# Parachain should progress with 3 blocks per relay chain block, so it's reasonable to expect state to be
# at least 50, assuming some tolerance
some-parachain: log line contains "BlockData { state: 50, add: 2 }" within 10 seconds
some-parachain-1: count of log lines containing "BlockData { state: 24, add: 2 }" is 0 within 10 seconds

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Description: Test that a paraid acquiring multiple cores does not brick itself if ElasticScalingMVP feature is enabled in genesis
Network: ./0012-elastic-scaling-mvp.toml
Network: ./0002-elastic-scaling-doesnt-break-parachains.toml
Creds: config

# Check authority status.
Expand All @@ -11,7 +11,8 @@ validator: reports substrate_block_height{status="finalized"} is at least 10 wit
validator: parachain 2000 block height is at least 10 within 200 seconds

# Register the second core assigned to this parachain.
alice: js-script ./0012-register-para.js return is 0 within 600 seconds
alice: js-script ./assign-core.js with "2000,0" return is 0 within 600 seconds
alice: js-script ./assign-core.js with "2000,1" return is 0 within 600 seconds

validator: reports substrate_block_height{status="finalized"} is at least 35 within 100 seconds

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
async function run(nodeName, networkInfo, _jsArgs) {
async function run(nodeName, networkInfo, args) {
const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName];
const api = await zombie.connect(wsUri, userDefinedTypes);

let para = Number(args[0]);
let core = Number(args[1]);
console.log(`Assigning para ${para} to core ${core}`);

await zombie.util.cryptoWaitReady();

// account to submit tx
Expand All @@ -10,7 +14,7 @@ async function run(nodeName, networkInfo, _jsArgs) {

await new Promise(async (resolve, reject) => {
const unsub = await api.tx.sudo
.sudo(api.tx.coretime.assignCore(0, 35, [[{ task: 2000 }, 57600]], null))
.sudo(api.tx.coretime.assignCore(core, 0, [[{ task: para }, 57600]], null))
.signAndSend(alice, ({ status, isError }) => {
if (status.isInBlock) {
console.log(
Expand Down

0 comments on commit 0dc0d40

Please sign in to comment.