DataVerifier
Last updated
Last updated
The DataVerifier
circuit is a s circuit is responsible for verifying certain constraints over the provided data and returning hash values for further usage.
The circuit is defined with two parameters:
tLevel: Total number of data entries.
nLevel: Number of data entries with constraints.
The circuit takes in the following input signals:
data: An array of tLevel + nLevel
size, which contains the data entries that the circuit will process.
code: An array of tLevel + nLevel
size, which serves as a form of mask for the data.
constraint_upper: An array of nLevel
size, which specifies the upper bound for the respective data entry.
constraint_lower: An array of nLevel
size, which specifies the lower bound for the respective data entry.
The circuit produces two output signals:
idHash: A 2-element array which holds the hash of the data
input signal.
constraintHash: A 2-element array which holds the hash of the data entries with constraints.
comp_upper: An array of GreaterEqThan
components of nLevel
size that checks if each constrained data entry is greater or equal to its respective upper constraint.
comp_lower: An array of LessEqThan
components of nLevel
size that checks if each constrained data entry is less or equal to its respective lower constraint.
hasher: A Pedersen
hashing component that hashes the data
input signal.
chasher: A Pedersen
hashing component that hashes the data entries with constraints.
The circuit makes use of the comparators
and pedersen
circuits from the circomlib
library.
A variable bitSize
is declared and initialized with 36
. This bitSize is the maximum bit length of data the GreaterEqThan
and LessEqThan
components can handle.