Serialization of timestamp
field for CommitSig::BlockIdFlagAbsent
does not match Go counterpart
#1352
Labels
bug
Something isn't working
What went wrong?
I noticed the following error when testing the light client attack evidence submission to CometBFT 0.34 and 0.37 via the
/broacast_evidence
RPC endpoint from Hermes:My investigation led me to the following problem:
CommitSig::BlockIdFlagAbsent
currently serializes to JSON aswhich fails the CometBFT check
CommitSig.ValidateBasic()
withtime is present
This check is performed as
IsZero()
is defined asFrom the documentation of the
Time
struct, we see that it expects azero time to be
0001-01-01T00:00:00Z
and not1970-01-01T00:00:00Z
:There may be other instances where the timestamp is formatted
incorrectly, but I don't have time to look into it at the moment.
Steps to reproduce
Download this evidence serialized as JSON: https://gist.github.com/romac/58548ff5b4f2ad880bcb53364b1b7ffa
Create a new Rust project, add
tendermint-rpc
v0.31.1 as a dependency:src/main.rs
:Expected
"0001-01-01T00:00:00Z"
Result
"1970-01-01T00:00:00Z"
Definition of "done"
The result should match the expected behaviour and tendermint-rs should be able to submit a valid evidence to CometBFT 0.34 and 0.37.
Related issues
Looks like this was already popped up in past issues, but either the fix was lost or overwritten or it was never correct in the first place:
The text was updated successfully, but these errors were encountered: