Skip to content

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

@spoonincode

Description

@spoonincode

When reading a name from JSON,

template <typename S>
void from_json(name& obj, S& stream) {
auto r = stream.get_string();
obj = name(hash_name(r));
}

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,
inline constexpr uint64_t hash_name( std::string_view str ) {
auto r = try_string_to_name_strict(str);
if( r ) return r.value();
return murmur64( str.data(), str.size() );
}

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Icebox

Relationships

None yet

Development

No branches or pull requests

Issue actions