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

More tries sync fixes #2967

Merged
merged 13 commits into from
Apr 8, 2021
Merged

Conversation

iulianpascalau
Copy link
Contributor

  • fixed the wrong trie node size estimation when inserting an intercepted trie node in the cache
  • made the trie syncer to not depend upon a trie instance

@iulianpascalau iulianpascalau self-assigned this Apr 7, 2021
@iulianpascalau iulianpascalau added the type:bug Something isn't working label Apr 7, 2021
@iulianpascalau iulianpascalau marked this pull request as ready for review April 7, 2021 19:15
- tweaked configs
@sasurobert sasurobert self-requested a review April 8, 2021 06:39
}

// hasher + marshalizer + dirty flag = 2 * pointerSizeInBytes + 1
nodeSize := len(bn.hash) + 2*pointerSizeInBytes + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a constant for "2"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return 0
}

// hasher + marshalizer + child + dirty flag = 3 * pointerSizeInBytes + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a constant for "2"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is 3, btw :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return 0
}

// hasher + marshalizer + dirty flag = 2 * pointerSizeInBytes + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a constant for "2"

@@ -285,10 +282,11 @@ func (ts *trieSyncer) getNode(hash []byte) (node, error) {

n, ok := ts.interceptedNodes.Get(hash)
if ok {
ts.interceptedNodes.Remove(hash)
Copy link
Contributor

Choose a reason for hiding this comment

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

the interceptor does not delete the unused infos ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, it just stores in the cache what it receives. Just like in the case of transactions, blocks and so on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@iulianpascalau iulianpascalau merged commit 6ba5a18 into feat/trie-sync-fixes Apr 8, 2021
@iulianpascalau iulianpascalau deleted the more-tries-sync-fixes branch April 8, 2021 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants