-
Notifications
You must be signed in to change notification settings - Fork 381
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
Benchmarking xcm instructions Weight #1012
Conversation
/bench shibuya-dev astar_xcm_benchmarks::generic |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6536053493. |
Benchmark job failed. |
/bench shibuya-dev astar_xcm_benchmarks |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6542412489. |
Benchmarks have been finished. |
/bench shibuya-dev astar_xcm_benchmarks::generic,astar_xcm_benchmarks::fungible::assets,astar_xcm_benchmarks::fungible::balances |
Benchmarks have been finished. |
/bench shibuya-dev astar_xcm_benchmarks::generic |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6574576146. |
Benchmarks have been finished. |
/bench shibuya-dev astar_xcm_benchmarks::generic,astar_xcm_benchmarks::fungible::assets,astar_xcm_benchmarks::fungible::balances |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6585607290. |
Benchmarks have been finished. |
/bench shibuya-dev astar_xcm_benchmarks::generic,astar_xcm_benchmarks::fungible::assets,astar_xcm_benchmarks::fungible::balances |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6589059865. |
Benchmarks have been finished. |
Minimum allowed line rate is |
benchmarks_instance_pallet! { | ||
where_clause { where | ||
< | ||
< | ||
T::TransactAsset | ||
as | ||
Inspect<T::AccountId> | ||
>::Balance | ||
as | ||
TryInto<u128> | ||
>::Error: sp_std::fmt::Debug, | ||
|
||
< T::TransactAsset | ||
as | ||
Inspect<T::AccountId> | ||
>::Balance : Into<u128> | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use old v1
benchmarks if new v2
has been available for many months?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to v2.
pub mod assets; | ||
pub mod balances; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are two completely separate modules really needed?
Seems like lots of copy/paste, for mock.rs and mod.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted our pallet to have consistent style with the original pallet so I used the same format. We can also merge them into one but that would mean changing the variable names and name of benchmarks and some logic which will be different from the original pallet.
Let me know what you think.
/bench shibuya-dev astar_xcm_benchmarks::generic,astar_xcm_benchmarks::fungible::assets,astar_xcm_benchmarks::fungible::balances |
Benchmarks job is scheduled at https://github.com/AstarNetwork/Astar/actions/runs/6728742049. |
Benchmarks have been finished. |
Pull Request Summary
Currently all xcm instructions occupy same weight, this PR changes that by changing
FixedWeightbounds
toWeightInfoBounds
which benchmarks all xcm instructions for accurate weight.Benchmarking pallets are inspired from
pallet_xcm_benchmark
and adjustments related to Shibuya has been made to benchmarks.Architecture
Just like the original pallet, instructions are divided between
generic
andfungible
instructions, and each pallet's config is configurable to define how the benchmarks will be run.Furthermore, for
fungible
instrctions, separate pallets for assets of typebalances
andassets
were added to keep the naming of benchmarks and config consistent and straightforward.Weight Calculations
For generic instructions we have taken the worst case scenarios that could occur.
For fungible instructions
We benchmark every instruction for 1 asset of
pallet_assets
and 1 asset ofpallet_balances
and take the maximum weight consumed between them. For multiple assets, we multiply that weight with the number of assets.Weight = max_weight_consumption( one pallet_balances token , one pallet_assets token) for that instruction * number of assets