-
Notifications
You must be signed in to change notification settings - Fork 768
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
Direct XCM ExportMessage
fees for different bridges to different receiver accounts
#2021
Direct XCM ExportMessage
fees for different bridges to different receiver accounts
#2021
Conversation
fd93ccc
to
33d3ed7
Compare
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.
LGTM. During review, I realized that I've been sure that we will be distributing fees between different bridges at the sending chain (AH). But obviously I was wrong and BH is the right place to do that.
AccountId: Clone + Into<[u8; 32]>, | ||
ReceiverAccount: Get<Option<AccountId>>, | ||
> FeeManager for XcmFeesToAccount<XcmConfig, WaivedLocations, AccountId, ReceiverAccount> | ||
ReceiverAccount: Get<AccountId>, |
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.
Do not know if there was some design solution behind having Get<Option<AccountId>>
in the previous version? Maybe some storage parameter was intended to be used - so fees still may be burnt unless governance has configured chain properly? But in any case - new version looks cleaner to me, just stumbled upon it
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 think Get<Option<AccountId>>
was needed in order to support the case where we wanted to waive the fees for some locations and burn the ones for the other locations using the XcmFeeToAccount
.
But now, that we have a separate component for handling fees, we can use XcmFeeManagerFromComponents
to specify the set of waived locations and the handling logic independently. And we can use XcmFeeManagerFromComponents<WaivedLocations, ()>
for the scenario above.
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
Outdated
Show resolved
Hide resolved
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.
lgtm
This is also good for Snowbridge. In our case a portion of the collected export fee will be routed to the sovereign account of the parachain from which the computed origin descends. So we will likely implement a custom XcmFeesToAccount that does this routing. |
I still think the appropriate place for this is in |
I experimented with this a bit, but I'm not sure if I understood correctly. I tried to add a
Each instruction could have a different destination, and some instructions might not have any destination at all (would be executed only locally). So considering that this destination is not "ultimate", do you think it would still make sense to add it ?
I'm not sure if this is possible. From what I understand, the intermediate destinations unfold as we execute the sub-parts of the XCM message on different chains, and the XCM itself doesn't hold a state across multiple chains. Only if we add a separate |
What does "intermediate destinations unfold as we execute the sub-parts" mean? Why is it not as simple as looking into the |
cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
Outdated
Show resolved
Hide resolved
Sorry, you're right. I don't remember what I was thinking about. Anyway, yes, it would work if we parse the entire message beforehand. But still I think we would have multiple branches, and not an ultimate destination and the route to it. |
AFAICT, altering pub trait FeeManager {
/// Determine if a fee which would normally payable should be waived.
fn is_waived(origin: Option<&MultiLocation>, r: FeeReason) -> bool;
/// Do something with the fee which has been paid. Doing nothing here silently burns the
/// fees.
fn handle_fee(fee: MultiAssets, context: Option<&XcmContext>, r: FeeReason);
} should be the only API change which is required here. It's easy enough to write type parameterised utility/adapter structs allowing this trait to be composed from components. The argument which happens to be named |
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.
As per my comment.
That's not what I'm arguing about. What I am saying is that this PR shouldn't simply modify |
Changed the |
Yes, but it's no longer core API but merely a helper trait specific to a utility adapter. |
substrate/frame/support/procedural/src/pallet/expand/warnings.rs
Outdated
Show resolved
Hide resolved
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.
Modulo the comments.
@KiChjang sorry, I merged this PR, maybe the changes make it into the next crates release which should be today from what I understand. Please let's follow-up on the discussion related to adding the destination in the XcmContext in a separate issue/PR if that's ok. |
…ceiver accounts (#2021)
This PR backports missing PR's needed for 1.3.0 cumulus release: #2042 #2139 #2129 #1967 #2021 #1887 #2023 --------- Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: Lulu <[email protected]> Co-authored-by: Sergejs Kostjucenko <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]> Co-authored-by: joe petrowski <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]>
* reject delivery transactions with at least one obsolete message * clippy * allow empty delivery transactions with rewards confirmations BUT only when there's no room left in the unrewarded relayers vector * clippy * allow empty delivery transactions if no message slots in unrewarded relayers vector
Related to #1549 and paritytech/parity-bridges-common#2554