Skip to content

Commit

Permalink
Polkadot stable2412 (#1018)
Browse files Browse the repository at this point in the history
* stable2412

* remove workaround

* fixes after update

* fix

* workaround

---------

Co-authored-by: Valery Klachkov <[email protected]>
  • Loading branch information
xlc and vklachkov authored Jan 30, 2025
1 parent 59e3734 commit ee451b0
Show file tree
Hide file tree
Showing 38 changed files with 109 additions and 103 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
tar -zxvf cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz -C $HOME/.cargo/bin
make Cargo.toml
cargo update
cargo update -p xcm-procedural --precise 10.1.0
cargo update [email protected] --precise 3.6.12
cargo update [email protected] --precise 3.6.12
cargo tarpaulin --verbose --no-fail-fast --workspace --timeout 300 --out Xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
- name: Update
run: |
cargo update
cargo update -p xcm-procedural --precise 10.1.0
cargo update [email protected] --precise 3.6.12
cargo update [email protected] --precise 3.6.12
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Check for Wasm
Expand Down
64 changes: 32 additions & 32 deletions Cargo.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,40 @@ resolver = "2"
split-debuginfo = "unpacked"

[workspace.dependencies]
log = { version = "0.4.20", default-features = false }
log = { version = "0.4.25", default-features = false }
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"] }
serde = { version = "1.0.214" }
parity-scale-codec = { version = "3.6.12", default-features = false, features = ["max-encoded-len"] }

cumulus-pallet-xcm = { version = "0.17.0", default-features = false }
cumulus-primitives-core = { version = "0.16.0", default-features = false }
frame-benchmarking = { version = "38.0.0", default-features = false }
frame-support = { version = "38.0.0", default-features = false }
frame-system = { version = "38.0.0", default-features = false }
pallet-balances = { version = "39.0.0", default-features = false }
pallet-elections-phragmen = { version = "39.0.0", default-features = false }
pallet-message-queue = { version = "41.0.1", default-features = false }
pallet-preimage = { version = "38.0.0", default-features = false }
pallet-root-testing = { version = "14.0.0", default-features = false }
pallet-scheduler = { version = "39.0.0", default-features = false }
pallet-timestamp = { version = "37.0.0", default-features = false }
pallet-treasury = { version = "37.0.0", default-features = false }
pallet-xcm = { version = "17.0.0", default-features = false }
polkadot-parachain-primitives = { version = "14.0.0", default-features = false }
polkadot-runtime-common = { version = "17.0.0", default-features = false }
polkadot-runtime-parachains = { version = "17.0.1", default-features = false }
sp-api = { version = "34.0.0", default-features = false }
sp-application-crypto = { version = "38.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.18.0", default-features = false }
cumulus-primitives-core = { version = "0.17.0", default-features = false }
frame-benchmarking = { version = "39.0.0", default-features = false }
frame-support = { version = "39.0.0", default-features = false }
frame-system = { version = "39.1.0", default-features = false }
pallet-balances = { version = "40.0.0", default-features = false }
pallet-elections-phragmen = { version = "40.0.0", default-features = false }
pallet-message-queue = { version = "42.0.0", default-features = false }
pallet-preimage = { version = "39.0.0", default-features = false }
pallet-root-testing = { version = "15.0.0", default-features = false }
pallet-scheduler = { version = "40.0.0", default-features = false }
pallet-timestamp = { version = "38.0.0", default-features = false }
pallet-treasury = { version = "38.0.0", default-features = false }
pallet-xcm = { version = "18.0.0", default-features = false }
polkadot-parachain-primitives = { version = "15.0.0", default-features = false }
polkadot-runtime-common = { version = "18.0.0", default-features = false }
polkadot-runtime-parachains = { version = "18.0.1", default-features = false }
sp-api = { version = "35.0.0", default-features = false }
sp-application-crypto = { version = "39.0.0", default-features = false }
sp-arithmetic = { version = "26.0.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-io = { version = "38.0.0", default-features = false }
sp-runtime = { version = "39.0.1", default-features = false }
sp-runtime-interface = { version = "28.0.0", default-features = false }
sp-staking = { version = "36.0.0", default-features = false }
sp-core = { version = "35.0.0", default-features = false }
sp-io = { version = "39.0.0", default-features = false }
sp-runtime = { version = "40.1.0", default-features = false }
sp-runtime-interface = { version = "29.0.0", default-features = false }
sp-staking = { version = "37.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 = "14.2.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "17.0.1", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "17.0.0", package = "staging-xcm-executor", default-features = false }
sp-storage = { version = "22.0.0", default-features = false }
xcm = { version = "15.0.1", package = "staging-xcm", default-features = false }
xcm-builder = { version = "18.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "18.0.0", package = "staging-xcm-executor", default-features = false }

xcm-simulator = { version = "17.0.0" }
xcm-simulator = { version = "18.0.0" }
8 changes: 4 additions & 4 deletions asset-registry/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use sp_std::prelude::*;
use xcm::VersionedLocation;
use xcm::{
v3,
v4::{prelude::*, Weight as XcmWeight},
v5::{prelude::*, Weight as XcmWeight},
};
use xcm_builder::TakeRevenue;
use xcm_executor::{traits::WeightTrader, AssetsInHolding};
Expand Down Expand Up @@ -188,7 +188,7 @@ impl<T: Config> Inspect for Pallet<T> {
type StringLimit = T::StringLimit;

fn asset_id(location: &Location) -> Option<Self::AssetId> {
Pallet::<T>::location_to_asset_id(v3::Location::try_from(location.clone()).ok()?)
Pallet::<T>::location_to_asset_id(v3::Location::try_from(location.clone().into_versioned()).ok()?)
}

fn metadata(id: &Self::AssetId) -> Option<AssetMetadata<Self::Balance, Self::CustomMetadata, Self::StringLimit>> {
Expand All @@ -198,11 +198,11 @@ impl<T: Config> Inspect for Pallet<T> {
fn metadata_by_location(
location: &Location,
) -> Option<AssetMetadata<Self::Balance, Self::CustomMetadata, Self::StringLimit>> {
Pallet::<T>::fetch_metadata_by_location(&v3::Location::try_from(location.clone()).ok()?)
Pallet::<T>::fetch_metadata_by_location(&v3::Location::try_from(location.clone().into_versioned()).ok()?)
}

fn location(asset_id: &Self::AssetId) -> Result<Option<Location>, DispatchError> {
Pallet::<T>::location(asset_id).map(|l| l.and_then(|l| l.try_into().ok()))
Pallet::<T>::location(asset_id).map(|l| l.and_then(|l| l.into_versioned().try_into().ok()))
}
}

Expand Down
10 changes: 5 additions & 5 deletions asset-registry/src/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sp_io::TestExternalities;
use sp_runtime::{traits::Convert, AccountId32, BuildStorage};
use xcm::{
v3,
v4::{Asset, Location},
v5::{Asset, Location},
};
use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt};

Expand Down Expand Up @@ -109,12 +109,12 @@ impl Convert<CurrencyId, Option<Location>> for CurrencyIdConvert {
),
CurrencyId::RegisteredAsset(id) => AssetRegistry::location(&id).unwrap_or_default(),
};
loc.and_then(|l| l.try_into().ok())
loc.and_then(|l| l.into_versioned().try_into().ok())
}
}
impl Convert<Location, Option<CurrencyId>> for CurrencyIdConvert {
fn convert(l: Location) -> Option<CurrencyId> {
use xcm::v4::Junction::*;
use xcm::v5::Junction::*;

let a: Vec<u8> = "A".into();
let a1: Vec<u8> = "A1".into();
Expand Down Expand Up @@ -147,14 +147,14 @@ impl Convert<Location, Option<CurrencyId>> for CurrencyIdConvert {
_ => None,
};
currency_id.or_else(|| {
let loc = v3::Location::try_from(l.clone()).ok()?;
let loc = v3::Location::try_from(l.into_versioned()).ok()?;
AssetRegistry::location_to_asset_id(&loc).map(CurrencyId::RegisteredAsset)
})
}
}
impl Convert<Asset, Option<CurrencyId>> for CurrencyIdConvert {
fn convert(a: Asset) -> Option<CurrencyId> {
use xcm::v4::prelude::*;
use xcm::v5::prelude::*;
if let Asset {
fun: Fungible(_),
id: AssetId(id),
Expand Down
6 changes: 4 additions & 2 deletions asset-registry/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sp_runtime::{
traits::{AccountIdConversion, Convert, IdentityLookup},
AccountId32,
};
use xcm::v4::{prelude::*, Weight};
use xcm::v5::{prelude::*, Weight};
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
Expand Down Expand Up @@ -55,6 +55,7 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = [u8; 8];
type MaxFreezes = ();
type DoneSlashHandler = ();
}

use orml_asset_registry::impls::ExistentialDeposits as AssetRegistryExistentialDeposits;
Expand Down Expand Up @@ -193,7 +194,8 @@ pub type AssetRegistryWeightTrader =
pub struct MyFixedConversionRateProvider;
impl FixedConversionRateProvider for MyFixedConversionRateProvider {
fn get_fee_per_second(location: &Location) -> Option<u128> {
let metadata = AssetRegistry::fetch_metadata_by_location(&location.clone().try_into().unwrap())?;
let metadata =
AssetRegistry::fetch_metadata_by_location(&location.clone().into_versioned().try_into().unwrap())?;
Some(metadata.additional.fee_per_second)
}
}
Expand Down
3 changes: 2 additions & 1 deletion asset-registry/src/mock/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use polkadot_runtime_parachains::{
origin, shared,
};
use sp_runtime::{traits::IdentityLookup, AccountId32};
use xcm::v4::prelude::*;
use xcm::v5::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia,
FixedWeightBounds, FungibleAdapter, IsConcrete, SignedAccountId32AsNative, SignedToAccountId32,
Expand Down Expand Up @@ -45,6 +45,7 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = [u8; 8];
type MaxFreezes = ();
type DoneSlashHandler = ();
}

impl shared::Config for Runtime {
Expand Down
23 changes: 1 addition & 22 deletions asset-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@ use sp_runtime::{
traits::{AccountIdConversion, BadOrigin, Dispatchable},
AccountId32,
};
use xcm::{v3, v4::prelude::*, VersionedLocation};
use xcm::{v3, v5::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 {
TreasuryAccount::get()
}
Expand Down Expand Up @@ -585,20 +578,6 @@ 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!(
old_location.encode() != Location::new(0, [Junction::from(BoundedVec::try_from(vec![0]).unwrap())]).encode()
);
}

#[test]
fn test_decode_bounded_vec() {
TestNet::reset();
Expand Down
4 changes: 2 additions & 2 deletions authority/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub mod module {
#[pallet::call_index(0)]
#[pallet::weight({
let info = call.get_dispatch_info();
(T::WeightInfo::dispatch_as().saturating_add(info.weight), info.class)
(T::WeightInfo::dispatch_as().saturating_add(info.total_weight()), info.class)
})]
pub fn dispatch_as(origin: OriginFor<T>, as_origin: T::AsOriginId, call: Box<CallOf<T>>) -> DispatchResult {
as_origin.check_dispatch_from(origin)?;
Expand Down Expand Up @@ -508,7 +508,7 @@ pub mod module {
ensure!(who == caller, Error::<T>::TriggerCallNotPermitted);
}
ensure!(
call_weight_bound.all_gte(call.get_dispatch_info().weight),
call_weight_bound.all_gte(call.get_dispatch_info().total_weight()),
Error::<T>::WrongCallWeightBound
);
let result = call.dispatch(OriginFor::<T>::root());
Expand Down
4 changes: 2 additions & 2 deletions authority/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ fn trigger_call_works() {
});
let hash = <Runtime as frame_system::Config>::Hashing::hash_of(&call);

let call_weight_bound = call.get_dispatch_info().weight;
let call_weight_bound = call.get_dispatch_info().total_weight();

// call not authorized yet
assert_noop!(
Expand Down Expand Up @@ -617,7 +617,7 @@ fn trigger_call_should_be_free_and_operational() {
ratio: Perbill::from_percent(50),
});
let hash = <Runtime as frame_system::Config>::Hashing::hash_of(&call);
let call_weight_bound = call.get_dispatch_info().weight;
let call_weight_bound = call.get_dispatch_info().total_weight();
let trigger_call = RuntimeCall::Authority(authority::Call::trigger_call {
hash,
call_weight_bound,
Expand Down
6 changes: 4 additions & 2 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub use frame_benchmarking::{

#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::{format, string::String};
#[cfg(feature = "std")]
pub use frame_benchmarking::{Analysis, BenchmarkSelector};
#[doc(hidden)]
Expand Down Expand Up @@ -1211,8 +1213,8 @@ pub fn show_benchmark_debug_info(
components: &[(BenchmarkParameter, u32)],
verify: &bool,
error_message: &str,
) -> sp_runtime::RuntimeString {
sp_runtime::format_runtime_string!(
) -> String {
format!(
"\n* Pallet: {}\n\
* Benchmark: {}\n\
* Components: {:?}\n\
Expand Down
1 change: 1 addition & 0 deletions currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = [u8; 8];
type MaxFreezes = ();
type DoneSlashHandler = ();
}

parameter_type_with_key! {
Expand Down
2 changes: 1 addition & 1 deletion gradually-update/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Laminar Developers <[email protected]>"]
edition = "2021"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion oracle/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Runtime API module for orml-oracle."
repository = "https://github.com/open-web3-stack/open-runtime-module-library"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] }
sp-api = { workspace = true }
sp-std = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion parameters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Acala Developers"]
edition = "2021"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
serde = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion rewards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Acala Developers"]
edition = "2021"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }

Expand Down
2 changes: 1 addition & 1 deletion tokens/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Laminar Developers <[email protected]>"]
edition = "2021"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["max-encoded-len"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["max-encoded-len"] }
log = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion tokens/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Runtime API module for orml-tokens."
repository = "https://github.com/open-web3-stack/open-runtime-module-library"

[dependencies]
parity-scale-codec = { version = "3.0.0", default-features = false, features = ["derive"] }
parity-scale-codec = { workspace = true, default-features = false, features = ["derive"] }
frame-support = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { workspace = true }
Expand Down
Loading

0 comments on commit ee451b0

Please sign in to comment.