Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[batcher] derive.ChannelOut factory #12344

Merged

Conversation

mdehoog
Copy link
Contributor

@mdehoog mdehoog commented Oct 5, 2024

Description

(Follow up of #12045 and #12079. Replacement of #12337, which would also solve our problem although somewhat more verbosely, so let me know which one is preferred.)

Adds the ability to customize the derive.ChannelOut using a factory. Changes made:

  • Adds a new NewChannelBuilderWithChannelOut that accepts a derive.ChannelOut as a parameter rather than creating them internally.
  • newChannel now accepts a derive.ChannelOut (and no longer has an error return value)
  • ChannelManager has a new SetChannelOutFactory method that lets you set the derive.ChannelOut factory
  • DriverSetup contains a ChannelOutFactory that is passed to the channel manager. This can be set with a new DriverSetupOption hook that is passed to the BatcherServiceFromCLIConfig, which allows customization of the batcher channel out without much code duplication.

Tests

Added a small factory test and updated other tests.

Additional context

This allows the L3 project to customize the ChannelOut implementation, which allows us to immediately batch when withdrawals are generated (for faster withdrawals).

Here's an example: https://github.com/mdehoog/op-enclave/blob/main/op-batcher/batcher/batch_submitter.go#L32-L35

@mdehoog mdehoog force-pushed the michael/channel-out-factory branch from 30c299d to a085671 Compare October 7, 2024 22:19
@mdehoog mdehoog force-pushed the michael/channel-out-factory branch from 45c33f5 to dd7d92b Compare October 7, 2024 22:59
@mdehoog mdehoog marked this pull request as ready for review October 7, 2024 23:24
@mdehoog mdehoog requested review from a team as code owners October 7, 2024 23:24
@mdehoog mdehoog requested a review from geoknee October 7, 2024 23:24
@geoknee geoknee added this pull request to the merge queue Oct 11, 2024
Merged via the queue into ethereum-optimism:develop with commit 5c1e198 Oct 11, 2024
58 checks passed
Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.29%. Comparing base (1495f6d) to head (f52cd43).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #12344      +/-   ##
===========================================
- Coverage    64.48%   64.29%   -0.19%     
===========================================
  Files           52       52              
  Lines         4361     4361              
===========================================
- Hits          2812     2804       -8     
- Misses        1373     1382       +9     
+ Partials       176      175       -1     
Flag Coverage Δ
cannon-go-tests 64.29% <ø> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes

@mdehoog mdehoog deleted the michael/channel-out-factory branch October 11, 2024 22:03
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
* Add support for a derive.ChannelOut factory

* Add DriverSetupOption for injecting custom options into the DriverSetup

* Remove factory from NewChannelManager and NewChannelBuilder

* Add ChannelOut factory test

* Add comment about why we use a wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants