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

accumulator/pollard: Speedups for pollard #176

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

kcalvinalvin
Copy link
Member

Things done:

  1. Different implementation of Match known hashes in pollard #3 where the already known hashes of parents were matched, saving sha256 hashes. Instead of going through all the nodes to the path of the leaf being verified, in this implementation just looks for the polNode at the parent position. New method on pollard readPos was needed as reading from grabPos created nil hashable nodes.

  2. Various comments and small code fixes.

In my testing to block 600,000 on testnet3, the speedups were around 5%. However, when tested on blocks with lower height, the speedups were even less. So more hashing goes on as the tree gets bigger, leading to bigger savings. The matched hashes to the tip of the default server was 160,716,082 hashes and the unmatched hashes were 55,700,940 hashes. So this is around 75% of potential sha computation saved.

Copy link
Contributor

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

tested. looks good, just 3 small things:

accumulator/pollardproof.go Outdated Show resolved Hide resolved
accumulator/batchproof.go Outdated Show resolved Hide resolved
Biggest thing done is to match known hashes in the pollard nodes when
hashing for parents from the given batchproof, saving on sha256 hashes.
@adiabat
Copy link
Contributor

adiabat commented Jul 31, 2020

Tested, looks good. Could have even more speedups combined with #177, or further TTL / caching after that PR.

@adiabat adiabat merged commit b4f3f83 into mit-dci:master Jul 31, 2020
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.

3 participants