Skip to content
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

Re-visit pallet_xcm benchmarks for teleport_assets / reserve_transfer_assets / transfer_assets #2874

Open
2 of 4 tasks
bkontur opened this issue Mar 15, 2024 · 9 comments
Open
2 of 4 tasks

Comments

@bkontur
Copy link
Contributor

bkontur commented Mar 15, 2024

Relates to the: https://github.com/polkadot-fellows/runtimes/issues/231#issue-2178704646

reserve_transfer_assets - https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L997-L1003
teleport_assets - https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L940-L945
transfer_assets - https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L1299-L1308

Is this adding ok? And does not double the actual weights?

T::WeightInfo::reserve_transfer_assets().saturating_add(w)
T::WeightInfo::teleport_assets().saturating_add(w)
T::WeightInfo::transfer_assets().saturating_add(w)

For example for AssetHubRococo for pallet_xcm::reserve_transfer_assets, it adds:

  1. benchamark for transfer_reserve_asset which is configured to transfer to Parent, which covers reserve, send+delivery
    https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs#L73-L97

  2. benchmark for pallet_xcm::reserve_transfer_assets, which is configured for delvering to sibling parachain, which also covers reserve+fee handling, send+delivery
    https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/pallet_xcm.rs#L99-L117

Why we adds "reserve+delivery-to-parent" + "reserve+delivery-to-sibling"?

I think we should remove maybe those: .saturating_add(w)

TODO

@bkontur
Copy link
Contributor Author

bkontur commented Mar 15, 2024

@acatangiu @franciscoaguirre guys, I need your eyes and fresh minds :), maybe I am missing something, I don't understand why we need to do those .saturating_add(w)

@acatangiu
Copy link
Collaborator

I thought either one weight or the other is used, not adding both (doubling)..

Either way, the second commit in this PR paritytech/polkadot-sdk#3695 should also indirectly fix this, yes?

@bkontur
Copy link
Contributor Author

bkontur commented Mar 18, 2024

I thought either one weight or the other is used, not adding both (doubling)..

Either way, the second commit in this PR paritytech/polkadot-sdk#3695 should also indirectly fix this, yes?

wow, I think this commit exactly fixes this, I would even backport that commit to 1.7 / (1.8?) / 1.9 :)

@franciscoaguirre
Copy link
Contributor

I was confused by this at first, but then I saw it gives you credit to execute the message, which is this part.
I think the idea came from that, you have to pay for the extrinsic but you also pay for the execution so you don't need to do BuyExecution in the message itself.
But I guess that only makes sense if prepare_and_execute is somehow mocked during the extrinsic benchmarks. If it's being accounted for then you're accounting for it twice indeed 😅

@franciscoaguirre
Copy link
Contributor

Just being able to use WeightInfo like in that commit would be great. It probably is what we should do

@bkontur
Copy link
Contributor Author

bkontur commented Mar 18, 2024

Just being able to use WeightInfo like in that commit would be great. It probably is what we should do

yes, exactly, also I just talked to the Adrian and we will patch his commit to the 1.7.0

acatangiu pushed a commit to paritytech/polkadot-sdk that referenced this issue Mar 18, 2024
bkontur added a commit to paritytech/polkadot-sdk that referenced this issue Mar 18, 2024
…hmarks instead (#3730)

Relates to: polkadot-fellows/runtimes#231
Fixes: paritytech/parity-bridges-common#2874

Expected patches for (1.7.0):
- pallet-xcm `8.0.3`

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Morganamilo pushed a commit to paritytech/polkadot-sdk that referenced this issue Mar 20, 2024
@bkontur
Copy link
Contributor Author

bkontur commented Apr 2, 2024

@acatangiu that double-weights fix was patched to the 1.7.0 and now it is coming to the master here: paritytech/polkadot-sdk#3927 so 1.10.0 release will be ok, but what about 1.8.0 / 1.9.0? Do we want/need to backport it?

@acatangiu
Copy link
Collaborator

I'm not sure if/how that PR fixes double weight or how they happened in the first place, for example benchmarking asset-hub-westend in said PR didn't result in relevant changes to pallet_xcm::weights.

@bkontur
Copy link
Contributor Author

bkontur commented Apr 2, 2024

I'm not sure if/how that PR fixes double weight or how they happened in the first place, for example benchmarking asset-hub-westend in said PR didn't result in relevant changes to pallet_xcm::weights.

this double-weights problem, you won't see it in the weights, but you would see it on the extrinsic fees: https://github.com/paritytech/polkadot-sdk/pull/3927/files#diff-742026ed87c0710683d2ef4263b463a3e6f0acfae3c8fad80f2f3d291088997fL991

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants