You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a balance in the middle is not equal to 0, it breaks the range check of its subsequent balance. For example, in the above test case, it breaks two equations that user1 balance1 zs[3] is 1.
A prover should not expect the test errors to include the whole overflow list. Certainly the real proof verification just shows pass or fail unlike MockProver in tests. However, the test gives so confusing a result that we clarify.
The text was updated successfully, but these errors were encountered:
participants: qpzm, pia
Description
This test data has two entries which exceed 2^64 -1.
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/csv/entry_16_overflow.csv
The test result, however, shows 4 balances break the range check. For example, user2 balance0 is zero, but the test error contains "Perform range check on balance 0 of user 2".
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/prover/src/circuits/tests.rs#L453-L484
Cause
The range check chip has 3 constraints.
https://github.com/summa-dev/summa-solvency/blob/v2/fec83a747ead213261aecfaf4a01b43fff9731ee/src/chips/range/range_check.rs#L63-L72
The third one constrains that
zs[3]
must be equal to the public instance column.https://github.com/summa-dev/summa-solvency/blob/v2/fec83a747ead213261aecfaf4a01b43fff9731ee/src/circuits/univariate_grand_sum.rs#L165
In tests, it is 0.
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/prover/src/circuits/tests.rs#L451
In
Summa.sol
, it is also 0.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/Summa.sol#L242
Therefore, all balances are constrained that
zs[3] == 0
through this chained constraints.If a balance in the middle is not equal to 0, it breaks the range check of its subsequent balance. For example, in the above test case, it breaks two equations that user1 balance1 zs[3] is 1.
Case1
Only one balance of user is out of range, but two error occurs. This is the case I mentioned before.
https://github.com/rkdud007/summa-solvency/blob/permute-overflow-poc/prover/src/circuits/tests.rs#L438
These are two constraints that break.
https://github.com/rkdud007/summa-solvency/blob/permute-overflow-poc/prover/src/circuits/tests.rs#L454-L473
Case2
In this test, there are two overflows: balance0 and balance1 of user1.
The test gives two errors: balance 0 of user 1, balance 0 of user 2 because these two constraints that break.
https://github.com/rkdud007/summa-solvency/blob/permute-overflow-poc/prover/src/circuits/tests.rs#L477
Case3
In this test, there are 4 overflows.
https://github.com/rkdud007/summa-solvency/blob/permute-overflow-poc/csv/entry_16_overflow_case_3.csv
However, only two overflow error comes.
https://github.com/rkdud007/summa-solvency/blob/permute-overflow-poc/prover/src/circuits/tests.rs#L517
Expected behavior
A prover should not expect the test errors to include the whole overflow list. Certainly the real proof verification just shows pass or fail unlike
MockProver
in tests. However, the test gives so confusing a result that we clarify.The text was updated successfully, but these errors were encountered: