-
Notifications
You must be signed in to change notification settings - Fork 108
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
Support Native ETH in v1 #1354
Support Native ETH in v1 #1354
Conversation
c2835dd
to
b75401c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1354 +/- ##
==========================================
- Coverage 77.83% 76.58% -1.25%
==========================================
Files 14 17 +3
Lines 415 739 +324
Branches 76 110 +34
==========================================
+ Hits 323 566 +243
- Misses 75 162 +87
+ Partials 17 11 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@vgeddes we have a Command called |
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.
+1
Changes: 1. Use the 0x0000000000000000000000000000000000000000 token address as Native ETH. 2. Convert it to/from `{ parents: 2, interior: X1(GlobalConsensus(Ethereum{chain_id: 1})) }` when encountered. Onchain changes: This will require a governance request to register native ETH (with the above location) in the foreign assets pallet and make it sufficient. Related solidity changes: Snowfork/snowbridge#1354 TODO: - [x] Emulated Tests --------- Co-authored-by: Vincent Geddes <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Bastian Köcher <[email protected]>
Changes: 1. Use the 0x0000000000000000000000000000000000000000 token address as Native ETH. 2. Convert it to/from `{ parents: 2, interior: X1(GlobalConsensus(Ethereum{chain_id: 1})) }` when encountered. Onchain changes: This will require a governance request to register native ETH (with the above location) in the foreign assets pallet and make it sufficient. Related solidity changes: Snowfork/snowbridge#1354 TODO: - [x] Emulated Tests --------- Co-authored-by: Vincent Geddes <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> (cherry picked from commit 4059282)
c778b96
to
757bcc0
Compare
contracts/src/Assets.sol
Outdated
@@ -60,7 +62,7 @@ library Assets { | |||
) external view returns (Costs memory costs) { | |||
AssetsStorage.Layout storage $ = AssetsStorage.layout(); | |||
TokenInfo storage info = $.tokenRegistry[token]; | |||
if (!info.isRegistered) { | |||
if (!info.isRegistered && token != address(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.
Why not just register ether as a token, so we can avoid the complexity of this check?
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.
Addressed in a3e5aa4
contracts/src/Assets.sol
Outdated
payable($.assetHubAgent).safeNativeTransfer(amount); | ||
ticket.value = amount; | ||
|
||
ticket.dest = $.assetHubParaID; |
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.
It seems that both _sendEther
and _sendNativeToken
share this ticket/payload creation code. Can we not factor that out?
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.
addressed in 0921ff9
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 feature! 🥳
* do not dispatch transfer from native command * test to make sure the behavior is off * fmt * naming
0921ff9
to
ddad89f
Compare
@alistair-singh ready for another round of review - I improved the validation of the passed ether in |
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.
Looks good!
Changes
0x0000000000000000000000000000000000000000
token address as Native ETH.0x00..
an amount ofmsg.value
is locked in asset hub agent.Related polkadot-sdk: paritytech/polkadot-sdk#6855
TODO
Resolves: https://linear.app/snowfork/issue/SNO-1222