Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elastic scaling RFC 103 end-to-end tests #6452

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,36 @@ zombienet-polkadot-elastic-scaling-0002-elastic-scaling-doesnt-break-parachains:
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0002-elastic-scaling-doesnt-break-parachains.zndsl"

zombienet-polkadot-elastic-scaling-0003-slot-based-3cores:
extends:
- .zombienet-polkadot-common
variables:
FORCED_INFRA_INSTANCE: "spot-iops"
alindima marked this conversation as resolved.
Show resolved Hide resolved
before_script:
- !reference [ .zombienet-polkadot-common, before_script ]
- cp --remove-destination ${LOCAL_DIR}/assign-core.js ${LOCAL_DIR}/elastic_scaling
# override COL_IMAGE to use test-parachain
- export COL_IMAGE="docker.io/paritypr/test-parachain:${PIPELINE_IMAGE_TAG}"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0003-slot-based-3cores.zndsl"

zombienet-polkadot-elastic-scaling-0004-mixed-receipt-versions:
extends:
- .zombienet-polkadot-common
variables:
FORCED_INFRA_INSTANCE: "spot-iops"
before_script:
- !reference [ .zombienet-polkadot-common, before_script ]
- cp --remove-destination ${LOCAL_DIR}/assign-core.js ${LOCAL_DIR}/elastic_scaling
# override COL_IMAGE to use test-parachain
- export COL_IMAGE="docker.io/paritypr/test-parachain:${PIPELINE_IMAGE_TAG}"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/elastic_scaling"
--test="0004-mixed-receipt-versions.zndsl"

.zombienet-polkadot-functional-0012-spam-statement-distribution-requests:
extends:
- .zombienet-polkadot-common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ polkadot-runtime-common = { workspace = true }
# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
pallet-message-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true, features = ["experimental-ump-signals"] }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-ping = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions cumulus/test/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ std = [
]
increment-spec-version = []
elastic-scaling = []
experimental-ump-signals = ["cumulus-pallet-parachain-system/experimental-ump-signals"]
8 changes: 8 additions & 0 deletions cumulus/test/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ fn main() {
.with_current_project()
.enable_feature("elastic-scaling")
.import_memory()
.set_file_name("wasm_binary_elastic_scaling_mvp.rs")
.build();

WasmBuilder::new()
.with_current_project()
.enable_feature("elastic-scaling")
.enable_feature("experimental-ump-signals")
.import_memory()
.set_file_name("wasm_binary_elastic_scaling.rs")
.build();
}
Expand Down
5 changes: 5 additions & 0 deletions cumulus/test/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ pub mod wasm_spec_version_incremented {
include!(concat!(env!("OUT_DIR"), "/wasm_binary_spec_version_incremented.rs"));
}

pub mod elastic_scaling_mvp {
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary_elastic_scaling_mvp.rs"));
}

pub mod elastic_scaling {
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary_elastic_scaling.rs"));
Expand Down
10 changes: 10 additions & 0 deletions cumulus/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,13 @@ pub fn get_elastic_scaling_chain_spec(id: Option<ParaId>) -> ChainSpec {
.expect("WASM binary was not built, please build it!"),
)
}

/// Get the chain spec for a specific parachain ID.
pub fn get_elastic_scaling_mvp_chain_spec(id: Option<ParaId>) -> ChainSpec {
get_chain_spec_with_extra_endowed(
id,
Default::default(),
cumulus_test_runtime::elastic_scaling_mvp::WASM_BINARY
.expect("WASM binary was not built, please build it!"),
)
}
8 changes: 7 additions & 1 deletion cumulus/test/service/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,16 @@ impl SubstrateCli for TestCollatorCli {
tracing::info!("Using default test service chain spec.");
Box::new(cumulus_test_service::get_chain_spec(Some(ParaId::from(2000)))) as Box<_>
},
"elastic-scaling-mvp" => {
tracing::info!("Using elastic-scaling mvp chain spec.");
Box::new(cumulus_test_service::get_elastic_scaling_mvp_chain_spec(Some(
ParaId::from(2100),
))) as Box<_>
},
"elastic-scaling" => {
tracing::info!("Using elastic-scaling chain spec.");
Box::new(cumulus_test_service::get_elastic_scaling_chain_spec(Some(ParaId::from(
2100,
2200,
)))) as Box<_>
},
path => {
Expand Down
4 changes: 3 additions & 1 deletion polkadot/runtime/rococo/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ fn default_parachains_host_configuration(
allowed_ancestry_len: 2,
},
node_features: bitvec::vec::BitVec::from_element(
1u8 << (FeatureIndex::ElasticScalingMVP as usize),
1u8 << (FeatureIndex::ElasticScalingMVP as usize) |
1u8 << (FeatureIndex::EnableAssignmentsV2 as usize) |
1u8 << (FeatureIndex::CandidateReceiptV2 as usize),
),
scheduler_params: SchedulerParams {
lookahead: 2,
Expand Down
3 changes: 2 additions & 1 deletion polkadot/runtime/westend/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ fn default_parachains_host_configuration(
},
node_features: bitvec::vec::BitVec::from_element(
1u8 << (FeatureIndex::ElasticScalingMVP as usize) |
1u8 << (FeatureIndex::EnableAssignmentsV2 as usize),
1u8 << (FeatureIndex::EnableAssignmentsV2 as usize) |
1u8 << (FeatureIndex::CandidateReceiptV2 as usize),
),
scheduler_params: SchedulerParams {
lookahead: 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[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
num_cores = 4

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

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

# First collator uses elastic scaling MVP.
[[parachains]]
id = 2100
chain = "elastic-scaling-mvp"
add_to_genesis = true

[[parachains.collators]]
name = "collator-elastic-mvp"
image = "{{COL_IMAGE}}"
command = "test-parachain"
args = ["-laura=trace,runtime=info,cumulus-consensus=trace,consensus::common=trace,parachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug", "--force-authoring", "--experimental-use-slot-based"]

# Second collator uses UMP commitments (RFC 103).
sandreim marked this conversation as resolved.
Show resolved Hide resolved
[[parachains]]
id = 2200
chain = "elastic-scaling"
add_to_genesis = true

[[parachains.collators]]
name = "collator-elastic"
image = "{{COL_IMAGE}}"
command = "test-parachain"
args = ["-laura=trace,runtime=info,cumulus-consensus=trace,consensus::common=trace,parachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug", "--force-authoring", "--experimental-use-slot-based"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Description: Test with slot-based collator using 3 cores and async backing
Network: ./0003-slot-based-3cores.toml
Creds: config

elastic-validator: is up
collator-elastic: is up
collator-elastic-mvp: is up

# Register 2 extra cores to each parachain.
elastic-validator-0: js-script ./assign-core.js with "0,2100,57600" return is 0 within 600 seconds
elastic-validator-1: js-script ./assign-core.js with "1,2100,57600" return is 0 within 600 seconds
elastic-validator-2: js-script ./assign-core.js with "2,2200,57600" return is 0 within 600 seconds
elastic-validator-3: js-script ./assign-core.js with "3,2200,57600" return is 0 within 600 seconds

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

elastic-validator-0: parachain 2100 block height is at least 20 within 30 seconds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my general comment is that using zombienet-v1 for measuring throughput via timeout will always be hacky and result in flaky tests:

  • we are waiting the substrate block height to be at least 20, but our intent is to wait for the next timeslice to kick in - this check might have false positives (block number > 20, but timeslice didn't kick in)
    then we're trying to measure parachain throughput via block height and timeouts - again this is flaky, because we are not starting to wait from 0 - the risk is having "passing tests", but broken functionality

we should switch to using zombienet-sdk tests IMHO, especially for newly written tests. are there any blockers for doing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I chose not to do this in the beginning because it would have taken a longer time and I was quite busy.
I switched to using zombienet-sdk test now, please have a look

elastic-validator-0: parachain 2200 block height is at least 20 within 30 seconds
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[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
num_cores = 2

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

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

[[parachains]]
id = 2200
chain = "elastic-scaling"
add_to_genesis = true

[[parachains.collators]]
name = "collator-elastic"
image = "{{COL_IMAGE}}"
command = "test-parachain"
args = ["-laura=trace,runtime=info,cumulus-consensus=trace,consensus::common=trace,parachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug", "--force-authoring", "--experimental-use-slot-based"]

[[parachains.collators]]
name = "old-collator-elastic"
# Use an old image here, this is roughly the commit where the stable2407 release branched off.
image = "docker.io/paritypr/test-parachain:master-b862b181"
command = "test-parachain"
args = ["-laura=trace,runtime=info,cumulus-consensus=trace,consensus::common=trace,parachain::collation-generation=trace,parachain::collator-protocol=trace,parachain=debug", "--force-authoring", "--experimental-use-slot-based"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Description: Test 3-core elastic scaling with two slot-based collators using both receipt versions
Network: ./0004-mixed-receipt-versions.toml
Creds: config

elastic-validator: is up
collator-elastic: is up
old-collator-elastic: is up

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

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

# We won't get full throughput as some candidates would be built for the same block and therefore dropped in the runtime.
elastic-validator-0: parachain 2200 block height is at least 16 within 30 seconds
Loading