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

feat: refactor, generics, bugfixes, and other nits #23

Merged
merged 16 commits into from
Dec 11, 2024
Merged

Conversation

signorecello
Copy link
Collaborator

@signorecello signorecello commented Nov 26, 2024

Trying to make the MT implementation similar to the sparse merkle one, figured I got the whole add and delete logic totally wrong... This fixes it.

Totally refactored the lib to go along with it lol. It now accepts generics so you can use it with any type as long as they implement Default and Eq.

Added some tests with BigNums, as that will most likely be the biggest use-case outside of integers and Fields.

@cedoor
Copy link
Member

cedoor commented Nov 27, 2024

Thanks @signorecello ! Looks like the style check is not passing

@signorecello
Copy link
Collaborator Author

Ok ended up with a big refactor to make the MTs generic. This is pretty cool (also shows the mighty power of Noir) because it allows all kinds of MTs, for example those with BigNums as leaves.

Still encountering some weird errors, so WIP for now

@signorecello
Copy link
Collaborator Author

Damn it's 1am and I swear I'll never implement a merkle tree again (you know I'm lying).

BUT I'm done with the refactor, needs a test tho (eating my own dogfood)

@signorecello signorecello changed the title MT bugfix feat: refactor, generics, bugfixes, and other nits Nov 29, 2024
@signorecello
Copy link
Collaborator Author

good to review now @cedoor @sripwoud

packages/merkle-trees/README.md Show resolved Hide resolved
packages/merkle-trees/src/sparse_merkle.nr Outdated Show resolved Hide resolved
packages/merkle-trees/src/sparse_merkle.nr Outdated Show resolved Hide resolved
packages/merkle-trees/src/sparse_merkle.nr Show resolved Hide resolved
@signorecello signorecello merged commit 28044a7 into main Dec 11, 2024
3 checks passed
@signorecello signorecello deleted the zpedro/mt_fix branch December 11, 2024 16:02
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.

3 participants