Skip to content

Commit a8fa09e

Browse files
karlfloerschopsuperchainclaude
authored
fix(op-supernode): error on uninitialized chain sync status (ethereum-optimism#19543)
* fix(op-supernode): error on uninitialized chain sync status * fix(op-supernode): use SyncStatus() in FinalizedL2Head to get nil guard FinalizedL2Head was calling c.vn.SyncStatus() directly, bypassing the nil guard added in SyncStatus(). This would panic if the virtual node hadn't been initialized yet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: opsuperchain <opsuperchain@slop.bot> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bd29b7d commit a8fa09e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

op-supernode/supernode/chain_container/chain_container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ func (c *simpleChainContainer) SyncStatus(ctx context.Context) (*eth.SyncStatus,
364364
if c.log != nil {
365365
c.log.Warn("SyncStatus: virtual node not initialized")
366366
}
367-
return &eth.SyncStatus{}, nil
367+
return nil, virtual_node.ErrVirtualNodeNotRunning
368368
}
369369
st, err := c.vn.SyncStatus(ctx)
370370
if err != nil {

op-supernode/supernode/chain_container/chain_container_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,3 +1166,18 @@ func TestChainContainer_LocalSafeBlockAtTimestamp(t *testing.T) {
11661166
})
11671167
}
11681168
}
1169+
1170+
func TestChainContainer_SyncStatus_UninitializedVirtualNode(t *testing.T) {
1171+
t.Parallel()
1172+
1173+
chainID := eth.ChainIDFromUInt64(420)
1174+
log := createTestLogger(t)
1175+
cfg := createTestCLIConfig(t.TempDir())
1176+
initOverload := &rollupNode.InitializationOverrides{}
1177+
1178+
container := NewChainContainer(chainID, createTestVNConfig(), log, cfg, initOverload, nil, nil, nil)
1179+
1180+
status, err := container.SyncStatus(context.Background())
1181+
require.Nil(t, status)
1182+
require.ErrorIs(t, err, virtual_node.ErrVirtualNodeNotRunning)
1183+
}

op-supernode/supernode/chain_container/super_authority.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (c *simpleChainContainer) FinalizedL2Head() (eth.BlockID, bool) {
5656
return eth.BlockID{}, true
5757
}
5858

59-
ss, err := c.vn.SyncStatus(context.Background())
59+
ss, err := c.SyncStatus(context.Background())
6060
if err != nil {
6161
c.log.Error("FinalizedL2Head: failed to get sync status", "err", err)
6262
return eth.BlockID{}, true

0 commit comments

Comments
 (0)