Skip to content

Commit

Permalink
getZKPRequests virtual, override with revert
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Nov 11, 2024
1 parent 6bc10f6 commit c263406
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
11 changes: 11 additions & 0 deletions contracts/verifiers/UniversalVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ contract UniversalVerifier is
_setState(state);
}

/// @dev Gets multiple ZKP requests within a range (disabled in this contract)
/// @param startIndex The starting index of the range
/// @param length The length of the range
/// @return An array of ZKP requests within the specified range
function getZKPRequests(
uint256 startIndex,
uint256 length
) public view override returns (IZKPVerifier.ZKPRequest[] memory) {
revert("Not implemented in this version");
}

/// @dev Sets ZKP Request Owner address
/// @param requestId The ID of the ZKP request
/// @param requestOwner ZKP Request Owner address
Expand Down
18 changes: 16 additions & 2 deletions contracts/verifiers/ZKPVerifierBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,22 @@ abstract contract ZKPVerifierBase is IZKPVerifier, ContextUpgradeable {
function getZKPRequests(
uint256 startIndex,
uint256 length
) public view returns (IZKPVerifier.ZKPRequest[] memory) {
revert("Not implemented in this version");
) public view virtual returns (IZKPVerifier.ZKPRequest[] memory) {
ZKPVerifierStorage storage s = _getZKPVerifierStorage();
(uint256 start, uint256 end) = ArrayUtils.calculateBounds(
s._requestIds.length,
startIndex,
length,
REQUESTS_RETURN_LIMIT
);

IZKPVerifier.ZKPRequest[] memory result = new IZKPVerifier.ZKPRequest[](end - start);

for (uint256 i = start; i < end; i++) {
result[i - start] = s._requests[s._requestIds[i]];
}

return result;
}

/// @dev Checks if proof submitted for a given sender and request ID
Expand Down

0 comments on commit c263406

Please sign in to comment.