-
Notifications
You must be signed in to change notification settings - Fork 224
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
abci: fix rpc response deserialization #432
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the concise change-set. Could you explain why the null as default behaviour is needed/desired and if it is treated like that somewhere else in tendermint like that.
@@ -59,9 +60,11 @@ pub struct DeliverTx { | |||
pub info: Info, | |||
|
|||
/// Amount of gas wanted | |||
#[serde(rename = "gasWanted")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid all of these field attribute by putting a #[serde(rename_all = "camelCase")]
on the struct. See the section in the container attribute documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the camelCase here is a special case, because other places tendermint actually use a_b
format.
|
b937b5e
to
a300e5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It be great, if this PR also comes with an (updated?) test-case. Note that currently, there is a test-failure:
---- endpoints::block_results stdout ----
thread 'endpoints::block_results' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: ParseError, message: "Parse error. Invalid JSON", data: Some("missing field `gasWanted` at line 34 column 7") }', rpc/tests/integration.rs:113:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
a300e5f
to
dec5990
Compare
The test case is fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚕 📸 🚯 🔭
Fix rpc response deserialization issues. fix #423
By the way, the
null_as_default
deserializer might be good to use on some other fields.