forked from open-web3-stack/open-runtime-module-library
-
Notifications
You must be signed in to change notification settings - Fork 2
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
transfer_with_transact
impl - iteration 2
#6
Draft
ghzlatarev
wants to merge
16
commits into
master
Choose a base branch
from
ghzlatarev/transfer-with-transact-latest
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
Signed-off-by: Georgi Zlatarev <[email protected]>
ghzlatarev
changed the title
Jul 15, 2022
transfer_with_transact
impltransfer_with_transact
impl - iteration 2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Georgi Zlatarev [email protected]
Design discussion at open-web3-stack#766 .
Transact
with Manta'sto_private
extrinsic.to_private
call with it.How the code change from first iteration:
Transact
input encoded call data bounded.transact
-only extrinsic, which does the transact without the transfer, to reduce fees.Current stage of code is that the sender sends 2 xcm messages:
1.1. Sender derivative account is crated from the sender multilocation as seen by the receiver chain.
1.2. Concretely in the mock runtime and tests the multilocation is simply hashed via a blak256 hasher Account32Hash
2.1
DescendOrigin
is used to descend into a unique sender origin, which was used to create the sender derivative account in the first message.2.2.
WithdrawAsset
is used to withdraw the funds sent with the first xcm message.2.3.
BuyExecution
is used to buy execution time.2.4. The sender derivative account is also used as local origin to dispatch the call within the
Transact
instruction.2.5.
RefundSurplus
+DepositAsset
is used to deposit any change.TODOs:
-todo: This code is also similar to this idea https://gist.github.com/xlc/ebc2476afb7ecacdaa5ce95ae3b991c8#xcm-builder and similarly could use a more comprehensive solution to calculate weights on the sender side.
-todo: barrier code can be improved by checking the length of the encoded call data
-todo: in barrier code if we can decode a Call then it can be matched against a configurable set of allowed Calls
-todo: in the barrier code we can can do weight and fee checks of the decoded call via
query_call_info
andquery_call_fee_details
paritytech/substrate#11819-todo: deposit change into any account
TODOs:
barrier
should work with Limited and Unlimited dest_weight
expect the Transact instruction
inspect Transact - check encoded length, for this I need a small PR to polkadot to get encoded.len()
inspect Transact - take_decode() and match against allowed calls, can be configurable set
expect the refund instructions as well