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

fix: provide a safe way to obtain leaf index from mmrIndex #19

Merged
merged 1 commit into from
Jun 5, 2024

Commits on Jun 5, 2024

  1. fix: provide a safe way to obtain leaf index from mmrIndex

    When the merklebuilder is adding a node it is guaranteed that the before
    and after mmrIndex are also valid mmrSizes. This lets it use LeafCount
    to directly obtain the leafIndex of the item just added.
    
    This led to the regular use of LeafCount as the way to get the leaf
    index. It is not safe to do this in general.
    
    This change adds FirstMMRSize which returns the size of the smallest
    valid MMR which containes the node identified by mmrIndex
    
    To provide a clear idiom for safely getting the leaf index from a node
    index (mmrIndex), LeafIndex(mmrIndex) is additionaly provided as a
    convenience for
    
      LeafCount(FirstMMRSize(mmrIndex)) - 1
    
    AB#9551
    Robin Bryce committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    deca41d View commit details
    Browse the repository at this point in the history