-
Notifications
You must be signed in to change notification settings - Fork 105
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
Asset from polkadot #1155
Asset from polkadot #1155
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1155 +/- ##
==========================================
- Coverage 77.83% 70.93% -6.90%
==========================================
Files 14 18 +4
Lines 415 609 +194
Branches 76 112 +36
==========================================
+ Hits 323 432 +109
- Misses 75 165 +90
+ Partials 17 12 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@vgeddes In 0b3344c I made the change to reuse But I'd still prefer to separate as different message types internally(rename as SendForeignToken). The two branches differ in several aspects(e.g. AssetHub is not involved in |
Add 3 smoke tests to cover the basic flow
|
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! Though in retrospect, some of my previous recommendations to you were not good ideas in the end, and so I'd like you to revert those.
contracts/src/Types.sol
Outdated
@@ -107,5 +109,8 @@ struct Ticket { | |||
|
|||
struct TokenInfo { | |||
bool isRegistered; | |||
bytes31 __padding; |
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.
Need to make sure that the storage layout of the old and new versions of the struct are compatible - ie. that isForeign
and isRegistered
are all packed into a single 32 byte slot.
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.
Yeah, could be a problem. I'd prefer a specific migration e5d9dd8
* Improve PNA implementation * More improvents to ERC20 token * Fix implementation of Assets._sendForeignToken * Fix build payload for foreign token --------- Co-authored-by: ron <[email protected]>
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 we should preserve the existing storage layout in AssetStorage.sol
rather than doing a full storage migration. The gas cost of migrating storage is unbounded (many tokens registered) so that could cost a lot and introduce a lot of errors.
We can however add new fields to the end of the Layout
struct in AssetStorage.sol
.
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.
Removed the storage migration in 64b9ef4
The initial concern in #1155 (comment) is about the TokenInfo
structure we changed. I'd assume it's safe to add the new foreignID
without overwritten the exist storage, but not 100% sure.
From Vincent: we may need a fork testing, add a test testUpgradeGatewayForPNA that upgrades the mainnet contract, and then runs some other nested tests as a sanity check(e.g. making sure the storage layout is not corrupted after the upgrade).
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.
13e8c32
to
cf596f3
Compare
# Description Adding support for send polkadot native assets(PNA) to Ethereum network through snowbridge. Asset with location in view of AH Including: - Relay token `(1,Here)` - Native asset `(0,[PalletInstance(instance),GenereIndex(index)])` managed by Assets Pallet - Native asset of Parachain `(1,[Parachain(paraId)])` managed by Foreign Assets Pallet The original PR in Snowfork#128 which has been internally reviewed by Snowbridge team. # Notes - This feature depends on the companion solidity change in Snowfork/snowbridge#1155. Currently register PNA is only allowed from [sudo](https://github.com/Snowfork/polkadot-sdk/blob/46cb3528cd8cd1394af2335a6907d7ab8647717a/bridges/snowbridge/pallets/system/src/lib.rs#L621), so it's actually not enabled. Will require another runtime upgrade to make the call permissionless together with upgrading the Gateway contract. - To make things easy multi-hop transfer(i.e. sending PNA from Ethereum through AH to Destination chain) is not support ed in this PR. For this case user can switch to 2-phases transfer instead. --------- Co-authored-by: Clara van Staden <[email protected]> Co-authored-by: Alistair Singh <[email protected]> Co-authored-by: Vincent Geddes <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]>
# Description Adding support for send polkadot native assets(PNA) to Ethereum network through snowbridge. Asset with location in view of AH Including: - Relay token `(1,Here)` - Native asset `(0,[PalletInstance(instance),GenereIndex(index)])` managed by Assets Pallet - Native asset of Parachain `(1,[Parachain(paraId)])` managed by Foreign Assets Pallet The original PR in #128 which has been internally reviewed by Snowbridge team. # Notes - This feature depends on the companion solidity change in Snowfork/snowbridge#1155. Currently register PNA is only allowed from [sudo](https://github.com/Snowfork/polkadot-sdk/blob/46cb3528cd8cd1394af2335a6907d7ab8647717a/bridges/snowbridge/pallets/system/src/lib.rs#L621), so it's actually not enabled. Will require another runtime upgrade to make the call permissionless together with upgrading the Gateway contract. - To make things easy multi-hop transfer(i.e. sending PNA from Ethereum through AH to Destination chain) is not support ed in this PR. For this case user can switch to 2-phases transfer instead. --------- Co-authored-by: Clara van Staden <[email protected]> Co-authored-by: Alistair Singh <[email protected]> Co-authored-by: Vincent Geddes <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]>
Requires: Snowfork/polkadot-sdk#128