ethereum-optimism / ethereum-optimism/optimism
fix(op-node/derive): channel size incorrect when pruning frames after last frame
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 134
Description
## Problem
In `Channel.AddFrame`, when the closing frame arrives and frames with index `>= endFrameNumber` are pruned, `ch.size` was decremented for every entry iterated in the map, not only for frames that are actually deleted.
## Expected
Decrement `ch.size` only when a frame is removed (same branch as `delete(ch.inputs, idx)`).
## Related PR
Will be fixed by the linked PR (see PR description).
Contributor guide
Research direction
Start at Channel.AddFrame in op-node/derive and inspect the closing-frame pruning path for indexes >= endFrameNumber. Verify that ch.size changes only when an entry is deleted from ch.inputs, then run the relevant derive tests and confirm the channel size remains correct when non-deleted frames are iterated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100