You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Nargo 1.0.0 beta fails to compile merkle tree example. This is problematic because the 1.0.0 beta is the default version installed by noirup. This problem can be avoided by running noirup -v 0.39.0
To Reproduce
Install the latest noir version using the quick-start instructions. Take the demo code from the merkle trees package and attempt to compile.
Expected behavior
Circuit compiles.
Screenshots
Error output
error: expected type SparseMerkleTree<T>, found type ()
┌─ /Users/chance/nargo/github.com/privacy-scaling-explorations/zk-kit.noir/main/packages/merkle-trees/src/types.nr:7:12
│
7 │ pub fn default(root: T, leaf_hasher: fn([T; 3]) -> T, hasher: fn([T; 2]) -> T) -> Self {}
│ ------- ---- expected SparseMerkleTree<T> because of return type
│ │
│ () returned here
│
= implicitly returns `()` as its body has no tail or `return` expression
error: Expected type fn([Field; 3]) -> Field, found type fn([T; 3]) -> T
┌─ /Users/chance/nargo/github.com/privacy-scaling-explorations/zk-kit.noir/main/packages/merkle-trees/src/types.nr:23:23
│
23 │ Self::from(0, leaf_hasher, hasher)
│ -----------
│
error: Expected type fn([Field; 2]) -> Field, found type fn([T; 2]) -> T
┌─ /Users/chance/nargo/github.com/privacy-scaling-explorations/zk-kit.noir/main/packages/merkle-trees/src/types.nr:23:36
│
23 │ Self::from(0, leaf_hasher, hasher)
│ ------
│
error: Only struct types can be used in constructor expressions
┌─ /Users/chance/nargo/github.com/privacy-scaling-explorations/zk-kit.noir/main/packages/merkle-trees/src/types.nr:29:9
│
29 │ Self { root, hasher }
│ ---- _ has no fields to construct it with
│
error: Could not resolve 'T' in path
┌─ /Users/chance/nargo/github.com/privacy-scaling-explorations/zk-kit.noir/main/packages/merkle-trees/src/types.nr:46:20
│
46 │ Self::from(T::default(), hasher)
│ -
│
Aborting due to 5 previous errors
main.nr:
use trees::merkle::MerkleTree;
use std::hash::poseidon;
use trees::types::MT_Creator;
use trees::types::Modifier;
fn main(entry: Field, paths: [Field; 0]) -> pub Field {
let mut mt = MerkleTree::new(poseidon::bn254::hash_2);
mt.add(entry, 0, paths);
//mt.membership(entry, 0, paths);
0
}
#[test]
fn test_main() {
//let _ = main(1, 2);
// Uncomment to make test fail
// main(1, 1);
}
Technologies (please complete the following information):
nargo --version
nargo version = 1.0.0-beta.2
noirc version = 1.0.0-beta.2+1a2a08cbcb68646ff1aaef383cfc1798933c1355
(git version hash: 1a2a08cbcb68646ff1aaef383cfc1798933c1355, is dirty: false)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
Nargo 1.0.0 beta fails to compile merkle tree example. This is problematic because the 1.0.0 beta is the default version installed by noirup. This problem can be avoided by running
noirup -v 0.39.0
To Reproduce
Install the latest noir version using the quick-start instructions. Take the demo code from the merkle trees package and attempt to compile.
Expected behavior
Circuit compiles.
Screenshots
Error output
main.nr
:Technologies (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: