Skip to content

Comments

SwitchableBeacon upgrades & task/role application systems#86

Merged
hudsonhrh merged 1 commit intohudsonhrh/event-ordering-fixfrom
hudsonhrh/contract-analysis
Feb 6, 2026
Merged

SwitchableBeacon upgrades & task/role application systems#86
hudsonhrh merged 1 commit intohudsonhrh/event-ordering-fixfrom
hudsonhrh/contract-analysis

Conversation

@hudsonhrh
Copy link
Member

Summary

Implemented four critical SwitchableBeacon fixes from the upgradeability analysis, plus added task rejection and role application systems from earlier work.

Key Changes

Fix 5: Emit MirrorSet event in constructor when initializing in Mirror mode.

Fix 2: Implement two-step ownership (Ownable2Step) pattern. SwitchableBeacon transferOwnership() now sets pendingOwner only; acceptOwnership() completes the transfer. Executor provides acceptBeaconOwnership() helper for deployment flow.

Fix 1: Transfer eligibility/toggle module beacon ownership directly to Executor (no transfer needed since created after executor exists). Only executor beacon requires two-step transfer.

Fix 3: Remove setAutoUpgrade() function and AutoUpgradeSet event from OrgRegistry. The autoUpgrade flag is now immutable (set at deployment, read-only thereafter).

Test Coverage

  • 627 tests pass (up from 596)
  • Added 8 two-step ownership tests + constructor event tests
  • Added 3 beacon ownership verification tests
  • Added 20 task application tests (from earlier work)
  • All existing tests continue to pass

Related Issues

Subgraph event tracking issues created:

  • #99: TaskManager events (TaskRejected, TaskApplicationSubmitted, TaskApplicationApproved)
  • #100: EligibilityModule events (RoleApplicationSubmitted, RoleApplicationWithdrawn)
  • #101: SwitchableBeacon/OrgRegistry event changes

…ication systems

## Changes

### Fix 5: Emit MirrorSet event in constructor
- Added MirrorSet event emission when SwitchableBeacon initializes in Mirror mode
- Tests verify constructor emits event correctly for both modes

### Fix 2: Implement two-step ownership (Ownable2Step)
- SwitchableBeacon: Added pendingOwner state, OwnershipTransferStarted event, acceptOwnership()
- Executor: Added acceptBeaconOwnership() helper for deployment flow
- GovernanceFactory: Added execBeacon to GovernanceResult, initiates transfer
- OrgDeployer: Accepts executor beacon ownership after deployment
- Comprehensive test coverage for all two-step scenarios

### Fix 1: Transfer eligibility/toggle beacon ownership to Executor
- GovernanceFactory: Pass result.executor as beaconOwner to _deployEligibilityModule and _deployToggleModule
- Eligibility/toggle beacons now owned by executor from creation (no transfer needed)
- Added 3 tests verifying all module beacons owned by executor after deployment

### Fix 3: Remove setAutoUpgrade from OrgRegistry
- Removed setAutoUpgrade() function and AutoUpgradeSet event
- autoUpgrade now immutable (set at deployment, read-only thereafter)

### Earlier improvements (from prior context)
- TaskManager: Added rejectTask(), TaskApplicationSubmitted, TaskApplicationApproved events
- EligibilityModule: Added applyForRole(), withdrawApplication() with application system
- Comprehensive tests for task rejection and role application flows

All 627 tests pass. Code formatted with forge fmt.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@hudsonhrh hudsonhrh merged commit 737ea01 into hudsonhrh/event-ordering-fix Feb 6, 2026
8 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.

1 participant