Skip to content

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

@clockworkgr

Description

@clockworkgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions