Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
49bb2268
Unverified
Commit
49bb2268
authored
Nov 24, 2021
by
Gavin Wood
Committed by
GitHub
Nov 24, 2021
Browse files
Fix use of weight limit errors (#4358)
parent
f9358cc4
Pipeline
#167763
passed with stages
in 44 minutes and 42 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
xcm/src/v0/traits.rs
View file @
49bb2268
...
...
@@ -56,12 +56,12 @@ pub enum Error {
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
/// `WithdrawAsset` XCM).
Wildcard
,
/// The case where an XCM message has specified a
optional
weight limit
and the weight required for
///
processing
is too
great
.
/// The case where an XCM message has specified a weight limit
on an interior call and this
///
limit
is too
low
.
///
/// Used by:
/// - `Transact`
TooMuchWeightRequire
d
,
MaxWeightInvali
d
,
/// The fees specified by the XCM message were not found in the holding account.
///
/// Used by:
...
...
xcm/src/v1/traits.rs
View file @
49bb2268
...
...
@@ -57,12 +57,12 @@ pub enum Error {
/// An asset wildcard was passed where it was not expected (e.g. as the asset to withdraw in a
/// `WithdrawAsset` XCM).
Wildcard
,
/// The case where an XCM message has specified a
optional
weight limit
and the weight required for
///
processing
is too
great
.
/// The case where an XCM message has specified a weight limit
on an interior call and this
///
limit
is too
low
.
///
/// Used by:
/// - `Transact`
TooMuchWeightRequire
d
,
MaxWeightInvali
d
,
/// The fees specified by the XCM message were not found in the holding register.
///
/// Used by:
...
...
xcm/src/v2/traits.rs
View file @
49bb2268
...
...
@@ -82,7 +82,7 @@ pub enum Error {
FailedToDecode
,
/// Used by `Transact` to indicate that the given weight limit could be breached by the functor.
#[codec(index
=
18
)]
TooMuchWeightRequire
d
,
MaxWeightInvali
d
,
/// Used by `BuyExecution` when the Holding Register does not contain payable fees.
#[codec(index
=
19
)]
NotHoldingFees
,
...
...
xcm/xcm-builder/src/tests.rs
View file @
49bb2268
...
...
@@ -598,7 +598,7 @@ fn transacting_should_respect_max_weight_requirement() {
}]);
let
weight_limit
=
60
;
let
r
=
XcmExecutor
::
<
TestConfig
>
::
execute_xcm
(
Parent
,
message
,
weight_limit
);
assert_eq!
(
r
,
Outcome
::
Incomplete
(
50
,
XcmError
::
TooMuchWeightRequire
d
));
assert_eq!
(
r
,
Outcome
::
Incomplete
(
50
,
XcmError
::
MaxWeightInvali
d
));
}
#[test]
...
...
xcm/xcm-executor/src/lib.rs
View file @
49bb2268
...
...
@@ -344,7 +344,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
::
TooMuchWeightRequire
d
);
ensure!
(
weight
<=
require_weight_at_most
,
XcmError
::
MaxWeightInvali
d
);
let
actual_weight
=
match
message_call
.dispatch
(
dispatch_origin
)
{
Ok
(
post_info
)
=>
post_info
.actual_weight
,
Err
(
error_and_info
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment