git.delta.rocks / unique-network / refs/commits / b0dfc97e805b

difftreelog

doc: why transactional is needed in XCM extensions

Daniel Shiposha2023-11-24parent: #644dfbe.patch.diff
in: master

1 file changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
2354 /// Create a collection's item using a transaction.2354 /// Create a collection's item using a transaction.
2355 ///2355 ///
2356 /// This function performs additional XCM-related checks before the actual creation.2356 /// This function performs additional XCM-related checks before the actual creation.
2357 ///
2358 /// The `transactional` attribute is needed because the inbound XCM messages
2359 /// are processed in a non-transactional context.
2360 /// To perform the needed logic, we use the internal pallets' functions
2361 /// that are not inherently safe to use outside a transaction.
2362 ///
2363 /// This requirement is temporary until XCM message processing becomes transactional:
2364 /// https://github.com/paritytech/polkadot-sdk/issues/490
2357 #[transactional]2365 #[transactional]
2358 fn create_item(2366 fn create_item(
2359 &self,2367 &self,
2381 /// Transfer an item from the `from` account to the `to` account using a transaction.2389 /// Transfer an item from the `from` account to the `to` account using a transaction.
2382 ///2390 ///
2383 /// This function performs additional XCM-related checks before the actual transfer.2391 /// This function performs additional XCM-related checks before the actual transfer.
2392 ///
2393 /// The `transactional` attribute is needed because the inbound XCM messages
2394 /// are processed in a non-transactional context.
2395 /// To perform the needed logic, we use the internal pallets' functions
2396 /// that are not inherently safe to use outside a transaction.
2397 ///
2398 /// This requirement is temporary until XCM message processing becomes transactional:
2399 /// https://github.com/paritytech/polkadot-sdk/issues/490
2384 #[transactional]2400 #[transactional]
2385 fn transfer_item(2401 fn transfer_item(
2386 &self,2402 &self,
2414 ) -> DispatchResult;2430 ) -> DispatchResult;
24152431
2416 /// Burn a collection's item using a transaction.2432 /// Burn a collection's item using a transaction.
2433 ///
2434 /// The `transactional` attribute is needed because the inbound XCM messages
2435 /// are processed in a non-transactional context.
2436 /// To perform the needed logic, we use the internal pallets' functions
2437 /// that are not inherently safe to use outside a transaction.
2438 ///
2439 /// This requirement is temporary until XCM message processing becomes transactional:
2440 /// https://github.com/paritytech/polkadot-sdk/issues/490
2417 #[transactional]2441 #[transactional]
2418 fn burn_item(&self, from: T::CrossAccountId, token: TokenId, amount: u128) -> DispatchResult {2442 fn burn_item(&self, from: T::CrossAccountId, token: TokenId, amount: u128) -> DispatchResult {
2419 self.burn_item_internal(from, token, amount)2443 self.burn_item_internal(from, token, amount)