tendermint / go-amino

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

fix: prevent false to not be encoded #290

Closed nicolasbrugneaux closed 4 years ago

nicolasbrugneaux commented 5 years ago

Should fix https://github.com/tendermint/go-amino/issues/289 :)

jaekwon commented 4 years ago

This makes a special case of bools, while conflating logic for decoding slices.

jaekwon commented 4 years ago

I like the idea of using pointers to determine whether to write if empty or not. There's still the question of whether to allow nested pointers, and what it would mean for there to be nil at the nested level. Currently, amino dereferences and constructs nested pointers infinitely as needed. But if we want to preserve the information like we agree is good here, a pointer-pointer should really encode as a pointer to an implicit struct which holds that pointer. And I think that's exactly what we'll do for the 1.0 release of Amino.