fix membership checker with correct indexes

This commit is contained in:
thomaslavaur 2024-07-24 08:13:34 +02:00
parent ca2ff45255
commit cbb0359ad9
4 changed files with 8 additions and 8 deletions

View File

@ -207,8 +207,8 @@ template membership_checker(){
hash[0].in[1] <== node[0] - index[31] * (node[0] - leaf);
for(var i=1; i<32; i++){
hash[i].in[0] <== hash[i-1].out - index[31] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31] * (node[i] - hash[i-1].out);
hash[i].in[0] <== hash[i-1].out - index[31-i] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31-i] * (node[i] - hash[i-1].out);
}
root === hash[31].out;

View File

@ -223,8 +223,8 @@ template membership_checker(){
hash[0].in[1] <== node[0] - index[31] * (node[0] - leaf);
for(var i=1; i<32; i++){
hash[i].in[0] <== hash[i-1].out - index[31] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31] * (node[i] - hash[i-1].out);
hash[i].in[0] <== hash[i-1].out - index[31-i] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31-i] * (node[i] - hash[i-1].out);
}
root === hash[31].out;

View File

@ -207,8 +207,8 @@ template membership_checker(){
hash[0].in[1] <== node[0] - index[31] * (node[0] - leaf);
for(var i=1; i<32; i++){
hash[i].in[0] <== hash[i-1].out - index[31] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31] * (node[i] - hash[i-1].out);
hash[i].in[0] <== hash[i-1].out - index[31-i] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31-i] * (node[i] - hash[i-1].out);
}
root === hash[31].out;

View File

@ -224,8 +224,8 @@ template membership_checker(){
hash[0].in[1] <== node[0] - index[31] * (node[0] - leaf);
for(var i=1; i<32; i++){
hash[i].in[0] <== hash[i-1].out - index[31] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31] * (node[i] - hash[i-1].out);
hash[i].in[0] <== hash[i-1].out - index[31-i] * (hash[i-1].out - node[i]);
hash[i].in[1] <== node[i] - index[31-i] * (node[i] - hash[i-1].out);
}
//root === hash[31].out;