-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
op-service, op-batcher, op-proposer: Active sequencer follow mode #8585
Conversation
b1f00bb
to
05b06f2
Compare
…m/optimism into evan/batcher-active-seq
…impl contains TODOs.
Semgrep found 1
Potential |
…ps one client open at a time.
4aad2e9
to
3fa961b
Compare
3fa961b
to
9fb14eb
Compare
WalkthroughWalkthroughAn update has been made across several files to support multiple URL configurations for L2 Ethereum RPC and Rollup RPC endpoints. This includes handling comma-separated lists and ensuring URL counts match. A new Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ? TipsChat with CodeRabbit Bot (
|
…rentIndex in Active L2 Providers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going in a good direction. Maybe we want to simplify further by not doing retries after having iterated over the whole list once. We then offload the retry driving to the callers. Might work well, should check.
Semgrep found 1
When working with web applications that involve rendering user-generated content, it's important to properly escape any HTML content to prevent Cross-Site Scripting (XSS) attacks. In Go, the Semgrep found 1
The special variable IFS affects how splitting takes place when expanding unquoted variables. Don't set it globally. Prefer a dedicated utility such as 'cut' or 'awk' if you need to split input data. If you must use 'read', set IFS locally using e.g. 'IFS="," read -a my_array'. Ignore this finding from ifs-tampering. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be confused, don't we want to retry a new sequencer if dialing one fails?
We might need to add functionality to the test setup to let the dialers error on dial.
Co-authored-by: Sebastian Stammler <[email protected]>
- Preserve the invariant that the index and current rollup/eth client match. - Dial at the start of the loop instead of at the end.
…articular close behavior in these tests.
op-service: Improve active seq provider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to go! There are some comments to fix in the regression test. Also proposed another 1-2 tests that we might have missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✨
…hereum-optimism#8585) * op-service: Add ActiveL2EndpointProvider. * Fix bug in initialization, and handle case where no ethUrls are provided. * Split active L2 provider into active rollup and active L2 provider. * Re-duplicate some code until tests are passing. * op-proposer: Add ability to enable active provider. * op-batcher: Add ability to enable active provider. * Add an empty test skeleton. * Add an empty test skeleton. * op-service: add, but do not yet use, RollupClientInterface and EthClientInterface. * op-service: update mocks and interfaces for endpoint provider testing. * op-service - WIP on Active L2 Providers: unit tests pass, design and impl contains TODOs. * op-service: restore design in Active Endpoint Providers that only keeps one client open at a time. * op-service: when dialing a new sequencer, close() the old connection. * op-service: obey coderabbit suggestion around safer handling of p.currentIndex in Active L2 Providers. * op-service, op-batcher, op-proposer: address review comments in PR#8585. * op-service: Active L2 Provider - add test case for a sequencer returning an error. * op-service: Active L2/Rollup Providers: improve unit testing and logging. * op-service, op-batcher: address review comments in 8585 regarding first-startup behavior and testing. * op-service: address review comments through adding more tests, and moving "nil client" behavior from client getter to constructor. * op-service: minor error message change in active endpoint providers. * Update op-service/dial/active_l2_provider.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * op-service: obey linter in rabbit-provided error message change. * Update op-service/dial/active_l2_provider.go Co-authored-by: Sebastian Stammler <[email protected]> * op-service active L2 provider tests: assertAllExpectations after most tests. * op-service: more elegantly handle startup in active l2 providers, and improve testing. * Change remaining longDurationTests to be able to use ept.assertAllExpectations. * use new error errSeqUnset. * Add test for scenario where many sequencers are inactive, and only the last is active. * Readability change: move the on-creation initialization to its own function. * Move extra one-time dial to constructor. * Update op-service/dial/active_rollup_provider.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add nil check to active l2 provider. * Update op-service/dial/active_rollup_provider.go Co-authored-by: Sebastian Stammler <[email protected]> * Address review comment: change many-inactive tests to many-undialable tests. * Add test that reproduces internal state corruption. * op-service: Improve active seq provider - Preserve the invariant that the index and current rollup/eth client match. - Dial at the start of the loop instead of at the end. * Fix some tests. * Move usage of ExpectClose to MaybeClose, we don't want to enforce a particular close behavior in these tests. * add a missing call to assertAllExpectations. * Test even the case where the active providers are managing a list of 1 element. * Revert experimental hunk in active_l2_provider. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Sebastian Stammler <[email protected]>
Description
This PR proposes to add
dial.ActiveL2EndpointProvider
anddial.ActiveL2RollupProvider
. These endpoint providers will check that they are pointing to the active sequencer before providing rollup clients and l2 ethClients to callers. They are enabled by passing a comma-separated list as the rollup/l2 ethclient URL string. Additionally, this PR adds infrastructure for unit testing these structs, such astestutils.MockRollupClient
.Tests
See new unit test file,
op-service/dial/active_l2_provider_test.go
, about half the changeset is that file. Most unit tests follow the pattern where anActiveL2RollupProvider
/ActiveL2EndpointProvider
is pointing at an active sequencer, "notices" that the sequencer goes inactive, and then dials a new sequencer that reports it is active.This also successfully failed over in a devnet-like test run locally on my machine. It has also been tested to work on our internal cloud devnet during a ZDD.
Metadata