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

bug: Incorrect defaults for google.protobuf.Timestamp #89

Open
clockworkgr opened this issue Nov 30, 2023 · 0 comments
Open

bug: Incorrect defaults for google.protobuf.Timestamp #89

clockworkgr opened this issue Nov 30, 2023 · 0 comments

Comments

@clockworkgr
Copy link

clockworkgr commented Nov 30, 2023

Tendermint/Comet BFT treats an undefined/unset Timestamp as a time.Time zero (checking against time.Time.isZero()).

This is 0001-01-01 00:00:00.000.

However, a google.protobuf.Timestamp with { seconds: 0n, nanos: 0 } as defined for undefined/unset here:

https://github.com/confio/cosmjs-types/blob/main/src/google/protobuf/timestamp.ts#L104-L109

results in 1970-01-01 00:00:00.000 (UNIX epoch).

The correct default should be:

{ seconds: -62135596800000n, nanos: 0 }

Admittedly this is golang specific I guess so probably not a good idea to change the "default" encoder but leaving this here in case someone else stumbles across it.

i.e. Always set timestamps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant