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

[Bug] Incorrect Deserialize for PubSubItem::Notification #92

Closed
leruaa opened this issue Dec 23, 2023 · 0 comments · Fixed by #93
Closed

[Bug] Incorrect Deserialize for PubSubItem::Notification #92

leruaa opened this issue Dec 23, 2023 · 0 comments · Fixed by #93
Labels
bug Something isn't working

Comments

@leruaa
Copy link
Contributor

leruaa commented Dec 23, 2023

Component

json-rpc

What version of Alloy are you on?

v0.1.0 (latest main branch)

Operating System

Linux

Describe the bug

Looking at:

"id" => {
if id.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id = Some(map.next_value()?);
}
"subscription" => {
if subscription.is_some() {
return Err(serde::de::Error::duplicate_field("subscription"));
}
subscription = Some(map.next_value()?);
}
"result" => {
if result.is_some() {
return Err(serde::de::Error::duplicate_field("result"));
}
result = Some(map.next_value()?);
}

It seems PubSubItem try to deserialize an EthNotification from a json that looks like this:

{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "subscription": "0x..."
  "result": {},
}

Whereas the correct json is like this:

{
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "params": {
    "subscription": "0x..."
    "result": {},
  }
}
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
None yet
Development

Successfully merging a pull request may close this issue.

1 participant