-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* LinkedMultiQuery small fixes * Add more linked multi query tests * Improve Linked Multi Query tests * Scaffold verifier integration-test * WIP * Fix getValidatorVerification helpers method * Fix lmk10 groth16 wrapper in constants * Remove console from Verifier.sol
- Loading branch information
1 parent
d952287
commit 43e6e8f
Showing
8 changed files
with
492 additions
and
100 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
contracts/lib/groth16-verifiers/Groth16VerifierLinkedMultiQuery10Wrapper.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// Copyright 2017 Christian Reitwiessner | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
// 2019 OKIMS | ||
// ported to solidity 0.6 | ||
// fixed linter warnings | ||
// added requiere error messages | ||
// | ||
// | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity ^0.8.10; | ||
|
||
import {IGroth16Verifier} from "../../interfaces/IGroth16Verifier.sol"; | ||
import {Groth16VerifierLinkedMultiQuery10} from "./Groth16VerifierLinkedMultiQuery10.sol"; | ||
|
||
contract Groth16VerifierLinkedMultiQuery10Wrapper is | ||
Groth16VerifierLinkedMultiQuery10, | ||
IGroth16Verifier | ||
{ | ||
/** | ||
* @dev Number of public signals for atomic mtp circuit | ||
*/ | ||
uint constant PUBSIGNALS_LENGTH = 22; | ||
|
||
/** | ||
* @dev Verify the circuit with the groth16 proof π=([πa]1,[πb]2,[πc]1). | ||
* @param a πa element of the groth16 proof. | ||
* @param b πb element of the groth16 proof. | ||
* @param c πc element of the groth16 proof. | ||
* @param input Public inputs of the circuit. | ||
* @return r true if the proof is valid. | ||
*/ | ||
function verify( | ||
uint256[2] calldata a, | ||
uint256[2][2] calldata b, | ||
uint256[2] calldata c, | ||
uint256[] calldata input | ||
) public view returns (bool r) { | ||
uint[PUBSIGNALS_LENGTH] memory pubSignals; | ||
|
||
require(input.length == PUBSIGNALS_LENGTH, "expected array length is 22"); | ||
|
||
for (uint256 i = 0; i < PUBSIGNALS_LENGTH; i++) { | ||
pubSignals[i] = input[i]; | ||
} | ||
|
||
return this.verifyProof(a, b, c, pubSignals); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.