mirror of
https://github.com/arnaucube/miksi-core.git
synced 2026-02-07 03:26:41 +01:00
Add fixed key leaf by contract
This commit is contained in:
@@ -42,10 +42,10 @@ describe("deposit test", function () {
|
||||
};
|
||||
console.log("siblingsOld", siblingsOld);
|
||||
|
||||
await tree.insert(commitment, 0);
|
||||
await tree.insert(2, commitment);
|
||||
let rootNew = tree.root;
|
||||
|
||||
res = await tree.find(commitment);
|
||||
res = await tree.find(2);
|
||||
// console.log(res);
|
||||
assert(res.found);
|
||||
let siblingsNew = res.siblings;
|
||||
@@ -62,11 +62,13 @@ describe("deposit test", function () {
|
||||
"secret": secret,
|
||||
"nullifier": nullifier,
|
||||
"oldKey": "1",
|
||||
"oldValue": "0",
|
||||
"siblingsOld": siblingsOld,
|
||||
"siblingsNew": siblingsNew,
|
||||
"rootOld": rootOld,
|
||||
"rootNew": rootNew,
|
||||
"commitment": commitment
|
||||
"commitment": commitment,
|
||||
"key": 2
|
||||
});
|
||||
await circuit.checkConstraints(witness);
|
||||
});
|
||||
|
||||
@@ -29,11 +29,11 @@ describe("withdraw test", function () {
|
||||
|
||||
// add commitment into SMT
|
||||
let tree = await smt.newMemEmptyTrie();
|
||||
await tree.insert(commitment, 0);
|
||||
await tree.insert(1, 0);
|
||||
await tree.insert(2, 0);
|
||||
await tree.insert(2, commitment);
|
||||
await tree.insert(3, 0);
|
||||
console.log("root", tree.root);
|
||||
const res = await tree.find(commitment);
|
||||
const res = await tree.find(2);
|
||||
assert(res.found);
|
||||
let siblings = res.siblings;
|
||||
while (siblings.length < nLevels) {
|
||||
@@ -50,7 +50,8 @@ describe("withdraw test", function () {
|
||||
"nullifier": nullifier,
|
||||
"siblings": siblings,
|
||||
"root": root,
|
||||
"address": "987654321"
|
||||
"address": "987654321",
|
||||
"key": 2
|
||||
});
|
||||
await circuit.checkConstraints(witness);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user