Skip to content

Commit

Permalink
Merge pull request #1 from open-web3-stack/polkadot-v1.13.0
Browse files Browse the repository at this point in the history
Polkadot v1.13.0
  • Loading branch information
ipapandinas authored Sep 4, 2024
2 parents d3629f9 + 706e7ff commit d5d465f
Show file tree
Hide file tree
Showing 38 changed files with 182 additions and 162 deletions.
59 changes: 31 additions & 28 deletions Cargo.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ members = [

resolver = "2"

[workspace.metadata.orml]
crates-version = "0.13.0"

[profile.dev]
split-debuginfo = "unpacked"

Expand All @@ -37,35 +40,35 @@ scale-info = { version = "2.10.0", default-features = false, features = ["derive
serde = { version = "1.0.189" }
parity-scale-codec = { version = "3.6.5", default-features = false, features = ["max-encoded-len"] }

cumulus-pallet-xcm = { version = "0.11.0", default-features = false }
cumulus-primitives-core = { version = "0.11.0", default-features = false }
frame-benchmarking = { version = "32.0.0", default-features = false }
frame-support = { version = "32.0.0", default-features = false }
frame-system = { version = "32.0.0", default-features = false }
pallet-balances = { version = "33.0.0", default-features = false }
pallet-elections-phragmen = { version = "33.0.0", default-features = false }
pallet-message-queue = { version = "35.0.0", default-features = false }
pallet-preimage = { version = "32.0.0", default-features = false }
pallet-root-testing = { version = "8.0.0", default-features = false }
pallet-scheduler = { version = "33.0.0", default-features = false }
pallet-timestamp = { version = "31.0.0", default-features = false }
pallet-treasury = { version = "31.0.0", default-features = false }
pallet-xcm = { version = "11.0.0", default-features = false }
polkadot-parachain-primitives = { version = "10.0.0", default-features = false }
polkadot-runtime-common = { version = "11.0.0", default-features = false }
polkadot-runtime-parachains = { version = "11.0.0", default-features = false }
sp-api = { version = "30.0.0", default-features = false }
sp-application-crypto = { version = "34.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.14.0", default-features = false }
cumulus-primitives-core = { version = "0.14.0", default-features = false }
frame-benchmarking = { version = "35.0.0", default-features = false }
frame-support = { version = "35.0.0", default-features = false }
frame-system = { version = "35.0.0", default-features = false }
pallet-balances = { version = "36.0.0", default-features = false }
pallet-elections-phragmen = { version = "36.0.0", default-features = false }
pallet-message-queue = { version = "38.0.0", default-features = false }
pallet-preimage = { version = "35.0.0", default-features = false }
pallet-root-testing = { version = "11.0.0", default-features = false }
pallet-scheduler = { version = "36.0.0", default-features = false }
pallet-timestamp = { version = "34.0.0", default-features = false }
pallet-treasury = { version = "34.0.0", default-features = false }
pallet-xcm = { version = "14.0.0", default-features = false }
polkadot-parachain-primitives = { version = "13.0.0", default-features = false }
polkadot-runtime-common = { version = "14.0.0", default-features = false }
polkadot-runtime-parachains = { version = "14.0.0", default-features = false }
sp-api = { version = "33.0.0", default-features = false }
sp-application-crypto = { version = "37.0.0", default-features = false }
sp-arithmetic = { version = "26.0.0", default-features = false }
sp-core = { version = "32.0.0", default-features = false }
sp-io = { version = "34.0.0", default-features = false }
sp-runtime = { version = "35.0.0", default-features = false }
sp-runtime-interface = { version = "27.0.0", default-features = false }
sp-staking = { version = "30.0.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-io = { version = "37.0.0", default-features = false }
sp-runtime = { version = "38.0.0", default-features = false }
sp-runtime-interface = { version = "28.0.0", default-features = false }
sp-staking = { version = "33.0.0", default-features = false }
sp-std = { version = "14.0.0", default-features = false }
sp-storage = { version = "21.0.0", default-features = false }
xcm = { version = "11.0.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "11.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "11.0.0", package = "staging-xcm-executor", default-features = false }
xcm = { version = "14.0.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "14.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "14.0.0", package = "staging-xcm-executor", default-features = false }

xcm-simulator = { version = "11.0.0" }
xcm-simulator = { version = "14.0.0" }
4 changes: 2 additions & 2 deletions asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "orml-asset-registry"
description = "Registry for (foreign) assets"
repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/asset-registry"
license = "Apache-2.0"
version = "0.10.0"
version = "0.13.0"
authors = ["Interlay Ltd, etc"]
edition = "2021"

Expand All @@ -27,7 +27,7 @@ xcm-builder = { workspace = true }
xcm-executor = { workspace = true }

# orml
orml-traits = { path = "../traits", version = "0.10.0", default-features = false }
orml-traits = { path = "../traits", version = "0.13.0", default-features = false }

# for runtime-benchmarks
polkadot-runtime-common = { workspace = true, optional = true }
Expand Down
1 change: 1 addition & 0 deletions asset-registry/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ impl Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand Down
1 change: 1 addition & 0 deletions asset-registry/src/mock/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl Config for XcmConfig {
type HrmpNewChannelOpenRequestHandler = ();
type HrmpChannelAcceptedHandler = ();
type HrmpChannelClosingHandler = ();
type XcmRecorder = ();
}

pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>;
Expand Down
15 changes: 10 additions & 5 deletions asset-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ use sp_runtime::{
use xcm::{v3, v4::prelude::*, VersionedLocation};
use xcm_simulator::TestExt;

#[allow(deprecated)]
type OldLocation = xcm::v2::MultiLocation;
#[allow(deprecated)]
type OldJunctions = xcm::v2::Junctions;
#[allow(deprecated)]
type OldJunction = xcm::v2::Junction;

fn treasury_account() -> AccountId32 {
Expand Down Expand Up @@ -585,12 +588,14 @@ fn test_asset_authority() {
#[test]
fn test_v2_to_v3_incompatible_multilocation() {
// Assert that V2 and V3 Location both are encoded differently

#[allow(deprecated)]
let old_location = OldLocation::new(
0,
OldJunctions::X1(OldJunction::GeneralKey(vec![0].try_into().unwrap())),
);
assert!(
OldLocation::new(
0,
OldJunctions::X1(OldJunction::GeneralKey(vec![0].try_into().unwrap()))
)
.encode() != Location::new(0, [Junction::from(BoundedVec::try_from(vec![0]).unwrap())]).encode()
old_location.encode() != Location::new(0, [Junction::from(BoundedVec::try_from(vec![0]).unwrap())]).encode()
);
}

Expand Down
4 changes: 2 additions & 2 deletions auction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "orml-auction"
description = "Auction module that implements `Auction` trait."
repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/auction"
license = "Apache-2.0"
version = "0.10.0"
version = "0.13.0"
authors = ["Acala Developers"]
edition = "2021"

Expand All @@ -17,7 +17,7 @@ frame-system = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

orml-traits = { path = "../traits", version = "0.10.0", default-features = false }
orml-traits = { path = "../traits", version = "0.13.0", default-features = false }

[dev-dependencies]
sp-core = { workspace = true, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion authority/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "orml-authority"
description = "Utility pallet to perform ROOT calls in a PoA network"
repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/auction"
license = "Apache-2.0"
version = "0.10.0"
version = "0.13.0"
authors = ["Acala Developers"]
edition = "2021"

Expand Down
4 changes: 3 additions & 1 deletion benchmarking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "orml-benchmarking"
description = "Provide macro to benchmark Substrate runtime."
repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/benchmarking"
license = "Apache-2.0"
version = "0.10.0"
version = "0.13.0"
authors = ["Laminar Developers <[email protected]>"]
edition = "2021"

Expand All @@ -17,6 +17,7 @@ serde = { workspace = true, optional = true }
frame-benchmarking = { workspace = true }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-runtime-interface = { workspace = true }
Expand All @@ -38,6 +39,7 @@ std = [
"scale-info/std",
"serde",
"sp-api/std",
"sp-core/std",
"sp-io/std",
"sp-runtime-interface/std",
"sp-runtime/std",
Expand Down
78 changes: 36 additions & 42 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ mod tests;

pub use frame_benchmarking::{
benchmarking, whitelisted_caller, BenchmarkBatch, BenchmarkConfig, BenchmarkError, BenchmarkList,
BenchmarkMetadata, BenchmarkParameter, BenchmarkResult, Benchmarking, BenchmarkingSetup,
BenchmarkMetadata, BenchmarkParameter, BenchmarkRecording, BenchmarkResult, Benchmarking, BenchmarkingSetup,
Recording,
};

#[cfg(feature = "std")]
pub use frame_benchmarking::{Analysis, BenchmarkSelector};
#[doc(hidden)]
Expand All @@ -20,6 +22,8 @@ pub use parity_scale_codec;
#[doc(hidden)]
pub use paste;
#[doc(hidden)]
pub use sp_core::defer;
#[doc(hidden)]
pub use sp_io::storage::root as storage_root;
#[doc(hidden)]
pub use sp_runtime::traits::Zero;
Expand Down Expand Up @@ -176,7 +180,6 @@ macro_rules! whitelist_account {
/// });
/// }
/// ```
#[macro_export]
macro_rules! runtime_benchmarks {
(
Expand Down Expand Up @@ -626,9 +629,10 @@ macro_rules! benchmark_backend {

fn instance(
&self,
recording: &mut impl $crate::Recording,
components: &[($crate::BenchmarkParameter, u32)],
verify: bool
) -> Result<$crate::Box<dyn FnOnce() -> Result<(), $crate::BenchmarkError>>, $crate::BenchmarkError> {
) -> Result<(), $crate::BenchmarkError> {
$(
// Prepare instance
let $param = components.iter()
Expand All @@ -642,13 +646,14 @@ macro_rules! benchmark_backend {
$( $param_instancer ; )*
$( $post )*

Ok($crate::Box::new(move || -> Result<(), $crate::BenchmarkError> {
$eval;
if verify {
$postcode;
}
Ok(())
}))
recording.start();
$eval;
recording.stop();

if verify {
$postcode;
}
Ok(())
}
}
};
Expand Down Expand Up @@ -696,14 +701,15 @@ macro_rules! selected_benchmark {

fn instance(
&self,
recording: &mut impl $crate::Recording,
components: &[($crate::BenchmarkParameter, u32)],
verify: bool
) -> Result<$crate::Box<dyn FnOnce() -> Result<(), $crate::BenchmarkError>>, $crate::BenchmarkError> {
) -> Result<(), $crate::BenchmarkError> {
match self {
$(
Self::$bench => <
$bench as $crate::BenchmarkingSetup<$runtime $(, $bench_inst)? >
>::instance(&$bench, components, verify),
>::instance(&$bench, recording, components, verify),
)*
}
}
Expand Down Expand Up @@ -781,14 +787,7 @@ macro_rules! impl_benchmark {

let mut results: $crate::Vec<$crate::BenchmarkResult> = $crate::Vec::new();

// Always do at least one internal repeat...
for _ in 0 .. internal_repeats.max(1) {
// Set up the externalities environment for the setup we want to
// benchmark.
let closure_to_benchmark = <
SelectedBenchmark as $crate::BenchmarkingSetup<$runtime $(, $instance)?>
>::instance(&selected_benchmark, c, verify)?;

let on_before_start = || {
// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Pallet::<$runtime>::block_number()) {
frame_system::Pallet::<$runtime>::set_block_number(1u32.into());
Expand All @@ -800,27 +799,25 @@ macro_rules! impl_benchmark {

// Reset the read/write counter so we don't count operations in the setup process.
$crate::benchmarking::reset_read_write_count();
};

// Always do at least one internal repeat...
for _ in 0 .. internal_repeats.max(1) {
// Always reset the state after the benchmark.
$crate::defer!($crate::benchmarking::wipe_db());

// Time the extrinsic logic.
$crate::log::trace!(
target: "benchmark",
"Start Benchmark: {:?}", c
);

let start_pov = $crate::benchmarking::proof_size();
let start_extrinsic = $crate::benchmarking::current_time();

closure_to_benchmark()?;

let finish_extrinsic = $crate::benchmarking::current_time();
let end_pov = $crate::benchmarking::proof_size();
let mut recording = $crate::BenchmarkRecording::new(&on_before_start);
<SelectedBenchmark as $crate::BenchmarkingSetup<$runtime>>::instance(&selected_benchmark, &mut recording, c, verify)?;

// Calculate the diff caused by the benchmark.
let elapsed_extrinsic = finish_extrinsic.saturating_sub(start_extrinsic);
let diff_pov = match (start_pov, end_pov) {
(Some(start), Some(end)) => end.saturating_sub(start),
_ => Default::default(),
};
let elapsed_extrinsic = recording.elapsed_extrinsic().expect("elapsed time should be recorded");
let diff_pov = recording.diff_pov().unwrap_or_default();

// Commit the changes to get proper write count
$crate::benchmarking::commit_db();
Expand Down Expand Up @@ -917,18 +914,16 @@ macro_rules! impl_benchmark_test {
let execute_benchmark = |
c: $crate::Vec<($crate::BenchmarkParameter, u32)>
| -> Result<(), $crate::BenchmarkError> {
// Set up the benchmark, return execution + verification function.
let closure_to_verify = <
SelectedBenchmark as $crate::BenchmarkingSetup<$runtime, _>
>::instance(&selected_benchmark, &c, true)?;

// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Pallet::<$runtime>::block_number()) {
frame_system::Pallet::<$runtime>::set_block_number(1u32.into());
}
let on_before_start = || {
// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Pallet::<$runtime>::block_number()) {
frame_system::Pallet::<$runtime>::set_block_number(1u32.into());
}
};

// Run execution + verification
closure_to_verify()?;
<SelectedBenchmark as $crate::BenchmarkingSetup<$runtime, _>>::test_instance(&selected_benchmark, &c, &on_before_start)?;

// Reset the state
$crate::benchmarking::wipe_db();
Expand Down Expand Up @@ -1386,7 +1381,6 @@ macro_rules! cb_add_benchmarks {
/// ```
///
/// This should match what exists with the `add_benchmark!` macro.
#[macro_export]
macro_rules! list_benchmark {
( $list:ident, $extra:ident, $name:path, $( $location:tt )* ) => (
Expand Down
Loading

0 comments on commit d5d465f

Please sign in to comment.