Skip to content

Commit fd253c9

Browse files
nhussein11Telucero
andauthored
Apply suggestions from code review
Co-authored-by: Taylor Lucero <[email protected]>
1 parent d743ee0 commit fd253c9

File tree

11 files changed

+46
-47
lines changed

11 files changed

+46
-47
lines changed

develop/interoperability/versions/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ template: index-page.html
88

99
XCM is a versioned language that evolves to meet the growing needs of cross-chain communication in the Polkadot ecosystem. Understanding XCM versioning is essential for developers building interoperable applications to keep up with the latest improvements.
1010

11-
New versions are defined via [Polkadot Fellowship RFCs](https://github.com/polkadot-fellows/rfcs){target=\_blank}, ensuring each iteration is thoroughly reviewed. The whole of this documentation uses _XCM V5_ as the primary reference, which is the current stable version.
11+
New versions are defined via [Polkadot Fellowship RFCs](https://github.com/polkadot-fellows/rfcs){target=\_blank}, ensuring each iteration is thoroughly reviewed. This entire documentation uses _XCM V5_ as the primary reference, which is the current stable version.
1212

1313
Each new version introduces new functionality while maintaining backward compatibility where possible. By understanding version differences, you can make informed decisions about which features to use and how to future-proof your applications.
1414

develop/interoperability/versions/v5/asset-claimer.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ XCMv5 introduces the [`AssetClaimer`](https://paritytech.github.io/polkadot-sdk/
1111

1212
When XCM execution failed and assets became trapped:
1313

14-
- **Governance dependency**: Most trapped asset recovery required governance proposals.
14+
- **Governance dependency**: Most trapped asset recovery requires governance proposals.
1515
- **Complex procedures**: Manual intervention through referendum processes.
1616
- **Long delays**: Recovery could take weeks or months through governance.
1717
- **Risk of loss**: Assets could remain permanently trapped if governance didn't act.
@@ -71,17 +71,17 @@ The `AssetClaimer` hint addresses several critical pain points in trapped asset
7171
| Feature | Before XCM V5 | After XCM V5 |
7272
| :-----: | :-----------: | :----------: |
7373
| **Recovery Speed** | Wait for governance process (weeks/months) | Designated claimer can act immediately |
74-
| **Governance Burden** | Every trapped asset required a governance proposal | Only complex cases need governance intervention |
74+
| **Governance Burden** | Every trapped asset requires a governance proposal | Only complex cases need governance intervention |
7575
| **Recovery Predictability** | Uncertain if governance would approve recovery | Predetermined claimer provides certainty |
76-
| **Accessibility** | Small amounts often not worth governance overhead | Any amount can be efficiently recovered |
76+
| **Accessibility** | Small amounts are often not worth governance overhead | Any amount can be efficiently recovered |
7777

7878
## Best Practices
7979

8080
Following these best practices ensures effective use of the `AssetClaimer` hint and maximizes the benefits of automated asset recovery.
8181

8282
### Set Hint Early
8383

84-
Always set the asset claimer hint before any operations that might fail, ensuring trapped assets can be recovered immediately without governance intervention.
84+
Always set the `AssetClaimer` hint before any operations that might fail, ensuring trapped assets can be recovered immediately without governance intervention.
8585

8686
```typescript
8787
// Set claimer hint before any risky operations

develop/interoperability/versions/v5/fees.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Explore the key differences in fee handling between XCM V4 and V5,
55

66
# Fees (XCM V4 → XCM V5)
77

8-
XCM V5 introduces a new fee payment mechanism that simplifies and unifies how fees are handled across different types of XCM operations.
8+
XCM V5 introduces a new fee payment mechanism that simplifies and unifies the handling of fees across various XCM operations.
99

1010
## Key Changes from V4
1111

@@ -18,12 +18,12 @@ XCM V5 replaces the [`BuyExecution`](https://paritytech.github.io/polkadot-sdk/m
1818
- Used `BuyExecution` instruction that handles only execution fees.
1919
- Leftover assets after buying execution are returned to holding.
2020
- Required explicit specification of execution weight limits.
21-
- Delivery fees might not be found and error out.
21+
- Delivery fees may not be found, and an error may occur.
2222

2323
- **XCM V5 Approach:**
2424

2525
- Introduces `PayFees` instruction for unified fee handling.
26-
- All assets passed to `PayFees` are kept in a special `fees` register, they are _NOT_ returned to holding.
26+
- All assets passed to `PayFees` are kept in a special `fees` register; they are _NOT_ returned to holding.
2727
- No need to specify weights, only assets.
2828
- More predictable.
2929

@@ -58,8 +58,8 @@ XcmV4Instruction.BuyExecution({
5858

5959
XCM V5 maintains backward compatibility with `BuyExecution` for existing implementations. Both instructions are supported, allowing gradual migration:
6060

61-
- **BuyExecution**: Still supported for compatibility with existing XCM programs
62-
- **PayFees**: Recommended for new development and simplified fee management
61+
- **BuyExecution**: Still supported for compatibility with existing XCM programs.
62+
- **PayFees**: Recommended for new development and simplified fee management.
6363

6464
## Migration Considerations
6565

@@ -71,13 +71,13 @@ When migrating from XCM V4 to XCM V5:
7171
- No breaking changes to existing functionality.
7272

7373
When using `PayFees`, keep in mind that _ALL_ assets passed to the instruction will be entirely dedicated to fees, not returned to holding.
74-
That's why it's more important than before to [properly estimate XCM fees](/develop/interoperability/xcm-runtime-apis/){target=\_blank}.
74+
That's why it's more important than before to [to estimate XCM fees properly](/develop/interoperability/xcm-runtime-apis/){target=\_blank}.
7575

7676
## `RefundSurplus` Instruction
7777

7878
When you overestimate fees with [`PayFees`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v5/enum.Instruction.html#variant.PayFees){target=\_blank}, you can recover unused funds using the [`RefundSurplus`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v5/enum.Instruction.html#variant.RefundSurplus){target=\_blank} instruction.
7979

80-
You can use `RefundSurplus` to put the leftover fees back into holding. This is useful when you've overestimated the fees needed for your XCM program. You can then deposit them to some account with [`DepositAsset`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v5/enum.Instruction.html#variant.DepositAsset){target=\_blank}.
80+
You can use `RefundSurplus` to put the leftover fees back into holding. This is useful when you've overestimated the fees needed for your XCM program. You can then deposit them into some account with [`DepositAsset`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v5/enum.Instruction.html#variant.DepositAsset){target=\_blank}.
8181

8282
```typescript
8383
// After all instructions that send messages.

develop/interoperability/versions/v5/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Version 5 addresses key pain points that developers faced in previous versions:
2626
- **Before XCM V5**
2727
- Cross-chain transfers were limited to only one transfer type, requiring multiple different XCMs to send the entirety of the tokens.
2828
- Fee management across multiple hops was extremely complicated to get right, particularly because of delivery fees.
29-
- Cross-chain transfers cleared the origin, making it impossible to [`Transact`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v4/enum.Instruction.html#variant.Transact) in the same XCM as a transfer.
29+
- Cross-chain transfers cleared the origin, making it impossible to [`Transact`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm/v4/enum.Instruction.html#variant.Transact){target=\_blank} in the same XCM as a transfer.
3030
- Claiming trapped assets when transfers failed was troublesome, most of the time requiring governance to intervene.
31-
- Having to specify the weight for `Transact` was really brittle.
31+
- Having to specify the weight for `Transact` was brittle.
3232
- **After XCM V5**
3333
- A unified cross-chain transfer instruction handles all possible transfer types and allows multiple ones in the same XCM.
3434
- The fee payment mechanism has been standardized to handle multiple types of fees, making fees much more predictable.

develop/interoperability/versions/v5/migration-guide.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Whether migration is possible depends mainly on if the target chains have alread
1515

1616
To determine whether a chain supports XCM V5:
1717

18-
- Read the changelog
19-
- Explore the metadata with PAPI's descriptors
20-
- Explore the metadata with a tool like [subwasm](https://github.com/chevdor/subwasm){target=\_blank}
18+
- Read the changelog.
19+
- Explore the metadata with PAPI's descriptors.
20+
- Explore the metadata with a tool like [subwasm](https://github.com/chevdor/subwasm){target=\_blank}.
2121

2222
For example, when generating PAPI descriptors for a chain, you can check if the `XcmVersionedXcm` known type has the V5 variant.
2323

@@ -27,7 +27,7 @@ npx papi add myChain -w <INSERT_RPC_WEB_SOCKET_ENDPOINT>
2727

2828
Ensure to replace the `<INSERT_RPC_WEB_SOCKET_ENDPOINT>` with the actual RPC web socket endpoint of the chain.
2929

30-
Alternatively, you can navigate to the [PAPI developer console](https://dev.papi.how/extrinsics){target=\_blank}, connect to the chain and under extrinsics choose `PolkadotXcm -> execute` and check for the V5 variant:
30+
Alternatively, you can navigate to the [PAPI developer console](https://dev.papi.how/extrinsics){target=\_blank}, connect to the chain, and under extrinsics choose `PolkadotXcm -> execute` and check for the V5 variant:
3131

3232
![](/images/develop/interoperability/versions/v5/migration-guide/check-xcm-version.webp)
3333

@@ -65,9 +65,9 @@ With XCM V5, the ecosystem is shifting toward writing XCM programs directly inst
6565

6666
Migration Impact:
6767

68-
- More verbose but significantly more flexible
69-
- Need to calculate weights using runtime APIs
70-
- Better control over execution flow
68+
- More verbose but significantly more flexible.
69+
- Need to calculate weights using runtime APIs.
70+
- Better control over execution flow.
7171

7272
!!! note "Is this `execute` new?"
7373

@@ -93,8 +93,8 @@ const result = await tx.signAndSubmit(signer);
9393

9494
!!! note "Are the extrinsics going away?"
9595

96-
No! The extrinsics will continue to be supported in the XCM pallet for an undefined period of time. Although, it is expected that as more chains support XCM V5 and more dApp developers use [execute](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank},
97-
they'll reap the benefits and not require the extrinsics anymore.
96+
No! The extrinsics will continue to be supported in the XCM pallet for an undefined period of time. Although it is expected that as more chains support XCM V5 and more dApp developers use [execute](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank},
97+
they'll reap the benefits and no longer require extrinsics.
9898

9999
### Unified Transfer Instructions
100100

@@ -135,7 +135,7 @@ Beyond the shift to direct XCM execution, XCM V5 also consolidates transfer oper
135135

136136
Migration Benefits:
137137

138-
- Mix different transfer types in single operation
138+
- Different transfer types in single operation
139139
- Clearer fee handling
140140
- Origin preservation option
141141

@@ -191,16 +191,16 @@ XcmV4Instruction.BuyExecution({
191191
});
192192
```
193193

194-
The new `PayFees` instruction just has the asset for fee payment. The `weight_limit` parameter has historically mostly been set to `Unlimited` because of the difficulty to estimate weight and the fees being sufficient for limiting the max execution cost.
194+
The new `PayFees` instruction just has the asset for fee payment. The `weight_limit` parameter has historically been set to `Unlimited` due to the difficulty in estimating weight and the fees being sufficient to limit the maximum execution cost.
195195

196196
There is another key difference between `PayFees` and `BuyExecution`:
197197

198198
- With `BuyExecution`, if too much was supplied for fees, the leftover after paying for execution would be returned to the [holding register](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_executor/struct.XcmExecutor.html#method.holding) to be used in the rest of the XCM.
199-
- With `PayFees`, the full amount put into `assets` is stored in the fees register, nothing is returned to the holding register.
199+
- With `PayFees`, the full amount put into `assets` is stored in the fees register; nothing is returned to the holding register.
200200

201201
This means the full amount intended for fee payment must be specified. It makes it much more predictable. For example, withdrawing 11 DOT with 1 DOT in `PayFees` ensures exactly 10 DOT is sent.
202202

203-
The reason for this is the introduction of **delivery fees**, which are charged in addition to **execution fees**. Delivery fees are charged the moment an instruction is encountered which results in sending a new XCM. That's why fees can't be returned to the holding register as before; they need to be kept in the new fees register.
203+
The reason for this is the introduction of **delivery fees**, which are charged in addition to **execution fees**. Delivery fees are charged the moment an instruction is encountered that results in sending a new XCM. That's why fees can't be returned to the holding register as before; they need to be kept in the new fees register.
204204

205205
!!! note "Is BuyExecution going away?"
206206

@@ -307,7 +307,7 @@ This example shows how XCM V5 enables combining multiple asset transfers with di
307307

308308
### `fallback_max_weight` in `Transact`
309309

310-
The `Transact` instruction has changed in XCM V5 to reduce chances of bugs when executing calls on remote chains.
310+
The `Transact` instruction has been updated in XCM V5 to reduce the likelihood of bugs when executing calls on remote chains.
311311

312312
The `Transact` instruction looked like this in XCM V4:
313313

@@ -349,7 +349,7 @@ This change makes `Transact` more reliable and reduces the maintenance burden of
349349

350350
This change affects how testnet networks are referenced in XCM.
351351

352-
The network IDs, used in the `GlobalConsensus` junction, for `Rococo` and `Westend` were removed. Instead, the generic `ByGenesis` network ID should be used for referencing testnets. This change was made because testnets come and go, as was shown by the [removal of Rococo](https://forum.polkadot.network/t/rococo-to-be-deprecated-in-october/8702) and [appearance of Paseo](https://forum.polkadot.network/t/the-new-polkadot-community-testnet/4956). From now on, only mainnets will have an explicit network ID, testnets should always be referenced with `ByGenesis`.
352+
The network IDs, used in the `GlobalConsensus` junction, for `Rococo` and `Westend` were removed. Instead, the generic `ByGenesis` network ID should be used for referencing testnets. This change was made because testnets come and go, as was shown by the [removal of Rococo](https://forum.polkadot.network/t/rococo-to-be-deprecated-in-october/8702) and [appearance of Paseo](https://forum.polkadot.network/t/the-new-polkadot-community-testnet/4956). From now on, only mainnets will have an explicit network ID; testnets should always be referenced with `ByGenesis`.
353353

354354
If storing these network IDs, they must be migrated to `ByGenesis`. These are the genesis hashes for the migration:
355355

develop/interoperability/versions/v5/transact.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Use `fallback_max_weight: { ref_time: ..., proof_size: ... }` when:
8484
The previous mandatory weight specification created:
8585

8686
- **Brittle implementations**: Weight requirements changed with runtime upgrades.
87-
- **Over/under-estimation**: Incorrect weight estimates led to failures or waste.
87+
- **Over/under-estimation**: Incorrect weight estimates that led to failures or waste.
8888
- **Maintenance overhead**: Constant monitoring and updates required.
8989

9090
### XCM V5 Improvements

develop/interoperability/versions/v5/transfers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ The new `preserve_origin` parameter enables:
7070

7171
!!! note "Important"
7272

73-
Origin preservation requires specific configuration on the destination chain.
73+
Origin preservation requires a specific configuration on the destination chain.
7474
If the destination chain doesn't support it, transfers with `preserve_origin: true` will fail.
75-
Setting `preserve_origin: false` will work as before, regardless of destination chain configuration.
75+
Setting `preserve_origin: false` will continue to work as before, regardless of the destination chain configuration.
7676

7777
### Integrated Fee Handling
7878

develop/interoperability/versions/v5/writing-xcm-programs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ api.tx.PolkadotXcm.claimAssets(...)
6161
- Existing dedicated extrinsics continue to work.
6262
- No breaking changes to existing programs.
6363
- New development should prefer `execute()` for better flexibility.
64-
- Gradual migration path available for existing applications.
64+
- A gradual migration path is available for existing applications.

develop/interoperability/xcm-guides/from-apps/claiming-trapped-assets.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ description: How to claim assets that become trapped on-chain due to an XCM exec
77

88
## Introduction
99

10-
When XCM execution fails or succeeds, leftover assets can become "trapped" on the destination chain. These assets are held by the system but not accessible through normal means. XCM provides mechanisms to claim these trapped assets and recover them.
10+
When XCM execution fails or succeeds, leftover assets can become "trapped" on the destination chain. These assets are held by the system but are not accessible through normal means. XCM provides mechanisms to claim these trapped assets and recover them.
1111
This guide details the process and required steps to claim trapped assets.
1212

1313
## Trapped Assets Causes
1414

1515
Assets become trapped whenever execution halts and there are leftover assets. This can happen for example if:
1616

17-
- An XCM execution throws an error in any instruction when assets are in holding:
17+
- An XCM execution throws an error in any instruction when assets are in holding such as:
1818
- `DepositAsset` can't deposit because the account doesn't exist.
1919
- `Transact` can't execute the call because it doesn't exist.
2020
- `PayFees` not enough funds or not paying enough for execution.
21-
- and others.
2221

2322
- XCM execution finishes successfully but not all assets were deposited:
2423
- Funds were withdrawn but some were not deposited.
@@ -216,10 +215,10 @@ This allows this other `SS58_ACCOUNT` to claim the trapped assets. This could al
216215

217216
## Best practices
218217

219-
1. **Always set a claimer**: Include `SetAssetClaimer` in XCMs with valuable assets
220-
2. **Use accessible locations**: Ensure the claimer location is controlled by someone who can act
221-
3. **Monitor for failures**: Track XCM execution to detect when claiming is needed
222-
4. **Test claiming flows**: Verify your claiming logic works in test environments
223-
5. **Document recovery procedures**: Maintain clear instructions for asset recovery
218+
1. **Always set a claimer**: Include `SetAssetClaimer` in XCMs with valuable assets.
219+
2. **Use accessible locations**: Ensure the claimer location is controlled by someone who can act.
220+
3. **Monitor for failures**: Track XCM execution to detect when claiming is needed.
221+
4. **Test claiming flows**: Verify your claiming logic works in test environments.
222+
5. **Document recovery procedures**: Maintain clear instructions for asset recovery.
224223

225224
Setting a custom asset claimer is a good practice for recovering trapped assets without the need for governance intervention.

develop/interoperability/xcm-guides/from-apps/fees.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ There are two main types of fees in XCM: [execution](#execution) and [delivery](
1515

1616
## Execution
1717

18-
All XCMs have a weight associated to them. Each XCM instruction is benchmarked for a particular system (blockchain), which assigns them a weight. The weight of an XCM is the sum of the weight of all instructions. It's important to correctly benchmark this with the worst case so that your system is safe from [Denial-of-Service (DoS)](https://en.wikipedia.org/wiki/Denial-of-service_attack){target=\_blank} attacks.
18+
All XCMs have a weight associated with them. Each XCM instruction is benchmarked for a particular system (blockchain), which assigns them a weight. The weight of an XCM is the sum of the weight of all instructions. It's important to correctly benchmark this with the worst case so that your system is safe from [Denial-of-Service (DoS)](https://en.wikipedia.org/wiki/Denial-of-service_attack){target=\_blank} attacks.
1919

2020
This generated weight represents how much time, and space, is needed for executing the XCM. It directly translates to _execution fees_.
2121

@@ -62,10 +62,10 @@ flowchart LR
6262
```
6363

6464
- Execution fees need to be paid on A.
65-
- Delivery fees from A to B.
66-
- Execution on B.
65+
- Delivery fees need to be paid from A to B.
66+
- Execution occurs on B.
6767
- Delivery from B to C.
68-
- Finally, execution on C.
68+
- Execution occurs on C.
6969

7070
An XCM that does this might look like so:
7171

0 commit comments

Comments
 (0)