-
Notifications
You must be signed in to change notification settings - Fork 868
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
Allow configuration of worst case buy execution weight #7944
base: master
Are you sure you want to change the base?
Allow configuration of worst case buy execution weight #7944
Conversation
…-buy-execution-weight
…-buy-execution-weight
I remember back in that PR there were a couple of things that needed to be analyzed:
|
CC @RomarQ |
Any opinion on this? |
/// By default returns ((AssetId(Here.into()), 100_000_000u128), Unlimited) | ||
fn worst_case_buy_execution() -> Result<(Asset, WeightLimit), BenchmarkError> { | ||
Ok(((AssetId(Junctions::Here.into()), 100_000_000u128).into(), WeightLimit::Unlimited)) | ||
} |
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 would not add here default, we want runtimes to set the worst case:
/// By default returns ((AssetId(Here.into()), 100_000_000u128), Unlimited) | |
fn worst_case_buy_execution() -> Result<(Asset, WeightLimit), BenchmarkError> { | |
Ok(((AssetId(Junctions::Here.into()), 100_000_000u128).into(), WeightLimit::Unlimited)) | |
} | |
fn worst_case_buy_execution() -> Result<(Asset, WeightLimit), BenchmarkError>; |
Just thinking about fn fee_asset()
which is supposed to do the same for PayFees
,
maybe we could have something like fn worst_case_for_trader()
and use it for PayFees
and BuyExecution
benchmarks.
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.
indeed yes
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.
is there any hint that I can take for the worst case scenario of each runtime? or should I try to guess?
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.
actually never mind, I can get it through fee_asset
the case where does not even need to go into the Trader. This PR allows | ||
developers to set the worst-case scenario as they wish. | ||
crates: | ||
- name: pallet-xcm-benchmarks |
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.
- name: pallet-xcm-benchmarks | |
- name: pallet-xcm-benchmarks | |
- bump: major |
It's major since you're adding a function with no default.
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.
well.. shit! how are we gonna backport then?
I guess we'll have to limit "backport" to just 2503 which hasn't been published yet
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.
ah, nevermind, that's fine, we don't really need to backport this too far back
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 am actually adding a default value, unless you want me to change it. If I dont add a default value I need to put a worst case scenario in all runtimes, and I dont really know what is the worst case scenario in each of them. I can try to guess, but a few hints would be good
@franciscoaguirre I actually applied @bkontur suggestion and converted polkadot-sdk/polkadot/xcm/xcm-executor/src/lib.rs Line 1358 in ec32daa
If you want as part of this PR I can also add a weight value so that the benchmarking of the buyExecution instruction corresponds to worst case |
@girazoki I think a |
This is done know. Now I think the only thing "left", but maybe that is for a separate PR, is to adjust assethub to its worst case scenario, which I believe is when you try to buy weight with an asset different than the parent. I have an idea in mind for this, let me know guys if you want to make it as part of this PR. |
Adds
worst_case_buy_execution
to the Config trait ofpallet-xcm-benchmarks
with a default implementation that mimics the code that existed previous to this PR.Rationale: not allowing to set the
WeightLimit
and theFeeAsset
might mean that we dont benchmark the worst case, as withWeightLimit::Unlimited
theTrader
does not even execute:polkadot-sdk/polkadot/xcm/xcm-executor/src/lib.rs
Line 833 in c01dbeb
The new configurable function allows projects to customize the parameters with which the benchmark is run to make sure they account for the worst-case scenario
This is very likely the case of the assethub system chain, with several traders being analyzed and possibly several reads being made:
polkadot-sdk/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs
Line 403 in 38d2fa8