Skip to content
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

Add XCM Transactor precompile V3 - [Moonbase only] #2338

Merged
merged 18 commits into from
Aug 25, 2023

Conversation

Agusrodri
Copy link
Contributor

@Agusrodri Agusrodri commented Jun 8, 2023

This PR introduces a new version of the xcm-transactor precompile, more specifically the version number three (V3) of it.


⚠️ Breaking Changes ⚠️

  • Adds support for Weights V2 through the XCM Transactor precompile.
  • Adds support for RefundSurplus instruction to refund the weight that was not used while transacting through the XCM Transactor precompile.

Support for Weights V2

This version, includes a new Weight struct that allows users to indicate how much weight to spent in terms of both ref_time and proof_size components. When users make use of it, this Weight struct is properly encoded and decoded (for solidity language to understand the information) allowing to send the correct data to the xcm-transactor pallet.

Support for RefundSurplus instruction

Another feature that is introduced with this version, is the possibility of using RefundSurplus XCM instruction to properly refund the user with the extra weight that was not used during the execution of an XCM message in the destination chain.

Some considerations to take into account at the moment of using this feature:

  • If users want to enable this functionality, they must pass the value true through the bool parameter refund in the corresponding functions.
  • If this feature is used together with transactThroughDerivative() or transactThroughDerivativeMultilocation() functions, the remaining surplus will be refunded to the origin chain's sovereign account on the destination chain.
  • If it's used together with transactThroughSigned() or transactThroughSignedMultilocation() functions, the remaining surplus will be refunded back to the user's derivative account on the destination chain. Note that the destination chain must implement its own MultiLocation based derivation mechanism for this process to work as expected.

@Agusrodri Agusrodri added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed. breaking Needs to be mentioned in breaking changes labels Jun 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

Coverage generated "Thu Aug 24 18:18:19 UTC 2023":
https://d3ifz9vhxc2wtb.cloudfront.net/pulls/2338/html/index.html

Master coverage: 87.39%
Pull coverage:

@Agusrodri Agusrodri force-pushed the agustin-xcm-transactor-v3 branch from 303e35e to ca349d3 Compare August 7, 2023 16:24
@Agusrodri
Copy link
Contributor Author

Agusrodri commented Aug 22, 2023

TODO: remove the new precompile from Moonriver and Moonbeam and enable it only on Moonbase for testing purposes.

Edit: done in eefddd3

@Agusrodri Agusrodri marked this pull request as ready for review August 23, 2023 14:34
@Agusrodri Agusrodri requested a review from librelois August 24, 2023 16:16
@librelois
Copy link
Collaborator

LGTM, I left a suggestion to reduce boilerplate code, but not mandatory

@librelois librelois mentioned this pull request Aug 25, 2023
28 tasks
@Agusrodri Agusrodri changed the title XCM Transactor precompile V3 XCM Transactor precompile V3 [Moonbase only] Aug 25, 2023
@Agusrodri Agusrodri merged commit 6ceeb10 into master Aug 25, 2023
@Agusrodri Agusrodri deleted the agustin-xcm-transactor-v3 branch August 25, 2023 15:59
grw-ms pushed a commit that referenced this pull request Aug 28, 2023
* progress

* add unit tests and fix integration tests

* barrier

* add refund xcm_tests to runtimes

* fmt

* add precompile to runtimes

* fix precompile existence

* add xcm-transactor precompile interface

* add xcm-transactor precompile interface

* delete old ForeignChainAliasAccount from tests

* enable XCM Transactor precompile V3 only on Moonbase

* reserve address for XCM Transactor precompile V3

* use then() syntax for appendix

* reduce boilerplate code
@noandrea noandrea changed the title XCM Transactor precompile V3 [Moonbase only] Add XCM Transactor precompile V3 - [Moonbase only] Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D5-nicetohaveaudit⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants