informalsystems / tendermint-rs

Client libraries for Tendermint/CometBFT in Rust!
Apache License 2.0
588 stars 215 forks source link

The null `value` field of `EventAttribute` should be allowed #1375

Closed mzabaluev closed 7 months ago

mzabaluev commented 7 months ago

An indexer ran into null value field of EventAttribute, preventing a service from indexing events and resulting in downtime. The exact error was serde invalid type: null.

Originally posted by @daniel-savu in https://github.com/informalsystems/tendermint-rs/issues/1216#issuecomment-1802436901

mzabaluev commented 7 months ago

The OpenAPI of the RPC interface does not allow for null-valued value fields, by omission of nullable on the appropriate schema. But this may be more about what event data the application is allowed to produce in practice. I don't see any checks forbidding null values in the code of CometBFT node. So I think the tendermint-rs implementation for CometBFT RPC 0.37+ should tolerate nulls as well.

daniel-savu commented 7 months ago

Thank you for the quick follow up @mzabaluev!

To answer your question about the Tendermint version, I believe the chain is using 0.34+.

I'm not a Go developer but this is what I gather from the go.mod file: https://github.com/neutron-org/neutron/blob/51ecb6b0466077abd4bd16b3e5746aec150608c8/go.mod#L29

mzabaluev commented 7 months ago

I believe the chain is using 0.34+.

Then you also need to use the correct compatibility mode with your tendermint-rpc client, otherwise your event data will be garbled (sorry for breaking this as we moved beyond 0.34; by 1.0 we should get past this).

I have just realized that our WebSocketClient documentation fails to include the builder API, but the code of the tendermint-rpc CLI binary can provide an example of dynamic mode discovery. You may just need to use the specific CompactMode if the nodes you connect to all use a specific CometBFT version.

daniel-savu commented 7 months ago

Appreciate the heads up! Oddly enough, things have been running fine without CompatMode::V0_34 but we'll keep a close eye on it