-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64284ff
commit 66fe34e
Showing
4 changed files
with
177 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.8.27; | ||
|
||
import {ZKPVerifierBase} from "../verifiers/ZKPVerifierBase.sol"; | ||
import {ICircuitValidator} from "../interfaces/ICircuitValidator.sol"; | ||
|
||
/** | ||
* @title VerifierLib | ||
* @dev A library for writing proof results. | ||
*/ | ||
library VerifierLibReqType1 { | ||
function writeProofResults( | ||
ZKPVerifierBase.ZKPVerifierStorageProofType1 storage self, | ||
address sender, | ||
uint256 requestId, | ||
ICircuitValidator.Signal[] memory signals | ||
) public { | ||
|
||
// TODO COMPLETE THE METHOD IMPLEMENTATION | ||
|
||
ZKPVerifierBase.ProofReqType1[] storage proofs = self._proofs[sender][requestId]; | ||
|
||
uint256 issuerId; | ||
for (uint256 i = 0; i < signals.length; i++) { | ||
if (signals[i].name == "issuerId") { | ||
issuerId = signals[i].value; | ||
} | ||
} | ||
require(issuerId != 0, "Issuer ID not found in the signals"); | ||
|
||
// TODO research if pushing elements with mapping would work here | ||
// without throwing exceptions in compilator | ||
proofs.push(ProofReqType1{ | ||
isVerified: true, | ||
validatorVersion: self._requests[requestId].validator.version(), | ||
blockTimestamp: block.timestamp | ||
}); | ||
|
||
ZKPVerifierBase.ProofReqType1 storage proof = proofs[proofs.length - 1]; | ||
|
||
for (uint256 i = 0; i < signals.length; i++) { | ||
proof.storageFields[signals[i].name] = signals[i].value; | ||
if (signals[i].name == "issuerId") { | ||
issuerId = signals[i].value; | ||
} | ||
} | ||
|
||
// TODO need to incapusulate this in a function maybe | ||
// as we dong user proofs.length - 1 to avoid 1 proof position ambiguity | ||
self._indexInProofs[sender][requestId][issuerId] = proofs.length; | ||
} | ||
} |
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