Skip to content

staking-async/ah-client: emit event when session key update from AssettHub fails on relay chain#11055

Merged
sigurpol merged 5 commits intomasterfrom
sigurpol-better-error-handlingh-session-duplicate-keys
Feb 12, 2026
Merged

staking-async/ah-client: emit event when session key update from AssettHub fails on relay chain#11055
sigurpol merged 5 commits intomasterfrom
sigurpol-better-error-handlingh-session-duplicate-keys

Conversation

@sigurpol
Copy link
Copy Markdown
Contributor

Emit SessionKeysUpdateFailed with the operation type and dispatch error for observability so set_keys/purge_kets failures from AssetHub are observable on-chain.

…tHub fails on relay chain

Emit SessionKeysUpdateFailed with the operation type and dispatch error for
observability so set_keys/purge_kets failures from AssetHub are observable
on-chain.
@sigurpol sigurpol requested a review from a team as a code owner February 12, 2026 09:35
@sigurpol
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience runtime_dev --bump major

@sigurpol sigurpol added T2-pallets This PR/Issue is related to a particular pallet. A4-backport-stable2512 Pull request must be backported to the stable2512 release branch A4-backport-stable2603 Pull request must be backported to the stable2603 release branch labels Feb 12, 2026
stash,
update: SessionKeysUpdate::Set,
});
match T::SessionInterface::set_keys(&stash, session_keys) {
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.

Are you sure this will fix the issue?

I looked a bit late yesterday into the:

message-queue -> T::MessageProcessor -> XcmExecutor::process -> ..

code path, and I was not sure how we can have success: true while the inner code path has failed somewhere.

I also am pretty sure that XcmExecutor runs in transactional layer, meaning that any failures, if happens, reverts all storage changes including events.

My knowledge OOTMH is spotty here, but just raising some concerns.

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.

But we are returning Ok(()) now even when session pallet update fails.

Copy link
Copy Markdown
Contributor Author

@sigurpol sigurpol Feb 12, 2026

Choose a reason for hiding this comment

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

Exactly, as Ankan said .

MY understanding :

how we can have success: true while the inner code path has failed somewhere.

we call dispatch here -> dispatch returns an error here -> but we swallow the error and return Ok() unconditionally here

I also am pretty sure that XcmExecutor runs in transactional layer, meaning that any failures, if happens, reverts all storage changes including events.

This would be true if set_keys_from_ah returned Err but we are returning Ok() on purpose

Copy link
Copy Markdown
Contributor Author

@sigurpol sigurpol Feb 12, 2026

Choose a reason for hiding this comment

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

what I am less sure about (maybe @franciscoaguirre can you help here?) is that the self.transact_status containing the error is effectively surfaced ONLY if we have a following ReportTransactStatus - that we don't have in our case. Maybe we should as alternative approach (very uncharted territories for me). But so far staking pallets seemed to adopt the approach returns Ok() + events for observability (debatable but out of the scope of this PR)

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.

so if we wanted to go with ReportTransactStatus we would need quick few changes if I get it right:

},
};

T::SessionInterface::set_keys(&stash, session_keys)?;
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 guess lesson for us is: xcm receiver calls should always succeed (except for origin privilege).

Ank4n
Ank4n approved these changes Feb 12, 2026
@sigurpol sigurpol added this pull request to the merge queue Feb 12, 2026
Merged via the queue into master with commit 3512a73 Feb 12, 2026
245 of 246 checks passed
@sigurpol sigurpol deleted the sigurpol-better-error-handlingh-session-duplicate-keys branch February 12, 2026 14:37
@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2512:

paritytech-release-backport-bot bot pushed a commit that referenced this pull request Feb 12, 2026
…ttHub fails on relay chain (#11055)

Emit SessionKeysUpdateFailed with the operation type and dispatch error
for observability so set_keys/purge_kets failures from AssetHub are
observable on-chain.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 3512a73)
paritytech-release-backport-bot bot pushed a commit that referenced this pull request Feb 12, 2026
…ttHub fails on relay chain (#11055)

Emit SessionKeysUpdateFailed with the operation type and dispatch error
for observability so set_keys/purge_kets failures from AssetHub are
observable on-chain.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 3512a73)
@paritytech-release-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for stable2603:

sigurpol added a commit that referenced this pull request Feb 12, 2026
Backport #11055 into `stable2512` from sigurpol.

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: Paolo La Camera <paolo@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
sigurpol added a commit that referenced this pull request Feb 13, 2026
Backport #11055 into `stable2603` from sigurpol.

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: Paolo La Camera <paolo@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
arturgontijo pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Apr 1, 2026
Backport paritytech#11055 into `stable2512` from sigurpol.

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: Paolo La Camera <paolo@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2512 Pull request must be backported to the stable2512 release branch A4-backport-stable2603 Pull request must be backported to the stable2603 release branch T2-pallets This PR/Issue is related to a particular pallet.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants