AntelopeIO / abieos

Other
2 stars 12 forks source link

consider undoing murmur hash of invalid name when reading name from JSON #31

Open spoonincode opened 2 months ago

spoonincode commented 2 months ago

When reading a name from JSON, https://github.com/AntelopeIO/abieos/blob/232600c587b9e7bfb78f6807997e4aa24075be39/include/eosio/name.hpp#L154-L158 abieos first checks if it's a valid name and uses it, but if it's not a valid name it makes it a valid name by murmur hashing it, https://github.com/AntelopeIO/abieos/blob/232600c587b9e7bfb78f6807997e4aa24075be39/include/eosio/name.hpp#L145-L149

This yields (imo) surprising behavior for someone using abieos to serialize actions from JSON. For example, someone using abieos' JSON->bin serialization may pass abieos

{"from":"bob bob bob","to":"carol","quantity":"2.0000 EOS","memo":"sup"}

what would you expect to happen here? nodeos will disallow serialization in this case because bob bob bob isn't a valid name. but abieos will serialize it, with from being the murmur hash output of bob bob bob. I consider nodeos the canonical abi behavior and abieos should match it.

heifner commented 2 months ago

💯 agree this should be removed.