Skip to content

Commit

Permalink
doc: why transactional is needed in XCM extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrshiposha committed Nov 27, 2023
1 parent 644dfbe commit b0dfc97
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pallets/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b0dfc97

Please sign in to comment.