Skip to content

Nest errors in pallet-xcm#7730

Merged
franciscoaguirre merged 42 commits intomasterfrom
nest-inner-xcm-errors
May 31, 2025
Merged

Nest errors in pallet-xcm#7730
franciscoaguirre merged 42 commits intomasterfrom
nest-inner-xcm-errors

Conversation

@franciscoaguirre
Copy link
Copy Markdown
Contributor

@franciscoaguirre franciscoaguirre commented Feb 26, 2025

Errors in pallet-xcm are frustrating. You execute an XCM instruction and get LocalExecutionIncomplete: no details, no context. Was it insufficient balance? An account conversion failure? You're left guessing.

To fix this, we introduce LocalExecutionIncompleteWithError, which nests an ExecutionError enum inside LocalExecutionIncomplete. This provides specific error details, like insufficient balance or asset transaction failures, making debugging easier for users and applications. FRAME errors are limited to 4 bytes, and we were only using one. By nesting ExecutionError, we utilize the full 4 bytes with a compact enum that mirrors XcmError for consistency.

To make this robust, we reworked problematic errors. For instance, FailedToTransactAsset previously took a string, which couldn’t fit in 4 bytes. We’ve replaced it with a unit variant in ExecutionError, logging the string for debugging while keeping the encoding compact. This ensures detailed, efficient error reporting.

@franciscoaguirre franciscoaguirre requested a review from a team as a code owner February 26, 2025 14:23
@franciscoaguirre franciscoaguirre added the T6-XCM This PR/Issue is related to XCM. label Feb 26, 2025
@franciscoaguirre franciscoaguirre marked this pull request as draft February 26, 2025 14:23
@acatangiu
Copy link
Copy Markdown
Contributor

acatangiu commented Mar 13, 2025

Either nest or do smth like Error("description") and each layer along the way adds to "description", but nesting should work better

@raymondkfcheung raymondkfcheung moved this from Todo to In Progress in Bridges + XCM May 13, 2025
@raymondkfcheung
Copy link
Copy Markdown
Contributor

/cmd prdoc --audience runtime_dev --bump patch

This PR fixes compile errors introduced in #7730, which adds nested
error reporting and instruction index tracking to `pallet-xcm`,
`xcm-executor`, and related components.

Specifically:
- Updates all usage sites to match the new nested structure.
- Ensures proper propagation of the index field in `Outcome::Error` and
`Outcome::Incomplete`.
- Adjusts method signatures and error handling to reflect the new error
format.

This change helps improve XCM observability and debugging by explicitly
identifying the failing instruction in error contexts.
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/15356104242
Failed job name: test-linux-stable-no-try-runtime

@franciscoaguirre franciscoaguirre disabled auto-merge May 31, 2025 17:37
@franciscoaguirre franciscoaguirre added this pull request to the merge queue May 31, 2025
Merged via the queue into master with commit 65ade49 May 31, 2025
244 checks passed
@franciscoaguirre franciscoaguirre deleted the nest-inner-xcm-errors branch May 31, 2025 22:35
@github-project-automation github-project-automation bot moved this from In Progress to Done in Bridges + XCM May 31, 2025
ordian added a commit that referenced this pull request Jun 4, 2025
* master:
  omni-node: fix `benchmark pallet` to work with `--runtime` (#8594)
  Handle and suppress "New unknown `FromSwarm` libp2p event" warning (#8731)
  Implement detailed logging for XCM failures (#8724)
  [pallet-revive] contract's nonce starts at 1 (#8734)
  sync/fix: Clear gap sync on known imported blocks (#8445)
  [PoP] Add personhood tracking pallets (#8164)
  client/net: Use litep2p as the default network backend (#8461)
  Unflake `returns_status_for_pruned_blocks` (#8709)
  [AHM] Report the weights of epmb pallet to expose kusama and polkadot weights (#8704)
  Remove all XCM dependencies from `pallet-revive` (#8584)
  Docker master image tag fix (#8711)
  Record ed as part of the storage deposit (#8718)
  [pallet-revive] update dry-run logic (#8662)
  feat: add collator peer ID to ParachainInherentData (#8708)
  Nest errors in pallet-xcm (#7730)
  pallet-assets ERC20 precompile (#8554)
  Broker: Introduce min price + adjust renewals to lower market. (#8630)
  [AHM] Staking async fixes for XCM and election planning (#8422)
  Staking (EPMB): Add defensive error handling to voter snapshot creation and solution verification (#8687)
pgherveou pushed a commit that referenced this pull request Jun 11, 2025
Errors in `pallet-xcm` are frustrating. You execute an XCM instruction
and get `LocalExecutionIncomplete`: no details, no context. Was it
insufficient balance? An account conversion failure? You're left
guessing.

To fix this, we introduce `LocalExecutionIncompleteWithError`, which
nests an `ExecutionError` enum inside `LocalExecutionIncomplete`. This
provides specific error details, like insufficient balance or asset
transaction failures, making debugging easier for users and
applications. FRAME errors are limited to 4 bytes, and we were only
using one. By nesting `ExecutionError`, we utilize the full 4 bytes with
a compact enum that mirrors `XcmError` for consistency.

To make this robust, we reworked problematic errors. For instance,
`FailedToTransactAsset` previously took a string, which couldn’t fit in
4 bytes. We’ve replaced it with a unit variant in `ExecutionError`,
logging the string for debugging while keeping the encoding compact.
This ensures detailed, efficient error reporting.

---------

Co-authored-by: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Andrii <ndk@parity.io>
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this pull request Aug 7, 2025
This brings in `stable2506` Polkadot SDK, and integrates many new
features.

Integrated breaking changes to be verified by the original authors:

- [x] ~paritytech/polkadot-sdk#8127 @kianenigma
@Ank4n~
     This will come in with AHM, and not before.
- [x] paritytech/polkadot-sdk#7597 @gui1117 
- [x] paritytech/polkadot-sdk#8254 @bkchr 
- [x] paritytech/polkadot-sdk#7592 @bkontur 
- [x] paritytech/polkadot-sdk#8382
@UtkarshBhardwaj007
- [x] paritytech/polkadot-sdk#8021 @serban300 
- [x] paritytech/polkadot-sdk#8344 @serban300 
- [x] paritytech/polkadot-sdk#8262 @athei 
- [x] paritytech/polkadot-sdk#8584 @athei 
- [x] paritytech/polkadot-sdk#8299 @skunert
- [x] paritytech/polkadot-sdk#8652 @pgherveou 
- [x] paritytech/polkadot-sdk#8554 @pgherveou 
- [x] paritytech/polkadot-sdk#8281 @mrshiposha 
- [x] paritytech/polkadot-sdk#7730
@franciscoaguirre
- [x] paritytech/polkadot-sdk#8599 @yrong
@claravanstaden
- [x] paritytech/polkadot-sdk#8531 @bkontur 
- [x] paritytech/polkadot-sdk#8409 @kianenigma 
- [x] paritytech/polkadot-sdk#9137
@franciscoaguirre
- [x] paritytech/polkadot-sdk#7944 @bkontur 
- [x] paritytech/polkadot-sdk#8179 @bkontur 
- [x] paritytech/polkadot-sdk#8037 @yrong

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: claravanstaden <claravanstaden64@gmail.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Alain Brenzikofer <alain@integritee.network>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: ron <yrong1997@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Overkillus <maciej.zyszkiewicz@parity.io>
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
Errors in `pallet-xcm` are frustrating. You execute an XCM instruction
and get `LocalExecutionIncomplete`: no details, no context. Was it
insufficient balance? An account conversion failure? You're left
guessing.

To fix this, we introduce `LocalExecutionIncompleteWithError`, which
nests an `ExecutionError` enum inside `LocalExecutionIncomplete`. This
provides specific error details, like insufficient balance or asset
transaction failures, making debugging easier for users and
applications. FRAME errors are limited to 4 bytes, and we were only
using one. By nesting `ExecutionError`, we utilize the full 4 bytes with
a compact enum that mirrors `XcmError` for consistency.

To make this robust, we reworked problematic errors. For instance,
`FailedToTransactAsset` previously took a string, which couldn’t fit in
4 bytes. We’ve replaced it with a unit variant in `ExecutionError`,
logging the string for debugging while keeping the encoding compact.
This ensures detailed, efficient error reporting.

---------

Co-authored-by: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Andrii <ndk@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T6-XCM This PR/Issue is related to XCM.

Projects

Status: Done
Status: Done
Status: To be released (SDK)

Development

Successfully merging this pull request may close these issues.

7 participants