Skip to content

Commit 772dba8

Browse files
committed
Merge remote-tracking branch 'origin/master' into bko-validate-xcm-nesting
2 parents b6ad32b + a2a049d commit 772dba8

File tree

26 files changed

+288
-101
lines changed

26 files changed

+288
-101
lines changed

.gitlab/pipeline/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ publish-subsystem-benchmarks:
7474
artifacts: true
7575
- job: subsystem-benchmark-availability-distribution
7676
artifacts: true
77+
- job: subsystem-benchmark-approval-voting
78+
artifacts: true
7779
- job: publish-rustdoc
7880
artifacts: false
7981
script:
@@ -115,6 +117,8 @@ trigger_workflow:
115117
artifacts: true
116118
- job: subsystem-benchmark-availability-distribution
117119
artifacts: true
120+
- job: subsystem-benchmark-approval-voting
121+
artifacts: true
118122
script:
119123
- echo "Triggering workflow"
120124
- >

.gitlab/pipeline/test.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ test-syscalls:
511511
fi
512512
allow_failure: false # this rarely triggers in practice
513513

514-
subsystem-benchmark-availability-recovery:
514+
.subsystem-benchmark-template:
515515
stage: test
516516
artifacts:
517517
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
@@ -523,26 +523,26 @@ subsystem-benchmark-availability-recovery:
523523
- .docker-env
524524
- .common-refs
525525
- .run-immediately
526-
script:
527-
- cargo bench -p polkadot-availability-recovery --bench availability-recovery-regression-bench --features subsystem-benchmarks
528526
tags:
529527
- benchmark
528+
529+
subsystem-benchmark-availability-recovery:
530+
extends:
531+
- .subsystem-benchmark-template
532+
script:
533+
- cargo bench -p polkadot-availability-recovery --bench availability-recovery-regression-bench --features subsystem-benchmarks
530534
allow_failure: true
531535

532536
subsystem-benchmark-availability-distribution:
533-
stage: test
534-
artifacts:
535-
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
536-
when: always
537-
expire_in: 1 hour
538-
paths:
539-
- charts/
540537
extends:
541-
- .docker-env
542-
- .common-refs
543-
- .run-immediately
538+
- .subsystem-benchmark-template
544539
script:
545540
- cargo bench -p polkadot-availability-distribution --bench availability-distribution-regression-bench --features subsystem-benchmarks
546-
tags:
547-
- benchmark
541+
allow_failure: true
542+
543+
subsystem-benchmark-approval-voting:
544+
extends:
545+
- .subsystem-benchmark-template
546+
script:
547+
- cargo bench -p polkadot-node-core-approval-voting --bench approval-voting-regression-bench --features subsystem-benchmarks
548548
allow_failure: true

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cumulus/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ use xcm_executor::XcmExecutor;
5151

5252
parameter_types! {
5353
pub const RelayLocation: Location = Location::parent();
54-
pub const RelayNetwork: Option<NetworkId> = None;
54+
pub const RelayNetwork: NetworkId = NetworkId::Rococo;
5555
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
56-
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
56+
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
5757
pub const ExecutiveBody: BodyId = BodyId::Executive;
5858
pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
5959
pub RelayTreasuryLocation: Location = (Parent, PalletInstance(rococo_runtime_constants::TREASURY_PALLET_ID)).into();

cumulus/parachains/runtimes/glutton/glutton-westend/src/xcm_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ use xcm_builder::{
3030

3131
parameter_types! {
3232
pub const WestendLocation: Location = Location::parent();
33-
pub const WestendNetwork: Option<NetworkId> = Some(NetworkId::Westend);
34-
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
33+
pub const WestendNetwork: NetworkId = NetworkId::Westend;
34+
pub UniversalLocation: InteriorLocation = [GlobalConsensus(WestendNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
3535
}
3636

3737
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,

cumulus/parachains/runtimes/starters/shell/src/xcm_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ use xcm_builder::{
3030

3131
parameter_types! {
3232
pub const RococoLocation: Location = Location::parent();
33-
pub const RococoNetwork: Option<NetworkId> = Some(NetworkId::Rococo);
34-
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
33+
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
34+
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RococoNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
3535
}
3636

3737
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,

cumulus/parachains/runtimes/testing/rococo-parachain/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}
327327

328328
parameter_types! {
329329
pub const RocLocation: Location = Location::parent();
330-
pub const RococoNetwork: Option<NetworkId> = Some(NetworkId::Rococo);
330+
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
331331
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
332-
pub UniversalLocation: InteriorLocation = [Parachain(ParachainInfo::parachain_id().into())].into();
332+
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RococoNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
333333
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
334334
}
335335

polkadot/node/core/approval-voting/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,14 @@ kvdb-memorydb = "0.13.0"
5353
test-helpers = { package = "polkadot-primitives-test-helpers", path = "../../../primitives/test-helpers" }
5454
log = { workspace = true, default-features = true }
5555
env_logger = "0.11"
56+
57+
polkadot-subsystem-bench = { path = "../../subsystem-bench" }
58+
59+
[[bench]]
60+
name = "approval-voting-regression-bench"
61+
path = "benches/approval-voting-regression-bench.rs"
62+
harness = false
63+
required-features = ["subsystem-benchmarks"]
64+
65+
[features]
66+
subsystem-benchmarks = []
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Copyright (C) Parity Technologies (UK) Ltd.
2+
// This file is part of Polkadot.
3+
4+
// Polkadot is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Polkadot is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
16+
17+
//! approval-voting throughput test
18+
//!
19+
//! Approval Voting benchmark based on Kusama parameters and scale.
20+
//!
21+
//! Subsystems involved:
22+
//! - approval-distribution
23+
//! - approval-voting
24+
25+
use polkadot_subsystem_bench::{
26+
self,
27+
approval::{bench_approvals, prepare_test, ApprovalsOptions},
28+
configuration::TestConfiguration,
29+
usage::BenchmarkUsage,
30+
utils::save_to_file,
31+
};
32+
use std::io::Write;
33+
34+
const BENCH_COUNT: usize = 10;
35+
36+
fn main() -> Result<(), String> {
37+
let mut messages = vec![];
38+
let mut config = TestConfiguration::default();
39+
config.n_cores = 100;
40+
config.n_validators = 500;
41+
config.num_blocks = 10;
42+
config.peer_bandwidth = 524288000000;
43+
config.bandwidth = 524288000000;
44+
config.latency = None;
45+
config.connectivity = 100;
46+
config.generate_pov_sizes();
47+
let options = ApprovalsOptions {
48+
last_considered_tranche: 89,
49+
coalesce_mean: 3.0,
50+
coalesce_std_dev: 1.0,
51+
coalesce_tranche_diff: 12,
52+
enable_assignments_v2: true,
53+
stop_when_approved: false,
54+
workdir_prefix: "/tmp".to_string(),
55+
num_no_shows_per_candidate: 0,
56+
};
57+
58+
println!("Benchmarking...");
59+
let usages: Vec<BenchmarkUsage> = (0..BENCH_COUNT)
60+
.map(|n| {
61+
print!("\r[{}{}]", "#".repeat(n), "_".repeat(BENCH_COUNT - n));
62+
std::io::stdout().flush().unwrap();
63+
let (mut env, state) = prepare_test(config.clone(), options.clone(), false);
64+
env.runtime().block_on(bench_approvals("approvals_throughput", &mut env, state))
65+
})
66+
.collect();
67+
println!("\rDone!{}", " ".repeat(BENCH_COUNT));
68+
69+
let average_usage = BenchmarkUsage::average(&usages);
70+
save_to_file(
71+
"charts/availability-distribution-regression-bench.json",
72+
average_usage.to_chart_json().map_err(|e| e.to_string())?,
73+
)
74+
.map_err(|e| e.to_string())?;
75+
println!("{}", average_usage);
76+
77+
// We expect no variance for received and sent
78+
// but use 0.001 because we operate with floats
79+
messages.extend(average_usage.check_network_usage(&[
80+
("Received from peers", 52944.7000, 0.001),
81+
("Sent to peers", 63532.2000, 0.001),
82+
]));
83+
messages.extend(average_usage.check_cpu_usage(&[
84+
("approval-distribution", 7.7883, 0.1),
85+
("approval-voting", 10.4655, 0.1),
86+
]));
87+
88+
if messages.is_empty() {
89+
Ok(())
90+
} else {
91+
eprintln!("{}", messages.join("\n"));
92+
Err("Regressions found".to_string())
93+
}
94+
}

polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ log = { workspace = true, default-features = true }
2929
[dev-dependencies]
3030
pallet-balances = { path = "../../../substrate/frame/balances" }
3131
pallet-assets = { path = "../../../substrate/frame/assets" }
32-
sp-core = { path = "../../../substrate/primitives/core" }
3332
sp-tracing = { path = "../../../substrate/primitives/tracing" }
3433
xcm = { package = "staging-xcm", path = ".." }
3534
# temp

0 commit comments

Comments
 (0)