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

Logs subscription errors out when "FromBlock" is present #2464

Closed
simsonraj opened this issue May 7, 2024 · 5 comments
Closed

Logs subscription errors out when "FromBlock" is present #2464

simsonraj opened this issue May 7, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@simsonraj
Copy link
Contributor

Description

Expected:
WS logs subscription should accept the same params as HTTP that works
Current:
Errors out with
"error": {
"code": -32602,
"name": "Invalid parameter",
"message": "Invalid parameter 'fromBlock' for EthSubscribeLogsParamsObject: Unknown parameter"
},

Steps to reproduce

WSS request:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": [ "logs", { "address": "0x0ed544cdac078ba3bc354b2458c04e358e758c9a", "fromBlock": "0x1E" } ] }

HTTP request:
{ "jsonrpc":"2.0", "method":"eth_getLogs", "params":[{ "address":"0x0ed544cdaC078ba3bC354b2458C04E358E758C9a", "fromBlock":"0x1E" }], "id":12 }

Additional context

No response

Hedera network

testnet

Version

0.47.0-rc3

Operating system

None

@simsonraj simsonraj added the bug Something isn't working label May 7, 2024
@Nana-EC Nana-EC added this to the 0.48.0 milestone May 7, 2024
@ebadiere ebadiere self-assigned this May 10, 2024
@quiet-node quiet-node assigned quiet-node and unassigned ebadiere May 15, 2024
@quiet-node
Copy link
Collaborator

Hello @simsonraj thanks for opening the ticket!
I did some research and it looks like standard log subscriptions only have params={address, topics} (like our current setup) but not the whole kit like in eth_getLogs.

Below is the logs subscriptions params by some well-known services:

Essentially, eth_subscribe is designed for real-time monitoring of new logs as they are added to the network, while eth_getLogs is used to retrieve historical logs from a specified block range. address and topics filters are sufficient for real-time monitoring for typically retrieving logs from specific contracts and topics. Other filters like fromBlock, toBlock, blockHash would only make sense for retrieving historical logs, i.e. logs that already occurred and added to the network in the past. So to sum up, the difference in filter params between logs subscription and eth_getLogs are intentional and based on their different use cases.

While this is indeed a good feature request, but sort of goes against the grain of how other services follow the industry standard patern for logs subscription params. Feel free to give me more context and explain why you think this is necessary. We will review your suggestion and see how it might fit into our future roadmap.

@AlfredoG87
Copy link
Collaborator

@quiet-node @simsonraj

in any case, I believe we should close this ticket, and in case that we wish to consider the feature request, another ticket should be created with the appropriate template and labels, as a feature enhancement.

@AlfredoG87 AlfredoG87 removed this from the 0.48.0 milestone May 20, 2024
@simsonraj
Copy link
Contributor Author

Hey @quiet-node , thanks for the response. you probably are right. The reason why I missed that is because I don't think the other endpoints throw an error, I believe they simply ignore the param, is that doable?

@quiet-node
Copy link
Collaborator

Ah I see you're right looks like other services ignore the invalid params. Yes it's doable, and I will create a new ticket to address that and replace this ticket with that. Thanks for pointing it out!

@quiet-node
Copy link
Collaborator

Replaced by #2520

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
5 participants