Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
622ffbd8
Commit
622ffbd8
authored
3 years ago
by
Shawn Tabrizi
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix XCM Weights on Westend (#4066)
* found issue * fix up * remove printlns
parent
533cdb6e
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
polkadot/runtime/westend/src/tests.rs
+18
-0
18 additions, 0 deletions
polkadot/runtime/westend/src/tests.rs
polkadot/runtime/westend/src/weights/xcm/mod.rs
+4
-2
4 additions, 2 deletions
polkadot/runtime/westend/src/weights/xcm/mod.rs
with
22 additions
and
2 deletions
polkadot/runtime/westend/src/tests.rs
+
18
−
0
View file @
622ffbd8
...
...
@@ -49,3 +49,21 @@ fn call_size() {
If the limit is too strong, maybe consider increase the limit to 300."
,
);
}
#[test]
fn
sanity_check_teleport_assets_weight
()
{
// This test sanity checks that at least 50 teleports can exist in a block.
// Usually when XCM runs into an issue, it will return a weight of `Weight::MAX`,
// so this test will certainly ensure that this problem does not occur.
use
frame_support
::
dispatch
::
GetDispatchInfo
;
let
weight
=
pallet_xcm
::
Call
::
<
Runtime
>
::
teleport_assets
{
dest
:
Box
::
new
(
xcm
::
VersionedMultiLocation
::
V1
(
MultiLocation
::
here
())),
beneficiary
:
Box
::
new
(
xcm
::
VersionedMultiLocation
::
V1
(
MultiLocation
::
here
())),
assets
:
Box
::
new
((
Concrete
(
MultiLocation
::
here
()),
Fungible
(
200_000
))
.into
()),
fee_asset_item
:
0
,
}
.get_dispatch_info
()
.weight
;
assert!
(
weight
*
50
<
BlockWeights
::
get
()
.max_block
);
}
This diff is collapsed.
Click to expand it.
polkadot/runtime/westend/src/weights/xcm/mod.rs
+
4
−
2
View file @
622ffbd8
...
...
@@ -31,7 +31,9 @@ trait WeighMultiAssets {
fn
weigh_multi_assets
(
&
self
,
balances_weight
:
Weight
)
->
Weight
;
}
// TODO wild case
// Westend only knows about one asset, the balances pallet.
const
MAX_ASSETS
:
u32
=
1
;
impl
WeighMultiAssets
for
MultiAssetFilter
{
fn
weigh_multi_assets
(
&
self
,
balances_weight
:
Weight
)
->
Weight
{
match
self
{
...
...
@@ -44,7 +46,7 @@ impl WeighMultiAssets for MultiAssetFilter {
AssetTypes
::
Unknown
=>
Weight
::
MAX
,
})
.fold
(
0
,
|
acc
,
x
|
acc
.saturating_add
(
x
)),
_
=>
Weight
::
MAX
,
Self
::
Wild
(
_
)
=>
(
MAX_ASSETS
as
Weight
)
.saturating_mul
(
balances_weight
)
,
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment