Skip to content

Update Contracts to use latest dependencies #13

Open

Description

@joelamouche

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!

Activity

  1. vmidyllic commented on Nov 13, 2023

    @vmidyllic
    Contributor

    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.

  2. vmidyllic commented on Nov 13, 2023

    @vmidyllic
    Contributor

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

  3. joelamouche commented on Nov 15, 2023

    @joelamouche
    Author

    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;
    }

  4. vmidyllic commented on Nov 20, 2023

    @vmidyllic
    Contributor

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

  5. joelamouche commented on Nov 20, 2023

    @joelamouche
    Author

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

  6. vmidyllic commented on Nov 21, 2023

    @vmidyllic
    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/

  7. joelamouche commented on Dec 12, 2023

    @joelamouche
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions