From b0dfc97e805b05d2c8be04ddaa6842c610b69f26 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Fri, 24 Nov 2023 18:11:02 +0100 Subject: [PATCH] doc: why transactional is needed in XCM extensions --- pallets/common/src/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pallets/common/src/lib.rs b/pallets/common/src/lib.rs index e441127157..bb55570935 100644 --- a/pallets/common/src/lib.rs +++ b/pallets/common/src/lib.rs @@ -2354,6 +2354,14 @@ where /// Create a collection's item using a transaction. /// /// This function performs additional XCM-related checks before the actual creation. + /// + /// The `transactional` attribute is needed because the inbound XCM messages + /// are processed in a non-transactional context. + /// To perform the needed logic, we use the internal pallets' functions + /// that are not inherently safe to use outside a transaction. + /// + /// This requirement is temporary until XCM message processing becomes transactional: + /// https://github.com/paritytech/polkadot-sdk/issues/490 #[transactional] fn create_item( &self, @@ -2381,6 +2389,14 @@ where /// Transfer an item from the `from` account to the `to` account using a transaction. /// /// This function performs additional XCM-related checks before the actual transfer. + /// + /// The `transactional` attribute is needed because the inbound XCM messages + /// are processed in a non-transactional context. + /// To perform the needed logic, we use the internal pallets' functions + /// that are not inherently safe to use outside a transaction. + /// + /// This requirement is temporary until XCM message processing becomes transactional: + /// https://github.com/paritytech/polkadot-sdk/issues/490 #[transactional] fn transfer_item( &self, @@ -2414,6 +2430,14 @@ where ) -> DispatchResult; /// Burn a collection's item using a transaction. + /// + /// The `transactional` attribute is needed because the inbound XCM messages + /// are processed in a non-transactional context. + /// To perform the needed logic, we use the internal pallets' functions + /// that are not inherently safe to use outside a transaction. + /// + /// This requirement is temporary until XCM message processing becomes transactional: + /// https://github.com/paritytech/polkadot-sdk/issues/490 #[transactional] fn burn_item(&self, from: T::CrossAccountId, token: TokenId, amount: u128) -> DispatchResult { self.burn_item_internal(from, token, amount)