-
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
Fix AbciQuery to support error response. #71
Conversation
40ab674
to
bd03874
Compare
|
||
/// Proof (if requested) | ||
pub proof: Option<Proof>, | ||
|
||
/// Block height | ||
pub height: block::Height, | ||
#[serde(default, deserialize_with = "serializers::parse_height_option")] | ||
pub height: Option<block::Height>, |
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.
So these are only optional now as they are None in case of an error response.
#[test] | ||
fn parse_query_responses() { | ||
let error_rsp = r#"{"response": {"code": 1, "log": "account lookup failed: account not found", "info": "", "index": "0", "key": null, "value": null, "proof": null, "height": "0", "codespace": ""}}"#; | ||
let success_rsp = r#"{"response": {"value": "some value"}}"#; |
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.
Doesn't a successful response also include code
etc and not only value
? Let me double check.
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 seems it depends solely on the abci app's implementation, and since it's protobuf, every field is optional.
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 might be good to update our fixtures in the rpc to contain both JSON files, the happy path and the error case:
https://docs.tendermint.com/master/rpc/#/ABCI/abci_query
It's fixed in current master, closing now. |
For example:
{"response": {"code": 1, "log": "account lookup failed: account not found", "info": "", "index": "0", "key": null, "value": null, "proof": null, "height ": "0", "codespace": ""}}