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

Upgrade to polkadot-v0.9.29 #809

Merged
merged 1 commit into from
Sep 27, 2022
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
130 changes: 65 additions & 65 deletions Cargo.dev.toml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ serde = { version = "1.0.136", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] }

# substrate
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }

# polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.28" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.28" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.28" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.28" }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }

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

[dev-dependencies]
# substrate
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

# cumulus
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.28" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.28" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.28" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.28" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.28" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }

# polkadot
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.28" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.28" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.28" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }

# orml
orml-tokens = { path = "../tokens" }
Expand Down
18 changes: 10 additions & 8 deletions asset-registry/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sp_runtime::{
ArithmeticError, FixedU128,
};
use sp_std::prelude::*;
use xcm::latest::prelude::*;
use xcm::latest::{prelude::*, Weight as XcmWeight};
use xcm::VersionedMultiLocation;
use xcm_builder::TakeRevenue;
use xcm_executor::{traits::WeightTrader, Assets};
Expand Down Expand Up @@ -55,7 +55,7 @@ pub struct FixedRateAssetRegistryTrader<P: FixedConversionRateProvider>(PhantomD
impl<P: FixedConversionRateProvider> WeightToFeeConverter for FixedRateAssetRegistryTrader<P> {
fn convert_weight_to_fee(location: &MultiLocation, weight: Weight) -> Option<u128> {
let fee_per_second = P::get_fee_per_second(location)?;
let weight_ratio = FixedU128::saturating_from_rational(weight as u128, WEIGHT_PER_SECOND as u128);
let weight_ratio = FixedU128::saturating_from_rational(weight.ref_time(), WEIGHT_PER_SECOND.ref_time() as u128);
let amount = weight_ratio.saturating_mul_int(fee_per_second);
Some(amount)
}
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<W: WeightToFeeConverter, R: TakeRevenue> WeightTrader for AssetRegistryTrad
}
}

fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result<Assets, XcmError> {
fn buy_weight(&mut self, weight: XcmWeight, payment: Assets) -> Result<Assets, XcmError> {
log::trace!(
target: "xcm::weight",
"AssetRegistryTrader::buy_weight weight: {:?}, payment: {:?}",
Expand All @@ -104,7 +104,7 @@ impl<W: WeightToFeeConverter, R: TakeRevenue> WeightTrader for AssetRegistryTrad
continue;
}

if let Some(fee_increase) = W::convert_weight_to_fee(location, weight) {
if let Some(fee_increase) = W::convert_weight_to_fee(location, Weight::from_ref_time(weight)) {
if fee_increase == 0 {
// if the fee is set very low it could lead to zero fees, in which case
// constructing the fee asset item to subtract from payment would fail.
Expand All @@ -115,12 +115,14 @@ impl<W: WeightToFeeConverter, R: TakeRevenue> WeightTrader for AssetRegistryTrad
if let Ok(unused) = payment.clone().checked_sub((asset.clone(), fee_increase).into()) {
let (existing_weight, existing_fee) = match self.bought_weight {
Some(ref x) => (x.weight, x.amount),
None => (0, 0),
None => (Weight::zero(), 0),
};

self.bought_weight = Some(BoughtWeight {
amount: existing_fee.checked_add(fee_increase).ok_or(XcmError::Overflow)?,
weight: existing_weight.checked_add(weight).ok_or(XcmError::Overflow)?,
weight: existing_weight
.checked_add(&Weight::from_ref_time(weight))
.ok_or(XcmError::Overflow)?,
asset_location: location.clone(),
});
return Ok(unused);
Expand All @@ -131,12 +133,12 @@ impl<W: WeightToFeeConverter, R: TakeRevenue> WeightTrader for AssetRegistryTrad
Err(XcmError::TooExpensive)
}

fn refund_weight(&mut self, weight: Weight) -> Option<MultiAsset> {
fn refund_weight(&mut self, weight: XcmWeight) -> Option<MultiAsset> {
log::trace!(target: "xcm::weight", "AssetRegistryTrader::refund_weight weight: {:?}", weight);

match self.bought_weight {
Some(ref mut bought) => {
let new_weight = bought.weight.saturating_sub(weight);
let new_weight = bought.weight.saturating_sub(Weight::from_ref_time(weight));
let new_amount = W::convert_weight_to_fee(&bought.asset_location, new_weight)?;
let refunded_amount = bought.amount.saturating_sub(new_amount);

Expand Down
8 changes: 4 additions & 4 deletions asset-registry/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use frame_support::traits::{EnsureOrigin, EnsureOriginWithArg};
use frame_support::{
construct_runtime, match_types, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Everything, Nothing},
weights::{constants::WEIGHT_PER_SECOND, Weight},
weights::constants::WEIGHT_PER_SECOND,
PalletId,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
Expand All @@ -26,7 +26,7 @@ use sp_runtime::{
traits::{AccountIdConversion, Convert, IdentityLookup},
AccountId32,
};
use xcm::latest::prelude::*;
use xcm::latest::{prelude::*, Weight};
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, LocationInverter,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
Expand Down Expand Up @@ -145,8 +145,8 @@ impl orml_asset_registry::Config for Runtime {
}

parameter_types! {
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND / 4;
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND / 4;
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.ref_time() / 4;
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.ref_time() / 4;
}

impl parachain_info::Config for Runtime {}
Expand Down
6 changes: 3 additions & 3 deletions asset-registry/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ pub trait WeightInfo {
/// Default weights.
impl WeightInfo for () {
fn register_asset() -> Weight {
0
Weight::zero()
}
fn update_asset() -> Weight {
0
Weight::zero()
}
fn set_asset_location() -> Weight {
0
Weight::zero()
}
}
12 changes: 6 additions & 6 deletions auction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
serde = { version = "1.0.136", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }

sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }

orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false }

[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

[features]
default = ["std"]
Expand Down
18 changes: 9 additions & 9 deletions auction/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ pub trait WeightInfo {
/// Default weights.
impl WeightInfo for () {
fn bid_collateral_auction() -> Weight {
(108_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
.saturating_add(RocksDbWeight::get().writes(9 as Weight))
Weight::from_ref_time(108_000_000)
.saturating_add(RocksDbWeight::get().reads(8 as u64))
.saturating_add(RocksDbWeight::get().writes(9 as u64))
}
fn on_finalize(c: u32, ) -> Weight {
(9_779_000 as Weight)
Weight::from_ref_time(9_779_000)
// Standard Error: 13_000
.saturating_add((57_962_000 as Weight).saturating_mul(c as Weight))
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(c as Weight)))
.saturating_add(Weight::from_ref_time(57_962_000).saturating_mul(c as u64))
.saturating_add(RocksDbWeight::get().reads(10 as u64))
.saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(c as u64)))
.saturating_add(RocksDbWeight::get().writes(7 as u64))
.saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(c as u64)))
}
}
16 changes: 8 additions & 8 deletions authority/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive"
serde = { version = "1.0.136", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }

sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.28" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub type BlockNumber = u64;

parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(2_000_000_000_000);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(2_000_000_000_000));
}

impl frame_system::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion authority/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ fn trigger_call_works() {

// wrong call weight bound
assert_noop!(
Authority::trigger_call(Origin::signed(1), hash, call_weight_bound - 1),
Authority::trigger_call(Origin::signed(1), hash, call_weight_bound - Weight::from_ref_time(1)),
Error::<Runtime>::WrongCallWeightBound
);

Expand Down
48 changes: 24 additions & 24 deletions authority/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,45 +43,45 @@ pub trait WeightInfo {
/// Default weights.
impl WeightInfo for () {
fn dispatch_as() -> Weight {
(12_000_000 as Weight)
Weight::from_ref_time(12_000_000)
}
fn schedule_dispatch_without_delay() -> Weight {
(30_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(30_000_000)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn schedule_dispatch_with_delay() -> Weight {
(32_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(32_000_000)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn fast_track_scheduled_dispatch() -> Weight {
(42_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(42_000_000)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn delay_scheduled_dispatch() -> Weight {
(42_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(42_000_000)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn cancel_scheduled_dispatch() -> Weight {
(29_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(29_000_000)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(2 as u64))
}
fn authorize_call() -> Weight {
(14_000_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(14_000_000)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
fn remove_authorized_call() -> Weight {
(16_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(16_000_000)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
fn trigger_call() -> Weight {
(29_000_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(29_000_000)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
}
Loading