Sort object before converting sign msg to bytes
cbarraford opened this issue · 2 comments
cbarraford commented
I noticed that I ran into a signing verification error when my msg contains an object (like sdk.Coins
, which is an array of objects). Because JSON'ifying an object is non-deterministic, the bytes array isn't deterministic when signing a message.
The binance chain JS code sorts the object as seen here. https://github.com/binance-chain/javascript-sdk/blob/75d955eecb6357940f4b3085821a1edbe22513b5/src/encoder/index.js#L72
Maybe this code base should do something similar.
Booyoun-Kim commented
I will add sortObject() too!
Booyoun-Kim commented
I added it.
c1b2c13