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

add eth_subscribe and eth_unsubscribe #331

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Shiti
Copy link

@Shiti Shiti commented Dec 5, 2022

This is implemented and supported by the most execution clients. For example:

I could not find the EIP or other document where this was discussed.

@lightclient
Copy link
Member

Hi @Shiti, thank you for this contribution. In addition to the spec update, we also need to generate tests. You can learn how to do this here: https://github.com/ethereum/execution-apis/blob/main/tests/README.md

@Shiti
Copy link
Author

Shiti commented Dec 18, 2022

@lightclient I'm unable to get the tests to pass.

Here's an example,

>> {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
<< {"jsonrpc":"2.0","id":1,"result":"0xcd0c3e8af590364c09d0fa6a1210faf5"}

The errors in the logs from failure are:

>>  {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
<<  {"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"notifications not supported"}}
response differs from expected:
 {
-  "error": {
-    "code": -32001,
-    "message": "notifications not supported"
-  },
   "id": 1,
   "jsonrpc": "2.0"
+  "result": "0xcd0c3e8af590364c09d0fa6a1210faf5"
 }


>>  {"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
<<  {"jsonrpc":"2.0","error":{"code":-32600,"message":"eth_subscribe found for the url 'http://0.0.0.0:8545' but is disabled for Https"},"id":1}
response differs from expected:
 {
-  "error": {
-    "code": -32600,
-    "message": "eth_subscribe found for the url 'http://0.0.0.0:8545' but is disabled for Https"
-  },
   "id": 1,
   "jsonrpc": "2.0"
+  "result": "0xcd0c3e8af590364c09d0fa6a1210faf5"
 }

Is it disabled intentionally for testing ?

At this time, this precludes subscription methods from being tested.
https://github.com/ethereum/execution-apis/blob/main/tests/README.md#test-generation

Please guide me on how to proceed.

@shanejonas
Copy link
Contributor

"message": "eth_subscribe found for the url 'http://0.0.0.0:8545' but is disabled for Https"

these methods are only available over websocket

@fjl
Copy link
Collaborator

fjl commented Jun 9, 2023

I don't think it will be possible to create example driven tests for this mechanism. For eth_subscribe, the server generates the subscription ID, and it will usually be a large random value. Our testing framework cannot deal with non-deterministic responses.

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.

4 participants