-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
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
Full Multi-query support onchain #321
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 12953945580Details
💛 - Coveralls |
b70f050
to
a02592c
Compare
5237dec
to
822c81c
Compare
…and validatorWhitelist
7819a0b
to
e2109e6
Compare
contracts/interfaces/IVerifier.sol
Outdated
/** | ||
* @dev IVerifier. Interface for verification of groth16 proofs. | ||
* @dev IVerifier. Interface for verification of groth16 proofs for validators circuits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is wrong in speaking about groth16
contracts/interfaces/IVerifier.sol
Outdated
IRequestValidator validator; | ||
bytes params; | ||
address creator; | ||
uint256 verifierId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering latest discussions, it doesn't seem we'll use the verifierId field anytime soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed from RequestData
and RequestInfo
contracts/interfaces/IVerifier.sol
Outdated
* @param proof proof to verify. | ||
*/ | ||
struct AuthResponse { | ||
string authType; //zkp-auth-v2, zkp-auth-v3, etc. will deside later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please remove "will deside later" ? :)
struct AuthType { | ||
string authType; | ||
IAuthValidator validator; | ||
bytes params; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NatSpec is missing
contracts/interfaces/IVerifier.sol
Outdated
/** | ||
* @dev Get the group of requests. | ||
* @return Group of requests. | ||
*/ | ||
function getGroupedRequests(uint256 groupID) external view returns (uint256[] memory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That may be more practical to return RequestInfo[]
rather than uint256[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure
IVerifier verifier = getVerifierByCircuitId(CIRCUIT_ID); | ||
require(verifier != IVerifier(address(0)), "Verifier address should not be zero"); | ||
IGroth16Verifier verifier = getVerifierByCircuitId(CIRCUIT_ID); | ||
require(verifier != IGroth16Verifier(address(0)), "Verifier address should not be zero"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better something like g16verifier as a var name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed also other contracts var names following the same rule.
/// @dev Main storage structure for the contract | ||
/// @custom:storage-location iden3.storage.EthIdentityValidator | ||
struct EthIdentityValidatorBaseStorage { | ||
IState state; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IState state;
can be removed as it is not used. So may be no storage at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using state
in the internal function _verifyEthIdentity
. So we can't removed it.
function _getRequestIfCanBeVerified( | ||
uint64 requestId | ||
uint256 requestId | ||
) | ||
internal | ||
view | ||
override(RequestDisableable, ValidatorWhitelist, ZKPVerifierBase) | ||
override(RequestDisableable, ValidatorWhitelist, Verifier) | ||
onlyEnabledRequest(requestId) | ||
returns (IZKPVerifier.ZKPRequest storage) | ||
returns (IVerifier.RequestData storage) | ||
{ | ||
return super._getRequestIfCanBeVerified(requestId); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not missing something, you don't need the onlyEnabledRequest(requestId) modifier at Universal Verifier level. You anyway have it at RequestDisableable level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so. Removed the onlyEnabledRequest(requestId)
at UniversalVerifier.sol level.
contracts/verifiers/Verifier.sol
Outdated
struct UserAddressToIdInfo { | ||
uint256 userID; | ||
uint256 timestamp; | ||
} | ||
|
||
struct UserIdToAddressInfo { | ||
address userAddress; | ||
uint256 timestamp; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two structs are not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
contracts/verifiers/Verifier.sol
Outdated
function _setRequestWithChecks( | ||
Request calldata request | ||
) | ||
internal | ||
checkRequestExistence(request.requestId, false) | ||
checkRequestGroupExistence(request, false) | ||
{ | ||
_setRequest(request); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkRequestExistence
looks like duplicated in one of the flows that use this method.
Besides checkRequestGroupExistence
is used only here and _setRequestWithChecks
is used in one place only. So maybe remove _setRequestWithChecks
method at all and reorganise the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was old code from previous versions. Reorganized.
fd814c2
to
d952287
Compare
* 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
539badf
to
b18c064
Compare
c98bf44
to
109f3f8
Compare
5256217
to
a64341a
Compare
Implement multi-query support similar to existing requests now in Universal Verifier.
Query
) independently and in the same way we are managing Requests in ZKPVerifierBase now (setQuery, getQuery, …). Avoid ZKP and generalize methods in Requests. setRequest, getRequest, submitResponse, …address user
touint256 userID
to keep identifier of the user.userAddress
anduserID
. In this first version 1 userID will have only 1 address? Review best approach or if we have to keep an array of addresses.linkID
between the Requests and Auth of the sameQuery
.uint64
touint256
.Link to Tech Spec for changes: https://www.notion.so/privado-id/Multi-query-Tech-Spec-13d4f86a875180e68fc8e3fa5362805e