Use streamer v2 - #480
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 453180ae16
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Addresses the stall found in the PR 459 review of peekNextBatch: the old streamer could discard a good batch when the channel manager tip and the streamer position described different blocks, stalling it for good. The v2 streamer owns the tip tracking: position and tip hash move together, repositioning is explicit via SetBatchPosition, and Reset / SetProperHead / Refresh / Update are gone. - pin espresso-streamers to 22c396aa (PR 36, op streamer v2) - construct the streamer in StartBatchSubmitting (needs a context and a synced L2 node to resolve its anchor), anchor it at the safe L2 head, and run it from its own poll loops via Start/Stop - drop peekNextBatch and the cachedSyncStatus provider; the loading loop now just Peeks batches extending the tracked tip and advances after the channel manager accepts them - re-anchor instead of skipping on ToBlock/AddL2Block failures - drop the dead BatchStreamerFromCLIConfig (no callers, v1-only API) Co-Authored-By: Claude Fable 5 <[email protected]>
453180a to
ee30adb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee30adb819
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee30adb819
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…t running after an error.
…r reset on the same heads.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 771da72396
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…art does not block later start attempts. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc3049c0e0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…t startup does not depend on the L2 endpoint serving the historical origin height. Co-Authored-By: Claude Fable 5 <[email protected]>
…oint so that the Espresso batcher never treats pre-activation blocks as its own. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3de4a40279
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…k timeout so that a stalled endpoint cannot hang StartBatchSubmitting while it holds the start mutex. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0eb8205b8b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…cal-safe head so that already-derived blocks are not resubmitted after a restart. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ddf36c4f4b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…choring on a cached unsafe floor block, whose reorg could permanently wedge fork selection. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 674259b664
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ero LocalSafeL2 cannot floor the queue at genesis and re-enqueue derived history. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e403dd1353
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ocalSafeL2 cannot disable the stale-batch re-anchor floor and republish derived blocks. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50a860967d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ent sync-status failure cannot empty the channel manager while leaving the streamer at its old cursor. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de1f861616
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This PR
Points the streamer dependency at espresso-streamers#36 (op streamer v2, pinned to
22c396aa) and adapts the batcher, following the reference integration in optimism-espresso-integration#444:StartBatchSubmitting, anchored at the safe L2 head, self-driven viaStart/StopPeeks /AdvancePositions;peekNextBatch,cachedSyncStatus, and allReset/SetProperHead/Refresh/Updatecalls removedSetBatchPosition(safeL2)) instead of skipping onToBlock/AddL2BlockfailuresBatchStreamerFromCLIConfig(v1-only API, no callers)Note: v2 owns the tip tracking (position and tip hash move together), so the stall noted in this review comment on #459 is resolved as a consequence —
SetProperHeadno longer exists.Whole module builds,
go vetclean, fullop-batchertest suite passes.Why v2 removes the stall
Before (v1 +
batcher.peekNextBatch()). The derivation cursor was split across two components — the streamer held only a block number, the channel manager only a tip hash — and the batcher compared them assuming they described adjacent blocks. After a half-reset (streamer rewound, channel manager not cleared), the comparison crossed heights and could only be read as a fork:flowchart LR subgraph SV1["Streamer v1"] POS["position = 50<br/>number only — Reset() rewound it 100 → 50"] BAT["candidates at height 50:<br/>batch 50 · parent = h(49)"] end subgraph CM["Channel manager"] TIP["tip = h(100)<br/>hash only — never cleared"] end POS -. "one logical cursor — split across two components" .- TIP PNB["batcher.peekNextBatch()<br/>batch.parent == tip ?<br/>h(49) ≠ h(100) ✗ — looks like a fork, isn't one"] BAT -- "Peek()" --> PNB TIP -- "tip" --> PNB PNB -- "SetProperHead(h(100)) → discard batch 50" --> SV1 STALL(["∞ every candidate at height 50 has parent h(49)<br/>→ discarded again next tick → permanent stall"]) PNB --> STALLAfter (v2). The reviewer's suggested fix — "or do the tip tracking in streamer" — is what v2 does. Position and tip hash live in one struct behind one lock, and the only two mutators move both together, so
Peek()always compares same-height hashes. The cross-component edge that caused the bug (channelMgr.tip → SetProperHead) is deleted along with both methods; a mismatch now returns nil and keeps the candidates instead of discarding them:flowchart LR ADV["AdvancePosition()<br/>(50, h49) → (51, h50)"] --> CUR SBP["SetBatchPosition(ref)<br/>(ref.n + 1, ref.hash)"] --> CUR subgraph SV2["Streamer v2 · batchStore"] CUR["cursor: one struct, one lock<br/>nextBatchPos = 50<br/>tipHash = h(49)<br/>invariant: tipHash = h(nextBatchPos − 1)"] end CUR -- "Peek(): serve batch 50 only if parent == tipHash<br/>same height by construction · no match → nil, nothing discarded" --> OUT["batch 50 → channel manager"] CM2["Channel manager tip:<br/>never consulted anymore"] -. "✗ edge deleted (was: tip → SetProperHead)" .-x CURIf the two components still drift, the loop self-heals instead of stalling:
AddL2Blockrejects the non-extending block andclearStatere-anchors both sides from the same sync status — the "streamer was reset and channel manager was not" half-state can no longer be produced:flowchart LR ADD["channelMgr.AddL2Block()<br/>rejects a block that doesn't extend its tip"] -- "error" --> CS["clearState()"] CS --> CLR["channelMgr.Clear(l1SafeOrigin)"] CS --> SBP2["streamer.SetBatchPosition(safeL2)"]Reset()SetBatchPosition(safeL2)— number + hash set together from one block refSetProperHead(hash)Peek()matches the parent internally; no match returns nil, candidates are keptNext()AdvancePosition()— promotes the just-peeked batch's own hash to tip as the number incrementsRefresh()/Update()Start()— the streamer runs its own finality and HotShot poll loops🤖 Generated with Claude Code