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

FIx unsubscribe() issues (#2669) #2670

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

FIx unsubscribe() issues (#2669) #2670

wants to merge 4 commits into from

Conversation

gbrew
Copy link
Contributor

@gbrew gbrew commented Nov 8, 2023

This is a set of proposed changes to fix the 4 issues with unsubscribe which are described in issue 2669.

Motivation

The goal of these changes is to ensure that eth_unsubscribe is called properly every time a subscription is ended, either via SubscriptionStream::drop or SubscriptionStream::unsubscribe().

Solution

This fixes a json-rpc formatting issue, an issue of translating subscription ID from client-side to server-side ID, and issues of simply not calling eth_unsubscribe in the IPC and ws-legacy PubsubClients.

I tried to keep these changes to a minimal set which would fix these issues and avoid any breaking changes. There's some remaining weirdness in that the boolean return value from eth_unsubscribe indicating success is not plumbed through ethers to the caller. Doing so complicates things as it requires await-ing the response, and the unsubscribe code is used in non-async contexts including pinned SubscriptionStream::drop(), which isn't easily modified to call async functions. If we want to plumb the return value, I can make additional changes to do so, but I suspect it would either require some code duplication or trickery which may not be worthwhile.

PR Checklist

  • [ x] Added Tests
  • [ x] Added Documentation
  • [ x] Breaking changes

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.

None yet

1 participant