op-batcher: enable graceful shutdown, closing current channel#5105
Conversation
|
b47e2f8 to
b9d6331
Compare
trianglesphere
left a comment
There was a problem hiding this comment.
Thanks for implementing this. I'd love to see some tests around this. Unit tests would be ideal, but we also have some frameworks which can handle more complex system setups.
Agreed about the need for testing. I'll see what I can put together here. |
|
I believe that this should be technically tested by some of the e2e tests, such as optimism/op-e2e/migration_test.go Line 121 in 68c357c This is proving to be fairly difficult to unit test due to the dependency on the |
f62fc02 to
669445a
Compare
|
Hey @BrianBland! This PR has merge conflicts. Please fix them before continuing review. |
669445a to
add81b5
Compare
✅ Deploy Preview for opstack-docs canceled.
|
be11111 to
ba5b58c
Compare
|
Hey @BrianBland! This PR has merge conflicts. Please fix them before continuing review. |
sebastianst
left a comment
There was a problem hiding this comment.
Thanks for adding this!
We should think about a way to not only test the channelManager but also the BatchSubmitter itself, because there's a lot going on now with different contexts, closing done channels etc.
|
Great work @BrianBland this is a super high leverage fix |
ba5b58c to
4ae79f8
Compare
Usa separate contexts for loading L2 blocks and tx submission
3a6e76f to
acdd051
Compare
sebastianst
left a comment
There was a problem hiding this comment.
Looks good now!
It seems one fix got reverted, see comment.
|
This PR has been added to the merge queue, and will be merged soon. |
|
Hey @BrianBland, this pull request failed to merge and has been dequeued from the merge train. If you believe your PR failed in the merge train because of a flaky test, requeue it by commenting with |
|
@Mergifyio requeue |
❌ Command disallowed due to command restrictions in the Mergify configuration.Details
|
Description
This change is intended to enable graceful shutdowns for the
BatchSubmitterwhen theStopmethod is called.In order to shut down safely, this first closes any current pending channel, then publishes any remaining frames on the channel back to the L1. Once the channel has been completely closed and submitted, the submitter loop should exit without loading any new L2 blocks into its local state.
One caveat is that a repeated failure to submit frames back to the L1 may cause this loop to hang even when a shutdown is desired, as this prioritizes channel completion over shutdown speed. This can be worked around by passing a channel into the
Stopmethod with a reasonable deadline, as is now the case in at least one e2e test.Tests
Added tests for various channel manager
Close()behaviors, including "close before first use", "close with no pending channel", "close with pending channel", and "close when all transactions are failed"Invariants
For changes to critical code paths, please list and describe the invariants or key security properties of your new or changed code.
Additional context
Add any other context about the problem you're solving.
Metadata