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

rpc: WebSocket client cannot parse NewBlock events #930

Closed
romac opened this issue Jul 16, 2021 · 0 comments · Fixed by #931
Closed

rpc: WebSocket client cannot parse NewBlock events #930

romac opened this issue Jul 16, 2021 · 0 comments · Fixed by #931
Assignees
Labels
bug Something isn't working

Comments

@romac
Copy link
Member

romac commented Jul 16, 2021

As of c8b97aa, and the addition of the time_iota_ms field to tendermint::block::Size, the WebSocket client cannot parse NewBlock events emitted by Tendermint because those do not include the time_iota_ms in the appropriate place.

As the time_iota_ms field is not part of Size's Protobuf counterpart, the value of this field is currently hardcoded to 1000 in the Proto->Domain conversion.

The field should probably be either removed or be added a #[serde(default = "...")] annotation so that we can parse NewBlock events again.

Steps to reproduce

  1. Start a Tendermint node which exposes a WS server at ws://127.0.0.1:26657/websocket (eg. via ibc-rs dev-env script`)
  2. Check out the romac/ws-inspect branch of tendermint-rs
  3. $ cd tools/ws-inspect
  4. $ RUST_LOG=info cargo run
  5. Notice that we receive raw NewBlock events over the WebSocket connection but that those fail to parse because of the missing time_iota_ms field
[/Users/coromac/Informal/Code/Current/tendermint-rs/rpc/src/client/transport/websocket.rs:648] &msg = "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"cf395ae4-3d9b-4076-b847-ef6e7661184e\",\n  \"result\": {\n    \"query\": \"tm.event = 'NewBlock'\",\n    \"data\": {\n      \"type\": \"tendermint/event/NewBlock\",\n      (...snip...)"
[/Users/coromac/Informal/Code/Current/tendermint-rs/rpc/src/client/transport/websocket.rs:648] Event::from_string(&msg) = Err(
    Error {
        code: ParseError,
        message: "Parse error. Invalid JSON",
        data: Some(
            "missing field `time_iota_ms` at line 230 column 13",
        ),
    },
)
@romac romac added the bug Something isn't working label Jul 16, 2021
@romac romac self-assigned this Jul 16, 2021
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