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

feat(op-node/op-batcher/op-proposer): add fallbackClient #55

Merged
merged 23 commits into from
Oct 17, 2023

Conversation

welkin22
Copy link
Contributor

@welkin22 welkin22 commented Sep 21, 2023

Description

The FallbackClient is designed to automatically switch to an alternative L1 endpoint when the current one encounters issues, and revert back once the primary endpoint is functional again.

The core logic operates as follows: When an error occurs, it is recorded until either the error count surpasses a predetermined threshold or the count is reset by a timer that executes once per minute. If the threshold is exceeded within a one-minute span, it suggests the L1 endpoint has become unreliable, prompting the system to select the next address in the L1 URL. A new RPC client is then created to replace the current one. Simultaneously, a separate Goroutine monitors the initial endpoint's health and, when deemed stable, reverts back to its use.

As the clients employed in op-node and op-batcher/op-proposer differ significantly, two distinct fallbackClients have been implemented. The op-node version incorporates additional features such as subscription management and RPC legality checks, resulting in a more complex implementation.

Rationale

We need to improve stability. Currently, the L1 endpoint is the most unstable point.

Example

Example of l1 flag after code modification:

--l1=https://data-seed-prebsc-1-s1.binance.org:8545,https://data-seed-prebsc-2-s2.binance.org:8545,https://data-seed-prebsc-2-s3.binance.org:8545

Changes

  • Add fallback client code
  • Implant fallback client in op-node, op-batcher, op-proposer related code

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2023

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 6, 2023
@owen-reorg owen-reorg removed the Stale label Oct 7, 2023
andyzhang2023
andyzhang2023 previously approved these changes Oct 10, 2023
@welkin22 welkin22 requested a review from owen-reorg October 13, 2023 09:14
@owen-reorg owen-reorg merged commit 6421d48 into bnb-chain:develop Oct 17, 2023
9 checks passed
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.

3 participants