Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Support non power of two sizes #672

Open
recmo opened this issue Apr 7, 2020 · 0 comments
Open

Support non power of two sizes #672

recmo opened this issue Apr 7, 2020 · 0 comments
Assignees
Labels
refactor Improves the code quality tracker Issues generated from source comments

Comments

@recmo
Copy link
Contributor

recmo commented Apr 7, 2020

On 2019-09-04 @recmo wrote in b51698e “Use size instead of depth + support zero”:

Support non power of two sizes

                commitment: Commitment::from_size_hash(size, &Hash::default()).unwrap(),
                nodes: MmapVec::with_capacity(0),
                leaves,
            });
        }
        // TODO: Support non power of two sizes
        require!(size.is_power_of_two(), Error::NumLeavesNotPowerOfTwo);
        require!(size <= Index::max_size(), Error::TreeToLarge);

        // Allocate result
        let leaf_depth = Index::depth_for_size(size);

From crypto/merkle-tree/src/tree.rs:75

@recmo recmo added refactor Improves the code quality tracker Issues generated from source comments labels Apr 7, 2020
@recmo recmo self-assigned this Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
refactor Improves the code quality tracker Issues generated from source comments
Projects
None yet
Development

No branches or pull requests

1 participant