mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 01:05:41 +00:00
Companion for Weight v1.5 (#5943)
* fix to latest substrate pr
* update weights
* cargo build -p polkadot-runtime-parachains
* fix xcm-builder
* fix import
* fix a bunch
* fix a bunch of weight stuff
* kusama compile
* unused
* builds
* maybe fix
* cargo test -p polkadot-runtime-parachains
* xcm simulator example
* fix tests
* xcm sim fuzz
* fix runtime tests
* remove unused
* fix integration tests
* scalar div
* update lockfile for {"substrate"}
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -16,17 +16,13 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use frame_support::{
|
||||
dispatch::{Dispatchable, Weight},
|
||||
ensure,
|
||||
weights::GetDispatchInfo,
|
||||
};
|
||||
use frame_support::{dispatch::Dispatchable, ensure, weights::GetDispatchInfo};
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
use xcm::latest::{
|
||||
Error as XcmError, ExecuteXcm,
|
||||
Instruction::{self, *},
|
||||
MultiAssets, MultiLocation, Outcome, Response, SendXcm, Xcm,
|
||||
MultiAssets, MultiLocation, Outcome, Response, SendXcm, Weight, Xcm,
|
||||
};
|
||||
|
||||
pub mod traits;
|
||||
@@ -343,7 +339,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
let dispatch_origin = Config::OriginConverter::convert_origin(origin, origin_type)
|
||||
.map_err(|_| XcmError::BadOrigin)?;
|
||||
let weight = message_call.get_dispatch_info().weight;
|
||||
ensure!(weight <= require_weight_at_most, XcmError::MaxWeightInvalid);
|
||||
ensure!(weight.ref_time() <= require_weight_at_most, XcmError::MaxWeightInvalid);
|
||||
let actual_weight = match message_call.dispatch(dispatch_origin) {
|
||||
Ok(post_info) => post_info.actual_weight,
|
||||
Err(error_and_info) => {
|
||||
@@ -362,7 +358,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
// reported back to the caller and this ensures that they account for the total
|
||||
// weight consumed correctly (potentially allowing them to do more operations in a
|
||||
// block than they otherwise would).
|
||||
self.total_surplus.saturating_accrue(surplus);
|
||||
self.total_surplus.saturating_accrue(surplus.ref_time());
|
||||
Ok(())
|
||||
},
|
||||
QueryResponse { query_id, response, max_weight } => {
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
use crate::Assets;
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{traits::Contains, weights::Weight};
|
||||
use xcm::latest::{MultiAssets, MultiLocation};
|
||||
use frame_support::traits::Contains;
|
||||
use sp_runtime::traits::Zero;
|
||||
use xcm::latest::{MultiAssets, MultiLocation, Weight};
|
||||
|
||||
/// Define a handler for when some non-empty `Assets` value should be dropped.
|
||||
pub trait DropAssets {
|
||||
@@ -26,7 +27,7 @@ pub trait DropAssets {
|
||||
}
|
||||
impl DropAssets for () {
|
||||
fn drop_assets(_origin: &MultiLocation, _assets: Assets) -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ impl<D: DropAssets, A: Contains<Assets>> DropAssets for FilterAssets<D, A> {
|
||||
if A::contains(&assets) {
|
||||
D::drop_assets(origin, assets)
|
||||
} else {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +55,7 @@ impl<D: DropAssets, O: Contains<MultiLocation>> DropAssets for FilterOrigin<D, O
|
||||
if O::contains(origin) {
|
||||
D::drop_assets(origin, assets)
|
||||
} else {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use frame_support::weights::Weight;
|
||||
use xcm::latest::{Error as XcmError, MultiLocation, QueryId, Response, Result as XcmResult};
|
||||
use sp_runtime::traits::Zero;
|
||||
use xcm::latest::{
|
||||
Error as XcmError, MultiLocation, QueryId, Response, Result as XcmResult, Weight,
|
||||
};
|
||||
|
||||
/// Define what needs to be done upon receiving a query response.
|
||||
pub trait OnResponse {
|
||||
@@ -39,7 +41,7 @@ impl OnResponse for () {
|
||||
_response: Response,
|
||||
_max_weight: Weight,
|
||||
) -> Weight {
|
||||
0
|
||||
Weight::zero()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use frame_support::weights::Weight;
|
||||
use sp_std::result::Result;
|
||||
use xcm::latest::{MultiLocation, Xcm};
|
||||
use xcm::latest::{MultiLocation, Weight, Xcm};
|
||||
|
||||
/// Trait to determine whether the execution engine should actually execute a given XCM.
|
||||
///
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Assets;
|
||||
use frame_support::weights::Weight;
|
||||
use sp_std::result::Result;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm::latest::{prelude::*, Weight};
|
||||
|
||||
/// Determine the weight of an XCM message.
|
||||
pub trait WeightBounds<Call> {
|
||||
|
||||
Reference in New Issue
Block a user