-
Notifications
You must be signed in to change notification settings - Fork 104
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
Transact from eth to sub #1141
base: bridge-next-gen
Are you sure you want to change the base?
Transact from eth to sub #1141
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## bridge-next-gen #1141 +/- ##
==================================================
Coverage ? 79.32%
==================================================
Files ? 13
Lines ? 416
Branches ? 74
==================================================
Hits ? 330
Misses ? 69
Partials ? 17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Could we start with the teleport pattern as before which will make things a bit easier? Or by no means that third party chain will accept that? I'm not sure but as we may notice to support transact it requires some custom xcm config anyway and only DOT from BH is required to pay the xcm fee so maybe not a big deal? |
Nope, unfortunately teleportation is strictly not allowed between system and third party chains. |
@vgeddes To not use teleport for transact in |
What if we teleported the DOT after the
|
@alistair-singh As Vincent mentioned teleportation is strictly not allowed here so I've removed that in recent commits |
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.
First round of review comments..
contracts/src/Types.sol
Outdated
if ( | ||
message.call.length == 0 || message.fee == 0 || message.weightAtMost.refTime == 0 | ||
|| message.weightAtMost.proofSize == 0 |
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.
All this validation can be done inline in Gateway.transact
. Its very little code and I don't think it requires its own function.
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.
Where did this validation move to? Should it not be done here somewhere?
I see it was removed here: 00abc13 and removed because of @vgeddes comment: #1141 (comment)
Should we not still at least check destinationFee > 0
? Ie does it make sense to allow a likely invalid message to be sent and the user to pay for it when it will likely not succeed?
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.
Agree. I think we need these checks on source chain so add it back here 3dd1adc
One caveat for Parachain to integrate is that since the fee is paid upfront on Ethereum and Custom Xcm config for that In Snowfork/polkadot-sdk@c18f771 could be referenced. |
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.
👏🏻 Awesome!
Does this PR still work this way? |
Nope. Sorry for the confusion, I should have removed it earlier. |
Would you mind adding a new comment with the updated functionality? That summary is helpful to understand the PR at a high level. |
Good catch. At least with paid execution, the |
contracts/src/Gateway.sol
Outdated
|
||
/// @inheritdoc IGateway | ||
function quoteSendCallFee(uint128 destinationFee) external view returns (uint256) { | ||
Costs memory costs = _calculateTransactCost(destinationFee); |
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.
We can remove destinationfee from here because only delivery costs are paid in the new fee model.
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.
|
||
## Explanation | ||
|
||
Basically it works as follows: |
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 would add a fee flow section:
- dApp is represents
msg.sender
or its sovereign depending on context. - Parachain represents the target parachain, its sovereign or its agent depending on context.
Sequence | Where | Who | What |
---|---|---|---|
1 | Gateway | dApp | pays(ETH, converted to DOT here) Parachain Agent for delivery costs only (no execution cost) |
2 | Bridge Hub | Relayer | pays(DOT) node for execution |
3 | Bridge Hub | Parachain Sovereign | pays(DOT) Relayer for delivery (refund+reward) |
4 | Parachain | dApp | pays(DOT, Native) for execution only. |
Does this balance? Yes because the parachain agent collects fees for delivery on Ethereum side and the Parachain Sovereign pays for delivery on the Bridge Hub side.
Execution costs totally belongs to the dApp prefunding its sovereign on the Parachain.
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.
Thanks for summarizing. Added to rfc in 53791d2
contracts/src/Gateway.sol
Outdated
} | ||
|
||
/// @inheritdoc IGateway | ||
function quoteSendCallFee(uint128 destinationFee) external view returns (uint256) { |
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.
destinationFee
can be removed from here, as the quote should only return delivery fees.
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.
Resolves: SNO-591,SNO-613,SNO-714
Requires: Snowfork/polkadot-sdk#114