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

Update Contracts to use latest dependencies #13

Open
joelamouche opened this issue Nov 13, 2023 · 7 comments
Open

Update Contracts to use latest dependencies #13

joelamouche opened this issue Nov 13, 2023 · 7 comments

Comments

@joelamouche
Copy link

Hi Polygon Decs, congratulations on the new release!

Would it be possible to update contracts repo with the latest versions?

StateV2 doesn't exist in latest version of @iden3/contracts for https://github.com/0xPolygonID/contracts/blob/main/contracts/validators/CredentialAtomicQuerySigValidator.sol

Thanks in advance!

@vmidyllic
Copy link
Contributor

vmidyllic commented Nov 13, 2023

This release 1.1.0 is a tag for production legacy contracts. All further changes will be committed to the main branch and a major version of the example will be released. All fixes to production example contracts (validators) will be made to this tag.

fixed lock file on main branch. You can use main version as example.

latest version 1.3.0 doesn’t contain Statev2, but it’s predicted and we are working on update.

@vmidyllic
Copy link
Contributor

or you can stick to version of 1.1.0 in your branch in case you use have own project.

@joelamouche
Copy link
Author

joelamouche commented Nov 15, 2023

I was able to to do most of the contract updates by replacing by Statev2 with State, etc.
I also had to manually add int256ToAddress that was removed from GenesisUtils.
But now my main problem is how to build the data for the setRequest call.
I have the values for the previous call:

bool res = setZKPRequest(
      requestId,
      validator,
      schema,
      claimPathKey,
      operator,
      value
    );

but not for the new call:
setZKPRequest(requestId, request);

https://github.com/iden3/contracts/blob/master/contracts/verifiers/ZKPVerifier.sol

with request being:

struct ZKPRequest {
string metadata;
ICircuitValidator validator;
bytes data;
}

@vmidyllic
Copy link
Contributor

PR of upgrade to 1.3.2 is here
#12
Documentation will released this week.

@joelamouche
Copy link
Author

Awesome! Looking forward to it. I will take a look if I get the opportunity

@vmidyllic
Copy link
Contributor

Hi @joelamouche, we released a new tutorial and examples
Feel free to ask anything in support channels if you have any problems

Fixed in #17

https://github.com/0xPolygonID/tutorial-examples/tree/main/on-chain-verification
https://devs.polygonid.com/docs/verifier/on-chain-verification/overview/

@joelamouche
Copy link
Author

Hi @vmidyllic
Finally got around to implement this in our code base. Thank you for the work it was very helpful.

BTW I had to rewrite this function to use viem instead of web3 (might be useful to you or other users):

export function packValidatorParams(
  query: OnChainQueryRequest,
  allowedIssuers = [],
) {
  return encodeAbiParameters(
    [
      {
        name: "CredentialAtomicQuery",
        type: "tuple",
        components: [
          { name: "schema", type: "uint256" },
          { name: "claimPathKey", type: "uint256" },
          { name: "operator", type: "uint256" },
          { name: "slotIndex", type: "uint256" },
          { name: "value", type: "uint256[]" },
          { name: "queryHash", type: "uint256" },
          { name: "allowedIssuers", type: "uint256[]" },
          { name: "circuitIds", type: "string[]" },
          { name: "skipClaimRevocationCheck", type: "bool" },
          { name: "claimPathNotExists", type: "uint256" },
        ],
      },
    ],
    [
      {
        schema: BigInt(query.schema),
        claimPathKey: BigInt(query.claimPathKey),
        operator: BigInt(query.operator),
        slotIndex: BigInt(query.slotIndex),
        value: query.value.map((v) => BigInt(v)),
        queryHash: BigInt(query.queryHash),
        allowedIssuers: allowedIssuers,
        circuitIds: query.circuitIds,
        skipClaimRevocationCheck: query.skipClaimRevocationCheck,
        claimPathNotExists: BigInt(query.claimPathNotExists),
      },
    ],
  );
}

Also, I think verifier address in https://github.com/0xPolygonID/tutorial-examples/blob/main/on-chain-verification/scripts/deployValidators.js doesn’t seem to be correct. I had to deploy my own VerifierSigWrapper/VerifierSig for it to work

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

No branches or pull requests

2 participants