-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
batcher: keep blocks, channels and frames in strict order & simplify …
…reorg handling (#12390) * use a queue.Queue for channelBuilder.frames * remove pop and push terminology * proliferate queue.Queue type * simplify requeue method * undo changes to submodule * sketch out new arch https://www.notion.so/oplabs/op-batcher-re-architecture-114f153ee162803d943ff4628ab6578f * add TODO * add channelManager.pruneSafeBlocks method and integrate into main loop * fix frameCursor semantics * fixup tests * avoid Rewind() in tests * only rewind cursor in rewind (never move it forward) * fix assertions * prune channels whose blocks are now safe * handle case when rewinding a channel with no blocks this is strange, I don't think we should expect channels with frames but no blocks... * add clarification * implement channelManager.pendinBlocks() method * fix pruning logic * simplify pruneChannels * simplify pruneSafeBlocks * add unit tests for pruneSafeBlocks * fix pruneSafeBlocks to avoid underflow * improve test * add unit tests for pruneChannels * introduce handleChannelTimeout and simplify channel.TxConfirmed API * factor out channelManager.rewindToBlockWithHash * change test expectation * do more pruning in test * Replace "clean shutdown" behaviour with waitNodeSync() Instead of optimizing for a clean shutdown (which we couldn't guarantee anyway), this change optimizes for code simplicity. This change also helps us restrict the amount of code which mutates the channelQueue (removePendingChannel was doing removal of channels at arbitrary positions in the queue). The downside is that we may end up needlessly resubmitting some data after the reset. Reorgs are rare, so it makes sense to optimize for correctness rather than DA costs here. * Add readme and architecture diagram * don't panic when there is a safe chain reorg * fix test * readability improvements * only clear state after waiting for node to sync * resize image * tweak readme * typo * rewindToBlockWithHash never moves cursor forward * use s.pendingBlocks() * add log line * check there are blocks when handling timeout * rename HasFrame() to HasPendingFrame() * fixup test * improve readme * link to open issues by tag * add log when main loop returns * pass blockID to rewindToBlock and panic if block does not exist * don't remove all channels when a channel times out keep older channels, it's possible that they also time out * use newSafeHead.L1Origin in Clear() when pruning blocks * clarify comment * use warn log level on safe chain reorg pruning, and unify handling for safe head above unsafe head * update panic message * extend test coverage and fix bug * rename test blocks * simplify HasPendingFrame() method * simplify implementation of RewindFrameCursor * activate dormant test * ensure pending_blocks_bytes_current metric is tracked properly * cover metrics behaviour in test using new TestMetrics struct * extend test coverage to channelManager.handleChannelTimeout * add comment to TxFailed * rename test fn * point to e2e tests in readme. * readme: performance -> throughput * improve channel_manager_test to assert old channels are not affected by requeue or timeout * fix handleChannelTimeout behaviour We were trimming older channels and keeping new ones. We need to trim newer channels and keep old ones. Fixes associated test (see previous commit). * tighten up requirements for invalidating a channel * replace requeue with handleChannelInvalidated
- Loading branch information
Showing
10 changed files
with
503 additions
and
482 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.