add nItems var, fixes CVF-30

This commit is contained in:
poma 2021-03-19 23:04:43 +03:00
parent 73b9369abc
commit e8954ec6ce
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

View File

@ -4,11 +4,12 @@ include "./MerkleTreeUpdater.circom";
include "./Utils.circom"; include "./Utils.circom";
template TreeLayer(height) { template TreeLayer(height) {
signal input ins[1 << (height + 1)]; var nItems = 1 << height;
signal output outs[1 << height]; signal input ins[nItems * 2];
signal output outs[nItems];
component hash[1 << height]; component hash[nItems];
for(var i = 0; i < (1 << height); i++) { for(var i = 0; i < nItems; i++) {
hash[i] = HashLeftRight(); hash[i] = HashLeftRight();
hash[i].left <== ins[i * 2]; hash[i].left <== ins[i * 2];
hash[i].right <== ins[i * 2 + 1]; hash[i].right <== ins[i * 2 + 1];