Closed
Conversation
Contributor
mslipper
commented
Oct 11, 2022
- port over deadlock fix
- op-node: Add wrapper to support EthSubscribe in HTTP clients (op-node: Add wrapper to support EthSubscribe in HTTP clients #3629)
- op-node: Integrate PollingClient with op-node (op-node: Integrate PollingClient with op-node #3630)
The Geth RPC client does not support subscriptions for HTTP endpoints. As a result, users who set an HTTP endpoint for the op-node were unable to sync since the driver never got any L1 head updates. This PR adds a wrapper around `client.RPC` that makes `newHeads` subscriptions work over HTTP. It does this by layering a notifications system that mimicks what Geth does under the hood on top of an HTTP polling loop. The interface is the same as the one exposed by the raw RPC client. I tried my best to match Geth's subscription semantics, including: - Closing the client causes all subscribers to get a nil error on their error channels. - Unsubscribing closes each subscriber's error channel. - Calling `Unsubscribe` multiple times is safe. The poll rate is configurable. It default to 250ms, which should be fine for both L1 and L2. I tried at first to use Geth's underlying libraries, but found that it was impossible to do so without making changes to Geth itself to export more fields. This system is also simpler, and gives us room to instrument the polling loop in the future. The wrapper is not integrated with the rest of the system in this PR. I'll stack those changes on top of this one so we can review this in isolation. Totally open to different solutions here - marking as draft to reflect the fact that if there's a better way to do this, I'm happy o close this + the dependent PRs and go a different route. Meta: - Fixes ENG-2490
Integrates the HTTP PollingClient with the op-node. To do this, I needed to change the RPC interface to return an `ethereum.Subscription` object rather than a concrete *rpc.ClientSubscription instance. I also introduced a new method to return the correct `client.RPC` implementation based on the user's chosen RPC URL. Lastly, I added an additional CircleCI job to run all end-to-end tests against an HTTP-based RPC endpoint to prevent issues from arising in the future.
|
Contributor
|
Hey @mslipper! This PR has merge conflicts. Please fix them before continuing review. |
Contributor
|
This PR changes implementation code, but doesn't include a changeset. Did you forget to add one? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.