We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GrandSumVerifier
GrandSumVerifier.verifyProof is not a view function. https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L32
GrandSumVerifier.verifyProof
This is a generated type in contracts/typechain-types/src/GrandSumVerifier.ts when running tests.
contracts/typechain-types/src/GrandSumVerifier.ts
verifyProof( vk: PromiseOrValue<string>, proof: PromiseOrValue<BytesLike>, values: PromiseOrValue<BigNumberish>[], overrides?: Overrides & { from?: PromiseOrValue<string> } ): Promise<ContractTransaction>;
It does not return the bool value that GrandSumVerifier.verifyProof returns so the test just checks whether the function is not reverted. However, the function does not revert when I change the input total_balances. https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
total_balances
Change total_balances to random values and then run npx hardhat test. https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/prover/bin/commitment_solidity_calldata.json#L5-L6
npx hardhat test
{ "range_check_snark_proof": "...", "grand_sums_batch_proof": "...", "total_balances": [ "0x1087f3e0000000000000", "0x197f3000000000000000" ] }
In Verifier.ts, GrandSum Proof Verifier > should verify grand sum proof test passes. https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
Verifier.ts
GrandSum Proof Verifier > should verify grand sum proof
- ) public returns (bool) { + ) public view returns (bool) {
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L32
- expect(await grandSumVerifier.verifyProof(verifyingKey.address, proofs, totalBalances)).to.be.not.reverted; + expect(await grandSumVerifier.verifyProof(verifyingKey.address, proofs, totalBalances)).to.be.true;
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
InclusionVerifier.sol
success := ec_add_tmp(success, lhs_x, lhs_y) + if iszero(success) { + revert(0, 0) + }
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L143-L144
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
GrandSumVerifier.verifyProof
is not a view function.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L32
This is a generated type in
contracts/typechain-types/src/GrandSumVerifier.ts
when running tests.It does not return the bool value that
GrandSumVerifier.verifyProof
returns so the test just checks whether the function is not reverted. However, the function does not revert when I change the inputtotal_balances
.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
POC
Change
total_balances
to random values and then runnpx hardhat test
.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/prover/bin/commitment_solidity_calldata.json#L5-L6
In
Verifier.ts
,GrandSum Proof Verifier > should verify grand sum proof
test passes.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
Fix
GrandSumVerifier.verifyProof
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L32
https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/test/Verifiers.ts#L96
InclusionVerifier.sol
.https://github.com/summa-dev/summa-solvency/blob/fec83a747ead213261aecfaf4a01b43fff9731ee/contracts/src/GrandSumVerifier.sol#L143-L144
The text was updated successfully, but these errors were encountered: