tendermint / go-amino

Protobuf3 with Interface support - Designed for blockchains (deterministic, upgradeable, fast, and compact)
Other
259 stars 78 forks source link

Proposal: make time varint encoded (instead of fixed length) #208

Closed liamsi closed 5 years ago

liamsi commented 6 years ago

In protobuf there is https://github.com/golang/protobuf/blob/14aad3d5ea4c323bcd7a2137e735da24a76e814c/ptypes/timestamp/timestamp.pb.go#L99-L108 where seconds and nanos are encoded as varint. See also the corresponding proto file / message: https://github.com/golang/protobuf/blob/14aad3d5ea4c323bcd7a2137e735da24a76e814c/ptypes/timestamp/timestamp.proto#L121-L133

In amino, we currently encode time as fixed length (signed) ints: https://github.com/tendermint/go-amino/blob/2106ca61d91029c931fd54968c2bb02dc96b1412/encoder.go#L123-L136

I think it could be worthwhile to change this behaviour. Then, people working on amino in other languages, or interefacing via vanilla protobuf could just use proto's encoding / types.

liamsi commented 5 years ago

Closed via #224