cosmos / ledger-cosmos-obsolete

Ledger Nano S support for Tendermint/Cosmos
Apache License 2.0
42 stars 29 forks source link

Json validation part 2 #79

Closed brejski closed 6 years ago

brejski commented 6 years ago

In this PR we're adding validation that checks if json dictionaries are all sorted, unit test for that validation and integration with ledger.

If invalid message is sent to be signed, ledger will parse it and reject it returning an error code. Also, in this PR, we've added 2 new messages that have invalid formats to goclient code.

Known issue: It seems that a bog standard message serialized by cosmos is already invalid because its dictionaries are not sorted. If you run goclient.go code, the very first message fails validation. @cwgoes, @jleni have I misunderstood the "dictionary in sorted order" validation or is there a problem in cosmos serialization?

Update: Key sorting validation has been temporarily disabled until Cosmos is updated to serialize with with key sorted.

cwgoes commented 6 years ago

Ref https://github.com/tendermint/go-amino/issues/171

jleni commented 6 years ago

The PR has some compilation error. But still, merging this will result in rejected txs until tendermint/go-amino#171 is solved.

cwgoes commented 6 years ago

Blocked on https://github.com/cosmos/cosmos-sdk/issues/1550, we should also sort the top-level fields (chain ID, sequence, ...) for consistency.