Skip to content

Commit

Permalink
Transactional processing for XCM (paritytech#1222)
Browse files Browse the repository at this point in the history
Moved from: paritytech/polkadot#6951

closes paritytech#490

- [x] update cumulus

--- 
This PR introduces transactional processing of certain xcm instructions.
For the list of instructions checkout
paritytech#490. The transactional
processing is implemented as an xcm-executor config item. The two
implementations in this PR are `FrameTransactionalProcessor` and `()`.
The `()` implementation does no transactional processing. Each
implementation of the `ProcessTransaction` trait has an
`IS_TRANSACTIONAL` const that tells the XCVM if transactional processing
is actually implemented. If Transactional processing is implemented,
changes to touched registers should also be rolled back to prevent
inconsistencies.


Note for reviewers:
Check out the following safety assumption:
https://github.com/paritytech/polkadot-sdk/pull/1222/files#diff-4effad7d8c1c9de19fd27e18661cbf2128c8718f3b2420a27d2f816e0749ea53R30

---------

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: command-bot <>
  • Loading branch information
3 people authored Jan 24, 2024
1 parent 6f59167 commit bd5326f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions substrate/frame/contracts/mock-network/src/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ use xcm::latest::prelude::*;
use xcm_builder::CurrencyAdapter as XcmCurrencyAdapter;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
ConvertedConcreteId, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, FungiblesAdapter,
IsConcrete, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, WithComputedOrigin,
ConvertedConcreteId, EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds,
FrameTransactionalProcessor, FungiblesAdapter, IsConcrete, NativeAsset, NoChecking,
ParentAsSuperuser, ParentIsPreset, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{traits::JustTry, Config, XcmExecutor};

Expand Down Expand Up @@ -284,6 +285,7 @@ impl Config for XcmConfig {
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
}

impl mock_msg_queue::Config for Runtime {
Expand Down
5 changes: 3 additions & 2 deletions substrate/frame/contracts/mock-network/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia,
ChildSystemParachainAsSuperuser, DescribeAllTerminal, DescribeFamily, FixedRateOfFungible,
FixedWeightBounds, HashedDescription, IsConcrete, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, WithComputedOrigin,
FixedWeightBounds, FrameTransactionalProcessor, HashedDescription, IsConcrete,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, WithComputedOrigin,
};
use xcm_executor::{Config, XcmExecutor};

Expand Down Expand Up @@ -185,6 +185,7 @@ impl Config for XcmConfig {
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
}

pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
Expand Down

0 comments on commit bd5326f

Please sign in to comment.