mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 06:21:02 +00:00
Elastic scaling: add e2e test (#3929)
On top of https://github.com/paritytech/polkadot-sdk/pull/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>
This commit is contained in:
@@ -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 %}
|
||||
|
||||
@@ -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
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
[settings]
|
||||
timeout = 1000
|
||||
bootnode = true
|
||||
|
||||
[relaychain.genesis.runtimeGenesis.patch.configuration.config]
|
||||
needed_approvals = 4
|
||||
|
||||
[relaychain.genesis.runtimeGenesis.patch.configuration.config.scheduler_params]
|
||||
max_validators_per_core = 2
|
||||
num_cores = 2
|
||||
|
||||
[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.nodes]]
|
||||
name = "alice"
|
||||
validator = "true"
|
||||
|
||||
[[relaychain.node_groups]]
|
||||
name = "validator"
|
||||
count = 3
|
||||
args = [ "-lparachain=debug,runtime=debug"]
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
default_command = "polkadot-parachain"
|
||||
add_to_genesis = false
|
||||
register_para = true
|
||||
onboard_as_parachain = false
|
||||
|
||||
[parachains.collator]
|
||||
name = "collator2000"
|
||||
command = "polkadot-parachain"
|
||||
args = [ "-lparachain=debug" ]
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
Description: Test that a paraid acquiring multiple cores does not brick itself if ElasticScalingMVP feature is enabled in genesis
|
||||
Network: ./0002-elastic-scaling-doesnt-break-parachains.toml
|
||||
Creds: config
|
||||
|
||||
# Check authority status.
|
||||
validator: reports node_roles is 4
|
||||
|
||||
validator: reports substrate_block_height{status="finalized"} is at least 10 within 100 seconds
|
||||
|
||||
# Ensure parachain was able to make progress.
|
||||
validator: parachain 2000 block height is at least 10 within 200 seconds
|
||||
|
||||
# Register the second core assigned to this parachain.
|
||||
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
|
||||
|
||||
# Ensure parachain is now making progress.
|
||||
validator: parachain 2000 block height is at least 30 within 200 seconds
|
||||
@@ -0,0 +1,41 @@
|
||||
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
|
||||
const keyring = new zombie.Keyring({ type: "sr25519" });
|
||||
const alice = keyring.addFromUri("//Alice");
|
||||
|
||||
await new Promise(async (resolve, reject) => {
|
||||
const unsub = await api.tx.sudo
|
||||
.sudo(api.tx.coretime.assignCore(core, 0, [[{ task: para }, 57600]], null))
|
||||
.signAndSend(alice, ({ status, isError }) => {
|
||||
if (status.isInBlock) {
|
||||
console.log(
|
||||
`Transaction included at blockhash ${status.asInBlock}`,
|
||||
);
|
||||
} else if (status.isFinalized) {
|
||||
console.log(
|
||||
`Transaction finalized at blockHash ${status.asFinalized}`,
|
||||
);
|
||||
unsub();
|
||||
return resolve();
|
||||
} else if (isError) {
|
||||
console.log(`Transaction error`);
|
||||
reject(`Transaction error`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module.exports = { run };
|
||||
Reference in New Issue
Block a user