-
Notifications
You must be signed in to change notification settings - Fork 95
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
client/eth/rpc: fix HTTP provider panic #2252
client/eth/rpc: fix HTTP provider panic #2252
Conversation
So then you understand this is also a bug with |
This is what I mean by "tricky", it doesn't matter who (producer/consumer) is using it wrong - the end result is same, hence consumer ideally shouldn't rely on producer not screwing up with this particular golang feature. |
The fix is needed. This change is defensive and that's good. Yet, an issue should still be filed with go-ethererum. An implementation of an exported API with |
I'll raise it there, doubt they'll bother fixing this any time soon though. |
Express yourself clearly and put up a terse PR and they will. |
Here's what I consider a terse fix upstream. func (ec *Client) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) {
sub, err := ec.c.EthSubscribe(ctx, ch, "newHeads")
if err != nil {
return nil, err // nil interface, not ethereum.Subscription(nil)
}
return sub, nil
} As the consumer we should be ignoring the other returns when error is non-nil, but we were being lazy and using it as a flag in a parent scope. ❌ |
I was fiddling with Arbitrum L2, Ethereum wallet does seem to work with it nicely (with minor adjustments it syncs with arbitrum Provider, and I was able to transfer some Arb ETH/USDC to/from it without any obvious issues!),
but I run into a nasty panic that crashes dexc when I'm adding arbitrum Provider (it could be Ethereum provider, the importaint thing here is to trigger "HTTP fallback"):
Comparing interface against
nil
is tricky, this PR fixes the issue.