-
Notifications
You must be signed in to change notification settings - Fork 195
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(stdlib): SMT with foreign merkle_membership #1108
Conversation
@@ -0,0 +1,84 @@ | |||
use crate::merkle; | |||
|
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.
Can we add some comments to the functions here and is there a way to test functionality?
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.
Sure. Relatedly, I've not noticed any explicit comments/docs on the hash check_membership
expects the tree to have used. This should probably be added too. I'm guessing it's pedersen?
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.
Yeah that would be great!
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.
Added
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.
Spoke too soon. The test proves, but doesn't verify D:
Guessing this test has exposed a bug that deserves a separate issue?
Failed to verify proof
thread 'tests::noir_integration' panicked at 'verification fail for "sparse_merkle_tree"', crates/nargo_cli/tests/prove_and_verify.rs:61:25
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.
Just noticed when proving from nargo it logs:
linear_eval is not 0.
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 think we have an issue with a similar bug, can you link this PR to it as another corpus?
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.
Would also be good if you could add a stripped down example into the program (We can revisit this and the other issue once we switch to ultra plonk)
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.
noir_stdlib/src/merkle/smt.nr
Outdated
} | ||
|
||
impl SparseMerkleTree { | ||
/// Constrains that the new leaf is located in the new tree at an index |
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.
we don't have doc comments in noir yet, only regular 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.
Now changed to regular comments
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Tracking issue : #1252 |
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.
We probably shouldn't include this in the stdlib for reasons mentioned in #1258
* master: (63 commits) feat(nargo): Remove usage of `CompiledProgram` in CLI code and use separate ABI/bytecode (#1269) feat: add integration tests for bitshift operators (#1272) chore: Replace explicit if-elses with `FieldElement::from<bool>()` for boolean fields (#1266) chore(noir): constrain expr; -> assert(expr); (#1276) chore: fix clippy warning (#1270) chore(ssa refactor): Add all remaining doc comments to ssa generation pass (#1256) chore(noir): Release 0.5.1 (#1264) fix: Add Poseidon examples into integration tests (#1257) chore(nargo): replace `aztec_backend` with `acvm-backend-barretenberg` (#1226) chore(noir): Release 0.5.0 (#1202) chore(ci): Utilize new workflow to build binaries (#1250) chore(ssa refactor): Fix loading from mutable parameters (#1248) fix(wasm): add std after dependencies (#1245) chore(ssa refactor): Fix no returns & duplicate main (#1243) chore(ssa refactor): Implement intrinsics (#1241) chore(ssa refactor): Implement first-class functions (#1238) chore: address clippy warnings (#1239) chore(ssa refactor): Implement function calls (#1235) chore(ssa refactor): Implement mutable and immutable variables (#1234) chore(ssa refactor): Fix recursive printing of blocks (#1230) ...
Closing this PR for thin stdlib reasons and it's out of date.. |
Related issue(s)
Resolves #1080
Description
Summary of changes
Simple helper for implementing sparse merkle tree operations in terms of the black box foreign function
check_membership
.Dependency additions / changes
Test additions / changes
Checklist
cargo fmt
with default settings.Documentation needs
Additional context