Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spoonincode opened this issue Jun 25, 2024 · 1 comment · May be fixed by #37
Open

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

spoonincode opened this issue Jun 25, 2024 · 1 comment · May be fixed by #37
Assignees
Milestone

Comments

@spoonincode
Copy link
Member

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.

@heifner
Copy link
Member

heifner commented Jun 25, 2024

💯 agree this should be removed.

@spoonincode spoonincode self-assigned this Jan 7, 2025
@spoonincode spoonincode moved this from Todo to In Progress in Team Backlog Jan 7, 2025
@spoonincode spoonincode added this to the rolling milestone Jan 7, 2025
@spoonincode spoonincode moved this from In Progress to Awaiting Review in Team Backlog Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Awaiting Review
Development

Successfully merging a pull request may close this issue.

2 participants