Skip to content
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

Draft
wants to merge 61 commits into
base: master
Choose a base branch
from

Conversation

daveroga
Copy link
Contributor

@daveroga daveroga commented Dec 3, 2024

Implement multi-query support similar to existing requests now in Universal Verifier.

  • Manage multi-query (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, …
  • Change _proofs mapping from address user to uint256 userID to keep identifier of the user.
  • Create 2 mappings for managing link between userAddress and userID . In this first version 1 userID will have only 1 address? Review best approach or if we have to keep an array of addresses.
mapping(address userAddress => uint256 userID) _user_address_to_id;
mapping(unit256 userID => address userAddress) _id_to_user_address; // check address[] ?
  • Manage Auth in specific type of requests. Auth requests.
requestId. 32 bytes (in Big Endian): 31-0x00(not used), 30-0x01(requestType), 29..0 hash calculated Id,

For requestType:
   - 0x00 - regular request
   - 0x01 - auth request
  • Define challenge based on the ethereum address in this first version
  • Figure out linkID between the Requests and Auth of the same Query.
  • Consider that more than one type of auth may be available there for specific multiRequest. And each of the multiRequests should define it’s own set of valid auth along with requests.
  • RequestId change from uint64 to uint256.

Link to Tech Spec for changes: https://www.notion.so/privado-id/Multi-query-Tech-Spec-13d4f86a875180e68fc8e3fa5362805e

@coveralls
Copy link

coveralls commented Dec 3, 2024

Pull Request Test Coverage Report for Build 12715993929

Details

  • 208 of 260 (80.0%) changed or added relevant lines in 12 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-1.5%) to 82.517%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/validators/CredentialAtomicQueryV3Validator.sol 13 14 92.86%
contracts/verifiers/ValidatorWhitelist.sol 8 9 88.89%
contracts/validators/AuthV2Validator.sol 0 7 0.0%
contracts/verifiers/EmbeddedVerifier.sol 0 7 0.0%
contracts/validators/EthIdentityValidator.sol 0 13 0.0%
contracts/verifiers/Verifier.sol 155 178 87.08%
Files with Coverage Reduction New Missed Lines %
contracts/validators/AuthV2Validator.sol 1 0.0%
contracts/validators/CredentialAtomicQueryValidatorBase.sol 1 76.39%
Totals Coverage Status
Change from base Build 12413543528: -1.5%
Covered Lines: 1093
Relevant Lines: 1237

💛 - Coveralls

@daveroga daveroga force-pushed the PID-2709-full-multi-query-support-on-chain branch from b70f050 to a02592c Compare December 5, 2024 11:33
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifierMultiQuery.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@AndriianChestnykh AndriianChestnykh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't completed review of all the files. However, these feedback is what I have now.

contracts/interfaces/IRequestValidator.sol Outdated Show resolved Hide resolved
contracts/interfaces/IRequestValidator.sol Outdated Show resolved Hide resolved
contracts/interfaces/IVerifier.sol Outdated Show resolved Hide resolved
contracts/lib/VerifierLib.sol Outdated Show resolved Hide resolved
contracts/lib/VerifierLib.sol Show resolved Hide resolved
contracts/verifiers/RequestOwnership.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifier.sol Outdated Show resolved Hide resolved
contracts/verifiers/UniversalVerifier.sol Outdated Show resolved Hide resolved
contracts/verifiers/ValidatorWhitelist.sol Outdated Show resolved Hide resolved
contracts/verifiers/ZKPVerifier.sol Outdated Show resolved Hide resolved
Comment on lines 240 to 243
function getProofStatus(
address sender,
uint256 requestId
) external view returns (ProofStatus memory);
Copy link
Collaborator

@AndriianChestnykh AndriianChestnykh Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add getMultiRequestStatus(), I think

* @param userID The user id of the user
* @return status The status of the multiRequest. "True" if all requests are verified, "false" otherwise
*/
function getMultiRequestStatus(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this method, and it doesn't even work properly anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

* @param name Name of the response field
* @param value Value of the response field
*/
struct ResponseField {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we agreed, we don't need this struct in IAuthValidator

bytes calldata params,
address sender,
IState state
) external returns (ResponseField[] memory);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return bool, as agreed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will return uint256 userID as agreed.

Comment on lines 61 to 62
// Whitelisted validators
mapping(IRequestValidator => bool isApproved) _validatorWhitelist;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitelisted validators mapping seem not to me used. The other mapping in the ValidatorWhitelist contract seem to be used.
If that's true than it can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants