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

Implement Pollard #27

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Davidson-Souza
Copy link
Collaborator

Pollard is a data structure that holds prune-able trees to represent the current accumulator, thus, creating a client that may prove arbitrary UTXOs. This PR implements a Pollard struct in Rust with add/del methods.

The implementation is capable of passing our test cases used for stump. There's also a wide range of tests for different aspects of a Pollard.

All commits should compile and run on its own, modulo some warnings in the first ones.

@Davidson-Souza Davidson-Souza force-pushed the feature/pollard branch 2 times, most recently from d204bb0 to b49021c Compare March 14, 2023 13:36
@Davidson-Souza Davidson-Souza force-pushed the feature/pollard branch 3 times, most recently from e23b64b to 906adbf Compare May 5, 2023 17:39
Implement basic element addition for Pollard
Pollard is a middle-ground between full tree and Stump that allows
holding only a subset of UTXOs, while still allowing proving those
elements.
This implementation only allows for full pollards, where all leaves are
present. Allowing partial pollard will be accomplished later.

The implementation uses interior mutability to work. A Pollard is
different from a normal Binary Tree because nodes points to it's
sibling, not their children. This makes recursive algoritms more
evolved, specially during deletions.

This implementation is all iteractive, and carefully uses interior
mutability with Cell and RefCell. Those smart pointers allows
runtime borrow checking, if some of the Borrowing Rules is broken, it
panics. Here, we take care of not holding reference to the interior of a
Cell or RefCell for too log, and not passing `mut ref` arround. Only a
few functions with very limited scope can use `mut ref`s.

A extensible collection of tests is also provided, to check for code
correctness and soundness.
@kcalvinalvin
Copy link
Member

Is this ready for review?

@Davidson-Souza
Copy link
Collaborator Author

Davidson-Souza commented Jul 7, 2023

I'll update this to support partial pollard. For full pollard, I made #36, which is ready to be reviewed and used in here. I could prove up to block 1M on testnet, but I ran out of RAM :/ (10GB isn't even close to be enough)
Edit: Marking as draft until it supports partial Pollard.

@Davidson-Souza Davidson-Souza marked this pull request as draft July 7, 2023 19:17
Davidson-Souza pushed a commit to Davidson-Souza/rustreexo that referenced this pull request Jun 8, 2024
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