-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Assets filtering pallet on master * Changed structure to have a default and origins policies * Rename, tests, isTeleportFilter * Set teleport policies on genesis build * Test * Moved tests * Updated names * fmt * IKnit benchmarks * Removed Default for GenesisConfig. serde on std * Benchmarks and serde * fmt * Cleanup * Default policies mocks and tests * fmt
- Loading branch information
Showing
9 changed files
with
1,275 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[package] | ||
name = "pallet-xcm-executor-utils" | ||
authors = { workspace = true } | ||
description = "XCM Executor configuration utility pallet" | ||
edition = "2021" | ||
license = "GPL-3.0-only" | ||
version = "0.1.0" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
serde = { workspace = true, features = ["derive"] } | ||
|
||
frame-benchmarking = { workspace = true, optional = true } | ||
frame-support = { workspace = true } | ||
frame-system = { workspace = true } | ||
parity-scale-codec = { workspace = true, features = [ | ||
"derive", | ||
"max-encoded-len", | ||
] } | ||
scale-info = { workspace = true } | ||
sp-core = { workspace = true } | ||
sp-io = { workspace = true } | ||
sp-runtime = { workspace = true } | ||
sp-std = { workspace = true } | ||
staging-xcm = { workspace = true } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"frame-benchmarking/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"parity-scale-codec/std", | ||
"scale-info/std", | ||
"serde/std", | ||
"sp-runtime/std", | ||
"sp-std/std", | ||
"staging-xcm/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Copyright (C) Moondance Labs Ltd. | ||
// This file is part of Tanssi. | ||
|
||
// Tanssi is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Tanssi is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Tanssi. If not, see <http://www.gnu.org/licenses/> | ||
|
||
#![cfg(feature = "runtime-benchmarks")] | ||
|
||
//! Benchmarking | ||
use { | ||
crate::{Call, Config, DefaultTrustPolicy, MultiLocation, Pallet, TrustPolicy}, | ||
frame_benchmarking::{impl_benchmark_test_suite, v2::*}, | ||
frame_system::RawOrigin, | ||
sp_std::vec, | ||
staging_xcm::v3::Junctions::Here, | ||
}; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn set_reserve_policy() -> Result<(), BenchmarkError> { | ||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
TrustPolicy::DefaultTrustPolicy(DefaultTrustPolicy::Never), | ||
); | ||
|
||
// assert!( | ||
Ok(()) | ||
} | ||
|
||
#[benchmark] | ||
fn remove_reserve_policy() -> Result<(), BenchmarkError> { | ||
let _ = Pallet::<T>::set_reserve_policy( | ||
RawOrigin::Root.into(), | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
TrustPolicy::DefaultTrustPolicy(DefaultTrustPolicy::Never), | ||
); | ||
|
||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
); | ||
assert!(Pallet::<T>::reserve_policy(MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}) | ||
.is_none()); | ||
|
||
Ok(()) | ||
} | ||
|
||
#[benchmark] | ||
fn set_teleport_policy() -> Result<(), BenchmarkError> { | ||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
TrustPolicy::DefaultTrustPolicy(DefaultTrustPolicy::Never), | ||
); | ||
|
||
// assert!( | ||
Ok(()) | ||
} | ||
|
||
#[benchmark] | ||
fn remove_teleport_policy() -> Result<(), BenchmarkError> { | ||
let _ = Pallet::<T>::set_teleport_policy( | ||
RawOrigin::Root.into(), | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
TrustPolicy::DefaultTrustPolicy(DefaultTrustPolicy::Never), | ||
); | ||
|
||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}, | ||
); | ||
assert!(Pallet::<T>::teleport_policy(MultiLocation { | ||
parents: 1, | ||
interior: Here, | ||
}) | ||
.is_none()); | ||
|
||
Ok(()) | ||
} | ||
|
||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); | ||
} |
Oops, something went wrong.