Sum proof
Maru volume sum proof via zk-STARKs enables efficient verification of any volume trades from a remote pools.
To prove volume of pool trades we need to add each value of sold token volume in receipts and prove that counted volume is correct. For this purpose we create SumStark using constraints and cross table lookups tables from SumStark and ArithmeticStark to prove correctness of each arithmetic addition of 256 bits elements.
Circuit
Private inputs include data fields about each value of acummulated sum.
In execution trace we use such fields:
IS_INPUTindicates where in row the initial value of accumulated sum.IS_OUTPUTindicates where in row the output of accumulated sum from previous operation will be as the operand in current row.IS_RESULTindicates the last value of accumulated sum of ChainResult operationsACUM_SUMconsists of 16 limbs that represent each 16 bit per column.IS_PUBLICindicates where in row the public value of accumulated sum.NOT_INITindicates where the first zero init value.VALUEindicates initial volume to be multiplied.MULTIPLIERis used to multiply the value to a consistent format, specifically, 18 digits after the decimal point.MULT_RESULTindicates result of multiplication.TOKEN_IDindicates the ID of the token with the specified volume value.CALCULATION_IDindicates the ID of volume summation.
Constraints
The Sum Stark aims at constraining the following aspects:
IS_INPUTandIS_OUTPUTcan be in range of {0, 1}
The main idea of proving relies on CTL, where we build two function for CTL:
ctl_previous_sum_equal_op1()prove that previous accumulated sum used as second operand in arithmetic operation.ctl_acum_equals_result()guarantees that acum sum columns have the exact values as result columns in arithmetic table.ctl_mult_value()ensures thatVALUE,MULTIPLIER,MULT_RESULTcolumns contain the exact values in the Arithmetic STARK, where we prove the multiplication.ctl_volume_value()ensures thatVALUEandCALCULATION_IDcolumns contain the exact values in the Data Stark.ctl_token_id()ensures thatTOKEN_IDandCALCULATION_IDcolumns contain the exact values in the Data Stark.
Last updated