-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[pallet_xcm] Customizable/extendable remote_message
estimation
#7424
base: master
Are you sure you want to change the base?
Conversation
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.
Overall structure and idea looks good to me. We could allow UniversalWeigherAdapter
to take a tuple of AdditionalDestinationInstructions
so we can apply simple additions instead of a full function that needs to track which additions to do. So lets say for a certain ML I add the SetTopic and for other ML I add DescendOrigin or I need to add both. This function should now match for all these MLs. If we can add a tuple we can simplify the functions and we might be able to create standards inside the xcm-builder that every runtime can use.
It is a suggestion and might be over engineering for the problem. Let me know what you think.
Co-authored-by: Just van Stam <vstam1@users.noreply.github.com>
bot rebase |
Rebased |
I'm not really keen on this approach, because it still utilizes the local weigher to weight the XCMs that will ultimately be weighed by the destination's weigher. I am not sure if the current approach allows for us in the future to easily swap the local weigher with the destination weigher. |
yes, exactly, I agree, using local weigher is no go - also more here, lets assume but AssetHubKusama uses so AssetHubPolkadot receives XCM with so this PR fixes at least two things:
pallet_xcm uses local weigher now, this PR does not change that, because I didnt know how, but Gav just recently came up with idea of "xcm standard weights", so if we find out how to generate "xcm standard weights", we can use them just for remote weight estimation instead of local weigher |
bot fmt |
@bkontur https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3404426 was started for your command Comment |
@bkontur Command |
The CI pipeline was cancelled due to failure one of the required jobs. |
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.
Should be ok, given that you can configure which weigher to use in UniversalWeighterAdapter
.
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
bot fmt |
@bkontur https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3406501 was started for your command Comment |
@bkontur Command |
@vstam1 |
Cumulus companion: paritytech/cumulus#2811
TL;DR: this PR fixes at least two things:
SetTopic
,UniversalOrigin
,DescendOrigin
, ...) to remote weight estimation (see more Problem 1. bellow)Note: This PR does not change any existing behavior, local weigher is now used for remote estimation, this PR just adds ability to configure different weigher for remote estimation.
Problem 1.:
Issue is that
pallet_xcm
for (do_teleport_assets/do_reserve_transfer_assets
) tries to estimate weight for remote_message, but calculates only with several instruction, and this weight is used as aweight_limit
forBuyExecution
on destination.But on the way, we can add possibly to this message other instructions, like
SetTopic
- feature for tracking message_id, bridging exporters addUniversalOrigin/DescendOrigin
and so on. So on destinationBuyExecution.weight_limit
could be lower than the real calculated weight by XcmExecutor for received message (which includes those other instructions) and possiblyBarrier
can stop this message.So with this PR, any runtime, which uses
pallet_xcm
, can configure additional instructions to this remote message estimation, because Runtime knows about his configuration.Problem 2.:
the correct solution here is to split weights:
pallet_xcm::reserve_transfer_assets / teleport_assets
problem could be potential, e.g. that local runtime does not process
ReserveAssetDeposited
so the real generated weight is should be Weight::MAX, so if we take this local weight forReserveAssetDeposited
(e.g.Weight::MAX
) for remote estimation, it will never work,because e.g. remote destination as AssetHubPolkadot could have its real regenerated value
also this PR will prepare pallet_xcm for "xcm standard weights" (Gav's idea from one discussion), because using local weight for remote estimation is not good