Skip to content

fix: remove aggregator controller and share aggregator state wit…#1434

Open
perfogic wants to merge 2 commits into
ReamLabs:masterfrom
perfogic:master
Open

fix: remove aggregator controller and share aggregator state wit…#1434
perfogic wants to merge 2 commits into
ReamLabs:masterfrom
perfogic:master

Conversation

@perfogic

@perfogic perfogic commented Jun 17, 2026

Copy link
Copy Markdown

What was wrong?

Fixes #1430.

  • POST /lean/v0/admin/aggregator updated NetworkState.is_aggregator, but the actual aggregation paths in LeanChainService used their own boot-time is_aggregator value.
    => This made the admin API misleading because toggling it did not affect chain-service aggregation behavior.

How was it fixed?

  • Deleted AggregatorController and stopped routing the admin endpoint through a separate controller layer.
  • Removed is_aggregator from NetworkState; network state should not own the aggregator role.
  • Added AggregatorState as the shared runtime flag for the node's aggregator role.
  • Passed that same state into both the RPC handlers and LeanChainService.
  • Changed the chain service to read the shared flag when deciding whether to aggregate during ticks or gossip attestation handling.
  • Left prover setup and subnet subscriptions as boot-time behavior for now.

To-Do

@perfogic perfogic changed the title refactor: remove aggregator controller and share aggregator state wit… fix: remove aggregator controller and share aggregator state wit… Jun 17, 2026
@perfogic

Copy link
Copy Markdown
Author

Illustration about how this PR works

  • Before this PR, the admin API and the chain service used different aggregator role states (is_aggregator).
For Admin API:
  POST /lean/v0/admin/aggregator
          |
          v
  RPC aggregator handler
          |
          v
  AggregatorController.set_enabled(enabled)
          |
          v
  NetworkState.is_aggregator
          |
          v
  GET /lean/v0/admin/aggregator
 For Chain Service:
   config.is_aggregator
          |
          v
  LeanChainService.is_aggregator
          |
          +--> tick_interval(..., is_aggregator)
          |
          +--> on_gossip_attestation(..., is_aggregator)

=> This lead to the case that aggregator role was enabled while the chain service still behaved as a non-aggregator.

  • After this PR, both RPC and chain-service aggregation checks share the same live role state, which is AggregatorState:
config.is_aggregator
        |
        v
AggregatorState
        |
        +------------------------------+
        |                              |
        v                              v
RPC admin aggregator handlers   LeanChainService
GET/POST /admin/aggregator      tick_interval(...)
                                on_gossip_attestation(...)

@perfogic perfogic marked this pull request as ready for review June 17, 2026 10:36
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.

Clean up the aggregator API as Lean admin aggregator toggle is a no-op

1 participant