Skip to content

Fix XCM Barrier Rejection Handling to Return Incomplete with Weight#7843

Merged
raymondkfcheung merged 11 commits intomasterfrom
ray-add-wt-for-barrier-err
Mar 19, 2025
Merged

Fix XCM Barrier Rejection Handling to Return Incomplete with Weight#7843
raymondkfcheung merged 11 commits intomasterfrom
ray-add-wt-for-barrier-err

Conversation

@raymondkfcheung
Copy link
Copy Markdown
Contributor

@raymondkfcheung raymondkfcheung commented Mar 7, 2025

This PR addresses an issue with the handling of message execution when blocked by the barrier. Instead of returning an Outcome::Error, we modify the behaviour to return Outcome::Incomplete, which includes the weight consumed up to the point of rejection and the error that caused the blockage.

This change ensures more accurate weight tracking during message execution, even when interrupted. It improves resource management and aligns the XCM executor’s behaviour with better error handling practices.

@raymondkfcheung raymondkfcheung requested a review from a team as a code owner March 7, 2025 11:25
@raymondkfcheung raymondkfcheung self-assigned this Mar 7, 2025
@raymondkfcheung raymondkfcheung marked this pull request as draft March 7, 2025 11:26
@raymondkfcheung raymondkfcheung added the T6-XCM This PR/Issue is related to XCM. label Mar 7, 2025
@raymondkfcheung raymondkfcheung moved this to In Progress in Bridges + XCM Mar 7, 2025
@raymondkfcheung
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience runtime_dev --bump patch

@raymondkfcheung raymondkfcheung marked this pull request as ready for review March 10, 2025 14:43
@raymondkfcheung raymondkfcheung moved this from In Progress to In-Review in Bridges + XCM Mar 11, 2025
assert_eq!(
outcome,
Outcome::Incomplete {
used: Weight::from_parts(3000000000, 3072),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these values come from? some benchmarking or something else?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);
return Outcome::Error { error: XcmError::Barrier }

// Return Outcome::Incomplete instead of Outcome::Error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't seem very helpful. We can either have a comment about why we return Outcome::Incomplete or no comment at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@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/13767468101
Failed job name: test-linux-stable

Copy link
Copy Markdown
Contributor

@serban300 serban300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

);
return Outcome::Error { error: XcmError::Barrier }

return Outcome::Incomplete {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, I think this change make sense according to the:

    /// Execution started, but did not complete successfully due to the given error; given weight
	/// was used.
	Incomplete { used: Weight, error: Error },
	/// Execution did not start due to the given error.
	Error { error: Error },

because Barrier check fails in the Self::execute(origin, pre, id, weight_credit) - so it started.

I am just wondering where else we are using Outcome::Error instead of Incomplete { used: Weight, error: Error }

impl From<Error> for Outcome {
	fn from(error: Error) -> Self {
		Self::Error { error }
	}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created the follow-up issue #7965

@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2503:

EgorPopelyaev pushed a commit that referenced this pull request Mar 20, 2025
Backport #7843 into `stable2503` from raymondkfcheung.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Raymond Cheung <[email protected]>
EgorPopelyaev pushed a commit that referenced this pull request Mar 20, 2025
Backport #7843 into `stable2407` from raymondkfcheung.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Raymond Cheung <[email protected]>
EgorPopelyaev pushed a commit that referenced this pull request Mar 20, 2025
Backport #7843 into `stable2409` from raymondkfcheung.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Raymond Cheung <[email protected]>
EgorPopelyaev pushed a commit that referenced this pull request Mar 20, 2025
Backport #7843 into `stable2412` from raymondkfcheung.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Raymond Cheung <[email protected]>
@alialobidm
Copy link
Copy Markdown

``

@alialobidm
Copy link
Copy Markdown

__

@alialobidm
Copy link
Copy Markdown

ordian added a commit that referenced this pull request Apr 28, 2025
* master: (26 commits)
  Snowbridge V2 (#7402)
  [AHM] Revert multi-block election, slashing and staking client pallets (#7939)
  docs: update local ci execution instruction (#8003)
  Upgrade deps to eliminate ancient dependencies (#7999)
  Removed `pallet:getter` from XCM pallets (#7916)
  Add digest processor xcm emulator (#7915)
  Fix: [Referenda Tracks] Resolve representation issues that are breaking PJS apps (#7671)
  Improve XCMP weight metering (#7963)
  bump version of zombienet-sdk (#7964)
  rpc-v2/archive: Rename archive call method result to value (#7885)
  Bump parachains runtime api to 13 (#7981)
  `bp-runtime`: make macro expansion not rely on `sp-std` in scope. (#7978)
  [CI/CD] Refactor backports flow so that it can determine automatically where to do a backport based on labels (#7976)
  Treasury: update expire date on payout (#7958) (#7959)
  `fatxpool`: report_invalid: do not ban Future/Stale txs from re-entering the view (#7777)
  Fix XCM Barrier Rejection Handling to Return Incomplete with Weight (#7843)
  Bump openssl from 0.10.64 to 0.10.70 (#7442)
  runtime-api: remove redundant version checks (#7610)
  Upgrade link-checker cache to v4 (#7874)
  Updating readmes (#7950)
  ...
@raymondkfcheung raymondkfcheung moved this to SDK Released - Needs Integration in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from SDK Released - Needs Integration to To be released (SDK) in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from To be released (SDK) to Integrated - Done in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from Integrated - Done to SDK Released - Needs Integration in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from SDK Released - Needs Integration to To be released (SDK) in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from To be released (SDK) to SDK Released - Needs Integration in fellowship/runtimes integrations queue May 29, 2025
@raymondkfcheung raymondkfcheung moved this from SDK Released - Needs Integration to To be released (SDK) in fellowship/runtimes integrations queue May 29, 2025
@acatangiu acatangiu moved this from To be released (SDK) to SDK Released - Needs Integration in fellowship/runtimes integrations queue Jul 3, 2025
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: SDK Released - Needs Integration

Development

Successfully merging this pull request may close these issues.

8 participants