Skip to content

Conversation

@yrong
Copy link
Contributor

@yrong yrong commented May 21, 2025

Context

Currently we use SovereignPaidRemoteExporter, which is unnecessary since all fees in Snowbridge V2 will be estimated on the fly and injected into the XCM.

Resolves: https://linear.app/snowfork/issue/SNO-1510

@yrong yrong changed the title Snowbridge V2: Unpaid execution bridge to Ethereum Snowbridge: Unpaid execution when bridging to Ethereum May 21, 2025
@yrong
Copy link
Contributor Author

yrong commented May 22, 2025

Hey @acatangiu, I've opened this PR to switch to the UnpaidExporter as you mentioned earlier.

I have a quick question: why do we enforce no payment here for UnpaidRemoteExporter? Could we remove this line and attach a fee, similar to what SovereignPaidRemoteExporter does?

I'm asking because, IMHO, the term unpaid refers to execution cost on the destination chain, not the source.

@acatangiu
Copy link
Contributor

I have a quick question: why do we enforce no payment here for UnpaidRemoteExporter? Could we remove this line and attach a fee, similar to what SovereignPaidRemoteExporter does?
I'm asking because, IMHO, the term unpaid refers to execution cost on the destination chain, not the source.

Sounds sane to me. @bkontur any reasons we should not do that?

I am thinking we can check WaivedLocations and simply waive transport fees accordingly based on origin rather than assume/assert they are waived for any origin using this exporter.

@yrong yrong marked this pull request as ready for review May 23, 2025 05:28
@paritytech-review-bot paritytech-review-bot bot requested a review from a team May 23, 2025 05:29
@bkontur
Copy link
Contributor

bkontur commented May 23, 2025

I have a quick question: why do we enforce no payment here for UnpaidRemoteExporter? Could we remove this line and attach a fee, similar to what SovereignPaidRemoteExporter does?
I'm asking because, IMHO, the term unpaid refers to execution cost on the destination chain, not the source.

Sounds sane to me. @bkontur any reasons we should not do that?

I am thinking we can check WaivedLocations and simply waive transport fees accordingly based on origin rather than assume/assert they are waived for any origin using this exporter.

Hmm, I think it make senses. I am checking trait ExporterFor docs:

/// The payment is specified from the local context, not the bridge chain. This is the
/// total amount to withdraw in to Holding and should cover both payment for the execution on
/// the bridge chain and payment for the use of the `ExportMessage` instruction.
fn exporter_for(

iiuc, the ExporterFor returns the cost, which should cover:

  1. remote-execution on the bridged chain
  2. delivery fees for ExportMessage

So, if we say that UnpaidRemoteExporter means that with UnpaidExecution we don't need to pay "2. delivery fees for ExportMessage", than yes, the assert for maybe_payment could be removed and the maybe_payment could be added to the cost like @yrong did here: https://github.com/paritytech/polkadot-sdk/pull/8599/files#diff-fb508a860be147ec684bacf49b9432885463edaba1fab99a8fbfc597f98a0685R61-R70.
Anyway this cost will contain XCMP delivery for example.

If we want total unpaid, means not to pay also "1. remote-execution on the bridged chain", then we can set up ExporterFor to return None, so we should be able to cover all the cases.

Also I think we don't need to check WaivedLocation here, because it will be anyway checked with fn take_fee or fn charge_fees -> but definitely we can add a test for this, that WaivedLocations works with UnpaidRemoteExporter with maybe_payment=Some(asset).

I think let's go with changes above for UnpaidRemoteExporter instead of a new SnowbridgeUnpaidRemoteExporter

@acatangiu
Copy link
Contributor

Also I think we don't need to check WaivedLocation here, because it will be anyway checked with fn take_fee or fn charge_fees

yes, I said it wrong, not meant explicitly check, but rather rely on WaivedLocations - proposing the exporter handle delivery fees as normal - the "Unpaid" part is related to the fact that it is using explicit UnpaidExecution instruction

I think let's go with changes above for UnpaidRemoteExporter instead of a new SnowbridgeUnpaidRemoteExporter

yes, @yrong please add delivery fees to UnpaidRemoteExporter rather than adding new SnowbridgeUnpaidRemoteExporter

@yrong yrong requested a review from a team as a code owner May 23, 2025 11:19
Comment on lines 463 to 467
SovereignPaidRemoteExporter<
bridging::to_ethereum::EthereumNetworkExportTable,
),
XcmpQueue,
UniversalLocation,
>,
XcmpQueue,
UniversalLocation,
>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since UnpaidRemoteExporter now supports attaching a fee, how about applying it to the Snowbridge V1 route as well?

That would eliminate the need to maintain a balance for AH’s sovereign account on BH.

@vgeddes @acatangiu WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how long do you plan to support Snowbridge v1 for? might not be worth the change if its lifetime is limited anyway (lower risks of breaking something)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed internally, it’s likely that we will run V1 along side with V2 for quite some time.

Btw, aside from changing this line

let fee = Asset::from((Location::parent(), fee.total())).into();
to set the fee to zero, I don’t see many changes required.

There might be some cleanup needed, but considering that our integration tests cover most cases, I’m not too concerned about the breaking things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A seperate PR for this: yrong#20

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks Ron.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acatangiu @bkontur I've merged yrong#20. Please take another look at your convenience.

@acatangiu acatangiu moved this to SDK Released - Needs Integration in fellowship/runtimes integrations queue May 23, 2025
@acatangiu acatangiu moved this from SDK Released - Needs Integration to To be released (SDK) in fellowship/runtimes integrations queue May 23, 2025
@acatangiu acatangiu added the T15-bridges This PR/Issue is related to bridges. label May 23, 2025
@yrong yrong requested review from acatangiu and bkontur May 28, 2025 22:56
@acatangiu
Copy link
Contributor

Summary [ 244.619s] 3465 tests run: 3461 passed (19 slow, 1 leaky), 4 failed, 7000 skipped
TRY 6 FAIL [ 0.136s] bridge-hub-rococo-runtime::snowbridge transfer_token_to_ethereum_fee_not_enough
TRY 6 FAIL [ 0.083s] bridge-hub-westend-runtime::snowbridge transfer_token_to_ethereum_fee_not_enough
TRY 6 FAIL [ 0.028s] bridge-hub-westend-runtime::snowbridge unpaid_transfer_token_to_ethereum_fails_with_barrier
TRY 6 FAIL [ 0.058s] bridge-hub-westend-runtime::tests governance_authorize_upgrade_works

@acatangiu acatangiu enabled auto-merge May 29, 2025 14:43
auto-merge was automatically disabled May 29, 2025 14:46

Head branch was pushed to by a user without write access

@acatangiu acatangiu added this pull request to the merge queue May 29, 2025
Merged via the queue into paritytech:master with commit 40e3fcb May 29, 2025
244 checks passed
pgherveou pushed a commit that referenced this pull request Jun 11, 2025
### Context

Currently we use
[SovereignPaidRemoteExporter](https://github.com/paritytech/polkadot-sdk/blob/ff5c67c8a3d60ccb3f0af114a07db8f4bec485a0/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs#L457-L464),
which is unnecessary since all fees in Snowbridge V2 will be estimated
on the fly and injected into the XCM.

Resolves: https://linear.app/snowfork/issue/SNO-1510

---------

Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this pull request Aug 7, 2025
This brings in `stable2506` Polkadot SDK, and integrates many new
features.

Integrated breaking changes to be verified by the original authors:

- [x] ~paritytech/polkadot-sdk#8127 @kianenigma
@Ank4n~
     This will come in with AHM, and not before.
- [x] paritytech/polkadot-sdk#7597 @gui1117 
- [x] paritytech/polkadot-sdk#8254 @bkchr 
- [x] paritytech/polkadot-sdk#7592 @bkontur 
- [x] paritytech/polkadot-sdk#8382
@UtkarshBhardwaj007
- [x] paritytech/polkadot-sdk#8021 @serban300 
- [x] paritytech/polkadot-sdk#8344 @serban300 
- [x] paritytech/polkadot-sdk#8262 @athei 
- [x] paritytech/polkadot-sdk#8584 @athei 
- [x] paritytech/polkadot-sdk#8299 @skunert
- [x] paritytech/polkadot-sdk#8652 @pgherveou 
- [x] paritytech/polkadot-sdk#8554 @pgherveou 
- [x] paritytech/polkadot-sdk#8281 @mrshiposha 
- [x] paritytech/polkadot-sdk#7730
@franciscoaguirre
- [x] paritytech/polkadot-sdk#8599 @yrong
@claravanstaden
- [x] paritytech/polkadot-sdk#8531 @bkontur 
- [x] paritytech/polkadot-sdk#8409 @kianenigma 
- [x] paritytech/polkadot-sdk#9137
@franciscoaguirre
- [x] paritytech/polkadot-sdk#7944 @bkontur 
- [x] paritytech/polkadot-sdk#8179 @bkontur 
- [x] paritytech/polkadot-sdk#8037 @yrong

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: claravanstaden <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Alain Brenzikofer <[email protected]>
Co-authored-by: kianenigma <[email protected]>
Co-authored-by: Francisco Aguirre <[email protected]>
Co-authored-by: ron <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: Overkillus <[email protected]>
@Polkadot-Forum
Copy link

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/snowbridge-incident-report-polkadot-runtime-upgrade-1-7-1/15144/1

alvicsam pushed a commit that referenced this pull request Oct 17, 2025
### Context

Currently we use
[SovereignPaidRemoteExporter](https://github.com/paritytech/polkadot-sdk/blob/ff5c67c8a3d60ccb3f0af114a07db8f4bec485a0/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs#L457-L464),
which is unnecessary since all fees in Snowbridge V2 will be estimated
on the fly and injected into the XCM.

Resolves: https://linear.app/snowfork/issue/SNO-1510

---------

Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: Adrian Catangiu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T15-bridges This PR/Issue is related to bridges.

Projects

Status: To be released (SDK)

Development

Successfully merging this pull request may close these issues.

5 participants