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

refactor HashedNodeStore.hash #678

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

danlaine
Copy link

This fixes a regression. I also think this simplifies the code.

added is a better name than modified.

The updated hash implementation now handles changed node sizes, which it couldn't before. This is sort of a hack because we shouldn't ever need to increase the size allocated to a branch node once we know the number of children. That is, a branch node with more AddressWithHash children has a larger serialized representation than the same node with only Address children. This can be addressed in a follow up PR.

@danlaine danlaine self-assigned this Jul 10, 2024
// We found a branch, so find all the children that need hashing
let mut modified = false;
) -> Result<(TrieHash, LinearAddress), Error> {
let modified = self.added.remove(&node_addr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think this was easier to read with the external function that isolated the magic about into_inner.

@danlaine danlaine merged commit 15b6eee into remove-shale-refactor-hash Jul 10, 2024
4 checks passed
@danlaine danlaine deleted the remove-shale-refactor-hash-3 branch July 10, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants