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

[feature/jmt (4/4]: In memory implementation of Jmt backed by storage traits + tests #894

Draft
wants to merge 1 commit into
base: feature/jmt-3-proof-generation-and-verification
Choose a base branch
from

Conversation

acerone85
Copy link
Contributor

@acerone85 acerone85 commented Jan 16, 2025

This feature implements a Jmt backed by two in-memory hashmaps (for the tree nodes and value preimages), and an optional value (to keep track of the latest version of the tree). The implementation makes use of the generic implementation of a Jmt over storage traits.

The following tests are provided:

  • Check root hash for empty tree
  • Check that restoring a tree to a previous state yields the original root hash
  • Test that the tree changes when updating the tree
  • Test a valid proof of exclusion on the empty tree
  • Test a valid proof of inclusion on a non-empty tree
  • Test a valid proof of exclusion on a non-empty tree
  • Test that a tampered proof of inclusion is non-valid
  • Test multiple proofs of inclusion and exclusion on a tree with 1000 leaves

[Short description of the changes.]

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • If performance characteristic of an instruction change, update gas costs as well or make a follow-up PR for that
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@acerone85 acerone85 requested review from netrome and rymnc January 16, 2025 23:13
@acerone85 acerone85 self-assigned this Jan 16, 2025
@acerone85 acerone85 marked this pull request as draft January 16, 2025 23:13
Copy link
Contributor

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Nice tests!

}

#[cfg(test)]
mod test {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you divide the tests into "Given", "When" and "Then" sections?

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