This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Introduce transactional processing for xcm instructions #6951
Open
vstam1
wants to merge
26
commits into
master
Choose a base branch
from
vstam1/xcm-transactional-processing
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.
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ea646b5
introduce transactional processing for xcm instructions
vstam1 cb8930d
merge master
vstam1 334307b
add Executor rollback on instruction error
vstam1 b1c1686
add transactional processing on xcm instrutions
vstam1 672012b
fix tests
vstam1 2f249f6
add clone to FixedRateOfFungiable
vstam1 b97a9ef
fix tests
vstam1 3524945
add FrameTransactionalProcessor to xcm-builder mock
vstam1 3dbe380
fmt
vstam1 497d955
more tests
vstam1 f2abce5
merge master
vstam1 c65ef90
small comment
vstam1 91c29de
move to unsafe transactional processing for frame
vstam1 358d025
change FrameTransactionProcessor and merge master
vstam1 fa4ea4a
Merge remote-tracking branch 'origin/master' into vstam1/xcm-transact…
d1d97f5
merge master
vstam1 e1b0bd2
fmt
vstam1 1b24683
add bool to processing trait to consider the rollback of registers
vstam1 68bea8a
add comments
vstam1 9aa5831
Merge remote-tracking branch 'origin/master' into vstam1/xcm-transact…
8fbd67b
address feedback
vstam1 49359bc
address feedback on function name
vstam1 3fe888e
fix register cloning
vstam1 3f5a2ff
Merge remote-tracking branch 'origin/master' into vstam1/xcm-transact…
908fbf0
address feedback
vstam1 c4120b5
update vm cloning to only cloning specific registers
vstam1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright 2021 Parity Technologies (UK) Ltd. | ||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| use frame_support::{ | ||
| pallet_prelude::DispatchError, | ||
| storage::{with_transaction, TransactionOutcome}, | ||
| }; | ||
| use xcm::latest::prelude::*; | ||
| use xcm_executor::traits::ProcessTransaction; | ||
|
|
||
| pub struct FrameTransactionalProcessor; | ||
| impl ProcessTransaction for FrameTransactionalProcessor { | ||
| fn process_transaction<F>(f: F) -> Result<(), XcmError> | ||
| where | ||
| F: FnOnce() -> Result<(), XcmError>, | ||
| { | ||
| let transaction_outcome = | ||
| with_transaction(|| -> TransactionOutcome<Result<_, DispatchError>> { | ||
| let outcome = f(); | ||
| match &outcome { | ||
| Ok(_) => TransactionOutcome::Commit(Ok(None)), | ||
| Err(err) => TransactionOutcome::Rollback(Ok(Some(*err))), | ||
|
vstam1 marked this conversation as resolved.
Outdated
|
||
| } | ||
| }); | ||
| match transaction_outcome { | ||
| Ok(None) => Ok(()), | ||
| Ok(Some(err)) => Err(err), | ||
| Err(err) => Err(XcmError::FailedToTransactAsset(err.into())), | ||
|
vstam1 marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright 2020 Parity Technologies (UK) Ltd. | ||
|
vstam1 marked this conversation as resolved.
Outdated
|
||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| use xcm::latest::prelude::*; | ||
|
|
||
| pub trait ProcessTransaction { | ||
| fn process_transaction<F>(f: F) -> Result<(), XcmError> | ||
|
vstam1 marked this conversation as resolved.
Outdated
|
||
| where | ||
| F: FnOnce() -> Result<(), XcmError>; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.