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

state: Define MPT root hash procedure for accounts #478

Merged
merged 2 commits into from
Jul 6, 2022
Merged

Conversation

chfast
Copy link
Member

@chfast chfast commented Jun 17, 2022

No description provided.

@chfast chfast requested review from axic and gumb0 June 17, 2022 09:16
Base automatically changed from state_mpt to master June 29, 2022 19:18
MPT trie;
for (const auto& [key, value] : storage)
{
if (!is_zero(value.current)) // Skip "deleted" values.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is rather logic of how MPT data structure is used in Ethereum... so not logic of hashing itself, may be better kept outside.

But I don't mind either way.

Copy link
Member Author

@chfast chfast Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both "hash functions" are use-case specific because at least you need to decide how to serialize a structure. As long as we will keep original and current value together we cannot erase instead of zeroing.

In more generic fashion in this case std::copy_if could be used if we support std::insterter(). In the other case we would need something like "transform if" so ranges should be more suited. Interesting exercise, but decided is too big detour.

@chfast chfast merged commit a3125f0 into master Jul 6, 2022
@chfast chfast deleted the state_mpt_hash branch July 6, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants