Skip to content

fix(governance): set_operator invalidates a pending operator proposal - #538

Merged
usmanimamu17-create merged 2 commits into
ApexChainx:mainfrom
beulah7717108-eng:fix/469-set-operator-invalidates-pending
Aug 31, 2026
Merged

fix(governance): set_operator invalidates a pending operator proposal#538
usmanimamu17-create merged 2 commits into
ApexChainx:mainfrom
beulah7717108-eng:fix/469-set-operator-invalidates-pending

Conversation

@beulah7717108-eng

Copy link
Copy Markdown
Contributor

Summary

set_operator installed the operator directly (admin-only) but left PENDING_OP_KEY intact, so a stale handoff could later complete and silently override the admin's single-step decision — the sequence set_operator(B) then accept_operator(C) would leave C as operator.

This change makes a direct assignment invalidate any pending operator proposal: it clears the pending slot and its expiry timestamp and emits an op_can event when one is pending, so the two-step and single-step paths can no longer conflict.

Changes

  • governance.rs: set_operator now clears PENDING_OP_KEY / PENDING_OP_TS_KEY and emits op_can when a proposal was pending.
  • tests.rs: coverage for the invalidation on direct set and for the blocked stale-accept path.

Tests

New tests pins the cleared pending slot, the installed operator, and that the superseded candidate can no longer accept.

Closes #469

A direct, admin-only operator assignment left PENDING_OP_KEY intact, so
a stale handoff could later complete and silently override the admin's
single-step decision. set_operator now clears the pending operator slot
and its expiry timestamp and emits an op_can event when one is pending,
so the two-step and single-step paths can no longer conflict. Adds
coverage for the invalidation and for the blocked stale-accept path.

Closes ApexChainx#469
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@beulah7717108-eng Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Triggers clippy::len_zero under -D warnings in the Client Checks gate.

@usmanimamu17-create usmanimamu17-create left a comment

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.

Good fix, let's merge.

@usmanimamu17-create usmanimamu17-create left a comment

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 fix, merging 👍

@usmanimamu17-create
usmanimamu17-create merged commit 36acc54 into ApexChainx:main Aug 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_operator can orphan a pending operator proposal: the two-step handoff state survives a direct assignment

2 participants