-
Notifications
You must be signed in to change notification settings - Fork 382
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(examples): add merkle tree package #631
Conversation
CI seems to be failing for the issue in #668 Could you add sha256 and hex in the whitelist in the meantime, for this PR? |
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.
merkle.gno also needs more documentation and comments
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.
maybe add a go equivalent to the js code?
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.
the merkle.gno is 100% go compatible.. with a quick look at the gno code, you can have the go code... is it really mendatory ?
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.
No, not necessarily. But it seems weird then that there is an example of JS code inside of the directory of a gno package :)
@thehowl thanks for your review, everything has beed fixed :) wdyt ? |
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.
A small performance suggestion but code-wise looks good. However, I do think it would be better if the exported symbols had proper documentation. I know most packages in p/demo have little-to-no documentation as well, but I think it's also a trend that needs to change.
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.
No, not necessarily. But it seems weird then that there is an example of JS code inside of the directory of a gno package :)
68407db
to
fa1ee30
Compare
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.
I appreciate this PR. However, since Gno already utilizes an automatic Merkle tree, it would be beneficial to compare the performance of this Merkle tree implementation against alternatives such as the avl
package or built-in native types that are automatically merkelized.
The evaluation may yield a nuanced result, indicating that for groups of over N entries, this package outperforms others in terms of speed or cost-effectiveness.
If this package proves to be less efficient than alternative solutions, I suggest considering a different name to avoid misleading users into assuming similar advantages to those found in other platforms.
Overall, it would be beneficial to create more packages like this to provide diverse options for content management. Thank you!
@moul rebased |
I don't understand your point, an avl tree will be stored on chain, which could be a lot of memory. Maybe a different approach would have been to add a "Proof" system on the avl tree ? 🤔 But AFAIK, most project use merkletreejs on client side to generate the merkle proof in the browser. cc: @moul |
Understood. This package wasn't initially designed as an internal proof verification system for an alternative tree storage. Its primary purpose is to facilitate proof generation in the browser and enable contract usage of the Naming it "merkletree" effectively highlights the included proof system. Let's proceed with the current name and focus on showcasing practical usage examples. To maintain simplicity and composability, we can extend |
Why this PR
I'm currently working on a Merkle Airdrop contract in Gno. you can see the ongoing progress on my fork albttx#1
This PR needs
crypto/sha256
implemented #580Description
This PR add a new package
p/merkle
for creating Merkle Tree.I did my best to make it as simple as possible and to provide the minimum features required.
NewTree
function.How has this been tested?
using
gnodev