tendermint / go-amino

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

Fix bug in function decodeReflectJSONStruct #306

Open NicolasMahe opened 4 years ago

NicolasMahe commented 4 years ago

This PR fixes a bug in the function decodeReflectJSONStruct.

To decode each field of the struct, this function is calling decodeReflectJSON. The issue was instead of using each field.FieldOptions, it was passing its parameter fopts FieldOptions: https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/json-decode.go#L416

The binary version decodeReflectBinaryStruct is already using each field.FieldOptions, so I just apply the same logic to the json version. https://github.com/tendermint/go-amino/blob/59d50ef176f686dc2c0c150e85a9381a78b9978a/binary-decode.go#L867

I also add a new Unsafe struct to json_test.go to unit test the issue. Without the fix, the tests are failing.


Here is the link to the failed CI test before the fix: https://app.circleci.com/jobs/github/tendermint/go-amino/670

jacquesvcritien commented 1 year ago

Are there plans for this to be merged please?

melekes commented 1 year ago

Are there plans for this to be merged please?

I don't think this repo is being maintained. Better to fork and continue from there.