mirror of
https://github.com/arnaucube/arbo.git
synced 2026-01-12 08:31:28 +01:00
Add circom test w/ circuit for CircomVerifierProof
Add circom test with circuit for CircomVerifierProofs, which allows to automatically check that the data generated from arbo matches the circom circuit of a SMTVerifierProof. Added also GHA workflow to test the circuits with the output of arbo code.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
include "../../node_modules/circomlib/circuits/comparators.circom";
|
||||
include "../../node_modules/circomlib/circuits/poseidon.circom";
|
||||
include "../../node_modules/circomlib/circuits/smt/smtprocessor.circom";
|
||||
|
||||
template SMTProcessorTest(nLevels) {
|
||||
signal input newKey;
|
||||
signal input newValue;
|
||||
signal private input oldKey;
|
||||
signal private input oldValue;
|
||||
signal private input isOld0;
|
||||
signal private input siblings[nLevels];
|
||||
signal input oldRoot;
|
||||
signal input newRoot;
|
||||
|
||||
component smtProcessor = SMTProcessor(nLevels);
|
||||
smtProcessor.oldRoot <== oldRoot;
|
||||
smtProcessor.newRoot <== newRoot;
|
||||
for (var i=0; i<nLevels; i++) {
|
||||
smtProcessor.siblings[i] <== siblings[i];
|
||||
}
|
||||
smtProcessor.oldKey <== oldKey;
|
||||
smtProcessor.oldValue <== oldValue;
|
||||
smtProcessor.isOld0 <== isOld0;
|
||||
smtProcessor.newKey <== newKey;
|
||||
smtProcessor.newValue <== newValue;
|
||||
smtProcessor.fnc[0] <== 1;
|
||||
smtProcessor.fnc[1] <== 0;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
include "../../node_modules/circomlib/circuits/comparators.circom";
|
||||
include "../../node_modules/circomlib/circuits/poseidon.circom";
|
||||
include "../../node_modules/circomlib/circuits/smt/smtverifier.circom";
|
||||
|
||||
template SMTVerifierTest(nLevels) {
|
||||
signal input key;
|
||||
signal input value;
|
||||
signal input fnc;
|
||||
signal private input oldKey;
|
||||
signal private input oldValue;
|
||||
signal private input isOld0;
|
||||
signal private input siblings[nLevels];
|
||||
signal input root;
|
||||
|
||||
component smtV = SMTVerifier(nLevels);
|
||||
smtV.enabled <== 1;
|
||||
smtV.fnc <== fnc;
|
||||
smtV.root <== root;
|
||||
for (var i=0; i<nLevels; i++) {
|
||||
smtV.siblings[i] <== siblings[i];
|
||||
}
|
||||
smtV.oldKey <== oldKey;
|
||||
smtV.oldValue <== oldValue;
|
||||
smtV.isOld0 <== isOld0;
|
||||
smtV.key <== key;
|
||||
smtV.value <== value;
|
||||
}
|
||||
Reference in New Issue
Block a user