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

rust-web3 cannot decode Infura getBlockByNumber response for pending block #483

Closed
e00E opened this issue Apr 20, 2021 · 1 comment · Fixed by #484
Closed

rust-web3 cannot decode Infura getBlockByNumber response for pending block #483

e00E opened this issue Apr 20, 2021 · 1 comment · Fixed by #484

Comments

@e00E
Copy link
Contributor

e00E commented Apr 20, 2021

because Infura sets miner to null.

rust-web3 has a non optional author/miner field that defaults to the 0 address if the field is not present in the json:

pub author: H160,

However when testing with Infura I found that they set miner to null which makes deserialization in rust-web3 fail. Potential solutions:

  • make the rust field optional which would automatically handle missing and null
  • see if there is a serde attribute (maybe from the serde_with crate) that also turns null into default
  • do not make any change because Infura is returning a response that is invalid according to the ethrpc specification
@tomusdrw
Copy link
Owner

see if there is a serde attribute (maybe from the serde_with crate) that also turns null into default

I like this one. Can we use #[serde(deserialize_with = "path")] for that?

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 a pull request may close this issue.

2 participants