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

Update to polkadot-sdk v1.7.0 #29

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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,839 changes: 937 additions & 902 deletions Cargo.lock

Large diffs are not rendered by default.

286 changes: 143 additions & 143 deletions Cargo.toml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions client/consensus/nimbus-consensus/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ pub struct Params<BI, CIDP, Client, Backend, RClient, CHP, SO, Proposer, CS, DP
pub slot_duration: Option<SlotDuration>,
/// A chain synchronization oracle.
pub sync_oracle: SO,
/// Whether we should reinitialize the collator config.
pub reinitialize: bool,
}

/// Run async-backing-friendly collator.
Expand Down Expand Up @@ -123,6 +125,7 @@ where
&mut params.overseer_handle,
params.collator_key,
params.para_id,
params.reinitialize,
)
.await;

Expand Down
1 change: 0 additions & 1 deletion pallets/author-mapping/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
12 changes: 6 additions & 6 deletions pallets/foreign-asset-creator/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sp_arithmetic::traits::AtLeast16BitUnsigned;
use staging_xcm::latest::prelude::*;
benchmarks! {
// This where clause allows us to create ForeignAssetTypes
where_clause { where T::ForeignAsset: From<MultiLocation>, AssetId<T>: AtLeast16BitUnsigned }
where_clause { where T::ForeignAsset: From<Location>, AssetId<T>: AtLeast16BitUnsigned }
create_foreign_asset {
const USER_SEED: u32 = 1;
let manager = account("manager", 0, USER_SEED);
Expand All @@ -43,7 +43,7 @@ benchmarks! {
let manager: T::AccountId = account("manager", 0, USER_SEED);

for i in 0..x {
let foreign_asset: T::ForeignAsset = MultiLocation::new(0, X1(GeneralIndex(i as u128))).into();
let foreign_asset: T::ForeignAsset = Location::new(0, [GeneralIndex(i as u128)]).into();
let asset_id: AssetId<T> = (i as u16).into();
let amount = 1u32.into();
Pallet::<T>::create_foreign_asset(
Expand All @@ -57,9 +57,9 @@ benchmarks! {
}

let new_foreign_asset = T::ForeignAsset::default();
let asset_type_to_be_changed: T::ForeignAsset = MultiLocation::new(
let asset_type_to_be_changed: T::ForeignAsset = Location::new(
0,
X1(GeneralIndex((x-1) as u128))
[GeneralIndex((x-1) as u128)]
).into();
let asset_id_to_be_changed: AssetId<T> = ((x-1) as u16).into();
}: _(RawOrigin::Root, asset_id_to_be_changed.clone(), new_foreign_asset.clone())
Expand All @@ -74,7 +74,7 @@ benchmarks! {
let manager: T::AccountId = account("manager", 0, USER_SEED);

for i in 0..x {
let foreign_asset: T::ForeignAsset = MultiLocation::new(0, X1(GeneralIndex(i as u128))).into();
let foreign_asset: T::ForeignAsset = Location::new(0, [GeneralIndex(i as u128)]).into();
let asset_id: AssetId<T> = (i as u16).into();
let amount = 1u32.into();
Pallet::<T>::create_foreign_asset(
Expand All @@ -100,7 +100,7 @@ benchmarks! {
let manager: T::AccountId = account("manager", 0, USER_SEED);

for i in 0..x {
let foreign_asset: T::ForeignAsset = MultiLocation::new(0, X1(GeneralIndex(i as u128))).into();
let foreign_asset: T::ForeignAsset = Location::new(0, [GeneralIndex(i as u128)]).into();
let asset_id: AssetId<T> = (i as u16).into();
let amount = 1u32.into();
Pallet::<T>::create_foreign_asset(
Expand Down
3 changes: 1 addition & 2 deletions pallets/foreign-asset-creator/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ impl pallet_balances::Config for Test {
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}

Expand Down Expand Up @@ -129,7 +128,7 @@ impl pallet_assets::Config for Test {

impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type ForeignAsset = MultiLocation;
type ForeignAsset = Location;
type ForeignAssetCreatorOrigin = EnsureRoot<AccountId>;
type ForeignAssetModifierOrigin = EnsureRoot<AccountId>;
type ForeignAssetDestroyerOrigin = EnsureRoot<AccountId>;
Expand Down
50 changes: 25 additions & 25 deletions pallets/foreign-asset-creator/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn creating_foreign_works() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -33,15 +33,15 @@ fn creating_foreign_works() {

assert_eq!(
ForeignAssetCreator::foreign_asset_for_id(1).unwrap(),
MultiLocation::parent()
Location::parent()
);
assert_eq!(
ForeignAssetCreator::asset_id_for_foreign(MultiLocation::parent()).unwrap(),
ForeignAssetCreator::asset_id_for_foreign(Location::parent()).unwrap(),
1
);
expect_events(vec![crate::Event::ForeignAssetCreated {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
}])
});
}
Expand All @@ -51,20 +51,20 @@ fn test_asset_exists_error() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
1u64,
));
assert_eq!(
ForeignAssetCreator::foreign_asset_for_id(1).unwrap(),
MultiLocation::parent()
Location::parent()
);
assert_noop!(
ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -81,7 +81,7 @@ fn test_regular_user_cannot_call_extrinsics() {
assert_noop!(
ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::signed(1),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -94,7 +94,7 @@ fn test_regular_user_cannot_call_extrinsics() {
ForeignAssetCreator::change_existing_asset_type(
RuntimeOrigin::signed(1),
1,
MultiLocation::parent()
Location::parent()
),
sp_runtime::DispatchError::BadOrigin
);
Expand All @@ -106,7 +106,7 @@ fn test_root_can_change_foreign_asset_for_asset_id() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -116,30 +116,30 @@ fn test_root_can_change_foreign_asset_for_asset_id() {
assert_ok!(ForeignAssetCreator::change_existing_asset_type(
RuntimeOrigin::root(),
1,
MultiLocation::here()
Location::here()
));

// New associations are stablished
assert_eq!(
ForeignAssetCreator::foreign_asset_for_id(1).unwrap(),
MultiLocation::here()
Location::here()
);
assert_eq!(
ForeignAssetCreator::asset_id_for_foreign(MultiLocation::here()).unwrap(),
ForeignAssetCreator::asset_id_for_foreign(Location::here()).unwrap(),
1
);

// Old ones are deleted
assert!(ForeignAssetCreator::asset_id_for_foreign(MultiLocation::parent()).is_none());
assert!(ForeignAssetCreator::asset_id_for_foreign(Location::parent()).is_none());

expect_events(vec![
crate::Event::ForeignAssetCreated {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
},
crate::Event::ForeignAssetTypeChanged {
asset_id: 1,
new_foreign_asset: MultiLocation::here(),
new_foreign_asset: Location::here(),
},
])
});
Expand All @@ -152,7 +152,7 @@ fn test_asset_id_non_existent_error() {
ForeignAssetCreator::change_existing_asset_type(
RuntimeOrigin::root(),
1,
MultiLocation::parent()
Location::parent()
),
Error::<Test>::AssetDoesNotExist
);
Expand All @@ -164,7 +164,7 @@ fn test_root_can_remove_asset_association() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -178,16 +178,16 @@ fn test_root_can_remove_asset_association() {

// Mappings are deleted
assert!(ForeignAssetCreator::foreign_asset_for_id(1).is_none());
assert!(ForeignAssetCreator::asset_id_for_foreign(MultiLocation::parent()).is_none());
assert!(ForeignAssetCreator::asset_id_for_foreign(Location::parent()).is_none());

expect_events(vec![
crate::Event::ForeignAssetCreated {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
},
crate::Event::ForeignAssetRemoved {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
},
])
});
Expand All @@ -198,7 +198,7 @@ fn test_destroy_foreign_asset_also_removes_everything() {
ExtBuilder::default().build().execute_with(|| {
assert_ok!(ForeignAssetCreator::create_foreign_asset(
RuntimeOrigin::root(),
MultiLocation::parent(),
Location::parent(),
1u32.into(),
1u32.into(),
true,
Expand All @@ -211,17 +211,17 @@ fn test_destroy_foreign_asset_also_removes_everything() {
));

// Mappings are deleted
assert!(ForeignAssetCreator::asset_id_for_foreign(MultiLocation::parent()).is_none());
assert!(ForeignAssetCreator::asset_id_for_foreign(Location::parent()).is_none());
assert!(ForeignAssetCreator::foreign_asset_for_id(1).is_none());

expect_events(vec![
crate::Event::ForeignAssetCreated {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
},
crate::Event::ForeignAssetDestroyed {
asset_id: 1,
foreign_asset: MultiLocation::parent(),
foreign_asset: Location::parent(),
},
])
});
Expand Down
1 change: 0 additions & 1 deletion pallets/migrations/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
1 change: 0 additions & 1 deletion pallets/randomness/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
1 change: 0 additions & 1 deletion pallets/relay-storage-roots/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
1 change: 0 additions & 1 deletion precompiles/balances-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
6 changes: 3 additions & 3 deletions precompiles/balances-erc20/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fn transfer() {
value: 400.into(),
},
)
.expect_cost(184118756) // 1 weight => 1 gas in mock
.expect_cost(172298756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down Expand Up @@ -370,7 +370,7 @@ fn transfer_from() {
value: 400.into(),
},
)
.expect_cost(184118756) // 1 weight => 1 gas in mock
.expect_cost(172298756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down Expand Up @@ -466,7 +466,7 @@ fn transfer_from_self() {
value: 400.into(),
},
)
.expect_cost(184118756) // 1 weight => 1 gas in mock
.expect_cost(172298756) // 1 weight => 1 gas in mock
.expect_log(log3(
Precompile1,
SELECTOR_LOG_TRANSFER,
Expand Down
1 change: 0 additions & 1 deletion precompiles/batch/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
1 change: 0 additions & 1 deletion precompiles/call-permit/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
type RuntimeFreezeReason = ();
}
Expand Down
Loading
Loading