-
Notifications
You must be signed in to change notification settings - Fork 39
Reintroduce HTTP JSON-RPC client #1001
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Reintroduce HTTP JSON-RPC client by replacing WebSocket blockchain client connections with HTTP RPC clients across CLI commands, indexers, and server componentsThe codebase transitions from WebSocket-based blockchain connections to HTTP JSON-RPC clients for most operations while maintaining separate WebSocket clients for live subscriptions. Key changes include:
📍Where to StartStart with the Changes since #1001 opened
Macroscope summarized aa5ca5a. |
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.
Issue on line in pkg/indexer/app_chain/app_chain.go:65:
The error handling in NewAppChain will dereference a nil rpcClient if blockchain.NewRPCClient fails, causing a panic. The code calls rpcClient.Close() even though rpcClient is nil on initialization failure. Consider guarding the call to rpcClient.Close() so it only runs when rpcClient is non-nil, preventing a nil pointer dereference.
- cancel()
- rpcClient.Close()
+ cancel()
+ if rpcClient != nil {
+ rpcClient.Close()
+ }🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
There’s been some back and forth on this.
We initially switched from HTTP RPC URLs to WSS URLs to simplify xmtpd configuration, since a WebSocket connection allow both JSON-RPC requests and subscriptions over a single connection.
However, it turns out that our RPC providers optimize their infrastructure for JSON-RPC requests specifically over HTTP. These performance improvements don’t apply when JSON-RPC is served over WebSocket.
With this change, we’re reverting to making all JSON-RPC requests over HTTP, while continuing to use WSS solely for subscriptions.