-
Notifications
You must be signed in to change notification settings - Fork 116
Add bit reverse leaf index option #168
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
Add bit reverse leaf index option #168
Conversation
|
Hi, if you never reorder the vector v then what prevents you from leaving the MT library as lexicographic and handling the mapping just outside? What is the difference between this pseudocode and the PR? |
|
So the data that we are commiting to is a polynomial.
Btw, nice to meet you, @WizardOfMenlo suggested for me to have a chat with you, multiple times, just didn't expect it to happen here 😄 |
| // 1 (001) -> 4 (100) | ||
| // 2 (010) -> 2 (010) | ||
| // 3 (011) -> 6 (110) | ||
| // 4 (100) -> 1 (001) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you mean that using ordering BIT_REVERSED the leaves in physical memory locations corresponding to 0 and 4 would get hashed into an internal node (rather than 0 and 1) ?
If so, can you write tests that cover this?
|
I think I understand the intent now. Personally, I think it would be more adaptable to open a new constructor for MerkleTree that accepts an Iterator over the vector you don't want to reorder. Something along those lines has been done in the EfficientSumcheck repo: https://github.com/compsec-epfl/efficient-sumcheck/blob/main/src/streams/stream_iterator.rs#L12 That way people can create their own orderings without modifying the actual MT Library code. It would also mean no breaking changes for the existing constructor. What are your thoughts? |
| &leaf_crh_params, | ||
| &two_to_one_params, | ||
| &leaves, | ||
| LeafOrderingMode::NATURAL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are theselexicographic and reverse_lexicographic ?
|
I can close it in this case, since it will be an Iterator either way. The only thing that is important is the next() operation. |
Description
This PR introduces an option to select if your leaves are accessed by regular or a bit-reverse order of the index.
This feature is needed in certain cases, eg. committing to the results of NTT and the reordering of the leaves is too costly to perform before the commitment.
Pendingsection inCHANGELOG.mdFiles changedin the Github PR explorer