├── .eslintrc.js ├── .github └── workflows │ ├── main.yml │ ├── npm-publish.yml │ └── security-ci.yml ├── .gitignore ├── .openzeppelin ├── polygon-mumbai.json ├── polygon.json ├── sepolia.json ├── unknown-1101.json ├── unknown-21000.json ├── unknown-21001.json ├── unknown-2442.json ├── unknown-59141.json ├── unknown-59144.json ├── unknown-6913.json └── unknown-80002.json ├── .prettierignore ├── .prettierrc ├── .solcover.js ├── .solhint.json ├── .solhintignore ├── LICENSE ├── README.md ├── SECURITY.md ├── contracts ├── AlwaysRevert.sol ├── Create2AddressAnchor.sol ├── cross-chain │ └── CrossChainProofValidator.sol ├── identitytreestore │ └── IdentityTreeStore.sol ├── imports.sol ├── interfaces │ ├── IAuthValidator.sol │ ├── ICrossChainProofValidator.sol │ ├── IGroth16Verifier.sol │ ├── IIdentifiable.sol │ ├── INonMerklizedIssuer.sol │ ├── IOnchainCredentialStatusResolver.sol │ ├── IRHSStorage.sol │ ├── IRequestValidator.sol │ ├── IState.sol │ ├── IStateTransitionVerifier.sol │ └── IVerifier.sol ├── lib │ ├── ArrayUtils.sol │ ├── ClaimBuilder.sol │ ├── GenesisUtils.sol │ ├── IdentityBase.sol │ ├── IdentityLib.sol │ ├── NonMerklizedIssuerBase.sol │ ├── Poseidon.sol │ ├── PrimitiveTypeUtils.sol │ ├── ReverseHashLib.sol │ ├── SmtLib.sol │ ├── StateLib.sol │ ├── VerifierLib.sol │ └── groth16-verifiers │ │ ├── Groth16VerifierAuthV2.sol │ │ ├── Groth16VerifierAuthV2Wrapper.sol │ │ ├── Groth16VerifierLinkedMultiQuery10.sol │ │ ├── Groth16VerifierLinkedMultiQuery10Wrapper.sol │ │ ├── Groth16VerifierMTP.sol │ │ ├── Groth16VerifierMTPWrapper.sol │ │ ├── Groth16VerifierSig.sol │ │ ├── Groth16VerifierSigWrapper.sol │ │ ├── Groth16VerifierStateTransition.sol │ │ ├── Groth16VerifierV3.sol │ │ └── Groth16VerifierV3Wrapper.sol ├── package-lock.json ├── package.json ├── payment │ ├── MCPayment.sol │ └── VCPayment.sol ├── state │ ├── README.md │ └── State.sol ├── test-helpers │ ├── AuthValidatorStub.sol │ ├── BinarySearchTestWrapper.sol │ ├── ClaimBuilderWrapper.sol │ ├── ERC20PermitToken.sol │ ├── ERC20Token.sol │ ├── EmbeddedVerifierWrapper.sol │ ├── GenesisUtilsWrapper.sol │ ├── Groth16VerifierStub.sol │ ├── Groth16VerifierValidatorStub.sol │ ├── IdentityExample.sol │ ├── PrimitiveTypeUtilsWrapper.sol │ ├── RequestDisableableTestWrapper.sol │ ├── RequestOwnershipTestWrapper.sol │ ├── RequestValidatorStub.sol │ ├── ReverseHashWrapper.sol │ ├── SmtLibTestWrapper.sol │ ├── StateLibTestWrapper.sol │ ├── UniversalVerifierTestWrapper_ManyResponsesPerUserAndRequest.sol │ ├── ValidatorWhitelistTestWrapper.sol │ └── VerifierTestWrapper.sol ├── validators │ ├── auth │ │ ├── AuthV2Validator.sol │ │ └── EthIdentityValidator.sol │ └── request │ │ ├── CredentialAtomicQueryMTPV2Validator.sol │ │ ├── CredentialAtomicQuerySigV2Validator.sol │ │ ├── CredentialAtomicQueryV2ValidatorBase.sol │ │ ├── CredentialAtomicQueryV3Validator.sol │ │ ├── CredentialAtomicQueryValidatorBase.sol │ │ ├── LinkedMultiQueryValidator.sol │ │ └── RequestValidatorBase.sol └── verifiers │ ├── EmbeddedVerifier.sol │ ├── RequestDisableable.sol │ ├── RequestOwnership.sol │ ├── UniversalVerifier.sol │ ├── ValidatorWhitelist.sol │ └── Verifier.sol ├── hardhat.config.ts ├── helpers ├── ContractMigrationSteps.ts ├── DeployHelper.ts ├── OnchainIdentityDeployHelper.ts ├── PoseidonDeployHelper.ts ├── StateContractMigrationHelper.ts ├── UniversalVerifierContractMigrationHelper.ts ├── constants.ts └── helperUtils.ts ├── ignition ├── deployments │ ├── chain-1 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-1101 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-11155111 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-137 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-21000 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-21001 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-2442 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-59141 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-59144 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ ├── chain-6913 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl │ └── chain-80002 │ │ ├── deployed_addresses.json │ │ └── journal.jsonl ├── index.ts └── modules │ ├── authV2Validator.ts │ ├── create2AddressAnchor.ts │ ├── credentialAtomicQueryMTPV2Validator.ts │ ├── credentialAtomicQuerySigV2Validator.ts │ ├── credentialAtomicQueryV3Validator.ts │ ├── ethIdentityValidator.ts │ ├── identityTreeStore.ts │ ├── libraries.ts │ ├── linkedMultiQuery.ts │ ├── mcPayment.ts │ ├── state.ts │ ├── universalVerifier.ts │ └── vcPayment.ts ├── packDemo.ts ├── package-lock.json ├── package.json ├── patches ├── @nomicfoundation+hardhat-ledger+1.0.3.patch └── README.md ├── scripts ├── deploy │ ├── deployCreate2AddressAnchor.ts │ ├── deployCreateX.ts │ ├── deployIdentityExample.ts │ ├── deployIdentityTreeStore.ts │ ├── deployLibraries.ts │ ├── deployMCPayment.ts │ ├── deployPoseidon.ts │ ├── deployState.ts │ ├── deployUniversalVerifier.ts │ ├── deployVCPayment.ts │ └── deployValidators.ts ├── deployments_output │ ├── deploy_cross_chain_verification_with_requests_output_1101_zkevm.json │ ├── deploy_cross_chain_verification_with_requests_output_21000_privado-main.json │ ├── deploy_cross_chain_verification_with_requests_output_2442_cardona.json │ ├── deploy_cross_chain_verification_with_requests_output_59141_linea-sepolia.json │ ├── deploy_cross_chain_verification_with_requests_output_80002_amoy.json │ ├── deploy_identity_tree_store_output_1101_zkevm-mainnet.json │ ├── deploy_identity_tree_store_output_11155111_ethereum-sepolia.json │ ├── deploy_identity_tree_store_output_137_polygon-mainnet.json │ ├── deploy_identity_tree_store_output_1_ethereum-mainnet.json │ ├── deploy_identity_tree_store_output_21000_privado-main.json │ ├── deploy_identity_tree_store_output_21001_privado-test.json │ ├── deploy_identity_tree_store_output_2442_zkevm-cardona.json │ ├── deploy_identity_tree_store_output_59141_linea-sepolia.json │ ├── deploy_identity_tree_store_output_59144_linea-mainnet.json │ ├── deploy_identity_tree_store_output_80002_polygon-amoy.json │ ├── deploy_libraries_output_1101_zkevm-mainnet.json │ ├── deploy_libraries_output_11155111_ethereum-sepolia.json │ ├── deploy_libraries_output_137_polygon-mainnet.json │ ├── deploy_libraries_output_1_ethereum-mainnet.json │ ├── deploy_libraries_output_21000_privado-main.json │ ├── deploy_libraries_output_21001_privado-test.json │ ├── deploy_libraries_output_2442_zkevm-cardona.json │ ├── deploy_libraries_output_59141_linea-sepolia.json │ ├── deploy_libraries_output_59144_linea-mainnet.json │ ├── deploy_libraries_output_6913_billions-test.json │ ├── deploy_libraries_output_80002_polygon-amoy.json │ ├── deploy_mc_payment_output_1101_zkevm-mainnet.json │ ├── deploy_mc_payment_output_11155111_ethereum-sepolia.json │ ├── deploy_mc_payment_output_137_polygon-mainnet.json │ ├── deploy_mc_payment_output_1_ethereum-mainnet.json │ ├── deploy_mc_payment_output_2442_zkevm-cardona.json │ ├── deploy_mc_payment_output_59141_linea-sepolia.json │ ├── deploy_mc_payment_output_59144_linea-mainnet.json │ ├── deploy_mc_payment_output_80002_polygon-amoy.json │ ├── deploy_poseidon_sepolia.json │ ├── deploy_state_output_1101_zkevm-mainnet.json │ ├── deploy_state_output_11155111_ethereum-sepolia.json │ ├── deploy_state_output_137_polygon-mainnet.json │ ├── deploy_state_output_1_ethereum-mainnet.json │ ├── deploy_state_output_21000_privado-main.json │ ├── deploy_state_output_21001_privado-test.json │ ├── deploy_state_output_2442_zkevm-cardona.json │ ├── deploy_state_output_59141_linea-sepolia.json │ ├── deploy_state_output_59144_linea-mainnet.json │ ├── deploy_state_output_6913_billions-test.json │ ├── deploy_state_output_80002_polygon-amoy.json │ ├── deploy_state_output_80002_polygon-amoy_upgrade.json │ ├── deploy_universal_verifier_output_1101_zkevm-mainnet.json │ ├── deploy_universal_verifier_output_11155111_ethereum-sepolia.json │ ├── deploy_universal_verifier_output_137_polygon-mainnet.json │ ├── deploy_universal_verifier_output_1_ethereum-mainnet.json │ ├── deploy_universal_verifier_output_21000_privado-main.json │ ├── deploy_universal_verifier_output_21001_privado-test.json │ ├── deploy_universal_verifier_output_2442_zkevm-cardona.json │ ├── deploy_universal_verifier_output_59141_linea-sepolia.json │ ├── deploy_universal_verifier_output_59144_linea-mainnet.json │ ├── deploy_universal_verifier_output_80002_polygon-amoy.json │ ├── deploy_validators_output_1101_zkevm-mainnet.json │ ├── deploy_validators_output_11155111_ethereum-sepolia.json │ ├── deploy_validators_output_137_polygon-mainnet.json │ ├── deploy_validators_output_1_ethereum-mainnet.json │ ├── deploy_validators_output_21000_privado-main.json │ ├── deploy_validators_output_21001_privado-test.json │ ├── deploy_validators_output_2442_zkevm-cardona.json │ ├── deploy_validators_output_59141_linea-sepolia.json │ ├── deploy_validators_output_59144_linea-mainnet.json │ └── deploy_validators_output_80002_polygon-amoy.json ├── maintenance │ ├── addValidatorsToUniversalVerifier.ts │ ├── checkContractsVerificationManually.ts │ ├── checkEmbeddedZKPVerifier.ts │ ├── checkUnifiedContractsVerification.ts │ ├── checkUniversalVerifierSingleNetwork.ts │ ├── computeCreate2Address.ts │ ├── disableProxyContract.ts │ ├── multi-chain │ │ ├── checkIdTypes.ts │ │ ├── checkOracleSigningAddress.ts │ │ ├── checkUnifiedContracts.ts │ │ └── checkUniversalVerifierVerification.ts │ ├── prepare-contracts-package.js │ ├── setOracleSigningAddress.ts │ ├── setPaymentValue.ts │ ├── setProofRequest.ts │ ├── setSupportedIdTypes.ts │ └── verifyEtherescan.js └── upgrade │ ├── identitytreestore │ └── identitytreestore-upgrade.ts │ ├── input-params.json │ ├── state │ ├── outdated │ │ ├── state-upgrade-2.ts │ │ ├── state-upgrade-with-data-check.ts │ │ ├── state-upgrade-with-data-model-migration.ts │ │ ├── state-upgrade.ts │ │ └── upgrade-test-def-id-type.ts │ └── state-upgrade.ts │ ├── upgrade-test.sh │ ├── validators │ └── validators-upgrade.ts │ └── verifiers │ ├── README.md │ ├── embedded-verifier-upgrade.ts │ ├── helpers │ ├── dl_circuits.sh │ ├── testVerifier.ts │ └── walletSetup.ts │ └── universal-verifier-upgrade.ts ├── slither.config.json ├── test ├── IdentityTreeStore │ └── IdentityTreeStore.test.ts ├── check-unified-addresses.test.ts ├── cross-chain │ └── cross-chain-proof-validator.test.ts ├── disable-proxy.test.ts ├── genesisUtils │ └── genesisUtils.test.ts ├── integration-tests │ ├── data │ │ ├── user_claim_issued_on_userid_v3.json │ │ ├── user_genesis_auth.json │ │ ├── user_genesis_auth_challenge_invalid.json │ │ └── user_linked_multi_query.json │ └── integration-verifier.test.ts ├── onchain-identity │ ├── claim-builder.test.ts │ ├── claim.ts │ ├── onchain-identity.test.ts │ └── vectorsGen │ │ ├── data │ │ └── claimBuilderData.json │ │ ├── go.mod │ │ ├── go.sum │ │ └── vectorsGenClaimBuilder_test.go ├── payment │ ├── mc-payment.test.ts │ └── vc-payment.test.ts ├── poseidon │ ├── poseidon.test.ts │ └── vectorsGen │ │ ├── go.mod │ │ ├── go.sum │ │ └── vectorsGen_test.go ├── primitiveUtils │ └── primitiveUtils.test.ts ├── reverseHash │ └── reverseHash.test.ts ├── smtLib │ ├── smtLib.test.ts │ └── vectorsGen │ │ ├── go.mod │ │ ├── go.sum │ │ └── vectorsGenSmt.go ├── state │ ├── data │ │ ├── user_state_genesis_transition.json │ │ └── user_state_next_transition.json │ └── state.test.ts ├── stateLib │ └── stateLib.test.ts ├── upgrade │ └── state-upgrade.test.ts ├── utils │ ├── id-calculation-utils.ts │ ├── packData.ts │ ├── query-hash-utils.ts │ ├── state-utils.ts │ └── validator-pack-utils.ts ├── validators │ ├── authv2 │ │ └── index.ts │ ├── common-data │ │ ├── issuer_from_first_state_to_second_transition_v3.json │ │ ├── issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json │ │ ├── issuer_from_genesis_state_to_first_transition_privado_main_v3.json │ │ ├── issuer_from_genesis_state_to_first_transition_v3.json │ │ ├── issuer_genesis_state.json │ │ ├── issuer_next_state_transition.json │ │ ├── user_from_first_state_to_second_transition_v3.json │ │ ├── user_from_genesis_state_to_first_transition_v3.json │ │ ├── user_next_state_transition.json │ │ └── user_state_transition.json │ ├── eth-identity │ │ └── index.ts │ ├── linked-multi-query │ │ └── linked-multi-query.test.ts │ ├── mtp │ │ ├── data │ │ │ ├── invalid_mtp_user_genesis.json │ │ │ ├── valid_mtp_user_genesis.json │ │ │ ├── valid_mtp_user_non_genesis.json │ │ │ └── valid_mtp_user_non_genesis_challenge_address.json │ │ └── index.ts │ ├── sig │ │ ├── data │ │ │ ├── invalid_sig_user_genesis.json │ │ │ ├── valid_sig_user_genesis.json │ │ │ ├── valid_sig_user_non_genesis.json │ │ │ └── valid_sig_user_non_genesis_challenge_address.json │ │ └── index.ts │ └── v3 │ │ ├── data │ │ ├── invalid_bjj_user_genesis_v3.json │ │ ├── invalid_mtp_user_genesis_v3.json │ │ ├── valid_bjj_user_first_issuer_genesis_v3.json │ │ ├── valid_bjj_user_first_issuer_second_v3.json │ │ ├── valid_bjj_user_first_v3.json │ │ ├── valid_bjj_user_genesis_auth_disabled_invalid_challenge_v3.json │ │ ├── valid_bjj_user_genesis_auth_disabled_v3.json │ │ ├── valid_bjj_user_genesis_auth_disabled_v3_wrong_id.json │ │ ├── valid_bjj_user_genesis_privado_main_v3.json │ │ ├── valid_bjj_user_genesis_v3.json │ │ ├── valid_bjj_user_second_issuer_first_v3.json │ │ ├── valid_mtp_user_first_issuer_second_v3.json │ │ ├── valid_mtp_user_first_v3.json │ │ ├── valid_mtp_user_genesis_auth_disabled_invalid_challenge_v3.json │ │ ├── valid_mtp_user_genesis_auth_disabled_v3.json │ │ ├── valid_mtp_user_genesis_auth_disabled_v3_wrong_id.json │ │ ├── valid_mtp_user_genesis_v3.json │ │ └── valid_mtp_user_second_issuer_first_v3.json │ │ └── index.ts └── verifier │ ├── embedded-verifier.test.ts │ ├── linked-proofs-data.json │ ├── requestDisableable.test.ts │ ├── requestOwnership.test.ts │ ├── universal-verifier.test.ts │ ├── validatorWhitelist.test.ts │ └── verifier.test.ts └── tsconfig.json /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | parserOptions: { 4 | project: 'tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | sourceType: 'module', 7 | }, 8 | plugins: ['@typescript-eslint/eslint-plugin'], 9 | extends: [ 10 | 'plugin:@typescript-eslint/recommended', 11 | 'plugin:prettier/recommended', 12 | ], 13 | root: true, 14 | env: { 15 | node: true, 16 | jest: true, 17 | }, 18 | ignorePatterns: ['.eslintrc.js'], 19 | rules: { 20 | '@typescript-eslint/interface-name-prefix': 'off', 21 | '@typescript-eslint/explicit-function-return-type': 'off', 22 | '@typescript-eslint/explicit-module-boundary-types': 'off', 23 | '@typescript-eslint/no-explicit-any': 'off', 24 | 'no-unused-vars': 'off', 25 | '@typescript-eslint/no-unused-vars': [ 26 | 'warn', 27 | { 28 | argsIgnorePattern: '^_', 29 | varsIgnorePattern: '^_', 30 | caughtErrorsIgnorePattern: '^_', 31 | }, 32 | ], 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: [push, pull_request] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | strategy: 7 | matrix: 8 | node: [ 20 ] 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v4 12 | - name: Use Nodejs 13 | uses: actions/setup-node@v4 14 | with: 15 | node-version: ${{ matrix.node }} # https://github.com/actions/setup-node#matrix-testing 16 | - name: Install node_modules 17 | run: npm install 18 | - name: Test contracts 19 | run: npm run test 20 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish contracts package to NPM 2 | 3 | on: workflow_dispatch 4 | jobs: 5 | publish-npm: 6 | runs-on: ubuntu-latest 7 | env: 8 | NODE_AUTH_TOKEN: ${{secrets.IDENTITY_NPM_PUBLISH_TOKEN}} 9 | steps: 10 | - uses: actions/checkout@v4 11 | - uses: actions/setup-node@v4 12 | with: 13 | node-version: 20 14 | registry-url: https://registry.npmjs.org/ 15 | 16 | - name: Install dependencies 17 | run: npm ci 18 | 19 | - name: "Clean Hardhat" 20 | run: "npx hardhat clean" 21 | 22 | - name: "Compile Hardhat" 23 | run: "npx hardhat compile" 24 | 25 | - name: Delete build folder 26 | working-directory: ./contracts 27 | run: rm -rf build 28 | 29 | - name: Create build folder 30 | working-directory: ./contracts 31 | run: mkdir -p build/contracts 32 | 33 | - name: "Copy artifacts" 34 | run: find artifacts/contracts -type f -name "*.json" ! -name "*dbg.json" ! -path "artifacts/contracts/test-helpers/*" -exec cp {} "contracts/build/contracts" \; 35 | 36 | - name: publish contracts package to NPM 37 | working-directory: ./contracts 38 | run: npm publish 39 | -------------------------------------------------------------------------------- /.github/workflows/security-ci.yml: -------------------------------------------------------------------------------- 1 | name: Security Scan 2 | on: # yamllint disable-line rule:truthy 3 | push: 4 | workflow_call: 5 | workflow_dispatch: {} 6 | 7 | jobs: 8 | solhint: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Get node.js 13 | uses: actions/setup-node@v4 14 | with: 15 | node-version: "20.x" 16 | - run: npm ci 17 | - run: npx solhint "contracts/**/*.sol" 18 | 19 | coverage: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Get node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: "20.x" 27 | cache: "npm" 28 | - run: npm ci 29 | - run: npx hardhat compile 30 | - name: solidity-coverage 31 | run: npx hardhat coverage 32 | - name: coveralls 33 | uses: coverallsapp/github-action@1.1.3 34 | with: 35 | github-token: ${{ secrets.GITHUB_TOKEN }} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | coverage 4 | coverage.json 5 | typechain 6 | typechain-types 7 | .idea 8 | build 9 | .vscode 10 | #Hardhat files 11 | cache 12 | artifacts 13 | migration-result.json 14 | events-data.json 15 | scripts/upgrade/verifiers/helpers/circuits 16 | **localhost.json 17 | **temp*.json -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/lib/VerifierMTP.sol 2 | **/lib/VerifierSig.sol 3 | **/lib/VerifierV3.sol 4 | **/lib/VerifierStateTransition.sol 5 | **/lib/groth16-verifiers/Groth16VerifierMTP.sol 6 | **/lib/groth16-verifiers/Groth16VerifierSig.sol 7 | **/lib/groth16-verifiers/Groth16VerifierV3.sol 8 | **/lib/groth16-verifiers/Groth16VerifierStateTransition.sol 9 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "singleQuote": false 4 | } 5 | -------------------------------------------------------------------------------- /.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | configureYulOptimizer: true, 3 | skipFiles: ["mocks", "test"], 4 | }; 5 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "plugins": ["prettier"], 4 | "rules": { 5 | "code-complexity": ["error", 8], 6 | "compiler-version": ["error", ">=0.8.4"], 7 | "func-visibility": ["error", { "ignoreConstructors": true }], 8 | "max-line-length": ["error", 120], 9 | "not-rely-on-time": "off", 10 | "prettier/prettier": [ 11 | "error", 12 | { 13 | "endOfLine": "auto" 14 | } 15 | ], 16 | "reason-string": ["warn", { "maxLength": 64 }] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.solhintignore: -------------------------------------------------------------------------------- 1 | # directories 2 | **/lib/Pairing.sol 3 | **/lib/VerifierMTP.sol 4 | **/lib/VerifierMTPWrapper.sol 5 | **/lib/VerifierSig.sol 6 | **/lib/VerifierSigWrapper.sol 7 | **/lib/VerifierStateTransition.sol 8 | **/lib/VerifierV3.sol 9 | **/lib/VerifierV3Wrapper.sol 10 | **/lib/groth16-verifiers 11 | **/node_modules 12 | 13 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Polygon Technology Security Information 2 | 3 | ## Link to vulnerability disclosure details (Bug Bounty). 4 | - Websites and Applications: https://hackerone.com/polygon-technology 5 | - Smart Contracts: https://immunefi.com/bounty/polygon 6 | 7 | ## Languages that our team speaks and understands. 8 | Preferred-Languages: en 9 | 10 | ## Security-related job openings at Polygon. 11 | https://polygon.technology/careers 12 | 13 | ## Polygon security contact details. 14 | security@polygon.technology 15 | 16 | ## The URL for accessing the security.txt file. 17 | Canonical: https://polygon.technology/security.txt 18 | -------------------------------------------------------------------------------- /contracts/AlwaysRevert.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | error TheContractIsDisabled(); 5 | 6 | /// @title This contract as a dummy implementation for Proxy contract if we need to revert all calls 7 | // This can be applied to disable all methods of a proxy contract with explicit error message 8 | contract AlwaysRevert { 9 | fallback() external payable { 10 | revert TheContractIsDisabled(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /contracts/Create2AddressAnchor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /* solhint-disable no-empty-blocks */ 5 | contract Create2AddressAnchor {} 6 | /* solhint-enable no-empty-blocks */ 7 | -------------------------------------------------------------------------------- /contracts/imports.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | // We import these here to force Hardhat to compile them. 5 | // This ensures that their artifacts are available for Hardhat Ignition to use. 6 | /* solhint-disable no-unused-import */ 7 | import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; 8 | import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; 9 | /* solhint-enable no-unused-import */ 10 | -------------------------------------------------------------------------------- /contracts/interfaces/IAuthValidator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /** 5 | * @dev IAuthValidator. Interface for verification of auth data. 6 | */ 7 | interface IAuthValidator { 8 | /** 9 | * @dev AuthResponseField. Information about response fields from verification. Used in verify function. 10 | * @param name Name of the response field 11 | * @param value Value of the response field 12 | */ 13 | struct AuthResponseField { 14 | string name; 15 | uint256 value; 16 | } 17 | 18 | /** 19 | * @dev Get version of the contract 20 | */ 21 | function version() external view returns (string memory); 22 | 23 | /** 24 | * @dev Verify the proof with the supported method informed in the auth query data 25 | * packed as bytes and that the proof was generated by the sender. 26 | * @param sender Sender of the proof. 27 | * @param proof Proof packed as bytes to verify. 28 | * @param params Request query data of the credential to verify. 29 | * @return userID User Id for the auth proof verified and response fields. 30 | * @return authResponseFields Additional response fields. 31 | */ 32 | function verify( 33 | address sender, 34 | bytes calldata proof, 35 | bytes calldata params 36 | ) external returns (uint256 userID, AuthResponseField[] memory authResponseFields); 37 | } 38 | -------------------------------------------------------------------------------- /contracts/interfaces/ICrossChainProofValidator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {IState} from "./IState.sol"; 5 | 6 | /** 7 | * @dev ICrossChainProofValidator. Interface for cross chain proof validation. 8 | */ 9 | interface ICrossChainProofValidator { 10 | /** 11 | * @dev Verifies global state proof and signer 12 | * @param globalStateProof The global state proof 13 | * @return The result of the global state proof verification 14 | */ 15 | function processGlobalStateProof( 16 | bytes calldata globalStateProof 17 | ) external returns (IState.GlobalStateProcessResult memory); 18 | 19 | /** 20 | * @dev Verifies identity state proof and signer 21 | * @param identityStateProof The identity state proof 22 | * @return The result of the identity state proof verification 23 | */ 24 | function processIdentityStateProof( 25 | bytes calldata identityStateProof 26 | ) external returns (IState.IdentityStateProcessResult memory); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/interfaces/IGroth16Verifier.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /** 5 | * @dev IGroth16Verifier. Interface for verification of groth16 proofs. 6 | */ 7 | interface IGroth16Verifier { 8 | /** 9 | * @dev Verify the circuit with the groth16 proof π=([πa]1,[πb]2,[πc]1). 10 | * @param a πa element of the groth16 proof. 11 | * @param b πb element of the groth16 proof. 12 | * @param c πc element of the groth16 proof. 13 | * @param signals Public inputs and outputs of the circuit. 14 | * @return r true if the proof is verified. 15 | */ 16 | function verify( 17 | uint256[2] calldata a, 18 | uint256[2][2] calldata b, 19 | uint256[2] calldata c, 20 | uint256[] calldata signals 21 | ) external view returns (bool r); 22 | } 23 | -------------------------------------------------------------------------------- /contracts/interfaces/IIdentifiable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /** 5 | * @dev IIdentifiable. Interface for identifiable entities. 6 | */ 7 | interface IIdentifiable { 8 | /** 9 | * @dev getId. Get id of the identity 10 | */ 11 | function getId() external view returns (uint256); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/interfaces/INonMerklizedIssuer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /** 5 | * @dev INonMerklizedIssuer. Interface for non-merklized issuer 6 | */ 7 | interface INonMerklizedIssuer { 8 | /** 9 | * @dev DisplayMethod display method for the credential 10 | * Optional fields 11 | */ 12 | struct DisplayMethod { 13 | string id; 14 | string _type; 15 | } 16 | 17 | /** 18 | * @dev CredentialSchema. Schema for the credential 19 | */ 20 | struct CredentialSchema { 21 | string id; 22 | string _type; 23 | } 24 | 25 | /** 26 | * @dev CredentialData. Information about the credential 27 | */ 28 | struct CredentialData { 29 | uint256 id; 30 | string[] context; 31 | string _type; 32 | uint64 issuanceDate; 33 | CredentialSchema credentialSchema; 34 | DisplayMethod displayMethod; 35 | } 36 | 37 | /** 38 | * @dev SubjectField credential subject for the credential 39 | * key - name of the field 40 | * value - value of the field 41 | * rawValue - raw value of the field, 42 | * is used for string and double types to restore source value in W3C verifiable credential 43 | */ 44 | struct SubjectField { 45 | string key; 46 | uint256 value; 47 | bytes rawValue; 48 | } 49 | 50 | /** 51 | * @dev getUserCredentialIds. Get list of user credentials identifiers 52 | * @param _userId user id 53 | */ 54 | function getUserCredentialIds(uint256 _userId) external view returns (uint256[] memory); 55 | 56 | /** 57 | * @dev getCredential. Get credential by user id and credential id. 58 | * Returns credential data, core claim and subject fields. 59 | * @param _userId user id 60 | * @param _credentialId credential id 61 | */ 62 | function getCredential( 63 | uint256 _userId, 64 | uint256 _credentialId 65 | ) external view returns (CredentialData memory, uint256[8] memory, SubjectField[] memory); 66 | 67 | /** 68 | * @dev getCredentialAdapterVersion. Get version of the credential adapter 69 | */ 70 | function getCredentialAdapterVersion() external view returns (string memory); 71 | } 72 | -------------------------------------------------------------------------------- /contracts/interfaces/IRHSStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | interface IRHSStorage { 5 | /** 6 | * @dev Saves nodes array. Note that each node contains an array itself. 7 | * @param nodes An array of nodes 8 | */ 9 | function saveNodes(uint256[][] memory nodes) external; 10 | 11 | /** 12 | * @dev Returns a node by its key. Note that a node contains an array. 13 | * @param key The key of the node 14 | * @return The node 15 | */ 16 | function getNode(uint256 key) external view returns (uint256[] memory); 17 | } 18 | -------------------------------------------------------------------------------- /contracts/interfaces/IStateTransitionVerifier.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /** 5 | * @dev IStateTransitionVerifier. Interface for groth16 state transition proof verification. 6 | */ 7 | interface IStateTransitionVerifier { 8 | /** 9 | * @dev Verify the state transition circuit with the groth16 proof π=([πa]1,[πb]2,[πc]1). 10 | * @param a πa element of the groth16 proof. 11 | * @param b πb element of the groth16 proof. 12 | * @param c πc element of the groth16 proof. 13 | * @param input Public inputs of the state transition circuit. 14 | * @return r true if the verification is passed. 15 | */ 16 | function verifyProof( 17 | uint256[2] calldata a, 18 | uint256[2][2] calldata b, 19 | uint256[2] calldata c, 20 | uint256[4] calldata input 21 | ) external view returns (bool r); 22 | } 23 | -------------------------------------------------------------------------------- /contracts/lib/ArrayUtils.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | /// @title A common functions for arrays. 5 | library ArrayUtils { 6 | /** 7 | * @dev Calculates bounds for the slice of the array. 8 | * @param arrLength An array length. 9 | * @param start A start index. 10 | * @param length A length of the slice. 11 | * @param limit A limit for the length. 12 | * @return The bounds for the slice of the array. 13 | */ 14 | function calculateBounds( 15 | uint256 arrLength, 16 | uint256 start, 17 | uint256 length, 18 | uint256 limit 19 | ) internal pure returns (uint256, uint256) { 20 | require(length > 0, "Length should be greater than 0"); 21 | require(length <= limit, "Length limit exceeded"); 22 | require(start < arrLength, "Start index out of bounds"); 23 | 24 | uint256 end = start + length; 25 | if (end > arrLength) { 26 | end = arrLength; 27 | } 28 | 29 | return (start, end); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contracts/lib/NonMerklizedIssuerBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {INonMerklizedIssuer} from "../interfaces/INonMerklizedIssuer.sol"; 5 | import {IdentityBase} from "./IdentityBase.sol"; 6 | 7 | /** 8 | * @dev NonMerklizedIssuerBase. Non-merklized base contract to issue non-merklized credentials 9 | */ 10 | abstract contract NonMerklizedIssuerBase is INonMerklizedIssuer, IdentityBase { 11 | /** 12 | * @dev Constant representing the credential adapter version 13 | */ 14 | string public constant CREDENTIAL_ADAPTER_VERSION = "0.0.1"; 15 | 16 | /** 17 | * @dev getCredentialAdapterVersion. Get version of the credential adapter 18 | */ 19 | function getCredentialAdapterVersion() external pure returns (string memory) { 20 | return CREDENTIAL_ADAPTER_VERSION; 21 | } 22 | 23 | /** 24 | * @dev supportsInterface. Check if the contract supports the interface 25 | */ 26 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { 27 | return 28 | interfaceId == type(INonMerklizedIssuer).interfaceId || 29 | super.supportsInterface(interfaceId); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contracts/lib/ReverseHashLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | library ReverseHashLib { 5 | struct Data { 6 | mapping(uint256 => uint256[]) hashesToPreimages; 7 | function(uint256[] memory) pure returns (uint256) hashFunction; 8 | } 9 | 10 | /** 11 | * @dev Saves preimages by their keys, which are a hashes of preimages. 12 | * Each preimage is an array. 13 | * @param preimages A two-dimension array of preimages 14 | */ 15 | function savePreimages(Data storage self, uint256[][] memory preimages) internal { 16 | for (uint256 i = 0; i < preimages.length; i++) { 17 | uint256 key = self.hashFunction(preimages[i]); 18 | self.hashesToPreimages[key] = preimages[i]; 19 | } 20 | } 21 | 22 | /** 23 | * @dev Returns preimage by the key, which is a hash of the preimage. 24 | * The preimage is an array. 25 | * @param key A key 26 | * @return A preimage 27 | */ 28 | function getPreimage(Data storage self, uint256 key) internal view returns (uint256[] memory) { 29 | return self.hashesToPreimages[key]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contracts/lib/groth16-verifiers/Groth16VerifierAuthV2Wrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {Groth16VerifierAuthV2} from "./Groth16VerifierAuthV2.sol"; 5 | import {IGroth16Verifier} from "../../interfaces/IGroth16Verifier.sol"; 6 | 7 | error ExpectedArrayLenght(uint256 expected, uint256 actual); 8 | 9 | contract Groth16VerifierAuthV2Wrapper is Groth16VerifierAuthV2, IGroth16Verifier { 10 | /** 11 | * @dev Number of public signals for atomic mtp circuit 12 | */ 13 | uint256 constant PUBSIGNALS_LENGTH = 3; 14 | 15 | /** 16 | * @dev Verify the circuit with the groth16 proof π=([πa]1,[πb]2,[πc]1). 17 | * @param a πa element of the groth16 proof. 18 | * @param b πb element of the groth16 proof. 19 | * @param c πc element of the groth16 proof. 20 | * @param signals Public inputs and outputs of the circuit. 21 | * @return r true if the proof is valid. 22 | */ 23 | function verify( 24 | uint256[2] calldata a, 25 | uint256[2][2] calldata b, 26 | uint256[2] calldata c, 27 | uint256[] calldata signals 28 | ) public view returns (bool r) { 29 | uint[PUBSIGNALS_LENGTH] memory pubSignals; 30 | 31 | if (signals.length != PUBSIGNALS_LENGTH) { 32 | revert ExpectedArrayLenght(PUBSIGNALS_LENGTH, signals.length); 33 | } 34 | 35 | for (uint256 i = 0; i < PUBSIGNALS_LENGTH; i++) { 36 | pubSignals[i] = signals[i]; 37 | } 38 | 39 | return this.verifyProof(a, b, c, pubSignals); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /contracts/lib/groth16-verifiers/Groth16VerifierLinkedMultiQuery10Wrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {IGroth16Verifier} from "../../interfaces/IGroth16Verifier.sol"; 5 | import {Groth16VerifierLinkedMultiQuery10} from "./Groth16VerifierLinkedMultiQuery10.sol"; 6 | 7 | error ExpectedArrayLenght(uint256 expected, uint256 actual); 8 | 9 | contract Groth16VerifierLinkedMultiQuery10Wrapper is 10 | Groth16VerifierLinkedMultiQuery10, 11 | IGroth16Verifier 12 | { 13 | /** 14 | * @dev Number of public signals for atomic mtp circuit 15 | */ 16 | uint256 constant PUBSIGNALS_LENGTH = 22; 17 | 18 | /** 19 | * @dev Verify the circuit with the groth16 proof π=([πa]1,[πb]2,[πc]1). 20 | * @param a πa element of the groth16 proof. 21 | * @param b πb element of the groth16 proof. 22 | * @param c πc element of the groth16 proof. 23 | * @param signals Public inputs and outputs of the circuit. 24 | * @return r true if the proof is valid. 25 | */ 26 | function verify( 27 | uint256[2] calldata a, 28 | uint256[2][2] calldata b, 29 | uint256[2] calldata c, 30 | uint256[] calldata signals 31 | ) public view returns (bool r) { 32 | uint[PUBSIGNALS_LENGTH] memory pubSignals; 33 | 34 | if (signals.length != PUBSIGNALS_LENGTH) { 35 | revert ExpectedArrayLenght(PUBSIGNALS_LENGTH, signals.length); 36 | } 37 | 38 | for (uint256 i = 0; i < PUBSIGNALS_LENGTH; i++) { 39 | pubSignals[i] = signals[i]; 40 | } 41 | 42 | return this.verifyProof(a, b, c, pubSignals); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /contracts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@iden3/contracts", 3 | "version": "3.0.1", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@iden3/contracts", 9 | "version": "3.0.1", 10 | "license": "GPL-3.0", 11 | "dependencies": { 12 | "@openzeppelin/contracts": "^5.2.0", 13 | "@openzeppelin/contracts-upgradeable": "^5.2.0" 14 | } 15 | }, 16 | "node_modules/@openzeppelin/contracts": { 17 | "version": "5.2.0", 18 | "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.2.0.tgz", 19 | "integrity": "sha512-bxjNie5z89W1Ea0NZLZluFh8PrFNn9DH8DQlujEok2yjsOlraUPKID5p1Wk3qdNbf6XkQ1Os2RvfiHrrXLHWKA==" 20 | }, 21 | "node_modules/@openzeppelin/contracts-upgradeable": { 22 | "version": "5.2.0", 23 | "resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-5.2.0.tgz", 24 | "integrity": "sha512-mZIu9oa4tQTlGiOJHk6D3LdJlqFqF6oNOSn6S6UVJtzfs9UsY9/dhMEbAVTwElxUtJnjpf6yA062+oBp+eOyPg==", 25 | "peerDependencies": { 26 | "@openzeppelin/contracts": "5.2.0" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@iden3/contracts", 3 | "description": "Smart Contract library for Solidity", 4 | "version": "3.1.0", 5 | "files": [ 6 | "**/*.sol", 7 | "/build/contracts/*.json", 8 | "!test-helpers" 9 | ], 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/iden3/contracts.git" 13 | }, 14 | "keywords": [ 15 | "solidity", 16 | "smart", 17 | "contracts" 18 | ], 19 | "author": "iden3", 20 | "license": "GPL-3.0", 21 | "bugs": { 22 | "url": "https://github.com/iden3/contracts/issues" 23 | }, 24 | "dependencies": { 25 | "@openzeppelin/contracts": "^5.2.0", 26 | "@openzeppelin/contracts-upgradeable": "^5.2.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/state/README.md: -------------------------------------------------------------------------------- 1 | ## State smart contract 2 | 3 | The contract is aimed to be a part of a core protocol for self-sovereign identity system. Its purpose is to store the meta information about identities. 4 | 5 | In particular, State contract stores the data of uint256 type for each identity, which is called "identity state" or state. The state represents a root of special cryptographic structure, which is out of scope of smart contract logic. But the only thing that smart contract should check is that the caller knows some private key, which public key is inside the structure. The overall check is hidden in the Zero-knowledge proof verifier smart contract attached to the State contract. The verifier contract was automatically generated by the Iden3 SnarkJS ZK library and was audited by the library creators. 6 | 7 | Another data structure used by State is a Sparse Merkle Tree, which keeps the whole tree on chain as well as its full history. Each tree leaf consist of an index and a value. The indexes keep identity identifier and values keep states. The main purpose of the SMT is to provide inclusion and non-inclusion proofs of the states of identities into the SMT root. The tree processing logic is implemented by the Smt library contract linked to the state contract. 8 | 9 | Take into account that the State contract and SMT library import Poseidon.sol contract, which is nothing more than a "placeholder" for auto generated EVM code. The code is responsible for the onchain Poseidon hash implementation. There is a helper method in the repo, which uses the circomlibjs Poseidon ABI and code generator. 10 | 11 | Finally, the State contract is OwnableUpgradeable, which means that it works via the ERC1967 Proxy contract, that keeps all its state. Any further upgrades of the State contract should avoid any storage collisions. 12 | -------------------------------------------------------------------------------- /contracts/test-helpers/AuthValidatorStub.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; 5 | import {IAuthValidator} from "../interfaces/IAuthValidator.sol"; 6 | 7 | /** 8 | * @dev AuthValidatorStub validator 9 | */ 10 | contract AuthValidatorStub is IAuthValidator, ERC165 { 11 | string public constant VERSION = "1.0.0-stub"; 12 | 13 | uint256 private userID; 14 | 15 | function version() public pure override returns (string memory) { 16 | return VERSION; 17 | } 18 | 19 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { 20 | return 21 | interfaceId == type(IAuthValidator).interfaceId || super.supportsInterface(interfaceId); 22 | } 23 | 24 | function verify( 25 | address, 26 | bytes calldata, 27 | bytes calldata 28 | ) external view override returns (uint256, AuthResponseField[] memory) { 29 | AuthResponseField[] memory authResponseFields = new AuthResponseField[](1); 30 | authResponseFields[0] = AuthResponseField("challenge", 1); 31 | return (userID, authResponseFields); 32 | } 33 | 34 | // solhint-disable-next-line func-name-mixedcase 35 | function stub_setVerifyResults(uint256 _userID) external { 36 | userID = _userID; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /contracts/test-helpers/BinarySearchTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {SmtLib} from "../lib/SmtLib.sol"; 5 | 6 | contract BinarySearchTestWrapper { 7 | SmtLib.Data internal smtData; 8 | using SmtLib for SmtLib.Data; 9 | 10 | constructor() { 11 | smtData.initialize(64); 12 | } 13 | 14 | function addRootEntry(uint256 root, uint256 createdAtTimestamp, uint256 createdAtBlock) public { 15 | smtData.rootEntries.push( 16 | SmtLib.RootEntry({ 17 | root: root, 18 | createdAtTimestamp: createdAtTimestamp, 19 | createdAtBlock: createdAtBlock 20 | }) 21 | ); 22 | 23 | smtData.rootIndexes[root].push(smtData.rootEntries.length - 1); 24 | } 25 | 26 | function getRootInfoByTime( 27 | uint256 _timestamp 28 | ) public view returns (SmtLib.RootEntryInfo memory) { 29 | return smtData.getRootInfoByTime(_timestamp); 30 | } 31 | 32 | function getHistoricalRootByBlock( 33 | uint256 _block 34 | ) public view returns (SmtLib.RootEntryInfo memory) { 35 | return smtData.getRootInfoByBlock(_block); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /contracts/test-helpers/ClaimBuilderWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {ClaimBuilder} from "../lib/ClaimBuilder.sol"; 5 | 6 | contract ClaimBuilderWrapper { 7 | using ClaimBuilder for ClaimBuilder.ClaimData; 8 | 9 | function buildClaim(ClaimBuilder.ClaimData calldata c) public pure returns (uint256[8] memory) { 10 | return ClaimBuilder.build(c); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /contracts/test-helpers/ERC20PermitToken.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.27; 2 | 3 | import {ERC20, ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; 4 | 5 | contract ERC20PermitToken is ERC20Permit { 6 | constructor(uint256 initialSupply) ERC20Permit("TEST") ERC20("EIP-2612 TEST", "EIP2612-TST") { 7 | _mint(msg.sender, initialSupply); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /contracts/test-helpers/ERC20Token.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.8.27; 2 | 3 | import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 4 | 5 | contract ERC20Token is ERC20 { 6 | constructor(uint256 initialSupply) ERC20("ERC20Token", "TST") { 7 | _mint(msg.sender, initialSupply); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /contracts/test-helpers/EmbeddedVerifierWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {EmbeddedVerifier} from "../verifiers/EmbeddedVerifier.sol"; 5 | import {IState} from "../interfaces/IState.sol"; 6 | 7 | contract EmbeddedVerifierWrapper is EmbeddedVerifier { 8 | event BeforeProofSubmit(AuthResponse authResponse, Response[] responses); 9 | event AfterProofSubmit(AuthResponse authResponse, Response[] responses); 10 | 11 | function initialize(address initialOwner, IState state) public initializer { 12 | super.__EmbeddedVerifier_init(initialOwner, state); 13 | } 14 | 15 | function _beforeProofSubmit( 16 | AuthResponse memory authResponse, 17 | Response[] memory responses 18 | ) internal override { 19 | emit BeforeProofSubmit(authResponse, responses); 20 | } 21 | 22 | function _afterProofSubmit( 23 | AuthResponse memory authResponse, 24 | Response[] memory responses 25 | ) internal override { 26 | emit AfterProofSubmit(authResponse, responses); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/test-helpers/GenesisUtilsWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {GenesisUtils} from "../lib/GenesisUtils.sol"; 5 | 6 | contract GenesisUtilsWrapper { 7 | function getIdType(uint256 id) public pure returns (bytes2) { 8 | return GenesisUtils.getIdType(id); 9 | } 10 | 11 | function isGenesisState(uint256 id, uint256 idState) public pure returns (bool) { 12 | return GenesisUtils.isGenesisState(id, idState); 13 | } 14 | 15 | function calcIdFromGenesisState(bytes2 idType, uint256 idState) public pure returns (uint256) { 16 | return GenesisUtils.calcIdFromGenesisState(idType, idState); 17 | } 18 | 19 | function calcOnchainIdFromAddress(bytes2 idType, address caller) public pure returns (uint256) { 20 | return GenesisUtils.calcIdFromEthAddress(idType, caller); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/test-helpers/Groth16VerifierStub.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {IStateTransitionVerifier} from "../interfaces/IStateTransitionVerifier.sol"; 5 | 6 | contract Groth16VerifierStub is IStateTransitionVerifier { 7 | function verifyProof( 8 | uint256[2] memory, 9 | uint256[2][2] memory, 10 | uint256[2] memory, 11 | uint256[4] memory 12 | ) external pure returns (bool r) { 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/test-helpers/Groth16VerifierValidatorStub.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {IGroth16Verifier} from "../interfaces/IGroth16Verifier.sol"; 5 | 6 | contract Groth16VerifierValidatorStub is IGroth16Verifier { 7 | bool private verifyResult; 8 | 9 | constructor() { 10 | verifyResult = true; 11 | } 12 | 13 | function verify( 14 | uint256[2] calldata, 15 | uint256[2][2] calldata, 16 | uint256[2] calldata, 17 | uint256[] calldata 18 | ) external view returns (bool r) { 19 | return verifyResult; 20 | } 21 | 22 | // solhint-disable-next-line func-name-mixedcase 23 | function stub_setVerifyResult(bool result) external { 24 | verifyResult = result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /contracts/test-helpers/PrimitiveTypeUtilsWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {PrimitiveTypeUtils} from "../lib/PrimitiveTypeUtils.sol"; 5 | 6 | contract PrimitiveTypeUtilsWrapper { 7 | function addressToUint256LE(address _addr) public pure returns (uint256) { 8 | return PrimitiveTypeUtils.addressToUint256LE(_addr); 9 | } 10 | 11 | function uint256LEToAddress(uint256 input) public pure returns (address) { 12 | return PrimitiveTypeUtils.uint256LEToAddress(input); 13 | } 14 | 15 | function addressToUint256(address _addr) public pure returns (uint256) { 16 | return PrimitiveTypeUtils.addressToUint256(_addr); 17 | } 18 | 19 | function uint256ToAddress(uint256 input) public pure returns (address) { 20 | return PrimitiveTypeUtils.uint256ToAddress(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /contracts/test-helpers/RequestDisableableTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {RequestDisableable} from "../verifiers/RequestDisableable.sol"; 5 | import {IState} from "../interfaces/IState.sol"; 6 | import {IVerifier} from "../interfaces/IVerifier.sol"; 7 | 8 | contract RequestDisableableTestWrapper is RequestDisableable { 9 | function initialize(IState state) public initializer { 10 | __Verifier_init(state); 11 | } 12 | 13 | function disableRequest(uint256 requestId) public { 14 | _disableRequest(requestId); 15 | } 16 | 17 | function enableRequest(uint256 requestId) public { 18 | _enableRequest(requestId); 19 | } 20 | 21 | /* solhint-disable no-empty-blocks */ 22 | function testModifier(uint256 requestId) public view onlyEnabledRequest(requestId) {} 23 | /* solhint-enable no-empty-blocks */ 24 | 25 | function getRequestIfCanBeVerified( 26 | uint256 requestId 27 | ) public view returns (IVerifier.RequestData memory) { 28 | return _getRequestIfCanBeVerified(requestId); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/test-helpers/RequestOwnershipTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {RequestOwnership} from "../verifiers/RequestOwnership.sol"; 5 | import {IState} from "../interfaces/IState.sol"; 6 | 7 | contract RequestOwnershipTestWrapper is RequestOwnership { 8 | function initialize(IState state) public initializer { 9 | __Verifier_init(state); 10 | } 11 | 12 | function setRequestOwner(uint256 requestId, address requestOwner) public { 13 | _setRequestOwner(requestId, requestOwner); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/test-helpers/ReverseHashWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {ReverseHashLib} from "../lib/ReverseHashLib.sol"; 5 | import {PoseidonUnit2L, PoseidonUnit3L} from "../lib/Poseidon.sol"; 6 | 7 | error UnsupportedLength(); 8 | 9 | contract ReverseHashWrapper { 10 | using ReverseHashLib for ReverseHashLib.Data; 11 | 12 | ReverseHashLib.Data private _data; 13 | 14 | constructor() { 15 | _data.hashFunction = hash; 16 | } 17 | 18 | function savePreimages(uint256[][] memory preimage) public { 19 | return _data.savePreimages(preimage); 20 | } 21 | 22 | function getPreimage(uint256 id) public view returns (uint256[] memory) { 23 | return _data.getPreimage(id); 24 | } 25 | 26 | function hash(uint256[] memory preimage) public pure returns (uint256) { 27 | if (preimage.length == 2) { 28 | return PoseidonUnit2L.poseidon([preimage[0], preimage[1]]); 29 | } 30 | if (preimage.length == 3) { 31 | return PoseidonUnit3L.poseidon([preimage[0], preimage[1], preimage[2]]); 32 | } 33 | revert UnsupportedLength(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /contracts/test-helpers/StateLibTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {StateLib} from "../lib/StateLib.sol"; 5 | 6 | contract StateLibTestWrapper { 7 | using StateLib for StateLib.Data; 8 | 9 | StateLib.Data internal stateData; 10 | 11 | function addState(uint256 id, uint256 state) external { 12 | stateData.addState(id, state); 13 | } 14 | 15 | function addGenesisState(uint256 id, uint256 state) external { 16 | stateData.addGenesisState(id, state); 17 | } 18 | 19 | function getStateInfoById(uint256 id) external view returns (StateLib.EntryInfo memory) { 20 | return stateData.getStateInfoById(id); 21 | } 22 | 23 | function getStateInfoByIdAndState( 24 | uint256 id, 25 | uint256 state 26 | ) external view returns (StateLib.EntryInfo memory) { 27 | return stateData.getStateInfoByIdAndState(id, state); 28 | } 29 | 30 | function getStateInfoHistoryLengthById(uint256 id) external view returns (uint256) { 31 | return stateData.getStateInfoHistoryLengthById(id); 32 | } 33 | 34 | function getStateInfoHistoryById( 35 | uint256 id, 36 | uint256 startIndex, 37 | uint256 length 38 | ) external view returns (StateLib.EntryInfo[] memory) { 39 | return stateData.getStateInfoHistoryById(id, startIndex, length); 40 | } 41 | 42 | function getStateInfoListLengthByIdAndState( 43 | uint256 id, 44 | uint256 state 45 | ) external view returns (uint256) { 46 | return stateData.getStateInfoListLengthByIdAndState(id, state); 47 | } 48 | 49 | function getStateInfoListByIdAndState( 50 | uint256 id, 51 | uint256 state, 52 | uint256 startIndex, 53 | uint256 length 54 | ) external view returns (StateLib.EntryInfo[] memory) { 55 | return stateData.getStateInfoListByIdAndState(id, state, startIndex, length); 56 | } 57 | 58 | function idExists(uint256 id) external view returns (bool) { 59 | return stateData.idExists(id); 60 | } 61 | 62 | function stateExists(uint256 id, uint256 state) external view returns (bool) { 63 | return stateData.stateExists(id, state); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /contracts/test-helpers/UniversalVerifierTestWrapper_ManyResponsesPerUserAndRequest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {UniversalVerifier} from "../verifiers/UniversalVerifier.sol"; 5 | 6 | contract UniversalVerifierTestWrapper_ManyResponsesPerUserAndRequest is UniversalVerifier { 7 | // solhint-disable no-empty-blocks 8 | function _checkCanWriteProofResults( 9 | uint256 /* requestId */, 10 | address /* caller */ 11 | ) internal view override { 12 | // Allow all writes for testing purposes 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /contracts/test-helpers/ValidatorWhitelistTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {ValidatorWhitelist} from "../verifiers/ValidatorWhitelist.sol"; 5 | import {IState} from "../interfaces/IState.sol"; 6 | import {IRequestValidator} from "../interfaces/IRequestValidator.sol"; 7 | import {IVerifier} from "../interfaces/IVerifier.sol"; 8 | 9 | contract ValidatorWhitelistTestWrapper is ValidatorWhitelist { 10 | function initialize(IState state) public initializer { 11 | __Verifier_init(state); 12 | } 13 | 14 | function addValidatorToWhitelist(IRequestValidator validator) public { 15 | _addValidatorToWhitelist(validator); 16 | } 17 | 18 | function removeValidatorFromWhitelist(IRequestValidator validator) public { 19 | _removeValidatorFromWhitelist(validator); 20 | } 21 | 22 | /* solhint-disable no-empty-blocks */ 23 | function testModifier( 24 | IRequestValidator validator 25 | ) public view onlyWhitelistedValidator(validator) {} 26 | /* solhint-enable no-empty-blocks */ 27 | 28 | function getRequestIfCanBeVerified( 29 | uint256 requestId 30 | ) public view returns (IVerifier.RequestData memory) { 31 | return _getRequestIfCanBeVerified(requestId); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /contracts/test-helpers/VerifierTestWrapper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.10; 3 | 4 | import {Verifier} from "../verifiers/Verifier.sol"; 5 | import {IState} from "../interfaces/IState.sol"; 6 | 7 | contract VerifierTestWrapper is Verifier { 8 | function initialize(IState state) public initializer { 9 | __Verifier_init(state); 10 | } 11 | 12 | function setVerifierID(uint256 verifierID) public { 13 | _setVerifierID(verifierID); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/verifiers/RequestOwnership.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity 0.8.27; 3 | 4 | import {Verifier} from "./Verifier.sol"; 5 | import {IVerifier} from "../interfaces/IVerifier.sol"; 6 | 7 | abstract contract RequestOwnership is Verifier { 8 | /// @custom:storage-location erc7201:iden3.storage.RequestOwnership 9 | struct RequestOwnershipStorage { 10 | mapping(uint256 requestId => address requestOwner) _requestOwners; 11 | } 12 | 13 | // keccak256(abi.encode(uint256(keccak256("iden3.storage.RequestOwnership")) - 1)) & ~bytes32(uint256(0xff)); 14 | // solhint-disable-next-line const-name-snakecase 15 | bytes32 private constant RequestOwnershipStorageLocation = 16 | 0x6209bdc3799f5201408f7a7d4d471bb2a0100353e618451674b93f730b006a00; 17 | 18 | function _getRequestOwnershipStorage() 19 | private 20 | pure 21 | returns (RequestOwnershipStorage storage $) 22 | { 23 | // solhint-disable-next-line no-inline-assembly 24 | assembly { 25 | $.slot := RequestOwnershipStorageLocation 26 | } 27 | } 28 | 29 | /** 30 | * @dev Get a request owner address 31 | * @param requestId The ID of a request 32 | * @return The request owner address 33 | */ 34 | function getRequestOwner( 35 | uint256 requestId 36 | ) public view virtual checkRequestExistence(requestId, true) returns (address) { 37 | return _getRequestOwnershipStorage()._requestOwners[requestId]; 38 | } 39 | 40 | function _setRequest(IVerifier.Request calldata request) internal virtual override { 41 | super._setRequest(request); 42 | _setRequestOwner(request.requestId, _msgSender()); 43 | } 44 | 45 | function _setRequestOwner( 46 | uint256 requestId, 47 | address requestOwner 48 | ) internal checkRequestExistence(requestId, true) { 49 | RequestOwnershipStorage storage $ = _getRequestOwnershipStorage(); 50 | $._requestOwners[requestId] = requestOwner; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ignition/deployments/chain-21000/deployed_addresses.json: -------------------------------------------------------------------------------- 1 | { 2 | "SmtLibModule#PoseidonUnit2L": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 3 | "SmtLibModule#PoseidonUnit3L": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 4 | "SmtLibModule#SmtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 5 | "Groth16VerifierStateTransitionModule#Groth16VerifierStateTransition": "0xAE950A9B8F48bC4519820728E210515a07F7cB71", 6 | "Groth16VerifierMTPWrapperModule#Groth16VerifierMTPWrapper": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F", 7 | "Groth16VerifierSigWrapperModule#Groth16VerifierSigWrapper": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51", 8 | "Groth16VerifierV3WrapperModule#Groth16VerifierV3Wrapper": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282", 9 | "StateProxyModule#TransparentUpgradeableProxy": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 10 | "StateProxyModule#ProxyAdmin": "0x3F570C4fE07c532cd274dF2d1dB26D74cc5F8F9A", 11 | "IdentityTreeStoreProxyModule#TransparentUpgradeableProxy": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 12 | "IdentityTreeStoreProxyModule#ProxyAdmin": "0x23F9ae5A19435347b8Ba10c69ad93128464f7A22", 13 | "CredentialAtomicQueryMTPV2ValidatorProxyModule#TransparentUpgradeableProxy": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 14 | "CredentialAtomicQueryMTPV2ValidatorProxyModule#ProxyAdmin": "0xbcC403558F4875894eb092d718863F74e879D343", 15 | "CredentialAtomicQuerySigV2ValidatorProxyModule#TransparentUpgradeableProxy": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 16 | "CredentialAtomicQuerySigV2ValidatorProxyModule#ProxyAdmin": "0xc5b4A6c4Ec91D660f020c5388253e42Cb76adB09", 17 | "CredentialAtomicQueryV3ValidatorProxyModule#TransparentUpgradeableProxy": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 18 | "CredentialAtomicQueryV3ValidatorProxyModule#ProxyAdmin": "0x759413E6Bc96eCd646EA9B23086E85De4b0CF070", 19 | "UniversalVerifierProxyModule#TransparentUpgradeableProxy": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 20 | "UniversalVerifierProxyModule#ProxyAdmin": "0xcCbEd68Fc1C38f5357bff08eCa414b7CD24026Af" 21 | } 22 | -------------------------------------------------------------------------------- /ignition/deployments/chain-21001/deployed_addresses.json: -------------------------------------------------------------------------------- 1 | { 2 | "IdentityTreeStoreProxyModule#TransparentUpgradeableProxy": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 3 | "IdentityTreeStoreProxyModule#ProxyAdmin": "0x23F9ae5A19435347b8Ba10c69ad93128464f7A22", 4 | "CredentialAtomicQueryMTPV2ValidatorProxyModule#TransparentUpgradeableProxy": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 5 | "CredentialAtomicQueryMTPV2ValidatorProxyModule#ProxyAdmin": "0xbcC403558F4875894eb092d718863F74e879D343", 6 | "CredentialAtomicQuerySigV2ValidatorProxyModule#TransparentUpgradeableProxy": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 7 | "CredentialAtomicQuerySigV2ValidatorProxyModule#ProxyAdmin": "0xc5b4A6c4Ec91D660f020c5388253e42Cb76adB09", 8 | "CredentialAtomicQueryV3ValidatorProxyModule#TransparentUpgradeableProxy": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 9 | "CredentialAtomicQueryV3ValidatorProxyModule#ProxyAdmin": "0x759413E6Bc96eCd646EA9B23086E85De4b0CF070", 10 | "UniversalVerifierProxyModule#TransparentUpgradeableProxy": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 11 | "UniversalVerifierProxyModule#ProxyAdmin": "0xcCbEd68Fc1C38f5357bff08eCa414b7CD24026Af" 12 | } 13 | -------------------------------------------------------------------------------- /ignition/deployments/chain-6913/deployed_addresses.json: -------------------------------------------------------------------------------- 1 | { 2 | "Poseidon1Module#Poseidon1Element": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "Poseidon2Module#Poseidon2Element": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "Poseidon3Module#Poseidon3Element": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "Poseidon4Module#Poseidon4Element": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "SmtLibModule#PoseidonUnit2L": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 7 | "SmtLibModule#PoseidonUnit3L": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 8 | "SmtLibModule#SmtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 9 | "Create2AddressAnchorModule#Create2AddressAnchor": "0x56fF81aBB5cdaC478bF236db717e4976b2ff841e", 10 | "StateProxyModule#TransparentUpgradeableProxy": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 11 | "StateProxyModule#ProxyAdmin": "0x3F570C4fE07c532cd274dF2d1dB26D74cc5F8F9A" 12 | } 13 | -------------------------------------------------------------------------------- /ignition/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./modules/create2AddressAnchor"; 2 | export * from "./modules/credentialAtomicQueryMTPV2Validator"; 3 | export * from "./modules/credentialAtomicQuerySigV2Validator"; 4 | export * from "./modules/credentialAtomicQueryV3Validator"; 5 | export * from "./modules/authV2Validator"; 6 | export * from "./modules/ethIdentityValidator"; 7 | export * from "./modules/identityTreeStore"; 8 | export * from "./modules/libraries"; 9 | export * from "./modules/linkedMultiQuery"; 10 | export * from "./modules/mcPayment"; 11 | export * from "./modules/state"; 12 | export * from "./modules/universalVerifier"; 13 | export * from "./modules/vcPayment"; 14 | -------------------------------------------------------------------------------- /ignition/modules/authV2Validator.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const AuthV2ValidatorProxyModule = buildModule("AuthV2ValidatorProxyModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.VALIDATOR_AUTH_V2.create2Calldata, 30 | ], 31 | ); 32 | 33 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 34 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /ignition/modules/create2AddressAnchor.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { contractsInfo } from "../../helpers/constants"; 3 | 4 | const contractName = contractsInfo.CREATE2_ADDRESS_ANCHOR.name; 5 | 6 | export const Create2AddressAnchorModule = buildModule("Create2AddressAnchorModule", (m) => { 7 | // The bytecode, which is effectively deployed is 0x60006000F3 (last 5 bytes of the init bytecode), 8 | // which is PUSH1 0x00, PUSH1 0x00, RETURN. 9 | // That means that the contract will do nothing but accept any transaction without throwing an error. 10 | // So, it can be used as a first "dummy" implementation of contracts such as TransparentUpgradeableProxy, 11 | // which demand the first implementation address to have non-empty contract. 12 | 13 | const create2AddressAnchor = m.contract(contractName, { 14 | abi: [], 15 | contractName, 16 | bytecode: "0x6005600C60003960056000F360006000F3", 17 | sourceName: "", 18 | linkReferences: {}, 19 | }); 20 | 21 | return { create2AddressAnchor }; 22 | }); 23 | 24 | // THE CONTRACT DISASSEMBLER 25 | 26 | // label_0000: 27 | // // Inputs[1] { @000B memory[0x00:0x05] } 28 | // 0000 60 PUSH1 0x05 29 | // 0002 60 PUSH1 0x0c 30 | // 0004 60 PUSH1 0x00 31 | // 0006 39 CODECOPY 32 | // 0007 60 PUSH1 0x05 33 | // 0009 60 PUSH1 0x00 34 | // 000B F3 *RETURN 35 | // // Stack delta = +0 36 | // // Outputs[2] 37 | // // { 38 | // // @0006 memory[0x00:0x05] = code[0x0c:0x11] 39 | // // @000B return memory[0x00:0x05]; 40 | // // } 41 | // // Block terminates 42 | // 43 | // 000C 60 PUSH1 0x00 44 | // 000E 60 PUSH1 0x00 45 | // 0010 F3 *RETURN 46 | 47 | // CODECOPY destOffset, offset, size 48 | // RETURN offset, size 49 | -------------------------------------------------------------------------------- /ignition/modules/credentialAtomicQueryMTPV2Validator.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const CredentialAtomicQueryMTPV2ValidatorProxyModule = buildModule( 9 | "CredentialAtomicQueryMTPV2ValidatorProxyModule", 10 | (m) => { 11 | const proxyAdminOwner = m.getAccount(0); 12 | 13 | // This contract is supposed to be deployed to the same address across many networks, 14 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 15 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 16 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 17 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 18 | 19 | const proxy = m.contract( 20 | "TransparentUpgradeableProxy", 21 | { 22 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 23 | contractName: "TransparentUpgradeableProxy", 24 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 25 | sourceName: "", 26 | linkReferences: {}, 27 | }, 28 | [ 29 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 30 | proxyAdminOwner, 31 | contractsInfo.VALIDATOR_MTP.create2Calldata, 32 | ], 33 | ); 34 | 35 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 36 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 37 | return { proxyAdmin, proxy }; 38 | }, 39 | ); 40 | -------------------------------------------------------------------------------- /ignition/modules/credentialAtomicQuerySigV2Validator.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const CredentialAtomicQuerySigV2ValidatorProxyModule = buildModule( 9 | "CredentialAtomicQuerySigV2ValidatorProxyModule", 10 | (m) => { 11 | const proxyAdminOwner = m.getAccount(0); 12 | 13 | // This contract is supposed to be deployed to the same address across many networks, 14 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 15 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 16 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 17 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 18 | 19 | const proxy = m.contract( 20 | "TransparentUpgradeableProxy", 21 | { 22 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 23 | contractName: "TransparentUpgradeableProxy", 24 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 25 | sourceName: "", 26 | linkReferences: {}, 27 | }, 28 | [ 29 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 30 | proxyAdminOwner, 31 | contractsInfo.VALIDATOR_SIG.create2Calldata, 32 | ], 33 | ); 34 | 35 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 36 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 37 | return { proxyAdmin, proxy }; 38 | }, 39 | ); 40 | -------------------------------------------------------------------------------- /ignition/modules/credentialAtomicQueryV3Validator.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const CredentialAtomicQueryV3ValidatorProxyModule = buildModule( 9 | "CredentialAtomicQueryV3ValidatorProxyModule", 10 | (m) => { 11 | const proxyAdminOwner = m.getAccount(0); 12 | 13 | // This contract is supposed to be deployed to the same address across many networks, 14 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 15 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 16 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 17 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 18 | 19 | const proxy = m.contract( 20 | "TransparentUpgradeableProxy", 21 | { 22 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 23 | contractName: "TransparentUpgradeableProxy", 24 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 25 | sourceName: "", 26 | linkReferences: {}, 27 | }, 28 | [ 29 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 30 | proxyAdminOwner, 31 | contractsInfo.VALIDATOR_V3.create2Calldata, 32 | ], 33 | ); 34 | 35 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 36 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 37 | return { proxyAdmin, proxy }; 38 | }, 39 | ); 40 | -------------------------------------------------------------------------------- /ignition/modules/ethIdentityValidator.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const EthIdentityValidatorModule = buildModule("EthIdentityValidatorModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.VALIDATOR_ETH_IDENTITY.create2Calldata, 30 | ], 31 | ); 32 | 33 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 34 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /ignition/modules/identityTreeStore.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const IdentityTreeStoreProxyModule = buildModule("IdentityTreeStoreProxyModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.IDENTITY_TREE_STORE.create2Calldata, 30 | ], 31 | ); 32 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 33 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 34 | 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /ignition/modules/linkedMultiQuery.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const LinkedMultiQueryProxyModule = buildModule("LinkedMultiQueryModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.VALIDATOR_LINKED_MULTI_QUERY.create2Calldata, 30 | ], 31 | ); 32 | 33 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 34 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /ignition/modules/mcPayment.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const MCPaymentProxyModule = buildModule("MCPaymentProxyModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.MC_PAYMENT.create2Calldata, 30 | ], 31 | ); 32 | 33 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 34 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 35 | 36 | return { proxyAdmin, proxy }; 37 | }); 38 | -------------------------------------------------------------------------------- /ignition/modules/state.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const StateProxyModule = buildModule("StateProxyModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.STATE.create2Calldata, 30 | ], 31 | ); 32 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 33 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 34 | 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /ignition/modules/universalVerifier.ts: -------------------------------------------------------------------------------- 1 | import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; 2 | import { 3 | contractsInfo, 4 | TRANSPARENT_UPGRADEABLE_PROXY_ABI, 5 | TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 6 | } from "../../helpers/constants"; 7 | 8 | export const UniversalVerifierProxyModule = buildModule("UniversalVerifierProxyModule", (m) => { 9 | const proxyAdminOwner = m.getAccount(0); 10 | 11 | // This contract is supposed to be deployed to the same address across many networks, 12 | // so the first implementation address is a dummy contract that does nothing but accepts any calldata. 13 | // Therefore, it is a mechanism to deploy TransparentUpgradeableProxy contract 14 | // with constant constructor arguments, so predictable init bytecode and predictable CREATE2 address. 15 | // Subsequent upgrades are supposed to switch this proxy to the real implementation. 16 | 17 | const proxy = m.contract( 18 | "TransparentUpgradeableProxy", 19 | { 20 | abi: TRANSPARENT_UPGRADEABLE_PROXY_ABI, 21 | contractName: "TransparentUpgradeableProxy", 22 | bytecode: TRANSPARENT_UPGRADEABLE_PROXY_BYTECODE, 23 | sourceName: "", 24 | linkReferences: {}, 25 | }, 26 | [ 27 | contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress, 28 | proxyAdminOwner, 29 | contractsInfo.UNIVERSAL_VERIFIER.create2Calldata, 30 | ], 31 | ); 32 | 33 | const proxyAdminAddress = m.readEventArgument(proxy, "AdminChanged", "newAdmin"); 34 | const proxyAdmin = m.contractAt("ProxyAdmin", proxyAdminAddress); 35 | return { proxyAdmin, proxy }; 36 | }); 37 | -------------------------------------------------------------------------------- /patches/@nomicfoundation+hardhat-ledger+1.0.3.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/@nomicfoundation/hardhat-ledger/dist/src/provider.js b/node_modules/@nomicfoundation/hardhat-ledger/dist/src/provider.js 2 | index caf192d..6e992c0 100644 3 | --- a/node_modules/@nomicfoundation/hardhat-ledger/dist/src/provider.js 4 | +++ b/node_modules/@nomicfoundation/hardhat-ledger/dist/src/provider.js 5 | @@ -102,7 +102,17 @@ class LedgerProvider extends chainId_1.ProviderWrapperWithChainId { 6 | return this._setOutputEnabled(params); 7 | } 8 | if (args.method === "eth_accounts") { 9 | - const accounts = (await this._wrappedProvider.request(args)); 10 | + let accounts; 11 | + // some rpcs return "the method has been deprecated: eth_accounts" error 12 | + try { 13 | + accounts = (await this._wrappedProvider.request(args)); 14 | + } catch (error) { 15 | + if (error.message.includes("eth_accounts")) { 16 | + accounts = []; 17 | + } else { 18 | + throw error; 19 | + } 20 | + } 21 | return [...accounts, ...this.options.accounts]; 22 | } 23 | if (this._methodRequiresSignature(args.method)) { 24 | @@ -241,6 +251,10 @@ class LedgerProvider extends chainId_1.ProviderWrapperWithChainId { 25 | if (txRequest.data !== undefined) { 26 | baseTx.data = (0, utils_1.toHex)(txRequest.data); 27 | } 28 | + // force legacy tx type if EIP-1559 fields are not present 29 | + if (!hasEip1559Fields) { 30 | + baseTx.type = 0; 31 | + } 32 | const txToSign = ethers_1.ethers.Transaction.from(baseTx).unsignedSerialized.substring(2); 33 | const resolution = await hw_app_eth_1.ledgerService.resolveTransaction(txToSign, {}, {}); 34 | const signature = await this._withConfirmation(() => this.eth.signTransaction(path, txToSign, resolution)); 35 | -------------------------------------------------------------------------------- /patches/README.md: -------------------------------------------------------------------------------- 1 | # Issue with zkEVM networks 2 | For supporting zkEVM networks we execute a patch in postinstall through `package.json` that patches hardhat-ledger plugin 3 | ``` 4 | "postinstall": "patch-package" 5 | ``` 6 | 7 | ## Patch fixes 8 | - `eth_accounts` it's not supported in zkEVM RPC or other chains. 9 | - Hardhat ledger plugin doesn't work with zkEVM and chains that doesn't support type `EIP-1559` transactions. 10 | -------------------------------------------------------------------------------- /scripts/deploy/deployCreate2AddressAnchor.ts: -------------------------------------------------------------------------------- 1 | import { ethers, ignition } from "hardhat"; 2 | import { Create2AddressAnchorModule } from "../../ignition/modules/create2AddressAnchor"; 3 | import { contractsInfo } from "../../helpers/constants"; 4 | 5 | async function main() { 6 | const [signer] = await ethers.getSigners(); 7 | 8 | const { create2AddressAnchor } = await ignition.deploy(Create2AddressAnchorModule, { 9 | strategy: "create2", 10 | defaultSender: await signer.getAddress(), 11 | }); 12 | 13 | const contractAddress = await create2AddressAnchor.getAddress(); 14 | if (contractAddress !== contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress) { 15 | throw Error( 16 | `The contract was supposed to be deployed to ${contractsInfo.CREATE2_ADDRESS_ANCHOR.unifiedAddress}, but it was deployed to ${contractAddress}`, 17 | ); 18 | } 19 | 20 | console.log(`Create2AddressAnchor deployed to: ${contractAddress}`); 21 | } 22 | 23 | main() 24 | .then(() => process.exit(0)) 25 | .catch((error) => { 26 | console.error(error); 27 | process.exit(1); 28 | }); 29 | -------------------------------------------------------------------------------- /scripts/deploy/deployCreateX.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "hardhat"; 2 | import { 3 | CREATEX_FACTORY_ADDRESS, 4 | SIGNED_SERIALISED_TRANSACTION_GAS_LIMIT_25000000, 5 | } from "../../helpers/constants"; 6 | 7 | async function main() { 8 | const [signer] = await ethers.getSigners(); 9 | 10 | await signer.sendTransaction({ 11 | to: "0xeD456e05CaAb11d66C4c797dD6c1D6f9A7F352b5", 12 | value: ethers.parseEther("100.0"), 13 | }); 14 | const provider = ethers.provider; 15 | const txResponse = await provider.broadcastTransaction(SIGNED_SERIALISED_TRANSACTION_GAS_LIMIT_25000000); 16 | 17 | await txResponse.wait(); 18 | 19 | const bytecode = await provider.getCode(CREATEX_FACTORY_ADDRESS); 20 | if (bytecode === "0x") { 21 | throw Error(`CreateX should've been deployed to ${CREATEX_FACTORY_ADDRESS} but it wasn't`); 22 | } else { 23 | console.log(`CreateX deployed to: ${CREATEX_FACTORY_ADDRESS}`); 24 | } 25 | } 26 | 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch((error) => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /scripts/deploy/deployIdentityExample.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | import { OnchainIdentityDeployHelper } from "../../helpers/OnchainIdentityDeployHelper"; 4 | import { DeployHelper } from "../../helpers/DeployHelper"; 5 | import { contractsInfo } from "../../helpers/constants"; 6 | const pathOutputJson = path.join(__dirname, "./deploy_identity_example_output.json"); 7 | import { getStateContractAddress } from "../../helpers/helperUtils"; 8 | 9 | async function main() { 10 | const stDeployHelper = await DeployHelper.initialize(); 11 | const { defaultIdType } = await stDeployHelper.getDefaultIdType(); 12 | 13 | const stateContractAddress = await getStateContractAddress(); 14 | 15 | const identityDeployHelper = await OnchainIdentityDeployHelper.initialize(); 16 | 17 | const contracts = await identityDeployHelper.deployIdentity( 18 | stateContractAddress, 19 | contractsInfo.SMT_LIB.unifiedAddress, 20 | contractsInfo.POSEIDON_3.unifiedAddress, 21 | contractsInfo.POSEIDON_4.unifiedAddress, 22 | defaultIdType, 23 | ); 24 | 25 | const identity = contracts.identity; 26 | 27 | const outputJson = { 28 | state: stateContractAddress, 29 | smtLib: contractsInfo.SMT_LIB.unifiedAddress, 30 | identity: await identity.getAddress(), 31 | poseidon1: contractsInfo.POSEIDON_1.unifiedAddress, 32 | poseidon2: contractsInfo.POSEIDON_2.unifiedAddress, 33 | poseidon3: contractsInfo.POSEIDON_3.unifiedAddress, 34 | poseidon4: contractsInfo.POSEIDON_4.unifiedAddress, 35 | network: process.env.HARDHAT_NETWORK, 36 | }; 37 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 38 | } 39 | 40 | main() 41 | .then(() => process.exit(0)) 42 | .catch((error) => { 43 | console.error(error); 44 | process.exit(1); 45 | }); 46 | -------------------------------------------------------------------------------- /scripts/deploy/deployIdentityTreeStore.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../helpers/DeployHelper"; 2 | import hre, { ethers } from "hardhat"; 3 | import path from "path"; 4 | import fs from "fs"; 5 | import { 6 | getChainId, 7 | getConfig, 8 | getStateContractAddress, 9 | verifyContract, 10 | } from "../../helpers/helperUtils"; 11 | import { contractsInfo } from "../../helpers/constants"; 12 | 13 | (async () => { 14 | const config = getConfig(); 15 | 16 | const chainId = await getChainId(); 17 | 18 | const stateContractAddress = await getStateContractAddress(); 19 | 20 | const deployStrategy: "basic" | "create2" = 21 | config.deployStrategy == "create2" ? "create2" : "basic"; 22 | const [signer] = await ethers.getSigners(); 23 | 24 | const deployHelper = await DeployHelper.initialize(null, true); 25 | 26 | const { identityTreeStore } = await deployHelper.deployIdentityTreeStore( 27 | stateContractAddress, 28 | contractsInfo.POSEIDON_2.unifiedAddress, 29 | contractsInfo.POSEIDON_3.unifiedAddress, 30 | deployStrategy, 31 | ); 32 | 33 | await verifyContract( 34 | await identityTreeStore.getAddress(), 35 | contractsInfo.IDENTITY_TREE_STORE.verificationOpts, 36 | ); 37 | 38 | const networkName = hre.network.name; 39 | const pathOutputJson = path.join( 40 | __dirname, 41 | `../deployments_output/deploy_identity_tree_store_output_${chainId}_${networkName}.json`, 42 | ); 43 | const outputJson = { 44 | proxyAdminOwnerAddress: await signer.getAddress(), 45 | identityTreeStore: await identityTreeStore.getAddress(), 46 | poseidon2ContractAddress: contractsInfo.POSEIDON_2.unifiedAddress, 47 | poseidon3ContractAddress: contractsInfo.POSEIDON_3.unifiedAddress, 48 | network: networkName, 49 | chainId, 50 | deployStrategy, 51 | }; 52 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 53 | })(); 54 | -------------------------------------------------------------------------------- /scripts/deploy/deployLibraries.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | import { getChainId, getConfig, verifyContract } from "../../helpers/helperUtils"; 4 | import { deployPoseidons } from "../../helpers/PoseidonDeployHelper"; 5 | import { DeployHelper } from "../../helpers/DeployHelper"; 6 | import hre from "hardhat"; 7 | import { contractsInfo } from "../../helpers/constants"; 8 | 9 | async function main() { 10 | const config = getConfig(); 11 | const deployStrategy: "basic" | "create2" = 12 | config.deployStrategy == "create2" ? "create2" : "basic"; 13 | 14 | const deployHelper = await DeployHelper.initialize(null, true); 15 | 16 | const [poseidon1Elements, poseidon2Elements, poseidon3Elements, poseidon4Elements] = 17 | await deployPoseidons([1, 2, 3, 4], deployStrategy); 18 | 19 | const smtLib = await deployHelper.deploySmtLib( 20 | await poseidon2Elements.getAddress(), 21 | await poseidon3Elements.getAddress(), 22 | contractsInfo.SMT_LIB.name, 23 | deployStrategy, 24 | ); 25 | 26 | await verifyContract(await smtLib.getAddress(), contractsInfo.SMT_LIB.verificationOpts); 27 | 28 | const chainId = await getChainId(); 29 | const networkName = hre.network.name; 30 | const outputJson = { 31 | poseidon1: await poseidon1Elements.getAddress(), 32 | poseidon2: await poseidon2Elements.getAddress(), 33 | poseidon3: await poseidon3Elements.getAddress(), 34 | poseidon4: await poseidon4Elements.getAddress(), 35 | smtLib: await smtLib.getAddress(), 36 | network: networkName, 37 | chainId, 38 | deployStrategy, 39 | }; 40 | 41 | const pathOutputJson = path.join( 42 | __dirname, 43 | `../deployments_output/deploy_libraries_output_${chainId}_${networkName}.json`, 44 | ); 45 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 46 | } 47 | 48 | main() 49 | .then(() => process.exit(0)) 50 | .catch((error) => { 51 | console.error(error); 52 | process.exit(1); 53 | }); 54 | -------------------------------------------------------------------------------- /scripts/deploy/deployMCPayment.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../helpers/DeployHelper"; 2 | import { getChainId, getConfig, verifyContract } from "../../helpers/helperUtils"; 3 | import { contractsInfo } from "../../helpers/constants"; 4 | import path from "path"; 5 | import hre from "hardhat"; 6 | import fs from "fs"; 7 | 8 | async function main() { 9 | const config = getConfig(); 10 | const deployStrategy: "basic" | "create2" = 11 | config.deployStrategy == "create2" ? "create2" : "basic"; 12 | 13 | const deployHelper = await DeployHelper.initialize(null, true); 14 | const { mcPayment } = await deployHelper.deployMCPayment(15, deployStrategy); 15 | await verifyContract(await mcPayment.getAddress(), contractsInfo.MC_PAYMENT.verificationOpts); 16 | 17 | const chainId = await getChainId(); 18 | const networkName = hre.network.name; 19 | const pathOutputJson = path.join( 20 | __dirname, 21 | `../deployments_output/deploy_mc_payment_output_${chainId}_${networkName}.json`, 22 | ); 23 | const outputJson = { 24 | mcPayment: await mcPayment.getAddress(), 25 | network: networkName, 26 | chainId: chainId, 27 | }; 28 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 29 | } 30 | 31 | main() 32 | .then(() => process.exit(0)) 33 | .catch((error) => { 34 | console.error(error); 35 | process.exit(1); 36 | }); 37 | -------------------------------------------------------------------------------- /scripts/deploy/deployPoseidon.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | import { deployPoseidonFacade } from "../../helpers/PoseidonDeployHelper"; 4 | import { getChainId, getConfig } from "../../helpers/helperUtils"; 5 | import hre from "hardhat"; 6 | 7 | async function main() { 8 | const config = getConfig(); 9 | const deployStrategy: "basic" | "create2" = 10 | config.deployStrategy == "create2" ? "create2" : "basic"; 11 | 12 | const deployInfo: any = []; 13 | const contracts = await deployPoseidonFacade(deployStrategy); 14 | deployInfo.push({ 15 | PoseidonFacade: await contracts.PoseidonFacade.getAddress(), 16 | PoseidonUnit1L: await contracts.PoseidonUnit1L.getAddress(), 17 | PoseidonUnit2L: await contracts.PoseidonUnit2L.getAddress(), 18 | PoseidonUnit3L: await contracts.PoseidonUnit3L.getAddress(), 19 | PoseidonUnit4L: await contracts.PoseidonUnit4L.getAddress(), 20 | PoseidonUnit5L: await contracts.PoseidonUnit5L.getAddress(), 21 | PoseidonUnit6L: await contracts.PoseidonUnit6L.getAddress(), 22 | SpongePoseidon: await contracts.SpongePoseidon.getAddress(), 23 | }); 24 | const chainId = await getChainId(); 25 | const networkName = hre.network.name; 26 | const outputJson = { 27 | info: deployInfo, 28 | network: networkName, 29 | chainId, 30 | deployStrategy, 31 | }; 32 | const pathOutputJson = path.join( 33 | __dirname, 34 | `../deployments_output/deploy_poseidon_facade_output_${chainId}_${networkName}.json`, 35 | ); 36 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 37 | } 38 | 39 | main() 40 | .then(() => process.exit(0)) 41 | .catch((error) => { 42 | console.error(error); 43 | process.exit(1); 44 | }); 45 | -------------------------------------------------------------------------------- /scripts/deploy/deployUniversalVerifier.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | import { DeployHelper } from "../../helpers/DeployHelper"; 4 | import hre, { ethers } from "hardhat"; 5 | import { 6 | getChainId, 7 | getConfig, 8 | getStateContractAddress, 9 | verifyContract, 10 | } from "../../helpers/helperUtils"; 11 | import { contractsInfo } from "../../helpers/constants"; 12 | 13 | async function main() { 14 | const config = getConfig(); 15 | const chainId = await getChainId(); 16 | 17 | const stateContractAddress = await getStateContractAddress(); 18 | const deployStrategy: "basic" | "create2" = 19 | config.deployStrategy == "create2" ? "create2" : "basic"; 20 | const [signer] = await ethers.getSigners(); 21 | 22 | const deployHelper = await DeployHelper.initialize(null, true); 23 | 24 | const { universalVerifier } = await deployHelper.deployUniversalVerifier( 25 | undefined, 26 | stateContractAddress, 27 | deployStrategy, 28 | // "UniversalVerifierTestWrapper_ManyResponsesPerUserAndRequest", 29 | ); 30 | 31 | await verifyContract( 32 | await universalVerifier.getAddress(), 33 | contractsInfo.UNIVERSAL_VERIFIER.verificationOpts, 34 | ); 35 | 36 | const networkName = hre.network.name; 37 | const pathOutputJson = path.join( 38 | __dirname, 39 | `../deployments_output/deploy_universal_verifier_output_${chainId}_${networkName}.json`, 40 | ); 41 | const outputJson = { 42 | proxyAdminOwnerAddress: await signer.getAddress(), 43 | universalVerifier: await universalVerifier.getAddress(), 44 | state: stateContractAddress, 45 | network: networkName, 46 | chainId, 47 | deployStrategy, 48 | }; 49 | fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); 50 | } 51 | 52 | main() 53 | .then(() => process.exit(0)) 54 | .catch((error) => { 55 | console.error(error); 56 | process.exit(1); 57 | }); 58 | -------------------------------------------------------------------------------- /scripts/deploy/deployVCPayment.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../helpers/DeployHelper"; 2 | import { getConfig, verifyContract } from "../../helpers/helperUtils"; 3 | import { contractsInfo } from "../../helpers/constants"; 4 | 5 | async function main() { 6 | const config = getConfig(); 7 | const deployStrategy: "basic" | "create2" = 8 | config.deployStrategy == "create2" ? "create2" : "basic"; 9 | 10 | const deployHelper = await DeployHelper.initialize(null, true); 11 | 12 | const { vcPayment } = await deployHelper.deployVCPayment(deployStrategy); 13 | 14 | await verifyContract(await vcPayment.getAddress(), contractsInfo.VC_PAYMENT.verificationOpts); 15 | } 16 | 17 | main() 18 | .then(() => process.exit(0)) 19 | .catch((error) => { 20 | console.error(error); 21 | process.exit(1); 22 | }); 23 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_cross_chain_verification_with_requests_output_1101_zkevm.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0x80203136fAe3111B810106bAa500231D4FD08FC6", 3 | "universalVerifierOwnerAddress": "0x80203136fAe3111B810106bAa500231D4FD08FC6", 4 | "state": "0xcFee2acB66671067f73191f6691A3b8E43D10137", 5 | "universalVerifier": "0xCBd1abaB16B0CFe829e8ea1DdF15c2a491A9DE45", 6 | "crossChainProofValidator": "0xD26D43bBf3FdcFc441dcA1dAAaB80bCdb1E050d6", 7 | "validatorSig": "0x9db901f3afdaaa73f5b2123b186f566fa3ed1551", 8 | "validatorMTP": "0x4be489fd4bd13c6b48dd70f1523d8275b4aa69be", 9 | "validatorV3": "0xea0c8dc57f61494338d4efc75b933357f972be97", 10 | "network": "zkevm", 11 | "chainId": 1101 12 | } 13 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_cross_chain_verification_with_requests_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": "0x975556428F077dB5877Ea2474D783D6C69233742", 3 | "verifier": "0xFfd47e5aCc8318852878fFe4Abc1681d64386E36", 4 | "stateLib": "0x433855AdB0D88e6340e28aAc5919E21B9B9F6252", 5 | "smtLib": "0x57390CC785D5Db8d0feafF8A8dF0b05d57DED001", 6 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 7 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 8 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 9 | "network": "privado-main", 10 | "chainId": 21000 11 | } 12 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_cross_chain_verification_with_requests_output_2442_cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0x0ef20f468D50289ed0394Ab34d54Da89DBc131DE", 3 | "universalVerifierOwnerAddress": "0x0ef20f468D50289ed0394Ab34d54Da89DBc131DE", 4 | "state": "0xD13BF1853346a97Fc62a7F7decE8dd83e444d66D", 5 | "universalVerifier": "0xF908a57c94353171B51e78654F09cd7bCF66B0C8", 6 | "crossChainProofValidator": "0xcDE0E51125B268320A951397454461F8F849e1C0", 7 | "validatorSig": "0xa5f08979370af7095cdedb2b83425367316fad0b", 8 | "validatorMTP": "0xeed5068ad8fecf0b9a91af730195fef9fab00356", 9 | "validatorV3": "0x7856f2cfefd1027bedec09dd70001d4e7f916f6d", 10 | "network": "cardona", 11 | "chainId": 2442 12 | } 13 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_cross_chain_verification_with_requests_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0x0ef20f468D50289ed0394Ab34d54Da89DBc131DE", 3 | "universalVerifierOwnerAddress": "0x0ef20f468D50289ed0394Ab34d54Da89DBc131DE", 4 | "state": "0x6B8e8E3806379f90e7a7dcA2Cfb3dbd6325F9a25", 5 | "universalVerifier": "0xcfe3f46048cb9dAa40c90fd574F6E1deB534b9e7", 6 | "crossChainProofValidator": "0x882E5d4f85b178d43500415C5c2A7099f3fDC1E6", 7 | "validatorSig": "0x932B85726B72050561bDd083816c97A667477800", 8 | "validatorMTP": "0x0bD2cEBA76FE52c03C780cd8f560A1190E4eB807", 9 | "validatorV3": "0x66575B6c2Ff0272fdba85fb741713eEc8a4eC1E8", 10 | "network": "linea-sepolia", 11 | "chainId": 59141 12 | } 13 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_cross_chain_verification_with_requests_output_80002_amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xFc8F850286C06ac5823687B88a21Cc99ec0128cb", 3 | "universalVerifierOwnerAddress": "0xFc8F850286C06ac5823687B88a21Cc99ec0128cb", 4 | "state": "0xDFF190bC887B5Bbae80BCa8999E54ea7d084026f", 5 | "universalVerifier": "0xB7487dDa8f0c465730fC715785743C459747bcbC", 6 | "crossChainProofValidator": "0xf8003ca05aE05177e8E3BeD7812F25F57A35A4FB", 7 | "validatorSig": "0x04dcEd2b96C72eD92f1F066592DBa2b7942d0f3B", 8 | "validatorMTP": "0x435A97C4653b768Eb7F01F780E2Da72213fB78d6", 9 | "validatorV3": "0xb53e2487ff38b59E183125E3cE79679005AbC7b2", 10 | "network": "amoy", 11 | "chainId": 80002 12 | } 13 | -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "zkevm-mainnet", 7 | "chainId": 1101, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "ethereum-sepolia", 7 | "chainId": 11155111, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "polygon-mainnet", 7 | "chainId": 137, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "ethereum-mainnet", 7 | "chainId": 1, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "privado-main", 7 | "chainId": 21000, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_21001_privado-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "privado-test", 7 | "chainId": 21001, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "zkevm-cardona", 7 | "chainId": 2442, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "linea-sepolia", 7 | "chainId": 59141, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "linea-mainnet", 7 | "chainId": 59144, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_identity_tree_store_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "identityTreeStore": "0x7dF78ED37d0B39Ffb6d4D527Bb1865Bf85B60f81", 4 | "poseidon2ContractAddress": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 5 | "poseidon3ContractAddress": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 6 | "network": "polygon-amoy", 7 | "chainId": 80002, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "zkevm-mainnet", 26 | "chainId": 1101, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "ethereum-sepolia", 26 | "chainId": 11155111, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "polygon-mainnet", 26 | "chainId": 137, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "ethereum-mainnet", 26 | "chainId": 1, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "privado-main", 26 | "chainId": 21000, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_21001_privado-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "privado-test", 26 | "chainId": 21001, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "zkevm-cardona", 26 | "chainId": 2442, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "linea-sepolia", 26 | "chainId": 59141, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "groth16verifiersInfo": [ 8 | { 9 | "verifierType": "mtpV2", 10 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 11 | }, 12 | { 13 | "verifierType": "sigV2", 14 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 15 | }, 16 | { 17 | "verifierType": "v3", 18 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 19 | }, 20 | { 21 | "validatorType": "stateTransition", 22 | "groth16verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71" 23 | } 24 | ], 25 | "network": "linea-mainnet", 26 | "chainId": 59144, 27 | "deployStrategy": "create2" 28 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_6913_billions-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "network": "billions-test", 8 | "chainId": 6913, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_libraries_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 3 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 4 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 5 | "poseidon4": "0x0695cF2c6dfc438a4E40508741888198A6ccacC2", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "network": "polygon-amoy", 8 | "chainId": 80002, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "zkevm-mainnet", 4 | "chainId": 1101 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "ethereum-sepolia", 4 | "chainId": 11155111 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "polygon-mainnet", 4 | "chainId": 137 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "ethereum-mainnet", 4 | "chainId": 1 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "zkevm-cardona", 4 | "chainId": 2442 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "linea-sepolia", 4 | "chainId": 59141 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "linea-mainnet", 4 | "chainId": 59144 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_mc_payment_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "mcPayment": "0xe317A4f1450116b2fD381446DEaB41c882D6136D", 3 | "network": "polygon-amoy", 4 | "chainId": 80002 5 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_poseidon_sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": [ 3 | { 4 | "PoseidonFacade": "0xb71158f3F50cFBD8dA00Bb1cB11053a9126C2093", 5 | "PoseidonUnit1L": "0x59293FE236e48A7924872300A8F28F6E8DF344F0", 6 | "PoseidonUnit2L": "0x5872b29F646F96962619223C623bf503476c7b0c", 7 | "PoseidonUnit3L": "0xbEeB6bB53504E8C872023451fd0D23BeF01d320B", 8 | "PoseidonUnit4L": "0xa0495df44ABBDbfCD1da30638869A3307BF21532", 9 | "PoseidonUnit5L": "0x8aB836b95b76B6fa2490bC691c9F7a169b07E3F0", 10 | "PoseidonUnit6L": "0xEF8540a5e0F4f53B436e7C3A273dCAe1C05d764D", 11 | "SpongePoseidon": "0x9D8240c35016a4656Ee22A74a425da662f9294dB" 12 | } 13 | ], 14 | "network": "sepolia" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "verifier": "0xB36C98728513a9D773b95db2815EcD9E325096eb", 5 | "stateLib": "0x241A2c2Bd2EBCC478B50e28ECA4e500A5a4b8736", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0x2473FC4139B6b157267c2b7098cd1727aa63C327", 8 | "crossChainProofValidator": "0x56479d71c8c7F4042b49F228b393879D339bB368", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "zkevm-mainnet", 13 | "chainId": 1101, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "verifier": "0x5582262b87cBCAC0479aD753798AbB440433Dc8C", 5 | "stateLib": "0x42Bdfa05945dB355D59fE0B65124e3636F7fEdB5", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0xFeF3960537D7a0954c9bc1a5C0CD0e29381b8993", 8 | "crossChainProofValidator": "0x430bC914AFC3Ae1271918339DdB501E41170a29C", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "ethereum-sepolia", 13 | "chainId": 11155111, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0x946d3D28f19702904CAb34c1391AEd9609D86C57", 5 | "stateCrossChainLib": "0xE2fEc1e232fd7D12404080824dccE800056FDD9b", 6 | "crossChainProofValidator": "0x71e7c0835737d8AB3BEc5a04d9a0be6D0a48622e", 7 | "network": "polygon-mainnet", 8 | "chainId": 137, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0x456Ae9a1cCE31e0b89927910Ee209c707726eC73", 5 | "stateCrossChainLib": "0xc504E928C513caDF8bDa93BF012cBFD61eFCA4ae", 6 | "crossChainProofValidator": "0x241A2c2Bd2EBCC478B50e28ECA4e500A5a4b8736", 7 | "network": "ethereum-mainnet", 8 | "chainId": 1, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0x241A2c2Bd2EBCC478B50e28ECA4e500A5a4b8736", 5 | "stateCrossChainLib": "0x2473FC4139B6b157267c2b7098cd1727aa63C327", 6 | "crossChainProofValidator": "0x56479d71c8c7F4042b49F228b393879D339bB368", 7 | "network": "privado-main", 8 | "chainId": 21000, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_21001_privado-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0x005668e8489B28C0c4C4B81b5DA2c1b3799745bF", 5 | "stateCrossChainLib": "0xB330d70FFE78c7c1a456BB841676Dc8419867134", 6 | "crossChainProofValidator": "0xb798dD8E55C44aaFBBF4E28b04AE830bD09d9D10", 7 | "network": "privado-test", 8 | "chainId": 21001, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71", 5 | "stateLib": "0x430bC914AFC3Ae1271918339DdB501E41170a29C", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0x6fba07d9777E145E163A2FEC94728861907A745D", 8 | "crossChainProofValidator": "0xeB9fEe616EAA3Bf74EB2bC8fa1D40d19315bbd8d", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "zkevm-cardona", 13 | "chainId": 2442, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "verifier": "0xAE950A9B8F48bC4519820728E210515a07F7cB71", 5 | "stateLib": "0xeae5373293A6b2c786870903C021aD0071689B7c", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0xeB9fEe616EAA3Bf74EB2bC8fa1D40d19315bbd8d", 8 | "crossChainProofValidator": "0x6982F7be5016C18Fae8915861085D72FA91a1863", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "linea-sepolia", 13 | "chainId": 59141, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0x456Ae9a1cCE31e0b89927910Ee209c707726eC73", 5 | "stateCrossChainLib": "0xc504E928C513caDF8bDa93BF012cBFD61eFCA4ae", 6 | "crossChainProofValidator": "0x241A2c2Bd2EBCC478B50e28ECA4e500A5a4b8736", 7 | "network": "linea-mainnet", 8 | "chainId": 59144, 9 | "deployStrategy": "create2" 10 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_6913_billions-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "stateLib": "0xBEba000A99c4d00706f46AC99aF06223BeF26d9a", 5 | "crossChainProofValidator": "0x55b9f84605B30Df9Bb9d817A6900219F25218157", 6 | "network": "billions-test", 7 | "chainId": 6913, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 4 | "verifier": "0xc504E928C513caDF8bDa93BF012cBFD61eFCA4ae", 5 | "stateLib": "0x2473FC4139B6b157267c2b7098cd1727aa63C327", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0x56479d71c8c7F4042b49F228b393879D339bB368", 8 | "crossChainProofValidator": "0x6661FFA2F49e3f1A7FCA37Cc2F08F86686cEDD36", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "polygon-amoy", 13 | "chainId": 80002, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_state_output_80002_polygon-amoy_upgrade.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0x0ef20f468D50289ed0394Ab34d54Da89DBc131DE", 3 | "state": "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124", 4 | "verifier": "0xf8d1E375D6b0d4EcCC411A04737544F2dA5f4dcF", 5 | "stateLib": "0x6472A2eb39BBc9b13801119EFFEBC3EC7b943062", 6 | "smtLib": "0x682364078e26C1626abD2B95109D2019E241F0F6", 7 | "stateCrossChainLib": "0x908f51a508711F81A1EE9D096400710a7ee81898", 8 | "crossChainProofValidator": "0x49C766eB4432D509A34FBe95955A2c7994F4aE71", 9 | "poseidon1": "0xC72D76D7271924a2AD54a19D216640FeA3d138d9", 10 | "poseidon2": "0x72F721D9D5f91353B505207C63B56cF3d9447edB", 11 | "poseidon3": "0x5Bc89782d5eBF62663Df7Ce5fb4bc7408926A240", 12 | "network": "polygon-amoy", 13 | "chainId": 80002, 14 | "deployStrategy": "create2" 15 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x99BcA0535e43e0F22496bee484DfC00D86A2042B", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "zkevm-mainnet", 7 | "chainId": 1101, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x22757926DBdF9270B553A4BA006a2c0E6Ad7e49E", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "ethereum-sepolia", 7 | "chainId": 11155111, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0xD0aa75DC173F6d824608743F236038a2E1c34E09", 5 | "state": "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D", 6 | "network": "polygon-mainnet", 7 | "chainId": 137, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x225615E26a8173726CB3557AF0e186d969F3747B", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "ethereum-mainnet", 7 | "chainId": 1, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0xad6ceC221704aef314911D4B58e084aaF9A6999f", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "privado-main", 7 | "chainId": 21000, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_21001_privado-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x50E8592B259c512aC2FfA1b26b9cE3dF5FC45821", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "privado-test", 7 | "chainId": 21001, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x92679aBbb05b8ca932Ef8f68D30B524d9A79116f", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "zkevm-cardona", 7 | "chainId": 2442, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0xEDAd75bb3594e36A504DA7989742de686c095C25", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "linea-sepolia", 7 | "chainId": 59141, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x225615E26a8173726CB3557AF0e186d969F3747B", 5 | "state": "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896", 6 | "network": "linea-mainnet", 7 | "chainId": 59144, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_universal_verifier_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "universalVerifier": "0xfcc86A79fCb057A8e55C6B853dff9479C3cf607c", 4 | "verifierLib": "0x2FAa40562E135B1643BD204bA30a260477DDDefF", 5 | "state": "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124", 6 | "network": "polygon-amoy", 7 | "chainId": 80002, 8 | "deployStrategy": "create2" 9 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_1101_zkevm-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "v3", 6 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 7 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 8 | } 9 | ], 10 | "network": "zkevm-mainnet", 11 | "chainId": 1101 12 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_11155111_ethereum-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "v3", 6 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 7 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 8 | } 9 | ], 10 | "network": "ethereum-sepolia", 11 | "chainId": 11155111 12 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_137_polygon-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "polygon-mainnet", 21 | "chainId": 137, 22 | "deployStrategy": "create2" 23 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_1_ethereum-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "ethereum-mainnet", 21 | "chainId": 1, 22 | "deployStrategy": "create2" 23 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_21000_privado-main.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "privado-main", 21 | "chainId": 21000, 22 | "deployStrategy": "create2" 23 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_21001_privado-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "privado-test", 21 | "chainId": 21001, 22 | "deployStrategy": "create2" 23 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_2442_zkevm-cardona.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "zkevm-cardona", 21 | "chainId": 2442 22 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_59141_linea-sepolia.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "sigV2", 6 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 7 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 8 | } 9 | ], 10 | "network": "linea-sepolia", 11 | "chainId": 59141 12 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_59144_linea-mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "mtpV2", 6 | "validator": "0x27bDFFCeC5478a648f89764E22fE415486A42Ede", 7 | "groth16verifier": "0x1205B90121cAbB2B7e6f1828005AC00D8927796F" 8 | }, 9 | { 10 | "validatorType": "sigV2", 11 | "validator": "0x59B347f0D3dd4B98cc2E056Ee6C53ABF14F8581b", 12 | "groth16verifier": "0x0ce200c9557BB64ee9E82452646b084e77Aaeb51" 13 | }, 14 | { 15 | "validatorType": "v3", 16 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 17 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 18 | } 19 | ], 20 | "network": "linea-mainnet", 21 | "chainId": 59144, 22 | "deployStrategy": "create2" 23 | } -------------------------------------------------------------------------------- /scripts/deployments_output/deploy_validators_output_80002_polygon-amoy.json: -------------------------------------------------------------------------------- 1 | { 2 | "proxyAdminOwnerAddress": "0xAe15d2023A76174a940cbb2b7F44012C728B9d74", 3 | "validatorsInfo": [ 4 | { 5 | "validatorType": "v3", 6 | "validator": "0xd179f29d00Cd0E8978eb6eB847CaCF9E2A956336", 7 | "groth16verifier": "0x1aA2B5AEAd506D269164958d36Cae04f95F79282" 8 | } 9 | ], 10 | "network": "polygon-amoy", 11 | "chainId": 80002 12 | } -------------------------------------------------------------------------------- /scripts/maintenance/checkContractsVerificationManually.ts: -------------------------------------------------------------------------------- 1 | import { verifyContract } from "../../helpers/helperUtils"; 2 | import { contractsInfo } from "../../helpers/constants"; 3 | 4 | async function main() { 5 | const StateLibAddress: string = ""; 6 | const StateAddress: string = ""; 7 | 8 | if (StateAddress.includes("0x")) { 9 | await verifyContract(StateAddress, contractsInfo.STATE.verificationOpts); 10 | } 11 | 12 | if (StateLibAddress.includes("0x")) { 13 | await verifyContract(StateLibAddress, contractsInfo.STATE_LIB.verificationOpts); 14 | } 15 | } 16 | 17 | main() 18 | .then(() => process.exit(0)) 19 | .catch((error) => { 20 | console.error(error); 21 | process.exit(1); 22 | }); 23 | -------------------------------------------------------------------------------- /scripts/maintenance/checkEmbeddedZKPVerifier.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iden3/contracts/d29c4a254cdbe9fd39bebe1e588a415b324444cd/scripts/maintenance/checkEmbeddedZKPVerifier.ts -------------------------------------------------------------------------------- /scripts/maintenance/checkUnifiedContractsVerification.ts: -------------------------------------------------------------------------------- 1 | import { getStateContractAddress, Logger, verifyContract } from "../../helpers/helperUtils"; 2 | import { contractsInfo } from "../../helpers/constants"; 3 | 4 | async function main() { 5 | const contractsNotVerified: string[] = []; 6 | const contractsVerified: string[] = []; 7 | for (const property in contractsInfo) { 8 | if (contractsInfo[property].unifiedAddress !== "" && contractsInfo[property].verificationOpts) { 9 | let contractAddress = contractsInfo[property].unifiedAddress; 10 | if (property === "STATE") { 11 | contractAddress = await getStateContractAddress(); 12 | } 13 | if (await verifyContract(contractAddress, contractsInfo[property].verificationOpts)) { 14 | contractsVerified.push(property); 15 | } else { 16 | contractsNotVerified.push(property); 17 | } 18 | } 19 | } 20 | if (contractsVerified.length > 0) { 21 | Logger.success( 22 | `${contractsVerified.length} contracts are verified: ${contractsVerified.map((property) => contractsInfo[property].name).join(", ")}`, 23 | ); 24 | } 25 | if (contractsNotVerified.length > 0) { 26 | Logger.error( 27 | `${contractsNotVerified.length} contracts are not verified: ${contractsNotVerified.map((property) => contractsInfo[property].name).join(", ")}`, 28 | ); 29 | } 30 | } 31 | 32 | main() 33 | .then(() => process.exit(0)) 34 | .catch((error) => { 35 | console.error(error); 36 | process.exit(1); 37 | }); 38 | -------------------------------------------------------------------------------- /scripts/maintenance/computeCreate2Address.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "hardhat"; 2 | 3 | async function main() { 4 | const byteCode = ""; 5 | const salt = "0x000000000000000000000000000000000000000000f4179bc3e4988a1a06f8d1"; // Replace your salt here; 6 | const create2Deployer = "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed"; // This is deployer address for CreateX in every network 7 | 8 | const create2ContractAddress = ethers.getCreate2Address( 9 | create2Deployer, 10 | ethers.keccak256(salt), 11 | ethers.keccak256(byteCode), 12 | ); 13 | 14 | console.log("Create2 computed address:", create2ContractAddress); 15 | } 16 | 17 | main() 18 | .then(() => process.exit(0)) 19 | .catch((error) => { 20 | console.error(error); 21 | process.exit(1); 22 | }); 23 | -------------------------------------------------------------------------------- /scripts/maintenance/disableProxyContract.ts: -------------------------------------------------------------------------------- 1 | import hre, { ethers, upgrades } from "hardhat"; 2 | import { expect } from "chai"; 3 | import { contractsInfo } from "../../helpers/constants"; 4 | 5 | // !!!!! Get proper contract address and name, e.g. contractsInfo.STATE.unifiedAddress !!!!! 6 | const contractAddress = ""; 7 | 8 | async function main() { 9 | // Put proper contract name here, e.g. contractsInfo.STATE.name 10 | const contractName = ""; 11 | 12 | const contract = await ethers.getContractAt(contractName, contractAddress); 13 | 14 | const alwaysRevertFactory = await ethers.getContractFactory("AlwaysRevert"); 15 | const c = await upgrades.upgradeProxy(contract, alwaysRevertFactory, { 16 | unsafeSkipStorageCheck: true, 17 | }); 18 | await c.waitForDeployment(); 19 | 20 | console.log("Waiting 20 seconds after contract deployment and before sanity check..."); 21 | await new Promise((resolve) => setTimeout(resolve, 20000)); 22 | 23 | // !!!!! Put proper function name here to make some check, e.g. getDefaultIdType() for State contract !!!!! 24 | await expect(contract.getDefaultIdType()).to.be.revertedWithCustomError( 25 | contract, 26 | "TheContractIsDisabled", 27 | ); 28 | 29 | const network = hre.network.name; 30 | console.log( 31 | `The contract ${contractName} at ${contractAddress} on network ${network} is disabled`, 32 | ); 33 | } 34 | 35 | main() 36 | .then(() => process.exit(0)) 37 | .catch((error) => { 38 | console.error(error); 39 | process.exit(1); 40 | }); 41 | -------------------------------------------------------------------------------- /scripts/maintenance/prepare-contracts-package.js: -------------------------------------------------------------------------------- 1 | const util = require("util"); 2 | const exec = util.promisify(require("child_process").exec); 3 | 4 | const buildFolder = "build"; 5 | 6 | const commands = [ 7 | { 8 | name: "Clean Hardhat", 9 | command: "npx hardhat clean", 10 | }, 11 | { 12 | name: "Compile Hardhat", 13 | command: "npx hardhat compile", 14 | }, 15 | { 16 | name: `Delete ${buildFolder} folder`, 17 | command: `rm -rf ${buildFolder}`, 18 | }, 19 | { 20 | name: `Create ${buildFolder} folder`, 21 | command: `mkdir ${buildFolder}`, 22 | }, 23 | { 24 | name: `Create ${buildFolder}/contracts folder`, 25 | command: `mkdir ${buildFolder}/contracts`, 26 | }, 27 | { 28 | name: "Copy artifacts", 29 | command: `find ../artifacts/contracts -type f -name "*.json" ! -name "*dbg.json" ! -path "../artifacts/contracts/test-helpers/*" -exec cp {} "${buildFolder}/contracts" \\;`, 30 | }, 31 | ]; 32 | 33 | async function preparePackage() { 34 | for (const command of commands) { 35 | console.log(`Running: ${command.name}`); 36 | const { stdout, stderr } = await exec(command.command); 37 | console.log(command.command) 38 | stdout && console.log("stdout:", stdout); 39 | stderr && console.log("stderr:", stderr); 40 | } 41 | } 42 | 43 | preparePackage().catch((error) => { 44 | console.error(error); 45 | process.exit(1); 46 | }); 47 | -------------------------------------------------------------------------------- /scripts/maintenance/setOracleSigningAddress.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "hardhat"; 2 | import { contractsInfo, ORACLE_SIGNING_ADDRESS_PRODUCTION } from "../../helpers/constants"; 3 | import { getStateContractAddress } from "../../helpers/helperUtils"; 4 | 5 | async function main() { 6 | const oracleSigningAddress = ORACLE_SIGNING_ADDRESS_PRODUCTION; // production signing address 7 | 8 | const stateContractAddress = await getStateContractAddress(); 9 | const state = await ethers.getContractAt(contractsInfo.STATE.name, stateContractAddress); 10 | const crossChainProofValidatorAddress = await state.getCrossChainProofValidator(); 11 | console.log(`CrossChainProofValidator address: ${crossChainProofValidatorAddress}`); 12 | 13 | const crossChainProofValidator = await ethers.getContractAt( 14 | contractsInfo.CROSS_CHAIN_PROOF_VALIDATOR.name, 15 | crossChainProofValidatorAddress, 16 | ); 17 | const tx = await crossChainProofValidator.setOracleSigningAddress(oracleSigningAddress); 18 | 19 | console.log( 20 | `Tx ${tx.hash} set oracle signing address to ${oracleSigningAddress} in CrossChainProofValidator contract ${await crossChainProofValidator.getAddress()}`, 21 | ); 22 | } 23 | 24 | main() 25 | .then(() => process.exit(0)) 26 | .catch((error) => { 27 | console.error(error); 28 | process.exit(1); 29 | }); 30 | -------------------------------------------------------------------------------- /scripts/maintenance/verifyEtherescan.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const hre = require("hardhat"); 3 | const { expect } = require("chai"); 4 | const { ethers } = require("hardhat"); 5 | 6 | const openzeppelinUpgrade = require( 7 | `../../.openzeppelin/polygon-${process.env.HARDHAT_NETWORK}.json`, 8 | ); 9 | 10 | async function main() { 11 | // verify verifier 12 | // try { 13 | // // verify governance 14 | // await hre.run("verify:verify", 15 | // { 16 | // address: deployOutputParameters.verifier, 17 | // } 18 | // ); 19 | // } catch (error) { 20 | // expect(error.message.toLowerCase().includes("already verified")).to.be.equal(true); 21 | // } 22 | 23 | // verify implementation 24 | for (const property in openzeppelinUpgrade.impls) { 25 | const address = openzeppelinUpgrade.impls[property].address; 26 | try { 27 | await hre.run("verify:verify", { address }); 28 | } catch (error) { 29 | console.log(error.message); 30 | //expect(error.message.toLowerCase().includes("already verified")).to.be.equal(true); 31 | } 32 | } 33 | } 34 | 35 | main() 36 | .then(() => process.exit(0)) 37 | .catch((error) => { 38 | console.error(error); 39 | process.exit(1); 40 | }); 41 | -------------------------------------------------------------------------------- /scripts/upgrade/input-params.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": { 3 | "commit": "2b45246c7a674c1a824ddd599b0be7e154fa66fb", 4 | "abiPath": "state/StateV2.sol/StateV2.json", 5 | "deployScript": "scripts/deploy.ts", 6 | "outputContractName": "state", 7 | "unitTestFile": "test/upgrade/state-upgrade.test.ts" 8 | } 9 | } -------------------------------------------------------------------------------- /scripts/upgrade/state/outdated/state-upgrade.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../../../helpers/DeployHelper"; 2 | import { ethers } from "hardhat"; 3 | import { StateContractMigrationHelper } from "../../../../helpers/StateContractMigrationHelper"; 4 | import fs from "fs"; 5 | import { Contract } from "ethers"; 6 | 7 | /* 8 | 1. add migration specific transactions (init new state etc..) 9 | 2. run deploy-from-commit.sh with commit of previously deployed contract 10 | 3. add contract addtess in `stateContractAddress` variable 11 | 4. run this script 12 | */ 13 | 14 | async function main() { 15 | const signers = await ethers.getSigners(); 16 | const stateDeployHelper = await DeployHelper.initialize(null, true); 17 | const stateContractMigrationHelper = new StateContractMigrationHelper(stateDeployHelper, signers[0]); 18 | const network = process.env.HARDHAT_NETWORK; 19 | 20 | const oldContractABI = []; // abi of contract that will be upgraded 21 | const stateContractAddress = ""; // address of contract that will be upgraded 22 | const stateContractInstance = await stateContractMigrationHelper.getInitContract({ 23 | contractNameOrAbi: oldContractABI, 24 | address: stateContractAddress, 25 | }); 26 | 27 | const { state } = await stateContractMigrationHelper.upgradeContract(stateContractInstance); 28 | 29 | console.log("Contract Upgrade Finished"); 30 | } 31 | 32 | main() 33 | .then(() => process.exit(0)) 34 | .catch((error) => { 35 | console.error(error); 36 | process.exit(1); 37 | }); 38 | -------------------------------------------------------------------------------- /scripts/upgrade/state/outdated/upgrade-test-def-id-type.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../../../helpers/DeployHelper"; 2 | import { ethers, network } from "hardhat"; 3 | import { StateContractMigrationHelper } from "../../../../helpers/StateContractMigrationHelper"; 4 | 5 | import { chainIdInfoMap } from "../../../../helpers/constants"; 6 | /* 7 | 1. deploy State to mumbai from feature/state-v3 branch 8 | 2. run transit-state script 9 | 3. cp .openzeppelin/* ../../contracts/.openzeppelin/ 10 | 4. update addreess and block number in data 11 | 5. run this script 12 | */ 13 | 14 | async function main() { 15 | 16 | const signers = await ethers.getSigners(); 17 | const stateDeployHelper = await DeployHelper.initialize(null, true); 18 | const stateContractMigrationHelper = new StateContractMigrationHelper(stateDeployHelper, signers[0]); 19 | 20 | const oldContractABI = []; // abi of contract that will be upgraded 21 | const stateContractAddress = ""; // address of contract that will be upgraded 22 | const stateContractInstance = await stateContractMigrationHelper.getInitContract({ 23 | contractNameOrAbi: oldContractABI, 24 | address: stateContractAddress, 25 | }); 26 | 27 | const { state } = await stateContractMigrationHelper.upgradeContract(stateContractInstance); 28 | const { defaultIdType } = await stateDeployHelper.getDefaultIdType(); 29 | console.log(`Setting value for _defaultIdType = ${defaultIdType}`); 30 | const tx = await state.setDefaultIdType(defaultIdType); 31 | const receipt = await tx.wait(); 32 | const contractDefIdType = await state.getDefaultIdType(); 33 | console.assert(contractDefIdType.toString() === defaultIdType.toString(), "default id type wasn't initialized"); 34 | console.log("Contract Upgrade Finished"); 35 | } 36 | 37 | main() 38 | .then(() => process.exit(0)) 39 | .catch((error) => { 40 | console.error(error); 41 | process.exit(1); 42 | }); 43 | -------------------------------------------------------------------------------- /scripts/upgrade/upgrade-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #get params from input file 4 | commit=$(jq .$1.commit scripts/upgrade/input-params.json | sed 's/"//g') 5 | deployScript=$(jq .$1.deployScript scripts/upgrade/input-params.json | sed 's/"//g') 6 | abiPath=$(jq .$1.abiPath scripts/upgrade/input-params.json | sed 's/"//g') 7 | outputContractName=$(jq .$1.outputContractName scripts/upgrade/input-params.json | sed 's/"//g') 8 | unitTestFile=$(jq .$1.unitTestFile scripts/upgrade/input-params.json | sed 's/"//g') 9 | 10 | #store current branch 11 | currBranch=$(git rev-parse --abbrev-ref HEAD) 12 | 13 | #checkout to prev commit & compile and deploy State contract 14 | git checkout $commit 15 | npx hardhat compile 16 | npx hardhat run --network localhost $deployScript 17 | 18 | #store abi to file & deployed contract address 19 | abi=$(jq .abi artifacts/contracts/$abiPath) 20 | contract_addr=$(jq .$outputContractName scripts/deploy_output.json | sed 's/"//g') 21 | 22 | #move back to branch & prepare and run upgrade unit test 23 | git checkout $currBranch 24 | npx hardhat compile 25 | 26 | echo $abi > scripts/upgrade/$1/abi-$commit.json 27 | 28 | 29 | output=$(jq --null-input \ 30 | --arg oldContractAddress "$contract_addr" \ 31 | --arg commit "$commit" \ 32 | '{"oldContractAddress": $oldContractAddress, "commit": $commit}') 33 | echo $output > scripts/upgrade/$1/output.json 34 | 35 | #run unit test upgrade 36 | npx hardhat test $unitTestFile --network localhost -------------------------------------------------------------------------------- /scripts/upgrade/verifiers/README.md: -------------------------------------------------------------------------------- 1 | # Upgrading Universal Verifier 2 | In order to test verification after upgrade, there is a check test for `submitZKPResponse` and `submitZKPResponseV2` functions of the Universal Verifier. 3 | For this test we use `js-sdk` and we need to download circuits for the verification. 4 | 5 | The verifier upgrade script executes: 6 | - Upgrade State contract 7 | - Upgrade Universal Verifier contract 8 | - Test verification for a requestId from user that has a KYCAgeCredential generated from an issuer in the same network of the deployment. 9 | 10 | ## Steps to execute the upgrade script 11 | 12 | 1. Download the zk circuits into `./circuits` by running `dl_circuits.sh`. This will download the latest files from `https://iden3-circuits-bucket.s3.eu-west-1.amazonaws.com/latest.zip` 13 | 14 | ```bash 15 | ./dl_circuits.sh 16 | ``` 17 | 2. Configure the network you want to upgrade in `hardhat.config.ts` and execute upgrade script. 18 | Example in amoy: 19 | ```bash 20 | npx hardhat run scripts/upgrade/verifiers/universal-verifier-upgrade.ts --network amoy 21 | ``` 22 | -------------------------------------------------------------------------------- /scripts/upgrade/verifiers/helpers/dl_circuits.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Download the latest.zip file 4 | curl -LO https://iden3-circuits-bucket.s3.eu-west-1.amazonaws.com/latest.zip 5 | 6 | # Unzip the file into ./circuits 7 | unzip -d ./circuits latest.zip 8 | 9 | # remove the zip file 10 | rm latest.zip -------------------------------------------------------------------------------- /slither.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude_informational": false, 3 | "exclude_low": false, 4 | "exclude_medium": false, 5 | "exclude_high": false, 6 | "disable_color": false, 7 | "filter_paths": "(node_modules/|contracts/state/State_migraton.sol)", 8 | "legacy_ast": false 9 | } 10 | -------------------------------------------------------------------------------- /test/disable-proxy.test.ts: -------------------------------------------------------------------------------- 1 | import { ethers, upgrades } from "hardhat"; 2 | import { expect } from "chai"; 3 | 4 | // dummy proof 5 | const d = [ 6 | [0, 0], 7 | [ 8 | [0, 0], 9 | [0, 0], 10 | ], 11 | [0, 0], 12 | [0, 0, 0, 0], 13 | ]; 14 | 15 | describe("Disable Proxy Contract test", async () => { 16 | it("Should disable and enable proxy contract", async () => { 17 | const verifierStubFactory = await ethers.getContractFactory("Groth16VerifierStub"); 18 | const verifier = await upgrades.deployProxy(verifierStubFactory, { kind: "transparent" }); 19 | await expect(verifier.verifyProof(d[0], d[1], d[2], d[3])).not.to.be.reverted; 20 | 21 | const alwaysRevertFactory = await ethers.getContractFactory("AlwaysRevert"); 22 | await upgrades.upgradeProxy(await verifier.getAddress(), alwaysRevertFactory); 23 | await expect(verifier.verifyProof(d[0], d[1], d[2], d[3])).to.be.rejectedWith( 24 | "TheContractIsDisabled()", 25 | ); 26 | 27 | await upgrades.upgradeProxy(await verifier.getAddress(), verifierStubFactory); 28 | await expect(verifier.verifyProof(d[0], d[1], d[2], d[3])).not.to.be.reverted; 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /test/integration-tests/data/user_claim_issued_on_userid_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23273167900576580892722615617815475823351560716009055944677723144398443009", 4 | "5163501582380794606957519356304223666405959765481558471633650858228490409290", 5 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 6 | "20336008450539684768013573494073798243349685857640613070314041678185349736439", 7 | "0", 8 | "0", 9 | "1", 10 | "41", 11 | "583091486781463398742321306787801699791102451699", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 15 | "1642074362", 16 | "1" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "19669163552065605232226440325758625657636624385583277995594891950486344866508", 21 | "10711637643378840554760385822550851249555527485204302585948254974040755477609", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "2876377569478858706516978096403208510392181149089058781420525859804877516279", 27 | "9515133907790273150201355935211769526767866212205498667361695701553682353137" 28 | ], 29 | [ 30 | "14869390077573764384106112054362589649141652233556283316748964628563711405904", 31 | "1151936578002145346443589143139936031757296603439509995084143527963932212544" 32 | ], 33 | ["1", "0"] 34 | ], 35 | "pi_c": [ 36 | "18589419753357207419833045626873608018236514226418635490877679898608141092303", 37 | "4377014052512563002949775596611087745477480197663974829547855257127755207594", 38 | "1" 39 | ], 40 | "protocol": "groth16", 41 | "curve": "bn128" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/integration-tests/data/user_genesis_auth.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23273167900576580892722615617815475823351560716009055944677723144398443009", 4 | "5212973139745638668633720237501954966656555739014896868936311397139229290378", 5 | "0" 6 | ], 7 | "proof": { 8 | "pi_a": [ 9 | "1238064536595227341390695164336084541847939190316067358993916901940214723234", 10 | "15799255647621631452959766830308132916683864863600158271743280920118665788588", 11 | "1" 12 | ], 13 | "pi_b": [ 14 | [ 15 | "17670400722045843961660874132388709522679013234267198690084857080641983583843", 16 | "5287730570087617132913682200031155642104951958077715792787827776465000719881" 17 | ], 18 | [ 19 | "6075263630519803963226139789246602077914731950499703659787166643095603330195", 20 | "7938053062178962435112746593441459158641110827412215757397151271877979765565" 21 | ], 22 | ["1", "0"] 23 | ], 24 | "pi_c": [ 25 | "21010592776578764547907351859929622777512296832984420047235514552228625464856", 26 | "18192765798069122918377413910327891618012999130269311083464781452775699686570", 27 | "1" 28 | ], 29 | "protocol": "groth16", 30 | "curve": "bn128" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/integration-tests/data/user_genesis_auth_challenge_invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23273167900576580892722615617815475823351560716009055944677723144398443009", 4 | "2378043419791432977129888049610162411300945363341716024701363947598560258096", 5 | "0" 6 | ], 7 | "proof": { 8 | "pi_a": [ 9 | "9541867327348938145541193982123992297208138293358805560483945427733735306124", 10 | "13833819619741404300235158867440476234063725794567625680704749737959767863116", 11 | "1" 12 | ], 13 | "pi_b": [ 14 | [ 15 | "20359745551134549335223867766905772056177316525265757287933840985984292914937", 16 | "1780864031735933858234307839702997430255911747389589653941781093680324195492" 17 | ], 18 | [ 19 | "12080937648102594742202930954953883943640192768810066345568670629167309979739", 20 | "13280726496624428913315243268401447342745276267258692974299666120924393078428" 21 | ], 22 | ["1", "0"] 23 | ], 24 | "pi_c": [ 25 | "12131738695386235649587882341686961353232752515854843634252155993701923991681", 26 | "18949649035566368476284982950769667836111086011759734792131512893325609072891", 27 | "1" 28 | ], 29 | "protocol": "groth16", 30 | "curve": "bn128" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/integration-tests/data/user_linked_multi_query.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "20336008450539684768013573494073798243349685857640613070314041678185349736439", 4 | "1", 5 | "0", 6 | "0", 7 | "0", 8 | "0", 9 | "0", 10 | "0", 11 | "0", 12 | "0", 13 | "0", 14 | "0", 15 | "3326382892536126749483088946048689911243394580824744244053752370464747528203", 16 | "9907132056133666096701539062450765284880813426582692863734448403438789333698", 17 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 18 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 19 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 20 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 21 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 22 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 23 | "13362042977965885903820557513534065802896288300017199700677633721405805677442", 24 | "13362042977965885903820557513534065802896288300017199700677633721405805677442" 25 | ], 26 | "proof": { 27 | "pi_a": [ 28 | "10541909102768476058347747538132221338909944796214430823937430621918433820572", 29 | "12998271972533338175505729586393778918022420191938730276405884463074788961369", 30 | "1" 31 | ], 32 | "pi_b": [ 33 | [ 34 | "21786734761872104002981387083471529709973058267263166350818620656227477577301", 35 | "6784160731236418180364992784613101482914038854158831514386379008042983363743" 36 | ], 37 | [ 38 | "17941889499361474971416705471447893349857158046615762117348229875623276791888", 39 | "5989944269623828035204132704907772907469171386995335116029892218132563943912" 40 | ], 41 | ["1", "0"] 42 | ], 43 | "pi_c": [ 44 | "17192623970124500187048482626581622763069786710232775241298788913349580516363", 45 | "17848067197475549139335038191779648120820902475170770311958006870826316291138", 46 | "1" 47 | ], 48 | "protocol": "groth16", 49 | "curve": "bn128" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /test/onchain-identity/claim.ts: -------------------------------------------------------------------------------- 1 | export interface ClaimData { 2 | schemaHash: bigint; 3 | idPosition: number; 4 | expirable: boolean; 5 | updatable: boolean; 6 | merklizedRootPosition: number; 7 | version: number; 8 | id: bigint; 9 | revocationNonce: number; 10 | expirationDate: number; 11 | merklizedRoot: bigint; 12 | indexDataSlotA: bigint; 13 | indexDataSlotB: bigint; 14 | valueDataSlotA: bigint; 15 | valueDataSlotB: bigint; 16 | }; 17 | -------------------------------------------------------------------------------- /test/onchain-identity/vectorsGen/go.mod: -------------------------------------------------------------------------------- 1 | module vectorsGenClaimBuilder 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/iden3/go-iden3-core v1.0.2 7 | github.com/kr/pretty v0.1.0 // indirect 8 | github.com/stretchr/testify v1.8.2 9 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /test/poseidon/vectorsGen/go.mod: -------------------------------------------------------------------------------- 1 | module vectorsGen 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/iden3/go-iden3-crypto v0.0.13 7 | github.com/iden3/go-merkletree-sql v1.0.1 8 | github.com/stretchr/testify v1.7.0 9 | ) 10 | 11 | require ( 12 | github.com/davecgh/go-spew v1.1.0 // indirect 13 | github.com/dchest/blake512 v1.0.0 // indirect 14 | github.com/pmezard/go-difflib v1.0.0 // indirect 15 | golang.org/x/crypto v0.17.0 // indirect 16 | golang.org/x/sys v0.15.0 // indirect 17 | gopkg.in/yaml.v3 v3.0.0 // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /test/reverseHash/reverseHash.test.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "hardhat"; 2 | import { expect } from "chai"; 3 | import { deployPoseidons } from "../../helpers/PoseidonDeployHelper"; 4 | import { poseidon } from "@iden3/js-crypto"; 5 | 6 | describe("ReverseHashWrapper", function () { 7 | let reverseHashWrapper; 8 | 9 | beforeEach(async function () { 10 | const [poseidon2Elements, poseidon3Elements] = await deployPoseidons([2, 3]); 11 | 12 | const ReverseHashWrapperFactory = await ethers.getContractFactory( 13 | "ReverseHashWrapper", { 14 | libraries: { 15 | PoseidonUnit2L: await poseidon2Elements.getAddress(), 16 | PoseidonUnit3L: await poseidon3Elements.getAddress(), 17 | } 18 | } 19 | ); 20 | reverseHashWrapper = await ReverseHashWrapperFactory.deploy(); 21 | await reverseHashWrapper.waitForDeployment(); 22 | }); 23 | 24 | it("Should save and get preimages", async function () { 25 | const preimages: bigint[][] = [ 26 | [2n, 3n], 27 | [5n, 6n], 28 | [10n, 11n, 12n], 29 | ]; 30 | 31 | await reverseHashWrapper.savePreimages(preimages); 32 | 33 | for (let i = 0; i < preimages.length; i++) { 34 | const hash = await poseidon.hash(preimages[i]); 35 | const retrievedPreimage = await reverseHashWrapper.getPreimage(hash); 36 | for (let j = 0; j < preimages[i].length; j++) { 37 | expect(retrievedPreimage[j]).to.equal(preimages[i][j]); 38 | } 39 | } 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /test/smtLib/vectorsGen/go.mod: -------------------------------------------------------------------------------- 1 | module vectorsGenSmt 2 | 3 | go 1.18 4 | 5 | require github.com/iden3/go-merkletree-sql v1.0.1 6 | 7 | require ( 8 | github.com/iden3/go-iden3-crypto v0.0.13 // indirect 9 | golang.org/x/sys v0.1.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /test/state/data/user_state_genesis_transition.json: -------------------------------------------------------------------------------- 1 | { 2 | "proof":{ 3 | "pi_a": [ 4 | "18346195759402376212024979420329551088592741269486755271134510788834334513891", 5 | "7012202223295484742921347876693343441807930149818290650979034012912601581544", 6 | "1" 7 | ], 8 | "pi_b": [ 9 | [ 10 | "6236985279569702137726670792735798189042440888102196719807515852593115281781", 11 | "19850075403141636230661664780558825645841360560291046077615507677944585252663" 12 | ], 13 | [ 14 | "2949375753978217986565160040413858783877181841899262147292792431426333657546", 15 | "20092749977970918376488646835187681292802431764355179877254553704305527177106" 16 | ], 17 | [ 18 | "1", 19 | "0" 20 | ] 21 | ], 22 | "pi_c": [ 23 | "1330002911982749196270119971078495055326264922301422480880608440561039175132", 24 | "13157497409875093658445957704876377394913278412537102184685805688417882106827", 25 | "1" 26 | ], 27 | "protocol": "groth16", 28 | "curve": "bn128" 29 | }, 30 | "pub_signals": [ 31 | "23148936466334350744548790012294489365207440754509988986684797708370051073", 32 | "8039964009611210398788855768060749920589777058607598891238307089541758339342", 33 | "7115004997868594253010848596868364067574661249707337517331323113105592633327", 34 | "1" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /test/state/data/user_state_next_transition.json: -------------------------------------------------------------------------------- 1 | { 2 | "proof": { 3 | "pi_a": [ 4 | "1639248422931772066014623202568537161733844183266291100193230886149114905619", 5 | "2473672412545451663314156699363178893267300305794479977245887180827086319731", 6 | "1" 7 | ], 8 | "pi_b": [ 9 | [ 10 | "14915883564773866336676553145591967972922211910702024853188172274623008542531", 11 | "10086153371438672979884533988368692570093452927438865989971970833403928715522" 12 | ], 13 | [ 14 | "10348959373203348877908940829137627857979222223771414072812497940410945306301", 15 | "12626520676878788405110479526642551049512492136950489621508814635164304878776" 16 | ], 17 | [ 18 | "1", 19 | "0" 20 | ] 21 | ], 22 | "pi_c": [ 23 | "11989739865864624534768196029150406222518072419322396861430168096714235329933", 24 | "11512556365010812495298138523891786009327327340242265936550543879464878735190", 25 | "1" 26 | ], 27 | "protocol": "groth16", 28 | "curve": "bn128" 29 | }, 30 | "pub_signals": [ 31 | "23148936466334350744548790012294489365207440754509988986684797708370051073", 32 | "7115004997868594253010848596868364067574661249707337517331323113105592633327", 33 | "4546963942567895423749885008322935416520496550192665955639269179690288593086", 34 | "0" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /test/utils/id-calculation-utils.ts: -------------------------------------------------------------------------------- 1 | import { ethers } from "hardhat"; 2 | 3 | export function calculateGroupID(requestIds: bigint[]): bigint { 4 | const types = Array(requestIds.length).fill("uint256"); 5 | 6 | const groupID = 7 | BigInt(ethers.keccak256(ethers.solidityPacked(types, requestIds))) & 8 | BigInt("0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"); 9 | 10 | return groupID; 11 | } 12 | 13 | export function calculateRequestID(params: string, address: string): bigint { 14 | const requestId = 15 | (BigInt(ethers.keccak256(ethers.solidityPacked(["bytes", "address"], [params, address]))) & 16 | BigInt("0x0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")) + 17 | BigInt("0x0001000000000000000000000000000000000000000000000000000000000000"); 18 | return requestId; 19 | } 20 | 21 | export function calculateMultiRequestId( 22 | requestIds: bigint[], 23 | groupIds: bigint[], 24 | sender: string, 25 | ): bigint { 26 | return BigInt( 27 | ethers.keccak256( 28 | ethers.solidityPacked(["uint256[]", "uint256[]", "address"], [requestIds, groupIds, sender]), 29 | ), 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /test/validators/common-data/issuer_from_first_state_to_second_transition_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","16808564267715042565747150526413707826810779846518769996187201048333752158039","0"],"proof":{"pi_a":["18274927106883199163355788916991381985630571862748524681743150374261809939593","9802435912268422838650604509810516453805247965998871399469374767775804882148","1"],"pi_b":[["18181197001796945938718253223010420484137543236967913759059894410898642490527","1303417021537462000398981093388099225623844425493023907138276246567956614165"],["11604460186647023916048118544435913678579388106418713142775511386266303288310","16735805109673462866933195996583562306750132730429071631013339816519096341201"],["1","0"]],"pi_c":["3573658626697331447235990130995586375145786555497794415483240771570413845578","16283028318711077577805304582691797337708210420343678063020769818148296684015","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/issuer_from_genesis_state_to_first_auth_disabled_transition_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["22057981499787921734624217749308316644136637822444794206796063681866502657","2943483356559152311923412925436024635269538717812859789851139200242297094","16911470968637303012243682196661900599310735102088601053412602445232291023376","1"],"proof":{"pi_a":["11608313046332407923443762774770130589829064286085813091448781927168259506710","13900383019154136085944839594567197072403292538777538007642240517606214120127","1"],"pi_b":[["8074068986419117238041869613499030014993124254085556477593913058772510892012","5841157452011349154499272017659900973981468631586010915389353892913654172912"],["6155713328196767745880090779968400945831051747234375759374377954900915874887","18588087355514139461965068328918875313183445229265537765545082635759024355395"],["1","0"]],"pi_c":["18177524827548194440380471739803080356628480835683842770916009546813214909435","9940728075862095874095184582881017096515396198706901943418327433772165143546","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/issuer_from_genesis_state_to_first_transition_privado_main_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23044931227378972356227387837613931283837146405465159484184304645869838593","2943483356559152311923412925436024635269538717812859789851139200242297094","4651810919406271424788795341290061054223854170593276161538505373945026322686","1"],"proof":{"pi_a":["13465766418320789798474136378233360843574757371148275474131341723973376742847","21110410610174670855918058010690128282141768321131972283098990805587260342565","1"],"pi_b":[["17259211700495713878709302956703729084556405307214589268863213140599714559641","1029732388224136987391242349706872343494503203476268802002997662870048798638"],["20534587785759779039913585756498390024306302893581493078123695319178029149721","20487719988288161927748292719240959253536126044506063272882289739424200458514"],["1","0"]],"pi_c":["787860736042842056812178364167066212475482063587005823411245046090994784560","3662523226505641668662880727560443440934612263159616206198980447626921044755","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/issuer_from_genesis_state_to_first_transition_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["22057981499787921734624217749308316644136637822444794206796063681866502657","2943483356559152311923412925436024635269538717812859789851139200242297094","17589915770180204105901402551557814231062156768237172640949582669912057325314","1"],"proof":{"pi_a":["7406151319346716707484964498137452656313363442796188996588086068627889225607","2298520626328096798644251022070795658174868382566428973441290516785648122469","1"],"pi_b":[["1249297591182081825196492344495922134317857076100264838754084500357504035612","12056122657275077363008767454925817872575979439478942955355206689217412000146"],["9766415291751673184525490231307791330894433372795068843893634003279610817332","20223612099552155543650245511953807314888387475302959804150295273278679710267"],["1","0"]],"pi_c":["12318955233212807830395199114798670824416742209124698005826398641672121529405","19135250638969945661182351104298078267859965654909128385048515544047230517668","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/issuer_genesis_state.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "21933750065545691586450392143787330185992517860945727248803138245838110721", 4 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 5 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 6 | "1" 7 | ], 8 | "proof": { 9 | "pi_a": [ 10 | "17328306131088238513612740615969539236226653729254909620074293222628665387500", 11 | "6315635195190072550836142405463621114871195506050339142166386791889264291772", 12 | "1" 13 | ], 14 | "pi_b": [ 15 | [ 16 | "12288395449635993862547473799552779333095574114893702389553265531864107416998", 17 | "20860444102100614935894199737540364001224402517448783840795956508136397546291" 18 | ], 19 | [ 20 | "1274541905409703353959579901404585060636203139799139819781490453500075860847", 21 | "21166422010542242074620096736517151686038747095897114232132247859361768027587" 22 | ], 23 | ["1", "0"] 24 | ], 25 | "pi_c": [ 26 | "4903839758592037143367861264022503866814617178646317425287088109888978826403", 27 | "4017315492074998542189208995977636147577115699304820560979840608676909232594", 28 | "1" 29 | ], 30 | "protocol": "groth16", 31 | "curve": "bn128" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/validators/common-data/issuer_next_state_transition.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "21933750065545691586450392143787330185992517860945727248803138245838110721", 4 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 5 | "21306816147125348268698128919345238438768792440721891850508117209346448952877", 6 | "0" 7 | ], 8 | "proof": { 9 | "pi_a": [ 10 | "2777337195682919965869465289166925199462228004508681365250696778171735648770", 11 | "939018295405419834876641169630185598179260052512157435411676557362691724765", 12 | "1" 13 | ], 14 | "pi_b": [ 15 | [ 16 | "21725063162779738401505928921946882871135914408858768433971830513058574876596", 17 | "19035733000571263608619458801207053094632820226789773914997346394574012054967" 18 | ], 19 | [ 20 | "3796944591532112805412123020369013640880093781793927343297240752968840169537", 21 | "14614239854434386635290679932405720040981227172390242728282460730901623248286" 22 | ], 23 | ["1", "0"] 24 | ], 25 | "pi_c": [ 26 | "4282138769260819927143921938413857295404226572953279150599156572395432845835", 27 | "4643450590543903584194001481825732848885419331126497374537326967609690783511", 28 | "1" 29 | ], 30 | "protocol": "groth16", 31 | "curve": "bn128" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/validators/common-data/user_from_first_state_to_second_transition_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","13421062220305656807332040413142908746386531813676548741852291985659124697073","14535482911083887650400775180811767777795251060472677534187665389233265353111","0"],"proof":{"pi_a":["18822474086578989973254316249370700104675930930607278503063050564486673864494","11474620187071323745861178454229669441539291925283027687313880893725000982366","1"],"pi_b":[["17664948203997594017561070410233145657408121630452585210742560606110821260699","11616828798210562870733399991313560978097734535579365144948586591119233964412"],["20704970968233591566611266632980105261772383978837746583490936884782996713999","14580727562292433762396010270196146658015505318803473263143087663231458722627"],["1","0"]],"pi_c":["19506940451402142790551193857852703643763607662149432663487144506631135698097","12254059610033047080903154101649577033630322862031412716474905407760024356896","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/user_from_genesis_state_to_first_transition_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8039964009611210398788855768060749920589777058607598891238307089541758339342","13421062220305656807332040413142908746386531813676548741852291985659124697073","1"],"proof":{"pi_a":["7731299467339209860522266830890110953339462123863235591307184929143275832455","4355628406040549553363047869516469121512516851018366825925825741403992529232","1"],"pi_b":[["414578198627745497404358786707869080514096536309995901719712737128584148104","2185916350498548089293521081056022986775480533227574807563173719878622204433"],["7784400705578519466399015427197422498820652717192518243290308260257074797824","10883570590371511210703486356013801160492201778054693186060258794241244366947"],["1","0"]],"pi_c":["1514868056781256250848777558332554792606674804903714209281846173984004497913","21032945567555830912841371695402373309904233595071069617228699242704744082135","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/common-data/user_next_state_transition.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23148936466334350744548790012294489365207440754509988986684797708370051073", 4 | "16943514292072615581951225733277375494772075645432829638168938263745642964909", 5 | "12762287340049584352525153213090774360762035980892092940952129329615052050238", 6 | "0" 7 | ], 8 | "proof": { 9 | "pi_a": [ 10 | "21448221414812836390107072098449637160250284202811129207815602504335801321632", 11 | "6169504458607334724475103282337680248474605034688360226696593972555375335920", 12 | "1" 13 | ], 14 | "pi_b": [ 15 | [ 16 | "10597128103585235779218695131076097271150197405003610962265186586580582943087", 17 | "546151128049926821433596219092727158195216263053996636119090061487833954787" 18 | ], 19 | [ 20 | "10855099850615805260966801108198896079244013730016372363358101133597259950233", 21 | "18956734071056256274106448787128035967773954136948344306912153297572014780231" 22 | ], 23 | [ 24 | "1", 25 | "0" 26 | ] 27 | ], 28 | "pi_c": [ 29 | "21469684513575581348581129357821527829685591253708391037237956994599200033465", 30 | "21606997945248685712431417836572285318773820667783949020118268238208660494523", 31 | "1" 32 | ], 33 | "protocol": "groth16", 34 | "curve": "bn128" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /test/validators/common-data/user_state_transition.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23148936466334350744548790012294489365207440754509988986684797708370051073","8039964009611210398788855768060749920589777058607598891238307089541758339342","16943514292072615581951225733277375494772075645432829638168938263745642964909","1"],"proof":{"pi_a":["19735760711635897779415411409046267455786277191646078702740855922779195261184","5242881701954773872400667466623192148644012463221075479588500838823517424237","1"],"pi_b":[["5894099723812693369023465129041791178822936227740866618067342105285493884280","12518906672981809869762339841322083615516113436834864081368167298213933640781"],["20877629804232458836898772144127769775426345281024131571243609234937385079377","5466849058488568460011386113316761140612607423423262123541698042940239528212"],["1","0"]],"pi_c":["8820543973108101996254395031738208288490628742744085010877731968408049415303","2699363376814432800533334059349846235959193652979501623217570040827632142196","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/eth-identity/index.ts: -------------------------------------------------------------------------------- 1 | import { DeployHelper } from "../../../helpers/DeployHelper"; 2 | import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; 3 | import { ethers } from "hardhat"; 4 | import { expect } from "chai"; 5 | 6 | describe("Eth Identity Validator", function () { 7 | let validator: any; 8 | 9 | async function deployContractsFixture() { 10 | const deployHelper = await DeployHelper.initialize(null, true); 11 | const { state: stateContract } = await deployHelper.deployStateWithLibraries(["0x0212"]); 12 | const stateContractAddress = await stateContract.getAddress(); 13 | ({ validator } = await deployHelper.deployValidatorContracts( 14 | "ethIdentity", 15 | stateContractAddress, 16 | )); 17 | } 18 | 19 | before(async () => { 20 | await loadFixture(deployContractsFixture); 21 | }); 22 | 23 | it("should deploy EthIdentityValidator contract", async function () { 24 | const sender = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"; 25 | const userId = "0xd056622b9ffcf797282b86acef4f688ad1ae5d69ff3000000000000001201"; 26 | 27 | const encoder = new ethers.AbiCoder(); 28 | const proof = encoder.encode(["uint256"], [userId]); 29 | 30 | const result = await validator.verify(sender, proof, "0x"); 31 | expect(result[0]).to.equal(userId); 32 | expect(result[1].length).to.equal(0); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /test/validators/mtp/data/invalid_mtp_user_genesis.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","1496222740463292783938163206931059379817846775593932664024082849882751356658","32","12345","2183529430841678412498629776531985643951481699066602015087769793102631847806","21933750065545691586450392143787330185992517860945727248803138245838110721","14350982505419309247370121592555562539756979893755695438303858350858014373778","1","14350982505419309247370121592555562539756979893755695438303858350858014373778","1642074362"],"proof":{"pi_a":["30407753001312325849390342892565345284353842707163970034115920372881739304652","8340617707492083335844921616003057220749793125834216179015612138976197534959","1"],"pi_b":[["18043013815166498801819867632002219731111574118442197472948722475667322895202","16463399469851564488237046184559306674779098912656826164216154355175152790060"],["8453062165251736489566626611140697495229112069117214526516251723635678178962","12345020950559826513415253778628334734622916338806680096674295915742015827532"],["1","0"]],"pi_c":["2426249428686298232020471045227367313191752079716698383804235410222633923919","9211870390155428277761800117018705434754790466695895154075236990579128541146","1"],"protocol":"groth16","curve":"bn128"}} 2 | -------------------------------------------------------------------------------- /test/validators/mtp/data/valid_mtp_user_genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "1", 4 | "23148936466334350744548790012294489365207440754509988986684797708370051073", 5 | "1496222740463292783938163206931059379817846775593932664024082849882751356658", 6 | "32", 7 | "12345", 8 | "9261952740082697154168142614372093837079863683752625783051369996839209879956", 9 | "21933750065545691586450392143787330185992517860945727248803138245838110721", 10 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 11 | "1", 12 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 13 | "1642074362" 14 | ], 15 | "proof": { 16 | "pi_a": [ 17 | "11291205156402119402084524543108781514576683133427152132755751825463444484741", 18 | "16976814959825328157772160865553086045979574751186302931283113910043306559274", 19 | "1" 20 | ], 21 | "pi_b": [ 22 | [ 23 | "7572288130143947606685100480180372619361842154269264597803077641393086990050", 24 | "19334774544386774319504257456132442500753247027423124777814339926584937231722" 25 | ], 26 | [ 27 | "4836739032605218074698384620051452375378515370975543441794297598002681886464", 28 | "9466169884908307158744151482276494118394813480172340094115062210569261078614" 29 | ], 30 | [ 31 | "1", 32 | "0" 33 | ] 34 | ], 35 | "pi_c": [ 36 | "18792108451526113293054455992274574519007917592683883998565830021760968025324", 37 | "10511523948512173201466992349658568805797302417421366764454791518372756973386", 38 | "1" 39 | ], 40 | "protocol": "groth16", 41 | "curve": "bn128" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/validators/mtp/data/valid_mtp_user_non_genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "1", 4 | "23148936466334350744548790012294489365207440754509988986684797708370051073", 5 | "1496222740463292783938163206931059379817846775593932664024082849882751356658", 6 | "32", 7 | "12345", 8 | "2330632222887470777740058486814238715476391492444368442359814550649181604485", 9 | "21933750065545691586450392143787330185992517860945727248803138245838110721", 10 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 11 | "1", 12 | "14350982505419309247370121592555562539756979893755695438303858350858014373778", 13 | "1642074362" 14 | ], 15 | "proof": { 16 | "pi_a": [ 17 | "1619875619503766368982449347702132394350465660963084327661829107699849698047", 18 | "1373035573611735119275076153344617154786545254399134501100362112321583641569", 19 | "1" 20 | ], 21 | "pi_b": [ 22 | [ 23 | "16213303235590714483247164467745497110336237617991203491915465762481880106393", 24 | "9820017541422233682440550577131382834489220156473987146991707326226115419959" 25 | ], 26 | [ 27 | "19913586706226740662916922793956628289580624180874874222771325040272380532112", 28 | "14693760548258641861801329561845702600671193761983278311884626439965479956166" 29 | ], 30 | [ 31 | "1", 32 | "0" 33 | ] 34 | ], 35 | "pi_c": [ 36 | "17702986491030117114494011584403740114422200665476736371179454562750945140312", 37 | "9684965314051418203526403552087537969631267077538270956333940009681548450916", 38 | "1" 39 | ], 40 | "protocol": "groth16", 41 | "curve": "bn128" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /test/validators/mtp/data/valid_mtp_user_non_genesis_challenge_address.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","1496222740463292783938163206931059379817846775593932664024082849882751356658","32","583091486781463398742321306787801699791102451699","2330632222887470777740058486814238715476391492444368442359814550649181604485","21933750065545691586450392143787330185992517860945727248803138245838110721","14350982505419309247370121592555562539756979893755695438303858350858014373778","0","14350982505419309247370121592555562539756979893755695438303858350858014373778","1642074362"],"proof":{"pi_a":["21526647557667884214609915220129524889417411173671962491569412467156664029771","21607998646088126315344467469163821324311845641451787601736758113847086923815","1"],"pi_b":[["757470361028404982989090774803522387661973544946124011579060764212018431585","7835104769749685526023699002891929549653888321693233587278388607104850128237"],["16589468580874625698214623729771375561285653284004369353758565785752392303932","19158262172118604450590978130602770440625580441627903264566100640737346108543"],["1","0"]],"pi_c":["7694915858213947770486609106568353343336250383266965481327646385998067170644","21756002282496353402053747063895642888914419280723098537857194798175588664466","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/sig/data/invalid_sig_user_genesis.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","17055061329686910061711483294099078173641776109555566375260051361977168049259","2943483356559152311923412925436024635269538717812859789851139200242297094","32","12345","2183529430841678412498629776531985643951481699066602015087769793102631847806","21933750065545691586450392143787330185992517860945727248803138245838110721","1","2943483356559152311923412925436024635269538717812859789851139200242297094","1642074362"],"proof":{"pi_a":["3548222926660766761092529655814151023202244244960599500345546723398316948200","18398575558292905765493839489901067708767449199224343827221895327894603643129","1"],"pi_b":[["4061977208040319506265962795660958164170059249367282853631084935958464252607","7782807062015906022716181103942416504404881135121121455960694173963442395423"],["5052884777838881418213008036299968607633174780558095626981315726209244189203","8162439860975505667079858414633757289297273402262781549491975646550637794238"],["1","0"]],"pi_c":["7032615305745219736809537806774014991234125733949590249269987063618436739756","11402635587183698544396398517340028208628918988765171164276647443535359257347","1"],"protocol":"groth16","curve":"bn128"}} 2 | -------------------------------------------------------------------------------- /test/validators/sig/data/valid_sig_user_genesis.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","1496222740463292783938163206931059379817846775593932664024082849882751356658","2943483356559152311923412925436024635269538717812859789851139200242297094","32","12345","9261952740082697154168142614372093837079863683752625783051369996839209879956","21933750065545691586450392143787330185992517860945727248803138245838110721","1","2943483356559152311923412925436024635269538717812859789851139200242297094","1642074362"],"proof":{"pi_a":["12321925495725635488349821531393347357029077422133487981075134759896579071721","13372607488133180454625828540890040360859563326872667238519662246161577231704","1"],"pi_b":[["21526684741622001966465675998667683827691539330205803222467657939189816643637","3576108443804131507871263762692430827600098688401087725067360789739812899716"],["7921398958053113550059059633757501914472490745431810250986603553565313623523","6476115078770436129056297875258607916984701630094012481711624830954819872440"],["1","0"]],"pi_c":["7006368652895891781743133120621017624617141350565090262933399320397791206217","21019038106141397456987509488277920269785476046060629742522406135871847603846","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/sig/data/valid_sig_user_non_genesis.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","1496222740463292783938163206931059379817846775593932664024082849882751356658","2943483356559152311923412925436024635269538717812859789851139200242297094","32","12345","2330632222887470777740058486814238715476391492444368442359814550649181604485","21933750065545691586450392143787330185992517860945727248803138245838110721","1","2943483356559152311923412925436024635269538717812859789851139200242297094","1642074362"],"proof":{"pi_a":["14757969321226641987014045046457539022908847557503538599666153915097254014213","17571376255732824767033168360784568391015606994694444570021833075579941738854","1"],"pi_b":[["21513904829931397750119648875965165430895719826794408116789928166079494711352","15671640033494784259825255182981284397625821875130022785765311529081339314504"],["8115032956776095568003155883240468063039233588164067251767123962259040059049","15915824381942307470109956780377303429974211119470577029225240824960050854497"],["1","0"]],"pi_c":["4228846121593437426350512928550310817327766103311276437964022030001665582275","16930346174085862905400666393396963640409754801070648211048319555371037713992","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/sig/data/valid_sig_user_non_genesis_challenge_address.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["1","23148936466334350744548790012294489365207440754509988986684797708370051073","1496222740463292783938163206931059379817846775593932664024082849882751356658","2943483356559152311923412925436024635269538717812859789851139200242297094","32","583091486781463398742321306787801699791102451699","2330632222887470777740058486814238715476391492444368442359814550649181604485","21933750065545691586450392143787330185992517860945727248803138245838110721","1","2943483356559152311923412925436024635269538717812859789851139200242297094","1642074362"],"proof":{"pi_a":["1586737020434671186479469693201682903767348489278928918437644869362426285987","10368374578954982886026700668192458272023628059221185517094289432313391574346","1"],"pi_b":[["8209584930734522176349491274051519385730056242274029221348202709658022380255","10467634573017180218197884581733108252303484275914626793162330699221056049997"],["8727203460568364282837439956284542723424467542192739359133672824842743578575","16780462512570391766527074671395013717949680440025828249250261266320709865031"],["1","0"]],"pi_c":["11215761237716692384931356337281938111805620146858403764487216970162196454846","4563515138436312174368382548605579502301781805108297754551533822937265670041","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/invalid_bjj_user_genesis_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23273167900576580892722615617815475823351560716009055944677723144398443009", 4 | "8238786461697294981612492348897864255604557628938234460054547971370500383919", 5 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 6 | "21264956840473518295367401759082248638554058714792654964349049745455799782226", 7 | "21540438192236855564075143333896114176485819065040531615519987653057866936972", 8 | "0", 9 | "1", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "17553467291814895170405188828004896559375980578450652516838963090977259468266", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "17589915770180204105901402551557814231062156768237172640949582669912057325314", 15 | "1642074362", 16 | "1" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "14574794811223802969923445990879348518445067072892582017007139605567534112189", 21 | "11874007190839762221273786466316423405358694980238600621813942217676641658551", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "3083057154916210840018456192866091923193713673178424619435046154002436945901", 27 | "7355995434914803652054939916420557973128674591314124724629308249865170651396" 28 | ], 29 | [ 30 | "1107524430045305248162390887072797101441131945422541788536670998979203184590", 31 | "20656717596720588929196661076009497017762380133783782204607032807671598076513" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "15058191483423477548332067927648930805646427998284703890164099714560398031238", 40 | "20697284369118929292610897477350680824754779604550582092552655646880174938514", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/invalid_mtp_user_genesis_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23273167900576580892722615617815475823351560716009055944677723144398443009", 4 | "14949918476068574586848485962747737454315773097464393423409459972617533745977", 5 | "17589915770180204105901402551557814231062156768237172640949582669912057325314", 6 | "21264956840473518295367401759082248638554058714792654964349049745455799782226", 7 | "21540438192236855564075143333896114176485819065040531615519987653057866936972", 8 | "0", 9 | "2", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "17553467291814895170405188828004896559375980578450652516838963090977259468266", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "17589915770180204105901402551557814231062156768237172640949582669912057325314", 15 | "1642074362", 16 | "1" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "15451255710956840365207998797531488037085593616201820313511483723713049459406", 21 | "2632932721237405215937807805162282819113891660693362950843314974451569951612", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "10979066588234110636732057767418756332876803323256729677633011297168103748706", 27 | "1297663384555178359452536342310765490548333703814027367756943536427717280765" 28 | ], 29 | [ 30 | "12707985625924074048763945021679048861749902010617200735062449586464930066906", 31 | "4854222308425140718821940129378999370312590487109251323739450421305989668135" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "8552715630350986042652950616855053571983984928779721889417081717641934298347", 40 | "2681818311310805183545667163798820911098278058050001612790665910904963189192", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_first_issuer_genesis_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","1","32","583091486781463398742321306787801699791102451699","17324622488979108054416002082921608267177770116274256097215720923692895619238","22057981499787921734624217749308316644136637822444794206796063681866502657","2943483356559152311923412925436024635269538717812859789851139200242297094","1642074362","1"],"proof":{"pi_a":["11961608651324268740993280809060506363704414935652731013950980915876353279386","21729757361356856630270201882136086940597810295083874777170312645098313571527","1"],"pi_b":[["4215347182745657991719122540519219575812736502147882931197096765624997244396","14911524857415717802803384536040847004457113630569288215157207419789472639583"],["2083161858566491638137620910253668798477979858550596699630845308552882636475","3636496171205191902213477960893120811648608999345462615513321113333311436603"],["1","0"]],"pi_c":["16863458593219381921371247428049861798746060532374845365905420980906567678253","1486329310635643615956566307333261757191229025882539431034225966926036601396","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_first_issuer_second_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","1","32","583091486781463398742321306787801699791102451699","3246149973995767198551331195301279032661034567528700100008644394827230835249","22057981499787921734624217749308316644136637822444794206796063681866502657","16808564267715042565747150526413707826810779846518769996187201048333752158039","1642074362","1"],"proof":{"pi_a":["7271619733402008623295918939121527482239950225172194515740269963878429958521","1940768467993173516737360516899437268762888570058462417236558377300170819810","1"],"pi_b":[["5733805854798919154692855865862244093379703630219805140381875655980747705669","14087270303420640154904868327886825221357046698613019933990875725899543949461"],["4679941920750120779453019684182875651816026573037943823311074653648511441608","21067994840479417460716205808860196169860655007927826941782300583144970421220"],["1","0"]],"pi_c":["4701219236094378762638312233927862378401653959716260543280295612000720241933","12294878181398418516363476991804721465989480349230162752179225425812940915337","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_first_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","1","32","583091486781463398742321306787801699791102451699","20586831885098765093977645199183344896684103637972080672236708215043596614295","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["8900541082213046855161373858138376316028814528571726879772031365911580296278","16628081672050364142708243874199235850215299373106462598183089937400285757218","1"],"pi_b":[["15236442921212324905017212155536727931932746622051790957990111125307323761545","21766966334820744053647206170178663033033469975226390034853792391984085122163"],["5225732767448242184733277147708618157094034453450922062527534137361341668292","5090358153390975461614228015925492073816550902140209335359574256701556708639"],["1","0"]],"pi_c":["18002041689978748347135954094867198608531831345731205708059975373257802591474","12993767429527479877827435112564975130385990195037644708173996807092446806991","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_genesis_auth_disabled_invalid_challenge_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "19185468473610285815446195195707572856383167010831244369191309337886545428382", 5 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "1", 10 | "32", 11 | "999", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8225790985618873765654935342213454650790524284518140495056580272466028211307", 21 | "4061081298212063295680041208544218182483812289119690843772114663942489261025", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "3564720781342639810380094890489723015631793308327876866035466107634514675103", 27 | "20191443411970323596401339526957618536159455599481411146080043762923172304015" 28 | ], 29 | [ 30 | "650108363271923215628036993433273199487811827460973067322525877316646692586", 31 | "10627003406686716336456604717233340115062695380752209342172538377881166747769" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "124448423970895751234097232274396762128437710998504714864870508616558666702", 40 | "1867455000997959849541158178488176209921983101841320218295664959420241412295", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_genesis_auth_disabled_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "19185468473610285815446195195707572856383167010831244369191309337886545428382", 5 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "1", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8225790985618873765654935342213454650790524284518140495056580272466028211307", 21 | "4061081298212063295680041208544218182483812289119690843772114663942489261025", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "3564720781342639810380094890489723015631793308327876866035466107634514675103", 27 | "20191443411970323596401339526957618536159455599481411146080043762923172304015" 28 | ], 29 | [ 30 | "650108363271923215628036993433273199487811827460973067322525877316646692586", 31 | "10627003406686716336456604717233340115062695380752209342172538377881166747769" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "124448423970895751234097232274396762128437710998504714864870508616558666702", 40 | "1867455000997959849541158178488176209921983101841320218295664959420241412295", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_genesis_auth_disabled_v3_wrong_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "19185468473610285815446195195707572856383167010831244369191309337886545428382", 5 | "2943483356559152311923412925436024635269538717812859789851139200242297094", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "1", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8225790985618873765654935342213454650790524284518140495056580272466028211307", 21 | "4061081298212063295680041208544218182483812289119690843772114663942489261025", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "3564720781342639810380094890489723015631793308327876866035466107634514675103", 27 | "20191443411970323596401339526957618536159455599481411146080043762923172304015" 28 | ], 29 | [ 30 | "650108363271923215628036993433273199487811827460973067322525877316646692586", 31 | "10627003406686716336456604717233340115062695380752209342172538377881166747769" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "124448423970895751234097232274396762128437710998504714864870508616558666702", 40 | "1867455000997959849541158178488176209921983101841320218295664959420241412295", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_genesis_privado_main_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["24260117628167631514325785706121090463052069299029421222065964108401778945","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","1181104146341669106833673731124247094742494237349821577369589255769064505023","7926291894349559894867197646745763534964871508096020709445412732737383992426","0","1","32","583091486781463398742321306787801699791102451699","15777832313232625969486825777216741183565241184204418238620213172477311174574","23044931227378972356227387837613931283837146405465159484184304645869838593","4651810919406271424788795341290061054223854170593276161538505373945026322686","1642074362","1"],"proof":{"pi_a":["17717822481616891907871971503442163935652252057396665621385642317234753021587","13177931203887147225591591185256544455619552616414546045698787814382102266401","1"],"pi_b":[["18341329155393304178945082539345747330691961829626251441023474738991162504540","17361181867643933334088981540354102526253819992894898237178401815486686403190"],["10406734607265591700275782527926829970521463725166978775879142138250391194966","3587667302533194601067756833369818808955675044758585254199107678731415443948"],["1","0"]],"pi_c":["605185334360256435693245097092786160038229773709847750827283549010473841755","13711089745722670725077661249505845977663848914767718089196044745922742760992","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_genesis_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","1","32","583091486781463398742321306787801699791102451699","17553467291814895170405188828004896559375980578450652516838963090977259468266","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["14574794811223802969923445990879348518445067072892582017007139605567534112189","11874007190839762221273786466316423405358694980238600621813942217676641658551","1"],"pi_b":[["3083057154916210840018456192866091923193713673178424619435046154002436945901","7355995434914803652054939916420557973128674591314124724629308249865170651396"],["1107524430045305248162390887072797101441131945422541788536670998979203184590","20656717596720588929196661076009497017762380133783782204607032807671598076513"],["1","0"]],"pi_c":["15058191483423477548332067927648930805646427998284703890164099714560398031237","20697284369118929292610897477350680824754779604550582092552655646880174938514","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_bjj_user_second_issuer_first_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","8238786461697294981612492348897864255604557628938234460054547971370500383919","2943483356559152311923412925436024635269538717812859789851139200242297094","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","1","32","583091486781463398742321306787801699791102451699","9099102572907537314140397131924122401084737995701214854737608469293791942353","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["2272907384715030553252077811762293923931521364842265902638466882454604401713","20520167453282548113167299771859108404812858984503699408383358963909609106572","1"],"pi_b":[["8381250544177254751004644600481794082875558993869821168512562390615500685200","7578066223243864396069480591911073181005678442230833656249821636858288946386"],["9774063033538023170403638103036484688283706506269419586595105579896118907176","2697780867869848235584851693697164276189444995084501892752391234031597966902"],["1","0"]],"pi_c":["3412671087023221754011312442077801824982298321589754588058283901365638036219","3140523938555958309544462524340494449047647092128201206120205561181378793088","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_first_issuer_second_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","14949918476068574586848485962747737454315773097464393423409459972617533745977","17589915770180204105901402551557814231062156768237172640949582669912057325314","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","2","32","583091486781463398742321306787801699791102451699","3246149973995767198551331195301279032661034567528700100008644394827230835249","22057981499787921734624217749308316644136637822444794206796063681866502657","16808564267715042565747150526413707826810779846518769996187201048333752158039","1642074362","1"],"proof":{"pi_a":["3408522645668986442704780431333109901384955466312565540324021821129365510703","21841196347407499162287087385362970766348294145253331381550288287201632577951","1"],"pi_b":[["2180686012289838694442206620706568930426745623875622093519776116981705955481","2369945513745833456300930205613028176803313928642380391073589866921237403597"],["12709028491030497494677555300459753869666957922924759482023833801943163807721","9634660616067298906388147114284380861635266598076388672439987873162452391400"],["1","0"]],"pi_c":["2511219872700601919062774451898428102641757008786512017075180740407247898322","3770756849406151835265541017542280221770975015293562307165044368820693566823","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_first_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","14949918476068574586848485962747737454315773097464393423409459972617533745977","17589915770180204105901402551557814231062156768237172640949582669912057325314","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","2","32","583091486781463398742321306787801699791102451699","20586831885098765093977645199183344896684103637972080672236708215043596614295","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["5538121048491069862223108014050379178911641741492571191204853142077444698777","9205772915201268051474991353594216871820327292772407290075852967232221324562","1"],"pi_b":[["16636767503820456094433869227434088006712916466720265172983097431234431708751","15713918381627201606935471591411655470186649093814345381872243187841985725129"],["5960091535635057938231224176369132431651629170583471511875413692344109352064","1109026058928964635681281801395025740861393573243428534493596250666863127503"],["1","0"]],"pi_c":["19986169681146768547165511015445569343438578326697988668403112425904913934360","5263322041200163774644459773975537557499601457632261318295734771513454133185","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_genesis_auth_disabled_invalid_challenge_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "18761762767436897318021395335040456013335870093640833036448186062813730716050", 5 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "2", 10 | "32", 11 | "999", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8725611164911500615484571084291053429801198528475850805944004918344452340336", 21 | "21855408298268919236431500078790034077364400819659527256194615934252430313161", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "5091246832426545576611356652959875644501598220673206343502587843542314094209", 27 | "10937106490685801119872910712314532112868496708165929886641641236825967181556" 28 | ], 29 | [ 30 | "1907433572282109233564669319119491580624141365969674549053910432054810661153", 31 | "883575701518357246233017057290045443601339677011281353278651511167260512236" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "2856835440784539835126399861899262494822955249504195883368919559123107395270", 40 | "7622266075799901602986827186173403465201002427665647829186543014447520417737", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_genesis_auth_disabled_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "18761762767436897318021395335040456013335870093640833036448186062813730716050", 5 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "2", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8725611164911500615484571084291053429801198528475850805944004918344452340336", 21 | "21855408298268919236431500078790034077364400819659527256194615934252430313161", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "5091246832426545576611356652959875644501598220673206343502587843542314094209", 27 | "10937106490685801119872910712314532112868496708165929886641641236825967181556" 28 | ], 29 | [ 30 | "1907433572282109233564669319119491580624141365969674549053910432054810661153", 31 | "883575701518357246233017057290045443601339677011281353278651511167260512236" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "2856835440784539835126399861899262494822955249504195883368919559123107395270", 40 | "7622266075799901602986827186173403465201002427665647829186543014447520417737", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_genesis_auth_disabled_v3_wrong_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "pub_signals": [ 3 | "23013175891893363078841232968022302880776034013620341061794940968520126978", 4 | "18761762767436897318021395335040456013335870093640833036448186062813730716050", 5 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 6 | "19823993270096139446564592922993947503208333537792611306066620392561342309875", 7 | "0", 8 | "0", 9 | "2", 10 | "32", 11 | "583091486781463398742321306787801699791102451699", 12 | "0", 13 | "22057981499787921734624217749308316644136637822444794206796063681866502657", 14 | "16911470968637303012243682196661900599310735102088601053412602445232291023376", 15 | "1642074362", 16 | "0" 17 | ], 18 | "proof": { 19 | "pi_a": [ 20 | "8725611164911500615484571084291053429801198528475850805944004918344452340336", 21 | "21855408298268919236431500078790034077364400819659527256194615934252430313161", 22 | "1" 23 | ], 24 | "pi_b": [ 25 | [ 26 | "5091246832426545576611356652959875644501598220673206343502587843542314094209", 27 | "10937106490685801119872910712314532112868496708165929886641641236825967181556" 28 | ], 29 | [ 30 | "1907433572282109233564669319119491580624141365969674549053910432054810661153", 31 | "883575701518357246233017057290045443601339677011281353278651511167260512236" 32 | ], 33 | [ 34 | "1", 35 | "0" 36 | ] 37 | ], 38 | "pi_c": [ 39 | "2856835440784539835126399861899262494822955249504195883368919559123107395270", 40 | "7622266075799901602986827186173403465201002427665647829186543014447520417737", 41 | "1" 42 | ], 43 | "protocol": "groth16", 44 | "curve": "bn128" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_genesis_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","14949918476068574586848485962747737454315773097464393423409459972617533745977","17589915770180204105901402551557814231062156768237172640949582669912057325314","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","2","32","583091486781463398742321306787801699791102451699","17553467291814895170405188828004896559375980578450652516838963090977259468266","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["15451255710956840365207998797531488037085593616201820313511483723713049459406","2632932721237405215937807805162282819113891660693362950843314974451569951612","1"],"pi_b":[["10979066588234110636732057767418756332876803323256729677633011297168103748706","1297663384555178359452536342310765490548333703814027367756943536427717280765"],["12707985625924074048763945021679048861749902010617200735062449586464930066906","4854222308425140718821940129378999370312590487109251323739450421305989668135"],["1","0"]],"pi_c":["8552715630350986042652950616855053571983984928779721889417081717641934298346","2681818311310805183545667163798820911098278058050001612790665910904963189192","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /test/validators/v3/data/valid_mtp_user_second_issuer_first_v3.json: -------------------------------------------------------------------------------- 1 | {"pub_signals":["23273167900576580892722615617815475823351560716009055944677723144398443009","14949918476068574586848485962747737454315773097464393423409459972617533745977","17589915770180204105901402551557814231062156768237172640949582669912057325314","21264956840473518295367401759082248638554058714792654964349049745455799782226","21540438192236855564075143333896114176485819065040531615519987653057866936972","0","2","32","583091486781463398742321306787801699791102451699","9099102572907537314140397131924122401084737995701214854737608469293791942353","22057981499787921734624217749308316644136637822444794206796063681866502657","17589915770180204105901402551557814231062156768237172640949582669912057325314","1642074362","1"],"proof":{"pi_a":["20050430037802171612313551366021052265219952178236535972696477918175333074098","5583046619604654108004431179161042062125030723578085782730295682831364163859","1"],"pi_b":[["16874771889497699557850555010040206070838337310956132918630315589738419242156","12357761789955954093783428637176829427330132569493378578579004831028507391609"],["2490315846819011234437683579251699728650625581302656857063815168329370113640","6963859243281238829636017731170142517766790076978910695497266557426471103610"],["1","0"]],"pi_c":["13257288930702991383454401388554154847722466608106630103858996275590527309374","3269396440386256360449329575234027819941685696452277332500016112323943557138","1"],"protocol":"groth16","curve":"bn128"}} -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "commonjs", 5 | "strict": true, 6 | "esModuleInterop": true, 7 | "outDir": "dist", 8 | "declaration": true, 9 | "noImplicitAny": false, 10 | "experimentalDecorators": true, 11 | "resolveJsonModule": true 12 | }, 13 | "include": ["./scripts", "./test", "./typechain", "./typechain-types", "./helpers", "./ignition"], 14 | "files": ["hardhat.config.ts", "packDemo.ts"] 15 | } 16 | --------------------------------------------------------------------------------