Skip to content

refactor(op-devstack): migrate Orchestrator to unified Registry (Phase 4)#18875

Merged
teddyknox merged 3 commits intodevelopfrom
teddyknox/id-refactor-phase4
Feb 25, 2026
Merged

refactor(op-devstack): migrate Orchestrator to unified Registry (Phase 4)#18875
teddyknox merged 3 commits intodevelopfrom
teddyknox/id-refactor-phase4

Conversation

@teddyknox
Copy link
Copy Markdown
Contributor

@teddyknox teddyknox commented Jan 20, 2026

This PR completes Phase 4 of the ID type system refactor by migrating the Orchestrator from 15 separate locks.RWMap registry fields to a single unified *stack.Registry.

Key changes:

  • Replace 15 typed registry fields (l1ELs, l2CLs, batchers, etc.) with single registry *stack.Registry
  • Update GetL2EL to use FindL2ELCapableByKey for polymorphic lookups across L2ELNode, RollupBoostNode, and OPRBuilderNode
  • Update Hydrate method to iterate components by kind with explicit ordering
  • Update all ControlPlane methods to use registry lookups with type assertions
  • Migrate ~24 files to use consistent registry.Register() and registry.Get() patterns

Motivation

The previous Orchestrator maintained 15 separate locks.RWMap fields, each keyed by its own ID type:

// Before: 15 separate registries
type Orchestrator struct {
    l1ELs           locks.RWMap[stack.L1ELNodeID, L1ELNode]
    l2CLs           locks.RWMap[stack.L2CLNodeID, L2CLNode]
    batchers        locks.RWMap[stack.L2BatcherID, *L2Batcher]
    rollupBoosts    locks.RWMap[stack.RollupBoostNodeID, *RollupBoostNode]
    // ... 11 more fields
}

This led to:

  • Duplicate lookup logic across registries
  • Complex polymorphic lookups (GetL2EL had to check 3 different maps)
  • No unified way to query "all components on chain X"
  • Adding new component types required adding new registry fields

Solution

Consolidate all component storage into a single registry:

// After: Single unified registry
type Orchestrator struct {
    registry *stack.Registry
}

The registry provides:

  • Primary storage: ComponentID -> component
  • Secondary index by kind: ComponentKind -> []ComponentID
  • Secondary index by chain: ChainID -> []ComponentID

Migration Patterns

Registration:

// Before
orch.batchers.Set(batcherID, b)

// After
orch.registry.Register(stack.ConvertL2BatcherID(batcherID).ComponentID, b)

Lookup:

// Before
batcher, ok := orch.batchers.Get(id)

// After
component, ok := orch.registry.Get(stack.ConvertL2BatcherID(id).ComponentID)
batcher := component.(*L2Batcher)

Polymorphic Lookup (using Phase 3 capabilities):

// Before: 15 lines checking 3 maps
func (o *Orchestrator) GetL2EL(id stack.L2ELNodeID) (L2ELNode, bool) {
    if el, ok := o.l2ELs.Get(id); ok { return el, true }
    rbID := stack.NewRollupBoostNodeID(id.Key(), id.ChainID())
    if rb, ok := o.rollupBoosts.Get(rbID); ok { return rb, true }
    // ... check OPRBuilder too
}

// After: 5 lines with capability interface
func (o *Orchestrator) GetL2EL(id stack.L2ELNodeID) (L2ELNode, bool) {
    capable, ok := stack.FindL2ELCapableByKey(o.registry, id.Key(), id.ChainID())
    if !ok { return nil, false }
    if el, ok := capable.(L2ELNode); ok { return el, true }
    return nil, false
}

Files Changed

Category Files
Core sysgo/orchestrator.go, sysgo/control_plane.go, sysgo/deployer.go
L2 EL nodes sysgo/l2_el_opgeth.go, sysgo/l2_el_opreth.go, sysgo/l2_el_synctester.go, sysgo/rollup_boost.go, sysgo/op_rbuilder.go
L2 CL nodes sysgo/l2_cl_opnode.go, sysgo/l2_cl_kona.go, sysgo/l2_cl_supernode.go, sysgo/l2_cl_p2p_util.go
Services sysgo/l2_batcher.go, sysgo/l2_proposer.go, sysgo/l2_challenger.go, sysgo/faucet.go
Infrastructure sysgo/supervisor.go, sysgo/supervisor_op.go, sysgo/supervisor_kona.go, sysgo/sync_tester.go, sysgo/test_sequencer.go
Other sysgo/add_game_type.go, sysgo/l2_metrics_dashboard.go, sysgo/l2_network_superchain_registry.go

Special Cases

l2MetricsEndpoints: This field stores Prometheus scrape targets, not components, so it remains separate. Changed from locks.RWMap to map[string][]PrometheusMetricsTarget with sync.RWMutex.

Test Plan

  • All 54 stack tests pass
  • Polymorphic lookups work for RollupBoostNode and OPRBuilderNode
  • Hydrate correctly initializes components in dependency order
  • ControlPlane can start/stop all component types
  • Build compiles without errors

Related

  • Phase 1 PR: Unified ComponentID with generic wrappers
  • Phase 2 PR: Unified Registry implementation
  • Phase 3 PR: Capability interfaces (L2ELCapable)
  • Design document

@teddyknox teddyknox requested review from a team and sebastianst and removed request for a team January 20, 2026 19:57
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.2%. Comparing base (aaa41a0) to head (9a4caac).
⚠️ Report is 3 commits behind head on teddyknox/id-refactor-phase3.

Additional details and impacted files
@@                       Coverage Diff                       @@
##           teddyknox/id-refactor-phase3   #18875     +/-   ##
===============================================================
- Coverage                          76.3%    73.2%   -3.2%     
===============================================================
  Files                               188      190      +2     
  Lines                             10943    10966     +23     
===============================================================
- Hits                               8356     8030    -326     
- Misses                             2441     2792    +351     
+ Partials                            146      144      -2     
Flag Coverage Δ
cannon-go-tests-64 66.4% <ø> (-0.9%) ⬇️
contracts-bedrock-tests 77.1% <ø> (-4.5%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase3 branch from cad37f6 to eb6a9ec Compare January 20, 2026 20:28
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch from 39c42cd to 650d744 Compare January 20, 2026 20:28
Comment thread op-devstack/sysgo/add_game_type.go Outdated
Comment thread op-devstack/sysgo/control_plane.go Outdated
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch from 650d744 to a4fa90c Compare January 20, 2026 21:28
Comment thread op-devstack/sysgo/orchestrator.go Outdated
Comment thread op-devstack/sysgo/orchestrator.go
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch from a4fa90c to 615316f Compare January 20, 2026 22:22
Comment thread op-devstack/sysgo/orchestrator.go Outdated
Comment thread op-devstack/sysgo/orchestrator.go
Comment thread op-devstack/sysgo/orchestrator.go Outdated
Comment thread op-devstack/sysgo/orchestrator.go Outdated
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase3 branch from eb6a9ec to b22581a Compare February 4, 2026 20:08
@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Feb 19, 2026
@opgitgovernance
Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@pcw109550 pcw109550 removed the S-stale Status: Will be closed unless there is activity label Feb 19, 2026
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch from 615316f to 1f978e3 Compare February 20, 2026 01:52
@teddyknox teddyknox requested review from a team as code owners February 20, 2026 01:52
@teddyknox teddyknox requested review from Inphi and removed request for a team February 20, 2026 01:52
@wiz-inc-a178a98b5d
Copy link
Copy Markdown

wiz-inc-a178a98b5d bot commented Feb 20, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch 3 times, most recently from 46d41bf to 9a4caac Compare February 20, 2026 16:02
                                                                                                                                                                                                                                                                                                                           
Introduce L2ELCapable interface that captures shared behavior across                                                                                                                                                                                                                                                     
L2ELNode, RollupBoostNode, and OPRBuilderNode without requiring them to                                                                                                                                                                                                                                                  
share an ID() method signature.                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                         
This enables polymorphic lookups where code can find any L2 EL-capable                                                                                                                                                                                                                                                   
component by key+chainID, regardless of concrete type:                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                         
  sequencer, ok := FindL2ELCapableByKey(registry, "sequencer", chainID)                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                         
Previously this required manual multi-registry lookups checking each                                                                                                                                                                                                                                                     
type separately.
…e 4)

                                                                                                                                                                                                                                                                                                                         
Replace 15 separate locks.RWMap registry fields in Orchestrator with a                                                                                                                                                                                                                                                   
single unified *stack.Registry. This completes the ID type system refactor                                                                                                                                                                                                                                               
by consolidating all component storage into one registry with secondary                                                                                                                                                                                                                                                  
indexes for efficient lookups by kind and chainID.                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                         
Key changes:                                                                                                                                                                                                                                                                                                             
- Remove l1ELs, l1CLs, l1Nets, l2ELs, l2CLs, l2Nets, batchers, proposers,                                                                                                                                                                                                                                                
  challengers, rollupBoosts, oprbuilderNodes, supervisors, clusters,                                                                                                                                                                                                                                                     
  superchains, and faucets fields from Orchestrator                                                                                                                                                                                                                                                                      
- Add single registry *stack.Registry field                                                                                                                                                                                                                                                                              
- Update GetL2EL to use FindL2ELCapableByKey for polymorphic lookups                                                                                                                                                                                                                                                     
- Update Hydrate to iterate by kind with explicit ordering                                                                                                                                                                                                                                                               
- Update ControlPlane methods to use registry lookups                                                                                                                                                                                                                                                                    
- Migrate ~24 files to use registry.Register() and registry.Get() patterns                                                                                                                                                                                                                                               
- Change l2MetricsEndpoints from locks.RWMap to map with sync.RWMutex                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                         
All 54 stack tests pass.
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase4 branch from 9a4caac to d2a572e Compare February 20, 2026 22:15
@teddyknox teddyknox force-pushed the teddyknox/id-refactor-phase3 branch from b22581a to 6c7c339 Compare February 20, 2026 22:22
@teddyknox teddyknox requested a review from a team as a code owner February 20, 2026 22:22
Copy link
Copy Markdown
Member

@pcw109550 pcw109550 left a comment

Choose a reason for hiding this comment

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

Approving with a single comment about handling supernodeIDs

Comment thread op-devstack/sysgo/orchestrator.go
Base automatically changed from teddyknox/id-refactor-phase3 to develop February 24, 2026 18:03
@teddyknox teddyknox added this pull request to the merge queue Feb 24, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2026
@teddyknox teddyknox added this pull request to the merge queue Feb 24, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2026
@teddyknox teddyknox added this pull request to the merge queue Feb 25, 2026
Merged via the queue into develop with commit 47fafdd Feb 25, 2026
76 checks passed
@teddyknox teddyknox deleted the teddyknox/id-refactor-phase4 branch February 25, 2026 15:43
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.

3 participants