-
Notifications
You must be signed in to change notification settings - Fork 745
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
Lowering XCM weights and fees #3692
Comments
@franciscoaguirre I would greatly appreciate your assistance and opinion on part 2, at the very least :) |
Before starting on part 2, please sync up with participants of polkadot-fellows/RFCs#82 (comment) discussion, to make sure we don't duplicate work. |
I think 2 is the best solution. I wanted to add callbacks for those instructions already, so that any parachain can do whatever they want when they open a channel to another chain. For example they could register a derivative of their token on the other chain. |
I heard the same about Polimec, let's work with them to make sure it gets upstreamed |
Second part is fixed here: #4025. First part is low prio and very nice to have, but it is better recommended to fix extrinsic:
|
Summary
The dedicated XCM-relevant benchmarks (
pallet_xcm
,pallet_xcm_benchmarks::fungible
,pallet_xcm_benchmarks::generic
) can utilize aSendXcm
implementation at the end, which typically employs theWrapVersion
implementation, often sourced frompallet_xcm
. This also impacts all other extrinsics and benchmarks that utilizeSendXcm
+WrapVersion
.The
pallet_xcm
'sWrapVersion
implementation adds unnecessary overhead to the weights - 2 reads and 1 write:This overhead arises from checking the compatible XCM version for the destination. If no supported version is stored, we utilize
SafeXcmVersion
and store theVersionDiscoveryQueue
key/value for later version discovery.This process occurs only the first time when the destination is not added to the
SupportedVersion
inpallet_xcm
.The idea here is that this overhead should not be borne by the end user, but rather should be part of establishing the communication channel (e.g., opening HRMP).
Proposed solution part 1 - reducing XCM weights
Implemented by: #3664
We utilize
xcm_builder::EnsureDelivery
andDeliveryHelper
features for XCM benchmarking, as demonstrated here and here. These features ensure successful delivery for extrinsic benchmarks with the underlyingSendXcm
implementation.A good example is benchmarking for AssetHubRococo, where it is essential to ensure that we can deliver to the
Parent
and/or to the sibling parachains. TheDeliveryHelper
ensures that the sender account has enough assets for delivery fees and/or opens HRMP channels.Therefore, the straightforward solution here is to extend this
DeliveryHelper
by one more step, which will insert the desired XCM version into thepallet_xcm::SupportedVersion
to eliminate the mentioned overhead.Note: These
EnsureDelivery
features can also be directly reused for other benchmarks when needed.Proposed solution part 2 - initiate
VersionDiscoveryQueue
when HRMP is acceptedImplemented by: #3696
Currently,
XcmExecutor
does not support the implementation forHrmpNewChannelOpenRequest
/HrmpChannelAccepted
/HrmpChannelClosing
XCM instructions, as indicated here.The idea here is that when a parachain receives
HrmpChannelAccepted
, it will add a key/value pair to theVersionDiscoveryQueue
, which will automatically initiate the "XCM version negotiation" mechanism. To achieve this, we need to add a proper callback handler to theXcmExecutor
's configuration.Example:
TODO/questions
The text was updated successfully, but these errors were encountered: