Skip to content

Make WeightBounds return Result<Weight, XcmError> to surface XCM weight failures#8549

Merged
raymondkfcheung merged 7 commits intoray-check-weight-with-limitfrom
ray-check-weight-with-limit-v2
May 22, 2025
Merged

Make WeightBounds return Result<Weight, XcmError> to surface XCM weight failures#8549
raymondkfcheung merged 7 commits intoray-check-weight-with-limitfrom
ray-check-weight-with-limit-v2

Conversation

@raymondkfcheung
Copy link
Copy Markdown
Contributor

@raymondkfcheung raymondkfcheung commented May 16, 2025

This PR continues the work in #8535 and partially addresses #8419 by updating the return types in WeightBounds (specifically weight and instr_weight) to return Result<Weight, XcmError>. This allows downstream callers to access detailed error context for XCM weight calculation failures.

Why change

Previously, XCM weight calculation errors were surfaced only as Result<Weight, ()>, losing valuable error information and forcing all upstream consumers to treat them as opaque failures. This blocked structured error handling and obscured debugging, especially in message preparation and error handler setup.

How change

  • Changes WeightBounds::weight and instr_weight to return Result<Weight, XcmError> instead of Result<Weight, ()>.
  • Ensures consumers (e.g., XcmExecutor, ExecuteXcm) propagate or handle these structured errors correctly.
  • Builds on Make WeightBounds return XcmError to surface failures #8535, which first converted internal logic to return XcmError and added tracing logs.

@raymondkfcheung raymondkfcheung requested a review from a team as a code owner May 16, 2025 10:14
@raymondkfcheung raymondkfcheung self-assigned this May 16, 2025
@raymondkfcheung raymondkfcheung added the T6-XCM This PR/Issue is related to XCM. label May 16, 2025
@raymondkfcheung raymondkfcheung moved this to In Progress in Bridges + XCM May 16, 2025
@raymondkfcheung raymondkfcheung changed the title Ray check weight with limit v2 Make WeightBounds return Result<Weight, XcmError> to surface XCM weight failures May 16, 2025
@raymondkfcheung raymondkfcheung changed the title Make WeightBounds return Result<Weight, XcmError> to surface XCM weight failures Make WeightBounds return Result<Weight, XcmError> to surface XCM weight failures May 16, 2025
@raymondkfcheung raymondkfcheung moved this from In Progress to In-Review in Bridges + XCM May 16, 2025
@raymondkfcheung
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience runtime_dev --bump patch

@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/15066385536
Failed job name: test-linux-stable-no-try-runtime

@raymondkfcheung raymondkfcheung added the A3-backport Pull request is already reviewed well in another branch. label May 19, 2025
@raymondkfcheung raymondkfcheung changed the base branch from master to ray-check-weight-with-limit May 22, 2025 08:23
@raymondkfcheung raymondkfcheung requested review from a team as code owners May 22, 2025 08:23
@raymondkfcheung raymondkfcheung merged commit 2ea36a9 into ray-check-weight-with-limit May 22, 2025
263 of 265 checks passed
@raymondkfcheung raymondkfcheung deleted the ray-check-weight-with-limit-v2 branch May 22, 2025 08:23
@github-project-automation github-project-automation bot moved this from In-Review to Done in Bridges + XCM May 22, 2025
@raymondkfcheung
Copy link
Copy Markdown
Contributor Author

Merged into #8535 in favour of consolidating the changes there.

@raymondkfcheung raymondkfcheung removed the A3-backport Pull request is already reviewed well in another branch. label May 22, 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

Development

Successfully merging this pull request may close these issues.

3 participants