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

dmp: Check that the para exist before delivering a message #6604

Merged
merged 34 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7c9cea6
dmp: Check that the para exist before delivering a message
bkchr Nov 21, 2024
0d23781
Update from bkchr running command 'prdoc --audience runtime_dev --bum…
actions-user Nov 29, 2024
70b42e0
Fix compilation + tests
bkchr Nov 29, 2024
6c040a4
Merge remote-tracking branch 'refs/remotes/origin/bkchr-dmp-check-par…
bkchr Nov 29, 2024
575294f
Update pr_6604.prdoc
bkchr Nov 29, 2024
a1c1153
Update prdoc/pr_6604.prdoc
bkchr Nov 29, 2024
3646d0f
Update prdoc/pr_6604.prdoc
bkchr Nov 29, 2024
086192a
Add test that checks it fails
bkchr Nov 29, 2024
a6a0406
Merge remote-tracking branch 'refs/remotes/origin/bkchr-dmp-check-par…
bkchr Nov 29, 2024
1b43681
Remove duplicate code
bkchr Nov 29, 2024
040da5d
Starting to fix some benchmarks
bkchr Nov 30, 2024
080ff18
Fix pallet-xcm
bkchr Nov 30, 2024
ef2a7c0
Small clean-up for `EnsureForParachain` stuff (#6714)
bkontur Nov 30, 2024
7d0f520
More fixes
bkchr Nov 30, 2024
af60dd5
Fix coretime benchmark
bkchr Nov 30, 2024
77f6a1e
Fix identity migration benchmarks
bkchr Dec 2, 2024
3bd4868
Fix the treasury benchmarks
bkchr Dec 2, 2024
7f9791a
Use zepter to correct features
bkchr Dec 2, 2024
de2e5ef
Merge remote-tracking branch 'refs/remotes/origin/master'
bkchr Dec 2, 2024
123a805
Update polkadot/runtime/parachains/src/dmp/tests.rs
bkchr Dec 3, 2024
01dc000
Update polkadot/runtime/common/src/xcm_sender.rs
bkchr Dec 3, 2024
eaaf4cb
Update polkadot/runtime/common/src/xcm_sender.rs
bkchr Dec 3, 2024
38b8775
Update polkadot/xcm/src/v5/traits.rs
bkchr Dec 3, 2024
3348079
".git/.scripts/commands/fmt/fmt.sh"
Dec 9, 2024
411de11
Merge branch 'master' into bkchr-dmp-check-para-exists
bkchr Dec 9, 2024
e759d38
Update polkadot/runtime/parachains/src/dmp/tests.rs
bkchr Dec 10, 2024
bb73ce0
Fix test
bkchr Dec 10, 2024
4efbafa
Fix warning
bkchr Dec 10, 2024
29e87af
Update from bkchr running command 'prdoc --audience runtime_dev --bum…
Dec 10, 2024
d285d85
Update prdoc/pr_6604.prdoc
bkchr Dec 10, 2024
141035a
Fix test
bkchr Dec 11, 2024
60c70af
Merge remote-tracking branch 'refs/remotes/origin/bkchr-dmp-check-par…
bkchr Dec 11, 2024
5fe3379
Fix integration tests
bkchr Dec 12, 2024
d198303
Merge branch 'master' into bkchr-dmp-check-para-exists
bkchr Dec 12, 2024
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bridges/bin/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ runtime-benchmarks = [
"pallet-utility/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-trie",
"xcm/runtime-benchmarks",
]
integrity-test = ["static_assertions"]
test-helpers = ["bp-runtime/test-helpers", "sp-trie"]
1 change: 1 addition & 0 deletions bridges/modules/xcm-bridge-hub-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions bridges/modules/xcm-bridge-hub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/pallets/inbound-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ runtime-benchmarks = [
"snowbridge-router-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/pallets/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ runtime-benchmarks = [
"snowbridge-pallet-outbound-queue/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions bridges/snowbridge/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
1 change: 1 addition & 0 deletions bridges/snowbridge/primitives/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ runtime-benchmarks = [
"snowbridge-core/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
1 change: 1 addition & 0 deletions bridges/snowbridge/runtime/runtime-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ runtime-benchmarks = [
"snowbridge-core/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
1 change: 1 addition & 0 deletions bridges/snowbridge/runtime/test-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ runtime-benchmarks = [
"snowbridge-pallet-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
fast-runtime = []
1 change: 1 addition & 0 deletions cumulus/pallets/dmp-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
5 changes: 1 addition & 4 deletions cumulus/pallets/parachain-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ sp-version = { workspace = true }
# Polkadot
polkadot-parachain-primitives = { features = ["wasm-api"], workspace = true }
polkadot-runtime-parachains = { workspace = true }
polkadot-runtime-common = { optional = true, workspace = true }
xcm = { workspace = true }
xcm-builder = { workspace = true }

Expand Down Expand Up @@ -84,7 +83,6 @@ std = [
"log/std",
"pallet-message-queue/std",
"polkadot-parachain-primitives/std",
"polkadot-runtime-common/std",
"polkadot-runtime-parachains/std",
"scale-info/std",
"sp-core/std",
Expand All @@ -109,17 +107,16 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-message-queue/try-runtime",
"polkadot-runtime-common?/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"sp-runtime/try-runtime",
]
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ impl<T: Config> InspectMessageQueues for Pallet<T> {
}

#[cfg(feature = "runtime-benchmarks")]
impl<T: Config> polkadot_runtime_common::xcm_sender::EnsureForParachain for Pallet<T> {
impl<T: Config> polkadot_runtime_parachains::EnsureForParachain for Pallet<T> {
fn ensure(para_id: ParaId) {
if let ChannelStatus::Closed = Self::get_channel_status(para_id) {
Self::open_outbound_hrmp_channel_for_benchmarks_or_tests(para_id)
Expand Down
1 change: 1 addition & 0 deletions cumulus/pallets/xcmp-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-parachain-system/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ runtime-benchmarks = [
"polkadot-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/assets/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/bridge-hubs/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ runtime-benchmarks = [
"pallet-message-queue/runtime-benchmarks",
"snowbridge-core/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
std = [
"codec/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/testing/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ runtime-benchmarks = [
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

try-runtime = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]

# A feature that should be enabled when the runtime should be built for on-chain
Expand Down
1 change: 1 addition & 0 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ runtime-benchmarks = [
"people-rococo-runtime/runtime-benchmarks",
"people-westend-runtime/runtime-benchmarks",
"rococo-parachain-runtime/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"polkadot-omni-node-lib/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions cumulus/primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ runtime-benchmarks = [
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
1 change: 1 addition & 0 deletions cumulus/primitives/utility/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
1 change: 1 addition & 0 deletions polkadot/node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"westend-runtime?/runtime-benchmarks",
"xcm-runtime-apis/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-system/try-runtime",
Expand Down
2 changes: 2 additions & 0 deletions polkadot/parachain/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ impl HeadData {
}
}

impl codec::EncodeLike<HeadData> for alloc::vec::Vec<u8> {}

/// Parachain validation code.
#[derive(
PartialEq,
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ runtime-benchmarks = [
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"xcm/runtime-benchmarks",
]
try-runtime = [
"frame-election-provider-support/try-runtime",
Expand Down
16 changes: 16 additions & 0 deletions polkadot/runtime/common/src/identity_migrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,22 @@ pub trait OnReapIdentity<AccountId> {
/// - `bytes`: The byte size of `IdentityInfo`.
/// - `subs`: The number of sub-accounts they had.
fn on_reap_identity(who: &AccountId, bytes: u32, subs: u32) -> DispatchResult;

/// Ensure that identity reaping will be succesful in benchmarking.
///
/// Should setup the state in a way that the same call ot `[Self::on_reap_identity]` will be
/// successful.
#[cfg(feature = "runtime-benchmarks")]
fn ensure_successful_identity_reaping(who: &AccountId, bytes: u32, subs: u32);
}

impl<AccountId> OnReapIdentity<AccountId> for () {
fn on_reap_identity(_who: &AccountId, _bytes: u32, _subs: u32) -> DispatchResult {
Ok(())
}

#[cfg(feature = "runtime-benchmarks")]
fn ensure_successful_identity_reaping(_: &AccountId, _: u32, _: u32) {}
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -219,6 +229,12 @@ mod benchmarks {
}
Identity::<T>::set_subs(target_origin.clone(), subs.clone())?;

T::ReapIdentityHandler::ensure_successful_identity_reaping(
&target,
info.encoded_size() as u32,
subs.len() as u32,
);

// add registrars and provide judgements
let registrar_origin = T::RegistrarOrigin::try_successful_origin()
.expect("RegistrarOrigin has no successful origin required for the benchmark");
Expand Down
3 changes: 3 additions & 0 deletions polkadot/runtime/common/src/paras_sudo_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub mod pallet {
/// A DMP message couldn't be sent because it exceeds the maximum size allowed for a
/// downward message.
ExceedsMaxMessageSize,
/// A DMP message couldn't be sent because the destination is unreachable.
Unroutable,
/// Could not schedule para cleanup.
CouldntCleanup,
/// Not a parathread (on-demand parachain).
Expand Down Expand Up @@ -157,6 +159,7 @@ pub mod pallet {
{
dmp::QueueDownwardMessageError::ExceedsMaxMessageSize =>
Error::<T>::ExceedsMaxMessageSize.into(),
dmp::QueueDownwardMessageError::Unroutable => Error::<T>::Unroutable.into(),
})
}

Expand Down
Loading
Loading