diff --git a/noir/.envrc b/noir/.envrc new file mode 100644 index 00000000000..b2f868b1898 --- /dev/null +++ b/noir/.envrc @@ -0,0 +1,20 @@ +# Based on https://github.com/direnv/direnv-vscode/blob/158e8302c2594cc0eaa5f8b4f0cafedd4e1c0315/.envrc + +# You can define your system-specific logic (like Git settings or GH tokens) in .envrc.local +# If that logic is usable by other people and might improve development environment, consider +# contributing it to this file! + +source_env_if_exists .envrc.local + +if [[ -z "${SKIP_NIX:-}" ]] && has nix; then + + if nix flake metadata &>/dev/null && has use_flake; then + # use flakes if possible + use flake + + else + # Otherwise fall back to pure nix + use nix + fi + +fi diff --git a/noir/.eslintrc.js b/noir/.eslintrc.js new file mode 100644 index 00000000000..f47f171561c --- /dev/null +++ b/noir/.eslintrc.js @@ -0,0 +1,19 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint', 'prettier'], + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + rules: { + 'comma-spacing': ['error', { before: false, after: true }], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', // or "error" + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + 'prettier/prettier': 'error', + }, +}; diff --git a/noir/.gitattributes b/noir/.gitattributes new file mode 100644 index 00000000000..204cff5c097 --- /dev/null +++ b/noir/.gitattributes @@ -0,0 +1 @@ +*.nr linguist-language=rust diff --git a/noir/.github/Cross.toml b/noir/.github/Cross.toml new file mode 100644 index 00000000000..09e6316a59c --- /dev/null +++ b/noir/.github/Cross.toml @@ -0,0 +1,9 @@ +[build.env] +passthrough = [ + "HOME", + "RUST_BACKTRACE", + "BARRETENBERG_BIN_DIR" +] +volumes = [ + "HOME", +] diff --git a/noir/.github/ISSUE_TEMPLATE/bug_report.yml b/noir/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000000..112da342e10 --- /dev/null +++ b/noir/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,99 @@ +name: Bug Report +description: Report an unexpected behavior. +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + # Description + Thanks for taking the time to create the Issue, and welcome to the Noirot family! + - type: textarea + id: aim + attributes: + label: Aim + description: Describe what you tried to achieve. + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Behavior + description: Describe what you expected to happen. + validations: + required: true + - type: textarea + id: bug + attributes: + label: Bug + description: Describe the bug. Supply error codes / terminal logs if applicable. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: To Reproduce + description: Describe the steps to reproduce the behavior. + value: | + 1. + 2. + 3. + 4. + - type: markdown + attributes: + value: | + # Environment + Specify your versions of Noir releases used. + - type: markdown + attributes: + value: | + ## Using Nargo? + - type: dropdown + id: nargo-install + attributes: + label: Installation Method + description: How did you install Nargo? + multiple: false + options: + - Binary + - Compiled from source + - type: input + id: nargo-version + attributes: + label: Nargo Version + description: What is the output of the `nargo --version` command? + placeholder: "nargo 0.6.0 (git version hash: 0181813203a9e3e46c6d8c3169ad5d25971d4282, is dirty: false)" + - type: markdown + attributes: + value: | + ## Using TypeScript? + Please await for our new set of packages. + You can find our target release timeframe on the [Noir Roadmap](https://github.com/orgs/noir-lang/projects/1/views/16). + - type: markdown + attributes: + value: | + # Misc + - type: textarea + id: additional + attributes: + label: Additional Context + description: Supplement further information if applicable. + - type: markdown + attributes: + value: | + # Pull Request + - type: dropdown + id: pr_preference + attributes: + label: Would you like to submit a PR for this Issue? + description: Fellow contributors are happy to provide support where applicable. + options: + - "No" + - "Maybe" + - "Yes" + validations: + required: true + - type: textarea + id: pr_support + attributes: + label: Support Needs + description: Support from other contributors you are looking for to create a PR for this Issue. diff --git a/noir/.github/ISSUE_TEMPLATE/config.yml b/noir/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..b5ded344eb9 --- /dev/null +++ b/noir/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: Ideas + url: https://github.com/orgs/noir-lang/discussions/new?category=ideas + about: Share ideas for new features diff --git a/noir/.github/ISSUE_TEMPLATE/idea_action_plan.yml b/noir/.github/ISSUE_TEMPLATE/idea_action_plan.yml new file mode 100644 index 00000000000..02fed1fc48b --- /dev/null +++ b/noir/.github/ISSUE_TEMPLATE/idea_action_plan.yml @@ -0,0 +1,54 @@ +name: Idea Action Plan +description: Outline the scope and steps for implementing an enhancement. Start with "Ideas" instead to request and discuss new features. +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + ## Description + Thanks for taking the time to create the Issue, and welcome to the Noirot family! + - type: textarea + id: problem + attributes: + label: Problem + description: Describe what you feel lacking. Supply code / step-by-step examples if applicable. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Happy Case + description: Describe how you think it should work. Supply pseudocode / step-by-step examples if applicable. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives Considered + description: Describe less-happy cases you have considered, if any. + - type: textarea + id: additional + attributes: + label: Additional Context + description: Supplement further information if applicable. + - type: markdown + attributes: + value: | + ## Pull Request + - type: dropdown + id: pr-preference + attributes: + label: Would you like to submit a PR for this Issue? + description: Fellow contributors are happy to provide support where applicable. + multiple: false + options: + - "No" + - "Maybe" + - "Yes" + validations: + required: true + - type: textarea + id: pr-support + attributes: + label: Support Needs + description: Support from other contributors you are looking for to create a PR for this Issue. diff --git a/noir/.github/NIGHTLY_TEST_FAILURE.md b/noir/.github/NIGHTLY_TEST_FAILURE.md new file mode 100644 index 00000000000..05772d82a51 --- /dev/null +++ b/noir/.github/NIGHTLY_TEST_FAILURE.md @@ -0,0 +1,11 @@ +--- +title: "nightly test-integration failed" +assignees: kobyhallx, tomafrench, jonybur +labels: bug +--- + +Something broke our nightly integration test. + +Check the [test]({{env.WORKFLOW_URL}}) workflow for details. + +This issue was raised by the workflow `{{env.WORKFLOW_NAME}}` diff --git a/noir/.github/actions/docs/build-status/action.yml b/noir/.github/actions/docs/build-status/action.yml new file mode 100644 index 00000000000..8206dd64776 --- /dev/null +++ b/noir/.github/actions/docs/build-status/action.yml @@ -0,0 +1,22 @@ +name: 'Get build status' +description: 'Gets the build status of a Netlify site' +inputs: + branch-name: + description: 'Branch name' + required: true + site-id: + description: Netlify site id + required: true +outputs: + deploy_status: + description: "The deploy status" + value: ${{ steps.check_deploy_status.outputs.deploy_status }} +runs: + using: "composite" + steps: + - run: ${{ github.action_path }}/script.sh + shell: bash + id: check_deploy_status + env: + BRANCH_NAME: ${{ inputs.branch-name }} + SITE_ID: ${{ inputs.site-id }} diff --git a/noir/.github/actions/docs/build-status/script.sh b/noir/.github/actions/docs/build-status/script.sh new file mode 100755 index 00000000000..0b282557cf2 --- /dev/null +++ b/noir/.github/actions/docs/build-status/script.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s#refs/[^/]*/##") +DEPLOY_STATUS=$(curl -X GET "https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?branch=$BRANCH_NAME" | jq -r '.[] | select(.created_at != null) | .state' | head -1) + +echo "$SITE_ID" +MAX_RETRIES=10 +COUNT=0 +while [[ "$DEPLOY_STATUS" != "ready" && $COUNT -lt $MAX_RETRIES ]]; do + sleep 20 + DEPLOY_STATUS=$(curl -X GET "https://api.netlify.com/api/v1/sites/$SITE_ID/deploys?branch=$BRANCH_NAME" | jq -r '.[] | select(.created_at != null) | .state' | head -1) + COUNT=$((COUNT+1)) + + echo "Deploy status: $DEPLOY_STATUS" + # If deploy status is ready, set the output and exit successfully + if [[ "$DEPLOY_STATUS" == "ready" ]]; then + echo "deploy_status=success" >> $GITHUB_OUTPUT + exit 0 + elif [[ "$DEPLOY_STATUS" == "error" ]]; then + echo "deploy_status=failure" >> $GITHUB_OUTPUT + exit 1 + fi + + echo "Deploy still running. Retrying..." +done + +echo "deploy_status=failure" >> $GITHUB_OUTPUT +exit 1 diff --git a/noir/.github/actions/install-playwright/action.yml b/noir/.github/actions/install-playwright/action.yml new file mode 100644 index 00000000000..ac412a7dd4a --- /dev/null +++ b/noir/.github/actions/install-playwright/action.yml @@ -0,0 +1,24 @@ +name: Install Playwright +description: Installs Playwright and its dependencies and caches them. + +runs: + using: composite + steps: + - name: Query playwright version + shell: bash + run: echo "PLAYWRIGHT_VERSION=$(yarn workspace @noir-lang/noirc_abi info @web/test-runner-playwright --json | jq .children.Version | tr -d '"')" >> $GITHUB_ENV + + - name: Cache playwright binaries + uses: actions/cache@v3 + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install playwright deps + shell: bash + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: | + npx playwright install + npx playwright install-deps diff --git a/noir/.github/actions/nix/action.yml b/noir/.github/actions/nix/action.yml new file mode 100644 index 00000000000..9f008ad0f9d --- /dev/null +++ b/noir/.github/actions/nix/action.yml @@ -0,0 +1,27 @@ +name: Setup Nix +description: Installs and setups Nix components + +inputs: + github-token: + description: 'Github Access Token' + required: true + nix-cache-name: + description: 'Name of the Cachix cache to use' + required: true + cachix-auth-token: + description: 'Cachix Auth Token' + required: true + + +runs: + using: composite + steps: + - uses: cachix/install-nix-action@v22 + with: + nix_path: nixpkgs=channel:nixos-23.05 + github_access_token: ${{ inputs.github-token }} + + - uses: cachix/cachix-action@v12 + with: + name: ${{ inputs.nix-cache-name }} + authToken: ${{ inputs.cachix-auth-token }} diff --git a/noir/.github/actions/setup/action.yml b/noir/.github/actions/setup/action.yml new file mode 100644 index 00000000000..5efe115ddcf --- /dev/null +++ b/noir/.github/actions/setup/action.yml @@ -0,0 +1,16 @@ +name: Install Yarn dependencies +description: Installs the workspace's yarn dependencies and caches them + +runs: + using: composite + steps: + - name: Cache + uses: actions/cache@v3 + id: cache + with: + path: "**/node_modules" + key: yarn-v1-${{ hashFiles('**/yarn.lock') }} + - name: Install + run: yarn --immutable + shell: bash + if: steps.cache.outputs.cache-hit != 'true' diff --git a/noir/.github/pull_request_template.md b/noir/.github/pull_request_template.md new file mode 100644 index 00000000000..e81ede7199d --- /dev/null +++ b/noir/.github/pull_request_template.md @@ -0,0 +1,25 @@ +# Description + +## Problem\* + +Resolves + +## Summary\* + + + +## Additional Context + + + +## Documentation\* + +Check one: +- [ ] No documentation needed. +- [ ] Documentation included in this PR. +- [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. + +# PR Checklist\* + +- [ ] I have tested the changes locally. +- [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. diff --git a/noir/.github/workflows/auto-pr-rebuild-script.yml b/noir/.github/workflows/auto-pr-rebuild-script.yml new file mode 100644 index 00000000000..4937de98e04 --- /dev/null +++ b/noir/.github/workflows/auto-pr-rebuild-script.yml @@ -0,0 +1,130 @@ +name: Rebuild ACIR artifacts + +on: + pull_request: + push: + branches: + - master + +jobs: + check-artifacts-requested: + name: Check if artifacts should be published + runs-on: ubuntu-22.04 + outputs: + publish: ${{ steps.check.outputs.result }} + + steps: + - name: Check if artifacts should be published + id: check + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { REF_NAME } = process.env; + if (REF_NAME == "master") { + console.log(`publish = true`) + return true; + } + + const labels = context.payload.pull_request.labels.map(label => label.name); + const publish = labels.includes('publish-acir'); + + console.log(`publish = ${publish}`) + return publish; + result-encoding: string + env: + REF_NAME: ${{ github.ref_name }} + + build-nargo: + name: Build nargo binary + if: ${{ needs.check-artifacts-requested.outputs.publish == 'true' }} + runs-on: ubuntu-22.04 + needs: [check-artifacts-requested] + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] + + steps: + - name: Checkout Noir repo + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build Nargo + run: cargo build --package nargo_cli --release + + - name: Package artifacts + run: | + mkdir dist + cp ./target/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo + path: ./dist/* + retention-days: 3 + + auto-pr-rebuild-script: + name: Rebuild ACIR artifacts + needs: [build-nargo] + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Add Nargo to $PATH + run: | + chmod +x ${{ github.workspace }}/nargo/nargo + echo "${{ github.workspace }}/nargo" >> $GITHUB_PATH + + - name: Set up Git user (Github Action) + run: | + git config --local user.name kevaundray + git config --local user.email kevtheappdev@gmail.com + + - name: Run rebuild script + working-directory: tooling/nargo_cli/tests + run: | + chmod +x ./rebuild.sh + ./rebuild.sh + + - name: Upload ACIR artifacts + uses: actions/upload-artifact@v3 + with: + name: acir-artifacts + path: ./tooling/nargo_cli/tests/acir_artifacts + retention-days: 10 + + - name: Check for changes in acir_artifacts directory + id: check_changes + if: ${{ github.ref_name }} == "master" + run: | + git diff --quiet tooling/nargo_cli/tests/acir_artifacts/ || echo "::set-output name=changes::true" + + - name: Create or Update PR + if: steps.check_changes.outputs.changes == 'true' + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.NOIR_REPO_TOKEN }} + commit-message: "chore: update acir artifacts" + title: "chore: Update ACIR artifacts" + body: "Automatic PR to update acir artifacts" + add-paths: tooling/nargo_cli/tests/acir_artifacts/*.gz + labels: "auto-pr" + branch: "auto-pr-rebuild-script-branch" diff --git a/noir/.github/workflows/build-aztec-feature-flag.yml b/noir/.github/workflows/build-aztec-feature-flag.yml new file mode 100644 index 00000000000..888a88a7f88 --- /dev/null +++ b/noir/.github/workflows/build-aztec-feature-flag.yml @@ -0,0 +1,45 @@ +name: Build with aztec feature flag + +on: + pull_request: + merge_group: + push: + branches: + - master + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-aztec-feature-flag: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.runner }} + timeout-minutes: 30 + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu + runner: ubuntu-latest + target: x86_64-unknown-linux-gnu + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build with feature flag + run: cargo build --features="noirc_frontend/aztec" diff --git a/noir/.github/workflows/cache-cleanup.yml b/noir/.github/workflows/cache-cleanup.yml new file mode 100644 index 00000000000..cf2b0ec413e --- /dev/null +++ b/noir/.github/workflows/cache-cleanup.yml @@ -0,0 +1,35 @@ +# This workflow cleans up any cache entries associated with a pull request once it has been closed. +# This prevents us from having many refs/pull/PR_NUMBER/merge cache entries which will never be used. +# +# Note that this will affect both PRs being closed with and without being merged. + +name: Cleanup closed PR cache entries + +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge diff --git a/noir/.github/workflows/deny.yml b/noir/.github/workflows/deny.yml new file mode 100644 index 00000000000..8ae7d03e076 --- /dev/null +++ b/noir/.github/workflows/deny.yml @@ -0,0 +1,26 @@ +name: deny + +on: + push: + branches: [master] + paths: [Cargo.lock] + pull_request: + branches: [master] + paths: [Cargo.lock] + merge_group: + +env: + RUSTFLAGS: -D warnings + CARGO_TERM_COLOR: always + +concurrency: deny-${{ github.head_ref || github.run_id }} + +jobs: + deny: + name: deny + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + command: check all \ No newline at end of file diff --git a/noir/.github/workflows/docs-new-version.yml b/noir/.github/workflows/docs-new-version.yml new file mode 100644 index 00000000000..9b109e170bb --- /dev/null +++ b/noir/.github/workflows/docs-new-version.yml @@ -0,0 +1,112 @@ +name: Cut a new version of the docs + +on: + workflow_dispatch: + inputs: + tag: + description: The tag to build Docs for + required: false + +jobs: + publish-docs: + runs-on: ubuntu-latest + if: ${{ inputs.tag != '' }} + permissions: + pull-requests: write + contents: write + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + + - name: Create new branch + run: | + git checkout -b new-docs-version-${{ github.event.inputs.tag }} + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install wasm-bindgen-cli + uses: taiki-e/install-action@v2 + with: + tool: wasm-bindgen-cli@0.2.86 + + - name: Install wasm-opt + run: | + npm i wasm-opt -g + + - name: Install Yarn + run: npm install -g yarn + + - name: Install Yarn dependencies + run: yarn + + - name: Build acvm_js + run: yarn workspace @noir-lang/acvm_js build + + - name: Build noirc_abi + run: yarn workspace @noir-lang/noirc_abi build + + - name: Build noir_js_types + run: yarn workspace @noir-lang/types build + + - name: Build barretenberg wrapper + run: yarn workspace @noir-lang/backend_barretenberg build + + - name: Run noir_js + run: | + yarn workspace @noir-lang/noir_js build + + - name: Build docs + run: + yarn workspace docs build + + - name: Cut a new version + working-directory: ./docs + run: yarn docusaurus docs:version ${{ inputs.tag }} + + - name: Remove pre-releases + id: get_version + run: | + cd docs && yarn setStable + + - name: Commit new documentation version + run: | + git config --local user.name 'signorecello' + git config --local user.email 'github@zepedro.me' + git add . + git commit -m "chore(docs): cut new docs version for tag ${{ github.event.inputs.tag }}" + + - name: Push changes to new branch + run: git push origin new-docs-version-${{ github.event.inputs.tag }} + + - name: Create Pull Request + run: | + gh pr create \ + --title "chore(docs): docs for ${{ github.event.inputs.tag }}" \ + --body "Updates documentation to new version for tag ${{ github.event.inputs.tag }}." \ + --base master \ + --head new-docs-version-${{ github.event.inputs.tag }} \ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build docs + run: yarn workspace docs build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.1 + with: + publish-dir: './docs/build' + production-branch: master + production-deploy: true + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-github-deployment: false + deploy-message: "Deploy from GitHub Actions for tag ${{ inputs.tag }}" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 + diff --git a/noir/.github/workflows/docs-pr.yml b/noir/.github/workflows/docs-pr.yml new file mode 100644 index 00000000000..02044c82224 --- /dev/null +++ b/noir/.github/workflows/docs-pr.yml @@ -0,0 +1,113 @@ +name: Deploy preview for PR + +on: + pull_request: + +jobs: + add_label: + runs-on: ubuntu-latest + outputs: + has_label: ${{ steps.check-labels.outputs.result }} + steps: + - name: Check if label is present + id: check-labels + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const labels = context.payload.pull_request.labels.map(label => label.name); + if (labels.includes('documentation')) { + return true; + } + + // Fetch the list of files changed in the PR + const { data: files } = await github.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + // Check if any file is within the 'docs' folder + const docsChanged = files.some(file => file.filename.startsWith('docs/')); + return docsChanged; + + - name: Add label if not present + if: steps.check-labels.outputs.result == 'true' + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const labels = context.payload.pull_request.labels.map(label => label.name); + if (!labels.includes('documentation')) { + github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['documentation'] + }) + } + + build_and_deploy_preview: + runs-on: ubuntu-latest + permissions: + pull-requests: write + needs: add_label + if: needs.add_label.outputs.has_label == 'true' + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install wasm-bindgen-cli + uses: taiki-e/install-action@v2 + with: + tool: wasm-bindgen-cli@0.2.86 + + - name: Install wasm-opt + run: | + npm i wasm-opt -g + + - name: Install dependencies + run: yarn + + - name: Build acvm_js + run: yarn workspace @noir-lang/acvm_js build + + - name: Build noirc_abi + run: yarn workspace @noir-lang/noirc_abi build + + - name: Build noir_js_types + run: yarn workspace @noir-lang/types build + + - name: Build barretenberg wrapper + run: yarn workspace @noir-lang/backend_barretenberg build + + - name: Run noir_js + run: | + yarn workspace @noir-lang/noir_js build + + - name: Remove pre-releases + working-directory: docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn setStable + + - name: Build docs + run: + yarn workspace docs build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.1 + with: + publish-dir: './docs/build' + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-github-deployment: false + deploy-message: "Deploy from GitHub Actions for PR ${{ github.event.number }}" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 diff --git a/noir/.github/workflows/docs-release.yml b/noir/.github/workflows/docs-release.yml new file mode 100644 index 00000000000..4cd9d9998cb --- /dev/null +++ b/noir/.github/workflows/docs-release.yml @@ -0,0 +1,72 @@ +name: Rebuild docs with the latest release + +on: + release: + types: [released] + workflow_dispatch: + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install wasm-bindgen-cli + uses: taiki-e/install-action@v2 + with: + tool: wasm-bindgen-cli@0.2.86 + + - name: Install wasm-opt + run: | + npm i wasm-opt -g + + - name: Install dependencies + run: yarn + + - name: Build acvm_js + run: yarn workspace @noir-lang/acvm_js build + + - name: Build noirc_abi + run: yarn workspace @noir-lang/noirc_abi build + + - name: Build noir_js_types + run: yarn workspace @noir-lang/types build + + - name: Build barretenberg wrapper + run: yarn workspace @noir-lang/backend_barretenberg build + + - name: Run noir_js + run: | + yarn workspace @noir-lang/noir_js build + + - name: Remove pre-releases + working-directory: docs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn setStable + + - name: Build docs + run: + yarn workspace docs build + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.1 + with: + publish-dir: './docs/build' + production-branch: master + production-deploy: true + github-token: ${{ secrets.GITHUB_TOKEN }} + enable-github-deployment: false + deploy-message: "Deploy from GitHub Actions for release" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 diff --git a/noir/.github/workflows/formatting.yml b/noir/.github/workflows/formatting.yml new file mode 100644 index 00000000000..97736e2415e --- /dev/null +++ b/noir/.github/workflows/formatting.yml @@ -0,0 +1,65 @@ +name: Formatting + +on: + pull_request: + merge_group: + push: + branches: + - master + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + clippy: + name: cargo clippy + runs-on: ${{ matrix.runner }} + timeout-minutes: 30 + env: + RUSTFLAGS: -Dwarnings + + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + target: x86_64-unknown-linux-gnu + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: ${{ matrix.target }} + components: clippy, rustfmt + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Run `cargo clippy` + run: cargo clippy --workspace --locked --release + + - name: Run `cargo fmt` + run: cargo fmt --all --check + + eslint: + name: eslint + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Run `yarn lint` + run: yarn lint diff --git a/noir/.github/workflows/gates_report.yml b/noir/.github/workflows/gates_report.yml new file mode 100644 index 00000000000..41a68c65852 --- /dev/null +++ b/noir/.github/workflows/gates_report.yml @@ -0,0 +1,90 @@ +name: Report gates diff + +on: + push: + branches: + - master + pull_request: + +jobs: + build-nargo: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] + + steps: + - name: Checkout Noir repo + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build Nargo + run: cargo build --package nargo_cli --release + + - name: Package artifacts + run: | + mkdir dist + cp ./target/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo + path: ./dist/* + retention-days: 3 + + + compare_gas_reports: + needs: [build-nargo] + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Set nargo on PATH + run: | + nargo_binary="${{ github.workspace }}/nargo/nargo" + chmod +x $nargo_binary + echo "$(dirname $nargo_binary)" >> $GITHUB_PATH + export PATH="$PATH:$(dirname $nargo_binary)" + nargo -V + + - name: Generate gates report + working-directory: ./tooling/nargo_cli/tests + run: | + ./gates_report.sh + mv gates_report.json ../../../gates_report.json + + - name: Compare gates reports + id: gates_diff + uses: TomAFrench/noir-gates-diff@e7cf131b7e7f044c01615f93f0b855f65ddc02d4 + with: + report: gates_report.json + summaryQuantile: 0.9 # only display the 10% most significant circuit size diffs in the summary (defaults to 20%) + + - name: Add gates diff to sticky comment + if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' + uses: marocchino/sticky-pull-request-comment@v2 + with: + # delete the comment in case changes no longer impact circuit sizes + delete: ${{ !steps.gates_diff.outputs.markdown }} + message: ${{ steps.gates_diff.outputs.markdown }} diff --git a/noir/.github/workflows/lockfile.yml b/noir/.github/workflows/lockfile.yml new file mode 100644 index 00000000000..190e01745af --- /dev/null +++ b/noir/.github/workflows/lockfile.yml @@ -0,0 +1,23 @@ +name: Lockfile check + +on: + pull_request: + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + yarn-lock: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Errors if installation would result in modifications to yarn.lock + - name: Install + run: yarn --immutable + shell: bash diff --git a/noir/.github/workflows/publish-acvm.yml b/noir/.github/workflows/publish-acvm.yml new file mode 100644 index 00000000000..ded669f13d0 --- /dev/null +++ b/noir/.github/workflows/publish-acvm.yml @@ -0,0 +1,70 @@ +name: Publish ACVM crates + +on: + workflow_dispatch: + inputs: + acvm-ref: + description: The acvm reference to checkout + required: true + +jobs: + publish: + name: Publish in order + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.acvm-ref }} + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + # These steps are in a specific order so crate dependencies are updated first + - name: Publish acir_field + run: | + cargo publish --package acir_field + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish brillig + run: | + cargo publish --package brillig + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish acir + run: | + cargo publish --package acir + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish acvm_blackbox_solver + run: | + cargo publish --package acvm_blackbox_solver + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish barretenberg_blackbox_solver + run: | + cargo publish --package barretenberg_blackbox_solver + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish acvm_stdlib + run: | + cargo publish --package acvm_stdlib + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish brillig_vm + run: | + cargo publish --package brillig_vm + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} + + - name: Publish acvm + run: | + cargo publish --package acvm + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.ACVM_CRATES_IO_TOKEN }} diff --git a/noir/.github/workflows/publish-es-packages.yml b/noir/.github/workflows/publish-es-packages.yml new file mode 100644 index 00000000000..2e88ee2b77f --- /dev/null +++ b/noir/.github/workflows/publish-es-packages.yml @@ -0,0 +1,139 @@ +name: Publish Noir ES Packages + +on: + workflow_dispatch: + inputs: + noir-ref: + description: The noir reference to checkout + required: false + default: 'master' + npm-tag: + description: Repository Tag to publish under + required: false + default: 'nightly' + +run-name: Publish ES Packages from ${{ inputs.noir-ref }} under @${{ inputs.npm-tag }} tag. + +jobs: + build-noir_wasm: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.noir-ref }} + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Enable aztec features + if: ${{ inputs.npm-tag == 'aztec' }} + run: | + echo $'\n'"default = [\"aztec\"]"$'\n' >> compiler/noirc_frontend/Cargo.toml + + - name: Build wasm package + run: | + nix build -L .#noir_wasm + + - uses: actions/upload-artifact@v3 + with: + name: noir_wasm + path: | + result/noir_wasm/nodejs + result/noir_wasm/web + + build-noirc_abi_wasm: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.noir-ref }} + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm package + run: | + nix build -L .#noirc_abi_wasm + + - uses: actions/upload-artifact@v3 + with: + name: noirc_abi_wasm + path: | + result/noirc_abi_wasm/nodejs + result/noirc_abi_wasm/web + + build-acvm_js: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.noir-ref }} + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm package + run: | + nix build -L .#acvm_js + + - uses: actions/upload-artifact@v3 + with: + name: acvm_js + path: | + result/acvm_js/nodejs + result/acvm_js/web + + publish-es-packages: + runs-on: ubuntu-latest + needs: [build-acvm_js, build-noirc_abi_wasm, build-noir_wasm] + steps: + + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ inputs.noir-ref }} + + - uses: actions/download-artifact@v3 + with: + name: acvm_js + path: acvm-repo/acvm_js + - uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: compiler/wasm + - uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: tooling/noirc_abi_wasm + + - name: Install Yarn dependencies + run: yarn install + + - name: Build ES Packages + run: yarn build:js:only + + - name: Prepare nightly version + if: ${{ inputs.npm-tag != 'latest' }} + run: | + yarn nightly:version -- .${{ inputs.npm-tag }} + + - name: Authenticate with npm + run: "echo npmAuthToken: ${{ secrets.NPM_TOKEN }} > ~/.yarnrc.yml" + + - name: Publish ES Packages + run: yarn publish:all --access public --tag ${{ inputs.npm-tag }} diff --git a/noir/.github/workflows/publish-nargo.yml b/noir/.github/workflows/publish-nargo.yml new file mode 100644 index 00000000000..59d4fe4cc48 --- /dev/null +++ b/noir/.github/workflows/publish-nargo.yml @@ -0,0 +1,202 @@ +name: Publish Nargo + +on: + workflow_dispatch: + # Allow pushing a manual nightly release + inputs: + tag: + description: The tag to build Nargo from (leave empty to build a nightly release from master) + required: false + features: + description: Extra feature flags to release with + required: false + publish: + description: Whether to publish the build artifacts + type: boolean + default: false + merge_group: + pull_request: + +permissions: + # Necessary to upload new release artifacts + contents: write + +jobs: + build-apple-darwin: + runs-on: macos-latest + env: + CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml + NIGHTLY_RELEASE: ${{ inputs.tag == '' }} + strategy: + matrix: + target: [x86_64-apple-darwin, aarch64-apple-darwin] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || env.GITHUB_REF }} + + - name: Setup for Apple Silicon + if: matrix.target == 'aarch64-apple-darwin' + run: | + sudo xcode-select -s /Applications/Xcode_13.2.1.app/Contents/Developer/ + echo "SDKROOT=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-path)" >> $GITHUB_ENV + echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx$(sw_vers -productVersion) --show-sdk-platform-version)" >> $GITHUB_ENV + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build environment and Compile + run: | + cargo build --package nargo_cli --release --target ${{ matrix.target }} --no-default-features --features "${{ inputs.features }}" + + - name: Package artifacts + run: | + mkdir dist + cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo-${{ matrix.target }} + path: ./dist/* + retention-days: 3 + + - name: Install Yarn dependencies + if: matrix.target == 'x86_64-apple-darwin' + uses: ./.github/actions/setup + + - name: Test built artifact + if: matrix.target == 'x86_64-apple-darwin' + run: | + cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ + yarn workspace release-tests test + + - name: Upload binaries to release tag + uses: svenstaro/upload-release-action@v2 + if: ${{ inputs.publish || github.event_name == 'schedule' }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + overwrite: true + tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch) + + - name: Get formatted date + id: date + if: ${{ inputs.tag == '' && inputs.publish || github.event_name == 'schedule' }} + run: echo "date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Upload binaries to release with date tag + uses: svenstaro/upload-release-action@v2 + if: ${{ inputs.tag == '' && inputs.publish || github.event_name == 'schedule' }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + prerelease: true + make_latest: false + overwrite: true + tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }} + + build-linux: + runs-on: ubuntu-22.04 + env: + CROSS_CONFIG: ${{ github.workspace }}/.github/Cross.toml + NIGHTLY_RELEASE: ${{ inputs.tag == '' }} + strategy: + fail-fast: false + matrix: + target: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || env.GITHUB_REF }} + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Install Cross + uses: taiki-e/install-action@v2 + with: + tool: cross@0.2.5 + + - name: Build Nargo + run: cross build --package nargo_cli --release --target=${{ matrix.target }} --no-default-features --features "${{ inputs.features }}" + + - name: Package artifacts + run: | + mkdir dist + cp ./target/${{ matrix.target }}/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-${{ matrix.target }}.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo-${{ matrix.target }} + path: ./dist/* + retention-days: 3 + + - name: Install Yarn dependencies + if: startsWith(matrix.target, 'x86_64-unknown-linux') + uses: ./.github/actions/setup + + - name: Test built artifact + if: startsWith(matrix.target, 'x86_64-unknown-linux') + run: | + cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ + yarn workspace release-tests test + + - name: Upload binaries to release tag + uses: svenstaro/upload-release-action@v2 + if: ${{ inputs.publish }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + prerelease: true + overwrite: true + tag: ${{ inputs.tag || 'nightly' }} # This will fail if `inputs.tag` is not a tag (e.g. testing a branch) + + - name: Get formatted date + id: date + if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} + run: echo "date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Upload binaries to release with date tag + uses: svenstaro/upload-release-action@v2 + if: ${{ env.NIGHTLY_RELEASE && inputs.publish }} + with: + repo_name: noir-lang/noir + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./nargo-${{ matrix.target }}.tar.gz + asset_name: nargo-${{ matrix.target }}.tar.gz + prerelease: true + make_latest: false + overwrite: true + tag: ${{ format('{0}-{1}', 'nightly', steps.date.outputs.date) }} + + diff --git a/noir/.github/workflows/publish-nightly.yml b/noir/.github/workflows/publish-nightly.yml new file mode 100644 index 00000000000..f5c013883bb --- /dev/null +++ b/noir/.github/workflows/publish-nightly.yml @@ -0,0 +1,26 @@ +name: Publish Nightly release +on: + workflow_dispatch: + schedule: + # Run a nightly release at 2 AM UTC + - cron: "0 2 * * *" + +jobs: + dispatch-publish-es: + runs-on: ubuntu-latest + steps: + - name: Dispatch to publish-nargo + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: publish-nargo.yml + token: ${{ secrets.NOIR_REPO_TOKEN }} + # Omitting a tag results in a nightly + inputs: "{ \"publish\": true }" + + + - name: Dispatch to publish-es-packages + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: publish-es-packages.yml + token: ${{ secrets.NOIR_REPO_TOKEN }} + inputs: "{ \"noir-ref\": \"${{ env.GITHUB_REF }}\", \"npm-tag\": \"nightly\" }" diff --git a/noir/.github/workflows/pull-request-title.yml b/noir/.github/workflows/pull-request-title.yml new file mode 100644 index 00000000000..4b8a626a94e --- /dev/null +++ b/noir/.github/workflows/pull-request-title.yml @@ -0,0 +1,29 @@ +name: Pull Request + +on: + merge_group: + pull_request_target: + types: + - opened + - reopened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + conventional-title: + name: Validate PR title is Conventional Commit + runs-on: ubuntu-latest + steps: + - name: Check title + if: github.event_name == 'pull_request_target' + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + fix + feat + chore diff --git a/noir/.github/workflows/recrawler.yml b/noir/.github/workflows/recrawler.yml new file mode 100644 index 00000000000..ee832e273a1 --- /dev/null +++ b/noir/.github/workflows/recrawler.yml @@ -0,0 +1,22 @@ +name: Algolia Recrawl +on: + push: + branches: [ master ] + workflow_dispatch: + +jobs: + algolia_recrawl: + name: Algolia Recrawl + runs-on: ubuntu-latest + steps: + - name: Algolia crawler creation and crawl + uses: algolia/algoliasearch-crawler-github-actions@v1.1.0 + id: algolia_crawler + with: + crawler-user-id: ${{ secrets.CRAWLER_USER_ID }} + crawler-api-key: ${{ secrets.CRAWLER_API_KEY }} + algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }} + algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }} + site-url: 'https://noir-lang.org/' + crawler-name: noir-lang + override-config: false diff --git a/noir/.github/workflows/release.yml b/noir/.github/workflows/release.yml new file mode 100644 index 00000000000..95da6792f04 --- /dev/null +++ b/noir/.github/workflows/release.yml @@ -0,0 +1,96 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + release-please: + name: Create Release + outputs: + release-pr: ${{ steps.release.outputs.pr }} + tag-name: ${{ steps.release.outputs.tag_name }} + runs-on: ubuntu-latest + steps: + - name: Run release-please + id: release + uses: google-github-actions/release-please-action@v3 + with: + token: ${{ secrets.NOIR_RELEASES_TOKEN }} + command: manifest + + update-lockfile: + name: Update lockfile + needs: [release-please] + if: ${{ needs.release-please.outputs.release-pr }} + runs-on: ubuntu-latest + steps: + - name: Checkout release branch + uses: actions/checkout@v4 + with: + ref: ${{ fromJSON(needs.release-please.outputs.release-pr).headBranchName }} + token: ${{ secrets.NOIR_RELEASES_TOKEN }} + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.65.0 + + - name: Update lockfile + run: | + cargo update --workspace + + - name: Configure git + run: | + git config user.name kevaundray + git config user.email kevtheappdev@gmail.com + + - name: Commit updates + run: | + git add Cargo.lock + git commit -m 'chore: Update lockfile' + git push + + build-binaries: + name: Build binaries + needs: [release-please] + if: ${{ needs.release-please.outputs.tag-name }} + runs-on: ubuntu-latest + steps: + - name: Dispatch to publish workflow + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: publish-nargo.yml + repo: noir-lang/noir + ref: master + token: ${{ secrets.GITHUB_TOKEN }} + inputs: '{ "tag": "${{ needs.release-please.outputs.tag-name }}", "publish": true }' + + publish-es-packages: + name: Publish ES packages + needs: [release-please] + if: ${{ needs.release-please.outputs.tag-name }} + runs-on: ubuntu-latest + steps: + - name: Dispatch to publish-es-packages + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: publish-es-packages.yml + ref: master + token: ${{ secrets.NOIR_REPO_TOKEN }} + inputs: '{ "noir-ref": "${{ needs.release-please.outputs.tag-name }}", "npm-tag": "latest" }' + + + publish-docs: + name: Publish docs + needs: [release-please] + if: ${{ needs.release-please.outputs.tag-name }} + runs-on: ubuntu-latest + steps: + - name: Dispatch to publish workflow + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: docs-new-version.yml + repo: noir-lang/noir + ref: master + token: ${{ secrets.GITHUB_TOKEN }} + inputs: '{ "tag": "${{ needs.release-please.outputs.tag-name }}"}' diff --git a/noir/.github/workflows/spellcheck.yml b/noir/.github/workflows/spellcheck.yml new file mode 100644 index 00000000000..89fcdd12d12 --- /dev/null +++ b/noir/.github/workflows/spellcheck.yml @@ -0,0 +1,13 @@ +name: Spellcheck + +on: [pull_request] + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + spellcheck: + name: Spellcheck + uses: noir-lang/.github/.github/workflows/spellcheck.yml@main diff --git a/noir/.github/workflows/test-abi_wasm.yml b/noir/.github/workflows/test-abi_wasm.yml new file mode 100644 index 00000000000..52223d874bf --- /dev/null +++ b/noir/.github/workflows/test-abi_wasm.yml @@ -0,0 +1,71 @@ +name: ABI Wasm test + +on: + pull_request: + merge_group: + push: + branches: + - master + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build noirc_abi_wasm + run: | + nix build -L .#noirc_abi_wasm + cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm + cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noirc_abi_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 10 + + test: + runs-on: ubuntu-latest + needs: [build] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: ./tooling/noirc_abi_wasm + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Run node tests + run: yarn workspace @noir-lang/noirc_abi test + + - name: Install Playwright + uses: ./.github/actions/install-playwright + + - name: Run browser tests + run: yarn workspace @noir-lang/noirc_abi test:browser + diff --git a/noir/.github/workflows/test-acvm-js.yml b/noir/.github/workflows/test-acvm-js.yml new file mode 100644 index 00000000000..14ce5d916c0 --- /dev/null +++ b/noir/.github/workflows/test-acvm-js.yml @@ -0,0 +1,99 @@ +name: Test acvm_js + +on: + pull_request: + merge_group: + push: + branches: + - master + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-acvm-js-package: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build acvm-js + run: | + nix build -L .#acvm_js + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: acvm-js + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + test-acvm_js-node: + needs: [build-acvm-js-package] + name: Node.js Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./result + + - name: Move build artifacts + run: | + mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs + mv ./result/acvm_js/web ./acvm-repo/acvm_js/web + + - name: Set up test environment + uses: ./.github/actions/setup + + - name: Run node tests + run: yarn workspace @noir-lang/acvm_js test + + test-acvm_js-browser: + needs: [build-acvm-js-package] + name: Browser Tests + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./result + + - name: Move build artifacts + run: | + mv ./result/acvm_js/nodejs ./acvm-repo/acvm_js/nodejs + mv ./result/acvm_js/web ./acvm-repo/acvm_js/web + + - name: Set up test environment + uses: ./.github/actions/setup + + - name: Install playwright deps + run: | + npx playwright install + npx playwright install-deps + + - name: Run browser tests + working-directory: ./acvm-repo/acvm_js + run: yarn workspace @noir-lang/acvm_js test:browser diff --git a/noir/.github/workflows/test-integration.yml b/noir/.github/workflows/test-integration.yml new file mode 100644 index 00000000000..ad28d9c8e86 --- /dev/null +++ b/noir/.github/workflows/test-integration.yml @@ -0,0 +1,199 @@ +name: test-integration + +on: + workflow_dispatch: + pull_request: + merge_group: + schedule: + - cron: "0 2 * * *" # Run nightly at 2 AM UTC + +jobs: + build-nargo: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] + + steps: + - name: Checkout Noir repo + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build Nargo + run: cargo build --package nargo_cli --release + + - name: Package artifacts + run: | + mkdir dist + cp ./target/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo + path: ./dist/* + retention-days: 3 + + build-acvm-js: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build acvm-js + run: | + nix build -L .#acvm_js + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f result/acvm_js)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: acvm-js + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + build-wasm: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm package + run: | + nix build -L .#noir_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noir_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + build-noirc: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build noirc_abi_wasm + run: | + nix build -L .#noirc_abi_wasm + cp -r ./result/noirc_abi_wasm/nodejs ./tooling/noirc_abi_wasm + cp -r ./result/noirc_abi_wasm/web ./tooling/noirc_abi_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noirc_abi_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noirc_abi_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 10 + + test-solidity-verifier: + runs-on: ubuntu-latest + needs: [build-acvm-js, build-wasm, build-nargo, build-noirc] + env: + CACHED_PATH: /tmp/nix-cache + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Download acvm_js package artifact + uses: actions/download-artifact@v3 + with: + name: acvm-js + path: ./acvm-repo/acvm_js + + - name: Download noir_wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: ./compiler/wasm + + - name: Download noirc_abi package artifact + uses: actions/download-artifact@v3 + with: + name: noirc_abi_wasm + path: ./tooling/noirc_abi_wasm + + - name: Set nargo on PATH + run: | + nargo_binary="${{ github.workspace }}/nargo/nargo" + chmod +x $nargo_binary + echo "$(dirname $nargo_binary)" >> $GITHUB_PATH + export PATH="$PATH:$(dirname $nargo_binary)" + nargo -V + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Install Playwright + uses: ./.github/actions/install-playwright + + - name: Setup `integration-tests` + run: | + yarn workspace @noir-lang/source-resolver build + yarn workspace @noir-lang/types build + yarn workspace @noir-lang/backend_barretenberg build + yarn workspace @noir-lang/noir_js build + + - name: Run `integration-tests` + run: | + yarn test:integration + + - name: Alert on nightly test failure + uses: JasonEtco/create-an-issue@v2 + if: ${{ failure() && github.event_name == 'schedule' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WORKFLOW_NAME: ${{ github.workflow }} + WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + with: + update_existing: true + filename: .github/NIGHTLY_TEST_FAILURE.md diff --git a/noir/.github/workflows/test-noir-js.yml b/noir/.github/workflows/test-noir-js.yml new file mode 100644 index 00000000000..e74f2ee6015 --- /dev/null +++ b/noir/.github/workflows/test-noir-js.yml @@ -0,0 +1,61 @@ +name: Test Noir Js + +on: + pull_request: + merge_group: + push: + branches: + - master + +jobs: + test-noir-js: + name: Test Noir JS + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: wasm32-unknown-unknown + + - uses: Swatinem/rust-cache@v2 + with: + key: wasm32-unknown-unknown-noir-js + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Install jq + run: sudo apt-get install jq + + - name: Install wasm-bindgen-cli + uses: taiki-e/install-action@v2 + with: + tool: wasm-bindgen-cli@0.2.86 + + - name: Install wasm-opt + run: | + npm i wasm-opt -g + + - name: Build acvm_js + run: yarn workspace @noir-lang/acvm_js build + + - name: Build noirc_abi + run: yarn workspace @noir-lang/noirc_abi build + + - name: Build noir_js_types + run: yarn workspace @noir-lang/types build + + - name: Build barretenberg wrapper + run: yarn workspace @noir-lang/backend_barretenberg build + + - name: Run noir_js tests + run: | + yarn workspace @noir-lang/noir_js build + yarn workspace @noir-lang/noir_js test diff --git a/noir/.github/workflows/test-noir_wasm.yml b/noir/.github/workflows/test-noir_wasm.yml new file mode 100644 index 00000000000..2175e20acd7 --- /dev/null +++ b/noir/.github/workflows/test-noir_wasm.yml @@ -0,0 +1,125 @@ +name: Wasm + +on: + pull_request: + merge_group: + push: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-nargo: + runs-on: ubuntu-22.04 + strategy: + matrix: + target: [x86_64-unknown-linux-gnu] + + steps: + - name: Checkout Noir repo + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Build Nargo + run: cargo build --package nargo_cli --release + + - name: Package artifacts + run: | + mkdir dist + cp ./target/release/nargo ./dist/nargo + 7z a -ttar -so -an ./dist/* | 7z a -si ./nargo-x86_64-unknown-linux-gnu.tar.gz + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: nargo + path: ./dist/* + retention-days: 3 + + build-wasm: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup Nix + uses: ./.github/actions/nix + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + nix-cache-name: "noir" + cachix-auth-token: ${{ secrets.CACHIXAUTHTOKEN }} + + - name: Build wasm package + run: | + nix build -L .#noir_wasm + + - name: Dereference symlink + run: echo "UPLOAD_PATH=$(readlink -f ./result/noir_wasm)" >> $GITHUB_ENV + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: noir_wasm + path: ${{ env.UPLOAD_PATH }} + retention-days: 3 + + test: + needs: [build-wasm, build-nargo] + name: Test noir_wasm + runs-on: ubuntu-latest + steps: + - name: Checkout noir-lang/noir + uses: actions/checkout@v4 + + - name: Download wasm package artifact + uses: actions/download-artifact@v3 + with: + name: noir_wasm + path: ./compiler/wasm/downloaded + + - name: Download nargo binary + uses: actions/download-artifact@v3 + with: + name: nargo + path: ./nargo + + - name: Compile fixtures with Nargo CLI + working-directory: ./compiler/wasm/fixtures + run: | + nargo_binary=${{ github.workspace }}/nargo/nargo + chmod +x $nargo_binary + for dir in $(ls -d */); do + pushd $dir/noir-script + $nargo_binary compile + popd + done + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Install Playwright + uses: ./.github/actions/install-playwright + + - name: Install dependencies + run: | + cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm + cp -r ./compiler/wasm/downloaded/web ./compiler/wasm + yarn workspace @noir-lang/source-resolver build + + - name: Run node tests + run: yarn workspace @noir-lang/noir_wasm test:node + + - name: Run browser tests + run: yarn workspace @noir-lang/noir_wasm test:browser diff --git a/noir/.github/workflows/test-rust-workspace.yml b/noir/.github/workflows/test-rust-workspace.yml new file mode 100644 index 00000000000..eccd7585fcf --- /dev/null +++ b/noir/.github/workflows/test-rust-workspace.yml @@ -0,0 +1,45 @@ +name: Test + +on: + pull_request: + merge_group: + push: + branches: + - master + +# This will cancel previous runs when a branch or PR is updated +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + test: + name: Test on ${{ matrix.os }} + runs-on: ${{ matrix.runner }} + timeout-minutes: 30 + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu + runner: ubuntu-latest + target: x86_64-unknown-linux-gnu + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup toolchain + uses: dtolnay/rust-toolchain@1.71.1 + with: + targets: ${{ matrix.target }} + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true + save-if: ${{ github.event_name != 'merge_group' }} + + - name: Run tests + run: cargo test --workspace --locked --release diff --git a/noir/.github/workflows/test-source-resolver.yml b/noir/.github/workflows/test-source-resolver.yml new file mode 100644 index 00000000000..5dafe4c5fd9 --- /dev/null +++ b/noir/.github/workflows/test-source-resolver.yml @@ -0,0 +1,26 @@ +name: Test Source Resolver + +on: + push: + paths: + - "compiler/source-resolver/**" + pull_request: + paths: + - "compiler/source-resolver/**" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Yarn dependencies + uses: ./.github/actions/setup + + - name: Build @noir-lang/source-resolver + run: yarn workspace @noir-lang/source-resolver build + + - name: Run tests + run: yarn workspace @noir-lang/source-resolver test diff --git a/noir/.gitignore b/noir/.gitignore new file mode 100644 index 00000000000..169353af2b6 --- /dev/null +++ b/noir/.gitignore @@ -0,0 +1,55 @@ +/target +.DS_Store +examples/**/target/ +examples/9 +node_modules +pkg/ + +# Yarn +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Source resolver +compiler/source-resolver/node_modules +compiler/source-resolver/lib +compiler/source-resolver/lib-node + +# Noir.js +tooling/noir_js/lib + +# Nix stuff +**/outputs +result +.envrc.local +.direnv/ + +# Nargo output +*.proof +*.acir +*.acir.sha256 +*.tr +*.pk +*.vk +**/Verifier.toml +**/target +!tooling/nargo_cli/tests/acir_artifacts/*/target +!tooling/nargo_cli/tests/acir_artifacts/*/target/witness.gz +!compiler/wasm/noir-script/target + +gates_report.json + +# Github Actions scratch space +# This gives a location to download artifacts into the repository in CI without making git dirty. +libbarretenberg-wasm32 + +# Wasm build atifacts +compiler/wasm/nodejs +compiler/wasm/web +tooling/noirc_abi_wasm/nodejs +tooling/noirc_abi_wasm/web +tooling/noir_js/lib diff --git a/noir/.gitrepo b/noir/.gitrepo new file mode 100644 index 00000000000..61242c421bf --- /dev/null +++ b/noir/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme +; +[subrepo] + remote = git@github.com:noir-lang/noir + branch = master + commit = d27db332f8c320ffd9b5520bebbd83ae09e31de7 + parent = 0dc2d586c60587f62e50bb7af0862d1a3f828688 + method = merge + cmdver = 0.4.6 diff --git a/noir/.prettierrc b/noir/.prettierrc new file mode 100644 index 00000000000..ef937f9697a --- /dev/null +++ b/noir/.prettierrc @@ -0,0 +1,6 @@ +{ + "parser": "typescript", + "printWidth": 120, + "singleQuote": true, + "trailingComma": "all" +} \ No newline at end of file diff --git a/noir/.release-please-manifest.json b/noir/.release-please-manifest.json new file mode 100644 index 00000000000..ea8ab2395df --- /dev/null +++ b/noir/.release-please-manifest.json @@ -0,0 +1,4 @@ +{ + ".": "0.19.2", + "acvm-repo": "0.33.0" +} \ No newline at end of file diff --git a/noir/.rustfmt.toml b/noir/.rustfmt.toml new file mode 100644 index 00000000000..c13d3e328d4 --- /dev/null +++ b/noir/.rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2018" +use_small_heuristics = "Max" diff --git a/noir/.vscode/extensions.json b/noir/.vscode/extensions.json new file mode 100644 index 00000000000..1fb1def7ce1 --- /dev/null +++ b/noir/.vscode/extensions.json @@ -0,0 +1,16 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "mkhl.direnv", + "jnoortheen.nix-ide", + "rust-lang.rust-analyzer", + "redhat.vscode-yaml", + "esbenp.prettier-vscode", + // Spell checking + "streetsidesoftware.code-spell-checker", + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/noir/.vscode/settings.json b/noir/.vscode/settings.json new file mode 100644 index 00000000000..171d36f4e04 --- /dev/null +++ b/noir/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "direnv.restart.automatic": true, + "redhat.telemetry.enabled": false, + "yaml.recommendations.show": false, + "nix.serverPath": "nil", + "nix.enableLanguageServer": true, + "nix.serverSettings": { + "nil": { + "formatting": { + "command": [ + "nixpkgs-fmt" + ] + } + } + }, + "yaml.schemas": { + "https://json.schemastore.org/github-workflow.json": "${workspaceRoot}/.github/workflows/*.yml" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/noir/.yarn/plugins/@yarnpkg/plugin-typescript.cjs b/noir/.yarn/plugins/@yarnpkg/plugin-typescript.cjs new file mode 100644 index 00000000000..5c1859e0b90 --- /dev/null +++ b/noir/.yarn/plugins/@yarnpkg/plugin-typescript.cjs @@ -0,0 +1,9 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { +name: "@yarnpkg/plugin-typescript", +factory: function (require) { +var plugin=(()=>{var Ft=Object.create,H=Object.defineProperty,Bt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptor,zt=Object.getOwnPropertyDescriptors,Gt=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,$t=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable;var Re=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))ne.call(t,r)&&Re(e,r,t[r]);if(Q)for(var r of Q(t))De.call(t,r)&&Re(e,r,t[r]);return e},g=(e,t)=>Bt(e,zt(t)),Lt=e=>H(e,"__esModule",{value:!0});var R=(e,t)=>{var r={};for(var s in e)ne.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&Q)for(var s of Q(e))t.indexOf(s)<0&&De.call(e,s)&&(r[s]=e[s]);return r};var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vt=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},Qt=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Gt(t))!ne.call(e,s)&&s!=="default"&&H(e,s,{get:()=>t[s],enumerable:!(r=Kt(t,s))||r.enumerable});return e},C=e=>Qt(Lt(H(e!=null?Ft($t(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var xe=I(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});function _(e){let t=[...e.caches],r=t.shift();return r===void 0?ve():{get(s,n,a={miss:()=>Promise.resolve()}){return r.get(s,n,a).catch(()=>_({caches:t}).get(s,n,a))},set(s,n){return r.set(s,n).catch(()=>_({caches:t}).set(s,n))},delete(s){return r.delete(s).catch(()=>_({caches:t}).delete(s))},clear(){return r.clear().catch(()=>_({caches:t}).clear())}}}function ve(){return{get(e,t,r={miss:()=>Promise.resolve()}){return t().then(n=>Promise.all([n,r.miss(n)])).then(([n])=>n)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}J.createFallbackableCache=_;J.createNullCache=ve});var Ee=I(($s,qe)=>{qe.exports=xe()});var Te=I(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});function Jt(e={serializable:!0}){let t={};return{get(r,s,n={miss:()=>Promise.resolve()}){let a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);let o=s(),d=n&&n.miss||(()=>Promise.resolve());return o.then(y=>d(y)).then(()=>o)},set(r,s){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete t[JSON.stringify(r)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}ae.createInMemoryCache=Jt});var we=I((Vs,Me)=>{Me.exports=Te()});var Ce=I(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});function Xt(e,t,r){let s={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers(){return e===oe.WithinHeaders?s:{}},queryParameters(){return e===oe.WithinQueryParameters?s:{}}}}function Yt(e){let t=0,r=()=>(t++,new Promise(s=>{setTimeout(()=>{s(e(r))},Math.min(100*t,1e3))}));return e(r)}function ke(e,t=(r,s)=>Promise.resolve()){return Object.assign(e,{wait(r){return ke(e.then(s=>Promise.all([t(s,r),s])).then(s=>s[1]))}})}function Zt(e){let t=e.length-1;for(t;t>0;t--){let r=Math.floor(Math.random()*(t+1)),s=e[t];e[t]=e[r],e[r]=s}return e}function er(e,t){return Object.keys(t!==void 0?t:{}).forEach(r=>{e[r]=t[r](e)}),e}function tr(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}var rr="4.2.0",sr=e=>()=>e.transporter.requester.destroy(),oe={WithinQueryParameters:0,WithinHeaders:1};M.AuthMode=oe;M.addMethods=er;M.createAuth=Xt;M.createRetryablePromise=Yt;M.createWaitablePromise=ke;M.destroy=sr;M.encode=tr;M.shuffle=Zt;M.version=rr});var F=I((Js,Ue)=>{Ue.exports=Ce()});var Ne=I(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});var nr={Delete:"DELETE",Get:"GET",Post:"POST",Put:"PUT"};ie.MethodEnum=nr});var B=I((Ys,We)=>{We.exports=Ne()});var Ze=I(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});var He=B();function ce(e,t){let r=e||{},s=r.data||{};return Object.keys(r).forEach(n=>{["timeout","headers","queryParameters","data","cacheable"].indexOf(n)===-1&&(s[n]=r[n])}),{data:Object.entries(s).length>0?s:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var X={Read:1,Write:2,Any:3},U={Up:1,Down:2,Timeouted:3},_e=2*60*1e3;function ue(e,t=U.Up){return g(u({},e),{status:t,lastUpdate:Date.now()})}function Fe(e){return e.status===U.Up||Date.now()-e.lastUpdate>_e}function Be(e){return e.status===U.Timeouted&&Date.now()-e.lastUpdate<=_e}function le(e){return{protocol:e.protocol||"https",url:e.url,accept:e.accept||X.Any}}function ar(e,t){return Promise.all(t.map(r=>e.get(r,()=>Promise.resolve(ue(r))))).then(r=>{let s=r.filter(d=>Fe(d)),n=r.filter(d=>Be(d)),a=[...s,...n],o=a.length>0?a.map(d=>le(d)):t;return{getTimeout(d,y){return(n.length===0&&d===0?1:n.length+3+d)*y},statelessHosts:o}})}var or=({isTimedOut:e,status:t})=>!e&&~~t==0,ir=e=>{let t=e.status;return e.isTimedOut||or(e)||~~(t/100)!=2&&~~(t/100)!=4},cr=({status:e})=>~~(e/100)==2,ur=(e,t)=>ir(e)?t.onRetry(e):cr(e)?t.onSucess(e):t.onFail(e);function Qe(e,t,r,s){let n=[],a=$e(r,s),o=Le(e,s),d=r.method,y=r.method!==He.MethodEnum.Get?{}:u(u({},r.data),s.data),b=u(u(u({"x-algolia-agent":e.userAgent.value},e.queryParameters),y),s.queryParameters),f=0,p=(h,S)=>{let O=h.pop();if(O===void 0)throw Ve(de(n));let P={data:a,headers:o,method:d,url:Ge(O,r.path,b),connectTimeout:S(f,e.timeouts.connect),responseTimeout:S(f,s.timeout)},x=j=>{let T={request:P,response:j,host:O,triesLeft:h.length};return n.push(T),T},v={onSucess:j=>Ke(j),onRetry(j){let T=x(j);return j.isTimedOut&&f++,Promise.all([e.logger.info("Retryable failure",pe(T)),e.hostsCache.set(O,ue(O,j.isTimedOut?U.Timeouted:U.Down))]).then(()=>p(h,S))},onFail(j){throw x(j),ze(j,de(n))}};return e.requester.send(P).then(j=>ur(j,v))};return ar(e.hostsCache,t).then(h=>p([...h.statelessHosts].reverse(),h.getTimeout))}function lr(e){let{hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:a,timeouts:o,userAgent:d,hosts:y,queryParameters:b,headers:f}=e,p={hostsCache:t,logger:r,requester:s,requestsCache:n,responsesCache:a,timeouts:o,userAgent:d,headers:f,queryParameters:b,hosts:y.map(h=>le(h)),read(h,S){let O=ce(S,p.timeouts.read),P=()=>Qe(p,p.hosts.filter(j=>(j.accept&X.Read)!=0),h,O);if((O.cacheable!==void 0?O.cacheable:h.cacheable)!==!0)return P();let v={request:h,mappedRequestOptions:O,transporter:{queryParameters:p.queryParameters,headers:p.headers}};return p.responsesCache.get(v,()=>p.requestsCache.get(v,()=>p.requestsCache.set(v,P()).then(j=>Promise.all([p.requestsCache.delete(v),j]),j=>Promise.all([p.requestsCache.delete(v),Promise.reject(j)])).then(([j,T])=>T)),{miss:j=>p.responsesCache.set(v,j)})},write(h,S){return Qe(p,p.hosts.filter(O=>(O.accept&X.Write)!=0),h,ce(S,p.timeouts.write))}};return p}function dr(e){let t={value:`Algolia for JavaScript (${e})`,add(r){let s=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return t.value.indexOf(s)===-1&&(t.value=`${t.value}${s}`),t}};return t}function Ke(e){try{return JSON.parse(e.content)}catch(t){throw Je(t.message,e)}}function ze({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(n){}return Xe(s,t,r)}function pr(e,...t){let r=0;return e.replace(/%s/g,()=>encodeURIComponent(t[r++]))}function Ge(e,t,r){let s=Ye(r),n=`${e.protocol}://${e.url}/${t.charAt(0)==="/"?t.substr(1):t}`;return s.length&&(n+=`?${s}`),n}function Ye(e){let t=r=>Object.prototype.toString.call(r)==="[object Object]"||Object.prototype.toString.call(r)==="[object Array]";return Object.keys(e).map(r=>pr("%s=%s",r,t(e[r])?JSON.stringify(e[r]):e[r])).join("&")}function $e(e,t){if(e.method===He.MethodEnum.Get||e.data===void 0&&t.data===void 0)return;let r=Array.isArray(e.data)?e.data:u(u({},e.data),t.data);return JSON.stringify(r)}function Le(e,t){let r=u(u({},e.headers),t.headers),s={};return Object.keys(r).forEach(n=>{let a=r[n];s[n.toLowerCase()]=a}),s}function de(e){return e.map(t=>pe(t))}function pe(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return g(u({},e),{request:g(u({},e.request),{headers:u(u({},e.request.headers),t)})})}function Xe(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}function Je(e,t){return{name:"DeserializationError",message:e,response:t}}function Ve(e){return{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:e}}A.CallEnum=X;A.HostStatusEnum=U;A.createApiError=Xe;A.createDeserializationError=Je;A.createMappedRequestOptions=ce;A.createRetryError=Ve;A.createStatefulHost=ue;A.createStatelessHost=le;A.createTransporter=lr;A.createUserAgent=dr;A.deserializeFailure=ze;A.deserializeSuccess=Ke;A.isStatefulHostTimeouted=Be;A.isStatefulHostUp=Fe;A.serializeData=$e;A.serializeHeaders=Le;A.serializeQueryParameters=Ye;A.serializeUrl=Ge;A.stackFrameWithoutCredentials=pe;A.stackTraceWithoutCredentials=de});var K=I((en,et)=>{et.exports=Ze()});var tt=I(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});var N=F(),mr=K(),z=B(),hr=e=>{let t=e.region||"us",r=N.createAuth(N.AuthMode.WithinHeaders,e.appId,e.apiKey),s=mr.createTransporter(g(u({hosts:[{url:`analytics.${t}.algolia.com`}]},e),{headers:u(g(u({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)})),n=e.appId;return N.addMethods({appId:n,transporter:s},e.methods)},yr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Post,path:"2/abtests",data:t},r),gr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Delete,path:N.encode("2/abtests/%s",t)},r),fr=e=>(t,r)=>e.transporter.read({method:z.MethodEnum.Get,path:N.encode("2/abtests/%s",t)},r),br=e=>t=>e.transporter.read({method:z.MethodEnum.Get,path:"2/abtests"},t),Pr=e=>(t,r)=>e.transporter.write({method:z.MethodEnum.Post,path:N.encode("2/abtests/%s/stop",t)},r);w.addABTest=yr;w.createAnalyticsClient=hr;w.deleteABTest=gr;w.getABTest=fr;w.getABTests=br;w.stopABTest=Pr});var st=I((rn,rt)=>{rt.exports=tt()});var at=I(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});var me=F(),jr=K(),nt=B(),Or=e=>{let t=e.region||"us",r=me.createAuth(me.AuthMode.WithinHeaders,e.appId,e.apiKey),s=jr.createTransporter(g(u({hosts:[{url:`recommendation.${t}.algolia.com`}]},e),{headers:u(g(u({},r.headers()),{"content-type":"application/json"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)}));return me.addMethods({appId:e.appId,transporter:s},e.methods)},Ir=e=>t=>e.transporter.read({method:nt.MethodEnum.Get,path:"1/strategies/personalization"},t),Ar=e=>(t,r)=>e.transporter.write({method:nt.MethodEnum.Post,path:"1/strategies/personalization",data:t},r);G.createRecommendationClient=Or;G.getPersonalizationStrategy=Ir;G.setPersonalizationStrategy=Ar});var it=I((nn,ot)=>{ot.exports=at()});var jt=I(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var l=F(),q=K(),m=B(),Sr=require("crypto");function Y(e){let t=r=>e.request(r).then(s=>{if(e.batch!==void 0&&e.batch(s.hits),!e.shouldStop(s))return s.cursor?t({cursor:s.cursor}):t({page:(r.page||0)+1})});return t({})}var Dr=e=>{let t=e.appId,r=l.createAuth(e.authMode!==void 0?e.authMode:l.AuthMode.WithinHeaders,t,e.apiKey),s=q.createTransporter(g(u({hosts:[{url:`${t}-dsn.algolia.net`,accept:q.CallEnum.Read},{url:`${t}.algolia.net`,accept:q.CallEnum.Write}].concat(l.shuffle([{url:`${t}-1.algolianet.com`},{url:`${t}-2.algolianet.com`},{url:`${t}-3.algolianet.com`}]))},e),{headers:u(g(u({},r.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:u(u({},r.queryParameters()),e.queryParameters)})),n={transporter:s,appId:t,addAlgoliaAgent(a,o){s.userAgent.add({segment:a,version:o})},clearCache(){return Promise.all([s.requestsCache.clear(),s.responsesCache.clear()]).then(()=>{})}};return l.addMethods(n,e.methods)};function ct(){return{name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}}function ut(){return{name:"ObjectNotFoundError",message:"Object not found."}}function lt(){return{name:"ValidUntilNotFoundError",message:"ValidUntil not found in given secured api key."}}var Rr=e=>(t,r)=>{let d=r||{},{queryParameters:s}=d,n=R(d,["queryParameters"]),a=u({acl:t},s!==void 0?{queryParameters:s}:{}),o=(y,b)=>l.createRetryablePromise(f=>$(e)(y.key,b).catch(p=>{if(p.status!==404)throw p;return f()}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:"1/keys",data:a},n),o)},vr=e=>(t,r,s)=>{let n=q.createMappedRequestOptions(s);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:m.MethodEnum.Post,path:"1/clusters/mapping",data:{cluster:r}},n)},xr=e=>(t,r,s)=>e.transporter.write({method:m.MethodEnum.Post,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},s),Z=e=>(t,r,s)=>{let n=(a,o)=>L(e)(t,{methods:{waitTask:D}}).waitTask(a.taskID,o);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},s),n)},qr=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Rules]})),Er=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Settings]})),Tr=e=>(t,r,s)=>Z(e)(t,r,g(u({},s),{scope:[ee.Synonyms]})),Mr=e=>(t,r)=>{let s=(n,a)=>l.createRetryablePromise(o=>$(e)(t,a).then(o).catch(d=>{if(d.status!==404)throw d}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/keys/%s",t)},r),s)},wr=()=>(e,t)=>{let r=q.serializeQueryParameters(t),s=Sr.createHmac("sha256",e).update(r).digest("hex");return Buffer.from(s+r).toString("base64")},$=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/keys/%s",t)},r),kr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/logs"},t),Cr=()=>e=>{let t=Buffer.from(e,"base64").toString("ascii"),r=/validUntil=(\d+)/,s=t.match(r);if(s===null)throw lt();return parseInt(s[1],10)-Math.round(new Date().getTime()/1e3)},Ur=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping/top"},t),Nr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/clusters/mapping/%s",t)},r),Wr=e=>t=>{let n=t||{},{retrieveMappings:r}=n,s=R(n,["retrieveMappings"]);return r===!0&&(s.getClusters=!0),e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping/pending"},s)},L=e=>(t,r={})=>{let s={transporter:e.transporter,appId:e.appId,indexName:t};return l.addMethods(s,r.methods)},Hr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/keys"},t),_r=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters"},t),Fr=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/indexes"},t),Br=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:"1/clusters/mapping"},t),Kr=e=>(t,r,s)=>{let n=(a,o)=>L(e)(t,{methods:{waitTask:D}}).waitTask(a.taskID,o);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},s),n)},zr=e=>(t,r)=>{let s=(n,a)=>Promise.all(Object.keys(n.taskID).map(o=>L(e)(o,{methods:{waitTask:D}}).waitTask(n.taskID[o],a)));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:"1/indexes/*/batch",data:{requests:t}},r),s)},Gr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:t}},r),$r=e=>(t,r)=>{let s=t.map(n=>g(u({},n),{params:q.serializeQueryParameters(n.params||{})}));return e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/queries",data:{requests:s},cacheable:!0},r)},Lr=e=>(t,r)=>Promise.all(t.map(s=>{let d=s.params,{facetName:n,facetQuery:a}=d,o=R(d,["facetName","facetQuery"]);return L(e)(s.indexName,{methods:{searchForFacetValues:dt}}).searchForFacetValues(n,a,u(u({},r),o))})),Vr=e=>(t,r)=>{let s=q.createMappedRequestOptions(r);return s.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:m.MethodEnum.Delete,path:"1/clusters/mapping"},s)},Qr=e=>(t,r)=>{let s=(n,a)=>l.createRetryablePromise(o=>$(e)(t,a).catch(d=>{if(d.status!==404)throw d;return o()}));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/keys/%s/restore",t)},r),s)},Jr=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:"1/clusters/mapping/search",data:{query:t}},r),Xr=e=>(t,r)=>{let s=Object.assign({},r),f=r||{},{queryParameters:n}=f,a=R(f,["queryParameters"]),o=n?{queryParameters:n}:{},d=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"],y=p=>Object.keys(s).filter(h=>d.indexOf(h)!==-1).every(h=>p[h]===s[h]),b=(p,h)=>l.createRetryablePromise(S=>$(e)(t,h).then(O=>y(O)?Promise.resolve():S()));return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Put,path:l.encode("1/keys/%s",t),data:o},a),b)},pt=e=>(t,r)=>{let s=(n,a)=>D(e)(n.taskID,a);return l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),s)},Yr=e=>t=>Y(g(u({},t),{shouldStop:r=>r.cursor===void 0,request:r=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/browse",e.indexName),data:r},t)})),Zr=e=>t=>{let r=u({hitsPerPage:1e3},t);return Y(g(u({},r),{shouldStop:s=>s.hits.lengthg(u({},n),{hits:n.hits.map(a=>(delete a._highlightResult,a))}))}}))},es=e=>t=>{let r=u({hitsPerPage:1e3},t);return Y(g(u({},r),{shouldStop:s=>s.hits.lengthg(u({},n),{hits:n.hits.map(a=>(delete a._highlightResult,a))}))}}))},te=e=>(t,r,s)=>{let y=s||{},{batchSize:n}=y,a=R(y,["batchSize"]),o={taskIDs:[],objectIDs:[]},d=(b=0)=>{let f=[],p;for(p=b;p({action:r,body:h})),a).then(h=>(o.objectIDs=o.objectIDs.concat(h.objectIDs),o.taskIDs.push(h.taskID),p++,d(p)))};return l.createWaitablePromise(d(),(b,f)=>Promise.all(b.taskIDs.map(p=>D(e)(p,f))))},ts=e=>t=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/clear",e.indexName)},t),(r,s)=>D(e)(r.taskID,s)),rs=e=>t=>{let a=t||{},{forwardToReplicas:r}=a,s=R(a,["forwardToReplicas"]),n=q.createMappedRequestOptions(s);return r&&(n.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/clear",e.indexName)},n),(o,d)=>D(e)(o.taskID,d))},ss=e=>t=>{let a=t||{},{forwardToReplicas:r}=a,s=R(a,["forwardToReplicas"]),n=q.createMappedRequestOptions(s);return r&&(n.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/clear",e.indexName)},n),(o,d)=>D(e)(o.taskID,d))},ns=e=>(t,r)=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(s,n)=>D(e)(s.taskID,n)),as=e=>t=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s",e.indexName)},t),(r,s)=>D(e)(r.taskID,s)),os=e=>(t,r)=>l.createWaitablePromise(yt(e)([t],r).then(s=>({taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),yt=e=>(t,r)=>{let s=t.map(n=>({objectID:n}));return te(e)(s,k.DeleteObject,r)},is=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s/rules/%s",e.indexName,t)},a),(d,y)=>D(e)(d.taskID,y))},cs=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Delete,path:l.encode("1/indexes/%s/synonyms/%s",e.indexName,t)},a),(d,y)=>D(e)(d.taskID,y))},us=e=>t=>gt(e)(t).then(()=>!0).catch(r=>{if(r.status!==404)throw r;return!1}),ls=e=>(t,r)=>{let y=r||{},{query:s,paginate:n}=y,a=R(y,["query","paginate"]),o=0,d=()=>ft(e)(s||"",g(u({},a),{page:o})).then(b=>{for(let[f,p]of Object.entries(b.hits))if(t(p))return{object:p,position:parseInt(f,10),page:o};if(o++,n===!1||o>=b.nbPages)throw ut();return d()});return d()},ds=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/%s",e.indexName,t)},r),ps=()=>(e,t)=>{for(let[r,s]of Object.entries(e.hits))if(s.objectID===t)return parseInt(r,10);return-1},ms=e=>(t,r)=>{let o=r||{},{attributesToRetrieve:s}=o,n=R(o,["attributesToRetrieve"]),a=t.map(d=>u({indexName:e.indexName,objectID:d},s?{attributesToRetrieve:s}:{}));return e.transporter.read({method:m.MethodEnum.Post,path:"1/indexes/*/objects",data:{requests:a}},n)},hs=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/rules/%s",e.indexName,t)},r),gt=e=>t=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t),ys=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/synonyms/%s",e.indexName,t)},r),bt=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Get,path:l.encode("1/indexes/%s/task/%s",e.indexName,t.toString())},r),gs=e=>(t,r)=>l.createWaitablePromise(Pt(e)([t],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),Pt=e=>(t,r)=>{let o=r||{},{createIfNotExists:s}=o,n=R(o,["createIfNotExists"]),a=s?k.PartialUpdateObject:k.PartialUpdateObjectNoCreate;return te(e)(t,a,n)},fs=e=>(t,r)=>{let O=r||{},{safe:s,autoGenerateObjectIDIfNotExist:n,batchSize:a}=O,o=R(O,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),d=(P,x,v,j)=>l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/operation",P),data:{operation:v,destination:x}},j),(T,V)=>D(e)(T.taskID,V)),y=Math.random().toString(36).substring(7),b=`${e.indexName}_tmp_${y}`,f=he({appId:e.appId,transporter:e.transporter,indexName:b}),p=[],h=d(e.indexName,b,"copy",g(u({},o),{scope:["settings","synonyms","rules"]}));p.push(h);let S=(s?h.wait(o):h).then(()=>{let P=f(t,g(u({},o),{autoGenerateObjectIDIfNotExist:n,batchSize:a}));return p.push(P),s?P.wait(o):P}).then(()=>{let P=d(b,e.indexName,"move",o);return p.push(P),s?P.wait(o):P}).then(()=>Promise.all(p)).then(([P,x,v])=>({objectIDs:x.objectIDs,taskIDs:[P.taskID,...x.taskIDs,v.taskID]}));return l.createWaitablePromise(S,(P,x)=>Promise.all(p.map(v=>v.wait(x))))},bs=e=>(t,r)=>ye(e)(t,g(u({},r),{clearExistingRules:!0})),Ps=e=>(t,r)=>ge(e)(t,g(u({},r),{replaceExistingSynonyms:!0})),js=e=>(t,r)=>l.createWaitablePromise(he(e)([t],r).then(s=>({objectID:s.objectIDs[0],taskID:s.taskIDs[0]})),(s,n)=>D(e)(s.taskID,n)),he=e=>(t,r)=>{let o=r||{},{autoGenerateObjectIDIfNotExist:s}=o,n=R(o,["autoGenerateObjectIDIfNotExist"]),a=s?k.AddObject:k.UpdateObject;if(a===k.UpdateObject){for(let d of t)if(d.objectID===void 0)return l.createWaitablePromise(Promise.reject(ct()))}return te(e)(t,a,n)},Os=e=>(t,r)=>ye(e)([t],r),ye=e=>(t,r)=>{let d=r||{},{forwardToReplicas:s,clearExistingRules:n}=d,a=R(d,["forwardToReplicas","clearExistingRules"]),o=q.createMappedRequestOptions(a);return s&&(o.queryParameters.forwardToReplicas=1),n&&(o.queryParameters.clearExistingRules=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/batch",e.indexName),data:t},o),(y,b)=>D(e)(y.taskID,b))},Is=e=>(t,r)=>ge(e)([t],r),ge=e=>(t,r)=>{let d=r||{},{forwardToReplicas:s,replaceExistingSynonyms:n}=d,a=R(d,["forwardToReplicas","replaceExistingSynonyms"]),o=q.createMappedRequestOptions(a);return s&&(o.queryParameters.forwardToReplicas=1),n&&(o.queryParameters.replaceExistingSynonyms=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/batch",e.indexName),data:t},o),(y,b)=>D(e)(y.taskID,b))},ft=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r),dt=e=>(t,r,s)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},s),mt=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r),ht=e=>(t,r)=>e.transporter.read({method:m.MethodEnum.Post,path:l.encode("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r),As=e=>(t,r)=>{let o=r||{},{forwardToReplicas:s}=o,n=R(o,["forwardToReplicas"]),a=q.createMappedRequestOptions(n);return s&&(a.queryParameters.forwardToReplicas=1),l.createWaitablePromise(e.transporter.write({method:m.MethodEnum.Put,path:l.encode("1/indexes/%s/settings",e.indexName),data:t},a),(d,y)=>D(e)(d.taskID,y))},D=e=>(t,r)=>l.createRetryablePromise(s=>bt(e)(t,r).then(n=>n.status!=="published"?s():void 0)),Ss={AddObject:"addObject",Analytics:"analytics",Browser:"browse",DeleteIndex:"deleteIndex",DeleteObject:"deleteObject",EditSettings:"editSettings",ListIndexes:"listIndexes",Logs:"logs",Recommendation:"recommendation",Search:"search",SeeUnretrievableAttributes:"seeUnretrievableAttributes",Settings:"settings",Usage:"usage"},k={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject"},ee={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},Ds={None:"none",StopIfEnoughMatches:"stopIfEnoughMatches"},Rs={Synonym:"synonym",OneWaySynonym:"oneWaySynonym",AltCorrection1:"altCorrection1",AltCorrection2:"altCorrection2",Placeholder:"placeholder"};i.ApiKeyACLEnum=Ss;i.BatchActionEnum=k;i.ScopeEnum=ee;i.StrategyEnum=Ds;i.SynonymEnum=Rs;i.addApiKey=Rr;i.assignUserID=vr;i.assignUserIDs=xr;i.batch=pt;i.browseObjects=Yr;i.browseRules=Zr;i.browseSynonyms=es;i.chunkedBatch=te;i.clearObjects=ts;i.clearRules=rs;i.clearSynonyms=ss;i.copyIndex=Z;i.copyRules=qr;i.copySettings=Er;i.copySynonyms=Tr;i.createBrowsablePromise=Y;i.createMissingObjectIDError=ct;i.createObjectNotFoundError=ut;i.createSearchClient=Dr;i.createValidUntilNotFoundError=lt;i.deleteApiKey=Mr;i.deleteBy=ns;i.deleteIndex=as;i.deleteObject=os;i.deleteObjects=yt;i.deleteRule=is;i.deleteSynonym=cs;i.exists=us;i.findObject=ls;i.generateSecuredApiKey=wr;i.getApiKey=$;i.getLogs=kr;i.getObject=ds;i.getObjectPosition=ps;i.getObjects=ms;i.getRule=hs;i.getSecuredApiKeyRemainingValidity=Cr;i.getSettings=gt;i.getSynonym=ys;i.getTask=bt;i.getTopUserIDs=Ur;i.getUserID=Nr;i.hasPendingMappings=Wr;i.initIndex=L;i.listApiKeys=Hr;i.listClusters=_r;i.listIndices=Fr;i.listUserIDs=Br;i.moveIndex=Kr;i.multipleBatch=zr;i.multipleGetObjects=Gr;i.multipleQueries=$r;i.multipleSearchForFacetValues=Lr;i.partialUpdateObject=gs;i.partialUpdateObjects=Pt;i.removeUserID=Vr;i.replaceAllObjects=fs;i.replaceAllRules=bs;i.replaceAllSynonyms=Ps;i.restoreApiKey=Qr;i.saveObject=js;i.saveObjects=he;i.saveRule=Os;i.saveRules=ye;i.saveSynonym=Is;i.saveSynonyms=ge;i.search=ft;i.searchForFacetValues=dt;i.searchRules=mt;i.searchSynonyms=ht;i.searchUserIDs=Jr;i.setSettings=As;i.updateApiKey=Xr;i.waitTask=D});var It=I((on,Ot)=>{Ot.exports=jt()});var At=I(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});function vs(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var xs={Debug:1,Info:2,Error:3};re.LogLevelEnum=xs;re.createNullLogger=vs});var Dt=I((un,St)=>{St.exports=At()});var xt=I(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});var Rt=require("http"),vt=require("https"),qs=require("url");function Es(){let e={keepAlive:!0},t=new Rt.Agent(e),r=new vt.Agent(e);return{send(s){return new Promise(n=>{let a=qs.parse(s.url),o=a.query===null?a.pathname:`${a.pathname}?${a.query}`,d=u({agent:a.protocol==="https:"?r:t,hostname:a.hostname,path:o,method:s.method,headers:s.headers},a.port!==void 0?{port:a.port||""}:{}),y=(a.protocol==="https:"?vt:Rt).request(d,h=>{let S="";h.on("data",O=>S+=O),h.on("end",()=>{clearTimeout(f),clearTimeout(p),n({status:h.statusCode||0,content:S,isTimedOut:!1})})}),b=(h,S)=>setTimeout(()=>{y.abort(),n({status:0,content:S,isTimedOut:!0})},h*1e3),f=b(s.connectTimeout,"Connection timeout"),p;y.on("error",h=>{clearTimeout(f),clearTimeout(p),n({status:0,content:h.message,isTimedOut:!1})}),y.once("response",()=>{clearTimeout(f),p=b(s.responseTimeout,"Socket timeout")}),s.data!==void 0&&y.write(s.data),y.end()})},destroy(){return t.destroy(),r.destroy(),Promise.resolve()}}}fe.createNodeHttpRequester=Es});var Et=I((dn,qt)=>{qt.exports=xt()});var kt=I((pn,Tt)=>{"use strict";var Mt=Ee(),Ts=we(),W=st(),be=F(),Pe=it(),c=It(),Ms=Dt(),ws=Et(),ks=K();function wt(e,t,r){let s={appId:e,apiKey:t,timeouts:{connect:2,read:5,write:30},requester:ws.createNodeHttpRequester(),logger:Ms.createNullLogger(),responsesCache:Mt.createNullCache(),requestsCache:Mt.createNullCache(),hostsCache:Ts.createInMemoryCache(),userAgent:ks.createUserAgent(be.version).add({segment:"Node.js",version:process.versions.node})};return c.createSearchClient(g(u(u({},s),r),{methods:{search:c.multipleQueries,searchForFacetValues:c.multipleSearchForFacetValues,multipleBatch:c.multipleBatch,multipleGetObjects:c.multipleGetObjects,multipleQueries:c.multipleQueries,copyIndex:c.copyIndex,copySettings:c.copySettings,copyRules:c.copyRules,copySynonyms:c.copySynonyms,moveIndex:c.moveIndex,listIndices:c.listIndices,getLogs:c.getLogs,listClusters:c.listClusters,multipleSearchForFacetValues:c.multipleSearchForFacetValues,getApiKey:c.getApiKey,addApiKey:c.addApiKey,listApiKeys:c.listApiKeys,updateApiKey:c.updateApiKey,deleteApiKey:c.deleteApiKey,restoreApiKey:c.restoreApiKey,assignUserID:c.assignUserID,assignUserIDs:c.assignUserIDs,getUserID:c.getUserID,searchUserIDs:c.searchUserIDs,listUserIDs:c.listUserIDs,getTopUserIDs:c.getTopUserIDs,removeUserID:c.removeUserID,hasPendingMappings:c.hasPendingMappings,generateSecuredApiKey:c.generateSecuredApiKey,getSecuredApiKeyRemainingValidity:c.getSecuredApiKeyRemainingValidity,destroy:be.destroy,initIndex:n=>a=>c.initIndex(n)(a,{methods:{batch:c.batch,delete:c.deleteIndex,getObject:c.getObject,getObjects:c.getObjects,saveObject:c.saveObject,saveObjects:c.saveObjects,search:c.search,searchForFacetValues:c.searchForFacetValues,waitTask:c.waitTask,setSettings:c.setSettings,getSettings:c.getSettings,partialUpdateObject:c.partialUpdateObject,partialUpdateObjects:c.partialUpdateObjects,deleteObject:c.deleteObject,deleteObjects:c.deleteObjects,deleteBy:c.deleteBy,clearObjects:c.clearObjects,browseObjects:c.browseObjects,getObjectPosition:c.getObjectPosition,findObject:c.findObject,exists:c.exists,saveSynonym:c.saveSynonym,saveSynonyms:c.saveSynonyms,getSynonym:c.getSynonym,searchSynonyms:c.searchSynonyms,browseSynonyms:c.browseSynonyms,deleteSynonym:c.deleteSynonym,clearSynonyms:c.clearSynonyms,replaceAllObjects:c.replaceAllObjects,replaceAllSynonyms:c.replaceAllSynonyms,searchRules:c.searchRules,getRule:c.getRule,deleteRule:c.deleteRule,saveRule:c.saveRule,saveRules:c.saveRules,replaceAllRules:c.replaceAllRules,browseRules:c.browseRules,clearRules:c.clearRules}}),initAnalytics:()=>n=>W.createAnalyticsClient(g(u(u({},s),n),{methods:{addABTest:W.addABTest,getABTest:W.getABTest,getABTests:W.getABTests,stopABTest:W.stopABTest,deleteABTest:W.deleteABTest}})),initRecommendation:()=>n=>Pe.createRecommendationClient(g(u(u({},s),n),{methods:{getPersonalizationStrategy:Pe.getPersonalizationStrategy,setPersonalizationStrategy:Pe.setPersonalizationStrategy}}))}}))}wt.version=be.version;Tt.exports=wt});var Ut=I((mn,je)=>{var Ct=kt();je.exports=Ct;je.exports.default=Ct});var Ws={};Vt(Ws,{default:()=>Ks});var Oe=C(require("@yarnpkg/core")),E=C(require("@yarnpkg/core")),Ie=C(require("@yarnpkg/plugin-essentials")),Ht=C(require("semver"));var se=C(require("@yarnpkg/core")),Nt=C(Ut()),Cs="e8e1bd300d860104bb8c58453ffa1eb4",Us="OFCNCOG2CU",Wt=async(e,t)=>{var a;let r=se.structUtils.stringifyIdent(e),n=Ns(t).initIndex("npm-search");try{return((a=(await n.getObject(r,{attributesToRetrieve:["types"]})).types)==null?void 0:a.ts)==="definitely-typed"}catch(o){return!1}},Ns=e=>(0,Nt.default)(Us,Cs,{requester:{async send(r){try{let s=await se.httpUtils.request(r.url,r.data||null,{configuration:e,headers:r.headers});return{content:s.body,isTimedOut:!1,status:s.statusCode}}catch(s){return{content:s.response.body,isTimedOut:!1,status:s.response.statusCode}}}}});var _t=e=>e.scope?`${e.scope}__${e.name}`:`${e.name}`,Hs=async(e,t,r,s)=>{if(r.scope==="types")return;let{project:n}=e,{configuration:a}=n,o=a.makeResolver(),d={project:n,resolver:o,report:new E.ThrowReport};if(!await Wt(r,a))return;let b=_t(r),f=E.structUtils.parseRange(r.range).selector;if(!E.semverUtils.validRange(f)){let P=await o.getCandidates(r,new Map,d);f=E.structUtils.parseRange(P[0].reference).selector}let p=Ht.default.coerce(f);if(p===null)return;let h=`${Ie.suggestUtils.Modifier.CARET}${p.major}`,S=E.structUtils.makeDescriptor(E.structUtils.makeIdent("types",b),h),O=E.miscUtils.mapAndFind(n.workspaces,P=>{var T,V;let x=(T=P.manifest.dependencies.get(r.identHash))==null?void 0:T.descriptorHash,v=(V=P.manifest.devDependencies.get(r.identHash))==null?void 0:V.descriptorHash;if(x!==r.descriptorHash&&v!==r.descriptorHash)return E.miscUtils.mapAndFind.skip;let j=[];for(let Ae of Oe.Manifest.allDependencies){let Se=P.manifest[Ae].get(S.identHash);typeof Se!="undefined"&&j.push([Ae,Se])}return j.length===0?E.miscUtils.mapAndFind.skip:j});if(typeof O!="undefined")for(let[P,x]of O)e.manifest[P].set(x.identHash,x);else{try{if((await o.getCandidates(S,new Map,d)).length===0)return}catch{return}e.manifest[Ie.suggestUtils.Target.DEVELOPMENT].set(S.identHash,S)}},_s=async(e,t,r)=>{if(r.scope==="types")return;let s=_t(r),n=E.structUtils.makeIdent("types",s);for(let a of Oe.Manifest.allDependencies)typeof e.manifest[a].get(n.identHash)!="undefined"&&e.manifest[a].delete(n.identHash)},Fs=(e,t)=>{t.publishConfig&&t.publishConfig.typings&&(t.typings=t.publishConfig.typings),t.publishConfig&&t.publishConfig.types&&(t.types=t.publishConfig.types)},Bs={hooks:{afterWorkspaceDependencyAddition:Hs,afterWorkspaceDependencyRemoval:_s,beforeWorkspacePacking:Fs}},Ks=Bs;return Ws;})(); +return plugin; +} +}; diff --git a/noir/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs b/noir/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs new file mode 100644 index 00000000000..4e89c7c352c --- /dev/null +++ b/noir/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs @@ -0,0 +1,28 @@ +/* eslint-disable */ +//prettier-ignore +module.exports = { +name: "@yarnpkg/plugin-workspace-tools", +factory: function (require) { +var plugin=(()=>{var yr=Object.create;var we=Object.defineProperty;var _r=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty;var W=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var q=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Cr=(e,r)=>{for(var t in r)we(e,t,{get:r[t],enumerable:!0})},Je=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Er(r))!xr.call(e,s)&&s!==t&&we(e,s,{get:()=>r[s],enumerable:!(n=_r(r,s))||n.enumerable});return e};var Be=(e,r,t)=>(t=e!=null?yr(br(e)):{},Je(r||!e||!e.__esModule?we(t,"default",{value:e,enumerable:!0}):t,e)),wr=e=>Je(we({},"__esModule",{value:!0}),e);var ve=q(ee=>{"use strict";ee.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;ee.find=(e,r)=>e.nodes.find(t=>t.type===r);ee.exceedsLimit=(e,r,t=1,n)=>n===!1||!ee.isInteger(e)||!ee.isInteger(r)?!1:(Number(r)-Number(e))/Number(t)>=n;ee.escapeNode=(e,r=0,t)=>{let n=e.nodes[r];!n||(t&&n.type===t||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ee.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;ee.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;ee.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;ee.reduce=e=>e.reduce((r,t)=>(t.type==="text"&&r.push(t.value),t.type==="range"&&(t.type="text"),r),[]);ee.flatten=(...e)=>{let r=[],t=n=>{for(let s=0;s{"use strict";var tt=ve();rt.exports=(e,r={})=>{let t=(n,s={})=>{let i=r.escapeInvalid&&tt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c="";if(n.value)return(i||a)&&tt.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let p of n.nodes)c+=t(p);return c};return t(e)}});var st=q((Vn,nt)=>{"use strict";nt.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var ht=q((Jn,pt)=>{"use strict";var at=st(),le=(e,r,t)=>{if(at(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(r===void 0||e===r)return String(e);if(at(r)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...t};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),c=String(n.wrap),p=e+":"+r+"="+s+i+a+c;if(le.cache.hasOwnProperty(p))return le.cache[p].result;let m=Math.min(e,r),h=Math.max(e,r);if(Math.abs(m-h)===1){let y=e+"|"+r;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let R=ft(e)||ft(r),f={min:e,max:r,a:m,b:h},$=[],_=[];if(R&&(f.isPadded=R,f.maxLen=String(f.max).length),m<0){let y=h<0?Math.abs(h):1;_=it(y,Math.abs(m),f,n),m=f.a=0}return h>=0&&($=it(m,h,f,n)),f.negatives=_,f.positives=$,f.result=Sr(_,$,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&$.length+_.length>1&&(f.result=`(?:${f.result})`),le.cache[p]=f,f.result};function Sr(e,r,t){let n=Pe(e,r,"-",!1,t)||[],s=Pe(r,e,"",!1,t)||[],i=Pe(e,r,"-?",!0,t)||[];return n.concat(i).concat(s).join("|")}function vr(e,r){let t=1,n=1,s=ut(e,t),i=new Set([r]);for(;e<=s&&s<=r;)i.add(s),t+=1,s=ut(e,t);for(s=ct(r+1,n)-1;e1&&c.count.pop(),c.count.push(h.count[0]),c.string=c.pattern+lt(c.count),a=m+1;continue}t.isPadded&&(R=Lr(m,t,n)),h.string=R+h.pattern+lt(h.count),i.push(h),a=m+1,c=h}return i}function Pe(e,r,t,n,s){let i=[];for(let a of e){let{string:c}=a;!n&&!ot(r,"string",c)&&i.push(t+c),n&&ot(r,"string",c)&&i.push(t+c)}return i}function $r(e,r){let t=[];for(let n=0;nr?1:r>e?-1:0}function ot(e,r,t){return e.some(n=>n[r]===t)}function ut(e,r){return Number(String(e).slice(0,-r)+"9".repeat(r))}function ct(e,r){return e-e%Math.pow(10,r)}function lt(e){let[r=0,t=""]=e;return t||r>1?`{${r+(t?","+t:"")}}`:""}function kr(e,r,t){return`[${e}${r-e===1?"":"-"}${r}]`}function ft(e){return/^-?(0+)\d/.test(e)}function Lr(e,r,t){if(!r.isPadded)return e;let n=Math.abs(r.maxLen-String(e).length),s=t.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}le.cache={};le.clearCache=()=>le.cache={};pt.exports=le});var Ue=q((es,Et)=>{"use strict";var Or=W("util"),At=ht(),dt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Nr=e=>r=>e===!0?Number(r):String(r),Me=e=>typeof e=="number"||typeof e=="string"&&e!=="",Ae=e=>Number.isInteger(+e),De=e=>{let r=`${e}`,t=-1;if(r[0]==="-"&&(r=r.slice(1)),r==="0")return!1;for(;r[++t]==="0";);return t>0},Ir=(e,r,t)=>typeof e=="string"||typeof r=="string"?!0:t.stringify===!0,Br=(e,r,t)=>{if(r>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?r-1:r,"0")}return t===!1?String(e):e},gt=(e,r)=>{let t=e[0]==="-"?"-":"";for(t&&(e=e.slice(1),r--);e.length{e.negatives.sort((a,c)=>ac?1:0),e.positives.sort((a,c)=>ac?1:0);let t=r.capture?"":"?:",n="",s="",i;return e.positives.length&&(n=e.positives.join("|")),e.negatives.length&&(s=`-(${t}${e.negatives.join("|")})`),n&&s?i=`${n}|${s}`:i=n||s,r.wrap?`(${t}${i})`:i},mt=(e,r,t,n)=>{if(t)return At(e,r,{wrap:!1,...n});let s=String.fromCharCode(e);if(e===r)return s;let i=String.fromCharCode(r);return`[${s}-${i}]`},Rt=(e,r,t)=>{if(Array.isArray(e)){let n=t.wrap===!0,s=t.capture?"":"?:";return n?`(${s}${e.join("|")})`:e.join("|")}return At(e,r,t)},yt=(...e)=>new RangeError("Invalid range arguments: "+Or.inspect(...e)),_t=(e,r,t)=>{if(t.strictRanges===!0)throw yt([e,r]);return[]},Mr=(e,r)=>{if(r.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Dr=(e,r,t=1,n={})=>{let s=Number(e),i=Number(r);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw yt([e,r]);return[]}s===0&&(s=0),i===0&&(i=0);let a=s>i,c=String(e),p=String(r),m=String(t);t=Math.max(Math.abs(t),1);let h=De(c)||De(p)||De(m),R=h?Math.max(c.length,p.length,m.length):0,f=h===!1&&Ir(e,r,n)===!1,$=n.transform||Nr(f);if(n.toRegex&&t===1)return mt(gt(e,R),gt(r,R),!0,n);let _={negatives:[],positives:[]},y=T=>_[T<0?"negatives":"positives"].push(Math.abs(T)),E=[],S=0;for(;a?s>=i:s<=i;)n.toRegex===!0&&t>1?y(s):E.push(Br($(s,S),R,f)),s=a?s-t:s+t,S++;return n.toRegex===!0?t>1?Pr(_,n):Rt(E,null,{wrap:!1,...n}):E},Ur=(e,r,t=1,n={})=>{if(!Ae(e)&&e.length>1||!Ae(r)&&r.length>1)return _t(e,r,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${e}`.charCodeAt(0),a=`${r}`.charCodeAt(0),c=i>a,p=Math.min(i,a),m=Math.max(i,a);if(n.toRegex&&t===1)return mt(p,m,!1,n);let h=[],R=0;for(;c?i>=a:i<=a;)h.push(s(i,R)),i=c?i-t:i+t,R++;return n.toRegex===!0?Rt(h,null,{wrap:!1,options:n}):h},$e=(e,r,t,n={})=>{if(r==null&&Me(e))return[e];if(!Me(e)||!Me(r))return _t(e,r,n);if(typeof t=="function")return $e(e,r,1,{transform:t});if(dt(t))return $e(e,r,0,t);let s={...n};return s.capture===!0&&(s.wrap=!0),t=t||s.step||1,Ae(t)?Ae(e)&&Ae(r)?Dr(e,r,t,s):Ur(e,r,Math.max(Math.abs(t),1),s):t!=null&&!dt(t)?Mr(t,s):$e(e,r,1,t)};Et.exports=$e});var Ct=q((ts,xt)=>{"use strict";var Gr=Ue(),bt=ve(),qr=(e,r={})=>{let t=(n,s={})=>{let i=bt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c=i===!0||a===!0,p=r.escapeInvalid===!0?"\\":"",m="";if(n.isOpen===!0||n.isClose===!0)return p+n.value;if(n.type==="open")return c?p+n.value:"(";if(n.type==="close")return c?p+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":c?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let h=bt.reduce(n.nodes),R=Gr(...h,{...r,wrap:!1,toRegex:!0});if(R.length!==0)return h.length>1&&R.length>1?`(${R})`:R}if(n.nodes)for(let h of n.nodes)m+=t(h,n);return m};return t(e)};xt.exports=qr});var vt=q((rs,St)=>{"use strict";var Kr=Ue(),wt=He(),he=ve(),fe=(e="",r="",t=!1)=>{let n=[];if(e=[].concat(e),r=[].concat(r),!r.length)return e;if(!e.length)return t?he.flatten(r).map(s=>`{${s}}`):r;for(let s of e)if(Array.isArray(s))for(let i of s)n.push(fe(i,r,t));else for(let i of r)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?fe(s,i,t):s+i);return he.flatten(n)},Wr=(e,r={})=>{let t=r.rangeLimit===void 0?1e3:r.rangeLimit,n=(s,i={})=>{s.queue=[];let a=i,c=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(s.invalid||s.dollar){c.push(fe(c.pop(),wt(s,r)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){c.push(fe(c.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let R=he.reduce(s.nodes);if(he.exceedsLimit(...R,r.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Kr(...R,r);f.length===0&&(f=wt(s,r)),c.push(fe(c.pop(),f)),s.nodes=[];return}let p=he.encloseBrace(s),m=s.queue,h=s;for(;h.type!=="brace"&&h.type!=="root"&&h.parent;)h=h.parent,m=h.queue;for(let R=0;R{"use strict";Ht.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:` +`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Nt=q((ss,Ot)=>{"use strict";var jr=He(),{MAX_LENGTH:Tt,CHAR_BACKSLASH:Ge,CHAR_BACKTICK:Fr,CHAR_COMMA:Qr,CHAR_DOT:Xr,CHAR_LEFT_PARENTHESES:Zr,CHAR_RIGHT_PARENTHESES:Yr,CHAR_LEFT_CURLY_BRACE:zr,CHAR_RIGHT_CURLY_BRACE:Vr,CHAR_LEFT_SQUARE_BRACKET:kt,CHAR_RIGHT_SQUARE_BRACKET:Lt,CHAR_DOUBLE_QUOTE:Jr,CHAR_SINGLE_QUOTE:en,CHAR_NO_BREAK_SPACE:tn,CHAR_ZERO_WIDTH_NOBREAK_SPACE:rn}=$t(),nn=(e,r={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let t=r||{},n=typeof t.maxLength=="number"?Math.min(Tt,t.maxLength):Tt;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let s={type:"root",input:e,nodes:[]},i=[s],a=s,c=s,p=0,m=e.length,h=0,R=0,f,$={},_=()=>e[h++],y=E=>{if(E.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&E.type==="text"){c.value+=E.value;return}return a.nodes.push(E),E.parent=a,E.prev=c,c=E,E};for(y({type:"bos"});h0){if(a.ranges>0){a.ranges=0;let E=a.nodes.shift();a.nodes=[E,{type:"text",value:jr(a)}]}y({type:"comma",value:f}),a.commas++;continue}if(f===Xr&&R>0&&a.commas===0){let E=a.nodes;if(R===0||E.length===0){y({type:"text",value:f});continue}if(c.type==="dot"){if(a.range=[],c.value+=f,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){E.pop();let S=E[E.length-1];S.value+=c.value+f,c=S,a.ranges--;continue}y({type:"dot",value:f});continue}y({type:"text",value:f})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(T=>{T.nodes||(T.type==="open"&&(T.isOpen=!0),T.type==="close"&&(T.isClose=!0),T.nodes||(T.type="text"),T.invalid=!0)});let E=i[i.length-1],S=E.nodes.indexOf(a);E.nodes.splice(S,1,...a.nodes)}while(i.length>0);return y({type:"eos"}),s};Ot.exports=nn});var Pt=q((as,Bt)=>{"use strict";var It=He(),sn=Ct(),an=vt(),on=Nt(),Z=(e,r={})=>{let t=[];if(Array.isArray(e))for(let n of e){let s=Z.create(n,r);Array.isArray(s)?t.push(...s):t.push(s)}else t=[].concat(Z.create(e,r));return r&&r.expand===!0&&r.nodupes===!0&&(t=[...new Set(t)]),t};Z.parse=(e,r={})=>on(e,r);Z.stringify=(e,r={})=>It(typeof e=="string"?Z.parse(e,r):e,r);Z.compile=(e,r={})=>(typeof e=="string"&&(e=Z.parse(e,r)),sn(e,r));Z.expand=(e,r={})=>{typeof e=="string"&&(e=Z.parse(e,r));let t=an(e,r);return r.noempty===!0&&(t=t.filter(Boolean)),r.nodupes===!0&&(t=[...new Set(t)]),t};Z.create=(e,r={})=>e===""||e.length<3?[e]:r.expand!==!0?Z.compile(e,r):Z.expand(e,r);Bt.exports=Z});var me=q((is,qt)=>{"use strict";var un=W("path"),se="\\\\/",Mt=`[^${se}]`,ie="\\.",cn="\\+",ln="\\?",Te="\\/",fn="(?=.)",Dt="[^/]",qe=`(?:${Te}|$)`,Ut=`(?:^|${Te})`,Ke=`${ie}{1,2}${qe}`,pn=`(?!${ie})`,hn=`(?!${Ut}${Ke})`,dn=`(?!${ie}{0,1}${qe})`,gn=`(?!${Ke})`,An=`[^.${Te}]`,mn=`${Dt}*?`,Gt={DOT_LITERAL:ie,PLUS_LITERAL:cn,QMARK_LITERAL:ln,SLASH_LITERAL:Te,ONE_CHAR:fn,QMARK:Dt,END_ANCHOR:qe,DOTS_SLASH:Ke,NO_DOT:pn,NO_DOTS:hn,NO_DOT_SLASH:dn,NO_DOTS_SLASH:gn,QMARK_NO_DOT:An,STAR:mn,START_ANCHOR:Ut},Rn={...Gt,SLASH_LITERAL:`[${se}]`,QMARK:Mt,STAR:`${Mt}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${se}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${se}])${ie}{1,2}(?:[${se}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${se}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${se}]|$))`,QMARK_NO_DOT:`[^.${se}]`,START_ANCHOR:`(?:^|[${se}])`,END_ANCHOR:`(?:[${se}]|$)`},yn={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};qt.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:yn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:un.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Rn:Gt}}});var Re=q(Q=>{"use strict";var _n=W("path"),En=process.platform==="win32",{REGEX_BACKSLASH:bn,REGEX_REMOVE_BACKSLASH:xn,REGEX_SPECIAL_CHARS:Cn,REGEX_SPECIAL_CHARS_GLOBAL:wn}=me();Q.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);Q.hasRegexChars=e=>Cn.test(e);Q.isRegexChar=e=>e.length===1&&Q.hasRegexChars(e);Q.escapeRegex=e=>e.replace(wn,"\\$1");Q.toPosixSlashes=e=>e.replace(bn,"/");Q.removeBackslashes=e=>e.replace(xn,r=>r==="\\"?"":r);Q.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};Q.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:En===!0||_n.sep==="\\";Q.escapeLast=(e,r,t)=>{let n=e.lastIndexOf(r,t);return n===-1?e:e[n-1]==="\\"?Q.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};Q.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};Q.wrapOutput=(e,r={},t={})=>{let n=t.contains?"":"^",s=t.contains?"":"$",i=`${n}(?:${e})${s}`;return r.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Yt=q((us,Zt)=>{"use strict";var Kt=Re(),{CHAR_ASTERISK:We,CHAR_AT:Sn,CHAR_BACKWARD_SLASH:ye,CHAR_COMMA:vn,CHAR_DOT:je,CHAR_EXCLAMATION_MARK:Fe,CHAR_FORWARD_SLASH:Xt,CHAR_LEFT_CURLY_BRACE:Qe,CHAR_LEFT_PARENTHESES:Xe,CHAR_LEFT_SQUARE_BRACKET:Hn,CHAR_PLUS:$n,CHAR_QUESTION_MARK:Wt,CHAR_RIGHT_CURLY_BRACE:Tn,CHAR_RIGHT_PARENTHESES:jt,CHAR_RIGHT_SQUARE_BRACKET:kn}=me(),Ft=e=>e===Xt||e===ye,Qt=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Ln=(e,r)=>{let t=r||{},n=e.length-1,s=t.parts===!0||t.scanToEnd===!0,i=[],a=[],c=[],p=e,m=-1,h=0,R=0,f=!1,$=!1,_=!1,y=!1,E=!1,S=!1,T=!1,L=!1,z=!1,I=!1,re=0,K,g,v={value:"",depth:0,isGlob:!1},k=()=>m>=n,l=()=>p.charCodeAt(m+1),H=()=>(K=g,p.charCodeAt(++m));for(;m0&&(B=p.slice(0,h),p=p.slice(h),R-=h),w&&_===!0&&R>0?(w=p.slice(0,R),o=p.slice(R)):_===!0?(w="",o=p):w=p,w&&w!==""&&w!=="/"&&w!==p&&Ft(w.charCodeAt(w.length-1))&&(w=w.slice(0,-1)),t.unescape===!0&&(o&&(o=Kt.removeBackslashes(o)),w&&T===!0&&(w=Kt.removeBackslashes(w)));let u={prefix:B,input:e,start:h,base:w,glob:o,isBrace:f,isBracket:$,isGlob:_,isExtglob:y,isGlobstar:E,negated:L,negatedExtglob:z};if(t.tokens===!0&&(u.maxDepth=0,Ft(g)||a.push(v),u.tokens=a),t.parts===!0||t.tokens===!0){let P;for(let b=0;b{"use strict";var ke=me(),Y=Re(),{MAX_LENGTH:Le,POSIX_REGEX_SOURCE:On,REGEX_NON_SPECIAL_CHARS:Nn,REGEX_SPECIAL_CHARS_BACKREF:In,REPLACEMENTS:zt}=ke,Bn=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t)}catch{return e.map(s=>Y.escapeRegex(s)).join("..")}return t},de=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Vt=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=zt[e]||e;let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:t.prepend||""},a=[i],c=t.capture?"":"?:",p=Y.isWindows(r),m=ke.globChars(p),h=ke.extglobChars(m),{DOT_LITERAL:R,PLUS_LITERAL:f,SLASH_LITERAL:$,ONE_CHAR:_,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:S,NO_DOTS_SLASH:T,QMARK:L,QMARK_NO_DOT:z,STAR:I,START_ANCHOR:re}=m,K=A=>`(${c}(?:(?!${re}${A.dot?y:R}).)*?)`,g=t.dot?"":E,v=t.dot?L:z,k=t.bash===!0?K(t):I;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let l={input:e,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=Y.removePrefix(e,l),s=e.length;let H=[],w=[],B=[],o=i,u,P=()=>l.index===s-1,b=l.peek=(A=1)=>e[l.index+A],V=l.advance=()=>e[++l.index]||"",J=()=>e.slice(l.index+1),X=(A="",O=0)=>{l.consumed+=A,l.index+=O},Ee=A=>{l.output+=A.output!=null?A.output:A.value,X(A.value)},mr=()=>{let A=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)V(),l.start++,A++;return A%2===0?!1:(l.negated=!0,l.start++,!0)},be=A=>{l[A]++,B.push(A)},oe=A=>{l[A]--,B.pop()},C=A=>{if(o.type==="globstar"){let O=l.braces>0&&(A.type==="comma"||A.type==="brace"),d=A.extglob===!0||H.length&&(A.type==="pipe"||A.type==="paren");A.type!=="slash"&&A.type!=="paren"&&!O&&!d&&(l.output=l.output.slice(0,-o.output.length),o.type="star",o.value="*",o.output=k,l.output+=o.output)}if(H.length&&A.type!=="paren"&&(H[H.length-1].inner+=A.value),(A.value||A.output)&&Ee(A),o&&o.type==="text"&&A.type==="text"){o.value+=A.value,o.output=(o.output||"")+A.value;return}A.prev=o,a.push(A),o=A},xe=(A,O)=>{let d={...h[O],conditions:1,inner:""};d.prev=o,d.parens=l.parens,d.output=l.output;let x=(t.capture?"(":"")+d.open;be("parens"),C({type:A,value:O,output:l.output?"":_}),C({type:"paren",extglob:!0,value:V(),output:x}),H.push(d)},Rr=A=>{let O=A.close+(t.capture?")":""),d;if(A.type==="negate"){let x=k;A.inner&&A.inner.length>1&&A.inner.includes("/")&&(x=K(t)),(x!==k||P()||/^\)+$/.test(J()))&&(O=A.close=`)$))${x}`),A.inner.includes("*")&&(d=J())&&/^\.[^\\/.]+$/.test(d)&&(O=A.close=`)${d})${x})`),A.prev.type==="bos"&&(l.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:u,output:O}),oe("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let A=!1,O=e.replace(In,(d,x,M,j,G,Ie)=>j==="\\"?(A=!0,d):j==="?"?x?x+j+(G?L.repeat(G.length):""):Ie===0?v+(G?L.repeat(G.length):""):L.repeat(M.length):j==="."?R.repeat(M.length):j==="*"?x?x+j+(G?k:""):k:x?d:`\\${d}`);return A===!0&&(t.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,d=>d.length%2===0?"\\\\":d?"\\":"")),O===e&&t.contains===!0?(l.output=e,l):(l.output=Y.wrapOutput(O,l,r),l)}for(;!P();){if(u=V(),u==="\0")continue;if(u==="\\"){let d=b();if(d==="/"&&t.bash!==!0||d==="."||d===";")continue;if(!d){u+="\\",C({type:"text",value:u});continue}let x=/^\\+/.exec(J()),M=0;if(x&&x[0].length>2&&(M=x[0].length,l.index+=M,M%2!==0&&(u+="\\")),t.unescape===!0?u=V():u+=V(),l.brackets===0){C({type:"text",value:u});continue}}if(l.brackets>0&&(u!=="]"||o.value==="["||o.value==="[^")){if(t.posix!==!1&&u===":"){let d=o.value.slice(1);if(d.includes("[")&&(o.posix=!0,d.includes(":"))){let x=o.value.lastIndexOf("["),M=o.value.slice(0,x),j=o.value.slice(x+2),G=On[j];if(G){o.value=M+G,l.backtrack=!0,V(),!i.output&&a.indexOf(o)===1&&(i.output=_);continue}}}(u==="["&&b()!==":"||u==="-"&&b()==="]")&&(u=`\\${u}`),u==="]"&&(o.value==="["||o.value==="[^")&&(u=`\\${u}`),t.posix===!0&&u==="!"&&o.value==="["&&(u="^"),o.value+=u,Ee({value:u});continue}if(l.quotes===1&&u!=='"'){u=Y.escapeRegex(u),o.value+=u,Ee({value:u});continue}if(u==='"'){l.quotes=l.quotes===1?0:1,t.keepQuotes===!0&&C({type:"text",value:u});continue}if(u==="("){be("parens"),C({type:"paren",value:u});continue}if(u===")"){if(l.parens===0&&t.strictBrackets===!0)throw new SyntaxError(de("opening","("));let d=H[H.length-1];if(d&&l.parens===d.parens+1){Rr(H.pop());continue}C({type:"paren",value:u,output:l.parens?")":"\\)"}),oe("parens");continue}if(u==="["){if(t.nobracket===!0||!J().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));u=`\\${u}`}else be("brackets");C({type:"bracket",value:u});continue}if(u==="]"){if(t.nobracket===!0||o&&o.type==="bracket"&&o.value.length===1){C({type:"text",value:u,output:`\\${u}`});continue}if(l.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(de("opening","["));C({type:"text",value:u,output:`\\${u}`});continue}oe("brackets");let d=o.value.slice(1);if(o.posix!==!0&&d[0]==="^"&&!d.includes("/")&&(u=`/${u}`),o.value+=u,Ee({value:u}),t.literalBrackets===!1||Y.hasRegexChars(d))continue;let x=Y.escapeRegex(o.value);if(l.output=l.output.slice(0,-o.value.length),t.literalBrackets===!0){l.output+=x,o.value=x;continue}o.value=`(${c}${x}|${o.value})`,l.output+=o.value;continue}if(u==="{"&&t.nobrace!==!0){be("braces");let d={type:"brace",value:u,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};w.push(d),C(d);continue}if(u==="}"){let d=w[w.length-1];if(t.nobrace===!0||!d){C({type:"text",value:u,output:u});continue}let x=")";if(d.dots===!0){let M=a.slice(),j=[];for(let G=M.length-1;G>=0&&(a.pop(),M[G].type!=="brace");G--)M[G].type!=="dots"&&j.unshift(M[G].value);x=Bn(j,t),l.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let M=l.output.slice(0,d.outputIndex),j=l.tokens.slice(d.tokensIndex);d.value=d.output="\\{",u=x="\\}",l.output=M;for(let G of j)l.output+=G.output||G.value}C({type:"brace",value:u,output:x}),oe("braces"),w.pop();continue}if(u==="|"){H.length>0&&H[H.length-1].conditions++,C({type:"text",value:u});continue}if(u===","){let d=u,x=w[w.length-1];x&&B[B.length-1]==="braces"&&(x.comma=!0,d="|"),C({type:"comma",value:u,output:d});continue}if(u==="/"){if(o.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",a.pop(),o=i;continue}C({type:"slash",value:u,output:$});continue}if(u==="."){if(l.braces>0&&o.type==="dot"){o.value==="."&&(o.output=R);let d=w[w.length-1];o.type="dots",o.output+=u,o.value+=u,d.dots=!0;continue}if(l.braces+l.parens===0&&o.type!=="bos"&&o.type!=="slash"){C({type:"text",value:u,output:R});continue}C({type:"dot",value:u,output:R});continue}if(u==="?"){if(!(o&&o.value==="(")&&t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("qmark",u);continue}if(o&&o.type==="paren"){let x=b(),M=u;if(x==="<"&&!Y.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(o.value==="("&&!/[!=<:]/.test(x)||x==="<"&&!/<([!=]|\w+>)/.test(J()))&&(M=`\\${u}`),C({type:"text",value:u,output:M});continue}if(t.dot!==!0&&(o.type==="slash"||o.type==="bos")){C({type:"qmark",value:u,output:z});continue}C({type:"qmark",value:u,output:L});continue}if(u==="!"){if(t.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){xe("negate",u);continue}if(t.nonegate!==!0&&l.index===0){mr();continue}}if(u==="+"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("plus",u);continue}if(o&&o.value==="("||t.regex===!1){C({type:"plus",value:u,output:f});continue}if(o&&(o.type==="bracket"||o.type==="paren"||o.type==="brace")||l.parens>0){C({type:"plus",value:u});continue}C({type:"plus",value:f});continue}if(u==="@"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:u,output:""});continue}C({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let d=Nn.exec(J());d&&(u+=d[0],l.index+=d[0].length),C({type:"text",value:u});continue}if(o&&(o.type==="globstar"||o.star===!0)){o.type="star",o.star=!0,o.value+=u,o.output=k,l.backtrack=!0,l.globstar=!0,X(u);continue}let A=J();if(t.noextglob!==!0&&/^\([^?]/.test(A)){xe("star",u);continue}if(o.type==="star"){if(t.noglobstar===!0){X(u);continue}let d=o.prev,x=d.prev,M=d.type==="slash"||d.type==="bos",j=x&&(x.type==="star"||x.type==="globstar");if(t.bash===!0&&(!M||A[0]&&A[0]!=="/")){C({type:"star",value:u,output:""});continue}let G=l.braces>0&&(d.type==="comma"||d.type==="brace"),Ie=H.length&&(d.type==="pipe"||d.type==="paren");if(!M&&d.type!=="paren"&&!G&&!Ie){C({type:"star",value:u,output:""});continue}for(;A.slice(0,3)==="/**";){let Ce=e[l.index+4];if(Ce&&Ce!=="/")break;A=A.slice(3),X("/**",3)}if(d.type==="bos"&&P()){o.type="globstar",o.value+=u,o.output=K(t),l.output=o.output,l.globstar=!0,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!j&&P()){l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=K(t)+(t.strictSlashes?")":"|$)"),o.value+=u,l.globstar=!0,l.output+=d.output+o.output,X(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&A[0]==="/"){let Ce=A[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=`${K(t)}${$}|${$}${Ce})`,o.value+=u,l.output+=d.output+o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&A[0]==="/"){o.type="globstar",o.value+=u,o.output=`(?:^|${$}|${K(t)}${$})`,l.output=o.output,l.globstar=!0,X(u+V()),C({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-o.output.length),o.type="globstar",o.output=K(t),o.value+=u,l.output+=o.output,l.globstar=!0,X(u);continue}let O={type:"star",value:u,output:k};if(t.bash===!0){O.output=".*?",(o.type==="bos"||o.type==="slash")&&(O.output=g+O.output),C(O);continue}if(o&&(o.type==="bracket"||o.type==="paren")&&t.regex===!0){O.output=u,C(O);continue}(l.index===l.start||o.type==="slash"||o.type==="dot")&&(o.type==="dot"?(l.output+=S,o.output+=S):t.dot===!0?(l.output+=T,o.output+=T):(l.output+=g,o.output+=g),b()!=="*"&&(l.output+=_,o.output+=_)),C(O)}for(;l.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));l.output=Y.escapeLast(l.output,"["),oe("brackets")}for(;l.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing",")"));l.output=Y.escapeLast(l.output,"("),oe("parens")}for(;l.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","}"));l.output=Y.escapeLast(l.output,"{"),oe("braces")}if(t.strictSlashes!==!0&&(o.type==="star"||o.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${$}?`}),l.backtrack===!0){l.output="";for(let A of l.tokens)l.output+=A.output!=null?A.output:A.value,A.suffix&&(l.output+=A.suffix)}return l};Vt.fastpaths=(e,r)=>{let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=zt[e]||e;let i=Y.isWindows(r),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOTS:R,NO_DOTS_SLASH:f,STAR:$,START_ANCHOR:_}=ke.globChars(i),y=t.dot?R:h,E=t.dot?f:h,S=t.capture?"":"?:",T={negated:!1,prefix:""},L=t.bash===!0?".*?":$;t.capture&&(L=`(${L})`);let z=g=>g.noglobstar===!0?L:`(${S}(?:(?!${_}${g.dot?m:a}).)*?)`,I=g=>{switch(g){case"*":return`${y}${p}${L}`;case".*":return`${a}${p}${L}`;case"*.*":return`${y}${L}${a}${p}${L}`;case"*/*":return`${y}${L}${c}${p}${E}${L}`;case"**":return y+z(t);case"**/*":return`(?:${y}${z(t)}${c})?${E}${p}${L}`;case"**/*.*":return`(?:${y}${z(t)}${c})?${E}${L}${a}${p}${L}`;case"**/.*":return`(?:${y}${z(t)}${c})?${a}${p}${L}`;default:{let v=/^(.*?)\.(\w+)$/.exec(g);if(!v)return;let k=I(v[1]);return k?k+a+v[2]:void 0}}},re=Y.removePrefix(e,T),K=I(re);return K&&t.strictSlashes!==!0&&(K+=`${c}?`),K};Jt.exports=Vt});var rr=q((ls,tr)=>{"use strict";var Pn=W("path"),Mn=Yt(),Ze=er(),Ye=Re(),Dn=me(),Un=e=>e&&typeof e=="object"&&!Array.isArray(e),D=(e,r,t=!1)=>{if(Array.isArray(e)){let h=e.map(f=>D(f,r,t));return f=>{for(let $ of h){let _=$(f);if(_)return _}return!1}}let n=Un(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=r||{},i=Ye.isWindows(r),a=n?D.compileRe(e,r):D.makeRe(e,r,!1,!0),c=a.state;delete a.state;let p=()=>!1;if(s.ignore){let h={...r,ignore:null,onMatch:null,onResult:null};p=D(s.ignore,h,t)}let m=(h,R=!1)=>{let{isMatch:f,match:$,output:_}=D.test(h,a,r,{glob:e,posix:i}),y={glob:e,state:c,regex:a,posix:i,input:h,output:_,match:$,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,R?y:!1):p(h)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,R?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),R?y:!0)};return t&&(m.state=c),m};D.test=(e,r,t,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=t||{},a=i.format||(s?Ye.toPosixSlashes:null),c=e===n,p=c&&a?a(e):e;return c===!1&&(p=a?a(e):e,c=p===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=D.matchBase(e,r,t,s):c=r.exec(p)),{isMatch:Boolean(c),match:c,output:p}};D.matchBase=(e,r,t,n=Ye.isWindows(t))=>(r instanceof RegExp?r:D.makeRe(r,t)).test(Pn.basename(e));D.isMatch=(e,r,t)=>D(r,t)(e);D.parse=(e,r)=>Array.isArray(e)?e.map(t=>D.parse(t,r)):Ze(e,{...r,fastpaths:!1});D.scan=(e,r)=>Mn(e,r);D.compileRe=(e,r,t=!1,n=!1)=>{if(t===!0)return e.output;let s=r||{},i=s.contains?"":"^",a=s.contains?"":"$",c=`${i}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let p=D.toRegex(c,r);return n===!0&&(p.state=e),p};D.makeRe=(e,r={},t=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(s.output=Ze.fastpaths(e,r)),s.output||(s=Ze(e,r)),D.compileRe(s,r,t,n)};D.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===!0)throw t;return/$^/}};D.constants=Dn;tr.exports=D});var sr=q((fs,nr)=>{"use strict";nr.exports=rr()});var cr=q((ps,ur)=>{"use strict";var ir=W("util"),or=Pt(),ae=sr(),ze=Re(),ar=e=>e===""||e==="./",N=(e,r,t)=>{r=[].concat(r),e=[].concat(e);let n=new Set,s=new Set,i=new Set,a=0,c=h=>{i.add(h.output),t&&t.onResult&&t.onResult(h)};for(let h=0;h!n.has(h));if(t&&m.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${r.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?r.map(h=>h.replace(/\\/g,"")):r}return m};N.match=N;N.matcher=(e,r)=>ae(e,r);N.isMatch=(e,r,t)=>ae(r,t)(e);N.any=N.isMatch;N.not=(e,r,t={})=>{r=[].concat(r).map(String);let n=new Set,s=[],a=N(e,r,{...t,onResult:c=>{t.onResult&&t.onResult(c),s.push(c.output)}});for(let c of s)a.includes(c)||n.add(c);return[...n]};N.contains=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);if(Array.isArray(r))return r.some(n=>N.contains(e,n,t));if(typeof r=="string"){if(ar(e)||ar(r))return!1;if(e.includes(r)||e.startsWith("./")&&e.slice(2).includes(r))return!0}return N.isMatch(e,r,{...t,contains:!0})};N.matchKeys=(e,r,t)=>{if(!ze.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=N(Object.keys(e),r,t),s={};for(let i of n)s[i]=e[i];return s};N.some=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(n.some(a=>i(a)))return!0}return!1};N.every=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(!n.every(a=>i(a)))return!1}return!0};N.all=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);return[].concat(r).every(n=>ae(n,t)(e))};N.capture=(e,r,t)=>{let n=ze.isWindows(t),i=ae.makeRe(String(e),{...t,capture:!0}).exec(n?ze.toPosixSlashes(r):r);if(i)return i.slice(1).map(a=>a===void 0?"":a)};N.makeRe=(...e)=>ae.makeRe(...e);N.scan=(...e)=>ae.scan(...e);N.parse=(e,r)=>{let t=[];for(let n of[].concat(e||[]))for(let s of or(String(n),r))t.push(ae.parse(s,r));return t};N.braces=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return r&&r.nobrace===!0||!/\{.*\}/.test(e)?[e]:or(e,r)};N.braceExpand=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return N.braces(e,{...r,expand:!0})};ur.exports=N});var fr=q((hs,lr)=>{"use strict";lr.exports=(e,...r)=>new Promise(t=>{t(e(...r))})});var hr=q((ds,Ve)=>{"use strict";var Gn=fr(),pr=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=[],t=0,n=()=>{t--,r.length>0&&r.shift()()},s=(c,p,...m)=>{t++;let h=Gn(c,...m);p(h),h.then(n,n)},i=(c,p,...m)=>{tnew Promise(m=>i(c,m,...p));return Object.defineProperties(a,{activeCount:{get:()=>t},pendingCount:{get:()=>r.length}}),a};Ve.exports=pr;Ve.exports.default=pr});var jn={};Cr(jn,{default:()=>Wn});var Se=W("@yarnpkg/cli"),ne=W("@yarnpkg/core"),et=W("@yarnpkg/core"),ue=W("clipanion"),ce=class extends Se.BaseCommand{constructor(){super(...arguments);this.json=ue.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ue.Option.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ue.Option.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ue.Option.Rest()}async execute(){let t=await ne.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ne.Project.find(t,this.context.cwd),i=await ne.Cache.find(t);await n.restoreInstallState({restoreResolutions:!1});let a;if(this.all)a=new Set(n.workspaces);else if(this.workspaces.length===0){if(!s)throw new Se.WorkspaceRequiredError(n.cwd,this.context.cwd);a=new Set([s])}else a=new Set(this.workspaces.map(p=>n.getWorkspaceByIdent(et.structUtils.parseIdent(p))));for(let p of a)for(let m of this.production?["dependencies"]:ne.Manifest.hardDependencies)for(let h of p.manifest.getForScope(m).values()){let R=n.tryWorkspaceByDescriptor(h);R!==null&&a.add(R)}for(let p of n.workspaces)a.has(p)?this.production&&p.manifest.devDependencies.clear():(p.manifest.installConfig=p.manifest.installConfig||{},p.manifest.installConfig.selfReferences=!1,p.manifest.dependencies.clear(),p.manifest.devDependencies.clear(),p.manifest.peerDependencies.clear(),p.manifest.scripts.clear());return(await ne.StreamReport.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!0},async p=>{await n.install({cache:i,report:p,persistProject:!1})})).exitCode()}};ce.paths=[["workspaces","focus"]],ce.usage=ue.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});var Ne=W("@yarnpkg/cli"),ge=W("@yarnpkg/core"),_e=W("@yarnpkg/core"),F=W("@yarnpkg/core"),gr=W("@yarnpkg/plugin-git"),U=W("clipanion"),Oe=Be(cr()),Ar=Be(hr()),te=Be(W("typanion")),pe=class extends Ne.BaseCommand{constructor(){super(...arguments);this.recursive=U.Option.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.from=U.Option.Array("--from",[],{description:"An array of glob pattern idents from which to base any recursion"});this.all=U.Option.Boolean("-A,--all",!1,{description:"Run the command on all workspaces of a project"});this.verbose=U.Option.Boolean("-v,--verbose",!1,{description:"Prefix each output line with the name of the originating workspace"});this.parallel=U.Option.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=U.Option.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=U.Option.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:te.isOneOf([te.isEnum(["unlimited"]),te.applyCascade(te.isNumber(),[te.isInteger(),te.isAtLeast(1)])])});this.topological=U.Option.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=U.Option.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=U.Option.Array("--include",[],{description:"An array of glob pattern idents; only matching workspaces will be traversed"});this.exclude=U.Option.Array("--exclude",[],{description:"An array of glob pattern idents; matching workspaces won't be traversed"});this.publicOnly=U.Option.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=U.Option.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.commandName=U.Option.String();this.args=U.Option.Proxy()}async execute(){let t=await ge.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ge.Project.find(t,this.context.cwd);if(!this.all&&!s)throw new Ne.WorkspaceRequiredError(n.cwd,this.context.cwd);await n.restoreInstallState();let i=this.cli.process([this.commandName,...this.args]),a=i.path.length===1&&i.path[0]==="run"&&typeof i.scriptName<"u"?i.scriptName:null;if(i.path.length===0)throw new U.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let c=this.all?n.topLevelWorkspace:s,p=this.since?Array.from(await gr.gitUtils.fetchChangedWorkspaces({ref:this.since,project:n})):[c,...this.from.length>0?c.getRecursiveWorkspaceChildren():[]],m=g=>Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.from),h=this.from.length>0?p.filter(m):p,R=new Set([...h,...h.map(g=>[...this.recursive?this.since?g.getRecursiveWorkspaceDependents():g.getRecursiveWorkspaceDependencies():g.getRecursiveWorkspaceChildren()]).flat()]),f=[],$=!1;if(a!=null&&a.includes(":")){for(let g of n.workspaces)if(g.manifest.scripts.has(a)&&($=!$,$===!1))break}for(let g of R)a&&!g.manifest.scripts.has(a)&&!$&&!(await ge.scriptUtils.getWorkspaceAccessibleBinaries(g)).has(a)||a===process.env.npm_lifecycle_event&&g.cwd===s.cwd||this.include.length>0&&!Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.include)||this.exclude.length>0&&Oe.default.isMatch(F.structUtils.stringifyIdent(g.locator),this.exclude)||this.publicOnly&&g.manifest.private===!0||f.push(g);let _=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.ceil(F.nodeUtils.availableParallelism()/2):1,y=_===1?!1:this.parallel,E=y?this.interlaced:!0,S=(0,Ar.default)(_),T=new Map,L=new Set,z=0,I=null,re=!1,K=await _e.StreamReport.start({configuration:t,stdout:this.context.stdout,includePrefix:!1},async g=>{let v=async(k,{commandIndex:l})=>{if(re)return-1;!y&&this.verbose&&l>1&&g.reportSeparator();let H=qn(k,{configuration:t,verbose:this.verbose,commandIndex:l}),[w,B]=dr(g,{prefix:H,interlaced:E}),[o,u]=dr(g,{prefix:H,interlaced:E});try{this.verbose&&g.reportInfo(null,`${H} Process started`);let P=Date.now(),b=await this.cli.run([this.commandName,...this.args],{cwd:k.cwd,stdout:w,stderr:o})||0;w.end(),o.end(),await B,await u;let V=Date.now();if(this.verbose){let J=t.get("enableTimers")?`, completed in ${F.formatUtils.pretty(t,V-P,F.formatUtils.Type.DURATION)}`:"";g.reportInfo(null,`${H} Process exited (exit code ${b})${J}`)}return b===130&&(re=!0,I=b),b}catch(P){throw w.end(),o.end(),await B,await u,P}};for(let k of f)T.set(k.anchoredLocator.locatorHash,k);for(;T.size>0&&!g.hasErrors();){let k=[];for(let[w,B]of T){if(L.has(B.anchoredDescriptor.descriptorHash))continue;let o=!0;if(this.topological||this.topologicalDev){let u=this.topologicalDev?new Map([...B.manifest.dependencies,...B.manifest.devDependencies]):B.manifest.dependencies;for(let P of u.values()){let b=n.tryWorkspaceByDescriptor(P);if(o=b===null||!T.has(b.anchoredLocator.locatorHash),!o)break}}if(!!o&&(L.add(B.anchoredDescriptor.descriptorHash),k.push(S(async()=>{let u=await v(B,{commandIndex:++z});return T.delete(w),L.delete(B.anchoredDescriptor.descriptorHash),u})),!y))break}if(k.length===0){let w=Array.from(T.values()).map(B=>F.structUtils.prettyLocator(t,B.anchoredLocator)).join(", ");g.reportError(_e.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${w})`);return}let H=(await Promise.all(k)).find(w=>w!==0);I===null&&(I=typeof H<"u"?1:I),(this.topological||this.topologicalDev)&&typeof H<"u"&&g.reportError(_e.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return I!==null?I:K.exitCode()}};pe.paths=[["workspaces","foreach"]],pe.usage=U.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -pt run build"],["Run build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -ptR --from '{workspace-a,workspace-b}' run build"]]});function dr(e,{prefix:r,interlaced:t}){let n=e.createStreamReporter(r),s=new F.miscUtils.DefaultStream;s.pipe(n,{end:!1}),s.on("finish",()=>{n.end()});let i=new Promise(c=>{n.on("finish",()=>{c(s.active)})});if(t)return[s,i];let a=new F.miscUtils.BufferStream;return a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()}),[a,i]}function qn(e,{configuration:r,commandIndex:t,verbose:n}){if(!n)return null;let i=`[${F.structUtils.stringifyIdent(e.locator)}]:`,a=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],c=a[t%a.length];return F.formatUtils.pretty(r,i,c)}var Kn={commands:[ce,pe]},Wn=Kn;return wr(jn);})(); +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ +/*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ +return plugin; +} +}; diff --git a/noir/.yarn/releases/yarn-3.6.3.cjs b/noir/.yarn/releases/yarn-3.6.3.cjs new file mode 100755 index 00000000000..9837c302811 --- /dev/null +++ b/noir/.yarn/releases/yarn-3.6.3.cjs @@ -0,0 +1,874 @@ +#!/usr/bin/env node +/* eslint-disable */ +//prettier-ignore +(()=>{var Dge=Object.create;var lS=Object.defineProperty;var kge=Object.getOwnPropertyDescriptor;var Rge=Object.getOwnPropertyNames;var Fge=Object.getPrototypeOf,Nge=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var Tge=(r,e)=>()=>(r&&(e=r(r=0)),e);var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ut=(r,e)=>{for(var t in e)lS(r,t,{get:e[t],enumerable:!0})},Lge=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rge(e))!Nge.call(r,n)&&n!==t&&lS(r,n,{get:()=>e[n],enumerable:!(i=kge(e,n))||i.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Dge(Fge(r)):{},Lge(e||!r||!r.__esModule?lS(t,"default",{value:r,enumerable:!0}):t,r));var PK=w((z7e,xK)=>{xK.exports=vK;vK.sync=ife;var QK=J("fs");function rfe(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var i=0;i{FK.exports=kK;kK.sync=nfe;var DK=J("fs");function kK(r,e,t){DK.stat(r,function(i,n){t(i,i?!1:RK(n,e))})}function nfe(r,e){return RK(DK.statSync(r),e)}function RK(r,e){return r.isFile()&&sfe(r,e)}function sfe(r,e){var t=r.mode,i=r.uid,n=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=t&c||t&l&&n===o||t&a&&i===s||t&u&&s===0;return g}});var LK=w((Z7e,TK)=>{var X7e=J("fs"),lI;process.platform==="win32"||global.TESTING_WINDOWS?lI=PK():lI=NK();TK.exports=SS;SS.sync=ofe;function SS(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){SS(r,e||{},function(s,o){s?n(s):i(o)})})}lI(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function ofe(r,e){try{return lI.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var YK=w((_7e,GK)=>{var Dg=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",MK=J("path"),afe=Dg?";":":",OK=LK(),KK=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),UK=(r,e)=>{let t=e.colon||afe,i=r.match(/\//)||Dg&&r.match(/\\/)?[""]:[...Dg?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=Dg?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Dg?n.split(t):[""];return Dg&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},HK=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=UK(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(KK(r));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=MK.join(h,r),C=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;u(l(C,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];OK(c+p,{pathExt:s},(C,y)=>{if(!C&&y)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},Afe=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=UK(r,e),s=[];for(let o=0;o{"use strict";var jK=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};vS.exports=jK;vS.exports.default=jK});var VK=w((eZe,zK)=>{"use strict";var JK=J("path"),lfe=YK(),cfe=qK();function WK(r,e){let t=r.options.env||process.env,i=process.cwd(),n=r.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=lfe.sync(r.command,{path:t[cfe({env:t})],pathExt:e?JK.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=JK.resolve(n?r.options.cwd:"",o)),o}function ufe(r){return WK(r)||WK(r,!0)}zK.exports=ufe});var XK=w((tZe,PS)=>{"use strict";var xS=/([()\][%!^"`<>&|;, *?])/g;function gfe(r){return r=r.replace(xS,"^$1"),r}function ffe(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(xS,"^$1"),e&&(r=r.replace(xS,"^$1")),r}PS.exports.command=gfe;PS.exports.argument=ffe});var _K=w((rZe,ZK)=>{"use strict";ZK.exports=/^#!(.*)/});var eU=w((iZe,$K)=>{"use strict";var hfe=_K();$K.exports=(r="")=>{let e=r.match(hfe);if(!e)return null;let[t,i]=e[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var rU=w((nZe,tU)=>{"use strict";var DS=J("fs"),pfe=eU();function dfe(r){let t=Buffer.alloc(150),i;try{i=DS.openSync(r,"r"),DS.readSync(i,t,0,150,0),DS.closeSync(i)}catch{}return pfe(t.toString())}tU.exports=dfe});var oU=w((sZe,sU)=>{"use strict";var Cfe=J("path"),iU=VK(),nU=XK(),mfe=rU(),Efe=process.platform==="win32",Ife=/\.(?:com|exe)$/i,yfe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function wfe(r){r.file=iU(r);let e=r.file&&mfe(r.file);return e?(r.args.unshift(r.file),r.command=e,iU(r)):r.file}function Bfe(r){if(!Efe)return r;let e=wfe(r),t=!Ife.test(e);if(r.options.forceShell||t){let i=yfe.test(e);r.command=Cfe.normalize(r.command),r.command=nU.command(r.command),r.args=r.args.map(s=>nU.argument(s,i));let n=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${n}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function bfe(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let i={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?i:Bfe(i)}sU.exports=bfe});var lU=w((oZe,AU)=>{"use strict";var kS=process.platform==="win32";function RS(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function Qfe(r,e){if(!kS)return;let t=r.emit;r.emit=function(i,n){if(i==="exit"){let s=aU(n,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function aU(r,e){return kS&&r===1&&!e.file?RS(e.original,"spawn"):null}function Sfe(r,e){return kS&&r===1&&!e.file?RS(e.original,"spawnSync"):null}AU.exports={hookChildProcess:Qfe,verifyENOENT:aU,verifyENOENTSync:Sfe,notFoundError:RS}});var TS=w((aZe,kg)=>{"use strict";var cU=J("child_process"),FS=oU(),NS=lU();function uU(r,e,t){let i=FS(r,e,t),n=cU.spawn(i.command,i.args,i.options);return NS.hookChildProcess(n,i),n}function vfe(r,e,t){let i=FS(r,e,t),n=cU.spawnSync(i.command,i.args,i.options);return n.error=n.error||NS.verifyENOENTSync(n.status,i),n}kg.exports=uU;kg.exports.spawn=uU;kg.exports.sync=vfe;kg.exports._parse=FS;kg.exports._enoent=NS});var fU=w((AZe,gU)=>{"use strict";function xfe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function Zl(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Zl)}xfe(Zl,Error);Zl.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g>",ie=me(">>",!1),de=">&",_e=me(">&",!1),Pt=">",It=me(">",!1),Mr="<<<",ii=me("<<<",!1),gi="<&",hr=me("<&",!1),fi="<",ni=me("<",!1),Ks=function(m){return{type:"argument",segments:[].concat(...m)}},pr=function(m){return m},Ii="$'",rs=me("$'",!1),fa="'",dA=me("'",!1),cg=function(m){return[{type:"text",text:m}]},is='""',CA=me('""',!1),ha=function(){return{type:"text",text:""}},wp='"',mA=me('"',!1),EA=function(m){return m},wr=function(m){return{type:"arithmetic",arithmetic:m,quoted:!0}},Tl=function(m){return{type:"shell",shell:m,quoted:!0}},ug=function(m){return{type:"variable",...m,quoted:!0}},yo=function(m){return{type:"text",text:m}},gg=function(m){return{type:"arithmetic",arithmetic:m,quoted:!1}},Bp=function(m){return{type:"shell",shell:m,quoted:!1}},bp=function(m){return{type:"variable",...m,quoted:!1}},vr=function(m){return{type:"glob",pattern:m}},se=/^[^']/,wo=Je(["'"],!0,!1),Fn=function(m){return m.join("")},fg=/^[^$"]/,bt=Je(["$",'"'],!0,!1),Ll=`\\ +`,Nn=me(`\\ +`,!1),ns=function(){return""},ss="\\",gt=me("\\",!1),Bo=/^[\\$"`]/,At=Je(["\\","$",'"',"`"],!1,!1),ln=function(m){return m},S="\\a",Lt=me("\\a",!1),hg=function(){return"a"},Ml="\\b",Qp=me("\\b",!1),Sp=function(){return"\b"},vp=/^[Ee]/,xp=Je(["E","e"],!1,!1),Pp=function(){return"\x1B"},G="\\f",yt=me("\\f",!1),IA=function(){return"\f"},zi="\\n",Ol=me("\\n",!1),Xe=function(){return` +`},pa="\\r",pg=me("\\r",!1),ME=function(){return"\r"},Dp="\\t",OE=me("\\t",!1),ar=function(){return" "},Tn="\\v",Kl=me("\\v",!1),kp=function(){return"\v"},Us=/^[\\'"?]/,da=Je(["\\","'",'"',"?"],!1,!1),cn=function(m){return String.fromCharCode(parseInt(m,16))},Le="\\x",dg=me("\\x",!1),Ul="\\u",Hs=me("\\u",!1),Hl="\\U",yA=me("\\U",!1),Cg=function(m){return String.fromCodePoint(parseInt(m,16))},mg=/^[0-7]/,Ca=Je([["0","7"]],!1,!1),ma=/^[0-9a-fA-f]/,rt=Je([["0","9"],["a","f"],["A","f"]],!1,!1),bo=nt(),wA="-",Gl=me("-",!1),Gs="+",Yl=me("+",!1),KE=".",Rp=me(".",!1),Eg=function(m,Q,N){return{type:"number",value:(m==="-"?-1:1)*parseFloat(Q.join("")+"."+N.join(""))}},Fp=function(m,Q){return{type:"number",value:(m==="-"?-1:1)*parseInt(Q.join(""))}},UE=function(m){return{type:"variable",...m}},jl=function(m){return{type:"variable",name:m}},HE=function(m){return m},Ig="*",BA=me("*",!1),Rr="/",GE=me("/",!1),Ys=function(m,Q,N){return{type:Q==="*"?"multiplication":"division",right:N}},js=function(m,Q){return Q.reduce((N,U)=>({left:N,...U}),m)},yg=function(m,Q,N){return{type:Q==="+"?"addition":"subtraction",right:N}},bA="$((",R=me("$((",!1),q="))",Ce=me("))",!1),Ke=function(m){return m},Re="$(",ze=me("$(",!1),dt=function(m){return m},Ft="${",Ln=me("${",!1),JQ=":-",k1=me(":-",!1),R1=function(m,Q){return{name:m,defaultValue:Q}},WQ=":-}",F1=me(":-}",!1),N1=function(m){return{name:m,defaultValue:[]}},zQ=":+",T1=me(":+",!1),L1=function(m,Q){return{name:m,alternativeValue:Q}},VQ=":+}",M1=me(":+}",!1),O1=function(m){return{name:m,alternativeValue:[]}},XQ=function(m){return{name:m}},K1="$",U1=me("$",!1),H1=function(m){return e.isGlobPattern(m)},G1=function(m){return m},ZQ=/^[a-zA-Z0-9_]/,_Q=Je([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),$Q=function(){return L()},eS=/^[$@*?#a-zA-Z0-9_\-]/,tS=Je(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),Y1=/^[(){}<>$|&; \t"']/,wg=Je(["(",")","{","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),rS=/^[<>&; \t"']/,iS=Je(["<",">","&",";"," "," ",'"',"'"],!1,!1),YE=/^[ \t]/,jE=Je([" "," "],!1,!1),b=0,Oe=0,QA=[{line:1,column:1}],d=0,E=[],I=0,k;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function L(){return r.substring(Oe,b)}function Z(){return Et(Oe,b)}function te(m,Q){throw Q=Q!==void 0?Q:Et(Oe,b),Ri([lt(m)],r.substring(Oe,b),Q)}function we(m,Q){throw Q=Q!==void 0?Q:Et(Oe,b),Mn(m,Q)}function me(m,Q){return{type:"literal",text:m,ignoreCase:Q}}function Je(m,Q,N){return{type:"class",parts:m,inverted:Q,ignoreCase:N}}function nt(){return{type:"any"}}function wt(){return{type:"end"}}function lt(m){return{type:"other",description:m}}function it(m){var Q=QA[m],N;if(Q)return Q;for(N=m-1;!QA[N];)N--;for(Q=QA[N],Q={line:Q.line,column:Q.column};Nd&&(d=b,E=[]),E.push(m))}function Mn(m,Q){return new Zl(m,null,null,Q)}function Ri(m,Q,N){return new Zl(Zl.buildMessage(m,Q),m,Q,N)}function SA(){var m,Q;return m=b,Q=Or(),Q===t&&(Q=null),Q!==t&&(Oe=m,Q=s(Q)),m=Q,m}function Or(){var m,Q,N,U,ce;if(m=b,Q=Kr(),Q!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=Ea(),U!==t?(ce=os(),ce===t&&(ce=null),ce!==t?(Oe=m,Q=o(Q,U,ce),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)}else b=m,m=t;if(m===t)if(m=b,Q=Kr(),Q!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=Ea(),U===t&&(U=null),U!==t?(Oe=m,Q=a(Q,U),m=Q):(b=m,m=t)):(b=m,m=t)}else b=m,m=t;return m}function os(){var m,Q,N,U,ce;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t)if(N=Or(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Oe=m,Q=l(N),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t;return m}function Ea(){var m;return r.charCodeAt(b)===59?(m=c,b++):(m=t,I===0&&be(u)),m===t&&(r.charCodeAt(b)===38?(m=g,b++):(m=t,I===0&&be(f))),m}function Kr(){var m,Q,N;return m=b,Q=j1(),Q!==t?(N=fge(),N===t&&(N=null),N!==t?(Oe=m,Q=h(Q,N),m=Q):(b=m,m=t)):(b=m,m=t),m}function fge(){var m,Q,N,U,ce,Se,ht;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t)if(N=hge(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Kr(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Oe=m,Q=p(N,ce),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t;return m}function hge(){var m;return r.substr(b,2)===C?(m=C,b+=2):(m=t,I===0&&be(y)),m===t&&(r.substr(b,2)===B?(m=B,b+=2):(m=t,I===0&&be(v))),m}function j1(){var m,Q,N;return m=b,Q=Cge(),Q!==t?(N=pge(),N===t&&(N=null),N!==t?(Oe=m,Q=D(Q,N),m=Q):(b=m,m=t)):(b=m,m=t),m}function pge(){var m,Q,N,U,ce,Se,ht;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t)if(N=dge(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=j1(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Oe=m,Q=T(N,ce),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t;return m}function dge(){var m;return r.substr(b,2)===H?(m=H,b+=2):(m=t,I===0&&be(j)),m===t&&(r.charCodeAt(b)===124?(m=$,b++):(m=t,I===0&&be(V))),m}function qE(){var m,Q,N,U,ce,Se;if(m=b,Q=rK(),Q!==t)if(r.charCodeAt(b)===61?(N=W,b++):(N=t,I===0&&be(_)),N!==t)if(U=W1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(Oe=m,Q=A(Q,U),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t;else b=m,m=t;if(m===t)if(m=b,Q=rK(),Q!==t)if(r.charCodeAt(b)===61?(N=W,b++):(N=t,I===0&&be(_)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Oe=m,Q=Ae(Q),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t;return m}function Cge(){var m,Q,N,U,ce,Se,ht,Bt,qr,hi,as;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t)if(r.charCodeAt(b)===40?(N=ge,b++):(N=t,I===0&&be(re)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Or(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();if(Se!==t)if(r.charCodeAt(b)===41?(ht=M,b++):(ht=t,I===0&&be(F)),ht!==t){for(Bt=[],qr=He();qr!==t;)Bt.push(qr),qr=He();if(Bt!==t){for(qr=[],hi=Np();hi!==t;)qr.push(hi),hi=Np();if(qr!==t){for(hi=[],as=He();as!==t;)hi.push(as),as=He();hi!==t?(Oe=m,Q=ue(ce,qr),m=Q):(b=m,m=t)}else b=m,m=t}else b=m,m=t}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t;if(m===t){for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t)if(r.charCodeAt(b)===123?(N=pe,b++):(N=t,I===0&&be(ke)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Or(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();if(Se!==t)if(r.charCodeAt(b)===125?(ht=Fe,b++):(ht=t,I===0&&be(Ne)),ht!==t){for(Bt=[],qr=He();qr!==t;)Bt.push(qr),qr=He();if(Bt!==t){for(qr=[],hi=Np();hi!==t;)qr.push(hi),hi=Np();if(qr!==t){for(hi=[],as=He();as!==t;)hi.push(as),as=He();hi!==t?(Oe=m,Q=oe(ce,qr),m=Q):(b=m,m=t)}else b=m,m=t}else b=m,m=t}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t}else b=m,m=t;else b=m,m=t;if(m===t){for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t){for(N=[],U=qE();U!==t;)N.push(U),U=qE();if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t){if(ce=[],Se=J1(),Se!==t)for(;Se!==t;)ce.push(Se),Se=J1();else ce=t;if(ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Oe=m,Q=le(N,ce),m=Q):(b=m,m=t)}else b=m,m=t}else b=m,m=t}else b=m,m=t}else b=m,m=t;if(m===t){for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t){if(N=[],U=qE(),U!==t)for(;U!==t;)N.push(U),U=qE();else N=t;if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Oe=m,Q=Be(N),m=Q):(b=m,m=t)}else b=m,m=t}else b=m,m=t}}}return m}function q1(){var m,Q,N,U,ce;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t){if(N=[],U=JE(),U!==t)for(;U!==t;)N.push(U),U=JE();else N=t;if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Oe=m,Q=fe(N),m=Q):(b=m,m=t)}else b=m,m=t}else b=m,m=t;return m}function J1(){var m,Q,N;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();if(Q!==t?(N=Np(),N!==t?(Oe=m,Q=ae(N),m=Q):(b=m,m=t)):(b=m,m=t),m===t){for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();Q!==t?(N=JE(),N!==t?(Oe=m,Q=ae(N),m=Q):(b=m,m=t)):(b=m,m=t)}return m}function Np(){var m,Q,N,U,ce;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();return Q!==t?(qe.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(ne)),N===t&&(N=null),N!==t?(U=mge(),U!==t?(ce=JE(),ce!==t?(Oe=m,Q=Y(N,U,ce),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m}function mge(){var m;return r.substr(b,2)===he?(m=he,b+=2):(m=t,I===0&&be(ie)),m===t&&(r.substr(b,2)===de?(m=de,b+=2):(m=t,I===0&&be(_e)),m===t&&(r.charCodeAt(b)===62?(m=Pt,b++):(m=t,I===0&&be(It)),m===t&&(r.substr(b,3)===Mr?(m=Mr,b+=3):(m=t,I===0&&be(ii)),m===t&&(r.substr(b,2)===gi?(m=gi,b+=2):(m=t,I===0&&be(hr)),m===t&&(r.charCodeAt(b)===60?(m=fi,b++):(m=t,I===0&&be(ni))))))),m}function JE(){var m,Q,N;for(m=b,Q=[],N=He();N!==t;)Q.push(N),N=He();return Q!==t?(N=W1(),N!==t?(Oe=m,Q=ae(N),m=Q):(b=m,m=t)):(b=m,m=t),m}function W1(){var m,Q,N;if(m=b,Q=[],N=z1(),N!==t)for(;N!==t;)Q.push(N),N=z1();else Q=t;return Q!==t&&(Oe=m,Q=Ks(Q)),m=Q,m}function z1(){var m,Q;return m=b,Q=Ege(),Q!==t&&(Oe=m,Q=pr(Q)),m=Q,m===t&&(m=b,Q=Ige(),Q!==t&&(Oe=m,Q=pr(Q)),m=Q,m===t&&(m=b,Q=yge(),Q!==t&&(Oe=m,Q=pr(Q)),m=Q,m===t&&(m=b,Q=wge(),Q!==t&&(Oe=m,Q=pr(Q)),m=Q))),m}function Ege(){var m,Q,N,U;return m=b,r.substr(b,2)===Ii?(Q=Ii,b+=2):(Q=t,I===0&&be(rs)),Q!==t?(N=Qge(),N!==t?(r.charCodeAt(b)===39?(U=fa,b++):(U=t,I===0&&be(dA)),U!==t?(Oe=m,Q=cg(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m}function Ige(){var m,Q,N,U;return m=b,r.charCodeAt(b)===39?(Q=fa,b++):(Q=t,I===0&&be(dA)),Q!==t?(N=Bge(),N!==t?(r.charCodeAt(b)===39?(U=fa,b++):(U=t,I===0&&be(dA)),U!==t?(Oe=m,Q=cg(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m}function yge(){var m,Q,N,U;if(m=b,r.substr(b,2)===is?(Q=is,b+=2):(Q=t,I===0&&be(CA)),Q!==t&&(Oe=m,Q=ha()),m=Q,m===t)if(m=b,r.charCodeAt(b)===34?(Q=wp,b++):(Q=t,I===0&&be(mA)),Q!==t){for(N=[],U=V1();U!==t;)N.push(U),U=V1();N!==t?(r.charCodeAt(b)===34?(U=wp,b++):(U=t,I===0&&be(mA)),U!==t?(Oe=m,Q=EA(N),m=Q):(b=m,m=t)):(b=m,m=t)}else b=m,m=t;return m}function wge(){var m,Q,N;if(m=b,Q=[],N=X1(),N!==t)for(;N!==t;)Q.push(N),N=X1();else Q=t;return Q!==t&&(Oe=m,Q=EA(Q)),m=Q,m}function V1(){var m,Q;return m=b,Q=eK(),Q!==t&&(Oe=m,Q=wr(Q)),m=Q,m===t&&(m=b,Q=tK(),Q!==t&&(Oe=m,Q=Tl(Q)),m=Q,m===t&&(m=b,Q=aS(),Q!==t&&(Oe=m,Q=ug(Q)),m=Q,m===t&&(m=b,Q=bge(),Q!==t&&(Oe=m,Q=yo(Q)),m=Q))),m}function X1(){var m,Q;return m=b,Q=eK(),Q!==t&&(Oe=m,Q=gg(Q)),m=Q,m===t&&(m=b,Q=tK(),Q!==t&&(Oe=m,Q=Bp(Q)),m=Q,m===t&&(m=b,Q=aS(),Q!==t&&(Oe=m,Q=bp(Q)),m=Q,m===t&&(m=b,Q=xge(),Q!==t&&(Oe=m,Q=vr(Q)),m=Q,m===t&&(m=b,Q=vge(),Q!==t&&(Oe=m,Q=yo(Q)),m=Q)))),m}function Bge(){var m,Q,N;for(m=b,Q=[],se.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(wo));N!==t;)Q.push(N),se.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(wo));return Q!==t&&(Oe=m,Q=Fn(Q)),m=Q,m}function bge(){var m,Q,N;if(m=b,Q=[],N=Z1(),N===t&&(fg.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(bt))),N!==t)for(;N!==t;)Q.push(N),N=Z1(),N===t&&(fg.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(bt)));else Q=t;return Q!==t&&(Oe=m,Q=Fn(Q)),m=Q,m}function Z1(){var m,Q,N;return m=b,r.substr(b,2)===Ll?(Q=Ll,b+=2):(Q=t,I===0&&be(Nn)),Q!==t&&(Oe=m,Q=ns()),m=Q,m===t&&(m=b,r.charCodeAt(b)===92?(Q=ss,b++):(Q=t,I===0&&be(gt)),Q!==t?(Bo.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(At)),N!==t?(Oe=m,Q=ln(N),m=Q):(b=m,m=t)):(b=m,m=t)),m}function Qge(){var m,Q,N;for(m=b,Q=[],N=_1(),N===t&&(se.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(wo)));N!==t;)Q.push(N),N=_1(),N===t&&(se.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(wo)));return Q!==t&&(Oe=m,Q=Fn(Q)),m=Q,m}function _1(){var m,Q,N;return m=b,r.substr(b,2)===S?(Q=S,b+=2):(Q=t,I===0&&be(Lt)),Q!==t&&(Oe=m,Q=hg()),m=Q,m===t&&(m=b,r.substr(b,2)===Ml?(Q=Ml,b+=2):(Q=t,I===0&&be(Qp)),Q!==t&&(Oe=m,Q=Sp()),m=Q,m===t&&(m=b,r.charCodeAt(b)===92?(Q=ss,b++):(Q=t,I===0&&be(gt)),Q!==t?(vp.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(xp)),N!==t?(Oe=m,Q=Pp(),m=Q):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===G?(Q=G,b+=2):(Q=t,I===0&&be(yt)),Q!==t&&(Oe=m,Q=IA()),m=Q,m===t&&(m=b,r.substr(b,2)===zi?(Q=zi,b+=2):(Q=t,I===0&&be(Ol)),Q!==t&&(Oe=m,Q=Xe()),m=Q,m===t&&(m=b,r.substr(b,2)===pa?(Q=pa,b+=2):(Q=t,I===0&&be(pg)),Q!==t&&(Oe=m,Q=ME()),m=Q,m===t&&(m=b,r.substr(b,2)===Dp?(Q=Dp,b+=2):(Q=t,I===0&&be(OE)),Q!==t&&(Oe=m,Q=ar()),m=Q,m===t&&(m=b,r.substr(b,2)===Tn?(Q=Tn,b+=2):(Q=t,I===0&&be(Kl)),Q!==t&&(Oe=m,Q=kp()),m=Q,m===t&&(m=b,r.charCodeAt(b)===92?(Q=ss,b++):(Q=t,I===0&&be(gt)),Q!==t?(Us.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(da)),N!==t?(Oe=m,Q=ln(N),m=Q):(b=m,m=t)):(b=m,m=t),m===t&&(m=Sge()))))))))),m}function Sge(){var m,Q,N,U,ce,Se,ht,Bt,qr,hi,as,AS;return m=b,r.charCodeAt(b)===92?(Q=ss,b++):(Q=t,I===0&&be(gt)),Q!==t?(N=nS(),N!==t?(Oe=m,Q=cn(N),m=Q):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Le?(Q=Le,b+=2):(Q=t,I===0&&be(dg)),Q!==t?(N=b,U=b,ce=nS(),ce!==t?(Se=On(),Se!==t?(ce=[ce,Se],U=ce):(b=U,U=t)):(b=U,U=t),U===t&&(U=nS()),U!==t?N=r.substring(N,b):N=U,N!==t?(Oe=m,Q=cn(N),m=Q):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Ul?(Q=Ul,b+=2):(Q=t,I===0&&be(Hs)),Q!==t?(N=b,U=b,ce=On(),ce!==t?(Se=On(),Se!==t?(ht=On(),ht!==t?(Bt=On(),Bt!==t?(ce=[ce,Se,ht,Bt],U=ce):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t),U!==t?N=r.substring(N,b):N=U,N!==t?(Oe=m,Q=cn(N),m=Q):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Hl?(Q=Hl,b+=2):(Q=t,I===0&&be(yA)),Q!==t?(N=b,U=b,ce=On(),ce!==t?(Se=On(),Se!==t?(ht=On(),ht!==t?(Bt=On(),Bt!==t?(qr=On(),qr!==t?(hi=On(),hi!==t?(as=On(),as!==t?(AS=On(),AS!==t?(ce=[ce,Se,ht,Bt,qr,hi,as,AS],U=ce):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t)):(b=U,U=t),U!==t?N=r.substring(N,b):N=U,N!==t?(Oe=m,Q=Cg(N),m=Q):(b=m,m=t)):(b=m,m=t)))),m}function nS(){var m;return mg.test(r.charAt(b))?(m=r.charAt(b),b++):(m=t,I===0&&be(Ca)),m}function On(){var m;return ma.test(r.charAt(b))?(m=r.charAt(b),b++):(m=t,I===0&&be(rt)),m}function vge(){var m,Q,N,U,ce;if(m=b,Q=[],N=b,r.charCodeAt(b)===92?(U=ss,b++):(U=t,I===0&&be(gt)),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t),N===t&&(N=b,U=b,I++,ce=iK(),I--,ce===t?U=void 0:(b=U,U=t),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t)),N!==t)for(;N!==t;)Q.push(N),N=b,r.charCodeAt(b)===92?(U=ss,b++):(U=t,I===0&&be(gt)),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t),N===t&&(N=b,U=b,I++,ce=iK(),I--,ce===t?U=void 0:(b=U,U=t),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t));else Q=t;return Q!==t&&(Oe=m,Q=Fn(Q)),m=Q,m}function sS(){var m,Q,N,U,ce,Se;if(m=b,r.charCodeAt(b)===45?(Q=wA,b++):(Q=t,I===0&&be(Gl)),Q===t&&(r.charCodeAt(b)===43?(Q=Gs,b++):(Q=t,I===0&&be(Yl))),Q===t&&(Q=null),Q!==t){if(N=[],qe.test(r.charAt(b))?(U=r.charAt(b),b++):(U=t,I===0&&be(ne)),U!==t)for(;U!==t;)N.push(U),qe.test(r.charAt(b))?(U=r.charAt(b),b++):(U=t,I===0&&be(ne));else N=t;if(N!==t)if(r.charCodeAt(b)===46?(U=KE,b++):(U=t,I===0&&be(Rp)),U!==t){if(ce=[],qe.test(r.charAt(b))?(Se=r.charAt(b),b++):(Se=t,I===0&&be(ne)),Se!==t)for(;Se!==t;)ce.push(Se),qe.test(r.charAt(b))?(Se=r.charAt(b),b++):(Se=t,I===0&&be(ne));else ce=t;ce!==t?(Oe=m,Q=Eg(Q,N,ce),m=Q):(b=m,m=t)}else b=m,m=t;else b=m,m=t}else b=m,m=t;if(m===t){if(m=b,r.charCodeAt(b)===45?(Q=wA,b++):(Q=t,I===0&&be(Gl)),Q===t&&(r.charCodeAt(b)===43?(Q=Gs,b++):(Q=t,I===0&&be(Yl))),Q===t&&(Q=null),Q!==t){if(N=[],qe.test(r.charAt(b))?(U=r.charAt(b),b++):(U=t,I===0&&be(ne)),U!==t)for(;U!==t;)N.push(U),qe.test(r.charAt(b))?(U=r.charAt(b),b++):(U=t,I===0&&be(ne));else N=t;N!==t?(Oe=m,Q=Fp(Q,N),m=Q):(b=m,m=t)}else b=m,m=t;if(m===t&&(m=b,Q=aS(),Q!==t&&(Oe=m,Q=UE(Q)),m=Q,m===t&&(m=b,Q=ql(),Q!==t&&(Oe=m,Q=jl(Q)),m=Q,m===t)))if(m=b,r.charCodeAt(b)===40?(Q=ge,b++):(Q=t,I===0&&be(re)),Q!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();if(N!==t)if(U=$1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(r.charCodeAt(b)===41?(Se=M,b++):(Se=t,I===0&&be(F)),Se!==t?(Oe=m,Q=HE(U),m=Q):(b=m,m=t)):(b=m,m=t)}else b=m,m=t;else b=m,m=t}else b=m,m=t}return m}function oS(){var m,Q,N,U,ce,Se,ht,Bt;if(m=b,Q=sS(),Q!==t){for(N=[],U=b,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(b)===42?(Se=Ig,b++):(Se=t,I===0&&be(BA)),Se===t&&(r.charCodeAt(b)===47?(Se=Rr,b++):(Se=t,I===0&&be(GE))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=sS(),Bt!==t?(Oe=U,ce=Ys(Q,Se,Bt),U=ce):(b=U,U=t)):(b=U,U=t)}else b=U,U=t;else b=U,U=t;for(;U!==t;){for(N.push(U),U=b,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(b)===42?(Se=Ig,b++):(Se=t,I===0&&be(BA)),Se===t&&(r.charCodeAt(b)===47?(Se=Rr,b++):(Se=t,I===0&&be(GE))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=sS(),Bt!==t?(Oe=U,ce=Ys(Q,Se,Bt),U=ce):(b=U,U=t)):(b=U,U=t)}else b=U,U=t;else b=U,U=t}N!==t?(Oe=m,Q=js(Q,N),m=Q):(b=m,m=t)}else b=m,m=t;return m}function $1(){var m,Q,N,U,ce,Se,ht,Bt;if(m=b,Q=oS(),Q!==t){for(N=[],U=b,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(b)===43?(Se=Gs,b++):(Se=t,I===0&&be(Yl)),Se===t&&(r.charCodeAt(b)===45?(Se=wA,b++):(Se=t,I===0&&be(Gl))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=oS(),Bt!==t?(Oe=U,ce=yg(Q,Se,Bt),U=ce):(b=U,U=t)):(b=U,U=t)}else b=U,U=t;else b=U,U=t;for(;U!==t;){for(N.push(U),U=b,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(b)===43?(Se=Gs,b++):(Se=t,I===0&&be(Yl)),Se===t&&(r.charCodeAt(b)===45?(Se=wA,b++):(Se=t,I===0&&be(Gl))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=oS(),Bt!==t?(Oe=U,ce=yg(Q,Se,Bt),U=ce):(b=U,U=t)):(b=U,U=t)}else b=U,U=t;else b=U,U=t}N!==t?(Oe=m,Q=js(Q,N),m=Q):(b=m,m=t)}else b=m,m=t;return m}function eK(){var m,Q,N,U,ce,Se;if(m=b,r.substr(b,3)===bA?(Q=bA,b+=3):(Q=t,I===0&&be(R)),Q!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();if(N!==t)if(U=$1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(r.substr(b,2)===q?(Se=q,b+=2):(Se=t,I===0&&be(Ce)),Se!==t?(Oe=m,Q=Ke(U),m=Q):(b=m,m=t)):(b=m,m=t)}else b=m,m=t;else b=m,m=t}else b=m,m=t;return m}function tK(){var m,Q,N,U;return m=b,r.substr(b,2)===Re?(Q=Re,b+=2):(Q=t,I===0&&be(ze)),Q!==t?(N=Or(),N!==t?(r.charCodeAt(b)===41?(U=M,b++):(U=t,I===0&&be(F)),U!==t?(Oe=m,Q=dt(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m}function aS(){var m,Q,N,U,ce,Se;return m=b,r.substr(b,2)===Ft?(Q=Ft,b+=2):(Q=t,I===0&&be(Ln)),Q!==t?(N=ql(),N!==t?(r.substr(b,2)===JQ?(U=JQ,b+=2):(U=t,I===0&&be(k1)),U!==t?(ce=q1(),ce!==t?(r.charCodeAt(b)===125?(Se=Fe,b++):(Se=t,I===0&&be(Ne)),Se!==t?(Oe=m,Q=R1(N,ce),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Ft?(Q=Ft,b+=2):(Q=t,I===0&&be(Ln)),Q!==t?(N=ql(),N!==t?(r.substr(b,3)===WQ?(U=WQ,b+=3):(U=t,I===0&&be(F1)),U!==t?(Oe=m,Q=N1(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Ft?(Q=Ft,b+=2):(Q=t,I===0&&be(Ln)),Q!==t?(N=ql(),N!==t?(r.substr(b,2)===zQ?(U=zQ,b+=2):(U=t,I===0&&be(T1)),U!==t?(ce=q1(),ce!==t?(r.charCodeAt(b)===125?(Se=Fe,b++):(Se=t,I===0&&be(Ne)),Se!==t?(Oe=m,Q=L1(N,ce),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Ft?(Q=Ft,b+=2):(Q=t,I===0&&be(Ln)),Q!==t?(N=ql(),N!==t?(r.substr(b,3)===VQ?(U=VQ,b+=3):(U=t,I===0&&be(M1)),U!==t?(Oe=m,Q=O1(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.substr(b,2)===Ft?(Q=Ft,b+=2):(Q=t,I===0&&be(Ln)),Q!==t?(N=ql(),N!==t?(r.charCodeAt(b)===125?(U=Fe,b++):(U=t,I===0&&be(Ne)),U!==t?(Oe=m,Q=XQ(N),m=Q):(b=m,m=t)):(b=m,m=t)):(b=m,m=t),m===t&&(m=b,r.charCodeAt(b)===36?(Q=K1,b++):(Q=t,I===0&&be(U1)),Q!==t?(N=ql(),N!==t?(Oe=m,Q=XQ(N),m=Q):(b=m,m=t)):(b=m,m=t)))))),m}function xge(){var m,Q,N;return m=b,Q=Pge(),Q!==t?(Oe=b,N=H1(Q),N?N=void 0:N=t,N!==t?(Oe=m,Q=G1(Q),m=Q):(b=m,m=t)):(b=m,m=t),m}function Pge(){var m,Q,N,U,ce;if(m=b,Q=[],N=b,U=b,I++,ce=nK(),I--,ce===t?U=void 0:(b=U,U=t),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t),N!==t)for(;N!==t;)Q.push(N),N=b,U=b,I++,ce=nK(),I--,ce===t?U=void 0:(b=U,U=t),U!==t?(r.length>b?(ce=r.charAt(b),b++):(ce=t,I===0&&be(bo)),ce!==t?(Oe=N,U=ln(ce),N=U):(b=N,N=t)):(b=N,N=t);else Q=t;return Q!==t&&(Oe=m,Q=Fn(Q)),m=Q,m}function rK(){var m,Q,N;if(m=b,Q=[],ZQ.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(_Q)),N!==t)for(;N!==t;)Q.push(N),ZQ.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(_Q));else Q=t;return Q!==t&&(Oe=m,Q=$Q()),m=Q,m}function ql(){var m,Q,N;if(m=b,Q=[],eS.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(tS)),N!==t)for(;N!==t;)Q.push(N),eS.test(r.charAt(b))?(N=r.charAt(b),b++):(N=t,I===0&&be(tS));else Q=t;return Q!==t&&(Oe=m,Q=$Q()),m=Q,m}function iK(){var m;return Y1.test(r.charAt(b))?(m=r.charAt(b),b++):(m=t,I===0&&be(wg)),m}function nK(){var m;return rS.test(r.charAt(b))?(m=r.charAt(b),b++):(m=t,I===0&&be(iS)),m}function He(){var m,Q;if(m=[],YE.test(r.charAt(b))?(Q=r.charAt(b),b++):(Q=t,I===0&&be(jE)),Q!==t)for(;Q!==t;)m.push(Q),YE.test(r.charAt(b))?(Q=r.charAt(b),b++):(Q=t,I===0&&be(jE));else m=t;return m}if(k=n(),k!==t&&b===r.length)return k;throw k!==t&&b{"use strict";function Dfe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function $l(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,$l)}Dfe($l,Error);$l.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;gH&&(H=v,j=[]),j.push(ne))}function Ne(ne,Y){return new $l(ne,null,null,Y)}function oe(ne,Y,he){return new $l($l.buildMessage(ne,Y),ne,Y,he)}function le(){var ne,Y,he,ie;return ne=v,Y=Be(),Y!==t?(r.charCodeAt(v)===47?(he=s,v++):(he=t,$===0&&Fe(o)),he!==t?(ie=Be(),ie!==t?(D=ne,Y=a(Y,ie),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=Be(),Y!==t&&(D=ne,Y=l(Y)),ne=Y),ne}function Be(){var ne,Y,he,ie;return ne=v,Y=fe(),Y!==t?(r.charCodeAt(v)===64?(he=c,v++):(he=t,$===0&&Fe(u)),he!==t?(ie=qe(),ie!==t?(D=ne,Y=g(Y,ie),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=fe(),Y!==t&&(D=ne,Y=f(Y)),ne=Y),ne}function fe(){var ne,Y,he,ie,de;return ne=v,r.charCodeAt(v)===64?(Y=c,v++):(Y=t,$===0&&Fe(u)),Y!==t?(he=ae(),he!==t?(r.charCodeAt(v)===47?(ie=s,v++):(ie=t,$===0&&Fe(o)),ie!==t?(de=ae(),de!==t?(D=ne,Y=h(),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=ae(),Y!==t&&(D=ne,Y=h()),ne=Y),ne}function ae(){var ne,Y,he;if(ne=v,Y=[],p.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Fe(C)),he!==t)for(;he!==t;)Y.push(he),p.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Fe(C));else Y=t;return Y!==t&&(D=ne,Y=h()),ne=Y,ne}function qe(){var ne,Y,he;if(ne=v,Y=[],y.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Fe(B)),he!==t)for(;he!==t;)Y.push(he),y.test(r.charAt(v))?(he=r.charAt(v),v++):(he=t,$===0&&Fe(B));else Y=t;return Y!==t&&(D=ne,Y=h()),ne=Y,ne}if(V=n(),V!==t&&v===r.length)return V;throw V!==t&&v{"use strict";function mU(r){return typeof r>"u"||r===null}function Rfe(r){return typeof r=="object"&&r!==null}function Ffe(r){return Array.isArray(r)?r:mU(r)?[]:[r]}function Nfe(r,e){var t,i,n,s;if(e)for(s=Object.keys(e),t=0,i=s.length;t{"use strict";function Vp(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Vp.prototype=Object.create(Error.prototype);Vp.prototype.constructor=Vp;Vp.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t};EU.exports=Vp});var wU=w((SZe,yU)=>{"use strict";var IU=tc();function HS(r,e,t,i,n){this.name=r,this.buffer=e,this.position=t,this.line=i,this.column=n}HS.prototype.getSnippet=function(e,t){var i,n,s,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,i="",n=this.position;n>0&&`\0\r +\x85\u2028\u2029`.indexOf(this.buffer.charAt(n-1))===-1;)if(n-=1,this.position-n>t/2-1){i=" ... ",n+=5;break}for(s="",o=this.position;ot/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),IU.repeat(" ",e)+i+a+s+` +`+IU.repeat(" ",e+this.position-n+i.length)+"^"};HS.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(i+=`: +`+t)),i};yU.exports=HS});var si=w((vZe,bU)=>{"use strict";var BU=Ng(),Mfe=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Ofe=["scalar","sequence","mapping"];function Kfe(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(i){e[String(i)]=t})}),e}function Ufe(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(Mfe.indexOf(t)===-1)throw new BU('Unknown option "'+t+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=Kfe(e.styleAliases||null),Ofe.indexOf(this.kind)===-1)throw new BU('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}bU.exports=Ufe});var rc=w((xZe,SU)=>{"use strict";var QU=tc(),dI=Ng(),Hfe=si();function GS(r,e,t){var i=[];return r.include.forEach(function(n){t=GS(n,e,t)}),r[e].forEach(function(n){t.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&i.push(o)}),t.push(n)}),t.filter(function(n,s){return i.indexOf(s)===-1})}function Gfe(){var r={scalar:{},sequence:{},mapping:{},fallback:{}},e,t;function i(n){r[n.kind][n.tag]=r.fallback[n.tag]=n}for(e=0,t=arguments.length;e{"use strict";var Yfe=si();vU.exports=new Yfe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})});var DU=w((DZe,PU)=>{"use strict";var jfe=si();PU.exports=new jfe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})});var RU=w((kZe,kU)=>{"use strict";var qfe=si();kU.exports=new qfe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})});var CI=w((RZe,FU)=>{"use strict";var Jfe=rc();FU.exports=new Jfe({explicit:[xU(),DU(),RU()]})});var TU=w((FZe,NU)=>{"use strict";var Wfe=si();function zfe(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function Vfe(){return null}function Xfe(r){return r===null}NU.exports=new Wfe("tag:yaml.org,2002:null",{kind:"scalar",resolve:zfe,construct:Vfe,predicate:Xfe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var MU=w((NZe,LU)=>{"use strict";var Zfe=si();function _fe(r){if(r===null)return!1;var e=r.length;return e===4&&(r==="true"||r==="True"||r==="TRUE")||e===5&&(r==="false"||r==="False"||r==="FALSE")}function $fe(r){return r==="true"||r==="True"||r==="TRUE"}function ehe(r){return Object.prototype.toString.call(r)==="[object Boolean]"}LU.exports=new Zfe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:_fe,construct:$fe,predicate:ehe,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"})});var KU=w((TZe,OU)=>{"use strict";var the=tc(),rhe=si();function ihe(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function nhe(r){return 48<=r&&r<=55}function she(r){return 48<=r&&r<=57}function ohe(r){if(r===null)return!1;var e=r.length,t=0,i=!1,n;if(!e)return!1;if(n=r[t],(n==="-"||n==="+")&&(n=r[++t]),n==="0"){if(t+1===e)return!0;if(n=r[++t],n==="b"){for(t++;t=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0"+r.toString(8):"-0"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var GU=w((LZe,HU)=>{"use strict";var UU=tc(),lhe=si(),che=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function uhe(r){return!(r===null||!che.test(r)||r[r.length-1]==="_")}function ghe(r){var e,t,i,n;return e=r.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,n=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(s){n.unshift(parseFloat(s,10))}),e=0,i=1,n.forEach(function(s){e+=s*i,i*=60}),t*e):t*parseFloat(e,10)}var fhe=/^[-+]?[0-9]+e/;function hhe(r,e){var t;if(isNaN(r))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(UU.isNegativeZero(r))return"-0.0";return t=r.toString(10),fhe.test(t)?t.replace("e",".e"):t}function phe(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||UU.isNegativeZero(r))}HU.exports=new lhe("tag:yaml.org,2002:float",{kind:"scalar",resolve:uhe,construct:ghe,predicate:phe,represent:hhe,defaultStyle:"lowercase"})});var YS=w((MZe,YU)=>{"use strict";var dhe=rc();YU.exports=new dhe({include:[CI()],implicit:[TU(),MU(),KU(),GU()]})});var jS=w((OZe,jU)=>{"use strict";var Che=rc();jU.exports=new Che({include:[YS()]})});var zU=w((KZe,WU)=>{"use strict";var mhe=si(),qU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),JU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Ehe(r){return r===null?!1:qU.exec(r)!==null||JU.exec(r)!==null}function Ihe(r){var e,t,i,n,s,o,a,l=0,c=null,u,g,f;if(e=qU.exec(r),e===null&&(e=JU.exec(r)),e===null)throw new Error("Date resolve error");if(t=+e[1],i=+e[2]-1,n=+e[3],!e[4])return new Date(Date.UTC(t,i,n));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],g=+(e[11]||0),c=(u*60+g)*6e4,e[9]==="-"&&(c=-c)),f=new Date(Date.UTC(t,i,n,s,o,a,l)),c&&f.setTime(f.getTime()-c),f}function yhe(r){return r.toISOString()}WU.exports=new mhe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Ehe,construct:Ihe,instanceOf:Date,represent:yhe})});var XU=w((UZe,VU)=>{"use strict";var whe=si();function Bhe(r){return r==="<<"||r===null}VU.exports=new whe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Bhe})});var $U=w((HZe,_U)=>{"use strict";var ic;try{ZU=J,ic=ZU("buffer").Buffer}catch{}var ZU,bhe=si(),qS=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;function Qhe(r){if(r===null)return!1;var e,t,i=0,n=r.length,s=qS;for(t=0;t64)){if(e<0)return!1;i+=6}return i%8===0}function She(r){var e,t,i=r.replace(/[\r\n=]/g,""),n=i.length,s=qS,o=0,a=[];for(e=0;e>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(i.charAt(e));return t=n%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),ic?ic.from?ic.from(a):new ic(a):a}function vhe(r){var e="",t=0,i,n,s=r.length,o=qS;for(i=0;i>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[i];return n=s%3,n===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):n===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):n===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function xhe(r){return ic&&ic.isBuffer(r)}_U.exports=new bhe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Qhe,construct:She,predicate:xhe,represent:vhe})});var t2=w((YZe,e2)=>{"use strict";var Phe=si(),Dhe=Object.prototype.hasOwnProperty,khe=Object.prototype.toString;function Rhe(r){if(r===null)return!0;var e=[],t,i,n,s,o,a=r;for(t=0,i=a.length;t{"use strict";var Nhe=si(),The=Object.prototype.toString;function Lhe(r){if(r===null)return!0;var e,t,i,n,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e{"use strict";var Ohe=si(),Khe=Object.prototype.hasOwnProperty;function Uhe(r){if(r===null)return!0;var e,t=r;for(e in t)if(Khe.call(t,e)&&t[e]!==null)return!1;return!0}function Hhe(r){return r!==null?r:{}}n2.exports=new Ohe("tag:yaml.org,2002:set",{kind:"mapping",resolve:Uhe,construct:Hhe})});var Lg=w((JZe,o2)=>{"use strict";var Ghe=rc();o2.exports=new Ghe({include:[jS()],implicit:[zU(),XU()],explicit:[$U(),t2(),i2(),s2()]})});var A2=w((WZe,a2)=>{"use strict";var Yhe=si();function jhe(){return!0}function qhe(){}function Jhe(){return""}function Whe(r){return typeof r>"u"}a2.exports=new Yhe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:jhe,construct:qhe,predicate:Whe,represent:Jhe})});var c2=w((zZe,l2)=>{"use strict";var zhe=si();function Vhe(r){if(r===null||r.length===0)return!1;var e=r,t=/\/([gim]*)$/.exec(r),i="";return!(e[0]==="/"&&(t&&(i=t[1]),i.length>3||e[e.length-i.length-1]!=="/"))}function Xhe(r){var e=r,t=/\/([gim]*)$/.exec(r),i="";return e[0]==="/"&&(t&&(i=t[1]),e=e.slice(1,e.length-i.length-1)),new RegExp(e,i)}function Zhe(r){var e="/"+r.source+"/";return r.global&&(e+="g"),r.multiline&&(e+="m"),r.ignoreCase&&(e+="i"),e}function _he(r){return Object.prototype.toString.call(r)==="[object RegExp]"}l2.exports=new zhe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Vhe,construct:Xhe,predicate:_he,represent:Zhe})});var f2=w((VZe,g2)=>{"use strict";var mI;try{u2=J,mI=u2("esprima")}catch{typeof window<"u"&&(mI=window.esprima)}var u2,$he=si();function epe(r){if(r===null)return!1;try{var e="("+r+")",t=mI.parse(e,{range:!0});return!(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function tpe(r){var e="("+r+")",t=mI.parse(e,{range:!0}),i=[],n;if(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return t.body[0].expression.params.forEach(function(s){i.push(s.name)}),n=t.body[0].expression.body.range,t.body[0].expression.body.type==="BlockStatement"?new Function(i,e.slice(n[0]+1,n[1]-1)):new Function(i,"return "+e.slice(n[0],n[1]))}function rpe(r){return r.toString()}function ipe(r){return Object.prototype.toString.call(r)==="[object Function]"}g2.exports=new $he("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:epe,construct:tpe,predicate:ipe,represent:rpe})});var Xp=w((ZZe,p2)=>{"use strict";var h2=rc();p2.exports=h2.DEFAULT=new h2({include:[Lg()],explicit:[A2(),c2(),f2()]})});var N2=w((_Ze,Zp)=>{"use strict";var Ba=tc(),w2=Ng(),npe=wU(),B2=Lg(),spe=Xp(),kA=Object.prototype.hasOwnProperty,EI=1,b2=2,Q2=3,II=4,JS=1,ope=2,d2=3,ape=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Ape=/[\x85\u2028\u2029]/,lpe=/[,\[\]\{\}]/,S2=/^(?:!|!!|![a-z\-]+!)$/i,v2=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function C2(r){return Object.prototype.toString.call(r)}function xo(r){return r===10||r===13}function sc(r){return r===9||r===32}function fn(r){return r===9||r===32||r===10||r===13}function Mg(r){return r===44||r===91||r===93||r===123||r===125}function cpe(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function upe(r){return r===120?2:r===117?4:r===85?8:0}function gpe(r){return 48<=r&&r<=57?r-48:-1}function m2(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?` +`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function fpe(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}var x2=new Array(256),P2=new Array(256);for(nc=0;nc<256;nc++)x2[nc]=m2(nc)?1:0,P2[nc]=m2(nc);var nc;function hpe(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||spe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=r.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function D2(r,e){return new w2(e,new npe(r.filename,r.input,r.position,r.line,r.position-r.lineStart))}function ft(r,e){throw D2(r,e)}function yI(r,e){r.onWarning&&r.onWarning.call(null,D2(r,e))}var E2={YAML:function(e,t,i){var n,s,o;e.version!==null&&ft(e,"duplication of %YAML directive"),i.length!==1&&ft(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&ft(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),o=parseInt(n[2],10),s!==1&&ft(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&yI(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var n,s;i.length!==2&&ft(e,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],S2.test(n)||ft(e,"ill-formed tag handle (first argument) of the TAG directive"),kA.call(e.tagMap,n)&&ft(e,'there is a previously declared suffix for "'+n+'" tag handle'),v2.test(s)||ft(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=s}};function DA(r,e,t,i){var n,s,o,a;if(e1&&(r.result+=Ba.repeat(` +`,e-1))}function ppe(r,e,t){var i,n,s,o,a,l,c,u,g=r.kind,f=r.result,h;if(h=r.input.charCodeAt(r.position),fn(h)||Mg(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(n=r.input.charCodeAt(r.position+1),fn(n)||t&&Mg(n)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;h!==0;){if(h===58){if(n=r.input.charCodeAt(r.position+1),fn(n)||t&&Mg(n))break}else if(h===35){if(i=r.input.charCodeAt(r.position-1),fn(i))break}else{if(r.position===r.lineStart&&wI(r)||t&&Mg(h))break;if(xo(h))if(l=r.line,c=r.lineStart,u=r.lineIndent,zr(r,!1,-1),r.lineIndent>=e){a=!0,h=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=l,r.lineStart=c,r.lineIndent=u;break}}a&&(DA(r,s,o,!1),zS(r,r.line-l),s=o=r.position,a=!1),sc(h)||(o=r.position+1),h=r.input.charCodeAt(++r.position)}return DA(r,s,o,!1),r.result?!0:(r.kind=g,r.result=f,!1)}function dpe(r,e){var t,i,n;if(t=r.input.charCodeAt(r.position),t!==39)return!1;for(r.kind="scalar",r.result="",r.position++,i=n=r.position;(t=r.input.charCodeAt(r.position))!==0;)if(t===39)if(DA(r,i,r.position,!0),t=r.input.charCodeAt(++r.position),t===39)i=r.position,r.position++,n=r.position;else return!0;else xo(t)?(DA(r,i,n,!0),zS(r,zr(r,!1,e)),i=n=r.position):r.position===r.lineStart&&wI(r)?ft(r,"unexpected end of the document within a single quoted scalar"):(r.position++,n=r.position);ft(r,"unexpected end of the stream within a single quoted scalar")}function Cpe(r,e){var t,i,n,s,o,a;if(a=r.input.charCodeAt(r.position),a!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=i=r.position;(a=r.input.charCodeAt(r.position))!==0;){if(a===34)return DA(r,t,r.position,!0),r.position++,!0;if(a===92){if(DA(r,t,r.position,!0),a=r.input.charCodeAt(++r.position),xo(a))zr(r,!1,e);else if(a<256&&x2[a])r.result+=P2[a],r.position++;else if((o=upe(a))>0){for(n=o,s=0;n>0;n--)a=r.input.charCodeAt(++r.position),(o=cpe(a))>=0?s=(s<<4)+o:ft(r,"expected hexadecimal character");r.result+=fpe(s),r.position++}else ft(r,"unknown escape sequence");t=i=r.position}else xo(a)?(DA(r,t,i,!0),zS(r,zr(r,!1,e)),t=i=r.position):r.position===r.lineStart&&wI(r)?ft(r,"unexpected end of the document within a double quoted scalar"):(r.position++,i=r.position)}ft(r,"unexpected end of the stream within a double quoted scalar")}function mpe(r,e){var t=!0,i,n=r.tag,s,o=r.anchor,a,l,c,u,g,f={},h,p,C,y;if(y=r.input.charCodeAt(r.position),y===91)l=93,g=!1,s=[];else if(y===123)l=125,g=!0,s={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),y=r.input.charCodeAt(++r.position);y!==0;){if(zr(r,!0,e),y=r.input.charCodeAt(r.position),y===l)return r.position++,r.tag=n,r.anchor=o,r.kind=g?"mapping":"sequence",r.result=s,!0;t||ft(r,"missed comma between flow collection entries"),p=h=C=null,c=u=!1,y===63&&(a=r.input.charCodeAt(r.position+1),fn(a)&&(c=u=!0,r.position++,zr(r,!0,e))),i=r.line,Kg(r,e,EI,!1,!0),p=r.tag,h=r.result,zr(r,!0,e),y=r.input.charCodeAt(r.position),(u||r.line===i)&&y===58&&(c=!0,y=r.input.charCodeAt(++r.position),zr(r,!0,e),Kg(r,e,EI,!1,!0),C=r.result),g?Og(r,s,f,p,h,C):c?s.push(Og(r,null,f,p,h,C)):s.push(h),zr(r,!0,e),y=r.input.charCodeAt(r.position),y===44?(t=!0,y=r.input.charCodeAt(++r.position)):t=!1}ft(r,"unexpected end of the stream within a flow collection")}function Epe(r,e){var t,i,n=JS,s=!1,o=!1,a=e,l=0,c=!1,u,g;if(g=r.input.charCodeAt(r.position),g===124)i=!1;else if(g===62)i=!0;else return!1;for(r.kind="scalar",r.result="";g!==0;)if(g=r.input.charCodeAt(++r.position),g===43||g===45)JS===n?n=g===43?d2:ope:ft(r,"repeat of a chomping mode identifier");else if((u=gpe(g))>=0)u===0?ft(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?ft(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(sc(g)){do g=r.input.charCodeAt(++r.position);while(sc(g));if(g===35)do g=r.input.charCodeAt(++r.position);while(!xo(g)&&g!==0)}for(;g!==0;){for(WS(r),r.lineIndent=0,g=r.input.charCodeAt(r.position);(!o||r.lineIndenta&&(a=r.lineIndent),xo(g)){l++;continue}if(r.lineIndente)&&l!==0)ft(r,"bad indentation of a sequence entry");else if(r.lineIndente)&&(Kg(r,e,II,!0,n)&&(p?f=r.result:h=r.result),p||(Og(r,c,u,g,f,h,s,o),g=f=h=null),zr(r,!0,-1),y=r.input.charCodeAt(r.position)),r.lineIndent>e&&y!==0)ft(r,"bad indentation of a mapping entry");else if(r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndent tag; it should be "scalar", not "'+r.kind+'"'),g=0,f=r.implicitTypes.length;g tag; it should be "'+h.kind+'", not "'+r.kind+'"'),h.resolve(r.result)?(r.result=h.construct(r.result),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):ft(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")):ft(r,"unknown tag !<"+r.tag+">");return r.listener!==null&&r.listener("close",r),r.tag!==null||r.anchor!==null||u}function bpe(r){var e=r.position,t,i,n,s=!1,o;for(r.version=null,r.checkLineBreaks=r.legacy,r.tagMap={},r.anchorMap={};(o=r.input.charCodeAt(r.position))!==0&&(zr(r,!0,-1),o=r.input.charCodeAt(r.position),!(r.lineIndent>0||o!==37));){for(s=!0,o=r.input.charCodeAt(++r.position),t=r.position;o!==0&&!fn(o);)o=r.input.charCodeAt(++r.position);for(i=r.input.slice(t,r.position),n=[],i.length<1&&ft(r,"directive name must not be less than one character in length");o!==0;){for(;sc(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!xo(o));break}if(xo(o))break;for(t=r.position;o!==0&&!fn(o);)o=r.input.charCodeAt(++r.position);n.push(r.input.slice(t,r.position))}o!==0&&WS(r),kA.call(E2,i)?E2[i](r,i,n):yI(r,'unknown document directive "'+i+'"')}if(zr(r,!0,-1),r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45?(r.position+=3,zr(r,!0,-1)):s&&ft(r,"directives end mark is expected"),Kg(r,r.lineIndent-1,II,!1,!0),zr(r,!0,-1),r.checkLineBreaks&&Ape.test(r.input.slice(e,r.position))&&yI(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&wI(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,zr(r,!0,-1));return}if(r.position"u"&&(t=e,e=null);var i=k2(r,t);if(typeof e!="function")return i;for(var n=0,s=i.length;n"u"&&(t=e,e=null),R2(r,e,Ba.extend({schema:B2},t))}function Spe(r,e){return F2(r,Ba.extend({schema:B2},e))}Zp.exports.loadAll=R2;Zp.exports.load=F2;Zp.exports.safeLoadAll=Qpe;Zp.exports.safeLoad=Spe});var iH=w(($Ze,_S)=>{"use strict";var $p=tc(),ed=Ng(),vpe=Xp(),xpe=Lg(),G2=Object.prototype.toString,Y2=Object.prototype.hasOwnProperty,Ppe=9,_p=10,Dpe=13,kpe=32,Rpe=33,Fpe=34,j2=35,Npe=37,Tpe=38,Lpe=39,Mpe=42,q2=44,Ope=45,J2=58,Kpe=61,Upe=62,Hpe=63,Gpe=64,W2=91,z2=93,Ype=96,V2=123,jpe=124,X2=125,Ni={};Ni[0]="\\0";Ni[7]="\\a";Ni[8]="\\b";Ni[9]="\\t";Ni[10]="\\n";Ni[11]="\\v";Ni[12]="\\f";Ni[13]="\\r";Ni[27]="\\e";Ni[34]='\\"';Ni[92]="\\\\";Ni[133]="\\N";Ni[160]="\\_";Ni[8232]="\\L";Ni[8233]="\\P";var qpe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Jpe(r,e){var t,i,n,s,o,a,l;if(e===null)return{};for(t={},i=Object.keys(e),n=0,s=i.length;n0?r.charCodeAt(s-1):null,f=f&&M2(o,a)}else{for(s=0;si&&r[g+1]!==" ",g=s);else if(!Ug(o))return BI;a=s>0?r.charCodeAt(s-1):null,f=f&&M2(o,a)}c=c||u&&s-g-1>i&&r[g+1]!==" "}return!l&&!c?f&&!n(r)?_2:$2:t>9&&Z2(r)?BI:c?tH:eH}function _pe(r,e,t,i){r.dump=function(){if(e.length===0)return"''";if(!r.noCompatMode&&qpe.indexOf(e)!==-1)return"'"+e+"'";var n=r.indent*Math.max(1,t),s=r.lineWidth===-1?-1:Math.max(Math.min(r.lineWidth,40),r.lineWidth-n),o=i||r.flowLevel>-1&&t>=r.flowLevel;function a(l){return zpe(r,l)}switch(Zpe(e,o,r.indent,s,a)){case _2:return e;case $2:return"'"+e.replace(/'/g,"''")+"'";case eH:return"|"+O2(e,r.indent)+K2(L2(e,n));case tH:return">"+O2(e,r.indent)+K2(L2($pe(e,s),n));case BI:return'"'+ede(e,s)+'"';default:throw new ed("impossible error: invalid scalar style")}}()}function O2(r,e){var t=Z2(r)?String(e):"",i=r[r.length-1]===` +`,n=i&&(r[r.length-2]===` +`||r===` +`),s=n?"+":i?"":"-";return t+s+` +`}function K2(r){return r[r.length-1]===` +`?r.slice(0,-1):r}function $pe(r,e){for(var t=/(\n+)([^\n]*)/g,i=function(){var c=r.indexOf(` +`);return c=c!==-1?c:r.length,t.lastIndex=c,U2(r.slice(0,c),e)}(),n=r[0]===` +`||r[0]===" ",s,o;o=t.exec(r);){var a=o[1],l=o[2];s=l[0]===" ",i+=a+(!n&&!s&&l!==""?` +`:"")+U2(l,e),n=s}return i}function U2(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,i,n=0,s,o=0,a=0,l="";i=t.exec(r);)a=i.index,a-n>e&&(s=o>n?o:a,l+=` +`+r.slice(n,s),n=s+1),o=a;return l+=` +`,r.length-n>e&&o>n?l+=r.slice(n,o)+` +`+r.slice(o+1):l+=r.slice(n),l.slice(1)}function ede(r){for(var e="",t,i,n,s=0;s=55296&&t<=56319&&(i=r.charCodeAt(s+1),i>=56320&&i<=57343)){e+=T2((t-55296)*1024+i-56320+65536),s++;continue}n=Ni[t],e+=!n&&Ug(t)?r[s]:n||T2(t)}return e}function tde(r,e,t){var i="",n=r.tag,s,o;for(s=0,o=t.length;s1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),oc(r,e,c,!1,!1)&&(u+=r.dump,i+=u));r.tag=n,r.dump="{"+i+"}"}function nde(r,e,t,i){var n="",s=r.tag,o=Object.keys(t),a,l,c,u,g,f;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new ed("sortKeys must be a boolean or a function");for(a=0,l=o.length;a1024,g&&(r.dump&&_p===r.dump.charCodeAt(0)?f+="?":f+="? "),f+=r.dump,g&&(f+=VS(r,e)),oc(r,e+1,u,!0,g)&&(r.dump&&_p===r.dump.charCodeAt(0)?f+=":":f+=": ",f+=r.dump,n+=f));r.tag=s,r.dump=n||"{}"}function H2(r,e,t){var i,n,s,o,a,l;for(n=t?r.explicitTypes:r.implicitTypes,s=0,o=n.length;s tag resolver accepts not "'+l+'" style');r.dump=i}return!0}return!1}function oc(r,e,t,i,n,s){r.tag=null,r.dump=t,H2(r,t,!1)||H2(r,t,!0);var o=G2.call(r.dump);i&&(i=r.flowLevel<0||r.flowLevel>e);var a=o==="[object Object]"||o==="[object Array]",l,c;if(a&&(l=r.duplicates.indexOf(t),c=l!==-1),(r.tag!==null&&r.tag!=="?"||c||r.indent!==2&&e>0)&&(n=!1),c&&r.usedDuplicates[l])r.dump="*ref_"+l;else{if(a&&c&&!r.usedDuplicates[l]&&(r.usedDuplicates[l]=!0),o==="[object Object]")i&&Object.keys(r.dump).length!==0?(nde(r,e,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(ide(r,e,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump));else if(o==="[object Array]"){var u=r.noArrayIndent&&e>0?e-1:e;i&&r.dump.length!==0?(rde(r,u,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(tde(r,u,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump))}else if(o==="[object String]")r.tag!=="?"&&_pe(r,r.dump,e,s);else{if(r.skipInvalid)return!1;throw new ed("unacceptable kind of an object to dump "+o)}r.tag!==null&&r.tag!=="?"&&(r.dump="!<"+r.tag+"> "+r.dump)}return!0}function sde(r,e){var t=[],i=[],n,s;for(XS(r,t,i),n=0,s=i.length;n{"use strict";var bI=N2(),nH=iH();function QI(r){return function(){throw new Error("Function "+r+" is deprecated and cannot be used.")}}Fr.exports.Type=si();Fr.exports.Schema=rc();Fr.exports.FAILSAFE_SCHEMA=CI();Fr.exports.JSON_SCHEMA=YS();Fr.exports.CORE_SCHEMA=jS();Fr.exports.DEFAULT_SAFE_SCHEMA=Lg();Fr.exports.DEFAULT_FULL_SCHEMA=Xp();Fr.exports.load=bI.load;Fr.exports.loadAll=bI.loadAll;Fr.exports.safeLoad=bI.safeLoad;Fr.exports.safeLoadAll=bI.safeLoadAll;Fr.exports.dump=nH.dump;Fr.exports.safeDump=nH.safeDump;Fr.exports.YAMLException=Ng();Fr.exports.MINIMAL_SCHEMA=CI();Fr.exports.SAFE_SCHEMA=Lg();Fr.exports.DEFAULT_SCHEMA=Xp();Fr.exports.scan=QI("scan");Fr.exports.parse=QI("parse");Fr.exports.compose=QI("compose");Fr.exports.addConstructor=QI("addConstructor")});var aH=w((t_e,oH)=>{"use strict";var ade=sH();oH.exports=ade});var lH=w((r_e,AH)=>{"use strict";function Ade(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function ac(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ac)}Ade(ac,Error);ac.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g({[Ke]:Ce})))},H=function(R){return R},j=function(R){return R},$=Us("correct indentation"),V=" ",W=ar(" ",!1),_=function(R){return R.length===bA*yg},A=function(R){return R.length===(bA+1)*yg},Ae=function(){return bA++,!0},ge=function(){return bA--,!0},re=function(){return pg()},M=Us("pseudostring"),F=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,ue=Tn(["\r",` +`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),pe=/^[^\r\n\t ,\][{}:#"']/,ke=Tn(["\r",` +`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),Fe=function(){return pg().replace(/^ *| *$/g,"")},Ne="--",oe=ar("--",!1),le=/^[a-zA-Z\/0-9]/,Be=Tn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),fe=/^[^\r\n\t :,]/,ae=Tn(["\r",` +`," "," ",":",","],!0,!1),qe="null",ne=ar("null",!1),Y=function(){return null},he="true",ie=ar("true",!1),de=function(){return!0},_e="false",Pt=ar("false",!1),It=function(){return!1},Mr=Us("string"),ii='"',gi=ar('"',!1),hr=function(){return""},fi=function(R){return R},ni=function(R){return R.join("")},Ks=/^[^"\\\0-\x1F\x7F]/,pr=Tn(['"',"\\",["\0",""],"\x7F"],!0,!1),Ii='\\"',rs=ar('\\"',!1),fa=function(){return'"'},dA="\\\\",cg=ar("\\\\",!1),is=function(){return"\\"},CA="\\/",ha=ar("\\/",!1),wp=function(){return"/"},mA="\\b",EA=ar("\\b",!1),wr=function(){return"\b"},Tl="\\f",ug=ar("\\f",!1),yo=function(){return"\f"},gg="\\n",Bp=ar("\\n",!1),bp=function(){return` +`},vr="\\r",se=ar("\\r",!1),wo=function(){return"\r"},Fn="\\t",fg=ar("\\t",!1),bt=function(){return" "},Ll="\\u",Nn=ar("\\u",!1),ns=function(R,q,Ce,Ke){return String.fromCharCode(parseInt(`0x${R}${q}${Ce}${Ke}`))},ss=/^[0-9a-fA-F]/,gt=Tn([["0","9"],["a","f"],["A","F"]],!1,!1),Bo=Us("blank space"),At=/^[ \t]/,ln=Tn([" "," "],!1,!1),S=Us("white space"),Lt=/^[ \t\n\r]/,hg=Tn([" "," ",` +`,"\r"],!1,!1),Ml=`\r +`,Qp=ar(`\r +`,!1),Sp=` +`,vp=ar(` +`,!1),xp="\r",Pp=ar("\r",!1),G=0,yt=0,IA=[{line:1,column:1}],zi=0,Ol=[],Xe=0,pa;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function pg(){return r.substring(yt,G)}function ME(){return cn(yt,G)}function Dp(R,q){throw q=q!==void 0?q:cn(yt,G),Ul([Us(R)],r.substring(yt,G),q)}function OE(R,q){throw q=q!==void 0?q:cn(yt,G),dg(R,q)}function ar(R,q){return{type:"literal",text:R,ignoreCase:q}}function Tn(R,q,Ce){return{type:"class",parts:R,inverted:q,ignoreCase:Ce}}function Kl(){return{type:"any"}}function kp(){return{type:"end"}}function Us(R){return{type:"other",description:R}}function da(R){var q=IA[R],Ce;if(q)return q;for(Ce=R-1;!IA[Ce];)Ce--;for(q=IA[Ce],q={line:q.line,column:q.column};Cezi&&(zi=G,Ol=[]),Ol.push(R))}function dg(R,q){return new ac(R,null,null,q)}function Ul(R,q,Ce){return new ac(ac.buildMessage(R,q),R,q,Ce)}function Hs(){var R;return R=Cg(),R}function Hl(){var R,q,Ce;for(R=G,q=[],Ce=yA();Ce!==t;)q.push(Ce),Ce=yA();return q!==t&&(yt=R,q=s(q)),R=q,R}function yA(){var R,q,Ce,Ke,Re;return R=G,q=ma(),q!==t?(r.charCodeAt(G)===45?(Ce=o,G++):(Ce=t,Xe===0&&Le(a)),Ce!==t?(Ke=Rr(),Ke!==t?(Re=Ca(),Re!==t?(yt=R,q=l(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R}function Cg(){var R,q,Ce;for(R=G,q=[],Ce=mg();Ce!==t;)q.push(Ce),Ce=mg();return q!==t&&(yt=R,q=c(q)),R=q,R}function mg(){var R,q,Ce,Ke,Re,ze,dt,Ft,Ln;if(R=G,q=Rr(),q===t&&(q=null),q!==t){if(Ce=G,r.charCodeAt(G)===35?(Ke=u,G++):(Ke=t,Xe===0&&Le(g)),Ke!==t){if(Re=[],ze=G,dt=G,Xe++,Ft=js(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Le(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t),ze!==t)for(;ze!==t;)Re.push(ze),ze=G,dt=G,Xe++,Ft=js(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Le(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t);else Re=t;Re!==t?(Ke=[Ke,Re],Ce=Ke):(G=Ce,Ce=t)}else G=Ce,Ce=t;if(Ce===t&&(Ce=null),Ce!==t){if(Ke=[],Re=Ys(),Re!==t)for(;Re!==t;)Ke.push(Re),Re=Ys();else Ke=t;Ke!==t?(yt=R,q=h(),R=q):(G=R,R=t)}else G=R,R=t}else G=R,R=t;if(R===t&&(R=G,q=ma(),q!==t?(Ce=Gl(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Le(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=Ca(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=ma(),q!==t?(Ce=Gs(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Le(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=Ca(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))){if(R=G,q=ma(),q!==t)if(Ce=Gs(),Ce!==t)if(Ke=Rr(),Ke!==t)if(Re=KE(),Re!==t){if(ze=[],dt=Ys(),dt!==t)for(;dt!==t;)ze.push(dt),dt=Ys();else ze=t;ze!==t?(yt=R,q=y(Ce,Re),R=q):(G=R,R=t)}else G=R,R=t;else G=R,R=t;else G=R,R=t;else G=R,R=t;if(R===t)if(R=G,q=ma(),q!==t)if(Ce=Gs(),Ce!==t){if(Ke=[],Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Le(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Ln=Gs(),Ln!==t?(yt=Re,ze=D(Ce,Ln),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t),Re!==t)for(;Re!==t;)Ke.push(Re),Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Le(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Ln=Gs(),Ln!==t?(yt=Re,ze=D(Ce,Ln),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t);else Ke=t;Ke!==t?(Re=Rr(),Re===t&&(Re=null),Re!==t?(r.charCodeAt(G)===58?(ze=p,G++):(ze=t,Xe===0&&Le(C)),ze!==t?(dt=Rr(),dt===t&&(dt=null),dt!==t?(Ft=Ca(),Ft!==t?(yt=R,q=T(Ce,Ke,Ft),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)}else G=R,R=t;else G=R,R=t}return R}function Ca(){var R,q,Ce,Ke,Re,ze,dt;if(R=G,q=G,Xe++,Ce=G,Ke=js(),Ke!==t?(Re=rt(),Re!==t?(r.charCodeAt(G)===45?(ze=o,G++):(ze=t,Xe===0&&Le(a)),ze!==t?(dt=Rr(),dt!==t?(Ke=[Ke,Re,ze,dt],Ce=Ke):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t),Xe--,Ce!==t?(G=q,q=void 0):q=t,q!==t?(Ce=Ys(),Ce!==t?(Ke=bo(),Ke!==t?(Re=Hl(),Re!==t?(ze=wA(),ze!==t?(yt=R,q=H(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=js(),q!==t?(Ce=bo(),Ce!==t?(Ke=Cg(),Ke!==t?(Re=wA(),Re!==t?(yt=R,q=H(Ke),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))if(R=G,q=Yl(),q!==t){if(Ce=[],Ke=Ys(),Ke!==t)for(;Ke!==t;)Ce.push(Ke),Ke=Ys();else Ce=t;Ce!==t?(yt=R,q=j(q),R=q):(G=R,R=t)}else G=R,R=t;return R}function ma(){var R,q,Ce;for(Xe++,R=G,q=[],r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Le(W));Ce!==t;)q.push(Ce),r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Le(W));return q!==t?(yt=G,Ce=_(q),Ce?Ce=void 0:Ce=t,Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)):(G=R,R=t),Xe--,R===t&&(q=t,Xe===0&&Le($)),R}function rt(){var R,q,Ce;for(R=G,q=[],r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Le(W));Ce!==t;)q.push(Ce),r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Le(W));return q!==t?(yt=G,Ce=A(q),Ce?Ce=void 0:Ce=t,Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)):(G=R,R=t),R}function bo(){var R;return yt=G,R=Ae(),R?R=void 0:R=t,R}function wA(){var R;return yt=G,R=ge(),R?R=void 0:R=t,R}function Gl(){var R;return R=jl(),R===t&&(R=Rp()),R}function Gs(){var R,q,Ce;if(R=jl(),R===t){if(R=G,q=[],Ce=Eg(),Ce!==t)for(;Ce!==t;)q.push(Ce),Ce=Eg();else q=t;q!==t&&(yt=R,q=re()),R=q}return R}function Yl(){var R;return R=Fp(),R===t&&(R=UE(),R===t&&(R=jl(),R===t&&(R=Rp()))),R}function KE(){var R;return R=Fp(),R===t&&(R=jl(),R===t&&(R=Eg())),R}function Rp(){var R,q,Ce,Ke,Re,ze;if(Xe++,R=G,F.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Le(ue)),q!==t){for(Ce=[],Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(pe.test(r.charAt(G))?(ze=r.charAt(G),G++):(ze=t,Xe===0&&Le(ke)),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ke!==t;)Ce.push(Ke),Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(pe.test(r.charAt(G))?(ze=r.charAt(G),G++):(ze=t,Xe===0&&Le(ke)),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ce!==t?(yt=R,q=Fe(),R=q):(G=R,R=t)}else G=R,R=t;return Xe--,R===t&&(q=t,Xe===0&&Le(M)),R}function Eg(){var R,q,Ce,Ke,Re;if(R=G,r.substr(G,2)===Ne?(q=Ne,G+=2):(q=t,Xe===0&&Le(oe)),q===t&&(q=null),q!==t)if(le.test(r.charAt(G))?(Ce=r.charAt(G),G++):(Ce=t,Xe===0&&Le(Be)),Ce!==t){for(Ke=[],fe.test(r.charAt(G))?(Re=r.charAt(G),G++):(Re=t,Xe===0&&Le(ae));Re!==t;)Ke.push(Re),fe.test(r.charAt(G))?(Re=r.charAt(G),G++):(Re=t,Xe===0&&Le(ae));Ke!==t?(yt=R,q=Fe(),R=q):(G=R,R=t)}else G=R,R=t;else G=R,R=t;return R}function Fp(){var R,q;return R=G,r.substr(G,4)===qe?(q=qe,G+=4):(q=t,Xe===0&&Le(ne)),q!==t&&(yt=R,q=Y()),R=q,R}function UE(){var R,q;return R=G,r.substr(G,4)===he?(q=he,G+=4):(q=t,Xe===0&&Le(ie)),q!==t&&(yt=R,q=de()),R=q,R===t&&(R=G,r.substr(G,5)===_e?(q=_e,G+=5):(q=t,Xe===0&&Le(Pt)),q!==t&&(yt=R,q=It()),R=q),R}function jl(){var R,q,Ce,Ke;return Xe++,R=G,r.charCodeAt(G)===34?(q=ii,G++):(q=t,Xe===0&&Le(gi)),q!==t?(r.charCodeAt(G)===34?(Ce=ii,G++):(Ce=t,Xe===0&&Le(gi)),Ce!==t?(yt=R,q=hr(),R=q):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,r.charCodeAt(G)===34?(q=ii,G++):(q=t,Xe===0&&Le(gi)),q!==t?(Ce=HE(),Ce!==t?(r.charCodeAt(G)===34?(Ke=ii,G++):(Ke=t,Xe===0&&Le(gi)),Ke!==t?(yt=R,q=fi(Ce),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)),Xe--,R===t&&(q=t,Xe===0&&Le(Mr)),R}function HE(){var R,q,Ce;if(R=G,q=[],Ce=Ig(),Ce!==t)for(;Ce!==t;)q.push(Ce),Ce=Ig();else q=t;return q!==t&&(yt=R,q=ni(q)),R=q,R}function Ig(){var R,q,Ce,Ke,Re,ze;return Ks.test(r.charAt(G))?(R=r.charAt(G),G++):(R=t,Xe===0&&Le(pr)),R===t&&(R=G,r.substr(G,2)===Ii?(q=Ii,G+=2):(q=t,Xe===0&&Le(rs)),q!==t&&(yt=R,q=fa()),R=q,R===t&&(R=G,r.substr(G,2)===dA?(q=dA,G+=2):(q=t,Xe===0&&Le(cg)),q!==t&&(yt=R,q=is()),R=q,R===t&&(R=G,r.substr(G,2)===CA?(q=CA,G+=2):(q=t,Xe===0&&Le(ha)),q!==t&&(yt=R,q=wp()),R=q,R===t&&(R=G,r.substr(G,2)===mA?(q=mA,G+=2):(q=t,Xe===0&&Le(EA)),q!==t&&(yt=R,q=wr()),R=q,R===t&&(R=G,r.substr(G,2)===Tl?(q=Tl,G+=2):(q=t,Xe===0&&Le(ug)),q!==t&&(yt=R,q=yo()),R=q,R===t&&(R=G,r.substr(G,2)===gg?(q=gg,G+=2):(q=t,Xe===0&&Le(Bp)),q!==t&&(yt=R,q=bp()),R=q,R===t&&(R=G,r.substr(G,2)===vr?(q=vr,G+=2):(q=t,Xe===0&&Le(se)),q!==t&&(yt=R,q=wo()),R=q,R===t&&(R=G,r.substr(G,2)===Fn?(q=Fn,G+=2):(q=t,Xe===0&&Le(fg)),q!==t&&(yt=R,q=bt()),R=q,R===t&&(R=G,r.substr(G,2)===Ll?(q=Ll,G+=2):(q=t,Xe===0&&Le(Nn)),q!==t?(Ce=BA(),Ce!==t?(Ke=BA(),Ke!==t?(Re=BA(),Re!==t?(ze=BA(),ze!==t?(yt=R,q=ns(Ce,Ke,Re,ze),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)))))))))),R}function BA(){var R;return ss.test(r.charAt(G))?(R=r.charAt(G),G++):(R=t,Xe===0&&Le(gt)),R}function Rr(){var R,q;if(Xe++,R=[],At.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Le(ln)),q!==t)for(;q!==t;)R.push(q),At.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Le(ln));else R=t;return Xe--,R===t&&(q=t,Xe===0&&Le(Bo)),R}function GE(){var R,q;if(Xe++,R=[],Lt.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Le(hg)),q!==t)for(;q!==t;)R.push(q),Lt.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Le(hg));else R=t;return Xe--,R===t&&(q=t,Xe===0&&Le(S)),R}function Ys(){var R,q,Ce,Ke,Re,ze;if(R=G,q=js(),q!==t){for(Ce=[],Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(ze=js(),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ke!==t;)Ce.push(Ke),Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(ze=js(),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)}else G=R,R=t;return R}function js(){var R;return r.substr(G,2)===Ml?(R=Ml,G+=2):(R=t,Xe===0&&Le(Qp)),R===t&&(r.charCodeAt(G)===10?(R=Sp,G++):(R=t,Xe===0&&Le(vp)),R===t&&(r.charCodeAt(G)===13?(R=xp,G++):(R=t,Xe===0&&Le(Pp)))),R}let yg=2,bA=0;if(pa=n(),pa!==t&&G===r.length)return pa;throw pa!==t&&G{"use strict";var hde=r=>{let e=!1,t=!1,i=!1;for(let n=0;n{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let t=n=>e.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(r)?r=r.map(n=>n.trim()).filter(n=>n.length).join("-"):r=r.trim(),r.length===0?"":r.length===1?e.pascalCase?r.toUpperCase():r.toLowerCase():(r!==r.toLowerCase()&&(r=hde(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,s)=>s.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),t(r))};ev.exports=hH;ev.exports.default=hH});var dH=w((A_e,pde)=>{pde.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:"NOW_BUILDER"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"}]});var Ac=w(Un=>{"use strict";var mH=dH(),Po=process.env;Object.defineProperty(Un,"_vendors",{value:mH.map(function(r){return r.constant})});Un.name=null;Un.isPR=null;mH.forEach(function(r){let t=(Array.isArray(r.env)?r.env:[r.env]).every(function(i){return CH(i)});if(Un[r.constant]=t,t)switch(Un.name=r.name,typeof r.pr){case"string":Un.isPR=!!Po[r.pr];break;case"object":"env"in r.pr?Un.isPR=r.pr.env in Po&&Po[r.pr.env]!==r.pr.ne:"any"in r.pr?Un.isPR=r.pr.any.some(function(i){return!!Po[i]}):Un.isPR=CH(r.pr);break;default:Un.isPR=null}});Un.isCI=!!(Po.CI||Po.CONTINUOUS_INTEGRATION||Po.BUILD_NUMBER||Po.RUN_ID||Un.name);function CH(r){return typeof r=="string"?!!Po[r]:Object.keys(r).every(function(e){return Po[e]===r[e]})}});var hn={};ut(hn,{KeyRelationship:()=>lc,applyCascade:()=>od,base64RegExp:()=>BH,colorStringAlphaRegExp:()=>wH,colorStringRegExp:()=>yH,computeKey:()=>RA,getPrintable:()=>Vr,hasExactLength:()=>xH,hasForbiddenKeys:()=>Wde,hasKeyRelationship:()=>av,hasMaxLength:()=>Dde,hasMinLength:()=>Pde,hasMutuallyExclusiveKeys:()=>zde,hasRequiredKeys:()=>Jde,hasUniqueItems:()=>kde,isArray:()=>yde,isAtLeast:()=>Nde,isAtMost:()=>Tde,isBase64:()=>jde,isBoolean:()=>mde,isDate:()=>Ide,isDict:()=>Bde,isEnum:()=>Zi,isHexColor:()=>Yde,isISO8601:()=>Gde,isInExclusiveRange:()=>Mde,isInInclusiveRange:()=>Lde,isInstanceOf:()=>Qde,isInteger:()=>Ode,isJSON:()=>qde,isLiteral:()=>dde,isLowerCase:()=>Kde,isNegative:()=>Rde,isNullable:()=>xde,isNumber:()=>Ede,isObject:()=>bde,isOneOf:()=>Sde,isOptional:()=>vde,isPositive:()=>Fde,isString:()=>sd,isTuple:()=>wde,isUUID4:()=>Hde,isUnknown:()=>vH,isUpperCase:()=>Ude,iso8601RegExp:()=>ov,makeCoercionFn:()=>cc,makeSetter:()=>SH,makeTrait:()=>QH,makeValidator:()=>Qt,matchesRegExp:()=>ad,plural:()=>kI,pushError:()=>pt,simpleKeyRegExp:()=>IH,uuid4RegExp:()=>bH});function Qt({test:r}){return QH(r)()}function Vr(r){return r===null?"null":r===void 0?"undefined":r===""?"an empty string":JSON.stringify(r)}function RA(r,e){var t,i,n;return typeof e=="number"?`${(t=r==null?void 0:r.p)!==null&&t!==void 0?t:"."}[${e}]`:IH.test(e)?`${(i=r==null?void 0:r.p)!==null&&i!==void 0?i:""}.${e}`:`${(n=r==null?void 0:r.p)!==null&&n!==void 0?n:"."}[${JSON.stringify(e)}]`}function cc(r,e){return t=>{let i=r[e];return r[e]=t,cc(r,e).bind(null,i)}}function SH(r,e){return t=>{r[e]=t}}function kI(r,e,t){return r===1?e:t}function pt({errors:r,p:e}={},t){return r==null||r.push(`${e!=null?e:"."}: ${t}`),!1}function dde(r){return Qt({test:(e,t)=>e!==r?pt(t,`Expected a literal (got ${Vr(r)})`):!0})}function Zi(r){let e=Array.isArray(r)?r:Object.values(r),t=new Set(e);return Qt({test:(i,n)=>t.has(i)?!0:pt(n,`Expected a valid enumeration value (got ${Vr(i)})`)})}var IH,yH,wH,BH,bH,ov,QH,vH,sd,Cde,mde,Ede,Ide,yde,wde,Bde,bde,Qde,Sde,od,vde,xde,Pde,Dde,xH,kde,Rde,Fde,Nde,Tde,Lde,Mde,Ode,ad,Kde,Ude,Hde,Gde,Yde,jde,qde,Jde,Wde,zde,lc,Vde,av,ls=Tge(()=>{IH=/^[a-zA-Z_][a-zA-Z0-9_]*$/,yH=/^#[0-9a-f]{6}$/i,wH=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,BH=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,bH=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,ov=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/,QH=r=>()=>r;vH=()=>Qt({test:(r,e)=>!0});sd=()=>Qt({test:(r,e)=>typeof r!="string"?pt(e,`Expected a string (got ${Vr(r)})`):!0});Cde=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]),mde=()=>Qt({test:(r,e)=>{var t;if(typeof r!="boolean"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i=Cde.get(r);if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a boolean (got ${Vr(r)})`)}return!0}}),Ede=()=>Qt({test:(r,e)=>{var t;if(typeof r!="number"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i;if(typeof r=="string"){let n;try{n=JSON.parse(r)}catch{}if(typeof n=="number")if(JSON.stringify(n)===r)i=n;else return pt(e,`Received a number that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a number (got ${Vr(r)})`)}return!0}}),Ide=()=>Qt({test:(r,e)=>{var t;if(!(r instanceof Date)){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i;if(typeof r=="string"&&ov.test(r))i=new Date(r);else{let n;if(typeof r=="string"){let s;try{s=JSON.parse(r)}catch{}typeof s=="number"&&(n=s)}else typeof r=="number"&&(n=r);if(typeof n<"u")if(Number.isSafeInteger(n)||!Number.isSafeInteger(n*1e3))i=new Date(n*1e3);else return pt(e,`Received a timestamp that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a date (got ${Vr(r)})`)}return!0}}),yde=(r,{delimiter:e}={})=>Qt({test:(t,i)=>{var n;if(typeof t=="string"&&typeof e<"u"&&typeof(i==null?void 0:i.coercions)<"u"){if(typeof(i==null?void 0:i.coercion)>"u")return pt(i,"Unbound coercion result");t=t.split(e),i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,t)])}if(!Array.isArray(t))return pt(i,`Expected an array (got ${Vr(t)})`);let s=!0;for(let o=0,a=t.length;o{let t=xH(r.length);return Qt({test:(i,n)=>{var s;if(typeof i=="string"&&typeof e<"u"&&typeof(n==null?void 0:n.coercions)<"u"){if(typeof(n==null?void 0:n.coercion)>"u")return pt(n,"Unbound coercion result");i=i.split(e),n.coercions.push([(s=n.p)!==null&&s!==void 0?s:".",n.coercion.bind(null,i)])}if(!Array.isArray(i))return pt(n,`Expected a tuple (got ${Vr(i)})`);let o=t(i,Object.assign({},n));for(let a=0,l=i.length;aQt({test:(t,i)=>{if(typeof t!="object"||t===null)return pt(i,`Expected an object (got ${Vr(t)})`);let n=Object.keys(t),s=!0;for(let o=0,a=n.length;o{let t=Object.keys(r);return Qt({test:(i,n)=>{if(typeof i!="object"||i===null)return pt(n,`Expected an object (got ${Vr(i)})`);let s=new Set([...t,...Object.keys(i)]),o={},a=!0;for(let l of s){if(l==="constructor"||l==="__proto__")a=pt(Object.assign(Object.assign({},n),{p:RA(n,l)}),"Unsafe property name");else{let c=Object.prototype.hasOwnProperty.call(r,l)?r[l]:void 0,u=Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;typeof c<"u"?a=c(u,Object.assign(Object.assign({},n),{p:RA(n,l),coercion:cc(i,l)}))&&a:e===null?a=pt(Object.assign(Object.assign({},n),{p:RA(n,l)}),`Extraneous property (got ${Vr(u)})`):Object.defineProperty(o,l,{enumerable:!0,get:()=>u,set:SH(i,l)})}if(!a&&(n==null?void 0:n.errors)==null)break}return e!==null&&(a||(n==null?void 0:n.errors)!=null)&&(a=e(o,n)&&a),a}})},Qde=r=>Qt({test:(e,t)=>e instanceof r?!0:pt(t,`Expected an instance of ${r.name} (got ${Vr(e)})`)}),Sde=(r,{exclusive:e=!1}={})=>Qt({test:(t,i)=>{var n,s,o;let a=[],l=typeof(i==null?void 0:i.errors)<"u"?[]:void 0;for(let c=0,u=r.length;c1?pt(i,`Expected to match exactly a single predicate (matched ${a.join(", ")})`):(o=i==null?void 0:i.errors)===null||o===void 0||o.push(...l),!1}}),od=(r,e)=>Qt({test:(t,i)=>{var n,s;let o={value:t},a=typeof(i==null?void 0:i.coercions)<"u"?cc(o,"value"):void 0,l=typeof(i==null?void 0:i.coercions)<"u"?[]:void 0;if(!r(t,Object.assign(Object.assign({},i),{coercion:a,coercions:l})))return!1;let c=[];if(typeof l<"u")for(let[,u]of l)c.push(u());try{if(typeof(i==null?void 0:i.coercions)<"u"){if(o.value!==t){if(typeof(i==null?void 0:i.coercion)>"u")return pt(i,"Unbound coercion result");i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,o.value)])}(s=i==null?void 0:i.coercions)===null||s===void 0||s.push(...l)}return e.every(u=>u(o.value,i))}finally{for(let u of c)u()}}}),vde=r=>Qt({test:(e,t)=>typeof e>"u"?!0:r(e,t)}),xde=r=>Qt({test:(e,t)=>e===null?!0:r(e,t)}),Pde=r=>Qt({test:(e,t)=>e.length>=r?!0:pt(t,`Expected to have a length of at least ${r} elements (got ${e.length})`)}),Dde=r=>Qt({test:(e,t)=>e.length<=r?!0:pt(t,`Expected to have a length of at most ${r} elements (got ${e.length})`)}),xH=r=>Qt({test:(e,t)=>e.length!==r?pt(t,`Expected to have a length of exactly ${r} elements (got ${e.length})`):!0}),kde=({map:r}={})=>Qt({test:(e,t)=>{let i=new Set,n=new Set;for(let s=0,o=e.length;sQt({test:(r,e)=>r<=0?!0:pt(e,`Expected to be negative (got ${r})`)}),Fde=()=>Qt({test:(r,e)=>r>=0?!0:pt(e,`Expected to be positive (got ${r})`)}),Nde=r=>Qt({test:(e,t)=>e>=r?!0:pt(t,`Expected to be at least ${r} (got ${e})`)}),Tde=r=>Qt({test:(e,t)=>e<=r?!0:pt(t,`Expected to be at most ${r} (got ${e})`)}),Lde=(r,e)=>Qt({test:(t,i)=>t>=r&&t<=e?!0:pt(i,`Expected to be in the [${r}; ${e}] range (got ${t})`)}),Mde=(r,e)=>Qt({test:(t,i)=>t>=r&&tQt({test:(e,t)=>e!==Math.round(e)?pt(t,`Expected to be an integer (got ${e})`):Number.isSafeInteger(e)?!0:pt(t,`Expected to be a safe integer (got ${e})`)}),ad=r=>Qt({test:(e,t)=>r.test(e)?!0:pt(t,`Expected to match the pattern ${r.toString()} (got ${Vr(e)})`)}),Kde=()=>Qt({test:(r,e)=>r!==r.toLowerCase()?pt(e,`Expected to be all-lowercase (got ${r})`):!0}),Ude=()=>Qt({test:(r,e)=>r!==r.toUpperCase()?pt(e,`Expected to be all-uppercase (got ${r})`):!0}),Hde=()=>Qt({test:(r,e)=>bH.test(r)?!0:pt(e,`Expected to be a valid UUID v4 (got ${Vr(r)})`)}),Gde=()=>Qt({test:(r,e)=>ov.test(r)?!1:pt(e,`Expected to be a valid ISO 8601 date string (got ${Vr(r)})`)}),Yde=({alpha:r=!1})=>Qt({test:(e,t)=>(r?yH.test(e):wH.test(e))?!0:pt(t,`Expected to be a valid hexadecimal color string (got ${Vr(e)})`)}),jde=()=>Qt({test:(r,e)=>BH.test(r)?!0:pt(e,`Expected to be a valid base 64 string (got ${Vr(r)})`)}),qde=(r=vH())=>Qt({test:(e,t)=>{let i;try{i=JSON.parse(e)}catch{return pt(t,`Expected to be a valid JSON string (got ${Vr(e)})`)}return r(i,t)}}),Jde=r=>{let e=new Set(r);return Qt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)||s.push(o);return s.length>0?pt(i,`Missing required ${kI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},Wde=r=>{let e=new Set(r);return Qt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>0?pt(i,`Forbidden ${kI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},zde=r=>{let e=new Set(r);return Qt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>1?pt(i,`Mutually exclusive properties ${s.map(o=>`"${o}"`).join(", ")}`):!0}})};(function(r){r.Forbids="Forbids",r.Requires="Requires"})(lc||(lc={}));Vde={[lc.Forbids]:{expect:!1,message:"forbids using"},[lc.Requires]:{expect:!0,message:"requires using"}},av=(r,e,t,{ignore:i=[]}={})=>{let n=new Set(i),s=new Set(t),o=Vde[e];return Qt({test:(a,l)=>{let c=new Set(Object.keys(a));if(!c.has(r)||n.has(a[r]))return!0;let u=[];for(let g of s)(c.has(g)&&!n.has(a[g]))!==o.expect&&u.push(g);return u.length>=1?pt(l,`Property "${r}" ${o.message} ${kI(u.length,"property","properties")} ${u.map(g=>`"${g}"`).join(", ")}`):!0}})}});var qH=w((A$e,jH)=>{"use strict";jH.exports=(r,...e)=>new Promise(t=>{t(r(...e))})});var Jg=w((l$e,pv)=>{"use strict";var gCe=qH(),JH=r=>{if(r<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],t=0,i=()=>{t--,e.length>0&&e.shift()()},n=(a,l,...c)=>{t++;let u=gCe(a,...c);l(u),u.then(i,i)},s=(a,l,...c)=>{tnew Promise(c=>s(a,c,...l));return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>e.length}}),o};pv.exports=JH;pv.exports.default=JH});var gd=w((u$e,WH)=>{var fCe="2.0.0",hCe=Number.MAX_SAFE_INTEGER||9007199254740991,pCe=16;WH.exports={SEMVER_SPEC_VERSION:fCe,MAX_LENGTH:256,MAX_SAFE_INTEGER:hCe,MAX_SAFE_COMPONENT_LENGTH:pCe}});var fd=w((g$e,zH)=>{var dCe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};zH.exports=dCe});var uc=w((NA,VH)=>{var{MAX_SAFE_COMPONENT_LENGTH:dv}=gd(),CCe=fd();NA=VH.exports={};var mCe=NA.re=[],et=NA.src=[],tt=NA.t={},ECe=0,St=(r,e,t)=>{let i=ECe++;CCe(i,e),tt[r]=i,et[i]=e,mCe[i]=new RegExp(e,t?"g":void 0)};St("NUMERICIDENTIFIER","0|[1-9]\\d*");St("NUMERICIDENTIFIERLOOSE","[0-9]+");St("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");St("MAINVERSION",`(${et[tt.NUMERICIDENTIFIER]})\\.(${et[tt.NUMERICIDENTIFIER]})\\.(${et[tt.NUMERICIDENTIFIER]})`);St("MAINVERSIONLOOSE",`(${et[tt.NUMERICIDENTIFIERLOOSE]})\\.(${et[tt.NUMERICIDENTIFIERLOOSE]})\\.(${et[tt.NUMERICIDENTIFIERLOOSE]})`);St("PRERELEASEIDENTIFIER",`(?:${et[tt.NUMERICIDENTIFIER]}|${et[tt.NONNUMERICIDENTIFIER]})`);St("PRERELEASEIDENTIFIERLOOSE",`(?:${et[tt.NUMERICIDENTIFIERLOOSE]}|${et[tt.NONNUMERICIDENTIFIER]})`);St("PRERELEASE",`(?:-(${et[tt.PRERELEASEIDENTIFIER]}(?:\\.${et[tt.PRERELEASEIDENTIFIER]})*))`);St("PRERELEASELOOSE",`(?:-?(${et[tt.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${et[tt.PRERELEASEIDENTIFIERLOOSE]})*))`);St("BUILDIDENTIFIER","[0-9A-Za-z-]+");St("BUILD",`(?:\\+(${et[tt.BUILDIDENTIFIER]}(?:\\.${et[tt.BUILDIDENTIFIER]})*))`);St("FULLPLAIN",`v?${et[tt.MAINVERSION]}${et[tt.PRERELEASE]}?${et[tt.BUILD]}?`);St("FULL",`^${et[tt.FULLPLAIN]}$`);St("LOOSEPLAIN",`[v=\\s]*${et[tt.MAINVERSIONLOOSE]}${et[tt.PRERELEASELOOSE]}?${et[tt.BUILD]}?`);St("LOOSE",`^${et[tt.LOOSEPLAIN]}$`);St("GTLT","((?:<|>)?=?)");St("XRANGEIDENTIFIERLOOSE",`${et[tt.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);St("XRANGEIDENTIFIER",`${et[tt.NUMERICIDENTIFIER]}|x|X|\\*`);St("XRANGEPLAIN",`[v=\\s]*(${et[tt.XRANGEIDENTIFIER]})(?:\\.(${et[tt.XRANGEIDENTIFIER]})(?:\\.(${et[tt.XRANGEIDENTIFIER]})(?:${et[tt.PRERELEASE]})?${et[tt.BUILD]}?)?)?`);St("XRANGEPLAINLOOSE",`[v=\\s]*(${et[tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${et[tt.XRANGEIDENTIFIERLOOSE]})(?:\\.(${et[tt.XRANGEIDENTIFIERLOOSE]})(?:${et[tt.PRERELEASELOOSE]})?${et[tt.BUILD]}?)?)?`);St("XRANGE",`^${et[tt.GTLT]}\\s*${et[tt.XRANGEPLAIN]}$`);St("XRANGELOOSE",`^${et[tt.GTLT]}\\s*${et[tt.XRANGEPLAINLOOSE]}$`);St("COERCE",`(^|[^\\d])(\\d{1,${dv}})(?:\\.(\\d{1,${dv}}))?(?:\\.(\\d{1,${dv}}))?(?:$|[^\\d])`);St("COERCERTL",et[tt.COERCE],!0);St("LONETILDE","(?:~>?)");St("TILDETRIM",`(\\s*)${et[tt.LONETILDE]}\\s+`,!0);NA.tildeTrimReplace="$1~";St("TILDE",`^${et[tt.LONETILDE]}${et[tt.XRANGEPLAIN]}$`);St("TILDELOOSE",`^${et[tt.LONETILDE]}${et[tt.XRANGEPLAINLOOSE]}$`);St("LONECARET","(?:\\^)");St("CARETTRIM",`(\\s*)${et[tt.LONECARET]}\\s+`,!0);NA.caretTrimReplace="$1^";St("CARET",`^${et[tt.LONECARET]}${et[tt.XRANGEPLAIN]}$`);St("CARETLOOSE",`^${et[tt.LONECARET]}${et[tt.XRANGEPLAINLOOSE]}$`);St("COMPARATORLOOSE",`^${et[tt.GTLT]}\\s*(${et[tt.LOOSEPLAIN]})$|^$`);St("COMPARATOR",`^${et[tt.GTLT]}\\s*(${et[tt.FULLPLAIN]})$|^$`);St("COMPARATORTRIM",`(\\s*)${et[tt.GTLT]}\\s*(${et[tt.LOOSEPLAIN]}|${et[tt.XRANGEPLAIN]})`,!0);NA.comparatorTrimReplace="$1$2$3";St("HYPHENRANGE",`^\\s*(${et[tt.XRANGEPLAIN]})\\s+-\\s+(${et[tt.XRANGEPLAIN]})\\s*$`);St("HYPHENRANGELOOSE",`^\\s*(${et[tt.XRANGEPLAINLOOSE]})\\s+-\\s+(${et[tt.XRANGEPLAINLOOSE]})\\s*$`);St("STAR","(<|>)?=?\\s*\\*");St("GTE0","^\\s*>=\\s*0.0.0\\s*$");St("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")});var hd=w((f$e,XH)=>{var ICe=["includePrerelease","loose","rtl"],yCe=r=>r?typeof r!="object"?{loose:!0}:ICe.filter(e=>r[e]).reduce((e,t)=>(e[t]=!0,e),{}):{};XH.exports=yCe});var MI=w((h$e,$H)=>{var ZH=/^[0-9]+$/,_H=(r,e)=>{let t=ZH.test(r),i=ZH.test(e);return t&&i&&(r=+r,e=+e),r===e?0:t&&!i?-1:i&&!t?1:r_H(e,r);$H.exports={compareIdentifiers:_H,rcompareIdentifiers:wCe}});var Li=w((p$e,iG)=>{var OI=fd(),{MAX_LENGTH:eG,MAX_SAFE_INTEGER:KI}=gd(),{re:tG,t:rG}=uc(),BCe=hd(),{compareIdentifiers:pd}=MI(),Yn=class{constructor(e,t){if(t=BCe(t),e instanceof Yn){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>eG)throw new TypeError(`version is longer than ${eG} characters`);OI("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=e.trim().match(t.loose?tG[rG.LOOSE]:tG[rG.FULL]);if(!i)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>KI||this.major<0)throw new TypeError("Invalid major version");if(this.minor>KI||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>KI||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);i===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};iG.exports=Yn});var gc=w((d$e,aG)=>{var{MAX_LENGTH:bCe}=gd(),{re:nG,t:sG}=uc(),oG=Li(),QCe=hd(),SCe=(r,e)=>{if(e=QCe(e),r instanceof oG)return r;if(typeof r!="string"||r.length>bCe||!(e.loose?nG[sG.LOOSE]:nG[sG.FULL]).test(r))return null;try{return new oG(r,e)}catch{return null}};aG.exports=SCe});var lG=w((C$e,AG)=>{var vCe=gc(),xCe=(r,e)=>{let t=vCe(r,e);return t?t.version:null};AG.exports=xCe});var uG=w((m$e,cG)=>{var PCe=gc(),DCe=(r,e)=>{let t=PCe(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};cG.exports=DCe});var fG=w((E$e,gG)=>{var kCe=Li(),RCe=(r,e,t,i)=>{typeof t=="string"&&(i=t,t=void 0);try{return new kCe(r,t).inc(e,i).version}catch{return null}};gG.exports=RCe});var cs=w((I$e,pG)=>{var hG=Li(),FCe=(r,e,t)=>new hG(r,t).compare(new hG(e,t));pG.exports=FCe});var UI=w((y$e,dG)=>{var NCe=cs(),TCe=(r,e,t)=>NCe(r,e,t)===0;dG.exports=TCe});var EG=w((w$e,mG)=>{var CG=gc(),LCe=UI(),MCe=(r,e)=>{if(LCe(r,e))return null;{let t=CG(r),i=CG(e),n=t.prerelease.length||i.prerelease.length,s=n?"pre":"",o=n?"prerelease":"";for(let a in t)if((a==="major"||a==="minor"||a==="patch")&&t[a]!==i[a])return s+a;return o}};mG.exports=MCe});var yG=w((B$e,IG)=>{var OCe=Li(),KCe=(r,e)=>new OCe(r,e).major;IG.exports=KCe});var BG=w((b$e,wG)=>{var UCe=Li(),HCe=(r,e)=>new UCe(r,e).minor;wG.exports=HCe});var QG=w((Q$e,bG)=>{var GCe=Li(),YCe=(r,e)=>new GCe(r,e).patch;bG.exports=YCe});var vG=w((S$e,SG)=>{var jCe=gc(),qCe=(r,e)=>{let t=jCe(r,e);return t&&t.prerelease.length?t.prerelease:null};SG.exports=qCe});var PG=w((v$e,xG)=>{var JCe=cs(),WCe=(r,e,t)=>JCe(e,r,t);xG.exports=WCe});var kG=w((x$e,DG)=>{var zCe=cs(),VCe=(r,e)=>zCe(r,e,!0);DG.exports=VCe});var HI=w((P$e,FG)=>{var RG=Li(),XCe=(r,e,t)=>{let i=new RG(r,t),n=new RG(e,t);return i.compare(n)||i.compareBuild(n)};FG.exports=XCe});var TG=w((D$e,NG)=>{var ZCe=HI(),_Ce=(r,e)=>r.sort((t,i)=>ZCe(t,i,e));NG.exports=_Ce});var MG=w((k$e,LG)=>{var $Ce=HI(),eme=(r,e)=>r.sort((t,i)=>$Ce(i,t,e));LG.exports=eme});var dd=w((R$e,OG)=>{var tme=cs(),rme=(r,e,t)=>tme(r,e,t)>0;OG.exports=rme});var GI=w((F$e,KG)=>{var ime=cs(),nme=(r,e,t)=>ime(r,e,t)<0;KG.exports=nme});var Cv=w((N$e,UG)=>{var sme=cs(),ome=(r,e,t)=>sme(r,e,t)!==0;UG.exports=ome});var YI=w((T$e,HG)=>{var ame=cs(),Ame=(r,e,t)=>ame(r,e,t)>=0;HG.exports=Ame});var jI=w((L$e,GG)=>{var lme=cs(),cme=(r,e,t)=>lme(r,e,t)<=0;GG.exports=cme});var mv=w((M$e,YG)=>{var ume=UI(),gme=Cv(),fme=dd(),hme=YI(),pme=GI(),dme=jI(),Cme=(r,e,t,i)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return ume(r,t,i);case"!=":return gme(r,t,i);case">":return fme(r,t,i);case">=":return hme(r,t,i);case"<":return pme(r,t,i);case"<=":return dme(r,t,i);default:throw new TypeError(`Invalid operator: ${e}`)}};YG.exports=Cme});var qG=w((O$e,jG)=>{var mme=Li(),Eme=gc(),{re:qI,t:JI}=uc(),Ime=(r,e)=>{if(r instanceof mme)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(qI[JI.COERCE]);else{let i;for(;(i=qI[JI.COERCERTL].exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||i.index+i[0].length!==t.index+t[0].length)&&(t=i),qI[JI.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;qI[JI.COERCERTL].lastIndex=-1}return t===null?null:Eme(`${t[2]}.${t[3]||"0"}.${t[4]||"0"}`,e)};jG.exports=Ime});var WG=w((K$e,JG)=>{"use strict";JG.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var WI=w((U$e,zG)=>{"use strict";zG.exports=Ht;Ht.Node=fc;Ht.create=Ht;function Ht(r){var e=this;if(e instanceof Ht||(e=new Ht),e.tail=null,e.head=null,e.length=0,r&&typeof r.forEach=="function")r.forEach(function(n){e.push(n)});else if(arguments.length>0)for(var t=0,i=arguments.length;t1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;i!==null;n++)t=r(t,i.value,n),i=i.next;return t};Ht.prototype.reduceReverse=function(r,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;i!==null;n--)t=r(t,i.value,n),i=i.prev;return t};Ht.prototype.toArray=function(){for(var r=new Array(this.length),e=0,t=this.head;t!==null;e++)r[e]=t.value,t=t.next;return r};Ht.prototype.toArrayReverse=function(){for(var r=new Array(this.length),e=0,t=this.tail;t!==null;e++)r[e]=t.value,t=t.prev;return r};Ht.prototype.slice=function(r,e){e=e||this.length,e<0&&(e+=this.length),r=r||0,r<0&&(r+=this.length);var t=new Ht;if(ethis.length&&(e=this.length);for(var i=0,n=this.head;n!==null&&ithis.length&&(e=this.length);for(var i=this.length,n=this.tail;n!==null&&i>e;i--)n=n.prev;for(;n!==null&&i>r;i--,n=n.prev)t.push(n.value);return t};Ht.prototype.splice=function(r,e,...t){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,n=this.head;n!==null&&i{"use strict";var bme=WI(),hc=Symbol("max"),va=Symbol("length"),Wg=Symbol("lengthCalculator"),md=Symbol("allowStale"),pc=Symbol("maxAge"),Sa=Symbol("dispose"),VG=Symbol("noDisposeOnSet"),di=Symbol("lruList"),Zs=Symbol("cache"),ZG=Symbol("updateAgeOnGet"),Ev=()=>1,yv=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let t=this[hc]=e.max||1/0,i=e.length||Ev;if(this[Wg]=typeof i!="function"?Ev:i,this[md]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[pc]=e.maxAge||0,this[Sa]=e.dispose,this[VG]=e.noDisposeOnSet||!1,this[ZG]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[hc]=e||1/0,Cd(this)}get max(){return this[hc]}set allowStale(e){this[md]=!!e}get allowStale(){return this[md]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[pc]=e,Cd(this)}get maxAge(){return this[pc]}set lengthCalculator(e){typeof e!="function"&&(e=Ev),e!==this[Wg]&&(this[Wg]=e,this[va]=0,this[di].forEach(t=>{t.length=this[Wg](t.value,t.key),this[va]+=t.length})),Cd(this)}get lengthCalculator(){return this[Wg]}get length(){return this[va]}get itemCount(){return this[di].length}rforEach(e,t){t=t||this;for(let i=this[di].tail;i!==null;){let n=i.prev;XG(this,e,i,t),i=n}}forEach(e,t){t=t||this;for(let i=this[di].head;i!==null;){let n=i.next;XG(this,e,i,t),i=n}}keys(){return this[di].toArray().map(e=>e.key)}values(){return this[di].toArray().map(e=>e.value)}reset(){this[Sa]&&this[di]&&this[di].length&&this[di].forEach(e=>this[Sa](e.key,e.value)),this[Zs]=new Map,this[di]=new bme,this[va]=0}dump(){return this[di].map(e=>zI(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[di]}set(e,t,i){if(i=i||this[pc],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let n=i?Date.now():0,s=this[Wg](t,e);if(this[Zs].has(e)){if(s>this[hc])return zg(this,this[Zs].get(e)),!1;let l=this[Zs].get(e).value;return this[Sa]&&(this[VG]||this[Sa](e,l.value)),l.now=n,l.maxAge=i,l.value=t,this[va]+=s-l.length,l.length=s,this.get(e),Cd(this),!0}let o=new wv(e,t,s,n,i);return o.length>this[hc]?(this[Sa]&&this[Sa](e,t),!1):(this[va]+=o.length,this[di].unshift(o),this[Zs].set(e,this[di].head),Cd(this),!0)}has(e){if(!this[Zs].has(e))return!1;let t=this[Zs].get(e).value;return!zI(this,t)}get(e){return Iv(this,e,!0)}peek(e){return Iv(this,e,!1)}pop(){let e=this[di].tail;return e?(zg(this,e),e.value):null}del(e){zg(this,this[Zs].get(e))}load(e){this.reset();let t=Date.now();for(let i=e.length-1;i>=0;i--){let n=e[i],s=n.e||0;if(s===0)this.set(n.k,n.v);else{let o=s-t;o>0&&this.set(n.k,n.v,o)}}}prune(){this[Zs].forEach((e,t)=>Iv(this,t,!1))}},Iv=(r,e,t)=>{let i=r[Zs].get(e);if(i){let n=i.value;if(zI(r,n)){if(zg(r,i),!r[md])return}else t&&(r[ZG]&&(i.value.now=Date.now()),r[di].unshiftNode(i));return n.value}},zI=(r,e)=>{if(!e||!e.maxAge&&!r[pc])return!1;let t=Date.now()-e.now;return e.maxAge?t>e.maxAge:r[pc]&&t>r[pc]},Cd=r=>{if(r[va]>r[hc])for(let e=r[di].tail;r[va]>r[hc]&&e!==null;){let t=e.prev;zg(r,e),e=t}},zg=(r,e)=>{if(e){let t=e.value;r[Sa]&&r[Sa](t.key,t.value),r[va]-=t.length,r[Zs].delete(t.key),r[di].removeNode(e)}},wv=class{constructor(e,t,i,n,s){this.key=e,this.value=t,this.length=i,this.now=n,this.maxAge=s||0}},XG=(r,e,t,i)=>{let n=t.value;zI(r,n)&&(zg(r,t),r[md]||(n=void 0)),n&&e.call(i,n.value,n.key,r)};_G.exports=yv});var us=w((G$e,iY)=>{var dc=class{constructor(e,t){if(t=Sme(t),e instanceof dc)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new dc(e.raw,t);if(e instanceof Bv)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!tY(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&kme(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let i=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=eY.get(i);if(n)return n;let s=this.options.loose,o=s?Mi[bi.HYPHENRANGELOOSE]:Mi[bi.HYPHENRANGE];e=e.replace(o,Hme(this.options.includePrerelease)),Hr("hyphen replace",e),e=e.replace(Mi[bi.COMPARATORTRIM],xme),Hr("comparator trim",e,Mi[bi.COMPARATORTRIM]),e=e.replace(Mi[bi.TILDETRIM],Pme),e=e.replace(Mi[bi.CARETTRIM],Dme),e=e.split(/\s+/).join(" ");let a=s?Mi[bi.COMPARATORLOOSE]:Mi[bi.COMPARATOR],l=e.split(" ").map(f=>Rme(f,this.options)).join(" ").split(/\s+/).map(f=>Ume(f,this.options)).filter(this.options.loose?f=>!!f.match(a):()=>!0).map(f=>new Bv(f,this.options)),c=l.length,u=new Map;for(let f of l){if(tY(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let g=[...u.values()];return eY.set(i,g),g}intersects(e,t){if(!(e instanceof dc))throw new TypeError("a Range is required");return this.set.some(i=>rY(i,t)&&e.set.some(n=>rY(n,t)&&i.every(s=>n.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new vme(e,this.options)}catch{return!1}for(let t=0;tr.value==="<0.0.0-0",kme=r=>r.value==="",rY=(r,e)=>{let t=!0,i=r.slice(),n=i.pop();for(;t&&i.length;)t=i.every(s=>n.intersects(s,e)),n=i.pop();return t},Rme=(r,e)=>(Hr("comp",r,e),r=Tme(r,e),Hr("caret",r),r=Fme(r,e),Hr("tildes",r),r=Mme(r,e),Hr("xrange",r),r=Kme(r,e),Hr("stars",r),r),$i=r=>!r||r.toLowerCase()==="x"||r==="*",Fme=(r,e)=>r.trim().split(/\s+/).map(t=>Nme(t,e)).join(" "),Nme=(r,e)=>{let t=e.loose?Mi[bi.TILDELOOSE]:Mi[bi.TILDE];return r.replace(t,(i,n,s,o,a)=>{Hr("tilde",r,i,n,s,o,a);let l;return $i(n)?l="":$i(s)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:$i(o)?l=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:a?(Hr("replaceTilde pr",a),l=`>=${n}.${s}.${o}-${a} <${n}.${+s+1}.0-0`):l=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,Hr("tilde return",l),l})},Tme=(r,e)=>r.trim().split(/\s+/).map(t=>Lme(t,e)).join(" "),Lme=(r,e)=>{Hr("caret",r,e);let t=e.loose?Mi[bi.CARETLOOSE]:Mi[bi.CARET],i=e.includePrerelease?"-0":"";return r.replace(t,(n,s,o,a,l)=>{Hr("caret",r,n,s,o,a,l);let c;return $i(s)?c="":$i(o)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:$i(a)?s==="0"?c=`>=${s}.${o}.0${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${i} <${+s+1}.0.0-0`:l?(Hr("replaceCaret pr",l),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${l} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${l} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${l} <${+s+1}.0.0-0`):(Hr("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${i} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Hr("caret return",c),c})},Mme=(r,e)=>(Hr("replaceXRanges",r,e),r.split(/\s+/).map(t=>Ome(t,e)).join(" ")),Ome=(r,e)=>{r=r.trim();let t=e.loose?Mi[bi.XRANGELOOSE]:Mi[bi.XRANGE];return r.replace(t,(i,n,s,o,a,l)=>{Hr("xRange",r,i,n,s,o,a,l);let c=$i(s),u=c||$i(o),g=u||$i(a),f=g;return n==="="&&f&&(n=""),l=e.includePrerelease?"-0":"",c?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&f?(u&&(o=0),a=0,n===">"?(n=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",u?s=+s+1:o=+o+1),n==="<"&&(l="-0"),i=`${n+s}.${o}.${a}${l}`):u?i=`>=${s}.0.0${l} <${+s+1}.0.0-0`:g&&(i=`>=${s}.${o}.0${l} <${s}.${+o+1}.0-0`),Hr("xRange return",i),i})},Kme=(r,e)=>(Hr("replaceStars",r,e),r.trim().replace(Mi[bi.STAR],"")),Ume=(r,e)=>(Hr("replaceGTE0",r,e),r.trim().replace(Mi[e.includePrerelease?bi.GTE0PRE:bi.GTE0],"")),Hme=r=>(e,t,i,n,s,o,a,l,c,u,g,f,h)=>($i(i)?t="":$i(n)?t=`>=${i}.0.0${r?"-0":""}`:$i(s)?t=`>=${i}.${n}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,$i(c)?l="":$i(u)?l=`<${+c+1}.0.0-0`:$i(g)?l=`<${c}.${+u+1}.0-0`:f?l=`<=${c}.${u}.${g}-${f}`:r?l=`<${c}.${u}.${+g+1}-0`:l=`<=${l}`,`${t} ${l}`.trim()),Gme=(r,e,t)=>{for(let i=0;i0){let n=r[i].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var Ed=w((Y$e,AY)=>{var Id=Symbol("SemVer ANY"),Vg=class{static get ANY(){return Id}constructor(e,t){if(t=Yme(t),e instanceof Vg){if(e.loose===!!t.loose)return e;e=e.value}Qv("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Id?this.value="":this.value=this.operator+this.semver.version,Qv("comp",this)}parse(e){let t=this.options.loose?nY[sY.COMPARATORLOOSE]:nY[sY.COMPARATOR],i=e.match(t);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new oY(i[2],this.options.loose):this.semver=Id}toString(){return this.value}test(e){if(Qv("Comparator.test",e,this.options.loose),this.semver===Id||e===Id)return!0;if(typeof e=="string")try{e=new oY(e,this.options)}catch{return!1}return bv(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Vg))throw new TypeError("a Comparator is required");if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new aY(e.value,t).test(this.value);if(e.operator==="")return e.value===""?!0:new aY(this.value,t).test(e.semver);let i=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),s=this.semver.version===e.semver.version,o=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),a=bv(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),l=bv(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return i||n||s&&o||a||l}};AY.exports=Vg;var Yme=hd(),{re:nY,t:sY}=uc(),bv=mv(),Qv=fd(),oY=Li(),aY=us()});var yd=w((j$e,lY)=>{var jme=us(),qme=(r,e,t)=>{try{e=new jme(e,t)}catch{return!1}return e.test(r)};lY.exports=qme});var uY=w((q$e,cY)=>{var Jme=us(),Wme=(r,e)=>new Jme(r,e).set.map(t=>t.map(i=>i.value).join(" ").trim().split(" "));cY.exports=Wme});var fY=w((J$e,gY)=>{var zme=Li(),Vme=us(),Xme=(r,e,t)=>{let i=null,n=null,s=null;try{s=new Vme(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===-1)&&(i=o,n=new zme(i,t))}),i};gY.exports=Xme});var pY=w((W$e,hY)=>{var Zme=Li(),_me=us(),$me=(r,e,t)=>{let i=null,n=null,s=null;try{s=new _me(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===1)&&(i=o,n=new Zme(i,t))}),i};hY.exports=$me});var mY=w((z$e,CY)=>{var Sv=Li(),eEe=us(),dY=dd(),tEe=(r,e)=>{r=new eEe(r,e);let t=new Sv("0.0.0");if(r.test(t)||(t=new Sv("0.0.0-0"),r.test(t)))return t;t=null;for(let i=0;i{let a=new Sv(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||dY(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!t||dY(t,s))&&(t=s)}return t&&r.test(t)?t:null};CY.exports=tEe});var IY=w((V$e,EY)=>{var rEe=us(),iEe=(r,e)=>{try{return new rEe(r,e).range||"*"}catch{return null}};EY.exports=iEe});var VI=w((X$e,bY)=>{var nEe=Li(),BY=Ed(),{ANY:sEe}=BY,oEe=us(),aEe=yd(),yY=dd(),wY=GI(),AEe=jI(),lEe=YI(),cEe=(r,e,t,i)=>{r=new nEe(r,i),e=new oEe(e,i);let n,s,o,a,l;switch(t){case">":n=yY,s=AEe,o=wY,a=">",l=">=";break;case"<":n=wY,s=lEe,o=yY,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(aEe(r,e,i))return!1;for(let c=0;c{h.semver===sEe&&(h=new BY(">=0.0.0")),g=g||h,f=f||h,n(h.semver,g.semver,i)?g=h:o(h.semver,f.semver,i)&&(f=h)}),g.operator===a||g.operator===l||(!f.operator||f.operator===a)&&s(r,f.semver))return!1;if(f.operator===l&&o(r,f.semver))return!1}return!0};bY.exports=cEe});var SY=w((Z$e,QY)=>{var uEe=VI(),gEe=(r,e,t)=>uEe(r,e,">",t);QY.exports=gEe});var xY=w((_$e,vY)=>{var fEe=VI(),hEe=(r,e,t)=>fEe(r,e,"<",t);vY.exports=hEe});var kY=w(($$e,DY)=>{var PY=us(),pEe=(r,e,t)=>(r=new PY(r,t),e=new PY(e,t),r.intersects(e));DY.exports=pEe});var FY=w((eet,RY)=>{var dEe=yd(),CEe=cs();RY.exports=(r,e,t)=>{let i=[],n=null,s=null,o=r.sort((u,g)=>CEe(u,g,t));for(let u of o)dEe(u,e,t)?(s=u,n||(n=u)):(s&&i.push([n,s]),s=null,n=null);n&&i.push([n,null]);let a=[];for(let[u,g]of i)u===g?a.push(u):!g&&u===o[0]?a.push("*"):g?u===o[0]?a.push(`<=${g}`):a.push(`${u} - ${g}`):a.push(`>=${u}`);let l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{var NY=us(),XI=Ed(),{ANY:vv}=XI,wd=yd(),xv=cs(),mEe=(r,e,t={})=>{if(r===e)return!0;r=new NY(r,t),e=new NY(e,t);let i=!1;e:for(let n of r.set){for(let s of e.set){let o=EEe(n,s,t);if(i=i||o!==null,o)continue e}if(i)return!1}return!0},EEe=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===vv){if(e.length===1&&e[0].semver===vv)return!0;t.includePrerelease?r=[new XI(">=0.0.0-0")]:r=[new XI(">=0.0.0")]}if(e.length===1&&e[0].semver===vv){if(t.includePrerelease)return!0;e=[new XI(">=0.0.0")]}let i=new Set,n,s;for(let h of r)h.operator===">"||h.operator===">="?n=TY(n,h,t):h.operator==="<"||h.operator==="<="?s=LY(s,h,t):i.add(h.semver);if(i.size>1)return null;let o;if(n&&s){if(o=xv(n.semver,s.semver,t),o>0)return null;if(o===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(n&&!wd(h,String(n),t)||s&&!wd(h,String(s),t))return null;for(let p of e)if(!wd(h,String(p),t))return!1;return!0}let a,l,c,u,g=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;g&&g.prerelease.length===1&&s.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(let h of e){if(u=u||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",n){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(a=TY(n,h,t),a===h&&a!==n)return!1}else if(n.operator===">="&&!wd(n.semver,String(h),t))return!1}if(s){if(g&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===g.major&&h.semver.minor===g.minor&&h.semver.patch===g.patch&&(g=!1),h.operator==="<"||h.operator==="<="){if(l=LY(s,h,t),l===h&&l!==s)return!1}else if(s.operator==="<="&&!wd(s.semver,String(h),t))return!1}if(!h.operator&&(s||n)&&o!==0)return!1}return!(n&&c&&!s&&o!==0||s&&u&&!n&&o!==0||f||g)},TY=(r,e,t)=>{if(!r)return e;let i=xv(r.semver,e.semver,t);return i>0?r:i<0||e.operator===">"&&r.operator===">="?e:r},LY=(r,e,t)=>{if(!r)return e;let i=xv(r.semver,e.semver,t);return i<0?r:i>0||e.operator==="<"&&r.operator==="<="?e:r};MY.exports=mEe});var Xr=w((ret,KY)=>{var Pv=uc();KY.exports={re:Pv.re,src:Pv.src,tokens:Pv.t,SEMVER_SPEC_VERSION:gd().SEMVER_SPEC_VERSION,SemVer:Li(),compareIdentifiers:MI().compareIdentifiers,rcompareIdentifiers:MI().rcompareIdentifiers,parse:gc(),valid:lG(),clean:uG(),inc:fG(),diff:EG(),major:yG(),minor:BG(),patch:QG(),prerelease:vG(),compare:cs(),rcompare:PG(),compareLoose:kG(),compareBuild:HI(),sort:TG(),rsort:MG(),gt:dd(),lt:GI(),eq:UI(),neq:Cv(),gte:YI(),lte:jI(),cmp:mv(),coerce:qG(),Comparator:Ed(),Range:us(),satisfies:yd(),toComparators:uY(),maxSatisfying:fY(),minSatisfying:pY(),minVersion:mY(),validRange:IY(),outside:VI(),gtr:SY(),ltr:xY(),intersects:kY(),simplifyRange:FY(),subset:OY()}});var Dv=w(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.VERSION=void 0;ZI.VERSION="9.1.0"});var Gt=w((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i{(function(r,e){typeof define=="function"&&define.amd?define([],e):typeof _I=="object"&&_I.exports?_I.exports=e():r.regexpToAst=e()})(typeof self<"u"?self:UY,function(){function r(){}r.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},r.prototype.restoreState=function(p){this.idx=p.idx,this.input=p.input,this.groupIdx=p.groupIdx},r.prototype.pattern=function(p){this.idx=0,this.input=p,this.groupIdx=0,this.consumeChar("/");var C=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:p.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":o(y,"global");break;case"i":o(y,"ignoreCase");break;case"m":o(y,"multiLine");break;case"u":o(y,"unicode");break;case"y":o(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:C,loc:this.loc(0)}},r.prototype.disjunction=function(){var p=[],C=this.idx;for(p.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),p.push(this.alternative());return{type:"Disjunction",value:p,loc:this.loc(C)}},r.prototype.alternative=function(){for(var p=[],C=this.idx;this.isTerm();)p.push(this.term());return{type:"Alternative",value:p,loc:this.loc(C)}},r.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},r.prototype.assertion=function(){var p=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(p)};case"$":return{type:"EndAnchor",loc:this.loc(p)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(p)};case"B":return{type:"NonWordBoundary",loc:this.loc(p)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var C;switch(this.popChar()){case"=":C="Lookahead";break;case"!":C="NegativeLookahead";break}a(C);var y=this.disjunction();return this.consumeChar(")"),{type:C,value:y,loc:this.loc(p)}}l()},r.prototype.quantifier=function(p){var C,y=this.idx;switch(this.popChar()){case"*":C={atLeast:0,atMost:1/0};break;case"+":C={atLeast:1,atMost:1/0};break;case"?":C={atLeast:0,atMost:1};break;case"{":var B=this.integerIncludingZero();switch(this.popChar()){case"}":C={atLeast:B,atMost:B};break;case",":var v;this.isDigit()?(v=this.integerIncludingZero(),C={atLeast:B,atMost:v}):C={atLeast:B,atMost:1/0},this.consumeChar("}");break}if(p===!0&&C===void 0)return;a(C);break}if(!(p===!0&&C===void 0))return a(C),this.peekChar(0)==="?"?(this.consumeChar("?"),C.greedy=!1):C.greedy=!0,C.type="Quantifier",C.loc=this.loc(y),C},r.prototype.atom=function(){var p,C=this.idx;switch(this.peekChar()){case".":p=this.dotAll();break;case"\\":p=this.atomEscape();break;case"[":p=this.characterClass();break;case"(":p=this.group();break}return p===void 0&&this.isPatternCharacter()&&(p=this.patternCharacter()),a(p),p.loc=this.loc(C),this.isQuantifier()&&(p.quantifier=this.quantifier()),p},r.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[n(` +`),n("\r"),n("\u2028"),n("\u2029")]}},r.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},r.prototype.decimalEscapeAtom=function(){var p=this.positiveInteger();return{type:"GroupBackReference",value:p}},r.prototype.characterClassEscape=function(){var p,C=!1;switch(this.popChar()){case"d":p=u;break;case"D":p=u,C=!0;break;case"s":p=f;break;case"S":p=f,C=!0;break;case"w":p=g;break;case"W":p=g,C=!0;break}return a(p),{type:"Set",value:p,complement:C}},r.prototype.controlEscapeAtom=function(){var p;switch(this.popChar()){case"f":p=n("\f");break;case"n":p=n(` +`);break;case"r":p=n("\r");break;case"t":p=n(" ");break;case"v":p=n("\v");break}return a(p),{type:"Character",value:p}},r.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var p=this.popChar();if(/[a-zA-Z]/.test(p)===!1)throw Error("Invalid ");var C=p.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:C}},r.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:n("\0")}},r.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},r.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},r.prototype.identityEscapeAtom=function(){var p=this.popChar();return{type:"Character",value:n(p)}},r.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case` +`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var p=this.popChar();return{type:"Character",value:n(p)}}},r.prototype.characterClass=function(){var p=[],C=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),C=!0);this.isClassAtom();){var y=this.classAtom(),B=y.type==="Character";if(B&&this.isRangeDash()){this.consumeChar("-");var v=this.classAtom(),D=v.type==="Character";if(D){if(v.value=this.input.length)throw Error("Unexpected end of input");this.idx++},r.prototype.loc=function(p){return{begin:p,end:this.idx}};var e=/[0-9a-fA-F]/,t=/[0-9]/,i=/[1-9]/;function n(p){return p.charCodeAt(0)}function s(p,C){p.length!==void 0?p.forEach(function(y){C.push(y)}):C.push(p)}function o(p,C){if(p[C]===!0)throw"duplicate flag "+C;p[C]=!0}function a(p){if(p===void 0)throw Error("Internal Error - Should never get here!")}function l(){throw Error("Internal Error - Should never get here!")}var c,u=[];for(c=n("0");c<=n("9");c++)u.push(c);var g=[n("_")].concat(u);for(c=n("a");c<=n("z");c++)g.push(c);for(c=n("A");c<=n("Z");c++)g.push(c);var f=[n(" "),n("\f"),n(` +`),n("\r"),n(" "),n("\v"),n(" "),n("\xA0"),n("\u1680"),n("\u2000"),n("\u2001"),n("\u2002"),n("\u2003"),n("\u2004"),n("\u2005"),n("\u2006"),n("\u2007"),n("\u2008"),n("\u2009"),n("\u200A"),n("\u2028"),n("\u2029"),n("\u202F"),n("\u205F"),n("\u3000"),n("\uFEFF")];function h(){}return h.prototype.visitChildren=function(p){for(var C in p){var y=p[C];p.hasOwnProperty(C)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(B){this.visit(B)},this))}},h.prototype.visit=function(p){switch(p.type){case"Pattern":this.visitPattern(p);break;case"Flags":this.visitFlags(p);break;case"Disjunction":this.visitDisjunction(p);break;case"Alternative":this.visitAlternative(p);break;case"StartAnchor":this.visitStartAnchor(p);break;case"EndAnchor":this.visitEndAnchor(p);break;case"WordBoundary":this.visitWordBoundary(p);break;case"NonWordBoundary":this.visitNonWordBoundary(p);break;case"Lookahead":this.visitLookahead(p);break;case"NegativeLookahead":this.visitNegativeLookahead(p);break;case"Character":this.visitCharacter(p);break;case"Set":this.visitSet(p);break;case"Group":this.visitGroup(p);break;case"GroupBackReference":this.visitGroupBackReference(p);break;case"Quantifier":this.visitQuantifier(p);break}this.visitChildren(p)},h.prototype.visitPattern=function(p){},h.prototype.visitFlags=function(p){},h.prototype.visitDisjunction=function(p){},h.prototype.visitAlternative=function(p){},h.prototype.visitStartAnchor=function(p){},h.prototype.visitEndAnchor=function(p){},h.prototype.visitWordBoundary=function(p){},h.prototype.visitNonWordBoundary=function(p){},h.prototype.visitLookahead=function(p){},h.prototype.visitNegativeLookahead=function(p){},h.prototype.visitCharacter=function(p){},h.prototype.visitSet=function(p){},h.prototype.visitGroup=function(p){},h.prototype.visitGroupBackReference=function(p){},h.prototype.visitQuantifier=function(p){},{RegExpParser:r,BaseRegExpVisitor:h,VERSION:"0.5.0"}})});var ty=w(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});Xg.clearRegExpParserCache=Xg.getRegExpAst=void 0;var IEe=$I(),ey={},yEe=new IEe.RegExpParser;function wEe(r){var e=r.toString();if(ey.hasOwnProperty(e))return ey[e];var t=yEe.pattern(e);return ey[e]=t,t}Xg.getRegExpAst=wEe;function BEe(){ey={}}Xg.clearRegExpParserCache=BEe});var qY=w(Cn=>{"use strict";var bEe=Cn&&Cn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.canMatchCharCode=Cn.firstCharOptimizedIndices=Cn.getOptimizedStartCodesIndices=Cn.failedOptimizationPrefixMsg=void 0;var GY=$I(),gs=Gt(),YY=ty(),xa=Rv(),jY="Complement Sets are not supported for first char optimization";Cn.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations: +`;function QEe(r,e){e===void 0&&(e=!1);try{var t=(0,YY.getRegExpAst)(r),i=iy(t.value,{},t.flags.ignoreCase);return i}catch(s){if(s.message===jY)e&&(0,gs.PRINT_WARNING)(""+Cn.failedOptimizationPrefixMsg+(" Unable to optimize: < "+r.toString()+` > +`)+` Complement Sets cannot be automatically optimized. + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var n="";e&&(n=` + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),(0,gs.PRINT_ERROR)(Cn.failedOptimizationPrefixMsg+` +`+(" Failed parsing: < "+r.toString()+` > +`)+(" Using the regexp-to-ast library version: "+GY.VERSION+` +`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]}Cn.getOptimizedStartCodesIndices=QEe;function iy(r,e,t){switch(r.type){case"Disjunction":for(var i=0;i=xa.minOptimizationVal)for(var f=u.from>=xa.minOptimizationVal?u.from:xa.minOptimizationVal,h=u.to,p=(0,xa.charCodeToOptimizedIndex)(f),C=(0,xa.charCodeToOptimizedIndex)(h),y=p;y<=C;y++)e[y]=y}}});break;case"Group":iy(o.value,e,t);break;default:throw Error("Non Exhaustive Match")}var a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&kv(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return(0,gs.values)(e)}Cn.firstCharOptimizedIndices=iy;function ry(r,e,t){var i=(0,xa.charCodeToOptimizedIndex)(r);e[i]=i,t===!0&&SEe(r,e)}function SEe(r,e){var t=String.fromCharCode(r),i=t.toUpperCase();if(i!==t){var n=(0,xa.charCodeToOptimizedIndex)(i.charCodeAt(0));e[n]=n}else{var s=t.toLowerCase();if(s!==t){var n=(0,xa.charCodeToOptimizedIndex)(s.charCodeAt(0));e[n]=n}}}function HY(r,e){return(0,gs.find)(r.value,function(t){if(typeof t=="number")return(0,gs.contains)(e,t);var i=t;return(0,gs.find)(e,function(n){return i.from<=n&&n<=i.to})!==void 0})}function kv(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,gs.isArray)(r.value)?(0,gs.every)(r.value,kv):kv(r.value):!1}var vEe=function(r){bEe(e,r);function e(t){var i=r.call(this)||this;return i.targetCharCodes=t,i.found=!1,i}return e.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}r.prototype.visitChildren.call(this,t)}},e.prototype.visitCharacter=function(t){(0,gs.contains)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?HY(t,this.targetCharCodes)===void 0&&(this.found=!0):HY(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(GY.BaseRegExpVisitor);function xEe(r,e){if(e instanceof RegExp){var t=(0,YY.getRegExpAst)(e),i=new vEe(r);return i.visit(t),i.found}else return(0,gs.find)(e,function(n){return(0,gs.contains)(r,n.charCodeAt(0))})!==void 0}Cn.canMatchCharCode=xEe});var Rv=w(Ve=>{"use strict";var JY=Ve&&Ve.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.charCodeToOptimizedIndex=Ve.minOptimizationVal=Ve.buildLineBreakIssueMessage=Ve.LineTerminatorOptimizedTester=Ve.isShortPattern=Ve.isCustomPattern=Ve.cloneEmptyGroups=Ve.performWarningRuntimeChecks=Ve.performRuntimeChecks=Ve.addStickyFlag=Ve.addStartOfInput=Ve.findUnreachablePatterns=Ve.findModesThatDoNotExist=Ve.findInvalidGroupType=Ve.findDuplicatePatterns=Ve.findUnsupportedFlags=Ve.findStartOfInputAnchor=Ve.findEmptyMatchRegExps=Ve.findEndOfInputAnchor=Ve.findInvalidPatterns=Ve.findMissingPatterns=Ve.validatePatterns=Ve.analyzeTokenTypes=Ve.enableSticky=Ve.disableSticky=Ve.SUPPORT_STICKY=Ve.MODES=Ve.DEFAULT_MODE=void 0;var WY=$I(),ir=Bd(),xe=Gt(),Zg=qY(),zY=ty(),ko="PATTERN";Ve.DEFAULT_MODE="defaultMode";Ve.MODES="modes";Ve.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function PEe(){Ve.SUPPORT_STICKY=!1}Ve.disableSticky=PEe;function DEe(){Ve.SUPPORT_STICKY=!0}Ve.enableSticky=DEe;function kEe(r,e){e=(0,xe.defaults)(e,{useSticky:Ve.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` +`],tracer:function(v,D){return D()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){HEe()});var i;t("Reject Lexer.NA",function(){i=(0,xe.reject)(r,function(v){return v[ko]===ir.Lexer.NA})});var n=!1,s;t("Transform Patterns",function(){n=!1,s=(0,xe.map)(i,function(v){var D=v[ko];if((0,xe.isRegExp)(D)){var T=D.source;return T.length===1&&T!=="^"&&T!=="$"&&T!=="."&&!D.ignoreCase?T:T.length===2&&T[0]==="\\"&&!(0,xe.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],T[1])?T[1]:e.useSticky?Tv(D):Nv(D)}else{if((0,xe.isFunction)(D))return n=!0,{exec:D};if((0,xe.has)(D,"exec"))return n=!0,D;if(typeof D=="string"){if(D.length===1)return D;var H=D.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),j=new RegExp(H);return e.useSticky?Tv(j):Nv(j)}else throw Error("non exhaustive match")}})});var o,a,l,c,u;t("misc mapping",function(){o=(0,xe.map)(i,function(v){return v.tokenTypeIdx}),a=(0,xe.map)(i,function(v){var D=v.GROUP;if(D!==ir.Lexer.SKIPPED){if((0,xe.isString)(D))return D;if((0,xe.isUndefined)(D))return!1;throw Error("non exhaustive match")}}),l=(0,xe.map)(i,function(v){var D=v.LONGER_ALT;if(D){var T=(0,xe.isArray)(D)?(0,xe.map)(D,function(H){return(0,xe.indexOf)(i,H)}):[(0,xe.indexOf)(i,D)];return T}}),c=(0,xe.map)(i,function(v){return v.PUSH_MODE}),u=(0,xe.map)(i,function(v){return(0,xe.has)(v,"POP_MODE")})});var g;t("Line Terminator Handling",function(){var v=Aj(e.lineTerminatorCharacters);g=(0,xe.map)(i,function(D){return!1}),e.positionTracking!=="onlyOffset"&&(g=(0,xe.map)(i,function(D){if((0,xe.has)(D,"LINE_BREAKS"))return D.LINE_BREAKS;if(oj(D,v)===!1)return(0,Zg.canMatchCharCode)(v,D.PATTERN)}))});var f,h,p,C;t("Misc Mapping #2",function(){f=(0,xe.map)(i,Mv),h=(0,xe.map)(s,sj),p=(0,xe.reduce)(i,function(v,D){var T=D.GROUP;return(0,xe.isString)(T)&&T!==ir.Lexer.SKIPPED&&(v[T]=[]),v},{}),C=(0,xe.map)(s,function(v,D){return{pattern:s[D],longerAlt:l[D],canLineTerminator:g[D],isCustom:f[D],short:h[D],group:a[D],push:c[D],pop:u[D],tokenTypeIdx:o[D],tokenType:i[D]}})});var y=!0,B=[];return e.safeMode||t("First Char Optimization",function(){B=(0,xe.reduce)(i,function(v,D,T){if(typeof D.PATTERN=="string"){var H=D.PATTERN.charCodeAt(0),j=Lv(H);Fv(v,j,C[T])}else if((0,xe.isArray)(D.START_CHARS_HINT)){var $;(0,xe.forEach)(D.START_CHARS_HINT,function(W){var _=typeof W=="string"?W.charCodeAt(0):W,A=Lv(_);$!==A&&($=A,Fv(v,A,C[T]))})}else if((0,xe.isRegExp)(D.PATTERN))if(D.PATTERN.unicode)y=!1,e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+Zg.failedOptimizationPrefixMsg+(" Unable to analyze < "+D.PATTERN.toString()+` > pattern. +`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var V=(0,Zg.getOptimizedStartCodesIndices)(D.PATTERN,e.ensureOptimizations);(0,xe.isEmpty)(V)&&(y=!1),(0,xe.forEach)(V,function(W){Fv(v,W,C[T])})}else e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+Zg.failedOptimizationPrefixMsg+(" TokenType: <"+D.name+`> is using a custom token pattern without providing parameter. +`)+` This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return v},[])}),t("ArrayPacking",function(){B=(0,xe.packArray)(B)}),{emptyGroups:p,patternIdxToConfig:C,charCodeToPatternIdxToConfig:B,hasCustom:n,canBeOptimized:y}}Ve.analyzeTokenTypes=kEe;function REe(r,e){var t=[],i=VY(r);t=t.concat(i.errors);var n=XY(i.valid),s=n.valid;return t=t.concat(n.errors),t=t.concat(FEe(s)),t=t.concat(rj(s)),t=t.concat(ij(s,e)),t=t.concat(nj(s)),t}Ve.validatePatterns=REe;function FEe(r){var e=[],t=(0,xe.filter)(r,function(i){return(0,xe.isRegExp)(i[ko])});return e=e.concat(ZY(t)),e=e.concat($Y(t)),e=e.concat(ej(t)),e=e.concat(tj(t)),e=e.concat(_Y(t)),e}function VY(r){var e=(0,xe.filter)(r,function(n){return!(0,xe.has)(n,ko)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- missing static 'PATTERN' property",type:ir.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findMissingPatterns=VY;function XY(r){var e=(0,xe.filter)(r,function(n){var s=n[ko];return!(0,xe.isRegExp)(s)&&!(0,xe.isFunction)(s)&&!(0,xe.has)(s,"exec")&&!(0,xe.isString)(s)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ir.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findInvalidPatterns=XY;var NEe=/[^\\][\$]/;function ZY(r){var e=function(n){JY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitEndAnchor=function(o){this.found=!0},s}(WY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[ko];try{var o=(0,zY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return NEe.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error: + Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$' + See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findEndOfInputAnchor=ZY;function _Y(r){var e=(0,xe.filter)(r,function(i){var n=i[ko];return n.test("")}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:ir.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[i]}});return t}Ve.findEmptyMatchRegExps=_Y;var TEe=/[^\\[][\^]|^\^/;function $Y(r){var e=function(n){JY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitStartAnchor=function(o){this.found=!0},s}(WY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[ko];try{var o=(0,zY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return TEe.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error: + Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^' + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findStartOfInputAnchor=$Y;function ej(r){var e=(0,xe.filter)(r,function(i){var n=i[ko];return n instanceof RegExp&&(n.multiline||n.global)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ir.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}});return t}Ve.findUnsupportedFlags=ej;function tj(r){var e=[],t=(0,xe.map)(r,function(s){return(0,xe.reduce)(r,function(o,a){return s.PATTERN.source===a.PATTERN.source&&!(0,xe.contains)(e,a)&&a.PATTERN!==ir.Lexer.NA&&(e.push(a),o.push(a)),o},[])});t=(0,xe.compact)(t);var i=(0,xe.filter)(t,function(s){return s.length>1}),n=(0,xe.map)(i,function(s){var o=(0,xe.map)(s,function(l){return l.name}),a=(0,xe.first)(s).PATTERN;return{message:"The same RegExp pattern ->"+a+"<-"+("has been used in all of the following Token Types: "+o.join(", ")+" <-"),type:ir.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}});return n}Ve.findDuplicatePatterns=tj;function rj(r){var e=(0,xe.filter)(r,function(i){if(!(0,xe.has)(i,"GROUP"))return!1;var n=i.GROUP;return n!==ir.Lexer.SKIPPED&&n!==ir.Lexer.NA&&!(0,xe.isString)(n)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ir.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}});return t}Ve.findInvalidGroupType=rj;function ij(r,e){var t=(0,xe.filter)(r,function(n){return n.PUSH_MODE!==void 0&&!(0,xe.contains)(e,n.PUSH_MODE)}),i=(0,xe.map)(t,function(n){var s="Token Type: ->"+n.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+n.PUSH_MODE+"<-which does not exist";return{message:s,type:ir.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}});return i}Ve.findModesThatDoNotExist=ij;function nj(r){var e=[],t=(0,xe.reduce)(r,function(i,n,s){var o=n.PATTERN;return o===ir.Lexer.NA||((0,xe.isString)(o)?i.push({str:o,idx:s,tokenType:n}):(0,xe.isRegExp)(o)&&MEe(o)&&i.push({str:o.source,idx:s,tokenType:n})),i},[]);return(0,xe.forEach)(r,function(i,n){(0,xe.forEach)(t,function(s){var o=s.str,a=s.idx,l=s.tokenType;if(n"+i.name+"<-")+`in the lexer's definition. +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ir.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[i,l]})}})}),e}Ve.findUnreachablePatterns=nj;function LEe(r,e){if((0,xe.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,xe.isFunction)(e))return e(r,0,[],{});if((0,xe.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function MEe(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,xe.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function Nv(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}Ve.addStartOfInput=Nv;function Tv(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}Ve.addStickyFlag=Tv;function OEe(r,e,t){var i=[];return(0,xe.has)(r,Ve.DEFAULT_MODE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.DEFAULT_MODE+`> property in its definition +`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,xe.has)(r,Ve.MODES)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.MODES+`> property in its definition +`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,xe.has)(r,Ve.MODES)&&(0,xe.has)(r,Ve.DEFAULT_MODE)&&!(0,xe.has)(r.modes,r.defaultMode)&&i.push({message:"A MultiMode Lexer cannot be initialized with a "+Ve.DEFAULT_MODE+": <"+r.defaultMode+`>which does not exist +`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,xe.has)(r,Ve.MODES)&&(0,xe.forEach)(r.modes,function(n,s){(0,xe.forEach)(n,function(o,a){(0,xe.isUndefined)(o)&&i.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+s+"> at index: <"+a+`> +`),type:ir.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),i}Ve.performRuntimeChecks=OEe;function KEe(r,e,t){var i=[],n=!1,s=(0,xe.compact)((0,xe.flatten)((0,xe.mapValues)(r.modes,function(l){return l}))),o=(0,xe.reject)(s,function(l){return l[ko]===ir.Lexer.NA}),a=Aj(t);return e&&(0,xe.forEach)(o,function(l){var c=oj(l,a);if(c!==!1){var u=aj(l,c),g={message:u,type:c.issue,tokenType:l};i.push(g)}else(0,xe.has)(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(n=!0):(0,Zg.canMatchCharCode)(a,l.PATTERN)&&(n=!0)}),e&&!n&&i.push({message:`Warning: No LINE_BREAKS Found. + This Lexer has been defined to track line and column information, + But none of the Token Types can be identified as matching a line terminator. + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS + for details.`,type:ir.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),i}Ve.performWarningRuntimeChecks=KEe;function UEe(r){var e={},t=(0,xe.keys)(r);return(0,xe.forEach)(t,function(i){var n=r[i];if((0,xe.isArray)(n))e[i]=[];else throw Error("non exhaustive match")}),e}Ve.cloneEmptyGroups=UEe;function Mv(r){var e=r.PATTERN;if((0,xe.isRegExp)(e))return!1;if((0,xe.isFunction)(e))return!0;if((0,xe.has)(e,"exec"))return!0;if((0,xe.isString)(e))return!1;throw Error("non exhaustive match")}Ve.isCustomPattern=Mv;function sj(r){return(0,xe.isString)(r)&&r.length===1?r.charCodeAt(0):!1}Ve.isShortPattern=sj;Ve.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t Token Type +`)+(" Root cause: "+e.errMsg+`. +`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===ir.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. +`+(" The problem is in the <"+r.name+`> Token Type +`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}Ve.buildLineBreakIssueMessage=aj;function Aj(r){var e=(0,xe.map)(r,function(t){return(0,xe.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function Fv(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}Ve.minOptimizationVal=256;var ny=[];function Lv(r){return r255?255+~~(r/255):r}}});var _g=w(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.isTokenType=Nt.hasExtendingTokensTypesMapProperty=Nt.hasExtendingTokensTypesProperty=Nt.hasCategoriesProperty=Nt.hasShortKeyProperty=Nt.singleAssignCategoriesToksMap=Nt.assignCategoriesMapProp=Nt.assignCategoriesTokensProp=Nt.assignTokenDefaultProps=Nt.expandCategories=Nt.augmentTokenTypes=Nt.tokenIdxToClass=Nt.tokenShortNameIdx=Nt.tokenStructuredMatcherNoCategories=Nt.tokenStructuredMatcher=void 0;var Zr=Gt();function GEe(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}Nt.tokenStructuredMatcher=GEe;function YEe(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}Nt.tokenStructuredMatcherNoCategories=YEe;Nt.tokenShortNameIdx=1;Nt.tokenIdxToClass={};function jEe(r){var e=lj(r);cj(e),gj(e),uj(e),(0,Zr.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}Nt.augmentTokenTypes=jEe;function lj(r){for(var e=(0,Zr.cloneArr)(r),t=r,i=!0;i;){t=(0,Zr.compact)((0,Zr.flatten)((0,Zr.map)(t,function(s){return s.CATEGORIES})));var n=(0,Zr.difference)(t,e);e=e.concat(n),(0,Zr.isEmpty)(n)?i=!1:t=n}return e}Nt.expandCategories=lj;function cj(r){(0,Zr.forEach)(r,function(e){fj(e)||(Nt.tokenIdxToClass[Nt.tokenShortNameIdx]=e,e.tokenTypeIdx=Nt.tokenShortNameIdx++),Ov(e)&&!(0,Zr.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ov(e)||(e.CATEGORIES=[]),hj(e)||(e.categoryMatches=[]),pj(e)||(e.categoryMatchesMap={})})}Nt.assignTokenDefaultProps=cj;function uj(r){(0,Zr.forEach)(r,function(e){e.categoryMatches=[],(0,Zr.forEach)(e.categoryMatchesMap,function(t,i){e.categoryMatches.push(Nt.tokenIdxToClass[i].tokenTypeIdx)})})}Nt.assignCategoriesTokensProp=uj;function gj(r){(0,Zr.forEach)(r,function(e){Kv([],e)})}Nt.assignCategoriesMapProp=gj;function Kv(r,e){(0,Zr.forEach)(r,function(t){e.categoryMatchesMap[t.tokenTypeIdx]=!0}),(0,Zr.forEach)(e.CATEGORIES,function(t){var i=r.concat(e);(0,Zr.contains)(i,t)||Kv(i,t)})}Nt.singleAssignCategoriesToksMap=Kv;function fj(r){return(0,Zr.has)(r,"tokenTypeIdx")}Nt.hasShortKeyProperty=fj;function Ov(r){return(0,Zr.has)(r,"CATEGORIES")}Nt.hasCategoriesProperty=Ov;function hj(r){return(0,Zr.has)(r,"categoryMatches")}Nt.hasExtendingTokensTypesProperty=hj;function pj(r){return(0,Zr.has)(r,"categoryMatchesMap")}Nt.hasExtendingTokensTypesMapProperty=pj;function qEe(r){return(0,Zr.has)(r,"tokenTypeIdx")}Nt.isTokenType=qEe});var Uv=w(sy=>{"use strict";Object.defineProperty(sy,"__esModule",{value:!0});sy.defaultLexerErrorProvider=void 0;sy.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(r){return"Unable to pop Lexer Mode after encountering Token ->"+r.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(r,e,t,i,n){return"unexpected character: ->"+r.charAt(e)+"<- at offset: "+e+","+(" skipped "+t+" characters.")}}});var Bd=w(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.Lexer=Cc.LexerDefinitionErrorType=void 0;var _s=Rv(),nr=Gt(),JEe=_g(),WEe=Uv(),zEe=ty(),VEe;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(VEe=Cc.LexerDefinitionErrorType||(Cc.LexerDefinitionErrorType={}));var bd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` +`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:WEe.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(bd);var XEe=function(){function r(e,t){var i=this;if(t===void 0&&(t=bd),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. +a boolean 2nd argument is no longer supported`);this.config=(0,nr.merge)(bd,t);var n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var s,o=!0;i.TRACE_INIT("Lexer Config handling",function(){if(i.config.lineTerminatorsPattern===bd.lineTerminatorsPattern)i.config.lineTerminatorsPattern=_s.LineTerminatorOptimizedTester;else if(i.config.lineTerminatorCharacters===bd.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');i.trackStartLines=/full|onlyStart/i.test(i.config.positionTracking),i.trackEndLines=/full/i.test(i.config.positionTracking),(0,nr.isArray)(e)?(s={modes:{}},s.modes[_s.DEFAULT_MODE]=(0,nr.cloneArr)(e),s[_s.DEFAULT_MODE]=_s.DEFAULT_MODE):(o=!1,s=(0,nr.cloneObj)(e))}),i.config.skipValidations===!1&&(i.TRACE_INIT("performRuntimeChecks",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,_s.performRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))}),i.TRACE_INIT("performWarningRuntimeChecks",function(){i.lexerDefinitionWarning=i.lexerDefinitionWarning.concat((0,_s.performWarningRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))})),s.modes=s.modes?s.modes:{},(0,nr.forEach)(s.modes,function(u,g){s.modes[g]=(0,nr.reject)(u,function(f){return(0,nr.isUndefined)(f)})});var a=(0,nr.keys)(s.modes);if((0,nr.forEach)(s.modes,function(u,g){i.TRACE_INIT("Mode: <"+g+"> processing",function(){if(i.modes.push(g),i.config.skipValidations===!1&&i.TRACE_INIT("validatePatterns",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,_s.validatePatterns)(u,a))}),(0,nr.isEmpty)(i.lexerDefinitionErrors)){(0,JEe.augmentTokenTypes)(u);var f;i.TRACE_INIT("analyzeTokenTypes",function(){f=(0,_s.analyzeTokenTypes)(u,{lineTerminatorCharacters:i.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:i.TRACE_INIT.bind(i)})}),i.patternIdxToConfig[g]=f.patternIdxToConfig,i.charCodeToPatternIdxToConfig[g]=f.charCodeToPatternIdxToConfig,i.emptyGroups=(0,nr.merge)(i.emptyGroups,f.emptyGroups),i.hasCustom=f.hasCustom||i.hasCustom,i.canModeBeOptimized[g]=f.canBeOptimized}})}),i.defaultMode=s.defaultMode,!(0,nr.isEmpty)(i.lexerDefinitionErrors)&&!i.config.deferDefinitionErrorsHandling){var l=(0,nr.map)(i.lexerDefinitionErrors,function(u){return u.message}),c=l.join(`----------------------- +`);throw new Error(`Errors detected in definition of Lexer: +`+c)}(0,nr.forEach)(i.lexerDefinitionWarning,function(u){(0,nr.PRINT_WARNING)(u.message)}),i.TRACE_INIT("Choosing sub-methods implementations",function(){if(_s.SUPPORT_STICKY?(i.chopInput=nr.IDENTITY,i.match=i.matchWithTest):(i.updateLastIndex=nr.NOOP,i.match=i.matchWithExec),o&&(i.handleModes=nr.NOOP),i.trackStartLines===!1&&(i.computeNewColumn=nr.IDENTITY),i.trackEndLines===!1&&(i.updateTokenEndLineColumnLocation=nr.NOOP),/full/i.test(i.config.positionTracking))i.createTokenInstance=i.createFullToken;else if(/onlyStart/i.test(i.config.positionTracking))i.createTokenInstance=i.createStartOnlyToken;else if(/onlyOffset/i.test(i.config.positionTracking))i.createTokenInstance=i.createOffsetOnlyToken;else throw Error('Invalid config option: "'+i.config.positionTracking+'"');i.hasCustom?(i.addToken=i.addTokenUsingPush,i.handlePayload=i.handlePayloadWithCustom):(i.addToken=i.addTokenUsingMemberAccess,i.handlePayload=i.handlePayloadNoCustom)}),i.TRACE_INIT("Failed Optimization Warnings",function(){var u=(0,nr.reduce)(i.canModeBeOptimized,function(g,f,h){return f===!1&&g.push(h),g},[]);if(t.ensureOptimizations&&!(0,nr.isEmpty)(u))throw Error("Lexer Modes: < "+u.join(", ")+` > cannot be optimized. + Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. + Or inspect the console log for details on how to resolve these issues.`)}),i.TRACE_INIT("clearRegExpParserCache",function(){(0,zEe.clearRegExpParserCache)()}),i.TRACE_INIT("toFastProperties",function(){(0,nr.toFastProperties)(i)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,nr.isEmpty)(this.lexerDefinitionErrors)){var i=(0,nr.map)(this.lexerDefinitionErrors,function(o){return o.message}),n=i.join(`----------------------- +`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: +`+n)}var s=this.tokenizeInternal(e,t);return s},r.prototype.tokenizeInternal=function(e,t){var i=this,n,s,o,a,l,c,u,g,f,h,p,C,y,B,v,D,T=e,H=T.length,j=0,$=0,V=this.hasCustom?0:Math.floor(e.length/10),W=new Array(V),_=[],A=this.trackStartLines?1:void 0,Ae=this.trackStartLines?1:void 0,ge=(0,_s.cloneEmptyGroups)(this.emptyGroups),re=this.trackStartLines,M=this.config.lineTerminatorsPattern,F=0,ue=[],pe=[],ke=[],Fe=[];Object.freeze(Fe);var Ne=void 0;function oe(){return ue}function le(pr){var Ii=(0,_s.charCodeToOptimizedIndex)(pr),rs=pe[Ii];return rs===void 0?Fe:rs}var Be=function(pr){if(ke.length===1&&pr.tokenType.PUSH_MODE===void 0){var Ii=i.config.errorMessageProvider.buildUnableToPopLexerModeMessage(pr);_.push({offset:pr.startOffset,line:pr.startLine!==void 0?pr.startLine:void 0,column:pr.startColumn!==void 0?pr.startColumn:void 0,length:pr.image.length,message:Ii})}else{ke.pop();var rs=(0,nr.last)(ke);ue=i.patternIdxToConfig[rs],pe=i.charCodeToPatternIdxToConfig[rs],F=ue.length;var fa=i.canModeBeOptimized[rs]&&i.config.safeMode===!1;pe&&fa?Ne=le:Ne=oe}};function fe(pr){ke.push(pr),pe=this.charCodeToPatternIdxToConfig[pr],ue=this.patternIdxToConfig[pr],F=ue.length,F=ue.length;var Ii=this.canModeBeOptimized[pr]&&this.config.safeMode===!1;pe&&Ii?Ne=le:Ne=oe}fe.call(this,t);for(var ae;jc.length){c=a,u=g,ae=_e;break}}}break}}if(c!==null){if(f=c.length,h=ae.group,h!==void 0&&(p=ae.tokenTypeIdx,C=this.createTokenInstance(c,j,p,ae.tokenType,A,Ae,f),this.handlePayload(C,u),h===!1?$=this.addToken(W,$,C):ge[h].push(C)),e=this.chopInput(e,f),j=j+f,Ae=this.computeNewColumn(Ae,f),re===!0&&ae.canLineTerminator===!0){var It=0,Mr=void 0,ii=void 0;M.lastIndex=0;do Mr=M.test(c),Mr===!0&&(ii=M.lastIndex-1,It++);while(Mr===!0);It!==0&&(A=A+It,Ae=f-ii,this.updateTokenEndLineColumnLocation(C,h,ii,It,A,Ae,f))}this.handleModes(ae,Be,fe,C)}else{for(var gi=j,hr=A,fi=Ae,ni=!1;!ni&&j <"+e+">");var n=(0,nr.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",r.NA=/NOT_APPLICABLE/,r}();Cc.Lexer=XEe});var TA=w(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.tokenMatcher=Qi.createTokenInstance=Qi.EOF=Qi.createToken=Qi.hasTokenLabel=Qi.tokenName=Qi.tokenLabel=void 0;var $s=Gt(),ZEe=Bd(),Hv=_g();function _Ee(r){return bj(r)?r.LABEL:r.name}Qi.tokenLabel=_Ee;function $Ee(r){return r.name}Qi.tokenName=$Ee;function bj(r){return(0,$s.isString)(r.LABEL)&&r.LABEL!==""}Qi.hasTokenLabel=bj;var eIe="parent",dj="categories",Cj="label",mj="group",Ej="push_mode",Ij="pop_mode",yj="longer_alt",wj="line_breaks",Bj="start_chars_hint";function Qj(r){return tIe(r)}Qi.createToken=Qj;function tIe(r){var e=r.pattern,t={};if(t.name=r.name,(0,$s.isUndefined)(e)||(t.PATTERN=e),(0,$s.has)(r,eIe))throw`The parent property is no longer supported. +See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,$s.has)(r,dj)&&(t.CATEGORIES=r[dj]),(0,Hv.augmentTokenTypes)([t]),(0,$s.has)(r,Cj)&&(t.LABEL=r[Cj]),(0,$s.has)(r,mj)&&(t.GROUP=r[mj]),(0,$s.has)(r,Ij)&&(t.POP_MODE=r[Ij]),(0,$s.has)(r,Ej)&&(t.PUSH_MODE=r[Ej]),(0,$s.has)(r,yj)&&(t.LONGER_ALT=r[yj]),(0,$s.has)(r,wj)&&(t.LINE_BREAKS=r[wj]),(0,$s.has)(r,Bj)&&(t.START_CHARS_HINT=r[Bj]),t}Qi.EOF=Qj({name:"EOF",pattern:ZEe.Lexer.NA});(0,Hv.augmentTokenTypes)([Qi.EOF]);function rIe(r,e,t,i,n,s,o,a){return{image:e,startOffset:t,endOffset:i,startLine:n,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}Qi.createTokenInstance=rIe;function iIe(r,e){return(0,Hv.tokenStructuredMatcher)(r,e)}Qi.tokenMatcher=iIe});var mn=w(zt=>{"use strict";var Pa=zt&&zt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(zt,"__esModule",{value:!0});zt.serializeProduction=zt.serializeGrammar=zt.Terminal=zt.Alternation=zt.RepetitionWithSeparator=zt.Repetition=zt.RepetitionMandatoryWithSeparator=zt.RepetitionMandatory=zt.Option=zt.Alternative=zt.Rule=zt.NonTerminal=zt.AbstractProduction=void 0;var Ar=Gt(),nIe=TA(),Ro=function(){function r(e){this._definition=e}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this),(0,Ar.forEach)(this.definition,function(t){t.accept(e)})},r}();zt.AbstractProduction=Ro;var Sj=function(r){Pa(e,r);function e(t){var i=r.call(this,[])||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(Ro);zt.NonTerminal=Sj;var vj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.orgText="",(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.Rule=vj;var xj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.ignoreAmbiguities=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.Alternative=xj;var Pj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.Option=Pj;var Dj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.RepetitionMandatory=Dj;var kj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.RepetitionMandatoryWithSeparator=kj;var Rj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.Repetition=Rj;var Fj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(Ro);zt.RepetitionWithSeparator=Fj;var Nj=function(r){Pa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,i.ignoreAmbiguities=!1,i.hasPredicates=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(Ro);zt.Alternation=Nj;var oy=function(){function r(e){this.idx=1,(0,Ar.assign)(this,(0,Ar.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();zt.Terminal=oy;function sIe(r){return(0,Ar.map)(r,Qd)}zt.serializeGrammar=sIe;function Qd(r){function e(s){return(0,Ar.map)(s,Qd)}if(r instanceof Sj){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,Ar.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof xj)return{type:"Alternative",definition:e(r.definition)};if(r instanceof Pj)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof Dj)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof kj)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:Qd(new oy({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof Fj)return{type:"RepetitionWithSeparator",idx:r.idx,separator:Qd(new oy({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof Rj)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof Nj)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof oy){var i={type:"Terminal",name:r.terminalType.name,label:(0,nIe.tokenLabel)(r.terminalType),idx:r.idx};(0,Ar.isString)(r.label)&&(i.terminalLabel=r.label);var n=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(i.pattern=(0,Ar.isRegExp)(n)?n.source:n),i}else{if(r instanceof vj)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}zt.serializeProduction=Qd});var Ay=w(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.RestWalker=void 0;var Gv=Gt(),En=mn(),oIe=function(){function r(){}return r.prototype.walk=function(e,t){var i=this;t===void 0&&(t=[]),(0,Gv.forEach)(e.definition,function(n,s){var o=(0,Gv.drop)(e.definition,s+1);if(n instanceof En.NonTerminal)i.walkProdRef(n,o,t);else if(n instanceof En.Terminal)i.walkTerminal(n,o,t);else if(n instanceof En.Alternative)i.walkFlat(n,o,t);else if(n instanceof En.Option)i.walkOption(n,o,t);else if(n instanceof En.RepetitionMandatory)i.walkAtLeastOne(n,o,t);else if(n instanceof En.RepetitionMandatoryWithSeparator)i.walkAtLeastOneSep(n,o,t);else if(n instanceof En.RepetitionWithSeparator)i.walkManySep(n,o,t);else if(n instanceof En.Repetition)i.walkMany(n,o,t);else if(n instanceof En.Alternation)i.walkOr(n,o,t);else throw Error("non exhaustive match")})},r.prototype.walkTerminal=function(e,t,i){},r.prototype.walkProdRef=function(e,t,i){},r.prototype.walkFlat=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkOption=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkAtLeastOne=function(e,t,i){var n=[new En.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkAtLeastOneSep=function(e,t,i){var n=Tj(e,t,i);this.walk(e,n)},r.prototype.walkMany=function(e,t,i){var n=[new En.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkManySep=function(e,t,i){var n=Tj(e,t,i);this.walk(e,n)},r.prototype.walkOr=function(e,t,i){var n=this,s=t.concat(i);(0,Gv.forEach)(e.definition,function(o){var a=new En.Alternative({definition:[o]});n.walk(a,s)})},r}();ay.RestWalker=oIe;function Tj(r,e,t){var i=[new En.Option({definition:[new En.Terminal({terminalType:r.separator})].concat(r.definition)})],n=i.concat(e,t);return n}});var $g=w(ly=>{"use strict";Object.defineProperty(ly,"__esModule",{value:!0});ly.GAstVisitor=void 0;var Fo=mn(),aIe=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case Fo.NonTerminal:return this.visitNonTerminal(t);case Fo.Alternative:return this.visitAlternative(t);case Fo.Option:return this.visitOption(t);case Fo.RepetitionMandatory:return this.visitRepetitionMandatory(t);case Fo.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case Fo.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case Fo.Repetition:return this.visitRepetition(t);case Fo.Alternation:return this.visitAlternation(t);case Fo.Terminal:return this.visitTerminal(t);case Fo.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(e){},r.prototype.visitAlternative=function(e){},r.prototype.visitOption=function(e){},r.prototype.visitRepetition=function(e){},r.prototype.visitRepetitionMandatory=function(e){},r.prototype.visitRepetitionMandatoryWithSeparator=function(e){},r.prototype.visitRepetitionWithSeparator=function(e){},r.prototype.visitAlternation=function(e){},r.prototype.visitTerminal=function(e){},r.prototype.visitRule=function(e){},r}();ly.GAstVisitor=aIe});var vd=w(Oi=>{"use strict";var AIe=Oi&&Oi.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Oi,"__esModule",{value:!0});Oi.collectMethods=Oi.DslMethodsCollectorVisitor=Oi.getProductionDslName=Oi.isBranchingProd=Oi.isOptionalProd=Oi.isSequenceProd=void 0;var Sd=Gt(),br=mn(),lIe=$g();function cIe(r){return r instanceof br.Alternative||r instanceof br.Option||r instanceof br.Repetition||r instanceof br.RepetitionMandatory||r instanceof br.RepetitionMandatoryWithSeparator||r instanceof br.RepetitionWithSeparator||r instanceof br.Terminal||r instanceof br.Rule}Oi.isSequenceProd=cIe;function Yv(r,e){e===void 0&&(e=[]);var t=r instanceof br.Option||r instanceof br.Repetition||r instanceof br.RepetitionWithSeparator;return t?!0:r instanceof br.Alternation?(0,Sd.some)(r.definition,function(i){return Yv(i,e)}):r instanceof br.NonTerminal&&(0,Sd.contains)(e,r)?!1:r instanceof br.AbstractProduction?(r instanceof br.NonTerminal&&e.push(r),(0,Sd.every)(r.definition,function(i){return Yv(i,e)})):!1}Oi.isOptionalProd=Yv;function uIe(r){return r instanceof br.Alternation}Oi.isBranchingProd=uIe;function gIe(r){if(r instanceof br.NonTerminal)return"SUBRULE";if(r instanceof br.Option)return"OPTION";if(r instanceof br.Alternation)return"OR";if(r instanceof br.RepetitionMandatory)return"AT_LEAST_ONE";if(r instanceof br.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(r instanceof br.RepetitionWithSeparator)return"MANY_SEP";if(r instanceof br.Repetition)return"MANY";if(r instanceof br.Terminal)return"CONSUME";throw Error("non exhaustive match")}Oi.getProductionDslName=gIe;var Lj=function(r){AIe(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var i=t.terminalType.name+this.separator+"Terminal";(0,Sd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitNonTerminal=function(t){var i=t.nonTerminalName+this.separator+"Terminal";(0,Sd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(lIe.GAstVisitor);Oi.DslMethodsCollectorVisitor=Lj;var cy=new Lj;function fIe(r){cy.reset(),r.accept(cy);var e=cy.dslMethods;return cy.reset(),e}Oi.collectMethods=fIe});var qv=w(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.firstForTerminal=No.firstForBranching=No.firstForSequence=No.first=void 0;var uy=Gt(),Mj=mn(),jv=vd();function gy(r){if(r instanceof Mj.NonTerminal)return gy(r.referencedRule);if(r instanceof Mj.Terminal)return Uj(r);if((0,jv.isSequenceProd)(r))return Oj(r);if((0,jv.isBranchingProd)(r))return Kj(r);throw Error("non exhaustive match")}No.first=gy;function Oj(r){for(var e=[],t=r.definition,i=0,n=t.length>i,s,o=!0;n&&o;)s=t[i],o=(0,jv.isOptionalProd)(s),e=e.concat(gy(s)),i=i+1,n=t.length>i;return(0,uy.uniq)(e)}No.firstForSequence=Oj;function Kj(r){var e=(0,uy.map)(r.definition,function(t){return gy(t)});return(0,uy.uniq)((0,uy.flatten)(e))}No.firstForBranching=Kj;function Uj(r){return[r.terminalType]}No.firstForTerminal=Uj});var Jv=w(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});fy.IN=void 0;fy.IN="_~IN~_"});var qj=w(fs=>{"use strict";var hIe=fs&&fs.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(fs,"__esModule",{value:!0});fs.buildInProdFollowPrefix=fs.buildBetweenProdsFollowPrefix=fs.computeAllProdsFollows=fs.ResyncFollowsWalker=void 0;var pIe=Ay(),dIe=qv(),Hj=Gt(),Gj=Jv(),CIe=mn(),Yj=function(r){hIe(e,r);function e(t){var i=r.call(this)||this;return i.topProd=t,i.follows={},i}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,i,n){},e.prototype.walkProdRef=function(t,i,n){var s=jj(t.referencedRule,t.idx)+this.topProd.name,o=i.concat(n),a=new CIe.Alternative({definition:o}),l=(0,dIe.first)(a);this.follows[s]=l},e}(pIe.RestWalker);fs.ResyncFollowsWalker=Yj;function mIe(r){var e={};return(0,Hj.forEach)(r,function(t){var i=new Yj(t).startWalking();(0,Hj.assign)(e,i)}),e}fs.computeAllProdsFollows=mIe;function jj(r,e){return r.name+e+Gj.IN}fs.buildBetweenProdsFollowPrefix=jj;function EIe(r){var e=r.terminalType.name;return e+r.idx+Gj.IN}fs.buildInProdFollowPrefix=EIe});var xd=w(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.defaultGrammarValidatorErrorProvider=Da.defaultGrammarResolverErrorProvider=Da.defaultParserErrorProvider=void 0;var ef=TA(),IIe=Gt(),eo=Gt(),Wv=mn(),Jj=vd();Da.defaultParserErrorProvider={buildMismatchTokenMessage:function(r){var e=r.expected,t=r.actual,i=r.previous,n=r.ruleName,s=(0,ef.hasTokenLabel)(e),o=s?"--> "+(0,ef.tokenLabel)(e)+" <--":"token of type --> "+e.name+" <--",a="Expecting "+o+" but found --> '"+t.image+"' <--";return a},buildNotAllInputParsedMessage:function(r){var e=r.firstRedundant,t=r.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(r){var e=r.expectedPathsPerAlt,t=r.actual,i=r.previous,n=r.customUserDescription,s=r.ruleName,o="Expecting: ",a=(0,eo.first)(t).image,l=` +but found: '`+a+"'";if(n)return o+n+l;var c=(0,eo.reduce)(e,function(h,p){return h.concat(p)},[]),u=(0,eo.map)(c,function(h){return"["+(0,eo.map)(h,function(p){return(0,ef.tokenLabel)(p)}).join(", ")+"]"}),g=(0,eo.map)(u,function(h,p){return" "+(p+1)+". "+h}),f=`one of these possible Token sequences: +`+g.join(` +`);return o+f+l},buildEarlyExitMessage:function(r){var e=r.expectedIterationPaths,t=r.actual,i=r.customUserDescription,n=r.ruleName,s="Expecting: ",o=(0,eo.first)(t).image,a=` +but found: '`+o+"'";if(i)return s+i+a;var l=(0,eo.map)(e,function(u){return"["+(0,eo.map)(u,function(g){return(0,ef.tokenLabel)(g)}).join(",")+"]"}),c=`expecting at least one iteration which starts with one of these possible Token sequences:: + `+("<"+l.join(" ,")+">");return s+c+a}};Object.freeze(Da.defaultParserErrorProvider);Da.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(r,e){var t="Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- +inside top level rule: ->`+r.name+"<-";return t}};Da.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(u){return u instanceof Wv.Terminal?u.terminalType.name:u instanceof Wv.NonTerminal?u.nonTerminalName:""}var i=r.name,n=(0,eo.first)(e),s=n.idx,o=(0,Jj.getProductionDslName)(n),a=t(n),l=s>0,c="->"+o+(l?s:"")+"<- "+(a?"with argument: ->"+a+"<-":"")+` + appears more than once (`+e.length+" times) in the top level rule: ->"+i+`<-. + For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES + `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,` +`),c},buildNamespaceConflictError:function(r){var e=`Namespace conflict found in grammar. +`+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+r.name+`>. +`)+`To resolve this make sure each Terminal and Non-Terminal names are unique +This is easy to accomplish by using the convention that Terminal names start with an uppercase letter +and Non-Terminal names start with a lower case letter.`;return e},buildAlternationPrefixAmbiguityError:function(r){var e=(0,eo.map)(r.prefixPath,function(n){return(0,ef.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous alternatives: <"+r.ambiguityIndices.join(" ,")+`> due to common lookahead prefix +`+("in inside <"+r.topLevelRule.name+`> Rule, +`)+("<"+e+`> may appears as a prefix path in all these alternatives. +`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX +For Further details.`;return i},buildAlternationAmbiguityError:function(r){var e=(0,eo.map)(r.prefixPath,function(n){return(0,ef.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous Alternatives Detected: <"+r.ambiguityIndices.join(" ,")+"> in "+(" inside <"+r.topLevelRule.name+`> Rule, +`)+("<"+e+`> may appears as a prefix path in all these alternatives. +`);return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,i},buildEmptyRepetitionError:function(r){var e=(0,Jj.getProductionDslName)(r.repetition);r.repetition.idx!==0&&(e+=r.repetition.idx);var t="The repetition <"+e+"> within Rule <"+r.topLevelRule.name+`> can never consume any tokens. +This could lead to an infinite loop.`;return t},buildTokenNameError:function(r){return"deprecated"},buildEmptyAlternationError:function(r){var e="Ambiguous empty alternative: <"+(r.emptyChoiceIdx+1)+">"+(" in inside <"+r.topLevelRule.name+`> Rule. +`)+"Only the last alternative may be an empty alternative.";return e},buildTooManyAlternativesError:function(r){var e=`An Alternation cannot have more than 256 alternatives: +`+(" inside <"+r.topLevelRule.name+`> Rule. + has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=IIe.map(r.leftRecursionPath,function(s){return s.name}),i=e+" --> "+t.concat([e]).join(" --> "),n=`Left Recursion found in grammar. +`+("rule: <"+e+`> can be invoked from itself (directly or indirectly) +`)+(`without consuming any Tokens. The grammar path that causes this is: + `+i+` +`)+` To fix this refactor your grammar to remove the left recursion. +see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return n},buildInvalidRuleNameError:function(r){return"deprecated"},buildDuplicateRuleNameError:function(r){var e;r.topLevelRule instanceof Wv.Rule?e=r.topLevelRule.name:e=r.topLevelRule;var t="Duplicate definition, rule: ->"+e+"<- is already defined in the grammar: ->"+r.grammarName+"<-";return t}}});var Vj=w(LA=>{"use strict";var yIe=LA&&LA.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(LA,"__esModule",{value:!0});LA.GastRefResolverVisitor=LA.resolveGrammar=void 0;var wIe=jn(),Wj=Gt(),BIe=$g();function bIe(r,e){var t=new zj(r,e);return t.resolveRefs(),t.errors}LA.resolveGrammar=bIe;var zj=function(r){yIe(e,r);function e(t,i){var n=r.call(this)||this;return n.nameToTopRule=t,n.errMsgProvider=i,n.errors=[],n}return e.prototype.resolveRefs=function(){var t=this;(0,Wj.forEach)((0,Wj.values)(this.nameToTopRule),function(i){t.currTopLevel=i,i.accept(t)})},e.prototype.visitNonTerminal=function(t){var i=this.nameToTopRule[t.nonTerminalName];if(i)t.referencedRule=i;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:n,type:wIe.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(BIe.GAstVisitor);LA.GastRefResolverVisitor=zj});var Dd=w(Nr=>{"use strict";var mc=Nr&&Nr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Nr,"__esModule",{value:!0});Nr.nextPossibleTokensAfter=Nr.possiblePathsFrom=Nr.NextTerminalAfterAtLeastOneSepWalker=Nr.NextTerminalAfterAtLeastOneWalker=Nr.NextTerminalAfterManySepWalker=Nr.NextTerminalAfterManyWalker=Nr.AbstractNextTerminalAfterProductionWalker=Nr.NextAfterTokenWalker=Nr.AbstractNextPossibleTokensWalker=void 0;var Xj=Ay(),Kt=Gt(),QIe=qv(),kt=mn(),Zj=function(r){mc(e,r);function e(t,i){var n=r.call(this)||this;return n.topProd=t,n.path=i,n.possibleTokTypes=[],n.nextProductionName="",n.nextProductionOccurrence=0,n.found=!1,n.isAtEndOfPath=!1,n}return e.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,Kt.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,Kt.cloneArr)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(t,i){i===void 0&&(i=[]),this.found||r.prototype.walk.call(this,t,i)},e.prototype.walkProdRef=function(t,i,n){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var s=i.concat(n);this.updateExpectedNext(),this.walk(t.referencedRule,s)}},e.prototype.updateExpectedNext=function(){(0,Kt.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(Xj.RestWalker);Nr.AbstractNextPossibleTokensWalker=Zj;var SIe=function(r){mc(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.path=i,n.nextTerminalName="",n.nextTerminalOccurrence=0,n.nextTerminalName=n.path.lastTok.name,n.nextTerminalOccurrence=n.path.lastTokOccurrence,n}return e.prototype.walkTerminal=function(t,i,n){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var s=i.concat(n),o=new kt.Alternative({definition:s});this.possibleTokTypes=(0,QIe.first)(o),this.found=!0}},e}(Zj);Nr.NextAfterTokenWalker=SIe;var Pd=function(r){mc(e,r);function e(t,i){var n=r.call(this)||this;return n.topRule=t,n.occurrence=i,n.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},n}return e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(Xj.RestWalker);Nr.AbstractNextTerminalAfterProductionWalker=Pd;var vIe=function(r){mc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkMany=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkMany.call(this,t,i,n)},e}(Pd);Nr.NextTerminalAfterManyWalker=vIe;var xIe=function(r){mc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkManySep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkManySep.call(this,t,i,n)},e}(Pd);Nr.NextTerminalAfterManySepWalker=xIe;var PIe=function(r){mc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOne=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOne.call(this,t,i,n)},e}(Pd);Nr.NextTerminalAfterAtLeastOneWalker=PIe;var DIe=function(r){mc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOneSep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOneSep.call(this,t,i,n)},e}(Pd);Nr.NextTerminalAfterAtLeastOneSepWalker=DIe;function _j(r,e,t){t===void 0&&(t=[]),t=(0,Kt.cloneArr)(t);var i=[],n=0;function s(c){return c.concat((0,Kt.drop)(r,n+1))}function o(c){var u=_j(s(c),e,t);return i.concat(u)}for(;t.length=0;ge--){var re=B.definition[ge],M={idx:p,def:re.definition.concat((0,Kt.drop)(h)),ruleStack:C,occurrenceStack:y};g.push(M),g.push(o)}else if(B instanceof kt.Alternative)g.push({idx:p,def:B.definition.concat((0,Kt.drop)(h)),ruleStack:C,occurrenceStack:y});else if(B instanceof kt.Rule)g.push(RIe(B,p,C,y));else throw Error("non exhaustive match")}}return u}Nr.nextPossibleTokensAfter=kIe;function RIe(r,e,t,i){var n=(0,Kt.cloneArr)(t);n.push(r.name);var s=(0,Kt.cloneArr)(i);return s.push(1),{idx:e,def:r.definition,ruleStack:n,occurrenceStack:s}}});var kd=w(Zt=>{"use strict";var tq=Zt&&Zt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Zt,"__esModule",{value:!0});Zt.areTokenCategoriesNotUsed=Zt.isStrictPrefixOfPath=Zt.containsPath=Zt.getLookaheadPathsForOptionalProd=Zt.getLookaheadPathsForOr=Zt.lookAheadSequenceFromAlternatives=Zt.buildSingleAlternativeLookaheadFunction=Zt.buildAlternativesLookAheadFunc=Zt.buildLookaheadFuncForOptionalProd=Zt.buildLookaheadFuncForOr=Zt.getProdType=Zt.PROD_TYPE=void 0;var sr=Gt(),$j=Dd(),FIe=Ay(),hy=_g(),MA=mn(),NIe=$g(),oi;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(oi=Zt.PROD_TYPE||(Zt.PROD_TYPE={}));function TIe(r){if(r instanceof MA.Option)return oi.OPTION;if(r instanceof MA.Repetition)return oi.REPETITION;if(r instanceof MA.RepetitionMandatory)return oi.REPETITION_MANDATORY;if(r instanceof MA.RepetitionMandatoryWithSeparator)return oi.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof MA.RepetitionWithSeparator)return oi.REPETITION_WITH_SEPARATOR;if(r instanceof MA.Alternation)return oi.ALTERNATION;throw Error("non exhaustive match")}Zt.getProdType=TIe;function LIe(r,e,t,i,n,s){var o=iq(r,e,t),a=Xv(o)?hy.tokenStructuredMatcherNoCategories:hy.tokenStructuredMatcher;return s(o,i,a,n)}Zt.buildLookaheadFuncForOr=LIe;function MIe(r,e,t,i,n,s){var o=nq(r,e,n,t),a=Xv(o)?hy.tokenStructuredMatcherNoCategories:hy.tokenStructuredMatcher;return s(o[0],a,i)}Zt.buildLookaheadFuncForOptionalProd=MIe;function OIe(r,e,t,i){var n=r.length,s=(0,sr.every)(r,function(l){return(0,sr.every)(l,function(c){return c.length===1})});if(e)return function(l){for(var c=(0,sr.map)(l,function(D){return D.GATE}),u=0;u{"use strict";var Zv=Vt&&Vt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Vt,"__esModule",{value:!0});Vt.checkPrefixAlternativesAmbiguities=Vt.validateSomeNonEmptyLookaheadPath=Vt.validateTooManyAlts=Vt.RepetionCollector=Vt.validateAmbiguousAlternationAlternatives=Vt.validateEmptyOrAlternative=Vt.getFirstNoneTerminal=Vt.validateNoLeftRecursion=Vt.validateRuleIsOverridden=Vt.validateRuleDoesNotAlreadyExist=Vt.OccurrenceValidationCollector=Vt.identifyProductionForDuplicates=Vt.validateGrammar=void 0;var er=Gt(),Qr=Gt(),To=jn(),_v=vd(),tf=kd(),YIe=Dd(),to=mn(),$v=$g();function jIe(r,e,t,i,n){var s=er.map(r,function(h){return qIe(h,i)}),o=er.map(r,function(h){return ex(h,h,i)}),a=[],l=[],c=[];(0,Qr.every)(o,Qr.isEmpty)&&(a=(0,Qr.map)(r,function(h){return cq(h,i)}),l=(0,Qr.map)(r,function(h){return uq(h,e,i)}),c=hq(r,e,i));var u=zIe(r,t,i),g=(0,Qr.map)(r,function(h){return fq(h,i)}),f=(0,Qr.map)(r,function(h){return lq(h,r,n,i)});return er.flatten(s.concat(c,o,a,l,u,g,f))}Vt.validateGrammar=jIe;function qIe(r,e){var t=new Aq;r.accept(t);var i=t.allProductions,n=er.groupBy(i,oq),s=er.pick(n,function(a){return a.length>1}),o=er.map(er.values(s),function(a){var l=er.first(a),c=e.buildDuplicateFoundError(r,a),u=(0,_v.getProductionDslName)(l),g={message:c,type:To.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:u,occurrence:l.idx},f=aq(l);return f&&(g.parameter=f),g});return o}function oq(r){return(0,_v.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+aq(r)}Vt.identifyProductionForDuplicates=oq;function aq(r){return r instanceof to.Terminal?r.terminalType.name:r instanceof to.NonTerminal?r.nonTerminalName:""}var Aq=function(r){Zv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}($v.GAstVisitor);Vt.OccurrenceValidationCollector=Aq;function lq(r,e,t,i){var n=[],s=(0,Qr.reduce)(e,function(a,l){return l.name===r.name?a+1:a},0);if(s>1){var o=i.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});n.push({message:o,type:To.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return n}Vt.validateRuleDoesNotAlreadyExist=lq;function JIe(r,e,t){var i=[],n;return er.contains(e,r)||(n="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+t+"<-as it is not defined in any of the super grammars ",i.push({message:n,type:To.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),i}Vt.validateRuleIsOverridden=JIe;function ex(r,e,t,i){i===void 0&&(i=[]);var n=[],s=Rd(e.definition);if(er.isEmpty(s))return[];var o=r.name,a=er.contains(s,r);a&&n.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:i}),type:To.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:o});var l=er.difference(s,i.concat([r])),c=er.map(l,function(u){var g=er.cloneArr(i);return g.push(u),ex(r,u,t,g)});return n.concat(er.flatten(c))}Vt.validateNoLeftRecursion=ex;function Rd(r){var e=[];if(er.isEmpty(r))return e;var t=er.first(r);if(t instanceof to.NonTerminal)e.push(t.referencedRule);else if(t instanceof to.Alternative||t instanceof to.Option||t instanceof to.RepetitionMandatory||t instanceof to.RepetitionMandatoryWithSeparator||t instanceof to.RepetitionWithSeparator||t instanceof to.Repetition)e=e.concat(Rd(t.definition));else if(t instanceof to.Alternation)e=er.flatten(er.map(t.definition,function(o){return Rd(o.definition)}));else if(!(t instanceof to.Terminal))throw Error("non exhaustive match");var i=(0,_v.isOptionalProd)(t),n=r.length>1;if(i&&n){var s=er.drop(r);return e.concat(Rd(s))}else return e}Vt.getFirstNoneTerminal=Rd;var tx=function(r){Zv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.alternations=[],t}return e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}($v.GAstVisitor);function cq(r,e){var t=new tx;r.accept(t);var i=t.alternations,n=er.reduce(i,function(s,o){var a=er.dropRight(o.definition),l=er.map(a,function(c,u){var g=(0,YIe.nextPossibleTokensAfter)([c],[],null,1);return er.isEmpty(g)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:o,emptyChoiceIdx:u}),type:To.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:o.idx,alternative:u+1}:null});return s.concat(er.compact(l))},[]);return n}Vt.validateEmptyOrAlternative=cq;function uq(r,e,t){var i=new tx;r.accept(i);var n=i.alternations;n=(0,Qr.reject)(n,function(o){return o.ignoreAmbiguities===!0});var s=er.reduce(n,function(o,a){var l=a.idx,c=a.maxLookahead||e,u=(0,tf.getLookaheadPathsForOr)(l,r,c,a),g=WIe(u,a,r,t),f=pq(u,a,r,t);return o.concat(g,f)},[]);return s}Vt.validateAmbiguousAlternationAlternatives=uq;var gq=function(r){Zv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}($v.GAstVisitor);Vt.RepetionCollector=gq;function fq(r,e){var t=new tx;r.accept(t);var i=t.alternations,n=er.reduce(i,function(s,o){return o.definition.length>255&&s.push({message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:o}),type:To.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:o.idx}),s},[]);return n}Vt.validateTooManyAlts=fq;function hq(r,e,t){var i=[];return(0,Qr.forEach)(r,function(n){var s=new gq;n.accept(s);var o=s.allProductions;(0,Qr.forEach)(o,function(a){var l=(0,tf.getProdType)(a),c=a.maxLookahead||e,u=a.idx,g=(0,tf.getLookaheadPathsForOptionalProd)(u,n,l,c),f=g[0];if((0,Qr.isEmpty)((0,Qr.flatten)(f))){var h=t.buildEmptyRepetitionError({topLevelRule:n,repetition:a});i.push({message:h,type:To.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:n.name})}})}),i}Vt.validateSomeNonEmptyLookaheadPath=hq;function WIe(r,e,t,i){var n=[],s=(0,Qr.reduce)(r,function(a,l,c){return e.definition[c].ignoreAmbiguities===!0||(0,Qr.forEach)(l,function(u){var g=[c];(0,Qr.forEach)(r,function(f,h){c!==h&&(0,tf.containsPath)(f,u)&&e.definition[h].ignoreAmbiguities!==!0&&g.push(h)}),g.length>1&&!(0,tf.containsPath)(n,u)&&(n.push(u),a.push({alts:g,path:u}))}),a},[]),o=er.map(s,function(a){var l=(0,Qr.map)(a.alts,function(u){return u+1}),c=i.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:l,prefixPath:a.path});return{message:c,type:To.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[a.alts]}});return o}function pq(r,e,t,i){var n=[],s=(0,Qr.reduce)(r,function(o,a,l){var c=(0,Qr.map)(a,function(u){return{idx:l,path:u}});return o.concat(c)},[]);return(0,Qr.forEach)(s,function(o){var a=e.definition[o.idx];if(a.ignoreAmbiguities!==!0){var l=o.idx,c=o.path,u=(0,Qr.findAll)(s,function(f){return e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});rf.validateGrammar=rf.resolveGrammar=void 0;var ix=Gt(),VIe=Vj(),XIe=rx(),dq=xd();function ZIe(r){r=(0,ix.defaults)(r,{errMsgProvider:dq.defaultGrammarResolverErrorProvider});var e={};return(0,ix.forEach)(r.rules,function(t){e[t.name]=t}),(0,VIe.resolveGrammar)(e,r.errMsgProvider)}rf.resolveGrammar=ZIe;function _Ie(r){return r=(0,ix.defaults)(r,{errMsgProvider:dq.defaultGrammarValidatorErrorProvider}),(0,XIe.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}rf.validateGrammar=_Ie});var nf=w(In=>{"use strict";var Fd=In&&In.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(In,"__esModule",{value:!0});In.EarlyExitException=In.NotAllInputParsedException=In.NoViableAltException=In.MismatchedTokenException=In.isRecognitionException=void 0;var $Ie=Gt(),mq="MismatchedTokenException",Eq="NoViableAltException",Iq="EarlyExitException",yq="NotAllInputParsedException",wq=[mq,Eq,Iq,yq];Object.freeze(wq);function eye(r){return(0,$Ie.contains)(wq,r.name)}In.isRecognitionException=eye;var py=function(r){Fd(e,r);function e(t,i){var n=this.constructor,s=r.call(this,t)||this;return s.token=i,s.resyncedTokens=[],Object.setPrototypeOf(s,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(s,s.constructor),s}return e}(Error),tye=function(r){Fd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=mq,s}return e}(py);In.MismatchedTokenException=tye;var rye=function(r){Fd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Eq,s}return e}(py);In.NoViableAltException=rye;var iye=function(r){Fd(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.name=yq,n}return e}(py);In.NotAllInputParsedException=iye;var nye=function(r){Fd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Iq,s}return e}(py);In.EarlyExitException=nye});var sx=w(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.attemptInRepetitionRecovery=Ki.Recoverable=Ki.InRuleRecoveryException=Ki.IN_RULE_RECOVERY_EXCEPTION=Ki.EOF_FOLLOW_KEY=void 0;var dy=TA(),hs=Gt(),sye=nf(),oye=Jv(),aye=jn();Ki.EOF_FOLLOW_KEY={};Ki.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function nx(r){this.name=Ki.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Ki.InRuleRecoveryException=nx;nx.prototype=Error.prototype;var Aye=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,hs.has)(e,"recoveryEnabled")?e.recoveryEnabled:aye.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Bq)},r.prototype.getTokenToInsert=function(e){var t=(0,dy.createTokenInstance)(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},r.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},r.prototype.tryInRepetitionRecovery=function(e,t,i,n){for(var s=this,o=this.findReSyncTokenType(),a=this.exportLexerState(),l=[],c=!1,u=this.LA(1),g=this.LA(1),f=function(){var h=s.LA(0),p=s.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:u,previous:h,ruleName:s.getCurrRuleFullName()}),C=new sye.MismatchedTokenException(p,u,s.LA(0));C.resyncedTokens=(0,hs.dropRight)(l),s.SAVE_ERROR(C)};!c;)if(this.tokenMatcher(g,n)){f();return}else if(i.call(this)){f(),e.apply(this,t);return}else this.tokenMatcher(g,o)?c=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,l));this.importLexerState(a)},r.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,i){return!(i===!1||e===void 0||t===void 0||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},r.prototype.getFollowsForInRuleRecovery=function(e,t){var i=this.getCurrentGrammarPath(e,t),n=this.getNextPossibleTokenTypes(i);return n},r.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t)){var i=this.getTokenToInsert(e);return i}if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new nx("sad sad panda")},r.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},r.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var i=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,hs.isEmpty)(t))return!1;var n=this.LA(1),s=(0,hs.find)(t,function(o){return i.tokenMatcher(n,o)})!==void 0;return s},r.prototype.canRecoverWithSingleTokenDeletion=function(e){var t=this.tokenMatcher(this.LA(2),e);return t},r.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),i=this.getFollowSetFromFollowKey(t);return(0,hs.contains)(i,e)},r.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),i=2;;){var n=t.tokenType;if((0,hs.contains)(e,n))return n;t=this.LA(i),i++}},r.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return Ki.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}},r.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,i=this.RULE_OCCURRENCE_STACK;return(0,hs.map)(t,function(n,s){return s===0?Ki.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(n),idxInCallingRule:i[s],inRule:e.shortRuleNameToFullName(t[s-1])}})},r.prototype.flattenFollowSet=function(){var e=this,t=(0,hs.map)(this.buildFullFollowKeyStack(),function(i){return e.getFollowSetFromFollowKey(i)});return(0,hs.flatten)(t)},r.prototype.getFollowSetFromFollowKey=function(e){if(e===Ki.EOF_FOLLOW_KEY)return[dy.EOF];var t=e.ruleName+e.idxInCallingRule+oye.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,dy.EOF)||t.push(e),t},r.prototype.reSyncTo=function(e){for(var t=[],i=this.LA(1);this.tokenMatcher(i,e)===!1;)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return(0,hs.dropRight)(t)},r.prototype.attemptInRepetitionRecovery=function(e,t,i,n,s,o,a){},r.prototype.getCurrentGrammarPath=function(e,t){var i=this.getHumanReadableRuleStack(),n=(0,hs.cloneArr)(this.RULE_OCCURRENCE_STACK),s={ruleStack:i,occurrenceStack:n,lastTok:e,lastTokOccurrence:t};return s},r.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,hs.map)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},r}();Ki.Recoverable=Aye;function Bq(r,e,t,i,n,s,o){var a=this.getKeyForAutomaticLookahead(i,n),l=this.firstAfterRepMap[a];if(l===void 0){var c=this.getCurrRuleFullName(),u=this.getGAstProductions()[c],g=new s(u,n);l=g.startWalking(),this.firstAfterRepMap[a]=l}var f=l.token,h=l.occurrence,p=l.isEndOfRule;this.RULE_STACK.length===1&&p&&f===void 0&&(f=dy.EOF,h=1),this.shouldInRepetitionRecoveryBeTried(f,h,o)&&this.tryInRepetitionRecovery(r,e,t,f)}Ki.attemptInRepetitionRecovery=Bq});var Cy=w(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.getKeyForAutomaticLookahead=Jt.AT_LEAST_ONE_SEP_IDX=Jt.MANY_SEP_IDX=Jt.AT_LEAST_ONE_IDX=Jt.MANY_IDX=Jt.OPTION_IDX=Jt.OR_IDX=Jt.BITS_FOR_ALT_IDX=Jt.BITS_FOR_RULE_IDX=Jt.BITS_FOR_OCCURRENCE_IDX=Jt.BITS_FOR_METHOD_TYPE=void 0;Jt.BITS_FOR_METHOD_TYPE=4;Jt.BITS_FOR_OCCURRENCE_IDX=8;Jt.BITS_FOR_RULE_IDX=12;Jt.BITS_FOR_ALT_IDX=8;Jt.OR_IDX=1<{"use strict";Object.defineProperty(my,"__esModule",{value:!0});my.LooksAhead=void 0;var ka=kd(),ro=Gt(),bq=jn(),Ra=Cy(),Ec=vd(),cye=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,ro.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:bq.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,ro.has)(e,"maxLookahead")?e.maxLookahead:bq.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=(0,ro.isES2015MapSupported)()?new Map:[],(0,ro.isES2015MapSupported)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},r.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,ro.forEach)(e,function(i){t.TRACE_INIT(i.name+" Rule Lookahead",function(){var n=(0,Ec.collectMethods)(i),s=n.alternation,o=n.repetition,a=n.option,l=n.repetitionMandatory,c=n.repetitionMandatoryWithSeparator,u=n.repetitionWithSeparator;(0,ro.forEach)(s,function(g){var f=g.idx===0?"":g.idx;t.TRACE_INIT(""+(0,Ec.getProductionDslName)(g)+f,function(){var h=(0,ka.buildLookaheadFuncForOr)(g.idx,i,g.maxLookahead||t.maxLookahead,g.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),p=(0,Ra.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[i.name],Ra.OR_IDX,g.idx);t.setLaFuncCache(p,h)})}),(0,ro.forEach)(o,function(g){t.computeLookaheadFunc(i,g.idx,Ra.MANY_IDX,ka.PROD_TYPE.REPETITION,g.maxLookahead,(0,Ec.getProductionDslName)(g))}),(0,ro.forEach)(a,function(g){t.computeLookaheadFunc(i,g.idx,Ra.OPTION_IDX,ka.PROD_TYPE.OPTION,g.maxLookahead,(0,Ec.getProductionDslName)(g))}),(0,ro.forEach)(l,function(g){t.computeLookaheadFunc(i,g.idx,Ra.AT_LEAST_ONE_IDX,ka.PROD_TYPE.REPETITION_MANDATORY,g.maxLookahead,(0,Ec.getProductionDslName)(g))}),(0,ro.forEach)(c,function(g){t.computeLookaheadFunc(i,g.idx,Ra.AT_LEAST_ONE_SEP_IDX,ka.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,g.maxLookahead,(0,Ec.getProductionDslName)(g))}),(0,ro.forEach)(u,function(g){t.computeLookaheadFunc(i,g.idx,Ra.MANY_SEP_IDX,ka.PROD_TYPE.REPETITION_WITH_SEPARATOR,g.maxLookahead,(0,Ec.getProductionDslName)(g))})})})},r.prototype.computeLookaheadFunc=function(e,t,i,n,s,o){var a=this;this.TRACE_INIT(""+o+(t===0?"":t),function(){var l=(0,ka.buildLookaheadFuncForOptionalProd)(t,e,s||a.maxLookahead,a.dynamicTokensEnabled,n,a.lookAheadBuilderForOptional),c=(0,Ra.getKeyForAutomaticLookahead)(a.fullRuleNameToShort[e.name],i,t);a.setLaFuncCache(c,l)})},r.prototype.lookAheadBuilderForOptional=function(e,t,i){return(0,ka.buildSingleAlternativeLookaheadFunction)(e,t,i)},r.prototype.lookAheadBuilderForAlternatives=function(e,t,i,n){return(0,ka.buildAlternativesLookAheadFunc)(e,t,i,n)},r.prototype.getKeyForAutomaticLookahead=function(e,t){var i=this.getLastExplicitRuleShortName();return(0,Ra.getKeyForAutomaticLookahead)(i,e,t)},r.prototype.getLaFuncFromCache=function(e){},r.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},r.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},r.prototype.setLaFuncCache=function(e,t){},r.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},r.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},r}();my.LooksAhead=cye});var Sq=w(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.addNoneTerminalToCst=Lo.addTerminalToCst=Lo.setNodeLocationFull=Lo.setNodeLocationOnlyOffset=void 0;function uye(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset{"use strict";Object.defineProperty(OA,"__esModule",{value:!0});OA.defineNameProp=OA.functionName=OA.classNameFromInstance=void 0;var pye=Gt();function dye(r){return xq(r.constructor)}OA.classNameFromInstance=dye;var vq="name";function xq(r){var e=r.name;return e||"anonymous"}OA.functionName=xq;function Cye(r,e){var t=Object.getOwnPropertyDescriptor(r,vq);return(0,pye.isUndefined)(t)||t.configurable?(Object.defineProperty(r,vq,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}OA.defineNameProp=Cye});var Fq=w(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.validateRedundantMethods=Si.validateMissingCstMethods=Si.validateVisitor=Si.CstVisitorDefinitionError=Si.createBaseVisitorConstructorWithDefaults=Si.createBaseSemanticVisitorConstructor=Si.defaultVisit=void 0;var ps=Gt(),Nd=ox();function Pq(r,e){for(var t=(0,ps.keys)(r),i=t.length,n=0;n: + `+(""+s.join(` + +`).replace(/\n/g,` + `)))}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}Si.createBaseSemanticVisitorConstructor=mye;function Eye(r,e,t){var i=function(){};(0,Nd.defineNameProp)(i,r+"BaseSemanticsWithDefaults");var n=Object.create(t.prototype);return(0,ps.forEach)(e,function(s){n[s]=Pq}),i.prototype=n,i.prototype.constructor=i,i}Si.createBaseVisitorConstructorWithDefaults=Eye;var ax;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(ax=Si.CstVisitorDefinitionError||(Si.CstVisitorDefinitionError={}));function Dq(r,e){var t=kq(r,e),i=Rq(r,e);return t.concat(i)}Si.validateVisitor=Dq;function kq(r,e){var t=(0,ps.map)(e,function(i){if(!(0,ps.isFunction)(r[i]))return{msg:"Missing visitor method: <"+i+"> on "+(0,Nd.functionName)(r.constructor)+" CST Visitor.",type:ax.MISSING_METHOD,methodName:i}});return(0,ps.compact)(t)}Si.validateMissingCstMethods=kq;var Iye=["constructor","visit","validateVisitor"];function Rq(r,e){var t=[];for(var i in r)(0,ps.isFunction)(r[i])&&!(0,ps.contains)(Iye,i)&&!(0,ps.contains)(e,i)&&t.push({msg:"Redundant visitor method: <"+i+"> on "+(0,Nd.functionName)(r.constructor)+` CST Visitor +There is no Grammar Rule corresponding to this method's name. +`,type:ax.REDUNDANT_METHOD,methodName:i});return t}Si.validateRedundantMethods=Rq});var Tq=w(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.TreeBuilder=void 0;var sf=Sq(),_r=Gt(),Nq=Fq(),yye=jn(),wye=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,_r.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:yye.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=_r.NOOP,this.cstFinallyStateUpdate=_r.NOOP,this.cstPostTerminal=_r.NOOP,this.cstPostNonTerminal=_r.NOOP,this.cstPostRule=_r.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=sf.setNodeLocationFull,this.setNodeLocationFromNode=sf.setNodeLocationFull,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=sf.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=sf.setNodeLocationOnlyOffset,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=_r.NOOP,this.setNodeLocationFromNode=_r.NOOP,this.cstPostRule=_r.NOOP,this.setInitialNodeLocation=_r.NOOP;else throw Error('Invalid config option: "'+e.nodeLocationTracking+'"')},r.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},r.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},r.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.cstInvocationStateUpdate=function(e,t){var i={name:e,children:{}};this.setInitialNodeLocation(i),this.CST_STACK.push(i)},r.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},r.prototype.cstPostRuleFull=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)},r.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?i.endOffset=t.endOffset:i.startOffset=NaN},r.prototype.cstPostTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,sf.addTerminalToCst)(i,t,e),this.setNodeLocationFromToken(i.location,t)},r.prototype.cstPostNonTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,sf.addNoneTerminalToCst)(i,t,e),this.setNodeLocationFromNode(i.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,_r.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,Nq.createBaseSemanticVisitorConstructor)(this.className,(0,_r.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,_r.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,Nq.createBaseVisitorConstructorWithDefaults)(this.className,(0,_r.keys)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},r.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},r.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},r.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},r}();Ey.TreeBuilder=wye});var Mq=w(Iy=>{"use strict";Object.defineProperty(Iy,"__esModule",{value:!0});Iy.LexerAdapter=void 0;var Lq=jn(),Bye=function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Lq.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Lq.END_OF_FILE:this.tokVector[t]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(e){this.currIdx=e},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r}();Iy.LexerAdapter=Bye});var Kq=w(yy=>{"use strict";Object.defineProperty(yy,"__esModule",{value:!0});yy.RecognizerApi=void 0;var Oq=Gt(),bye=nf(),Ax=jn(),Qye=xd(),Sye=rx(),vye=mn(),xye=function(){function r(){}return r.prototype.ACTION=function(e){return e.call(this)},r.prototype.consume=function(e,t,i){return this.consumeInternal(t,e,i)},r.prototype.subrule=function(e,t,i){return this.subruleInternal(t,e,i)},r.prototype.option=function(e,t){return this.optionInternal(t,e)},r.prototype.or=function(e,t){return this.orInternal(t,e)},r.prototype.many=function(e,t){return this.manyInternal(e,t)},r.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},r.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},r.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},r.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},r.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},r.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},r.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},r.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},r.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},r.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},r.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},r.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},r.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},r.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},r.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},r.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},r.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},r.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},r.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},r.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},r.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},r.prototype.OPTION=function(e){return this.optionInternal(e,0)},r.prototype.OPTION1=function(e){return this.optionInternal(e,1)},r.prototype.OPTION2=function(e){return this.optionInternal(e,2)},r.prototype.OPTION3=function(e){return this.optionInternal(e,3)},r.prototype.OPTION4=function(e){return this.optionInternal(e,4)},r.prototype.OPTION5=function(e){return this.optionInternal(e,5)},r.prototype.OPTION6=function(e){return this.optionInternal(e,6)},r.prototype.OPTION7=function(e){return this.optionInternal(e,7)},r.prototype.OPTION8=function(e){return this.optionInternal(e,8)},r.prototype.OPTION9=function(e){return this.optionInternal(e,9)},r.prototype.OR=function(e){return this.orInternal(e,0)},r.prototype.OR1=function(e){return this.orInternal(e,1)},r.prototype.OR2=function(e){return this.orInternal(e,2)},r.prototype.OR3=function(e){return this.orInternal(e,3)},r.prototype.OR4=function(e){return this.orInternal(e,4)},r.prototype.OR5=function(e){return this.orInternal(e,5)},r.prototype.OR6=function(e){return this.orInternal(e,6)},r.prototype.OR7=function(e){return this.orInternal(e,7)},r.prototype.OR8=function(e){return this.orInternal(e,8)},r.prototype.OR9=function(e){return this.orInternal(e,9)},r.prototype.MANY=function(e){this.manyInternal(0,e)},r.prototype.MANY1=function(e){this.manyInternal(1,e)},r.prototype.MANY2=function(e){this.manyInternal(2,e)},r.prototype.MANY3=function(e){this.manyInternal(3,e)},r.prototype.MANY4=function(e){this.manyInternal(4,e)},r.prototype.MANY5=function(e){this.manyInternal(5,e)},r.prototype.MANY6=function(e){this.manyInternal(6,e)},r.prototype.MANY7=function(e){this.manyInternal(7,e)},r.prototype.MANY8=function(e){this.manyInternal(8,e)},r.prototype.MANY9=function(e){this.manyInternal(9,e)},r.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},r.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},r.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},r.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},r.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},r.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},r.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},r.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},r.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},r.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},r.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},r.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},r.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},r.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},r.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},r.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},r.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},r.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},r.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},r.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},r.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},r.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},r.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},r.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},r.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},r.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},r.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},r.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},r.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},r.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},r.prototype.RULE=function(e,t,i){if(i===void 0&&(i=Ax.DEFAULT_RULE_CONFIG),(0,Oq.contains)(this.definedRulesNames,e)){var n=Qye.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),s={message:n,type:Ax.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);var o=this.defineRule(e,t,i);return this[e]=o,o},r.prototype.OVERRIDE_RULE=function(e,t,i){i===void 0&&(i=Ax.DEFAULT_RULE_CONFIG);var n=[];n=n.concat((0,Sye.validateRuleIsOverridden)(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(n);var s=this.defineRule(e,t,i);return this[e]=s,s},r.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var i=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if((0,bye.isRecognitionException)(n))return!1;throw n}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}},r.prototype.getGAstProductions=function(){return this.gastProductionsCache},r.prototype.getSerializedGastProductions=function(){return(0,vye.serializeGrammar)((0,Oq.values)(this.gastProductionsCache))},r}();yy.RecognizerApi=xye});var Yq=w(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});By.RecognizerEngine=void 0;var Pr=Gt(),qn=Cy(),wy=nf(),Uq=kd(),of=Dd(),Hq=jn(),Pye=sx(),Gq=TA(),Td=_g(),Dye=ox(),kye=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,Dye.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Td.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,Pr.has)(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 + For Further details.`);if((0,Pr.isArray)(e)){if((0,Pr.isEmpty)(e))throw Error(`A Token Vocabulary cannot be empty. + Note that the first argument for the parser constructor + is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 + For Further details.`)}if((0,Pr.isArray)(e))this.tokensMap=(0,Pr.reduce)(e,function(o,a){return o[a.name]=a,o},{});else if((0,Pr.has)(e,"modes")&&(0,Pr.every)((0,Pr.flatten)((0,Pr.values)(e.modes)),Td.isTokenType)){var i=(0,Pr.flatten)((0,Pr.values)(e.modes)),n=(0,Pr.uniq)(i);this.tokensMap=(0,Pr.reduce)(n,function(o,a){return o[a.name]=a,o},{})}else if((0,Pr.isObject)(e))this.tokensMap=(0,Pr.cloneObj)(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=Gq.EOF;var s=(0,Pr.every)((0,Pr.values)(e),function(o){return(0,Pr.isEmpty)(o.categoryMatches)});this.tokenMatcher=s?Td.tokenStructuredMatcherNoCategories:Td.tokenStructuredMatcher,(0,Td.augmentTokenTypes)((0,Pr.values)(this.tokensMap))},r.prototype.defineRule=function(e,t,i){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+`> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var n=(0,Pr.has)(i,"resyncEnabled")?i.resyncEnabled:Hq.DEFAULT_RULE_CONFIG.resyncEnabled,s=(0,Pr.has)(i,"recoveryValueFunc")?i.recoveryValueFunc:Hq.DEFAULT_RULE_CONFIG.recoveryValueFunc,o=this.ruleShortNameIdx<t},r.prototype.orInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(qn.OR_IDX,t),n=(0,Pr.isArray)(e)?e:e.DEF,s=this.getLaFuncFromCache(i),o=s.call(this,n);if(o!==void 0){var a=n[o];return a.ALT.call(this)}this.raiseNoAltException(t,e.ERR_MSG)},r.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new wy.NotAllInputParsedException(t,e))}},r.prototype.subruleInternal=function(e,t,i){var n;try{var s=i!==void 0?i.ARGS:void 0;return n=e.call(this,t,s),this.cstPostNonTerminal(n,i!==void 0&&i.LABEL!==void 0?i.LABEL:e.ruleName),n}catch(o){this.subruleInternalError(o,i,e.ruleName)}},r.prototype.subruleInternalError=function(e,t,i){throw(0,wy.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:i),delete e.partialCstResult),e},r.prototype.consumeInternal=function(e,t,i){var n;try{var s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),n=s):this.consumeInternalError(e,s,i)}catch(o){n=this.consumeInternalRecovery(e,t,o)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:e.name,n),n},r.prototype.consumeInternalError=function(e,t,i){var n,s=this.LA(0);throw i!==void 0&&i.ERR_MSG?n=i.ERR_MSG:n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new wy.MismatchedTokenException(n,t,s))},r.prototype.consumeInternalRecovery=function(e,t,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){var n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(s){throw s.name===Pye.IN_RULE_RECOVERY_EXCEPTION?i:s}}else throw i},r.prototype.saveRecogState=function(){var e=this.errors,t=(0,Pr.cloneArr)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},r.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},r.prototype.ruleInvocationStateUpdate=function(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},r.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},r.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},r.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},r.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),Gq.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();By.RecognizerEngine=kye});var qq=w(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.ErrorHandler=void 0;var lx=nf(),cx=Gt(),jq=kd(),Rye=jn(),Fye=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,cx.has)(e,"errorMessageProvider")?e.errorMessageProvider:Rye.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,lx.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,cx.cloneArr)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(r.prototype,"errors",{get:function(){return(0,cx.cloneArr)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),r.prototype.raiseEarlyExitException=function(e,t,i){for(var n=this.getCurrRuleFullName(),s=this.getGAstProductions()[n],o=(0,jq.getLookaheadPathsForOptionalProd)(e,s,t,this.maxLookahead),a=o[0],l=[],c=1;c<=this.maxLookahead;c++)l.push(this.LA(c));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:l,previous:this.LA(0),customUserDescription:i,ruleName:n});throw this.SAVE_ERROR(new lx.EarlyExitException(u,this.LA(1),this.LA(0)))},r.prototype.raiseNoAltException=function(e,t){for(var i=this.getCurrRuleFullName(),n=this.getGAstProductions()[i],s=(0,jq.getLookaheadPathsForOr)(e,n,this.maxLookahead),o=[],a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));var l=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:l,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new lx.NoViableAltException(c,this.LA(1),l))},r}();by.ErrorHandler=Fye});var zq=w(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});Qy.ContentAssist=void 0;var Jq=Dd(),Wq=Gt(),Nye=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var i=this.gastProductionsCache[e];if((0,Wq.isUndefined)(i))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,Jq.nextPossibleTokensAfter)([i],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,Wq.first)(e.ruleStack),i=this.getGAstProductions(),n=i[t],s=new Jq.NextAfterTokenWalker(n,e).startWalking();return s},r}();Qy.ContentAssist=Nye});var rJ=w(xy=>{"use strict";Object.defineProperty(xy,"__esModule",{value:!0});xy.GastRecorder=void 0;var yn=Gt(),Mo=mn(),Tye=Bd(),_q=_g(),$q=TA(),Lye=jn(),Mye=Cy(),vy={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(vy);var Vq=!0,Xq=Math.pow(2,Mye.BITS_FOR_OCCURRENCE_IDX)-1,eJ=(0,$q.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:Tye.Lexer.NA});(0,_q.augmentTokenTypes)([eJ]);var tJ=(0,$q.createTokenInstance)(eJ,`This IToken indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(tJ);var Oye={name:`This CSTNode indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Kye=function(){function r(){}return r.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},r.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(n){var s=n>0?n:"";e["CONSUME"+s]=function(o,a){return this.consumeInternalRecord(o,n,a)},e["SUBRULE"+s]=function(o,a){return this.subruleInternalRecord(o,n,a)},e["OPTION"+s]=function(o){return this.optionInternalRecord(o,n)},e["OR"+s]=function(o){return this.orInternalRecord(o,n)},e["MANY"+s]=function(o){this.manyInternalRecord(n,o)},e["MANY_SEP"+s]=function(o){this.manySepFirstInternalRecord(n,o)},e["AT_LEAST_ONE"+s]=function(o){this.atLeastOneInternalRecord(n,o)},e["AT_LEAST_ONE_SEP"+s]=function(o){this.atLeastOneSepFirstInternalRecord(n,o)}},i=0;i<10;i++)t(i);e.consume=function(n,s,o){return this.consumeInternalRecord(s,n,o)},e.subrule=function(n,s,o){return this.subruleInternalRecord(s,n,o)},e.option=function(n,s){return this.optionInternalRecord(s,n)},e.or=function(n,s){return this.orInternalRecord(s,n)},e.many=function(n,s){this.manyInternalRecord(n,s)},e.atLeastOne=function(n,s){this.atLeastOneInternalRecord(n,s)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},r.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var i=t>0?t:"";delete e["CONSUME"+i],delete e["SUBRULE"+i],delete e["OPTION"+i],delete e["OR"+i],delete e["MANY"+i],delete e["MANY_SEP"+i],delete e["AT_LEAST_ONE"+i],delete e["AT_LEAST_ONE_SEP"+i]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})},r.prototype.ACTION_RECORD=function(e){},r.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},r.prototype.LA_RECORD=function(e){return Lye.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var i=new Mo.Rule({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+` + This error was thrown during the "grammar recording phase" For more info see: + https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}},r.prototype.optionInternalRecord=function(e,t){return Ld.call(this,Mo.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){Ld.call(this,Mo.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){Ld.call(this,Mo.RepetitionMandatoryWithSeparator,t,e,Vq)},r.prototype.manyInternalRecord=function(e,t){Ld.call(this,Mo.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){Ld.call(this,Mo.RepetitionWithSeparator,t,e,Vq)},r.prototype.orInternalRecord=function(e,t){return Uye.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,i){if(Sy(t),!e||(0,yn.has)(e,"ruleName")===!1){var n=new Error(" argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(e)+">")+(` + inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,yn.peek)(this.recordingProdStack),o=e.ruleName,a=new Mo.NonTerminal({idx:t,nonTerminalName:o,label:i==null?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(a),this.outputCst?Oye:vy},r.prototype.consumeInternalRecord=function(e,t,i){if(Sy(t),!(0,_q.hasShortKeyProperty)(e)){var n=new Error(" argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(e)+">")+(` + inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,yn.peek)(this.recordingProdStack),o=new Mo.Terminal({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return s.definition.push(o),tJ},r}();xy.GastRecorder=Kye;function Ld(r,e,t,i){i===void 0&&(i=!1),Sy(t);var n=(0,yn.peek)(this.recordingProdStack),s=(0,yn.isFunction)(e)?e:e.DEF,o=new r({definition:[],idx:t});return i&&(o.separator=e.SEP),(0,yn.has)(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),n.definition.push(o),this.recordingProdStack.pop(),vy}function Uye(r,e){var t=this;Sy(e);var i=(0,yn.peek)(this.recordingProdStack),n=(0,yn.isArray)(r)===!1,s=n===!1?r:r.DEF,o=new Mo.Alternation({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});(0,yn.has)(r,"MAX_LOOKAHEAD")&&(o.maxLookahead=r.MAX_LOOKAHEAD);var a=(0,yn.some)(s,function(l){return(0,yn.isFunction)(l.GATE)});return o.hasPredicates=a,i.definition.push(o),(0,yn.forEach)(s,function(l){var c=new Mo.Alternative({definition:[]});o.definition.push(c),(0,yn.has)(l,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:(0,yn.has)(l,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),l.ALT.call(t),t.recordingProdStack.pop()}),vy}function Zq(r){return r===0?"":""+r}function Sy(r){if(r<0||r>Xq){var e=new Error("Invalid DSL Method idx value: <"+r+`> + `+("Idx value must be a none negative value smaller than "+(Xq+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var nJ=w(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.PerformanceTracer=void 0;var iJ=Gt(),Hye=jn(),Gye=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,iJ.has)(e,"traceInitPerf")){var t=e.traceInitPerf,i=typeof t=="number";this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Hye.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <"+e+">");var n=(0,iJ.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r}();Py.PerformanceTracer=Gye});var sJ=w(Dy=>{"use strict";Object.defineProperty(Dy,"__esModule",{value:!0});Dy.applyMixins=void 0;function Yye(r,e){e.forEach(function(t){var i=t.prototype;Object.getOwnPropertyNames(i).forEach(function(n){if(n!=="constructor"){var s=Object.getOwnPropertyDescriptor(i,n);s&&(s.get||s.set)?Object.defineProperty(r.prototype,n,s):r.prototype[n]=t.prototype[n]}})})}Dy.applyMixins=Yye});var jn=w(dr=>{"use strict";var AJ=dr&&dr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.EmbeddedActionsParser=dr.CstParser=dr.Parser=dr.EMPTY_ALT=dr.ParserDefinitionErrorType=dr.DEFAULT_RULE_CONFIG=dr.DEFAULT_PARSER_CONFIG=dr.END_OF_FILE=void 0;var en=Gt(),jye=qj(),oJ=TA(),lJ=xd(),aJ=Cq(),qye=sx(),Jye=Qq(),Wye=Tq(),zye=Mq(),Vye=Kq(),Xye=Yq(),Zye=qq(),_ye=zq(),$ye=rJ(),ewe=nJ(),twe=sJ();dr.END_OF_FILE=(0,oJ.createTokenInstance)(oJ.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(dr.END_OF_FILE);dr.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:lJ.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});dr.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var rwe;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(rwe=dr.ParserDefinitionErrorType||(dr.ParserDefinitionErrorType={}));function iwe(r){return r===void 0&&(r=void 0),function(){return r}}dr.EMPTY_ALT=iwe;var ky=function(){function r(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;var i=this;if(i.initErrorHandler(t),i.initLexerAdapter(),i.initLooksAhead(t),i.initRecognizerEngine(e,t),i.initRecoverable(t),i.initTreeBuilder(t),i.initContentAssist(),i.initGastRecorder(t),i.initPerformanceTracer(t),(0,en.has)(t,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. + Please use the flag on the relevant DSL method instead. + See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES + For further details.`);this.skipValidations=(0,en.has)(t,"skipValidations")?t.skipValidations:dr.DEFAULT_PARSER_CONFIG.skipValidations}return r.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},r.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",function(){var t;e.selfAnalysisDone=!0;var i=e.className;e.TRACE_INIT("toFastProps",function(){(0,en.toFastProperties)(e)}),e.TRACE_INIT("Grammar Recording",function(){try{e.enableRecording(),(0,en.forEach)(e.definedRulesNames,function(s){var o=e[s],a=o.originalGrammarAction,l=void 0;e.TRACE_INIT(s+" Rule",function(){l=e.topLevelRuleRecord(s,a)}),e.gastProductionsCache[s]=l})}finally{e.disableRecording()}});var n=[];if(e.TRACE_INIT("Grammar Resolving",function(){n=(0,aJ.resolveGrammar)({rules:(0,en.values)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(n)}),e.TRACE_INIT("Grammar Validations",function(){if((0,en.isEmpty)(n)&&e.skipValidations===!1){var s=(0,aJ.validateGrammar)({rules:(0,en.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,en.values)(e.tokensMap),errMsgProvider:lJ.defaultGrammarValidatorErrorProvider,grammarName:i});e.definitionErrors=e.definitionErrors.concat(s)}}),(0,en.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var s=(0,jye.computeAllProdsFollows)((0,en.values)(e.gastProductionsCache));e.resyncFollows=s}),e.TRACE_INIT("ComputeLookaheadFunctions",function(){e.preComputeLookaheadFunctions((0,en.values)(e.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,en.isEmpty)(e.definitionErrors))throw t=(0,en.map)(e.definitionErrors,function(s){return s.message}),new Error(`Parser Definition Errors detected: + `+t.join(` +------------------------------- +`))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();dr.Parser=ky;(0,twe.applyMixins)(ky,[qye.Recoverable,Jye.LooksAhead,Wye.TreeBuilder,zye.LexerAdapter,Xye.RecognizerEngine,Vye.RecognizerApi,Zye.ErrorHandler,_ye.ContentAssist,$ye.GastRecorder,ewe.PerformanceTracer]);var nwe=function(r){AJ(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,en.cloneObj)(i);return s.outputCst=!0,n=r.call(this,t,s)||this,n}return e}(ky);dr.CstParser=nwe;var swe=function(r){AJ(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,en.cloneObj)(i);return s.outputCst=!1,n=r.call(this,t,s)||this,n}return e}(ky);dr.EmbeddedActionsParser=swe});var uJ=w(Ry=>{"use strict";Object.defineProperty(Ry,"__esModule",{value:!0});Ry.createSyntaxDiagramsCode=void 0;var cJ=Dv();function owe(r,e){var t=e===void 0?{}:e,i=t.resourceBase,n=i===void 0?"https://unpkg.com/chevrotain@"+cJ.VERSION+"/diagrams/":i,s=t.css,o=s===void 0?"https://unpkg.com/chevrotain@"+cJ.VERSION+"/diagrams/diagrams.css":s,a=` + + + + + +`,l=` + +`,c=` + +

Very basic Noir app

+
+

Logs

+

Proof

+
+ + +``` + +## Some good old vanilla Javascript + +Create a new file `app.js`, which is where our javascript code will live. Let's start with this code inside: + +```js +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); + +function display(container, msg) { + const c = document.getElementById(container); + const p = document.createElement('p'); + p.textContent = msg; + c.appendChild(p); +} +``` + +We can manipulate our website with this little function, so we can see our website working. + +## Adding Noir + +If you come from the previous page, your folder structure should look like this: + +```tree +├── app.js +├── circuit +│ ├── Nargo.toml +│ ├── src +│ │ └── main.nr +│ └── target +│ └── circuit.json +├── index.html +├── package.json +└── vite.config.js +``` + +You'll see other files and folders showing up (like `package-lock.json`, `yarn.lock`, `node_modules`) but you shouldn't have to care about those. + +## Importing our dependencies + +We're starting with the good stuff now. At the top of the new javascript file, import the packages: + +```ts +import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; +import { Noir } from '@noir-lang/noir_js'; +``` + +We also need to import the `circuit` JSON file we created. If you have the suggested folder structure, you can add this line: + +```ts +import circuit from './circuit/target/circuit.json'; +``` + +## Write code + +:::note + +We're gonna be adding code inside the `document.addEventListener...etc` block: + +```js +// forget stuff here +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); +// forget stuff here +``` + +::: + +Our dependencies exported two classes: `BarretenbergBackend` and `Noir`. Let's `init` them and add some logs, just to flex: + +```ts +const backend = new BarretenbergBackend(circuit); +const noir = new Noir(circuit, backend); +``` + +## Proving + +Now we're ready to prove stuff! Let's feed some inputs to our circuit and calculate the proof: + +```js +const input = { x: 1, y: 2 }; +display('logs', 'Generating proof... ⌛'); +const proof = await noir.generateFinalProof(input); +display('logs', 'Generating proof... ✅'); +display('results', proof.proof); +``` + +You're probably eager to see stuff happening, so go and run your app now! + +From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: + +![Getting Started 0](@site/static/img/noir_getting_started_1.png) + +If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. + +In any case, this means your proof was generated! But you shouldn't trust me just yet. Add these lines to see it being verified: + +```js +display('logs', 'Verifying proof... ⌛'); +const verification = await noir.verifyFinalProof(proof); +if (verification) display('logs', 'Verifying proof... ✅'); +``` + +By saving, your app will refresh and here's our complete Tiny Noir App! + +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + +## Further Reading + +You can see how noirjs is used in a full stack Next.js hardhat application in the [noir-starter repo here](https://github.com/noir-lang/noir-starter/tree/main/next-hardhat). The example shows how to calculate a proof in the browser and verify it with a deployed Solidity verifier contract from noirjs. + +You should also check out the more advanced examples in the [noir-examples repo](https://github.com/noir-lang/noir-examples), where you'll find reference usage for some cool apps. diff --git a/noir/docs/docs/noir_js/noir_js.md b/noir/docs/docs/noir_js/noir_js.md new file mode 100644 index 00000000000..f895b22eaf8 --- /dev/null +++ b/noir/docs/docs/noir_js/noir_js.md @@ -0,0 +1,36 @@ +--- +title: NoirJS +description: Interact with Noir in Typescript or Javascript +keywords: [Noir project, javascript, typescript, node.js, browser, react] +--- + +NoirJS is a TypeScript library that make it easy to use Noir on your dapp, webapp, Node.js server, website, etc. + +A typical workflow would be composed of two major elements: + +- NoirJS +- Proving backend of choice's JavaScript package + + + +To install NoirJS, install Node.js if you have not already and run this in your JavaScript project: + +```bash +npm i @noir-lang/noir_js +``` + +## Proving backend + +Since Noir is backend agnostic, you can instantiate NoirJS without any backend (i.e. to execute a function). But for proving, you would have to instantiate NoirJS with any of the supported backends through their own `js` interface. + +### Barretenberg + +Aztec Labs maintains the `barretenberg` proving backend, which you can instantiate and make use of alongside NoirJS. It is also the default proving backend installed and used with Nargo, the Noir CLI tool. + +To install its JavaScript library, run this in your project: + +```bash +npm i @noir-lang/backend_barretenberg +``` + +For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/noir_js/classes/Noir.md) sections. diff --git a/noir/docs/docs/standard_library/black_box_fns.md b/noir/docs/docs/standard_library/black_box_fns.md new file mode 100644 index 00000000000..1dfabfe8f22 --- /dev/null +++ b/noir/docs/docs/standard_library/black_box_fns.md @@ -0,0 +1,46 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen Hash](./cryptographic_primitives/hashes#pedersen_hash) +- [Pedersen Commitment](./cryptographic_primitives/hashes#pedersen_commitment) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/docs/standard_library/cryptographic_primitives.md b/noir/docs/docs/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..76745196681 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,167 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen_hash + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen_hash(_input : [Field]) -> Field +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::pedersen_hash(x); +} +``` + + + + + +## pedersen_commitment + +Given an array of Fields, returns the Pedersen commitment. + +```rust +fn pedersen_commitment(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let commitment = std::hash::pedersen_commitment(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::mimc::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/docs/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..c7eed820a80 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,27 @@ +--- +title: Scalar multiplication +description: See how you can perform scalar multiplications over a fixed base in Noir +keywords: [cryptographic primitives, Noir project, scalar multiplication] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## scalar_mul::fixed_base_embedded_curve + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base_embedded_curve(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/docs/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..c184ce28120 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/docs/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..72bce984821 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/docs/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/docs/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/docs/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..9a5beb55ee9 --- /dev/null +++ b/noir/docs/docs/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/docs/standard_library/logging.md b/noir/docs/docs/standard_library/logging.md new file mode 100644 index 00000000000..7e2fd9b9aff --- /dev/null +++ b/noir/docs/docs/standard_library/logging.md @@ -0,0 +1,62 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +You can print the output of println statements in your Noir code by using the `nargo execute` command or the `--show-output` flag when using `nargo test` (provided there are println statements in your tests). + +It is recommended to use `nargo execute` if you want to debug failing constrains with `println` statements. This is due to every input in a test being a constant rather than a witness, so we issue an error during compilation while we only print during execution (which comes after compilation). `println` will not work for failed constraints caught at compile time. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` + +You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character: + +```rust + let fmt_str = f"i: {i}, j: {j}"; + std::println(fmt_str); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"i: {i}, s: {s}"); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); +``` diff --git a/noir/docs/docs/standard_library/merkle_trees.md b/noir/docs/docs/standard_library/merkle_trees.md new file mode 100644 index 00000000000..dc383a1426b --- /dev/null +++ b/noir/docs/docs/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen_hash). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/docs/standard_library/options.md b/noir/docs/docs/standard_library/options.md new file mode 100644 index 00000000000..3d3139fb98b --- /dev/null +++ b/noir/docs/docs/standard_library/options.md @@ -0,0 +1,99 @@ +--- +title: Option Type +--- + +The `Option` type is a way to express that a value might be present (`Some(T))` or absent (`None`). It's a safer way to handle potential absence of values, compared to using nulls in many other languages. + +```rust +struct Option { + None, + Some(T), +} +``` + +You can import the Option type into your Noir program like so: + +```rust +use dep::std::option::Option; + +fn main() { + let none = Option::none(); + let some = Option::some(3); +} +``` + +See [this test](https://github.com/noir-lang/noir/blob/5cbfb9c4a06c8865c98ff2b594464b037d821a5c/crates/nargo_cli/tests/test_data/option/src/main.nr) for a more comprehensive set of examples of each of the methods described below. + +## Methods + +### none + +Constructs a none value. + +### some + +Constructs a some wrapper around a given value. + +### is_none + +Returns true if the Option is None. + +### is_some + +Returns true of the Option is Some. + +### unwrap + +Asserts `self.is_some()` and returns the wrapped value. + +### unwrap_unchecked + +Returns the inner value without asserting `self.is_some()`. This method can be useful within an if condition when we already know that `option.is_some()`. If the option is None, there is no guarantee what value will be returned, only that it will be of type T for an `Option`. + +### unwrap_or + +Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + +### unwrap_or_else + +Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return a default value. + +### map + +If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + +### map_or + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + +### map_or_else + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + +### and + +Returns None if self is None. Otherwise, this returns `other`. + +### and_then + +If self is None, this returns None. Otherwise, this calls the given function with the Some value contained within self, and returns the result of that call. In some languages this function is called `flat_map` or `bind`. + +### or + +If self is Some, return self. Otherwise, return `other`. + +### or_else + +If self is Some, return self. Otherwise, return `default()`. + +### xor + +If only one of the two Options is Some, return that option. Otherwise, if both options are Some or both are None, None is returned. + +### filter + +Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. Otherwise, this returns `None`. + +### flatten + +Flattens an `Option>` into a `Option`. This returns `None` if the outer Option is None. Otherwise, this returns the inner Option. diff --git a/noir/docs/docs/standard_library/recursion.md b/noir/docs/docs/standard_library/recursion.md new file mode 100644 index 00000000000..ff4c63acaa7 --- /dev/null +++ b/noir/docs/docs/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). diff --git a/noir/docs/docs/standard_library/zeroed.md b/noir/docs/docs/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/docs/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/docusaurus.config.js b/noir/docs/docusaurus.config.js new file mode 100644 index 00000000000..8f62df3d0e9 --- /dev/null +++ b/noir/docs/docusaurus.config.js @@ -0,0 +1,215 @@ +// @ts-check +// Note: type annotations allow type checking and IDEs autocompletion + +const lightCodeTheme = require('prism-react-renderer/themes/github'); +const darkCodeTheme = require('prism-react-renderer/themes/dracula'); + +const math = require('remark-math'); +const katex = require('rehype-katex'); + +/** @type {import('@docusaurus/types').Config} */ +const config = { + title: 'Noir Documentation', + tagline: 'The Universal ZK Circuit Language', + favicon: 'img/favicon.ico', + url: 'https://noir-lang.org', + // Set the // pathname under which your site is served + // For GitHub pages deployment, it is often '//' + baseUrl: '/', + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'throw', + + // Even if you don't use internalization, you can use this field to set useful + // metadata like html lang. For example, if your site is Chinese, you may want + // to replace "en" with "zh-Hans". + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + + presets: [ + [ + '@docusaurus/preset-classic', + { + // gtag: { + // trackingID: 'G-SZQHEQZK3L', + // anonymizeIP: true, + // }, + docs: { + sidebarPath: require.resolve('./sidebars.js'), + routeBasePath: '/', + remarkPlugins: [math], + rehypePlugins: [katex], + versions: { + current: { + label: 'dev', + path: 'dev', + }, + }, + editUrl: ({ versionDocsDirPath, docPath }) => + `https://github.com/noir-lang/noir/edit/master/docs/${versionDocsDirPath}/${docPath}`, + }, + blog: false, + theme: { + customCss: require.resolve('./src/css/custom.css'), + }, + }, + ], + ], + + themeConfig: + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + { + // Replace with your project's social card + navbar: { + logo: { + alt: 'Noir Logo', + src: 'img/logo.svg', + srcDark: 'img/logoDark.svg', + href: '/', + }, + items: [ + { + href: 'https://github.com/noir-lang/docs', + label: 'GitHub', + position: 'right', + }, + { + type: 'docsVersionDropdown', + position: 'left', + dropdownActiveClassDisabled: true, + }, + ], + }, + metadata: [ + { + name: 'Noir', + content: 'noir, programming, language, documentation, zk, zero-knowledge, l2, crypto, layer2, ethereum', + }, + ], + footer: { + style: 'dark', + links: [ + { + title: 'Community', + items: [ + { + label: 'Noir Forum', + href: 'https://discourse.aztec.network/c/noir/7', + }, + { + label: 'Twitter', + href: 'https://twitter.com/NoirLang', + }, + { + label: 'Discord', + href: 'https://discord.gg/JtqzkdeQ6G', + }, + ], + }, + { + title: 'Code', + items: [ + { + label: 'Noir GitHub', + href: 'https://github.com/noir-lang', + }, + { + label: 'Docs GitHub', + href: 'https://github.com/noir-lang/docs', + }, + ], + }, + ], + copyright: `Noir will be dual licensed under MIT/Apache (Version 2.0).`, + }, + prism: { + theme: lightCodeTheme, + darkTheme: darkCodeTheme, + additionalLanguages: ['rust', 'powershell', 'solidity', 'toml'], + }, + stylesheets: [ + { + href: 'https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css', + type: 'text/css', + integrity: 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM', + crossorigin: 'anonymous', + }, + ], + algolia: { + // The application ID provided by Algolia + appId: '97APAVUL6H', + + // Public API key: it is safe to commit it + apiKey: 'b9b94d2f1c58f7d509f0bc1f13b381fb', + + indexName: 'noir-lang', + }, + }, + plugins: [ + [ + 'docusaurus-plugin-typedoc', + { + id: 'noir_js', + entryPoints: ['../tooling/noir_js/src/index.ts'], + tsconfig: '../tooling/noir_js/tsconfig.json', + entryPointStrategy: 'resolve', + out: 'docs/noir_js/reference/noir_js', + plugin: ['typedoc-plugin-markdown'], + name: 'Noir JS', + disableSources: true, + excludePrivate: true, + + sidebar: { + filteredIds: ['noir_js/reference/noir_js/index'], + }, + readme: 'none', + hidePageHeader: true, + hideBreadcrumbs: true, + hideInPageTOC: true, + useCodeBlocks: true, + typeDeclarationFormat: 'table', + propertiesFormat: 'table', + parametersFormat: 'table', + enumMembersFormat: 'table', + indexFormat: 'table', + outputFileStrategy: 'members', + memberPageTitle: '{name}', + membersWithOwnFile: ['Interface', 'Class', 'TypeAlias', 'Function'], + }, + ], + [ + 'docusaurus-plugin-typedoc', + { + id: 'noir_js_backend_barretenberg', + entryPoints: ['../tooling/noir_js_backend_barretenberg/src/index.ts'], + tsconfig: '../tooling/noir_js_backend_barretenberg/tsconfig.json', + entryPointStrategy: 'resolve', + out: 'docs/noir_js/reference/backend_barretenberg', + plugin: ['typedoc-plugin-markdown'], + name: 'Backend Barretenberg', + disableSources: true, + excludePrivate: true, + + sidebar: { + filteredIds: ['noir_js/reference/backend_barretenberg/index'], + }, + readme: 'none', + hidePageHeader: true, + hideBreadcrumbs: true, + hideInPageTOC: true, + useCodeBlocks: true, + typeDeclarationFormat: 'table', + propertiesFormat: 'table', + parametersFormat: 'table', + enumMembersFormat: 'table', + indexFormat: 'table', + outputFileStrategy: 'members', + memberPageTitle: '{name}', + membersWithOwnFile: ['Interface', 'Class', 'TypeAlias'], + }, + ], + ], +}; + +module.exports = config; diff --git a/noir/docs/package.json b/noir/docs/package.json new file mode 100644 index 00000000000..09f8d718b56 --- /dev/null +++ b/noir/docs/package.json @@ -0,0 +1,49 @@ +{ + "name": "docs", + "version": "0.0.0", + "private": true, + "scripts": { + "start": "docusaurus start", + "build": "docusaurus build", + "setStable": "node ./scripts/setStable.js" + }, + "dependencies": { + "@docusaurus/core": "^2.4.0", + "@docusaurus/plugin-google-gtag": "^2.4.0", + "@docusaurus/preset-classic": "^2.4.0", + "@easyops-cn/docusaurus-search-local": "^0.35.0", + "@mdx-js/react": "^1.6.22", + "axios": "^1.4.0", + "clsx": "^1.2.1", + "docusaurus-plugin-typedoc": "1.0.0-next.18", + "hast-util-is-element": "^1.1.0", + "prism-react-renderer": "^1.3.5", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "rehype-katex": "^5.0.0", + "remark-math": "^3.0.1", + "typedoc": "^0.25.0", + "typedoc-plugin-frontmatter": "^0.0.2", + "typedoc-plugin-markdown": "4.0.0-next.25", + "typedoc-plugin-merge-modules": "^5.1.0", + "typescript": "^5.2.2" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "^2.4.0" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "engines": { + "node": ">=16.14" + } +} diff --git a/noir/docs/scripts/setStable.js b/noir/docs/scripts/setStable.js new file mode 100644 index 00000000000..4bbe283f4be --- /dev/null +++ b/noir/docs/scripts/setStable.js @@ -0,0 +1,42 @@ +/* eslint-disable */ +const fs = require('fs'); +const path = require('path'); +const axios = require('axios'); +const { release } = require('os'); + +const IGNORE_VERSIONS = ['0.16.0']; +const NUMBER_OF_VERSIONS_TO_SHOW = 4; + +async function main() { + const versionsFile = path.join(__dirname, '../versions.json'); + + const axiosOpts = { + params: { per_page: 100 }, + }; + + console.log(process.env.GITHUB_TOKEN); + // cool if you have a GITHUB_TOKEN because of rate limiting + // but fine if you don't + if (process.env.GITHUB_TOKEN) axiosOpts.headers = { Authorization: `token ${process.env.GITHUB_TOKEN}` }; + + const { data } = await axios.get('https://api.github.com/repos/noir-lang/noir/releases', axiosOpts); + + const all = data.map((release) => release.tag_name); + console.log('All versions: ', all); + const aztecs = data.filter((release) => release.tag_name.includes('aztec')).map((release) => release.tag_name); + console.log('Removing aztecs: ', aztecs); + const prereleases = data.filter((release) => !release.prerelease).map((release) => release.tag_name); + console.log('Removing prereleases: ', prereleases); + + const stables = data + .filter((release) => !release.prerelease && !release.tag_name.includes('aztec')) + .filter((release) => !IGNORE_VERSIONS.includes(release.tag_name.replace('v', ''))) + .map((release) => release.tag_name) + .slice(0, NUMBER_OF_VERSIONS_TO_SHOW); + + console.log('Stables: ', stables); + + fs.writeFileSync(versionsFile, JSON.stringify(stables, null, 2)); +} + +main(); diff --git a/noir/docs/sidebars.js b/noir/docs/sidebars.js new file mode 100644 index 00000000000..3fd391cf09c --- /dev/null +++ b/noir/docs/sidebars.js @@ -0,0 +1,151 @@ +/** + * Creating a sidebar enables you to: + - create an ordered group of docs + - render a sidebar for each doc of that group + - provide next/previous navigation + + The sidebars can be generated from the filesystem, or explicitly defined here. + + Create as many sidebars as you want. + */ + +// @ts-check + +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const sidebars = { + sidebar: [ + { + type: 'doc', + id: 'index', + label: 'Noir', + }, + { + type: 'category', + label: 'Getting Started', + items: [{ type: 'autogenerated', dirName: 'getting_started' }], + }, + { + type: 'category', + label: 'Examples', + items: [{ type: 'autogenerated', dirName: 'examples' }], + }, + { + type: 'category', + label: 'Nargo', + items: [{ type: 'autogenerated', dirName: 'nargo' }], + }, + { + type: 'category', + label: 'Language Concepts', + items: [ + { + type: 'category', + label: 'Data Types', + link: { + type: 'doc', + id: 'language_concepts/data_types', + }, + items: [ + { + type: 'autogenerated', + dirName: 'language_concepts/data_types', + }, + ], + }, + 'language_concepts/functions', + 'language_concepts/control_flow', + 'language_concepts/ops', + 'language_concepts/assert', + 'language_concepts/unconstrained', + 'language_concepts/generics', + 'language_concepts/mutability', + 'language_concepts/lambdas', + 'language_concepts/comments', + 'language_concepts/distinct', + 'language_concepts/shadowing', + ], + }, + { + type: 'category', + label: 'Noir Standard Library', + items: [ + { + type: 'category', + label: 'Cryptographic Primitives', + link: { + type: 'doc', + id: 'standard_library/cryptographic_primitives', + }, + items: [ + { + type: 'autogenerated', + dirName: 'standard_library/cryptographic_primitives', + }, + ], + }, + 'standard_library/recursion', + 'standard_library/logging', + 'standard_library/merkle_trees', + 'standard_library/zeroed', + 'standard_library/black_box_fns', + 'standard_library/options', + ], + }, + { + type: 'category', + label: 'Modules, Packages and Crates', + items: [{ type: 'autogenerated', dirName: 'modules_packages_crates' }], + }, + { + type: 'category', + label: 'NoirJS', + link: { + type: 'doc', + id: 'noir_js/noir_js', + }, + items: [ + { + type: 'category', + label: 'Guides', + items: [ + { + type: 'autogenerated', + dirName: 'noir_js/getting_started', + }, + ], + }, + { + type: 'category', + label: 'Reference', + items: [ + { + type: 'category', + label: 'Noir JS', + link: { + type: 'doc', + id: 'noir_js/reference/noir_js/index', + }, + items: require('./docs/noir_js/reference/noir_js/typedoc-sidebar.cjs'), + }, + { + type: 'category', + label: 'Backend Barretenberg', + link: { + type: 'doc', + id: 'noir_js/reference/backend_barretenberg/index', + }, + items: require('./docs/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs'), + }, + ], + }, + ], + }, + { + type: 'doc', + id: 'migration_notes', + label: 'Migration notes', + }, + ], +}; + +module.exports = sidebars; diff --git a/noir/docs/src/components/GithubCode/index.js b/noir/docs/src/components/GithubCode/index.js new file mode 100644 index 00000000000..69ba17ef791 --- /dev/null +++ b/noir/docs/src/components/GithubCode/index.js @@ -0,0 +1,63 @@ +import React, { useEffect, useState } from 'react'; +import axios from 'axios'; +import Highlight, { defaultProps } from "prism-react-renderer"; +import github from 'prism-react-renderer/themes/github'; +//import vsDark from 'prism-react-renderer/themes/vsDark'; + +const GitHubCode = ({ owner, repo, branch = 'master', filePath, language, startLine = 1, endLine = Infinity }) => { + const [code, setCode] = useState(''); + const [response, setResponse] = useState(''); + + useEffect(() => { + const fetchCode = async () => { + const url = `https://api.github.com/repos/${owner}/${repo}/contents/${filePath}?ref=${branch}` + try { + const response = await axios.get(url); + const content = response.data.content; + const decodedContent = atob(content); // Decode Base64 content + + const lines = decodedContent.split('\n'); + const desiredLines = lines.slice(startLine - 1, endLine).join('\n').trimEnd(); + + setResponse(response); + setCode(desiredLines); + } catch (error) { + console.error('Failed to fetch GitHub code:', error); + } + }; + + fetchCode(); + }, [owner, repo, branch, filePath, startLine, endLine]); + + const highlightedCode = ( + + {({ className, style, tokens, getLineProps, getTokenProps }) => ( +
+
+                        {tokens.map((line, i) => (
+                            
+ {/* uncomment for line numbers */} + {/* {i + 1} */} + {line.map((token, key) => ( + + ))} +
+ ))} +
+ { + response.data?.html_url ? Link to source code. : '' + } +
+ )} +
+ ) + + return highlightedCode; +}; + +export default GitHubCode; \ No newline at end of file diff --git a/noir/docs/src/components/HomepageFeatures/index.js b/noir/docs/src/components/HomepageFeatures/index.js new file mode 100644 index 00000000000..78f410ba688 --- /dev/null +++ b/noir/docs/src/components/HomepageFeatures/index.js @@ -0,0 +1,64 @@ +import React from 'react'; +import clsx from 'clsx'; +import styles from './styles.module.css'; + +const FeatureList = [ + { + title: 'Easy to Use', + Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, + description: ( + <> + Docusaurus was designed from the ground up to be easily installed and + used to get your website up and running quickly. + + ), + }, + { + title: 'Focus on What Matters', + Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default, + description: ( + <> + Docusaurus lets you focus on your docs, and we'll do the chores. Go + ahead and move your docs into the docs directory. + + ), + }, + { + title: 'Powered by React', + Svg: require('@site/static/img/undraw_docusaurus_react.svg').default, + description: ( + <> + Extend or customize your website layout by reusing React. Docusaurus can + be extended while reusing the same header and footer. + + ), + }, +]; + +function Feature({Svg, title, description}) { + return ( +
+
+ +
+
+

{title}

+

{description}

+
+
+ ); +} + +export default function HomepageFeatures() { + return ( +
+
+
+ {FeatureList.map((props, idx) => ( + + ))} +
+
+
+ ); +} diff --git a/noir/docs/src/components/HomepageFeatures/styles.module.css b/noir/docs/src/components/HomepageFeatures/styles.module.css new file mode 100644 index 00000000000..b248eb2e5de --- /dev/null +++ b/noir/docs/src/components/HomepageFeatures/styles.module.css @@ -0,0 +1,11 @@ +.features { + display: flex; + align-items: center; + padding: 2rem 0; + width: 100%; +} + +.featureSvg { + height: 200px; + width: 200px; +} diff --git a/noir/docs/src/components/Notes/_blackbox.mdx b/noir/docs/src/components/Notes/_blackbox.mdx new file mode 100644 index 00000000000..9fe9b48fbff --- /dev/null +++ b/noir/docs/src/components/Notes/_blackbox.mdx @@ -0,0 +1,5 @@ +:::info + +This is a black box function. Read [this section](../black_box_fns) to learn more about black box functions in Noir. + +::: \ No newline at end of file diff --git a/noir/docs/src/components/Notes/_experimental.mdx b/noir/docs/src/components/Notes/_experimental.mdx new file mode 100644 index 00000000000..da1b0826aa1 --- /dev/null +++ b/noir/docs/src/components/Notes/_experimental.mdx @@ -0,0 +1,6 @@ +:::caution + +This feature is experimental. You should expect it to change in future versions, +cause unexpected behavior, or simply not work at all. + +::: diff --git a/noir/docs/src/css/custom.css b/noir/docs/src/css/custom.css new file mode 100644 index 00000000000..c1faa9d3139 --- /dev/null +++ b/noir/docs/src/css/custom.css @@ -0,0 +1,70 @@ +/** + * Any CSS included here will be global. The classic template + * bundles Infima by default. Infima is a CSS framework designed to + * work well for content-centric websites. + */ + +/* You can override the default Infima variables here. */ +:root { + --ifm-color-primary: #9f3fff; + --ifm-color-primary-dark: #2f1f49; + --ifm-color-primary-darker: #2f1f49; + --ifm-color-primary-darkest: #2f1f49; + --ifm-color-primary-light: #9f3fff; + --ifm-color-primary-lighter: #9f3fff; + --ifm-color-primary-lightest: #9f3fff; + --search-local-highlight-color: #2f1f49; + --ifm-menu-color-background-active: #f6f8fa; + --ifm-code-font-size: 95%; + --ifm-breadcrumb-color-active: white; + --ifm-breadcrumb-item-background-active: #2f1f49; + --ifm-heading-color: #2f1f49; + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); +} + +/* For readability concerns, you should choose a lighter palette in dark mode. */ +[data-theme='dark'] { + --ifm-color-primary: #f5bda9; + --ifm-color-primary-dark: #f5bda9; + --ifm-color-primary-darker: #f5bda9; + --ifm-color-primary-darkest: #f5bda9; + --ifm-color-primary-light: #f5bda9; + --ifm-color-primary-lighter: #f5bda9; + --ifm-color-primary-lightest: #f5bda9; + + --ifm-heading-color: white; + --ifm-menu-color-background-active: #282a36; + --ifm-breadcrumb-color-active: #2f1f49; + --ifm-breadcrumb-item-background-active: #f5bda9; + + --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); +} + +html[data-theme='dark'] { + --search-local-highlight-color: #f5bda9; + --search-local-muted-color: white; + --search-local-hit-active-color: #1b1b1d; + --search-local-hit-color: white; +} + +[data-theme='dark'] .footer { + --ifm-footer-background-color: #282a36 + --ifm-footer-color: var(--ifm-footer-link-color); + --ifm-footer-link-color: var(--ifm-color-secondary); + --ifm-footer-title-color: var(--ifm-color-white); +} + +[data-theme='light'] .navbar { + background-color: #f6fbfc; +} + +[data-theme='light'] .footer { + --ifm-footer-background-color: #f6fbfc; + --ifm-footer-color: #2f1f49; + --ifm-footer-link-color: #2f1f49; + --ifm-footer-title-color: #2f1f49; +} + +.katex-html { + display: none; +} diff --git a/noir/docs/static/.nojekyll b/noir/docs/static/.nojekyll new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/docs/static/img/codelens_compile_execute.png b/noir/docs/static/img/codelens_compile_execute.png new file mode 100644 index 00000000000..040e3af2704 Binary files /dev/null and b/noir/docs/static/img/codelens_compile_execute.png differ diff --git a/noir/docs/static/img/codelens_run_test.png b/noir/docs/static/img/codelens_run_test.png new file mode 100644 index 00000000000..568869fb839 Binary files /dev/null and b/noir/docs/static/img/codelens_run_test.png differ diff --git a/noir/docs/static/img/codelens_testing_panel.png b/noir/docs/static/img/codelens_testing_panel.png new file mode 100644 index 00000000000..cec1708d405 Binary files /dev/null and b/noir/docs/static/img/codelens_testing_panel.png differ diff --git a/noir/docs/static/img/favicon.ico b/noir/docs/static/img/favicon.ico new file mode 100644 index 00000000000..1c85cef482e Binary files /dev/null and b/noir/docs/static/img/favicon.ico differ diff --git a/noir/docs/static/img/logo.svg b/noir/docs/static/img/logo.svg new file mode 100644 index 00000000000..8095d6a169d --- /dev/null +++ b/noir/docs/static/img/logo.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/noir/docs/static/img/logoDark.svg b/noir/docs/static/img/logoDark.svg new file mode 100644 index 00000000000..dee9f27a6a9 --- /dev/null +++ b/noir/docs/static/img/logoDark.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/noir/docs/static/img/noir_getting_started_1.png b/noir/docs/static/img/noir_getting_started_1.png new file mode 100644 index 00000000000..9de33296e91 Binary files /dev/null and b/noir/docs/static/img/noir_getting_started_1.png differ diff --git a/noir/docs/versioned_docs/version-v0.10.5/examples/merkle-proof.mdx b/noir/docs/versioned_docs/version-v0.10.5/examples/merkle-proof.mdx new file mode 100644 index 00000000000..6430780817c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/examples/merkle-proof.mdx @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[View an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.10.5/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.10.5/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..de30869732d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/getting_started/00_nargo_installation.md @@ -0,0 +1,285 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [TypeScript](../typescript). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Install via Nix](#option-3-install-via-nix) +- [Option 4: Compile from Source](#option-4-compile-from-source) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Windows (PowerShell) + +Open PowerShell as Administrator and run: + +```powershell +mkdir -f -p "$env:USERPROFILE\.nargo\bin\"; ` +Invoke-RestMethod -Method Get -Uri https://github.com/noir-lang/noir/releases/download/v0.4.1/nargo-x86_64-pc-windows-msvc.zip -Outfile "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip"; ` +Expand-Archive -Path "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip" -DestinationPath "$env:USERPROFILE\.nargo\bin\"; ` +$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"; ` +$OldPath = (Get-ItemProperty -Path "$Reg" -Name PATH).Path; ` +$NewPath = $OldPath + ’;’ + "$env:USERPROFILE\.nargo\bin\"; ` +Set-ItemProperty -Path "$Reg" -Name PATH –Value "$NewPath"; ` +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Install via Nix + +Due to the large number of native dependencies, Noir projects can be installed via [Nix](https://nixos.org/). + +#### Installing Nix + +For the best experience, please follow these instructions to setup Nix: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +#### Install Nargo into your Nix profile + +1. Use `nix profile` to install Nargo + +```sh +nix profile install github:noir-lang/noir +``` + +### Option 4: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). + 1. For bash or zshell, add `eval "$(direnv hook bash)"` or `eval "$(direnv hook zsh)"` to your ~/.bashrc or ~/.zshrc file, respectively. +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +[rust]: https://www.rust-lang.org/tools/install +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir +[homebrew]: https://brew.sh/ +[cmake]: https://cmake.org/install/ +[llvm]: https://llvm.org/docs/GettingStarted.html +[openmp]: https://openmp.llvm.org/ +[barretenberg]: https://github.com/AztecProtocol/barretenberg diff --git a/noir/docs/versioned_docs/version-v0.10.5/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.10.5/getting_started/01_hello_world.md new file mode 100644 index 00000000000..8b4416beba1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program: + +```sh +nargo prove +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`.proof`, where the project name is defined in Nargo.toml. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof by running: + +```sh +nargo verify +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.10.5/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.10.5/getting_started/02_breakdown.md new file mode 100644 index 00000000000..3fa3a35766b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/getting_started/02_breakdown.md @@ -0,0 +1,200 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +### Prover.toml + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +### Verifier.toml + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +### Nargo.toml + +_Nargo.toml_ contains the environmental options of your project. It contains a "package" section and a "dependencies" section. + +Example Nargo.toml: + +```toml +[package] +name = "noirstarter" +type = "bin" +authors = ["Alice"] +compiler_version = "0.9.0" +description = "Getting started with Noir" +entry = "circuit/main.nr" +license = "MIT" + +[dependencies] +ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"} +``` + +Nargo.toml for a [workspace](../modules_packages_crates/workspaces) will look a bit different. For example: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +#### Package section + +The package section requires a number of fields including: + +- `name` (**required**) - the name of the package +- `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract +- `authors` (optional) - authors of the project +- `compiler_version` (optional) - specifies the version of the compiler to use. This is not currently enforced by the compiler, but will be in future versions. +- `description` (optional) +- `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) +- `backend` (optional) +- `license` (optional) + +#### Dependencies section + +This is where you will specify any dependencies for your project. See the [Dependencies page](../modules_packages_crates/dependencies) for more info. + +`./proofs/` and `./contract/` directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory in a file called your-project.proof. So if your project is named "private_voting" (defined in the project Nargo.toml), the proof will be saved at `./proofs/private_voting.proof`. Opening this file will display the proof in hex format. + +#### Arrays of Structs + +The following code shows how to pass an array of structs to a Noir program to generate a proof. + +```rust +// main.nr +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} +``` + +Prover.toml: + +```toml +[[foos]] # foos[0] +bar = 0 +baz = 0 + +[[foos]] # foos[1] +bar = 0 +baz = 0 + +[[foos]] # foos[2] +bar = 1 +baz = 2 +``` + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates the proof and saves it at `./proofs/.proof`: + +```bash +nargo prove +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof and saves it at `./proofs/.proof`: + +```bash +nargo prove -p OtherProver +``` + +## Verifying a Proof + +When the command `nargo verify` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a proof file with the project name (eg. test_project.proof) + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. + +In the [next section](language_server), we will explain how to utilize the Noir Language Server. diff --git a/noir/docs/versioned_docs/version-v0.10.5/getting_started/03_language_server.md b/noir/docs/versioned_docs/version-v0.10.5/getting_started/03_language_server.md new file mode 100644 index 00000000000..49bd1d24675 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/getting_started/03_language_server.md @@ -0,0 +1,36 @@ +--- +title: Language Server +description: + Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: + [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +When you language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, execution, and tests: + +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) + +### Configuration + +* __Noir: Enable LSP__ - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +* __Noir: Nargo Flags__ - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +* __Noir: Nargo Path__ - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +* __Noir > Trace: Server__ - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.10.5/index.md b/noir/docs/versioned_docs/version-v0.10.5/index.md new file mode 100644 index 00000000000..e56b24bccd8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/index.md @@ -0,0 +1,103 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +This version of the book is being released with the public alpha. There will be a lot of features +that are missing in this version, however the syntax and the feel of the language will mostly be +completed. + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/01_functions.md new file mode 100644 index 00000000000..7cb43c4c5f2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/01_functions.md @@ -0,0 +1,99 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` + +## Lambdas + +Lambdas are anonymous functions. They follow the syntax of Rust - `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +See [Lambdas](./08_lambdas.md) for more details. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..691c514d9a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/02_control_flow.md @@ -0,0 +1,42 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/04_assert.md new file mode 100644 index 00000000000..a25a946123d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/04_assert.md @@ -0,0 +1,34 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. + +### Example + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +The above snippet compiles because `==` is a predicate operation. Conversely, the following will not +compile: + +```rust +// INCORRECT + +fn main(x : Field, y : Field) { + assert(x + y); +} +``` + +> The rationale behind this not compiling is due to ambiguity. It is not clear if the above should +> equate to `x + y == 0` or if it should check the truthiness of the result. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/05_unconstrained.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/05_unconstrained.md new file mode 100644 index 00000000000..6b621eda3eb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/05_unconstrained.md @@ -0,0 +1,96 @@ +--- +title: Unconstrained Functions +description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to." + +keywords: [Noir programming language, unconstrained, open] +--- + + + +Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation. + +## Why? + +Zero-knowledge (ZK) domain-specific languages (DSL) enable developers to generate ZK proofs from their programs by compiling code down to the constraints of an NP complete language (such as R1CS or PLONKish languages). However, the hard bounds of a constraint system can be very limiting to the functionality of a ZK DSL. + +Enabling a circuit language to perform unconstrained execution is a powerful tool. Said another way, unconstrained execution lets developers generate witnesses from code that does not generate any constraints. Being able to execute logic outside of a circuit is critical for both circuit performance and constructing proofs on information that is external to a circuit. + +Fetching information from somewhere external to a circuit can also be used to enable developers to improve circuit efficiency. + +A ZK DSL does not just prove computation, but proves that some computation was handled correctly. Thus, it is necessary that when we switch from performing some operation directly inside of a circuit to inside of an unconstrained environment that the appropriate constraints are still laid down elsewhere in the circuit. + +## Example + +An in depth example might help drive the point home. This example comes from the excellent [post](https://discord.com/channels/1113924620781883405/1124022445054111926/1128747641853972590) by Tom in the Noir Discord. + +Let's look at how we can optimize a function to turn a `u72` into an array of `u8`s. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u72 & 0xff) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 91 +Backend circuit size: 3619 +``` + +A lot of the operations in this function are optimized away by the compiler (all the bit-shifts turn into divisions by constants). However we can save a bunch of gates by casting to u8 a bit earlier. This automatically truncates the bit-shifted value to fit in a u8 which allows us to remove the XOR against 0xff. This saves us ~480 gates in total. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 75 +Backend circuit size: 3143 +``` + +Those are some nice savings already but we can do better. This code is all constrained so we're proving every step of calculating out using num, but we don't actually care about how we calculate this, just that it's correct. This is where brillig comes in. + +It turns out that truncating a u72 into a u8 is hard to do inside a snark, each time we do as u8 we lay down 4 ACIR opcodes which get converted into multiple gates. It's actually much easier to calculate num from out than the other way around. All we need to do is multiply each element of out by a constant and add them all together, both relatively easy operations inside a snark. + +We can then run u72_to_u8 as unconstrained brillig code in order to calculate out, then use that result in our constrained function and assert that if we were to do the reverse calculation we'd get back num. This looks a little like the below: + +```rust +fn main(num: u72) -> pub [u8; 8] { + let out = u72_to_u8(num); + + let mut reconstructed_num: u72 = 0; + for i in 0..8 { + reconstructed_num += (out[i] as u72 << (56 - (8 * i))); + } + assert(num == reconstructed_num); + out +} + +unconstrained fn u72_to_u8(num: u72) -> [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8))) as u8; + } + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 78 +Backend circuit size: 2902 +``` + +This ends up taking off another ~250 gates from our circuit! We've ended up with more ACIR opcodes than before but they're easier for the backend to prove (resulting in fewer gates). + +Generally we want to use brillig whenever there's something that's easy to verify but hard to compute within the circuit. For example, if you wanted to calculate a square root of a number it'll be a much better idea to calculate this in brillig and then assert that if you square the result you get back your number. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/06_generics.md new file mode 100644 index 00000000000..9fb4177c2a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/06_generics.md @@ -0,0 +1,113 @@ +--- +title: Generics +description: Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/07_mutability.md new file mode 100644 index 00000000000..4641521b1d9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/07_mutability.md @@ -0,0 +1,92 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a }; +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +:::warning + +The 'comptime' keyword was removed in version 0.10. The comptime keyword and syntax are currently still kept and parsed for backwards compatibility, but are now deprecated and will issue a warning when used. `comptime` has been removed because it is no longer needed for accessing arrays. + +::: + +## Globals + +Noir also supports global variables. However, they must be known at compile-time. The global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/08_lambdas.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/08_lambdas.md new file mode 100644 index 00000000000..ae1e6aecab1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/08_lambdas.md @@ -0,0 +1,80 @@ +--- +title: Lambdas +description: Learn how to use anonymous functions in Noir programming language. +keywords: [Noir programming language, lambda, closure, function, anonymous function] +--- + +## Introduction + +Lambdas are anonymous functions. The syntax is `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +A block can be used as the body of a lambda, allowing you to declare local variables inside it: + +```rust +let cool = || { + let x = 100; + let y = 100; + x + y +} + +assert(cool() == 200); +``` + +## Closures + +Inside the body of a lambda, you can use variables defined in the enclosing function. Such lambdas are called **closures**. In this example `x` is defined inside `main` and is accessed from within the lambda: + +```rust +fn main() { + let x = 100; + let closure = || x + 150; + assert(closure() == 250); +} +``` + +## Passing closures to higher-order functions + +It may catch you by surprise that the following code fails to compile: + +```rust +fn foo(f: fn () -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // error :( +} +``` + +The reason is that the closure's capture environment affects its type - we have a closure that captures two Fields and `foo` +expects a regular function as an argument - those are incompatible. +:::note + +Variables contained within the `||` are the closure's parameters, and the expression that follows it is the closure's body. The capture environment is comprised of any variables used in the closure's body that are not parameters. + +E.g. in |x| x + y, y would be a captured variable, but x would not be, since it is a parameter of the closure. + +::: +The syntax for the type of a closure is `fn[env](args) -> ret_type`, where `env` is the capture environment of the closure - +in this example that's `(Field, Field)`. + +The best solution in our case is to make `foo` generic over the environment type of its parameter, so that it can be called +with closures with any environment, as well as with regular functions: + +```rust +fn foo(f: fn[Env]() -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // compiles fine + assert(foo(|| 60) == 60); // compiles fine +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/09_comments.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/09_comments.md new file mode 100644 index 00000000000..3bb4d2f25a4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/09_comments.md @@ -0,0 +1,32 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir also supports multi-line block comments. Start a block comment with `/*` and end the block with `*/`. + +Noir does not natively support doc comments. You may be able to use [Rust doc comments](https://doc.rust-lang.org/reference/comments.html) in your code to leverage some Rust documentation build tools with Noir code. + +```rust +/* + This is a block comment describing a complex function. +*/ +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/10_distinct.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/10_distinct.md new file mode 100644 index 00000000000..e7ff7f5017a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/10_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `distinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/11_shadowing.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/11_shadowing.md new file mode 100644 index 00000000000..efd743e764f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/11_shadowing.md @@ -0,0 +1,43 @@ +--- +title: Shadowing +--- + +Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing. + +For example, the following function is valid in Noir: + +```rust +fn main() { + let x = 5; + + { + let x = x * 2; + assert (x == 10); + } + + assert (x == 5); +} +``` + +In this example, a variable x is first defined with the value 5. + +The local scope that follows shadows the original x, i.e. creates a local mutable x based on the value of the original x. It is given a value of 2 times the original x. + +When we return to the main scope, x once again refers to just the original x, which stays at the value of 5. + +## Temporal mutability + +One way that shadowing is useful, in addition to ergonomics across scopes, is for temporarily mutating variables. + +```rust +fn main() { + let age = 30; + // age = age + 5; // Would error as `age` is immutable by default. + + let mut age = age + 5; // Temporarily mutates `age` with a new value. + + let age = age; // Locks `age`'s mutability again. + + assert (age == 35); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types.md new file mode 100644 index 00000000000..d546cc463a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types.md @@ -0,0 +1,96 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Type Aliases + +A type alias is a new name for an existing type. Type aliases are declared with the keyword `type`: + +```rust +type Id = u8; + +fn main() { + let id: Id = 1; + let zero: u8 = 0; + assert(zero + 1 == id); +} +``` + +Type aliases can also be used with [generics](./06_generics.md): + +```rust +type Id = Size; + +fn main() { + let id: Id = 1; + let zero: u32 = 0; + assert(zero + 1 == id); +} +``` + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/00_fields.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/00_fields.md new file mode 100644 index 00000000000..658a0441ffb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/00_fields.md @@ -0,0 +1,165 @@ +--- +title: Fields +description: + Dive deep into the Field data type in Noir. Understand its methods, practical examples, and best practices to effectively use Fields in your Noir programs. +keywords: + [ + noir, + field type, + methods, + examples, + best practices, + ] +--- + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +## Methods + +After declaring a Field, you can use these common methods on it: + +### to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_le_bits(32); +} +``` + +### to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_be_bits(32); +} +``` + +### to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_le_bytes(4); +} +``` + +### to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_be_bytes(4); +} +``` + +### to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_le_radix(256, 4); +} +``` + +### to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_be_radix(256, 4); +} +``` + +### pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +### sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/01_integers.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/01_integers.md new file mode 100644 index 00000000000..d9c5e20e795 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/01_integers.md @@ -0,0 +1,33 @@ +--- +title: Integers +description: + Explore the Integer data type in Noir. Learn about its methods, see real-world examples, and grasp how to efficiently use Integers in your Noir code. +keywords: + [ + noir, + integer types, + methods, + examples, + arithmetic, + ] +--- + +An integer type is a range constrained field type. The Noir frontend currently supports unsigned, +arbitrary-sized integer types. + +An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by +its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of +$\\([0,2^{32}-1]\\)$: + +```rust +fn main(x : Field, y : u32) { + let z = x as u32 + y; +} +``` + +`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z` +are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created +will be rejected by the verifier. + +> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`) +> sized integer types. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/02_booleans.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/02_booleans.md new file mode 100644 index 00000000000..885db167d83 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/02_booleans.md @@ -0,0 +1,30 @@ +--- +title: Booleans +description: + Delve into the Boolean data type in Noir. Understand its methods, practical examples, and best practices for using Booleans in your Noir programs. +keywords: + [ + noir, + boolean type, + methods, + examples, + logical operations, + ] +--- + + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](../control_flow) and +[Assert Function](../assert) sections. diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/03_strings.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/03_strings.md new file mode 100644 index 00000000000..ee69853bfba --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/03_strings.md @@ -0,0 +1,43 @@ +--- +title: Strings +description: + Discover the String data type in Noir. Learn about its methods, see real-world examples, and understand how to effectively manipulate and use Strings in Noir. +keywords: + [ + noir, + string type, + methods, + examples, + concatenation, + ] +--- + + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. See more about [Logging](../../standard_library/logging). + +```rust +use dep::std; + +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +You can convert a `str` to a byte array by calling `as_bytes()` +or a vector by calling `as_bytes_vec()`. + +```rust +fn main() { + let message = "hello world"; + let message_bytes = message.as_bytes(); + let mut message_vec = message.as_bytes_vec(); + assert(message_bytes.len() == 11); + assert(message_bytes[0] == 104); + assert(message_bytes[0] == message_vec.get(0)); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/04_arrays.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/04_arrays.md new file mode 100644 index 00000000000..f826b39bf39 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/04_arrays.md @@ -0,0 +1,237 @@ +--- +title: Arrays +description: + Dive into the Array data type in Noir. Grasp its methods, practical examples, and best practices for efficiently using Arrays in your Noir code. +keywords: + [ + noir, + array type, + methods, + examples, + indexing, + ] +--- + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +You can instantiate a new array of a fixed size with the same value repeated for each element. The following example instantiates an array of length 32 where each element is of type Field and has the value 0. + +```rust +let array: [Field; 32] = [0; 32]; +``` + +Like in Rust, arrays in Noir are a fixed size. However, if you wish to convert an array to a [slice](./slices), you can just call `as_slice` on your array: + +```rust +let array: [Field; 32] = [0; 32]; +let sl = array.as_slice() +``` + +## Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for arrays: + +### len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + assert(array.len() == 2); +} +``` + +### sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32]; + let sorted = arr.sort(); + assert(sorted == [32, 42]); +} +``` + +### sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +### map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2); // b is now [2, 4, 6] +``` + +### fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2, 2, 2, 2, 2]; + let folded = arr.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +### reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let reduced = arr.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +### all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let all = arr.all(|a| a == 2); + assert(all); +} +``` + +### any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 5]; + let any = arr.any(|a| a == 5); + assert(any); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/05_slices.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/05_slices.md new file mode 100644 index 00000000000..bc7f5c531e7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/05_slices.md @@ -0,0 +1,157 @@ +--- +title: Slices +description: + Explore the Slice data type in Noir. Understand its methods, see real-world examples, and learn how to effectively use Slices in your Noir programs. +keywords: + [ + noir, + slice type, + methods, + examples, + subarrays, + ] +--- + +:::caution + +This feature is experimental. You should expect it to change in future versions, +cause unexpected behavior, or simply not work at all. + +::: + +A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. + +```rust +use dep::std::slice; + +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here]([test-file]. + +[test-file]: https://github.com/noir-lang/noir/blob/f387ec1475129732f72ba294877efdf6857135ac/crates/nargo_cli/tests/test_data_ssa_refactor/slices/src/main.nr + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for slices: + +### push_back + +Pushes a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice. + +```rust +fn push_back(_self: [T], _elem: T) -> [T] +``` + +example: + +```rust +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +### push_front + +Returns a new array with the specified element inserted at index 0. The existing elements indexes are incremented by 1. + +```rust +fn push_front(_self: Self, _elem: T) -> Self +``` + +Example: + +```rust +let mut new_slice: [Field] = []; +new_slice = new_slice.push_front(20); +assert(new_slice[0] == 20); // returns true +``` + +View the corresponding test file [here][test-file]. + +### pop_front + +Returns a tuple of two items, the first element of the array and the rest of the array. + +```rust +fn pop_front(_self: Self) -> (T, Self) +``` + +Example: + +```rust +let (first_elem, rest_of_slice) = slice.pop_front(); +``` + +View the corresponding test file [here][test-file]. + +### pop_back + +Returns a tuple of two items, the beginning of the array with the last element omitted and the last element. + +```rust +fn pop_back(_self: Self) -> (Self, T) +``` + +Example: + +```rust +let (popped_slice, last_elem) = slice.pop_back(); +``` + +View the corresponding test file [here][test-file]. + +### append + +Loops over a slice and adds it to the end of another. + +```rust +fn append(mut self, other: Self) -> Self +``` + +Example: + +```rust +let append = [1, 2].append([3, 4, 5]); +``` + +### insert + +Inserts an element at a specified index and shifts all following elements by 1. + +```rust +fn insert(_self: Self, _index: Field, _elem: T) -> Self +``` + +Example: + +```rust +new_slice = rest_of_slice.insert(2, 100); +assert(new_slice[2] == 100); +``` + +View the corresponding test file [here][test-file]. + +### remove + +Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element. + +```rust +fn remove(_self: Self, _index: Field) -> (Self, T) +``` + +Example: + +```rust +let (remove_slice, removed_elem) = slice.remove(3); +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/06_vectors.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/06_vectors.md new file mode 100644 index 00000000000..c5b74c877f8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/06_vectors.md @@ -0,0 +1,34 @@ +--- +title: Vectors +description: + Delve into the Vector data type in Noir. Learn about its methods, practical examples, and best practices for using Vectors in your Noir code. +keywords: + [ + noir, + vector type, + methods, + examples, + dynamic arrays, + ] +--- + +:::caution + +This feature is experimental. You should expect it to change in future versions, +cause unexpected behavior, or simply not work at all. + +::: + +A vector is a collection type similar to Rust's Vector type. It's convenient way to use slices as mutable arrays. + +Example: + +```rust +use dep::std::collections::vec::Vec; + +let mut vector: Vec = Vec::new(); +for i in 0..5 { + vector.push(i); +} +assert(vector.len() == 5); +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/07_tuples.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/07_tuples.md new file mode 100644 index 00000000000..5f6cab974a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/07_tuples.md @@ -0,0 +1,47 @@ +--- +title: Tuples +description: + Dive into the Tuple data type in Noir. Understand its methods, practical examples, and best practices for efficiently using Tuples in your Noir code. +keywords: + [ + noir, + tuple type, + methods, + examples, + multi-value containers, + ] +--- + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/08_structs.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/08_structs.md new file mode 100644 index 00000000000..85649dfb389 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/08_structs.md @@ -0,0 +1,73 @@ +--- +title: Structs +description: + Explore the Struct data type in Noir. Learn about its methods, see real-world examples, and grasp how to effectively define and use Structs in your Noir programs. +keywords: + [ + noir, + struct type, + methods, + examples, + data structures, + ] +--- + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. + +:::note +You can use Structs as inputs to the `main` function, but you can't output them +::: diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/09_references.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/09_references.md new file mode 100644 index 00000000000..b0c35ce2cb9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/09_references.md @@ -0,0 +1,22 @@ +--- +title: References +--- + +Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it. + +Example: + +```rust +fn main() { + let mut x = 2; + + // you can reference x as &mut and pass it to multiplyBy2 + multiplyBy2(&mut x); +} + +// you can access &mut here +fn multiplyBy2(x: &mut Field) { + // and dereference it with * + *x = *x * 2; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/10_function_types.md b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/10_function_types.md new file mode 100644 index 00000000000..1ec92efd594 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/language_concepts/data_types/10_function_types.md @@ -0,0 +1,25 @@ +--- +title: Function types +--- + +Noir supports higher-order functions. The syntax for a function type is as follows: + +```rust +fn(arg1_type, arg2_type, ...) -> return_type +``` + +Example: + +```rust +fn assert_returns_100(f: fn() -> Field) { // f takes no args and returns a Field + assert(f() == 100); +} + +fn main() { + assert_returns_100(|| 100); // ok + assert_returns_100(|| 150); // fails +} +``` + +A function type also has an optional capture environment - this is necessary to support closures. +See [Lambdas](../08_lambdas.md) for more details. diff --git a/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..fb83a33d94e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,42 @@ +--- +title: Crates and Packages +description: Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in several forms: binaries, libraries or contracts. + +#### Binaries + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +#### Libraries + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +#### Contracts + +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..9e6463801b7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/dependencies.md @@ -0,0 +1,123 @@ +--- +title: Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +If the module is in a subdirectory, you can define a subdirectory in your git repository, for example: + +```toml +# Nargo.toml + +[dependencies] +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +```tree +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +We don't have a way to consume libraries from inside a [workspace](./workspaces) as external dependencies right now. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/modules.md new file mode 100644 index 00000000000..147c9b284e8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree + +All modules are accessible from the `crate::` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` + +In the above snippet, if `bar` would like to use functions in `foo`, it can do so by `use crate::foo::function_name`. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/workspaces.md b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/workspaces.md new file mode 100644 index 00000000000..eaa09506698 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/modules_packages_crates/workspaces.md @@ -0,0 +1,39 @@ +--- +title: Workspaces +--- + +Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations. + +Each Noir project (with it's own Nargo.toml file) can be thought of as a package. Each package is expected to contain exactly one "named circuit", being the "name" defined in Nargo.toml with the program logic defined in `./src/main.nr`. + +For a project with the following structure: + +```tree +├── crates +│   ├── a +│   │   ├── Nargo.toml +│   │   └── src +│   │   └── main.nr +│   └── b +│   ├── Nargo.toml +│   └── src +│   └── main.nr +├── Nargo.toml +└── Prover.toml +``` + +You can define a workspace in Nargo.toml like so: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. + +`default-member` indicates which package various commands process by default. + +Libraries can be defined in a workspace. We just don't have a way to consume libraries from inside a workspace as external dependencies right now. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. diff --git a/noir/docs/versioned_docs/version-v0.10.5/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.10.5/nargo/01_commands.md new file mode 100644 index 00000000000..425a73a34c8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/nargo/01_commands.md @@ -0,0 +1,223 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +``` +Options: + --show-ssa Emit debug information for the intermediate SSA IR + --deny-warnings Quit execution when warnings are emitted + -h, --help Print help +``` + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +- `` - The subcommand whose help message to display + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +**Options** + +``` + --package The name of the package to check + --workspace Check all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +**Options** + +``` + --package The name of the package to codegen + --workspace Codegen all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo compile` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +You can also use "build" as an alias for compile (e.g. `nargo build`). + +**Options** + +``` + --include-keys Include Proving and Verification keys in the build artifacts + --package The name of the package to compile + --workspace Compile all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo new ` + +Creates a new Noir project in a new folder. + +**Arguments** + +``` + The path to save the new project +``` + +**Options** + +``` + --name Name of the package [default: package directory name] + --lib Use a library template + --bin Use a binary template [default] + --contract Use a contract template +-h, --help Print help +``` + +## `nargo init` + +Creates a new Noir project in the current directory. + +**Options** + +``` + --name Name of the package [default: current directory name] + --lib Use a library template + --bin Use a binary template [default] + --contract Use a contract template +-h, --help Print help +``` + +## `nargo execute [WITNESS_NAME]` + +Runs the Noir program and prints its return value. + +**Arguments** + +``` +[WITNESS_NAME] Write the execution witness to named file +``` + +**Options** + +``` +-p, --prover-name The name of the toml file which contains the inputs for the prover [default: Prover] + --package The name of the package to execute + --workspace Execute all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `WITNESS_NAME` argument. A +`.tr` file will then be saved in the `./target` folder. + +> **Info:** The `.tr` file is the witness file. The witness file can be considered as program inputs +> parsed for your program's ACIR. +> +> This file can be passed along with circuit's ACIR into a TypeScript project for proving and +> verification. See the [TypeScript](../typescript#proving-and-verifying-externally-compiled-files) +> section to learn more. + +## `nargo prove` + +Creates a proof for the program. + +**Options** + +``` +-p, --prover-name The name of the toml file which contains the inputs for the prover [default: Prover] +-v, --verifier-name The name of the toml file which contains the inputs for the verifier [default: Verifier] + --verify Verify proof after proving + --package The name of the package to prove + --workspace Prove all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo verify` + +Given a proof and a program, verify whether the proof is valid. + +**Options** + +``` +-v, --verifier-name The name of the toml file which contains the inputs for the verifier [default: Verifier] + --package The name of the package verify + --workspace Verify all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo test [TEST_NAME]` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. To print `println` statements in tests, use the `--show-output` flag. + +Takes an optional `--exact` flag which allows you to select tests based on an exact name. + +See an example on the [testing page](./testing). + +**Options** + +``` + --show-output Display output of `println` statements + --exact Only run tests that match exactly + --package The name of the package to test + --workspace Test all packages in the workspace + --print-acir Display the ACIR for compiled circuit + --deny-warnings Treat all warnings as errors +-h, --help Print help +``` + +## `nargo info` + +Prints a table containing the information of the package. + +Currently the table provide + +1. The number of ACIR opcodes +2. The final number gates in the circuit used by a backend + +If the file contains a contract the table will provide the +above information about each function of the contract. + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). diff --git a/noir/docs/versioned_docs/version-v0.10.5/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.10.5/nargo/02_testing.md new file mode 100644 index 00000000000..106952c44c0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/nargo/02_testing.md @@ -0,0 +1,42 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +### Test fail + +You can write tests that are expected to fail by using the decorator `#[test(should_fail)]`. For example: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test(should_fail)] +fn test_add() { + assert(add(2,2) == 5); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.10.5/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/black_box_fns.md new file mode 100644 index 00000000000..c758846b688 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/black_box_fns.md @@ -0,0 +1,45 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen](./cryptographic_primitives/hashes#pedersen) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..1d9b1c7f09c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,146 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::pedersen(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..62265cddb1e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,33 @@ +--- +title: Scalar multiplication +description: + See how you can perform scalar multiplications over a fixed base in Noir +keywords: + [ + cryptographic primitives, + Noir project, + scalar multiplication, + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## scalar_mul::fixed_base + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..0e219c0e5ff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..3934a0338d0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..8f060ed3316 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/common/_blackbox.mdx b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/common/_blackbox.mdx new file mode 100644 index 00000000000..9fe9b48fbff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/cryptographic_primitives/common/_blackbox.mdx @@ -0,0 +1,5 @@ +:::info + +This is a black box function. Read [this section](../black_box_fns) to learn more about black box functions in Noir. + +::: \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/logging.md new file mode 100644 index 00000000000..7e2fd9b9aff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/logging.md @@ -0,0 +1,62 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +You can print the output of println statements in your Noir code by using the `nargo execute` command or the `--show-output` flag when using `nargo test` (provided there are println statements in your tests). + +It is recommended to use `nargo execute` if you want to debug failing constrains with `println` statements. This is due to every input in a test being a constant rather than a witness, so we issue an error during compilation while we only print during execution (which comes after compilation). `println` will not work for failed constraints caught at compile time. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` + +You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character: + +```rust + let fmt_str = f"i: {i}, j: {j}"; + std::println(fmt_str); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"i: {i}, s: {s}"); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); +``` diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/merkle_trees.md new file mode 100644 index 00000000000..57d8c4a9e4f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/options.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/options.md new file mode 100644 index 00000000000..3d3139fb98b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/options.md @@ -0,0 +1,99 @@ +--- +title: Option Type +--- + +The `Option` type is a way to express that a value might be present (`Some(T))` or absent (`None`). It's a safer way to handle potential absence of values, compared to using nulls in many other languages. + +```rust +struct Option { + None, + Some(T), +} +``` + +You can import the Option type into your Noir program like so: + +```rust +use dep::std::option::Option; + +fn main() { + let none = Option::none(); + let some = Option::some(3); +} +``` + +See [this test](https://github.com/noir-lang/noir/blob/5cbfb9c4a06c8865c98ff2b594464b037d821a5c/crates/nargo_cli/tests/test_data/option/src/main.nr) for a more comprehensive set of examples of each of the methods described below. + +## Methods + +### none + +Constructs a none value. + +### some + +Constructs a some wrapper around a given value. + +### is_none + +Returns true if the Option is None. + +### is_some + +Returns true of the Option is Some. + +### unwrap + +Asserts `self.is_some()` and returns the wrapped value. + +### unwrap_unchecked + +Returns the inner value without asserting `self.is_some()`. This method can be useful within an if condition when we already know that `option.is_some()`. If the option is None, there is no guarantee what value will be returned, only that it will be of type T for an `Option`. + +### unwrap_or + +Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + +### unwrap_or_else + +Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return a default value. + +### map + +If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + +### map_or + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + +### map_or_else + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + +### and + +Returns None if self is None. Otherwise, this returns `other`. + +### and_then + +If self is None, this returns None. Otherwise, this calls the given function with the Some value contained within self, and returns the result of that call. In some languages this function is called `flat_map` or `bind`. + +### or + +If self is Some, return self. Otherwise, return `other`. + +### or_else + +If self is Some, return self. Otherwise, return `default()`. + +### xor + +If only one of the two Options is Some, return that option. Otherwise, if both options are Some or both are None, None is returned. + +### filter + +Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. Otherwise, this returns `None`. + +### flatten + +Flattens an `Option>` into a `Option`. This returns `None` if the outer Option is None. Otherwise, this returns the inner Option. diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/recursion.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/recursion.md new file mode 100644 index 00000000000..ff4c63acaa7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). diff --git a/noir/docs/versioned_docs/version-v0.10.5/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.10.5/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.10.5/typescript.md b/noir/docs/versioned_docs/version-v0.10.5/typescript.md new file mode 100644 index 00000000000..258a2160e92 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.10.5/typescript.md @@ -0,0 +1,237 @@ +--- +title: Working with TypeScript +description: + Learn how to interact with Noir programs using TypeScript. Follow this tutorial to compile your + program, specify inputs, initialize a prover & verifier, and prove and verify your program. +keywords: [TypeScript, Noir, tutorial, compile, inputs, prover, verifier, proof] +--- + +Interactions with Noir programs can also be performed in TypeScript, which can come in handy when +writing tests or when working in TypeScript-based projects like [Hardhat](https://hardhat.org/). + +You can check the complete code for this tutorial here: [browser with next.js](https://github.com/signorecello/noir-min-browser-example) and [node.js](https://github.com/signorecello/noir-min-nodejs-example). If you want just a browser boilerplate to start with, check out the [noir-starter](https://github.com/noir-lang/noir-starter) for an example implementation. + +:::note + +You may find unexpected errors working with some frameworks such as `vite`. This is due to the +nature of `wasm` files and the way Noir uses web workers. As we figure it out, we suggest using +[Create React App](https://create-react-app.dev/), or [Next.js](https://nextjs.org/) for a quick +start. + +::: + +## Setup + +Make sure you are using Noir version >= 0.10.1. + +You can check your current version by running `nargo --version`. + +See the [Installation page](./getting_started/nargo_installation) for more info. + +We're assuming you're using ES6 and ESM for both browser (for example with React), or nodejs. Install [Node.js](https://nodejs.org/en). Init a new project with `npm init` and add `"type": "module"` to your `package.json`, to let `node` know we're using the new ESM sytem: + +```json +{ + "type": "module" + // the rest of your package.json +} +``` + +Install Noir dependencies in your project by running: + +```bash +npm i @aztec/bb.js@0.3.6 https://git@github.com/noir-lang/acvm-simulator-wasm.git#b9d9ca9dfc5140839f23998d9466307215607c42 fflate ethers@5.7.2 +``` + +This will install the `acvm-simulator` that will generate our witness, and the proving backend barretenberg `bb.js`. + +We're also installing `ethers` because we're too lazy to write a function that pads public inputs with 32bytes, and `fflate` to help us decompress our circuit bytecode. + +Since we're with typescript and using `nodejs` types, we also recommend to install the `@types/node` package, otherwise your IDE will scream at you. + +```bash +npm i --save-dev @types/node +``` + +:::note + +While Noir is in rapid development, some packages could interfere with others. For that reason, you +should use these specified versions. Let us know if for some reason you need to use other ones. + +::: + +As for the circuit, run `nargo init` to create a new Noir project. + +We will use a Standard Noir Example and place it in the `src` folder. This program simply multiplies input `x` with input `y` and returns the result `z`. The verifier doesn't know the value of `x`: we're proving that we know it without making it public. + +```rust +// src/main.nr +fn main(x: u32, y: pub u32) -> pub u32 { + let z = x * y; + z +} +``` + +One valid scenario for proving could be `x = 3`, `y = 4` and `return = 12` + +## Compiling + +In order to start proving, we need to compile our circuit into the intermediate representation used by our backend. As of today, you have to do that with `nargo`. Just hop to your circuits folder and run `nargo compile`. + +:::info + +At this time, you need to use a nightly version of nargo. Using [noirup](./getting_started/00_nargo_installation.md#option-1-noirup) you can do this simply by running `noirup -n`. + +::: + +You should have a `json` file in `target/` with your circuit's bytecode. The json file is name based on the project name specified in Nargo.toml, so for a project named "test", it will be at `target/test.json`. You can then import that file normally. + +```ts +import circuit from '../target/test.json' assert { type: 'json' }; +``` + +## Decompressing the circuit + +The compiled circuit comes compressed. We need to decompress it, that's where `fflate` comes in. + +```ts +import { decompressSync } from 'fflate'; + +const acirBuffer = Buffer.from(circuit.bytecode, 'base64'); +const acirBufferUncompressed = decompressSync(acirBuffer); +``` + +From here, it's highly recommended you store `acirBuffer` and `acirBufferUncompressed` close by, as they will be used for witness generation and proving. + +## Initializing ACVM and BB.JS + +:::note + +This step will eventually be abstracted away as Noir tooling matures. For now, you should be fine just literally copy-pasting most of this into your own code. + +::: + +Before proving, `bb.js` needs to be initialized. We need to import some functions and use them + +```ts +import { Crs, newBarretenbergApiAsync, RawBuffer } from '@aztec/bb.js/dest/node/index.js'; + +const api = await newBarretenbergApiAsync(4); + +const [exact, circuitSize, subgroup] = await api.acirGetCircuitSizes(acirBufferUncompressed); +const subgroupSize = Math.pow(2, Math.ceil(Math.log2(circuitSize))); +const crs = await Crs.new(subgroupSize + 1); +await api.commonInitSlabAllocator(subgroupSize); +await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data())); + +const acirComposer = await api.acirNewAcirComposer(subgroupSize); +``` + +We should take two very useful objects from here: `api` and `acirComposer`. Make sure to keep these close by! + +:::info + +On the browser, you also need to init the ACVM. You can do that by importing it and calling it like: + +```ts +import initACVM, { executeCircuit, compressWitness } from '@noir-lang/acvm_js'; + +await initACVM(); +// the rest of your code +``` + +::: + +## Generating witnesses + +Witness generation is what allows us to prove with arbitrary inputs (like user inputs on a form, game, etc). In this example, our input is a simple object with our circuit inputs `x`, `y`, and return `z` (fun fact: the return value in Noir is actually a public input!). We're wrapping it in a function, so it can be conveniently called later on. + +```ts +import { ethers } from 'ethers'; // I'm lazy so I'm using ethers to pad my input +import { executeCircuit, compressWitness } from '@noir-lang/acvm_js'; + +async function generateWitness(input: any, acirBuffer: Buffer): Promise { + const initialWitness = new Map(); + initialWitness.set(1, ethers.utils.hexZeroPad(`0x${input.x.toString(16)}`, 32)); + initialWitness.set(2, ethers.utils.hexZeroPad(`0x${input.y.toString(16)}`, 32)); + + const witnessMap = await executeCircuit(acirBuffer, initialWitness, () => { + throw Error('unexpected oracle'); + }); + + const witnessBuff = compressWitness(witnessMap); + return witnessBuff; +} +``` + +## Proving + +Finally, we're ready to prove with our backend. Just like with the witness generation, could be useful to wrap it in its own function: + +```ts +async function generateProof(witness: Uint8Array) { + const proof = await api.acirCreateProof( + acirComposer, + acirBufferUncompressed, + decompressSync(witness), + false, + ); + return proof; +} +``` + +## Verifying + +Our backend should also be ready to verify our proof: + +```ts +async function verifyProof(proof: Uint8Array) { + await api.acirInitProvingKey(acirComposer, acirBufferUncompressed); + const verified = await api.acirVerifyProof(acirComposer, proof, false); + return verified; +} +``` + +## Now for the fun part + +Let's call our functions, and destroy our API! + +```ts +const input = { x: 3, y: 4 }; +const witness = await generateWitness(input, acirBuffer); +console.log('Witness generated!'); +const proof = await generateProof(witness); +console.log('Proof generated!'); +await verifyProof(proof); +console.log('Proof verified!'); +api.destroy(); +``` + +You can use [this](https://gist.github.com/critesjosh/6f3ba19fdc9298b24e90ba4f736247dc) tsconfig.json. You can see the script [here](https://gist.github.com/critesjosh/4aa36e87a0cc3f09feaf1febb4d11348). + +## Verifying with Smart Contract + +Alternatively, a verifier smart contract can be generated and used for verifying Noir proofs in +TypeScript as well. + +This could be useful if the Noir program is designed to be decentrally verified and/or make use of +decentralized states and logics that is handled at the smart contract level. + +This assumes you've already ran `nargo codegen-verifier`, got your smart contract, and deployed it with Hardhat, Foundry, or your tool of choice. You can then verify a Noir proof by simply calling it. + +Currently, `bb.js` appends the public inputs to the proof. However, these inputs need to be fed separately to the verifier contract. A simple solution is to just slice them from the resulting proof, like this: + +```ts +import { ethers } from 'ethers'; // example using ethers v5 +import artifacts from '../artifacts/circuits/contract/plonk_vk.sol/UltraVerifier.json'; // I compiled using Hardhat, so I'm getting my abi from here + +const verifierAddress = '0x123455'; // your verifier address +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = this.provider.getSigner(); + +const contract = new ethers.Contract(verifierAddress, artifacts.abi, signer); + +const publicInputs = proof.slice(0, 32); +const slicedProof = proof.slice(32); +await contract.verify(slicedProof, [publicInputs]); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/examples/merkle-proof.mdx b/noir/docs/versioned_docs/version-v0.17.0/examples/merkle-proof.mdx new file mode 100644 index 00000000000..6430780817c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/examples/merkle-proof.mdx @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[View an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.17.0/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.17.0/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..4ff5fc46334 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/getting_started/00_nargo_installation.md @@ -0,0 +1,249 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [NoirJS](../noir_js/noir_js.md). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Compile from Source](#option-3-compile-from-source) +- [Option 4: WSL for Windows](#option-4-wsl-for-windows) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. It helps mitigating ssues commonly associated with dependency management, such as conflicts between required package versions for different projects (often referred to as "dependency hell"). + +Combined with direnv, which automatically sets or unsets environment variables based on the directory, it further simplifies the development process by seamlessly integrating with the developer's shell, facilitating an efficient and reliable workflow for managing and deploying Noir projects with multiple dependencies. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). + 1. For bash or zshell, add `eval "$(direnv hook bash)"` or `eval "$(direnv hook zsh)"` to your ~/.bashrc or ~/.zshrc file, respectively. +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +### Option 4: WSL (for Windows) + +Windows is not directly supported at this time. To install Noir on a Windows machine, it is recommended to use WSL. + +Step 1: Follow the instructions [here](https://learn.microsoft.com/en-us/windows/wsl/install) to install and run WSL. + +step 2: Follow the [Noirup instructions](#option-1-noirup). + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir diff --git a/noir/docs/versioned_docs/version-v0.17.0/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.17.0/getting_started/01_hello_world.md new file mode 100644 index 00000000000..8b4416beba1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program: + +```sh +nargo prove +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`.proof`, where the project name is defined in Nargo.toml. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof by running: + +```sh +nargo verify +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.17.0/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.17.0/getting_started/02_breakdown.md new file mode 100644 index 00000000000..bc0e742fb4e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/getting_started/02_breakdown.md @@ -0,0 +1,198 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +### Prover.toml + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +### Verifier.toml + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +### Nargo.toml + +_Nargo.toml_ contains the environmental options of your project. It contains a "package" section and a "dependencies" section. + +Example Nargo.toml: + +```toml +[package] +name = "noirstarter" +type = "bin" +authors = ["Alice"] +compiler_version = "0.9.0" +description = "Getting started with Noir" +entry = "circuit/main.nr" +license = "MIT" + +[dependencies] +ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"} +``` + +Nargo.toml for a [workspace](../modules_packages_crates/workspaces) will look a bit different. For example: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +#### Package section + +The package section requires a number of fields including: + +- `name` (**required**) - the name of the package +- `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract +- `authors` (optional) - authors of the project +- `compiler_version` (optional) - specifies the version of the compiler to use. This is not currently enforced by the compiler, but will be in future versions. +- `description` (optional) +- `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) +- `backend` (optional) +- `license` (optional) + +#### Dependencies section + +This is where you will specify any dependencies for your project. See the [Dependencies page](../modules_packages_crates/dependencies) for more info. + +`./proofs/` and `./contract/` directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory in a file called your-project.proof. So if your project is named "private_voting" (defined in the project Nargo.toml), the proof will be saved at `./proofs/private_voting.proof`. Opening this file will display the proof in hex format. + +#### Arrays of Structs + +The following code shows how to pass an array of structs to a Noir program to generate a proof. + +```rust +// main.nr +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} +``` + +Prover.toml: + +```toml +[[foos]] # foos[0] +bar = 0 +baz = 0 + +[[foos]] # foos[1] +bar = 0 +baz = 0 + +[[foos]] # foos[2] +bar = 1 +baz = 2 +``` + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates the proof and saves it at `./proofs/.proof`: + +```bash +nargo prove +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof and saves it at `./proofs/.proof`: + +```bash +nargo prove -p OtherProver +``` + +## Verifying a Proof + +When the command `nargo verify` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a proof file with the project name (eg. test_project.proof) + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. diff --git a/noir/docs/versioned_docs/version-v0.17.0/index.md b/noir/docs/versioned_docs/version-v0.17.0/index.md new file mode 100644 index 00000000000..9ebe1d54944 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/index.md @@ -0,0 +1,99 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/01_functions.md new file mode 100644 index 00000000000..47cdea0cf04 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/01_functions.md @@ -0,0 +1,225 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +By default, functions are visible only within the package they are defined. To make them visible outside of that package (for example, as part of a [library](../modules_packages_crates/crates_and_packages.md#libraries)), you should mark them as `pub`: + +```rust +pub fn foo() {} +``` + +You can also restrict the visibility of the function to only the crate it was defined in, by specifying `pub(crate)`: + +```rust +pub(crate) fn foo() {} //foo can only be called within its crate +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Main function + +If you're writing a binary, the `main` function is the starting point of your program. You can pass all types of expressions to it, as long as they have a fixed size at compile time: + +```rust +fn main(x : Field) // this is fine: passing a Field +fn main(x : [Field; 2]) // this is also fine: passing a Field with known size at compile-time +fn main(x : (Field, bool)) // 👌: passing a (Field, bool) tuple means size 2 +fn main(x : str<5>) // this is fine, as long as you pass a string of size 5 + +fn main(x : Vec) // can't compile, has variable size +fn main(x : [Field]) // can't compile, has variable size +fn main(....// i think you got it by now +``` + +Keep in mind [tests](../nargo/02_testing.md) don't differentiate between `main` and any other function. The following snippet passes tests, but won't compile or prove: + +```rust +fn main(x : [Field]) { + assert(x[0] == 1); +} + +#[test] +fn test_one() { + main([1, 2]); +} +``` + +```bash +$ nargo test +[testing] Running 1 test functions +[testing] Testing test_one... ok +[testing] All tests passed + +$ nargo check +The application panicked (crashed). +Message: Cannot have variable sized arrays as a parameter to main +``` + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` + +It is also possible to specialize which method is chosen depending on the [generic](./06_generics.md) type that is used. In this example, the `foo` function returns different values depending on its type: + +```rust +struct Foo {} + +impl Foo { + fn foo(self) -> Field { 1 } +} + +impl Foo { + fn foo(self) -> Field { 2 } +} + +fn main() { + let f1: Foo = Foo{}; + let f2: Foo = Foo{}; + assert(f1.foo() + f2.foo() == 3); +} +``` + +Also note that impls with the same method name defined in them cannot overlap. For example, if we already have `foo` defined for `Foo` and `Foo` like we do above, we cannot also define `foo` in an `impl Foo` since it would be ambiguous which version of `foo` to choose. + +```rust +// Including this impl in the same project as the above snippet would +// cause an overlapping impls error +impl Foo { + fn foo(self) -> Field { 3 } +} +``` + +## Lambdas + +Lambdas are anonymous functions. They follow the syntax of Rust - `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +See [Lambdas](./08_lambdas.md) for more details. + +## Attributes + +Attributes are metadata that can be applied to a function, using the following syntax: `#[attribute(value)]`. + +Supported attributes include: + +- **builtin**: the function is implemented by the compiler, for efficiency purposes. +- **deprecated**: mark the function as _deprecated_. Calling the function will generate a warning: `warning: use of deprecated function` +- **field**: Used to enable conditional compilation of code depending on the field size. See below for more details +- **oracle**: mark the function as _oracle_; meaning it is an external unconstrained function, implemented in noir_js. See [Unconstrained](./05_unconstrained.md) and [NoirJS](../noir_js/noir_js.md) for more details. +- **test**: mark the function as unit tests. See [Tests](../nargo/02_testing.md) for more details + +### Field Attribute + +The field attribute defines which field the function is compatible for. The function is conditionally compiled, under the condition that the field attribute matches the Noir native field. +The field can be defined implicitly, by using the name of the elliptic curve usually associated to it - for instance bn254, bls12_381 - or explicitly by using the field (prime) order, in decimal or hexadecimal form. +As a result, it is possible to define multiple versions of a function with each version specialized for a different field attribute. This can be useful when a function requires different parameters depending on the underlying elliptic curve. + +Example: we define the function `foo()` three times below. Once for the default Noir bn254 curve, once for the field $\mathbb F_{23}$, which will normally never be used by Noir, and once again for the bls12_381 curve. + +```rust +#[field(bn254)] +fn foo() -> u32 { + 1 +} + +#[field(23)] +fn foo() -> u32 { + 2 +} + +// This commented code would not compile as foo would be defined twice because it is the same field as bn254 +// #[field(21888242871839275222246405745257275088548364400416034343698204186575808495617)] +// fn foo() -> u32 { +// 2 +// } + +#[field(bls12_381)] +fn foo() -> u32 { + 3 +} +``` + +If the field name is not known to Noir, it will discard the function. Field names are case insensitive. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..a7f85360197 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/02_control_flow.md @@ -0,0 +1,44 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +The index for loops is of type `u64`. + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/04_assert.md new file mode 100644 index 00000000000..7427ec6cc63 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/04_assert.md @@ -0,0 +1,26 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. Example: + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +You can optionally provide a message to be logged when the assertion fails: + +```rust +assert(x == y, "x and y are not equal"); +``` + +> Assertions only work for predicate operations, such as `==`. If there's any ambiguity on the operation, the program will fail to compile. For example, it is unclear if `assert(x + y)` would check for `x + y == 0` or simply would return `true`. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/05_unconstrained.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/05_unconstrained.md new file mode 100644 index 00000000000..6b621eda3eb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/05_unconstrained.md @@ -0,0 +1,96 @@ +--- +title: Unconstrained Functions +description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to." + +keywords: [Noir programming language, unconstrained, open] +--- + + + +Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation. + +## Why? + +Zero-knowledge (ZK) domain-specific languages (DSL) enable developers to generate ZK proofs from their programs by compiling code down to the constraints of an NP complete language (such as R1CS or PLONKish languages). However, the hard bounds of a constraint system can be very limiting to the functionality of a ZK DSL. + +Enabling a circuit language to perform unconstrained execution is a powerful tool. Said another way, unconstrained execution lets developers generate witnesses from code that does not generate any constraints. Being able to execute logic outside of a circuit is critical for both circuit performance and constructing proofs on information that is external to a circuit. + +Fetching information from somewhere external to a circuit can also be used to enable developers to improve circuit efficiency. + +A ZK DSL does not just prove computation, but proves that some computation was handled correctly. Thus, it is necessary that when we switch from performing some operation directly inside of a circuit to inside of an unconstrained environment that the appropriate constraints are still laid down elsewhere in the circuit. + +## Example + +An in depth example might help drive the point home. This example comes from the excellent [post](https://discord.com/channels/1113924620781883405/1124022445054111926/1128747641853972590) by Tom in the Noir Discord. + +Let's look at how we can optimize a function to turn a `u72` into an array of `u8`s. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u72 & 0xff) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 91 +Backend circuit size: 3619 +``` + +A lot of the operations in this function are optimized away by the compiler (all the bit-shifts turn into divisions by constants). However we can save a bunch of gates by casting to u8 a bit earlier. This automatically truncates the bit-shifted value to fit in a u8 which allows us to remove the XOR against 0xff. This saves us ~480 gates in total. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 75 +Backend circuit size: 3143 +``` + +Those are some nice savings already but we can do better. This code is all constrained so we're proving every step of calculating out using num, but we don't actually care about how we calculate this, just that it's correct. This is where brillig comes in. + +It turns out that truncating a u72 into a u8 is hard to do inside a snark, each time we do as u8 we lay down 4 ACIR opcodes which get converted into multiple gates. It's actually much easier to calculate num from out than the other way around. All we need to do is multiply each element of out by a constant and add them all together, both relatively easy operations inside a snark. + +We can then run u72_to_u8 as unconstrained brillig code in order to calculate out, then use that result in our constrained function and assert that if we were to do the reverse calculation we'd get back num. This looks a little like the below: + +```rust +fn main(num: u72) -> pub [u8; 8] { + let out = u72_to_u8(num); + + let mut reconstructed_num: u72 = 0; + for i in 0..8 { + reconstructed_num += (out[i] as u72 << (56 - (8 * i))); + } + assert(num == reconstructed_num); + out +} + +unconstrained fn u72_to_u8(num: u72) -> [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8))) as u8; + } + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 78 +Backend circuit size: 2902 +``` + +This ends up taking off another ~250 gates from our circuit! We've ended up with more ACIR opcodes than before but they're easier for the backend to prove (resulting in fewer gates). + +Generally we want to use brillig whenever there's something that's easy to verify but hard to compute within the circuit. For example, if you wanted to calculate a square root of a number it'll be a much better idea to calculate this in brillig and then assert that if you square the result you get back your number. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/06_generics.md new file mode 100644 index 00000000000..9fb4177c2a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/06_generics.md @@ -0,0 +1,113 @@ +--- +title: Generics +description: Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/07_mutability.md new file mode 100644 index 00000000000..4641521b1d9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/07_mutability.md @@ -0,0 +1,92 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a }; +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +:::warning + +The 'comptime' keyword was removed in version 0.10. The comptime keyword and syntax are currently still kept and parsed for backwards compatibility, but are now deprecated and will issue a warning when used. `comptime` has been removed because it is no longer needed for accessing arrays. + +::: + +## Globals + +Noir also supports global variables. However, they must be known at compile-time. The global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/08_lambdas.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/08_lambdas.md new file mode 100644 index 00000000000..ae1e6aecab1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/08_lambdas.md @@ -0,0 +1,80 @@ +--- +title: Lambdas +description: Learn how to use anonymous functions in Noir programming language. +keywords: [Noir programming language, lambda, closure, function, anonymous function] +--- + +## Introduction + +Lambdas are anonymous functions. The syntax is `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +A block can be used as the body of a lambda, allowing you to declare local variables inside it: + +```rust +let cool = || { + let x = 100; + let y = 100; + x + y +} + +assert(cool() == 200); +``` + +## Closures + +Inside the body of a lambda, you can use variables defined in the enclosing function. Such lambdas are called **closures**. In this example `x` is defined inside `main` and is accessed from within the lambda: + +```rust +fn main() { + let x = 100; + let closure = || x + 150; + assert(closure() == 250); +} +``` + +## Passing closures to higher-order functions + +It may catch you by surprise that the following code fails to compile: + +```rust +fn foo(f: fn () -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // error :( +} +``` + +The reason is that the closure's capture environment affects its type - we have a closure that captures two Fields and `foo` +expects a regular function as an argument - those are incompatible. +:::note + +Variables contained within the `||` are the closure's parameters, and the expression that follows it is the closure's body. The capture environment is comprised of any variables used in the closure's body that are not parameters. + +E.g. in |x| x + y, y would be a captured variable, but x would not be, since it is a parameter of the closure. + +::: +The syntax for the type of a closure is `fn[env](args) -> ret_type`, where `env` is the capture environment of the closure - +in this example that's `(Field, Field)`. + +The best solution in our case is to make `foo` generic over the environment type of its parameter, so that it can be called +with closures with any environment, as well as with regular functions: + +```rust +fn foo(f: fn[Env]() -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // compiles fine + assert(foo(|| 60) == 60); // compiles fine +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/09_comments.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/09_comments.md new file mode 100644 index 00000000000..3bb4d2f25a4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/09_comments.md @@ -0,0 +1,32 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir also supports multi-line block comments. Start a block comment with `/*` and end the block with `*/`. + +Noir does not natively support doc comments. You may be able to use [Rust doc comments](https://doc.rust-lang.org/reference/comments.html) in your code to leverage some Rust documentation build tools with Noir code. + +```rust +/* + This is a block comment describing a complex function. +*/ +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/10_distinct.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/10_distinct.md new file mode 100644 index 00000000000..e7ff7f5017a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/10_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `distinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/11_shadowing.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/11_shadowing.md new file mode 100644 index 00000000000..efd743e764f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/11_shadowing.md @@ -0,0 +1,43 @@ +--- +title: Shadowing +--- + +Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing. + +For example, the following function is valid in Noir: + +```rust +fn main() { + let x = 5; + + { + let x = x * 2; + assert (x == 10); + } + + assert (x == 5); +} +``` + +In this example, a variable x is first defined with the value 5. + +The local scope that follows shadows the original x, i.e. creates a local mutable x based on the value of the original x. It is given a value of 2 times the original x. + +When we return to the main scope, x once again refers to just the original x, which stays at the value of 5. + +## Temporal mutability + +One way that shadowing is useful, in addition to ergonomics across scopes, is for temporarily mutating variables. + +```rust +fn main() { + let age = 30; + // age = age + 5; // Would error as `age` is immutable by default. + + let mut age = age + 5; // Temporarily mutates `age` with a new value. + + let age = age; // Locks `age`'s mutability again. + + assert (age == 35); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types.md new file mode 100644 index 00000000000..d546cc463a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types.md @@ -0,0 +1,96 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Type Aliases + +A type alias is a new name for an existing type. Type aliases are declared with the keyword `type`: + +```rust +type Id = u8; + +fn main() { + let id: Id = 1; + let zero: u8 = 0; + assert(zero + 1 == id); +} +``` + +Type aliases can also be used with [generics](./06_generics.md): + +```rust +type Id = Size; + +fn main() { + let id: Id = 1; + let zero: u32 = 0; + assert(zero + 1 == id); +} +``` + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/00_fields.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/00_fields.md new file mode 100644 index 00000000000..658a0441ffb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/00_fields.md @@ -0,0 +1,165 @@ +--- +title: Fields +description: + Dive deep into the Field data type in Noir. Understand its methods, practical examples, and best practices to effectively use Fields in your Noir programs. +keywords: + [ + noir, + field type, + methods, + examples, + best practices, + ] +--- + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +## Methods + +After declaring a Field, you can use these common methods on it: + +### to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_le_bits(32); +} +``` + +### to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_be_bits(32); +} +``` + +### to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_le_bytes(4); +} +``` + +### to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_be_bytes(4); +} +``` + +### to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_le_radix(256, 4); +} +``` + +### to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_be_radix(256, 4); +} +``` + +### pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +### sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/01_integers.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/01_integers.md new file mode 100644 index 00000000000..d9c5e20e795 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/01_integers.md @@ -0,0 +1,33 @@ +--- +title: Integers +description: + Explore the Integer data type in Noir. Learn about its methods, see real-world examples, and grasp how to efficiently use Integers in your Noir code. +keywords: + [ + noir, + integer types, + methods, + examples, + arithmetic, + ] +--- + +An integer type is a range constrained field type. The Noir frontend currently supports unsigned, +arbitrary-sized integer types. + +An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by +its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of +$\\([0,2^{32}-1]\\)$: + +```rust +fn main(x : Field, y : u32) { + let z = x as u32 + y; +} +``` + +`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z` +are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created +will be rejected by the verifier. + +> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`) +> sized integer types. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/02_booleans.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/02_booleans.md new file mode 100644 index 00000000000..885db167d83 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/02_booleans.md @@ -0,0 +1,30 @@ +--- +title: Booleans +description: + Delve into the Boolean data type in Noir. Understand its methods, practical examples, and best practices for using Booleans in your Noir programs. +keywords: + [ + noir, + boolean type, + methods, + examples, + logical operations, + ] +--- + + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](../control_flow) and +[Assert Function](../assert) sections. diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/03_strings.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/03_strings.md new file mode 100644 index 00000000000..c42f34ec3ad --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/03_strings.md @@ -0,0 +1,63 @@ +--- +title: Strings +description: + Discover the String data type in Noir. Learn about its methods, see real-world examples, and understand how to effectively manipulate and use Strings in Noir. +keywords: + [ + noir, + string type, + methods, + examples, + concatenation, + ] +--- + + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. See more about [Logging](../../standard_library/logging). + +```rust +use dep::std; + +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +You can convert a `str` to a byte array by calling `as_bytes()` +or a vector by calling `as_bytes_vec()`. + +```rust +fn main() { + let message = "hello world"; + let message_bytes = message.as_bytes(); + let mut message_vec = message.as_bytes_vec(); + assert(message_bytes.len() == 11); + assert(message_bytes[0] == 104); + assert(message_bytes[0] == message_vec.get(0)); +} +``` + +## Escape characters + +You can use escape characters for your strings: + +| Escape Sequence | Description | +|-----------------|-----------------| +| `\r` | Carriage Return | +| `\n` | Newline | +| `\t` | Tab | +| `\0` | Null Character | +| `\"` | Double Quote | +| `\\` | Backslash | + +Example: + +```rust +let s = "Hello \"world" // prints "Hello "world" +let s = "hey \tyou"; // prints "hey you" +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/04_arrays.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/04_arrays.md new file mode 100644 index 00000000000..bdbd1798bef --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/04_arrays.md @@ -0,0 +1,244 @@ +--- +title: Arrays +description: + Dive into the Array data type in Noir. Grasp its methods, practical examples, and best practices for efficiently using Arrays in your Noir code. +keywords: + [ + noir, + array type, + methods, + examples, + indexing, + ] +--- + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +You can instantiate a new array of a fixed size with the same value repeated for each element. The following example instantiates an array of length 32 where each element is of type Field and has the value 0. + +```rust +let array: [Field; 32] = [0; 32]; +``` + +Like in Rust, arrays in Noir are a fixed size. However, if you wish to convert an array to a [slice](./slices), you can just call `as_slice` on your array: + +```rust +let array: [Field; 32] = [0; 32]; +let sl = array.as_slice() +``` + +You can define multidimensional arrays: + +```rust +let array : [[Field; 2]; 2]; +let element = array[0][0]; +``` + +## Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for arrays: + +### len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + assert(array.len() == 2); +} +``` + +### sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32]; + let sorted = arr.sort(); + assert(sorted == [32, 42]); +} +``` + +### sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +### map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2); // b is now [2, 4, 6] +``` + +### fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2, 2, 2, 2, 2]; + let folded = arr.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +### reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let reduced = arr.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +### all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let all = arr.all(|a| a == 2); + assert(all); +} +``` + +### any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 5]; + let any = arr.any(|a| a == 5); + assert(any); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/05_slices.mdx b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/05_slices.mdx new file mode 100644 index 00000000000..f45f56daee1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/05_slices.mdx @@ -0,0 +1,146 @@ +--- +title: Slices +description: Explore the Slice data type in Noir. Understand its methods, see real-world examples, and learn how to effectively use Slices in your Noir programs. +keywords: [noir, slice type, methods, examples, subarrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. + +```rust +use dep::std::slice; + +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here]([test-file]. + +[test-file]: https://github.com/noir-lang/noir/blob/f387ec1475129732f72ba294877efdf6857135ac/crates/nargo_cli/tests/test_data_ssa_refactor/slices/src/main.nr + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for slices: + +### push_back + +Pushes a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice. + +```rust +fn push_back(_self: [T], _elem: T) -> [T] +``` + +example: + +```rust +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +### push_front + +Returns a new array with the specified element inserted at index 0. The existing elements indexes are incremented by 1. + +```rust +fn push_front(_self: Self, _elem: T) -> Self +``` + +Example: + +```rust +let mut new_slice: [Field] = []; +new_slice = new_slice.push_front(20); +assert(new_slice[0] == 20); // returns true +``` + +View the corresponding test file [here][test-file]. + +### pop_front + +Returns a tuple of two items, the first element of the array and the rest of the array. + +```rust +fn pop_front(_self: Self) -> (T, Self) +``` + +Example: + +```rust +let (first_elem, rest_of_slice) = slice.pop_front(); +``` + +View the corresponding test file [here][test-file]. + +### pop_back + +Returns a tuple of two items, the beginning of the array with the last element omitted and the last element. + +```rust +fn pop_back(_self: Self) -> (Self, T) +``` + +Example: + +```rust +let (popped_slice, last_elem) = slice.pop_back(); +``` + +View the corresponding test file [here][test-file]. + +### append + +Loops over a slice and adds it to the end of another. + +```rust +fn append(mut self, other: Self) -> Self +``` + +Example: + +```rust +let append = [1, 2].append([3, 4, 5]); +``` + +### insert + +Inserts an element at a specified index and shifts all following elements by 1. + +```rust +fn insert(_self: Self, _index: Field, _elem: T) -> Self +``` + +Example: + +```rust +new_slice = rest_of_slice.insert(2, 100); +assert(new_slice[2] == 100); +``` + +View the corresponding test file [here][test-file]. + +### remove + +Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element. + +```rust +fn remove(_self: Self, _index: Field) -> (Self, T) +``` + +Example: + +```rust +let (remove_slice, removed_elem) = slice.remove(3); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/06_vectors.mdx b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/06_vectors.mdx new file mode 100644 index 00000000000..4617e90d038 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/06_vectors.mdx @@ -0,0 +1,172 @@ +--- +title: Vectors +description: Delve into the Vector data type in Noir. Learn about its methods, practical examples, and best practices for using Vectors in your Noir code. +keywords: [noir, vector type, methods, examples, dynamic arrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A vector is a collection type similar to Rust's Vector type. It's convenient way to use slices as mutable arrays. + +Example: + +```rust +use dep::std::collections::vec::Vec; + +let mut vector: Vec = Vec::new(); +for i in 0..5 { + vector.push(i); +} +assert(vector.len() == 5); +``` + +## Methods + +### new + +Creates a new, empty vector. + +```rust +pub fn new() -> Self { + Self { slice: [] } +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` + +### from_slice + +Creates a vector containing each element from a given slice. Mutations to the resulting vector will not affect the original slice. + +```rust +pub fn from_slice(slice: [T]) -> Self { + Self { slice } +} +``` + +Example: + +```rust +let arr: [Field] = [1, 2, 3]; +let vector_from_slice = Vec::from_slice(arr); +assert(vector_from_slice.len() == 3); +``` + +### get + +Retrieves an element from the vector at a given index. Panics if the index points beyond the vector's end. + +```rust +pub fn get(self, index: Field) -> T { + self.slice[index] +} +``` + +Example: + +```rust +let vector: Vec = Vec::from_slice([10, 20, 30]); +assert(vector.get(1) == 20); +``` + +### push + +Adds a new element to the vector's end, returning a new vector with a length one greater than the original unmodified vector. + +```rust +pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); +} +``` + +Example: + +```rust +let mut vector: Vec = Vec::new(); +vector.push(10); +assert(vector.len() == 1); +``` + +### pop + +Removes an element from the vector's end, returning a new vector with a length one less than the original vector, along with the removed element. Panics if the vector's length is zero. + +```rust +pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20]); +let popped_elem = vector.pop(); +assert(popped_elem == 20); +assert(vector.len() == 1); +``` + +### insert + +Inserts an element at a specified index, shifting subsequent elements to the right. + +```rust +pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 30]); +vector.insert(1, 20); +assert(vector.get(1) == 20); +``` + +### remove + +Removes an element at a specified index, shifting subsequent elements to the left, and returns the removed element. + +```rust +pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20, 30]); +let removed_elem = vector.remove(1); +assert(removed_elem == 20); +assert(vector.len() == 2); +``` + +### len + +Returns the number of elements in the vector. + +```rust +pub fn len(self) -> Field { + self.slice.len() +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/07_tuples.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/07_tuples.md new file mode 100644 index 00000000000..5f6cab974a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/07_tuples.md @@ -0,0 +1,47 @@ +--- +title: Tuples +description: + Dive into the Tuple data type in Noir. Understand its methods, practical examples, and best practices for efficiently using Tuples in your Noir code. +keywords: + [ + noir, + tuple type, + methods, + examples, + multi-value containers, + ] +--- + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/08_structs.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/08_structs.md new file mode 100644 index 00000000000..85649dfb389 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/08_structs.md @@ -0,0 +1,73 @@ +--- +title: Structs +description: + Explore the Struct data type in Noir. Learn about its methods, see real-world examples, and grasp how to effectively define and use Structs in your Noir programs. +keywords: + [ + noir, + struct type, + methods, + examples, + data structures, + ] +--- + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. + +:::note +You can use Structs as inputs to the `main` function, but you can't output them +::: diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/09_references.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/09_references.md new file mode 100644 index 00000000000..b0c35ce2cb9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/09_references.md @@ -0,0 +1,22 @@ +--- +title: References +--- + +Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it. + +Example: + +```rust +fn main() { + let mut x = 2; + + // you can reference x as &mut and pass it to multiplyBy2 + multiplyBy2(&mut x); +} + +// you can access &mut here +fn multiplyBy2(x: &mut Field) { + // and dereference it with * + *x = *x * 2; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/10_function_types.md b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/10_function_types.md new file mode 100644 index 00000000000..1ec92efd594 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/language_concepts/data_types/10_function_types.md @@ -0,0 +1,25 @@ +--- +title: Function types +--- + +Noir supports higher-order functions. The syntax for a function type is as follows: + +```rust +fn(arg1_type, arg2_type, ...) -> return_type +``` + +Example: + +```rust +fn assert_returns_100(f: fn() -> Field) { // f takes no args and returns a Field + assert(f() == 100); +} + +fn main() { + assert_returns_100(|| 100); // ok + assert_returns_100(|| 150); // fails +} +``` + +A function type also has an optional capture environment - this is necessary to support closures. +See [Lambdas](../08_lambdas.md) for more details. diff --git a/noir/docs/versioned_docs/version-v0.17.0/migration_notes.md b/noir/docs/versioned_docs/version-v0.17.0/migration_notes.md new file mode 100644 index 00000000000..48a8abcf22e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/migration_notes.md @@ -0,0 +1,83 @@ +--- +title: Migration notes +description: Read about migration notes from previous versions, which could solve problems while updating +keywords: [Noir, notes, migration, updating, upgrading] +--- + +Noir is in full-speed development. Things break fast, wild, and often. This page attempts to leave some notes on errors you might encounter when upgrading and how to resolve them until proper patches are built. + +## ≥0.14 + +The index of the [for loops](./language_concepts/02_control_flow.md#loops) is now of type `u64` instead of `Field`. An example refactor would be: + +```rust +for i in 0..10 { + let i = i as Field; +} +``` + +## ≥v0.11.0 and Nargo backend + +From this version onwards, Nargo starts managing backends through the `nargo backend` command. Upgrading to the versions per usual steps might lead to: + +### `backend encountered an error` + +This is likely due to the existing locally installed version of proving backend (e.g. barretenberg) is incompatible with the version of Nargo in use. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo prove +``` + +with you Noir program. + +This will trigger the download and installation of the latest version of barretenberg compatible with your Nargo in use. + +### `backend encountered an error: illegal instruction` + +On certain Intel-based systems, an `illegal instruction` error may arise due to incompatibility of barretenberg with certain CPU instructions. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo backend install acvm-backend-barretenberg https://github.com/noir-lang/barretenberg-js-binary/raw/master/run-bb.tar.gz +``` + +This downloads and installs a specific bb.js based version of barretenberg binary from GitHub. + +The gzipped filed is running this bash script: , where we need to gzip it as the Nargo currently expect the backend to be zipped up. + +Then run: + +``` +DESIRED_BINARY_VERSION=0.8.1 nargo info +``` + +This overrides the bb native binary with a bb.js node application instead, which should be compatible with most if not all hardware. This does come with the drawback of being generally slower than native binary. + +0.8.1 indicates bb.js version 0.8.1, so if you change that it will update to a different version or the default version in the script if none was supplied. diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..fb83a33d94e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,42 @@ +--- +title: Crates and Packages +description: Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in several forms: binaries, libraries or contracts. + +#### Binaries + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +#### Libraries + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +#### Contracts + +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..75f95aaa305 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/dependencies.md @@ -0,0 +1,123 @@ +--- +title: Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +If the module is in a subdirectory, you can define a subdirectory in your git repository, for example: + +```toml +# Nargo.toml + +[dependencies] +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +```tree +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base_embedded_curve; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +We don't have a way to consume libraries from inside a [workspace](./workspaces) as external dependencies right now. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/modules.md new file mode 100644 index 00000000000..147c9b284e8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree + +All modules are accessible from the `crate::` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` + +In the above snippet, if `bar` would like to use functions in `foo`, it can do so by `use crate::foo::function_name`. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/workspaces.md b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/workspaces.md new file mode 100644 index 00000000000..d9ac92667c9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/modules_packages_crates/workspaces.md @@ -0,0 +1,39 @@ +--- +title: Workspaces +--- + +Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations. + +Each Noir project (with it's own Nargo.toml file) can be thought of as a package. Each package is expected to contain exactly one "named circuit", being the "name" defined in Nargo.toml with the program logic defined in `./src/main.nr`. + +For a project with the following structure: + +```tree +├── crates +│   ├── a +│   │   ├── Nargo.toml +│   │   └── src +│   │   └── main.nr +│   └── b +│   ├── Nargo.toml +│   └── src +│   └── main.nr +├── Nargo.toml +└── Prover.toml +``` + +You can define a workspace in Nargo.toml like so: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. + +`default-member` indicates which package various commands process by default. + +Libraries can be defined in a workspace. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. diff --git a/noir/docs/versioned_docs/version-v0.17.0/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.17.0/nargo/01_commands.md new file mode 100644 index 00000000000..65e2bdb44e3 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/nargo/01_commands.md @@ -0,0 +1,250 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +| Option | Description | +| -------------------- | -------------------------------------------------- | +| `--show-ssa` | Emit debug information for the intermediate SSA IR | +| `--deny-warnings` | Quit execution when warnings are emitted | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +| Argument | Description | +| -------------- | -------------------------------------------- | +| `` | The subcommand whose help message to display | + +## `nargo backend` + +Installs and selects custom backends used to generate and verify proofs. + +### Commands + +| Command | Description | +| ----------- | --------------------------------------------------------- | +| `current` | Prints the name of the currently active backend | +| `ls` | Prints the list of currently installed backends | +| `use` | Select the backend to use | +| `install` | Install a new backend from a URL | +| `uninstall` | Uninstalls a backend | +| `help` | Print this message or the help of the given subcommand(s) | + +### Options + +| Option | Description | +| ------------ | ----------- | +| `-h, --help` | Print help | + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to check | +| `--workspace` | Check all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +### `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to codegen | +| `--workspace` | Codegen all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo compile` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +You can also use "build" as an alias for compile (e.g. `nargo build`). + +### Options + +| Option | Description | +| --------------------- | ------------------------------------------------------------ | +| `--include-keys` | Include Proving and Verification keys in the build artifacts | +| `--package ` | The name of the package to compile | +| `--workspace` | Compile all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo new ` + +Creates a new Noir project in a new folder. + +**Arguments** + +| Argument | Description | +| -------- | -------------------------------- | +| `` | The path to save the new project | + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: package directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo init` + +Creates a new Noir project in the current directory. + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: current directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo execute [WITNESS_NAME]` + +Runs the Noir program and prints its return value. + +**Arguments** + +| Argument | Description | +| ---------------- | ----------------------------------------- | +| `[WITNESS_NAME]` | Write the execution witness to named file | + +### Options + +| Option | Description | +| --------------------------------- | ------------------------------------------------------------------------------------ | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `--package ` | The name of the package to execute | +| `--workspace` | Execute all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `WITNESS_NAME` argument. A +`.tr` file will then be saved in the `./target` folder. + +## `nargo prove` + +Creates a proof for the program. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--verify` | Verify proof after proving | +| `--package ` | The name of the package to prove | +| `--workspace` | Prove all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo verify` + +Given a proof and a program, verify whether the proof is valid. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--package ` | The name of the package to verify | +| `--workspace` | Verify all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo test [TEST_NAME]` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. To print `println` statements in tests, use the `--show-output` flag. + +Takes an optional `--exact` flag which allows you to select tests based on an exact name. + +See an example on the [testing page](./testing). + +### Options + +| Option | Description | +| --------------------- | -------------------------------------- | +| `--show-output` | Display output of `println` statements | +| `--exact` | Only run tests that match exactly | +| `--package ` | The name of the package to test | +| `--workspace` | Test all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo info` + +Prints a table containing the information of the package. + +Currently the table provide + +1. The number of ACIR opcodes +2. The final number gates in the circuit used by a backend + +If the file contains a contract the table will provide the +above information about each function of the contract. + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). + +## `nargo fmt` + +Automatically formats your Noir source code based on the default formatting settings. diff --git a/noir/docs/versioned_docs/version-v0.17.0/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.17.0/nargo/02_testing.md new file mode 100644 index 00000000000..da767274efd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/nargo/02_testing.md @@ -0,0 +1,61 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +### Test fail + +You can write tests that are expected to fail by using the decorator `#[test(should_fail)]`. For example: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test(should_fail)] +fn test_add() { + assert(add(2,2) == 5); +} +``` + +You can be more specific and make it fail with a specific reason by using `should_fail_with = "`: + +```rust +fn main(african_swallow_avg_speed : Field) { + assert(african_swallow_avg_speed == 65, "What is the airspeed velocity of an unladen swallow"); +} + +#[test] +fn test_king_arthur() { + main(65); +} + +#[test(should_fail_with = "What is the airspeed velocity of an unladen swallow")] +fn test_bridgekeeper() { + main(32); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.17.0/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.17.0/nargo/04_language_server.md b/noir/docs/versioned_docs/version-v0.17.0/nargo/04_language_server.md new file mode 100644 index 00000000000..48c01465f6e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/nargo/04_language_server.md @@ -0,0 +1,42 @@ +--- +title: Language Server +description: Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +> **Note:** Noir's Language Server Protocol support currently assumes users' VSCode workspace root to be the same as users' Noir project root (i.e. where Nargo.toml lies). +> +> If LSP features seem to be missing / malfunctioning, make sure you are opening your Noir project directly (instead of as a sub-folder) in your VSCode instance. + +When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests: + +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) + +You should also see your tests in the `testing` panel: + +![Testing panel](@site/static/img/codelens_testing_panel.png) + +### Configuration + +- **Noir: Enable LSP** - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +- **Noir: Nargo Flags** - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +- **Noir: Nargo Path** - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +- **Noir > Trace: Server** - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.17.0/noir_js/getting_started/01_tiny_noir_app.md b/noir/docs/versioned_docs/version-v0.17.0/noir_js/getting_started/01_tiny_noir_app.md new file mode 100644 index 00000000000..6955f7a1e64 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/noir_js/getting_started/01_tiny_noir_app.md @@ -0,0 +1,256 @@ +--- +title: End-to-end +description: Learn how to setup a new app that uses Noir to generate and verify zero-knowledge SNARK proofs in a typescript or javascript environment +keywords: [how to, guide, javascript, typescript, noir, barretenberg, zero-knowledge, proofs] +--- + +NoirJS works both on the browser and on the server, and works for both ESM and CJS module systems. In this page, we will learn how can we write a simple test and a simple web app to verify the standard Noir example. + +## Before we start + +:::note + +Feel free to use whatever versions, just keep in mind that Nargo and the NoirJS packages are meant to be in sync. For example, Nargo 0.18.x matches `noir_js@0.18.x`, etc. + +In this guide, we will be pinned to 0.17.0. + +::: + +Make sure you have Node installed on your machine by opening a terminal and executing `node --version`. If you don't see a version, you should install [node](https://github.com/nvm-sh/nvm). You can also use `yarn` if you prefer that package manager over npm (which comes with node). + +First of all, follow the the [Nargo guide](../../getting_started/00_nargo_installation.md) to install nargo version 0.17.0 and create a new project with `nargo new circuit`. Once there, `cd` into the `circuit` folder. You should then be able to compile your circuit into `json` format and see it inside the `target` folder: + +```bash +nargo compile +``` + +Your folder structure should look like: + +```tree +. +└── circuit + ├── Nargo.toml + ├── src + │ └── main.nr + └── target + └── circuit.json +``` + +## Starting a new project + +Go back to the previous folder and start a new project by running run `npm init`. You can configure your project or just leave the defaults, and see a `package.json` appear in your root folder. + +## Installing dependencies + +We'll need two `npm` packages. These packages will provide us the methods we need to run and verify proofs: + +```bash +npm i @noir-lang/backend_barretenberg@^0.17.0 @noir-lang/noir_js@^0.17.0 +``` + +To serve our page, we can use a build tool such as `vite`. Because we're gonna use some `wasm` files, we need to install a plugin as well. Run: + +```bash +npm i --save-dev vite rollup-plugin-copy +``` + +Since we're on the dependency world, we may as well define a nice starting script. Vite makes it easy. Just open `package.json`, find the block "scripts" and add this just below the line with `"test" : "echo......."`: + +```json + "start": "vite --open" +``` + +If you want do build a static website, you can also add some build and preview scripts: + +```json + "build": "vite build", + "preview": "vite preview" +``` + +## Vite plugins + +Vite is great, but support from `wasm` doesn't work out-of-the-box. We're gonna write a quick plugin and use another one. Just copy and paste this into a file named `vite.config.js`. You don't need to understand it, just trust me bro. + +```js +import { defineConfig } from 'vite'; +import copy from 'rollup-plugin-copy'; +import fs from 'fs'; +import path from 'path'; + +const wasmContentTypePlugin = { + name: 'wasm-content-type-plugin', + configureServer(server) { + server.middlewares.use(async (req, res, next) => { + if (req.url.endsWith('.wasm')) { + res.setHeader('Content-Type', 'application/wasm'); + const newPath = req.url.replace('deps', 'dist'); + const targetPath = path.join(__dirname, newPath); + const wasmContent = fs.readFileSync(targetPath); + return res.end(wasmContent); + } + next(); + }); + }, +}; + +export default defineConfig(({ command }) => { + if (command === 'serve') { + return { + plugins: [ + copy({ + targets: [{ src: 'node_modules/**/*.wasm', dest: 'node_modules/.vite/dist' }], + copySync: true, + hook: 'buildStart', + }), + command === 'serve' ? wasmContentTypePlugin : [], + ], + }; + } + + return {}; +}); +``` + +## HTML + +Here's the simplest HTML with some terrible UI. Create a file called `index.html` and paste this: + +```html + + + + + + +

Very basic Noir app

+
+

Logs

+

Proof

+
+ + +``` + +## Some good old vanilla Javascript + +Create a new file `app.js`, which is where our javascript code will live. Let's start with this code inside: + +```js +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); + +function display(container, msg) { + const c = document.getElementById(container); + const p = document.createElement('p'); + p.textContent = msg; + c.appendChild(p); +} +``` + +We can manipulate our website with this little function, so we can see our website working. + +## Adding Noir + +If you come from the previous page, your folder structure should look like this: + +```tree +├── app.js +├── circuit +│ ├── Nargo.toml +│ ├── src +│ │ └── main.nr +│ └── target +│ └── circuit.json +├── index.html +├── package.json +└── vite.config.js +``` + +You'll see other files and folders showing up (like `package-lock.json`, `yarn.lock`, `node_modules`) but you shouldn't have to care about those. + +## Importing our dependencies + +We're starting with the good stuff now. At the top of the new javascript file, import the packages: + +```ts +import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; +import { Noir } from '@noir-lang/noir_js'; +``` + +We also need to import the `circuit` JSON file we created. If you have the suggested folder structure, you can add this line: + +```ts +import circuit from './circuit/target/circuit.json'; +``` + +## Write code + +:::note + +We're gonna be adding code inside the `document.addEventListener...etc` block: + +```js +// forget stuff here +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); +// forget stuff here +``` + +::: + +Our dependencies exported two classes: `BarretenbergBackend` and `Noir`. Let's `init` them and add some logs, just to flex: + +```ts +const backend = new BarretenbergBackend(circuit); +const noir = new Noir(circuit, backend); +``` + +## Proving + +Now we're ready to prove stuff! Let's feed some inputs to our circuit and calculate the proof: + +```js +const input = { x: 1, y: 2 }; +display('logs', 'Generating proof... ⌛'); +const proof = await noir.generateFinalProof(input); +display('logs', 'Generating proof... ✅'); +display('results', proof.proof); +``` + +You're probably eager to see stuff happening, so go and run your app now! + +From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: + +![Getting Started 0](@site/static/img/noir_getting_started_1.png) + +If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. + +In any case, this means your proof was generated! But you shouldn't trust me just yet. Add these lines to see it being verified: + +```js +display('logs', 'Verifying proof... ⌛'); +const verification = await noir.verifyFinalProof(proof); +if (verification) display('logs', 'Verifying proof... ✅'); +``` + +By saving, your app will refresh and here's our complete Tiny Noir App! + +## Further Reading + +You can see how noirjs is used in a full stack Next.js hardhat application in the [noir-starter repo here](https://github.com/noir-lang/noir-starter/tree/main/next-hardhat). The example shows how to calculate a proof in the browser and verify it with a deployed Solidity verifier contract from noirjs. + +You should also check out the more advanced examples in the [noir-examples repo](https://github.com/noir-lang/noir-examples), where you'll find reference usage for some cool apps. diff --git a/noir/docs/versioned_docs/version-v0.17.0/noir_js/noir_js.md b/noir/docs/versioned_docs/version-v0.17.0/noir_js/noir_js.md new file mode 100644 index 00000000000..23ea550e156 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/noir_js/noir_js.md @@ -0,0 +1,36 @@ +--- +title: NoirJS +description: Interact with Noir in Typescript or Javascript +keywords: [Noir project, javascript, typescript, node.js, browser, react] +--- + +NoirJS is a TypeScript library that make it easy to use Noir on your dapp, webapp, Node.js server, website, etc. + +A typical workflow would be composed of two major elements: + +- NoirJS +- Proving backend of choice's JavaScript package + + + +To install NoirJS, install Node.js if you have not already and run this in your JavaScript project: + +```bash +npm i @noir-lang/noir_js +``` + +## Proving backend + +Since Noir is backend agnostic, you can instantiate NoirJS without any backend (i.e. to execute a function). But for proving, you would have to instantiate NoirJS with any of the supported backends through their own `js` interface. + +### Barretenberg + +Aztec Labs maintains the `barretenberg` proving backend, which you can instantiate and make use of alongside NoirJS. It is also the default proving backend installed and used with Nargo, the Noir CLI tool. + +To install its JavaScript library, run this in your project: + +```bash +npm i @noir-lang/backend_barretenberg +``` + +For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/01_noirjs.md) sections. diff --git a/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/01_noirjs.md b/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/01_noirjs.md new file mode 100644 index 00000000000..d9e5a0c6115 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/01_noirjs.md @@ -0,0 +1,143 @@ +--- +title: Noir +description: Reference to noir_js library and the Noir class +keywords: [Noir project, javascript, typescript, node.js, browser, react, class, reference] +--- + +## Table of Contents + +- [constructor](#constructor) +- [init](#init) +- [generateFinalProof](#generatefinalproof) +- [verifyFinalProof](#verifyfinalproof) + +## `constructor` + +The `constructor` is a method used to create and initialize objects created within the `Noir` class. In the `Noir` class constructor, you need to pass two parameters: `circuit` and `backend`. + +### Syntax + +```js +constructor(circuit, backend); +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `circuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode. Typically obtained by running [`nargo compile`](../../nargo/01_commands.md) | +| `backend` | Object | A backend instance, before initialization. | + +### Usage + +```js +const noir = new Noir(circuit, backend); +``` + +## `init` + +This async method should be called after class instantiation. It will run processes on the ACVM, instantiate your backend, etc. + +### Syntax + +```js +async init() +``` + +### Parameters + +This method takes no parameters + +### Usage + +```js +await noirInstance.init(); +``` + +## `execute` + +This async method allows to execute a circuit to get its witness and return value. [`generateFinalProof`](#generatefinalproof) calls it for you, but you can call it directly (i.e. to feed directly to a backend, or to get the return value). + +### Syntax + +```js +async execute(inputs) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| `inputs` | Object | An object containing the inputs to your circuit. | + +### Returns + +| Return value | Type | Description | +| ------------ | --------------------- | --------------------------------------------------- | +| `witness` | Promise | The witness | +| `returnValue` | Promise | The return value | + +### Usage + +```js +const { witness, returnValue } = await noir.execute(inputs) +``` + +## `generateFinalProof` + +This async method generates a witness and a proof given an object as input. + +### Syntax + +```js +async generateFinalproof(input) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------ | +| `input` | Object | An object containing the inputs to your circuit. | + +### Returns + +| Return value | Type | Description | +| ------------ | --------------------- | --------------------------------------------------- | +| `proof` | Promise | An array with the byte representation of the proof. | + +### Usage + +```js +// consider the Standard Noir Example given with nargo init +const input = { x: 1, y: 2 }; +noirInstance.generateProof(input); +``` + +## `verifyFinalProof` + +This async method instantiates the verification key and verifies your proof. + +### Syntax + +```js +async verifyFinalProof(proof) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ---------- | --------------------------------------------------------------------------------------------- | +| `proof` | Uint8Array | The Uint8Array representation of your proof, usually obtained by calling `generateFinalProof` | + +### Returns + +| Return value | Type | Description | +| ------------ | ------------------ | -------------------------------------------- | +| `verified` | Promise | A boolean for whether the proof was verified | + +### Usage + +```js +const proof = noirInstance.generateProof(input); +noirInstance.verifyFinalProof(proof); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/02_bb_backend.md b/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/02_bb_backend.md new file mode 100644 index 00000000000..21c2ff32b57 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/noir_js/reference/02_bb_backend.md @@ -0,0 +1,272 @@ +--- +title: BarretenbergBackend +description: Reference documentation for the barretenberg_backend library and the BarretenbergBackend class +keywords: + [ + BarretenbergBackend, + Barretenberg, + javascript, + typescript, + node.js, + browser, + class, + reference, + noir_js, + ] +--- + +## Table of Contents + +- [constructor](#constructor) +- [generateFinalProof](#generatefinalproof) +- [generateIntermediateProof](#generateintermediateproof) +- [generateProof](#generateproof) +- [generateIntermediateProofArtifacts](#generateintermediateproofartifacts) +- [verifyFinalProof](#verifyfinalproof) +- [verifyIntermediateProof](#verifyintermediateproof) +- [verifyProof](#verifyproof) +- [destroy](#destroy) + +## `constructor` + +The `constructor` is a method used to create and initialize objects created within the `BarretenbergBackend` class. In this class, you should pass at least one argument for the `circuit`. + +### Syntax + +```js +constructor(acirCircuit, (numberOfThreads = 1)); +``` + +### Parameters + +| Parameter | Type | Description | +| ----------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `acirCircuit` | Object | A circuit represented in a `json` format, containing the ABI and bytecode Tipically obtained by running [`nargo compile`](../../nargo/01_commands.md). This is the same circuit expected to be passed to [the Noir class](01_noirjs.md) | +| `numberOfThreads` | Number (optional) | The number of threads to be used by the backend. Defaults to 1. | + +### Usage + +```js +const backend = new BarretenbergBackend(acirCircuit); +``` + +## `generateFinalProof` + +An async wrapper around the [generateProof](#generateproof) method that passes a `false` flag. Usually called by the Noir class. + +### Syntax + +```js +async generateFinalProof(decompressedWitness) +``` + +### Parameters + +| Parameter | Type | Description | +| --------------------- | ------ | -------------------------------------------------------- | +| `decompressedWitness` | Object | The decompressed witness for generating the final proof. | + +### Returns + +| Return value | Type | Description | +| ------------ | -------------------- | --------------------------------------------------------- | +| `proof` | Promise | An array with the byte representation of the final proof. | + +### Usage + +```js +const finalProof = await backend.generateFinalProof(decompressedWitness); +``` + +## `generateIntermediateProof` + +An async wrapper around the [generateProof](#generateproof) method that passes a `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. + +### Syntax + +```js +async generateIntermediateProof(witness) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | -------------------------------------------------- | +| `witness` | Object | The witness for generating the intermediate proof. | + +### Returns + +| Return value | Type | Description | +| ------------ | -------------------- | --------------------------------------------------------------- | +| `proof` | Promise | An array with the byte representation of the intermediate proof | + +### Usage + +```js +const intermediateProof = await backend.generateIntermediateProof(witness); +``` + +## `generateProof` + +This async method generates a proof. Takes the witness generated by ACVM, and a boolean that evaluates to `true` when the proof _is_ meant to be verified in another circuit. Not currently used by the Noir class. + +### Syntax + +```js +async generateProof(decompressedWitness, makeEasyToVerifyInCircuit) +``` + +### Parameters + +| Parameter | Type | Description | +| --------------------------- | ------- | ---------------------------------------------------------------------------------------------- | +| `decompressedWitness` | Object | The decompressed witness for generating the proof. | +| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether to generate proof components for easy verification within a circuit. | + +### Returns + +| Return value | Type | Description | +| ------------ | -------------------- | -------------------------------------------------- | +| `proof` | Promise | An array with the byte representation of the proof | + +### Usage + +```js +const proof = await backend.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); +``` + +## `generateIntermediateProofArtifacts` + +This async method returns the artifacts needed to verify the intermediate proof in another circuit. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. + +### Syntax + +```js +async generateIntermediateProofArtifacts(proof, numOfPublicInputs = 0) +``` + +### Parameters + +| Parameter | Type | Description | +| ------------------- | ----------------- | ---------------------------------------------------------------- | +| `proof` | Object | The proof object. | +| `numOfPublicInputs` | Number (optional) | The number of public inputs in the inner proof, defaulting to 0. | + +### Returns + +| Return value | Type | Description | +| --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `proofAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up a proof | +| `vkAsFields` | string[] | An array of strings with the hexadecimal representation of the [Fields](../../language_concepts/data_types/00_fields.md) that make up the verification key | +| `vkHash` | string | A pedersen hash of the verification key | + +### Usage + +```js +const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); +``` + +## `verifyFinalProof` + +An async wrapper around [verifyProof](#verifyproof) that sets the `false` flag. Usually called by the Noir class. + +### Syntax + +```js +async verifyFinalProof(proof) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | --------------------------- | +| `proof` | Object | The proof object to verify. | + +### Returns + +| Return value | Type | Description | +| ------------ | ------------------ | -------------------------------------------- | +| `verified` | Promise | A boolean for whether the proof was verified | + +### Usage + +```js +const isValidFinal = await backend.verifyFinalProof(proof); +``` + +## `verifyIntermediateProof` + +An async wrapper around [verifyProof](#verifyproof) that sets the `true` flag. It's not currently being used by the Noir class, but developers can call this method directly to use Noir's recursive features. + +### Syntax + +```js +async verifyIntermediateProof(proof) +``` + +### Parameters + +| Parameter | Type | Description | +| --------- | ------ | ---------------------------------------- | +| `proof` | Object | The intermediate proof object to verify. | + +### Returns + +| Return value | Type | Description | +| ------------ | ------------------ | -------------------------------------------- | +| `verified` | Promise | A boolean for whether the proof was verified | + +### Usage + +```js +const isValidIntermediate = await backend.verifyIntermediateProof(proof); +``` + +## `verifyProof` + +This async method verifies a proof. Takes the proof, and a boolean that evaluates to `true` when the proof is intermediate. + +### Syntax + +```js +async verifyProof(proof, makeEasyToVerifyInCircuit) +``` + +### Parameters + +| Parameter | Type | Description | +| --------------------------- | ------- | ------------------------------------------------------------ | +| `proof` | Object | The proof object to verify | +| `makeEasyToVerifyInCircuit` | Boolean | A flag indicating whether the proof is intermediate or final | + +### Returns + +| Parameter | Type | Description | +| ---------- | ------------------ | -------------------------------------------- | +| `verified` | Promise\ | A boolean for whether the proof was verified | + +### Usage + +```js +const isValid = await backend.verifyProof(proof, makeEasyToVerifyInCircuit); +``` + +## `destroy` + +This method destroys the resources allocated in the [instantiate](#instantiate) method. Noir doesn't currently call this method, but it's highly recommended that developers do so in order to save resources. + +### Syntax + +```js +async destroy() +``` + +### Parameters + +This method takes no parameters. + +### Usage + +```js +await backend.destroy(); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/black_box_fns.md new file mode 100644 index 00000000000..c758846b688 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/black_box_fns.md @@ -0,0 +1,45 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen](./cryptographic_primitives/hashes#pedersen) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..2cc3cd81e4e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,146 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::pedersen(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..c7eed820a80 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,27 @@ +--- +title: Scalar multiplication +description: See how you can perform scalar multiplications over a fixed base in Noir +keywords: [cryptographic primitives, Noir project, scalar multiplication] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## scalar_mul::fixed_base_embedded_curve + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base_embedded_curve(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..c184ce28120 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..72bce984821 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..9a5beb55ee9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/logging.md new file mode 100644 index 00000000000..7e2fd9b9aff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/logging.md @@ -0,0 +1,62 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +You can print the output of println statements in your Noir code by using the `nargo execute` command or the `--show-output` flag when using `nargo test` (provided there are println statements in your tests). + +It is recommended to use `nargo execute` if you want to debug failing constrains with `println` statements. This is due to every input in a test being a constant rather than a witness, so we issue an error during compilation while we only print during execution (which comes after compilation). `println` will not work for failed constraints caught at compile time. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` + +You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character: + +```rust + let fmt_str = f"i: {i}, j: {j}"; + std::println(fmt_str); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"i: {i}, s: {s}"); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); +``` diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/merkle_trees.md new file mode 100644 index 00000000000..9761105f4f2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/options.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/options.md new file mode 100644 index 00000000000..3d3139fb98b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/options.md @@ -0,0 +1,99 @@ +--- +title: Option Type +--- + +The `Option` type is a way to express that a value might be present (`Some(T))` or absent (`None`). It's a safer way to handle potential absence of values, compared to using nulls in many other languages. + +```rust +struct Option { + None, + Some(T), +} +``` + +You can import the Option type into your Noir program like so: + +```rust +use dep::std::option::Option; + +fn main() { + let none = Option::none(); + let some = Option::some(3); +} +``` + +See [this test](https://github.com/noir-lang/noir/blob/5cbfb9c4a06c8865c98ff2b594464b037d821a5c/crates/nargo_cli/tests/test_data/option/src/main.nr) for a more comprehensive set of examples of each of the methods described below. + +## Methods + +### none + +Constructs a none value. + +### some + +Constructs a some wrapper around a given value. + +### is_none + +Returns true if the Option is None. + +### is_some + +Returns true of the Option is Some. + +### unwrap + +Asserts `self.is_some()` and returns the wrapped value. + +### unwrap_unchecked + +Returns the inner value without asserting `self.is_some()`. This method can be useful within an if condition when we already know that `option.is_some()`. If the option is None, there is no guarantee what value will be returned, only that it will be of type T for an `Option`. + +### unwrap_or + +Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + +### unwrap_or_else + +Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return a default value. + +### map + +If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + +### map_or + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + +### map_or_else + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + +### and + +Returns None if self is None. Otherwise, this returns `other`. + +### and_then + +If self is None, this returns None. Otherwise, this calls the given function with the Some value contained within self, and returns the result of that call. In some languages this function is called `flat_map` or `bind`. + +### or + +If self is Some, return self. Otherwise, return `other`. + +### or_else + +If self is Some, return self. Otherwise, return `default()`. + +### xor + +If only one of the two Options is Some, return that option. Otherwise, if both options are Some or both are None, None is returned. + +### filter + +Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. Otherwise, this returns `None`. + +### flatten + +Flattens an `Option>` into a `Option`. This returns `None` if the outer Option is None. Otherwise, this returns the inner Option. diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/recursion.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/recursion.md new file mode 100644 index 00000000000..ff4c63acaa7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). diff --git a/noir/docs/versioned_docs/version-v0.17.0/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.17.0/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.17.0/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.19.1/examples/merkle-proof.mdx b/noir/docs/versioned_docs/version-v0.19.1/examples/merkle-proof.mdx new file mode 100644 index 00000000000..832fb4bb55e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/examples/merkle-proof.mdx @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen_hash` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[View an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.19.1/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.19.1/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..725c5f4d373 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/getting_started/00_nargo_installation.md @@ -0,0 +1,249 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [NoirJS](../noir_js/noir_js.md). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Compile from Source](#option-3-compile-from-source) +- [Option 4: WSL for Windows](#option-4-wsl-for-windows) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. It helps mitigating ssues commonly associated with dependency management, such as conflicts between required package versions for different projects (often referred to as "dependency hell"). + +Combined with direnv, which automatically sets or unsets environment variables based on the directory, it further simplifies the development process by seamlessly integrating with the developer's shell, facilitating an efficient and reliable workflow for managing and deploying Noir projects with multiple dependencies. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). + 1. For bash or zshell, add `eval "$(direnv hook bash)"` or `eval "$(direnv hook zsh)"` to your ~/.bashrc or ~/.zshrc file, respectively. +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `rust-toolchain.toml`, which is 1.71.1 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +### Option 4: WSL (for Windows) + +The default backend for Noir (Barretenberg) doesn't provide Windows binaries at this time. For that reason, Noir cannot be installed nativerly. However, it is available by using Windows Subsystem for Linux (WSL). + +Step 1: Follow the instructions [here](https://learn.microsoft.com/en-us/windows/wsl/install) to install and run WSL. + +step 2: Follow the [Noirup instructions](#option-1-noirup). + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir diff --git a/noir/docs/versioned_docs/version-v0.19.1/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.19.1/getting_started/01_hello_world.md new file mode 100644 index 00000000000..8b4416beba1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program: + +```sh +nargo prove +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`.proof`, where the project name is defined in Nargo.toml. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof by running: + +```sh +nargo verify +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.19.1/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.19.1/getting_started/02_breakdown.md new file mode 100644 index 00000000000..9a17f5d6360 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/getting_started/02_breakdown.md @@ -0,0 +1,198 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +### Prover.toml + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +### Verifier.toml + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +### Nargo.toml + +_Nargo.toml_ contains the environmental options of your project. It contains a "package" section and a "dependencies" section. + +Example Nargo.toml: + +```toml +[package] +name = "noirstarter" +type = "bin" +authors = ["Alice"] +compiler_version = "0.9.0" +description = "Getting started with Noir" +entry = "circuit/main.nr" +license = "MIT" + +[dependencies] +ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"} +``` + +Nargo.toml for a [workspace](../modules_packages_crates/workspaces) will look a bit different. For example: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +#### Package section + +The package section requires a number of fields including: + +- `name` (**required**) - the name of the package +- `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract +- `authors` (optional) - authors of the project +- `compiler_version` - specifies the version of the compiler to use. This is enforced by the compiler and follow's [Rust's versioning](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field), so a `compiler_version = 0.18.0` will enforce Nargo version 0.18.0, `compiler_version = ^0.18.0` will enforce anything above 0.18.0 but below 0.19.0, etc. For more information, see how [Rust handles these operators](https://docs.rs/semver/latest/semver/enum.Op.html) +- `description` (optional) +- `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) +- `backend` (optional) +- `license` (optional) + +#### Dependencies section + +This is where you will specify any dependencies for your project. See the [Dependencies page](../modules_packages_crates/dependencies) for more info. + +`./proofs/` and `./contract/` directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory in a file called your-project.proof. So if your project is named "private_voting" (defined in the project Nargo.toml), the proof will be saved at `./proofs/private_voting.proof`. Opening this file will display the proof in hex format. + +#### Arrays of Structs + +The following code shows how to pass an array of structs to a Noir program to generate a proof. + +```rust +// main.nr +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} +``` + +Prover.toml: + +```toml +[[foos]] # foos[0] +bar = 0 +baz = 0 + +[[foos]] # foos[1] +bar = 0 +baz = 0 + +[[foos]] # foos[2] +bar = 1 +baz = 2 +``` + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates the proof and saves it at `./proofs/.proof`: + +```bash +nargo prove +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof and saves it at `./proofs/.proof`: + +```bash +nargo prove -p OtherProver +``` + +## Verifying a Proof + +When the command `nargo verify` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a proof file with the project name (eg. test_project.proof) + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. diff --git a/noir/docs/versioned_docs/version-v0.19.1/index.md b/noir/docs/versioned_docs/version-v0.19.1/index.md new file mode 100644 index 00000000000..75e1abf2932 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/index.md @@ -0,0 +1,100 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen Commitment +- Pedersen Hash +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/01_functions.md new file mode 100644 index 00000000000..47cdea0cf04 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/01_functions.md @@ -0,0 +1,225 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +By default, functions are visible only within the package they are defined. To make them visible outside of that package (for example, as part of a [library](../modules_packages_crates/crates_and_packages.md#libraries)), you should mark them as `pub`: + +```rust +pub fn foo() {} +``` + +You can also restrict the visibility of the function to only the crate it was defined in, by specifying `pub(crate)`: + +```rust +pub(crate) fn foo() {} //foo can only be called within its crate +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Main function + +If you're writing a binary, the `main` function is the starting point of your program. You can pass all types of expressions to it, as long as they have a fixed size at compile time: + +```rust +fn main(x : Field) // this is fine: passing a Field +fn main(x : [Field; 2]) // this is also fine: passing a Field with known size at compile-time +fn main(x : (Field, bool)) // 👌: passing a (Field, bool) tuple means size 2 +fn main(x : str<5>) // this is fine, as long as you pass a string of size 5 + +fn main(x : Vec) // can't compile, has variable size +fn main(x : [Field]) // can't compile, has variable size +fn main(....// i think you got it by now +``` + +Keep in mind [tests](../nargo/02_testing.md) don't differentiate between `main` and any other function. The following snippet passes tests, but won't compile or prove: + +```rust +fn main(x : [Field]) { + assert(x[0] == 1); +} + +#[test] +fn test_one() { + main([1, 2]); +} +``` + +```bash +$ nargo test +[testing] Running 1 test functions +[testing] Testing test_one... ok +[testing] All tests passed + +$ nargo check +The application panicked (crashed). +Message: Cannot have variable sized arrays as a parameter to main +``` + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` + +It is also possible to specialize which method is chosen depending on the [generic](./06_generics.md) type that is used. In this example, the `foo` function returns different values depending on its type: + +```rust +struct Foo {} + +impl Foo { + fn foo(self) -> Field { 1 } +} + +impl Foo { + fn foo(self) -> Field { 2 } +} + +fn main() { + let f1: Foo = Foo{}; + let f2: Foo = Foo{}; + assert(f1.foo() + f2.foo() == 3); +} +``` + +Also note that impls with the same method name defined in them cannot overlap. For example, if we already have `foo` defined for `Foo` and `Foo` like we do above, we cannot also define `foo` in an `impl Foo` since it would be ambiguous which version of `foo` to choose. + +```rust +// Including this impl in the same project as the above snippet would +// cause an overlapping impls error +impl Foo { + fn foo(self) -> Field { 3 } +} +``` + +## Lambdas + +Lambdas are anonymous functions. They follow the syntax of Rust - `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +See [Lambdas](./08_lambdas.md) for more details. + +## Attributes + +Attributes are metadata that can be applied to a function, using the following syntax: `#[attribute(value)]`. + +Supported attributes include: + +- **builtin**: the function is implemented by the compiler, for efficiency purposes. +- **deprecated**: mark the function as _deprecated_. Calling the function will generate a warning: `warning: use of deprecated function` +- **field**: Used to enable conditional compilation of code depending on the field size. See below for more details +- **oracle**: mark the function as _oracle_; meaning it is an external unconstrained function, implemented in noir_js. See [Unconstrained](./05_unconstrained.md) and [NoirJS](../noir_js/noir_js.md) for more details. +- **test**: mark the function as unit tests. See [Tests](../nargo/02_testing.md) for more details + +### Field Attribute + +The field attribute defines which field the function is compatible for. The function is conditionally compiled, under the condition that the field attribute matches the Noir native field. +The field can be defined implicitly, by using the name of the elliptic curve usually associated to it - for instance bn254, bls12_381 - or explicitly by using the field (prime) order, in decimal or hexadecimal form. +As a result, it is possible to define multiple versions of a function with each version specialized for a different field attribute. This can be useful when a function requires different parameters depending on the underlying elliptic curve. + +Example: we define the function `foo()` three times below. Once for the default Noir bn254 curve, once for the field $\mathbb F_{23}$, which will normally never be used by Noir, and once again for the bls12_381 curve. + +```rust +#[field(bn254)] +fn foo() -> u32 { + 1 +} + +#[field(23)] +fn foo() -> u32 { + 2 +} + +// This commented code would not compile as foo would be defined twice because it is the same field as bn254 +// #[field(21888242871839275222246405745257275088548364400416034343698204186575808495617)] +// fn foo() -> u32 { +// 2 +// } + +#[field(bls12_381)] +fn foo() -> u32 { + 3 +} +``` + +If the field name is not known to Noir, it will discard the function. Field names are case insensitive. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..a7f85360197 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/02_control_flow.md @@ -0,0 +1,44 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +The index for loops is of type `u64`. + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/04_assert.md new file mode 100644 index 00000000000..7427ec6cc63 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/04_assert.md @@ -0,0 +1,26 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. Example: + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +You can optionally provide a message to be logged when the assertion fails: + +```rust +assert(x == y, "x and y are not equal"); +``` + +> Assertions only work for predicate operations, such as `==`. If there's any ambiguity on the operation, the program will fail to compile. For example, it is unclear if `assert(x + y)` would check for `x + y == 0` or simply would return `true`. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/05_unconstrained.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/05_unconstrained.md new file mode 100644 index 00000000000..6b621eda3eb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/05_unconstrained.md @@ -0,0 +1,96 @@ +--- +title: Unconstrained Functions +description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to." + +keywords: [Noir programming language, unconstrained, open] +--- + + + +Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation. + +## Why? + +Zero-knowledge (ZK) domain-specific languages (DSL) enable developers to generate ZK proofs from their programs by compiling code down to the constraints of an NP complete language (such as R1CS or PLONKish languages). However, the hard bounds of a constraint system can be very limiting to the functionality of a ZK DSL. + +Enabling a circuit language to perform unconstrained execution is a powerful tool. Said another way, unconstrained execution lets developers generate witnesses from code that does not generate any constraints. Being able to execute logic outside of a circuit is critical for both circuit performance and constructing proofs on information that is external to a circuit. + +Fetching information from somewhere external to a circuit can also be used to enable developers to improve circuit efficiency. + +A ZK DSL does not just prove computation, but proves that some computation was handled correctly. Thus, it is necessary that when we switch from performing some operation directly inside of a circuit to inside of an unconstrained environment that the appropriate constraints are still laid down elsewhere in the circuit. + +## Example + +An in depth example might help drive the point home. This example comes from the excellent [post](https://discord.com/channels/1113924620781883405/1124022445054111926/1128747641853972590) by Tom in the Noir Discord. + +Let's look at how we can optimize a function to turn a `u72` into an array of `u8`s. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u72 & 0xff) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 91 +Backend circuit size: 3619 +``` + +A lot of the operations in this function are optimized away by the compiler (all the bit-shifts turn into divisions by constants). However we can save a bunch of gates by casting to u8 a bit earlier. This automatically truncates the bit-shifted value to fit in a u8 which allows us to remove the XOR against 0xff. This saves us ~480 gates in total. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 75 +Backend circuit size: 3143 +``` + +Those are some nice savings already but we can do better. This code is all constrained so we're proving every step of calculating out using num, but we don't actually care about how we calculate this, just that it's correct. This is where brillig comes in. + +It turns out that truncating a u72 into a u8 is hard to do inside a snark, each time we do as u8 we lay down 4 ACIR opcodes which get converted into multiple gates. It's actually much easier to calculate num from out than the other way around. All we need to do is multiply each element of out by a constant and add them all together, both relatively easy operations inside a snark. + +We can then run u72_to_u8 as unconstrained brillig code in order to calculate out, then use that result in our constrained function and assert that if we were to do the reverse calculation we'd get back num. This looks a little like the below: + +```rust +fn main(num: u72) -> pub [u8; 8] { + let out = u72_to_u8(num); + + let mut reconstructed_num: u72 = 0; + for i in 0..8 { + reconstructed_num += (out[i] as u72 << (56 - (8 * i))); + } + assert(num == reconstructed_num); + out +} + +unconstrained fn u72_to_u8(num: u72) -> [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8))) as u8; + } + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 78 +Backend circuit size: 2902 +``` + +This ends up taking off another ~250 gates from our circuit! We've ended up with more ACIR opcodes than before but they're easier for the backend to prove (resulting in fewer gates). + +Generally we want to use brillig whenever there's something that's easy to verify but hard to compute within the circuit. For example, if you wanted to calculate a square root of a number it'll be a much better idea to calculate this in brillig and then assert that if you square the result you get back your number. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/06_generics.md new file mode 100644 index 00000000000..9fb4177c2a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/06_generics.md @@ -0,0 +1,113 @@ +--- +title: Generics +description: Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/07_mutability.md new file mode 100644 index 00000000000..4641521b1d9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/07_mutability.md @@ -0,0 +1,92 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a }; +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +:::warning + +The 'comptime' keyword was removed in version 0.10. The comptime keyword and syntax are currently still kept and parsed for backwards compatibility, but are now deprecated and will issue a warning when used. `comptime` has been removed because it is no longer needed for accessing arrays. + +::: + +## Globals + +Noir also supports global variables. However, they must be known at compile-time. The global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/08_lambdas.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/08_lambdas.md new file mode 100644 index 00000000000..ae1e6aecab1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/08_lambdas.md @@ -0,0 +1,80 @@ +--- +title: Lambdas +description: Learn how to use anonymous functions in Noir programming language. +keywords: [Noir programming language, lambda, closure, function, anonymous function] +--- + +## Introduction + +Lambdas are anonymous functions. The syntax is `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +A block can be used as the body of a lambda, allowing you to declare local variables inside it: + +```rust +let cool = || { + let x = 100; + let y = 100; + x + y +} + +assert(cool() == 200); +``` + +## Closures + +Inside the body of a lambda, you can use variables defined in the enclosing function. Such lambdas are called **closures**. In this example `x` is defined inside `main` and is accessed from within the lambda: + +```rust +fn main() { + let x = 100; + let closure = || x + 150; + assert(closure() == 250); +} +``` + +## Passing closures to higher-order functions + +It may catch you by surprise that the following code fails to compile: + +```rust +fn foo(f: fn () -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // error :( +} +``` + +The reason is that the closure's capture environment affects its type - we have a closure that captures two Fields and `foo` +expects a regular function as an argument - those are incompatible. +:::note + +Variables contained within the `||` are the closure's parameters, and the expression that follows it is the closure's body. The capture environment is comprised of any variables used in the closure's body that are not parameters. + +E.g. in |x| x + y, y would be a captured variable, but x would not be, since it is a parameter of the closure. + +::: +The syntax for the type of a closure is `fn[env](args) -> ret_type`, where `env` is the capture environment of the closure - +in this example that's `(Field, Field)`. + +The best solution in our case is to make `foo` generic over the environment type of its parameter, so that it can be called +with closures with any environment, as well as with regular functions: + +```rust +fn foo(f: fn[Env]() -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // compiles fine + assert(foo(|| 60) == 60); // compiles fine +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/09_comments.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/09_comments.md new file mode 100644 index 00000000000..3bb4d2f25a4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/09_comments.md @@ -0,0 +1,32 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir also supports multi-line block comments. Start a block comment with `/*` and end the block with `*/`. + +Noir does not natively support doc comments. You may be able to use [Rust doc comments](https://doc.rust-lang.org/reference/comments.html) in your code to leverage some Rust documentation build tools with Noir code. + +```rust +/* + This is a block comment describing a complex function. +*/ +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/10_distinct.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/10_distinct.md new file mode 100644 index 00000000000..e7ff7f5017a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/10_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `distinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/11_shadowing.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/11_shadowing.md new file mode 100644 index 00000000000..efd743e764f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/11_shadowing.md @@ -0,0 +1,43 @@ +--- +title: Shadowing +--- + +Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing. + +For example, the following function is valid in Noir: + +```rust +fn main() { + let x = 5; + + { + let x = x * 2; + assert (x == 10); + } + + assert (x == 5); +} +``` + +In this example, a variable x is first defined with the value 5. + +The local scope that follows shadows the original x, i.e. creates a local mutable x based on the value of the original x. It is given a value of 2 times the original x. + +When we return to the main scope, x once again refers to just the original x, which stays at the value of 5. + +## Temporal mutability + +One way that shadowing is useful, in addition to ergonomics across scopes, is for temporarily mutating variables. + +```rust +fn main() { + let age = 30; + // age = age + 5; // Would error as `age` is immutable by default. + + let mut age = age + 5; // Temporarily mutates `age` with a new value. + + let age = age; // Locks `age`'s mutability again. + + assert (age == 35); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types.md new file mode 100644 index 00000000000..d546cc463a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types.md @@ -0,0 +1,96 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Type Aliases + +A type alias is a new name for an existing type. Type aliases are declared with the keyword `type`: + +```rust +type Id = u8; + +fn main() { + let id: Id = 1; + let zero: u8 = 0; + assert(zero + 1 == id); +} +``` + +Type aliases can also be used with [generics](./06_generics.md): + +```rust +type Id = Size; + +fn main() { + let id: Id = 1; + let zero: u32 = 0; + assert(zero + 1 == id); +} +``` + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/00_fields.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/00_fields.md new file mode 100644 index 00000000000..658a0441ffb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/00_fields.md @@ -0,0 +1,165 @@ +--- +title: Fields +description: + Dive deep into the Field data type in Noir. Understand its methods, practical examples, and best practices to effectively use Fields in your Noir programs. +keywords: + [ + noir, + field type, + methods, + examples, + best practices, + ] +--- + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +## Methods + +After declaring a Field, you can use these common methods on it: + +### to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_le_bits(32); +} +``` + +### to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_be_bits(32); +} +``` + +### to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_le_bytes(4); +} +``` + +### to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_be_bytes(4); +} +``` + +### to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_le_radix(256, 4); +} +``` + +### to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_be_radix(256, 4); +} +``` + +### pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +### sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/01_integers.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/01_integers.md new file mode 100644 index 00000000000..b1e7ad11bfd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/01_integers.md @@ -0,0 +1,112 @@ +--- +title: Integers +description: Explore the Integer data type in Noir. Learn about its methods, see real-world examples, and grasp how to efficiently use Integers in your Noir code. +keywords: [noir, integer types, methods, examples, arithmetic] +--- + +An integer type is a range constrained field type. The Noir frontend supports arbitrarily-sized, both unsigned and signed integer types. + +:::info + +When an integer is defined in Noir without a specific type, it will default to `Field`. + +The one exception is for loop indices which default to `u64` since comparisons on `Field`s are not possible. + +::: + +## Unsigned Integers + +An unsigned integer type is specified first with the letter `u` (indicating its unsigned nature) followed by its bit size (e.g. `8`): + +```rust +fn main() { + let x: u8 = 1; + let y: u8 = 1; + let z = x + y; + assert (z == 2); +} +``` + +The bit size determines the maximum value the integer type can store. For example, a `u8` variable can store a value in the range of 0 to 255 (i.e. $\\2^{8}-1\\$). + +## Signed Integers + +A signed integer type is specified first with the letter `i` (which stands for integer) followed by its bit size (e.g. `8`): + +```rust +fn main() { + let x: i8 = -1; + let y: i8 = -1; + let z = x + y; + assert (z == -2); +} +``` + +The bit size determines the maximum and minimum range of value the integer type can store. For example, an `i8` variable can store a value in the range of -128 to 127 (i.e. $\\-2^{7}\\$ to $\\2^{7}-1\\$). + +:::tip + +If you are using the default proving backend with Noir, both even (e.g. _u2_, _i2_) and odd (e.g. _u3_, _i3_) arbitrarily-sized integer types up to 127 bits (i.e. _u127_ and _i127_) are supported. + +::: + +## Overflows + +Computations that exceed the type boundaries will result in overflow errors. This happens with both signed and unsigned integers. For example, attempting to prove: + +```rust +fn main(x: u8, y: u8) { + let z = x + y; +} +``` + +With: + +```toml +x = "255" +y = "1" +``` + +Would result in: + +``` +$ nargo prove +error: Assertion failed: 'attempt to add with overflow' +┌─ ~/src/main.nr:9:13 +│ +│ let z = x + y; +│ ----- +│ += Call stack: + ... +``` + +A similar error would happen with signed integers: + +```rust +fn main() { + let x: i8 = -118; + let y: i8 = -11; + let z = x + y; +} +``` + +### Wrapping methods + +Although integer overflow is expected to error, some use-cases rely on wrapping. For these use-cases, the standard library provides `wrapping` variants of certain common operations: + +```rust +fn wrapping_add(x: T, y: T) -> T; +fn wrapping_sub(x: T, y: T) -> T; +fn wrapping_mul(x: T, y: T) -> T; +``` + +Example of how it is used: + +```rust +use dep::std; + +fn main(x: u8, y: u8) -> pub u8 { + std::wrapping_add(x + y) +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/02_booleans.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/02_booleans.md new file mode 100644 index 00000000000..885db167d83 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/02_booleans.md @@ -0,0 +1,30 @@ +--- +title: Booleans +description: + Delve into the Boolean data type in Noir. Understand its methods, practical examples, and best practices for using Booleans in your Noir programs. +keywords: + [ + noir, + boolean type, + methods, + examples, + logical operations, + ] +--- + + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](../control_flow) and +[Assert Function](../assert) sections. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/03_strings.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/03_strings.md new file mode 100644 index 00000000000..c42f34ec3ad --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/03_strings.md @@ -0,0 +1,63 @@ +--- +title: Strings +description: + Discover the String data type in Noir. Learn about its methods, see real-world examples, and understand how to effectively manipulate and use Strings in Noir. +keywords: + [ + noir, + string type, + methods, + examples, + concatenation, + ] +--- + + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. See more about [Logging](../../standard_library/logging). + +```rust +use dep::std; + +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +You can convert a `str` to a byte array by calling `as_bytes()` +or a vector by calling `as_bytes_vec()`. + +```rust +fn main() { + let message = "hello world"; + let message_bytes = message.as_bytes(); + let mut message_vec = message.as_bytes_vec(); + assert(message_bytes.len() == 11); + assert(message_bytes[0] == 104); + assert(message_bytes[0] == message_vec.get(0)); +} +``` + +## Escape characters + +You can use escape characters for your strings: + +| Escape Sequence | Description | +|-----------------|-----------------| +| `\r` | Carriage Return | +| `\n` | Newline | +| `\t` | Tab | +| `\0` | Null Character | +| `\"` | Double Quote | +| `\\` | Backslash | + +Example: + +```rust +let s = "Hello \"world" // prints "Hello "world" +let s = "hey \tyou"; // prints "hey you" +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/04_arrays.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/04_arrays.md new file mode 100644 index 00000000000..bdbd1798bef --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/04_arrays.md @@ -0,0 +1,244 @@ +--- +title: Arrays +description: + Dive into the Array data type in Noir. Grasp its methods, practical examples, and best practices for efficiently using Arrays in your Noir code. +keywords: + [ + noir, + array type, + methods, + examples, + indexing, + ] +--- + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +You can instantiate a new array of a fixed size with the same value repeated for each element. The following example instantiates an array of length 32 where each element is of type Field and has the value 0. + +```rust +let array: [Field; 32] = [0; 32]; +``` + +Like in Rust, arrays in Noir are a fixed size. However, if you wish to convert an array to a [slice](./slices), you can just call `as_slice` on your array: + +```rust +let array: [Field; 32] = [0; 32]; +let sl = array.as_slice() +``` + +You can define multidimensional arrays: + +```rust +let array : [[Field; 2]; 2]; +let element = array[0][0]; +``` + +## Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for arrays: + +### len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + assert(array.len() == 2); +} +``` + +### sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32]; + let sorted = arr.sort(); + assert(sorted == [32, 42]); +} +``` + +### sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +### map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2); // b is now [2, 4, 6] +``` + +### fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2, 2, 2, 2, 2]; + let folded = arr.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +### reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let reduced = arr.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +### all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let all = arr.all(|a| a == 2); + assert(all); +} +``` + +### any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 5]; + let any = arr.any(|a| a == 5); + assert(any); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/05_slices.mdx b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/05_slices.mdx new file mode 100644 index 00000000000..1be0ec4a137 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/05_slices.mdx @@ -0,0 +1,146 @@ +--- +title: Slices +description: Explore the Slice data type in Noir. Understand its methods, see real-world examples, and learn how to effectively use Slices in your Noir programs. +keywords: [noir, slice type, methods, examples, subarrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. + +```rust +use dep::std::slice; + +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +[test-file]: https://github.com/noir-lang/noir/blob/f387ec1475129732f72ba294877efdf6857135ac/crates/nargo_cli/tests/test_data_ssa_refactor/slices/src/main.nr + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for slices: + +### push_back + +Pushes a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice. + +```rust +fn push_back(_self: [T], _elem: T) -> [T] +``` + +example: + +```rust +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +### push_front + +Returns a new array with the specified element inserted at index 0. The existing elements indexes are incremented by 1. + +```rust +fn push_front(_self: Self, _elem: T) -> Self +``` + +Example: + +```rust +let mut new_slice: [Field] = []; +new_slice = new_slice.push_front(20); +assert(new_slice[0] == 20); // returns true +``` + +View the corresponding test file [here][test-file]. + +### pop_front + +Returns a tuple of two items, the first element of the array and the rest of the array. + +```rust +fn pop_front(_self: Self) -> (T, Self) +``` + +Example: + +```rust +let (first_elem, rest_of_slice) = slice.pop_front(); +``` + +View the corresponding test file [here][test-file]. + +### pop_back + +Returns a tuple of two items, the beginning of the array with the last element omitted and the last element. + +```rust +fn pop_back(_self: Self) -> (Self, T) +``` + +Example: + +```rust +let (popped_slice, last_elem) = slice.pop_back(); +``` + +View the corresponding test file [here][test-file]. + +### append + +Loops over a slice and adds it to the end of another. + +```rust +fn append(mut self, other: Self) -> Self +``` + +Example: + +```rust +let append = [1, 2].append([3, 4, 5]); +``` + +### insert + +Inserts an element at a specified index and shifts all following elements by 1. + +```rust +fn insert(_self: Self, _index: Field, _elem: T) -> Self +``` + +Example: + +```rust +new_slice = rest_of_slice.insert(2, 100); +assert(new_slice[2] == 100); +``` + +View the corresponding test file [here][test-file]. + +### remove + +Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element. + +```rust +fn remove(_self: Self, _index: Field) -> (Self, T) +``` + +Example: + +```rust +let (remove_slice, removed_elem) = slice.remove(3); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/06_vectors.mdx b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/06_vectors.mdx new file mode 100644 index 00000000000..4617e90d038 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/06_vectors.mdx @@ -0,0 +1,172 @@ +--- +title: Vectors +description: Delve into the Vector data type in Noir. Learn about its methods, practical examples, and best practices for using Vectors in your Noir code. +keywords: [noir, vector type, methods, examples, dynamic arrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A vector is a collection type similar to Rust's Vector type. It's convenient way to use slices as mutable arrays. + +Example: + +```rust +use dep::std::collections::vec::Vec; + +let mut vector: Vec = Vec::new(); +for i in 0..5 { + vector.push(i); +} +assert(vector.len() == 5); +``` + +## Methods + +### new + +Creates a new, empty vector. + +```rust +pub fn new() -> Self { + Self { slice: [] } +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` + +### from_slice + +Creates a vector containing each element from a given slice. Mutations to the resulting vector will not affect the original slice. + +```rust +pub fn from_slice(slice: [T]) -> Self { + Self { slice } +} +``` + +Example: + +```rust +let arr: [Field] = [1, 2, 3]; +let vector_from_slice = Vec::from_slice(arr); +assert(vector_from_slice.len() == 3); +``` + +### get + +Retrieves an element from the vector at a given index. Panics if the index points beyond the vector's end. + +```rust +pub fn get(self, index: Field) -> T { + self.slice[index] +} +``` + +Example: + +```rust +let vector: Vec = Vec::from_slice([10, 20, 30]); +assert(vector.get(1) == 20); +``` + +### push + +Adds a new element to the vector's end, returning a new vector with a length one greater than the original unmodified vector. + +```rust +pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); +} +``` + +Example: + +```rust +let mut vector: Vec = Vec::new(); +vector.push(10); +assert(vector.len() == 1); +``` + +### pop + +Removes an element from the vector's end, returning a new vector with a length one less than the original vector, along with the removed element. Panics if the vector's length is zero. + +```rust +pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20]); +let popped_elem = vector.pop(); +assert(popped_elem == 20); +assert(vector.len() == 1); +``` + +### insert + +Inserts an element at a specified index, shifting subsequent elements to the right. + +```rust +pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 30]); +vector.insert(1, 20); +assert(vector.get(1) == 20); +``` + +### remove + +Removes an element at a specified index, shifting subsequent elements to the left, and returns the removed element. + +```rust +pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20, 30]); +let removed_elem = vector.remove(1); +assert(removed_elem == 20); +assert(vector.len() == 2); +``` + +### len + +Returns the number of elements in the vector. + +```rust +pub fn len(self) -> Field { + self.slice.len() +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/07_tuples.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/07_tuples.md new file mode 100644 index 00000000000..5f6cab974a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/07_tuples.md @@ -0,0 +1,47 @@ +--- +title: Tuples +description: + Dive into the Tuple data type in Noir. Understand its methods, practical examples, and best practices for efficiently using Tuples in your Noir code. +keywords: + [ + noir, + tuple type, + methods, + examples, + multi-value containers, + ] +--- + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/08_structs.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/08_structs.md new file mode 100644 index 00000000000..35421734639 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/08_structs.md @@ -0,0 +1,69 @@ +--- +title: Structs +description: + Explore the Struct data type in Noir. Learn about its methods, see real-world examples, and grasp how to effectively define and use Structs in your Noir programs. +keywords: + [ + noir, + struct type, + methods, + examples, + data structures, + ] +--- + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/09_references.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/09_references.md new file mode 100644 index 00000000000..b0c35ce2cb9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/09_references.md @@ -0,0 +1,22 @@ +--- +title: References +--- + +Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it. + +Example: + +```rust +fn main() { + let mut x = 2; + + // you can reference x as &mut and pass it to multiplyBy2 + multiplyBy2(&mut x); +} + +// you can access &mut here +fn multiplyBy2(x: &mut Field) { + // and dereference it with * + *x = *x * 2; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/10_function_types.md b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/10_function_types.md new file mode 100644 index 00000000000..1ec92efd594 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/language_concepts/data_types/10_function_types.md @@ -0,0 +1,25 @@ +--- +title: Function types +--- + +Noir supports higher-order functions. The syntax for a function type is as follows: + +```rust +fn(arg1_type, arg2_type, ...) -> return_type +``` + +Example: + +```rust +fn assert_returns_100(f: fn() -> Field) { // f takes no args and returns a Field + assert(f() == 100); +} + +fn main() { + assert_returns_100(|| 100); // ok + assert_returns_100(|| 150); // fails +} +``` + +A function type also has an optional capture environment - this is necessary to support closures. +See [Lambdas](../08_lambdas.md) for more details. diff --git a/noir/docs/versioned_docs/version-v0.19.1/migration_notes.md b/noir/docs/versioned_docs/version-v0.19.1/migration_notes.md new file mode 100644 index 00000000000..e87eb1feaba --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/migration_notes.md @@ -0,0 +1,91 @@ +--- +title: Migration notes +description: Read about migration notes from previous versions, which could solve problems while updating +keywords: [Noir, notes, migration, updating, upgrading] +--- + +Noir is in full-speed development. Things break fast, wild, and often. This page attempts to leave some notes on errors you might encounter when upgrading and how to resolve them until proper patches are built. + +## ≥0.19 + +### Enforcing `compiler_version` + +From this version on, the compiler will check for the `compiler_version` field in `Nargo.toml`, and will error if it doesn't match the current Nargo version in use. + +To update, please make sure this field in `Nargo.toml` matches the output of `nargo --version`. + +## ≥0.14 + +The index of the [for loops](./language_concepts/02_control_flow.md#loops) is now of type `u64` instead of `Field`. An example refactor would be: + +```rust +for i in 0..10 { + let i = i as Field; +} +``` + +## ≥v0.11.0 and Nargo backend + +From this version onwards, Nargo starts managing backends through the `nargo backend` command. Upgrading to the versions per usual steps might lead to: + +### `backend encountered an error` + +This is likely due to the existing locally installed version of proving backend (e.g. barretenberg) is incompatible with the version of Nargo in use. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo prove +``` + +with you Noir program. + +This will trigger the download and installation of the latest version of barretenberg compatible with your Nargo in use. + +### `backend encountered an error: illegal instruction` + +On certain Intel-based systems, an `illegal instruction` error may arise due to incompatibility of barretenberg with certain CPU instructions. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo backend install acvm-backend-barretenberg https://github.com/noir-lang/barretenberg-js-binary/raw/master/run-bb.tar.gz +``` + +This downloads and installs a specific bb.js based version of barretenberg binary from GitHub. + +The gzipped filed is running this bash script: , where we need to gzip it as the Nargo currently expect the backend to be zipped up. + +Then run: + +``` +DESIRED_BINARY_VERSION=0.8.1 nargo info +``` + +This overrides the bb native binary with a bb.js node application instead, which should be compatible with most if not all hardware. This does come with the drawback of being generally slower than native binary. + +0.8.1 indicates bb.js version 0.8.1, so if you change that it will update to a different version or the default version in the script if none was supplied. diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..fb83a33d94e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,42 @@ +--- +title: Crates and Packages +description: Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in several forms: binaries, libraries or contracts. + +#### Binaries + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +#### Libraries + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +#### Contracts + +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..75f95aaa305 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/dependencies.md @@ -0,0 +1,123 @@ +--- +title: Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +If the module is in a subdirectory, you can define a subdirectory in your git repository, for example: + +```toml +# Nargo.toml + +[dependencies] +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +```tree +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base_embedded_curve; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +We don't have a way to consume libraries from inside a [workspace](./workspaces) as external dependencies right now. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/modules.md new file mode 100644 index 00000000000..147c9b284e8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree + +All modules are accessible from the `crate::` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` + +In the above snippet, if `bar` would like to use functions in `foo`, it can do so by `use crate::foo::function_name`. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/workspaces.md b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/workspaces.md new file mode 100644 index 00000000000..d9ac92667c9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/modules_packages_crates/workspaces.md @@ -0,0 +1,39 @@ +--- +title: Workspaces +--- + +Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations. + +Each Noir project (with it's own Nargo.toml file) can be thought of as a package. Each package is expected to contain exactly one "named circuit", being the "name" defined in Nargo.toml with the program logic defined in `./src/main.nr`. + +For a project with the following structure: + +```tree +├── crates +│   ├── a +│   │   ├── Nargo.toml +│   │   └── src +│   │   └── main.nr +│   └── b +│   ├── Nargo.toml +│   └── src +│   └── main.nr +├── Nargo.toml +└── Prover.toml +``` + +You can define a workspace in Nargo.toml like so: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. + +`default-member` indicates which package various commands process by default. + +Libraries can be defined in a workspace. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. diff --git a/noir/docs/versioned_docs/version-v0.19.1/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.19.1/nargo/01_commands.md new file mode 100644 index 00000000000..65e2bdb44e3 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/nargo/01_commands.md @@ -0,0 +1,250 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +| Option | Description | +| -------------------- | -------------------------------------------------- | +| `--show-ssa` | Emit debug information for the intermediate SSA IR | +| `--deny-warnings` | Quit execution when warnings are emitted | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +| Argument | Description | +| -------------- | -------------------------------------------- | +| `` | The subcommand whose help message to display | + +## `nargo backend` + +Installs and selects custom backends used to generate and verify proofs. + +### Commands + +| Command | Description | +| ----------- | --------------------------------------------------------- | +| `current` | Prints the name of the currently active backend | +| `ls` | Prints the list of currently installed backends | +| `use` | Select the backend to use | +| `install` | Install a new backend from a URL | +| `uninstall` | Uninstalls a backend | +| `help` | Print this message or the help of the given subcommand(s) | + +### Options + +| Option | Description | +| ------------ | ----------- | +| `-h, --help` | Print help | + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to check | +| `--workspace` | Check all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +### `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to codegen | +| `--workspace` | Codegen all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo compile` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +You can also use "build" as an alias for compile (e.g. `nargo build`). + +### Options + +| Option | Description | +| --------------------- | ------------------------------------------------------------ | +| `--include-keys` | Include Proving and Verification keys in the build artifacts | +| `--package ` | The name of the package to compile | +| `--workspace` | Compile all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo new ` + +Creates a new Noir project in a new folder. + +**Arguments** + +| Argument | Description | +| -------- | -------------------------------- | +| `` | The path to save the new project | + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: package directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo init` + +Creates a new Noir project in the current directory. + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: current directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo execute [WITNESS_NAME]` + +Runs the Noir program and prints its return value. + +**Arguments** + +| Argument | Description | +| ---------------- | ----------------------------------------- | +| `[WITNESS_NAME]` | Write the execution witness to named file | + +### Options + +| Option | Description | +| --------------------------------- | ------------------------------------------------------------------------------------ | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `--package ` | The name of the package to execute | +| `--workspace` | Execute all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `WITNESS_NAME` argument. A +`.tr` file will then be saved in the `./target` folder. + +## `nargo prove` + +Creates a proof for the program. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--verify` | Verify proof after proving | +| `--package ` | The name of the package to prove | +| `--workspace` | Prove all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo verify` + +Given a proof and a program, verify whether the proof is valid. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--package ` | The name of the package to verify | +| `--workspace` | Verify all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo test [TEST_NAME]` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. To print `println` statements in tests, use the `--show-output` flag. + +Takes an optional `--exact` flag which allows you to select tests based on an exact name. + +See an example on the [testing page](./testing). + +### Options + +| Option | Description | +| --------------------- | -------------------------------------- | +| `--show-output` | Display output of `println` statements | +| `--exact` | Only run tests that match exactly | +| `--package ` | The name of the package to test | +| `--workspace` | Test all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo info` + +Prints a table containing the information of the package. + +Currently the table provide + +1. The number of ACIR opcodes +2. The final number gates in the circuit used by a backend + +If the file contains a contract the table will provide the +above information about each function of the contract. + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). + +## `nargo fmt` + +Automatically formats your Noir source code based on the default formatting settings. diff --git a/noir/docs/versioned_docs/version-v0.19.1/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.19.1/nargo/02_testing.md new file mode 100644 index 00000000000..da767274efd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/nargo/02_testing.md @@ -0,0 +1,61 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +### Test fail + +You can write tests that are expected to fail by using the decorator `#[test(should_fail)]`. For example: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test(should_fail)] +fn test_add() { + assert(add(2,2) == 5); +} +``` + +You can be more specific and make it fail with a specific reason by using `should_fail_with = "`: + +```rust +fn main(african_swallow_avg_speed : Field) { + assert(african_swallow_avg_speed == 65, "What is the airspeed velocity of an unladen swallow"); +} + +#[test] +fn test_king_arthur() { + main(65); +} + +#[test(should_fail_with = "What is the airspeed velocity of an unladen swallow")] +fn test_bridgekeeper() { + main(32); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.19.1/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.19.1/nargo/04_language_server.md b/noir/docs/versioned_docs/version-v0.19.1/nargo/04_language_server.md new file mode 100644 index 00000000000..48c01465f6e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/nargo/04_language_server.md @@ -0,0 +1,42 @@ +--- +title: Language Server +description: Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +> **Note:** Noir's Language Server Protocol support currently assumes users' VSCode workspace root to be the same as users' Noir project root (i.e. where Nargo.toml lies). +> +> If LSP features seem to be missing / malfunctioning, make sure you are opening your Noir project directly (instead of as a sub-folder) in your VSCode instance. + +When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests: + +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) + +You should also see your tests in the `testing` panel: + +![Testing panel](@site/static/img/codelens_testing_panel.png) + +### Configuration + +- **Noir: Enable LSP** - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +- **Noir: Nargo Flags** - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +- **Noir: Nargo Path** - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +- **Noir > Trace: Server** - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/getting_started/01_tiny_noir_app.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/getting_started/01_tiny_noir_app.md new file mode 100644 index 00000000000..c51ed61de52 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/getting_started/01_tiny_noir_app.md @@ -0,0 +1,260 @@ +--- +title: End-to-end +description: Learn how to setup a new app that uses Noir to generate and verify zero-knowledge SNARK proofs in a typescript or javascript environment +keywords: [how to, guide, javascript, typescript, noir, barretenberg, zero-knowledge, proofs] +--- + +NoirJS works both on the browser and on the server, and works for both ESM and CJS module systems. In this page, we will learn how can we write a simple test and a simple web app to verify the standard Noir example. + +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + +## Before we start + +:::note + +Feel free to use whatever versions, just keep in mind that Nargo and the NoirJS packages are meant to be in sync. For example, Nargo 0.18.x matches `noir_js@0.18.x`, etc. + +In this guide, we will be pinned to 0.17.0. + +::: + +Make sure you have Node installed on your machine by opening a terminal and executing `node --version`. If you don't see a version, you should install [node](https://github.com/nvm-sh/nvm). You can also use `yarn` if you prefer that package manager over npm (which comes with node). + +First of all, follow the the [Nargo guide](../../getting_started/00_nargo_installation.md) to install nargo version 0.17.0 and create a new project with `nargo new circuit`. Once there, `cd` into the `circuit` folder. You should then be able to compile your circuit into `json` format and see it inside the `target` folder: + +```bash +nargo compile +``` + +Your folder structure should look like: + +```tree +. +└── circuit + ├── Nargo.toml + ├── src + │ └── main.nr + └── target + └── circuit.json +``` + +## Starting a new project + +Go back to the previous folder and start a new project by running run `npm init`. You can configure your project or just leave the defaults, and see a `package.json` appear in your root folder. + +## Installing dependencies + +We'll need two `npm` packages. These packages will provide us the methods we need to run and verify proofs: + +```bash +npm i @noir-lang/backend_barretenberg@^0.17.0 @noir-lang/noir_js@^0.17.0 +``` + +To serve our page, we can use a build tool such as `vite`. Because we're gonna use some `wasm` files, we need to install a plugin as well. Run: + +```bash +npm i --save-dev vite rollup-plugin-copy +``` + +Since we're on the dependency world, we may as well define a nice starting script. Vite makes it easy. Just open `package.json`, find the block "scripts" and add this just below the line with `"test" : "echo......."`: + +```json + "start": "vite --open" +``` + +If you want do build a static website, you can also add some build and preview scripts: + +```json + "build": "vite build", + "preview": "vite preview" +``` + +## Vite plugins + +Vite is great, but support from `wasm` doesn't work out-of-the-box. We're gonna write a quick plugin and use another one. Just copy and paste this into a file named `vite.config.js`. You don't need to understand it, just trust me bro. + +```js +import { defineConfig } from 'vite'; +import copy from 'rollup-plugin-copy'; +import fs from 'fs'; +import path from 'path'; + +const wasmContentTypePlugin = { + name: 'wasm-content-type-plugin', + configureServer(server) { + server.middlewares.use(async (req, res, next) => { + if (req.url.endsWith('.wasm')) { + res.setHeader('Content-Type', 'application/wasm'); + const newPath = req.url.replace('deps', 'dist'); + const targetPath = path.join(__dirname, newPath); + const wasmContent = fs.readFileSync(targetPath); + return res.end(wasmContent); + } + next(); + }); + }, +}; + +export default defineConfig(({ command }) => { + if (command === 'serve') { + return { + plugins: [ + copy({ + targets: [{ src: 'node_modules/**/*.wasm', dest: 'node_modules/.vite/dist' }], + copySync: true, + hook: 'buildStart', + }), + command === 'serve' ? wasmContentTypePlugin : [], + ], + }; + } + + return {}; +}); +``` + +## HTML + +Here's the simplest HTML with some terrible UI. Create a file called `index.html` and paste this: + +```html + + + + + + +

Very basic Noir app

+
+

Logs

+

Proof

+
+ + +``` + +## Some good old vanilla Javascript + +Create a new file `app.js`, which is where our javascript code will live. Let's start with this code inside: + +```js +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); + +function display(container, msg) { + const c = document.getElementById(container); + const p = document.createElement('p'); + p.textContent = msg; + c.appendChild(p); +} +``` + +We can manipulate our website with this little function, so we can see our website working. + +## Adding Noir + +If you come from the previous page, your folder structure should look like this: + +```tree +├── app.js +├── circuit +│ ├── Nargo.toml +│ ├── src +│ │ └── main.nr +│ └── target +│ └── circuit.json +├── index.html +├── package.json +└── vite.config.js +``` + +You'll see other files and folders showing up (like `package-lock.json`, `yarn.lock`, `node_modules`) but you shouldn't have to care about those. + +## Importing our dependencies + +We're starting with the good stuff now. At the top of the new javascript file, import the packages: + +```ts +import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; +import { Noir } from '@noir-lang/noir_js'; +``` + +We also need to import the `circuit` JSON file we created. If you have the suggested folder structure, you can add this line: + +```ts +import circuit from './circuit/target/circuit.json'; +``` + +## Write code + +:::note + +We're gonna be adding code inside the `document.addEventListener...etc` block: + +```js +// forget stuff here +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); +// forget stuff here +``` + +::: + +Our dependencies exported two classes: `BarretenbergBackend` and `Noir`. Let's `init` them and add some logs, just to flex: + +```ts +const backend = new BarretenbergBackend(circuit); +const noir = new Noir(circuit, backend); +``` + +## Proving + +Now we're ready to prove stuff! Let's feed some inputs to our circuit and calculate the proof: + +```js +const input = { x: 1, y: 2 }; +display('logs', 'Generating proof... ⌛'); +const proof = await noir.generateFinalProof(input); +display('logs', 'Generating proof... ✅'); +display('results', proof.proof); +``` + +You're probably eager to see stuff happening, so go and run your app now! + +From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: + +![Getting Started 0](@site/static/img/noir_getting_started_1.png) + +If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. + +In any case, this means your proof was generated! But you shouldn't trust me just yet. Add these lines to see it being verified: + +```js +display('logs', 'Verifying proof... ⌛'); +const verification = await noir.verifyFinalProof(proof); +if (verification) display('logs', 'Verifying proof... ✅'); +``` + +By saving, your app will refresh and here's our complete Tiny Noir App! + +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + +## Further Reading + +You can see how noirjs is used in a full stack Next.js hardhat application in the [noir-starter repo here](https://github.com/noir-lang/noir-starter/tree/main/next-hardhat). The example shows how to calculate a proof in the browser and verify it with a deployed Solidity verifier contract from noirjs. + +You should also check out the more advanced examples in the [noir-examples repo](https://github.com/noir-lang/noir-examples), where you'll find reference usage for some cool apps. diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/noir_js.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/noir_js.md new file mode 100644 index 00000000000..f895b22eaf8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/noir_js.md @@ -0,0 +1,36 @@ +--- +title: NoirJS +description: Interact with Noir in Typescript or Javascript +keywords: [Noir project, javascript, typescript, node.js, browser, react] +--- + +NoirJS is a TypeScript library that make it easy to use Noir on your dapp, webapp, Node.js server, website, etc. + +A typical workflow would be composed of two major elements: + +- NoirJS +- Proving backend of choice's JavaScript package + + + +To install NoirJS, install Node.js if you have not already and run this in your JavaScript project: + +```bash +npm i @noir-lang/noir_js +``` + +## Proving backend + +Since Noir is backend agnostic, you can instantiate NoirJS without any backend (i.e. to execute a function). But for proving, you would have to instantiate NoirJS with any of the supported backends through their own `js` interface. + +### Barretenberg + +Aztec Labs maintains the `barretenberg` proving backend, which you can instantiate and make use of alongside NoirJS. It is also the default proving backend installed and used with Nargo, the Noir CLI tool. + +To install its JavaScript library, run this in your project: + +```bash +npm i @noir-lang/backend_barretenberg +``` + +For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/noir_js/classes/Noir.md) sections. diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/.nojekyll b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md new file mode 100644 index 00000000000..5cbe9421b92 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md @@ -0,0 +1,185 @@ +# BarretenbergBackend + +## Implements + +- [`Backend`](../interfaces/Backend.md) + +## Constructors + +### new BarretenbergBackend(acirCircuit, options) + +```ts +new BarretenbergBackend(acirCircuit, options): BarretenbergBackend +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | + +#### Returns + +[`BarretenbergBackend`](BarretenbergBackend.md) + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`destroy`](../interfaces/Backend.md#destroy) + +#### Description + +Destroys the backend + +*** + +### generateFinalProof() + +```ts +generateFinalProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateFinalProof`](../interfaces/Backend.md#generatefinalproof) + +#### Description + +Generates a final proof (not meant to be verified in another circuit) + +*** + +### generateIntermediateProof() + +```ts +generateIntermediateProof(witness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `witness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProof`](../interfaces/Backend.md#generateintermediateproof) + +#### Example + +```typescript +const intermediateProof = await backend.generateIntermediateProof(witness); +``` + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | `undefined` | +| `numOfPublicInputs` | `number` | `0` | + +#### Returns + +`Promise`\<`object`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProofArtifacts`](../interfaces/Backend.md#generateintermediateproofartifacts) + +#### Example + +```typescript +const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); +``` + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`verifyFinalProof`](../interfaces/Backend.md#verifyfinalproof) + +#### Description + +Verifies a final proof + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`verifyIntermediateProof`](../interfaces/Backend.md#verifyintermediateproof) + +#### Example + +```typescript +const isValidIntermediate = await backend.verifyIntermediateProof(proof); +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/index.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/index.md new file mode 100644 index 00000000000..3680ba3ca77 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/index.md @@ -0,0 +1,27 @@ +# Backend Barretenberg + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [BarretenbergBackend](classes/BarretenbergBackend.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | +| [Backend](interfaces/Backend.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [BackendOptions](type-aliases/BackendOptions.md) | - | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/interfaces/Backend.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/interfaces/Backend.md new file mode 100644 index 00000000000..3eb9645c8d2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/interfaces/Backend.md @@ -0,0 +1,132 @@ +# Backend + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Description + +Destroys the backend + +*** + +### generateFinalProof() + +```ts +generateFinalProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates a final proof (not meant to be verified in another circuit) + +*** + +### generateIntermediateProof() + +```ts +generateIntermediateProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates an intermediate proof (meant to be verified in another circuit) + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | +| `numOfPublicInputs` | `number` | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Retrieves the artifacts from a proof in the Field format + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Verifies a final proof + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Verifies an intermediate proof + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md new file mode 100644 index 00000000000..266ade75d17 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md @@ -0,0 +1,19 @@ +# BackendOptions + +```ts +type BackendOptions: object; +``` + +## Description + +An options object, currently only used to specify the number of threads to use. + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `threads` | `number` | **Description**

Number of threads | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs new file mode 100644 index 00000000000..04e662c845f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/classes/BarretenbergBackend","label":"BarretenbergBackend"}]},{"type":"category","label":"Interfaces","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/interfaces/Backend","label":"Backend"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/BackendOptions","label":"BackendOptions"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/ProofData","label":"ProofData"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/.nojekyll b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/classes/Noir.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/classes/Noir.md new file mode 100644 index 00000000000..a8a0bb451c1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/classes/Noir.md @@ -0,0 +1,131 @@ +# Noir + +## Constructors + +### new Noir(circuit, backend) + +```ts +new Noir(circuit, backend?): Noir +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `circuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `backend`? | `Backend` | + +#### Returns + +[`Noir`](Noir.md) + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Description + +Destroys the underlying backend instance. + +#### Example + +```typescript +await noir.destroy(); +``` + +*** + +### execute() + +```ts +execute(inputs, foreignCallHandler?): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | +| `foreignCallHandler`? | [`ForeignCallHandler`](../type-aliases/ForeignCallHandler.md) | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Allows to execute a circuit to get its witness and return value. + +#### Example + +```typescript +async execute(inputs) +``` + +*** + +### generateFinalProof() + +```ts +generateFinalProof(inputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates a witness and a proof given an object as input. + +#### Example + +```typescript +async generateFinalproof(input) +``` + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Instantiates the verification key and verifies a proof. + +#### Example + +```typescript +async verifyFinalProof(proof) +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/and.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/and.md new file mode 100644 index 00000000000..c783283e396 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/and.md @@ -0,0 +1,22 @@ +# and() + +```ts +and(lhs, rhs): string +``` + +Performs a bitwise AND operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/blake2s256.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/blake2s256.md new file mode 100644 index 00000000000..7882d0da8d5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/blake2s256.md @@ -0,0 +1,21 @@ +# blake2s256() + +```ts +blake2s256(inputs): Uint8Array +``` + +Calculates the Blake2s256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md new file mode 100644 index 00000000000..0ba5783f0d5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md @@ -0,0 +1,29 @@ +# ecdsa\_secp256k1\_verify() + +```ts +ecdsa_secp256k1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. +Verifies a ECDSA signature over the secp256k1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md new file mode 100644 index 00000000000..0b20ff68957 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md @@ -0,0 +1,28 @@ +# ecdsa\_secp256r1\_verify() + +```ts +ecdsa_secp256r1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Verifies a ECDSA signature over the secp256r1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/keccak256.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/keccak256.md new file mode 100644 index 00000000000..d10f155ce86 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/keccak256.md @@ -0,0 +1,21 @@ +# keccak256() + +```ts +keccak256(inputs): Uint8Array +``` + +Calculates the Keccak256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/sha256.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/sha256.md new file mode 100644 index 00000000000..6ba4ecac022 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/sha256.md @@ -0,0 +1,21 @@ +# sha256() + +```ts +sha256(inputs): Uint8Array +``` + +Calculates the SHA256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/xor.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/xor.md new file mode 100644 index 00000000000..8d762b895d3 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/functions/xor.md @@ -0,0 +1,22 @@ +# xor() + +```ts +xor(lhs, rhs): string +``` + +Performs a bitwise XOR operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/index.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/index.md new file mode 100644 index 00000000000..58902c17b99 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/index.md @@ -0,0 +1,36 @@ +# Noir JS + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [Noir](classes/Noir.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ForeignCallHandler](type-aliases/ForeignCallHandler.md) | A callback which performs an foreign call and returns the response. | +| [ForeignCallInput](type-aliases/ForeignCallInput.md) | - | +| [ForeignCallOutput](type-aliases/ForeignCallOutput.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | +| [WitnessMap](type-aliases/WitnessMap.md) | - | + +### Functions + +| Function | Description | +| :------ | :------ | +| [and](functions/and.md) | Performs a bitwise AND operation between `lhs` and `rhs` | +| [blake2s256](functions/blake2s256.md) | Calculates the Blake2s256 hash of the input bytes | +| [ecdsa\_secp256k1\_verify](functions/ecdsa_secp256k1_verify.md) | Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. | +| [ecdsa\_secp256r1\_verify](functions/ecdsa_secp256r1_verify.md) | Verifies a ECDSA signature over the secp256r1 curve. | +| [keccak256](functions/keccak256.md) | Calculates the Keccak256 hash of the input bytes | +| [sha256](functions/sha256.md) | Calculates the SHA256 hash of the input bytes | +| [xor](functions/xor.md) | Performs a bitwise XOR operation between `lhs` and `rhs` | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md new file mode 100644 index 00000000000..812b8b16481 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md @@ -0,0 +1,24 @@ +# ForeignCallHandler + +```ts +type ForeignCallHandler: (name, inputs) => Promise; +``` + +A callback which performs an foreign call and returns the response. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | The identifier for the type of foreign call being performed. | +| `inputs` | [`ForeignCallInput`](ForeignCallInput.md)[] | An array of hex encoded inputs to the foreign call. | + +## Returns + +`Promise`\<[`ForeignCallOutput`](ForeignCallOutput.md)[]\> + +outputs - An array of hex encoded outputs containing the results of the foreign call. + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md new file mode 100644 index 00000000000..dd95809186a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md @@ -0,0 +1,9 @@ +# ForeignCallInput + +```ts +type ForeignCallInput: string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md new file mode 100644 index 00000000000..b71fb78a946 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md @@ -0,0 +1,9 @@ +# ForeignCallOutput + +```ts +type ForeignCallOutput: string | string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ProofData.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/WitnessMap.md b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/WitnessMap.md new file mode 100644 index 00000000000..258c46f9d0c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/type-aliases/WitnessMap.md @@ -0,0 +1,9 @@ +# WitnessMap + +```ts +type WitnessMap: Map; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/typedoc-sidebar.cjs b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/typedoc-sidebar.cjs new file mode 100644 index 00000000000..c18318850d0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/noir_js/reference/noir_js/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/noir_js/classes/Noir","label":"Noir"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallHandler","label":"ForeignCallHandler"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallInput","label":"ForeignCallInput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallOutput","label":"ForeignCallOutput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ProofData","label":"ProofData"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/WitnessMap","label":"WitnessMap"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"noir_js/reference/noir_js/functions/and","label":"and"},{"type":"doc","id":"noir_js/reference/noir_js/functions/blake2s256","label":"blake2s256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify","label":"ecdsa_secp256k1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify","label":"ecdsa_secp256r1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/keccak256","label":"keccak256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/sha256","label":"sha256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/xor","label":"xor"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/black_box_fns.md new file mode 100644 index 00000000000..1dfabfe8f22 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/black_box_fns.md @@ -0,0 +1,46 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen Hash](./cryptographic_primitives/hashes#pedersen_hash) +- [Pedersen Commitment](./cryptographic_primitives/hashes#pedersen_commitment) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..76745196681 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,167 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen_hash + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen_hash(_input : [Field]) -> Field +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::pedersen_hash(x); +} +``` + + + + + +## pedersen_commitment + +Given an array of Fields, returns the Pedersen commitment. + +```rust +fn pedersen_commitment(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let commitment = std::hash::pedersen_commitment(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::mimc::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..c7eed820a80 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,27 @@ +--- +title: Scalar multiplication +description: See how you can perform scalar multiplications over a fixed base in Noir +keywords: [cryptographic primitives, Noir project, scalar multiplication] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## scalar_mul::fixed_base_embedded_curve + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base_embedded_curve(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..c184ce28120 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..72bce984821 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..9a5beb55ee9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/logging.md new file mode 100644 index 00000000000..7e2fd9b9aff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/logging.md @@ -0,0 +1,62 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +You can print the output of println statements in your Noir code by using the `nargo execute` command or the `--show-output` flag when using `nargo test` (provided there are println statements in your tests). + +It is recommended to use `nargo execute` if you want to debug failing constrains with `println` statements. This is due to every input in a test being a constant rather than a witness, so we issue an error during compilation while we only print during execution (which comes after compilation). `println` will not work for failed constraints caught at compile time. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` + +You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character: + +```rust + let fmt_str = f"i: {i}, j: {j}"; + std::println(fmt_str); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"i: {i}, s: {s}"); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/merkle_trees.md new file mode 100644 index 00000000000..dc383a1426b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen_hash). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/options.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/options.md new file mode 100644 index 00000000000..3d3139fb98b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/options.md @@ -0,0 +1,99 @@ +--- +title: Option Type +--- + +The `Option` type is a way to express that a value might be present (`Some(T))` or absent (`None`). It's a safer way to handle potential absence of values, compared to using nulls in many other languages. + +```rust +struct Option { + None, + Some(T), +} +``` + +You can import the Option type into your Noir program like so: + +```rust +use dep::std::option::Option; + +fn main() { + let none = Option::none(); + let some = Option::some(3); +} +``` + +See [this test](https://github.com/noir-lang/noir/blob/5cbfb9c4a06c8865c98ff2b594464b037d821a5c/crates/nargo_cli/tests/test_data/option/src/main.nr) for a more comprehensive set of examples of each of the methods described below. + +## Methods + +### none + +Constructs a none value. + +### some + +Constructs a some wrapper around a given value. + +### is_none + +Returns true if the Option is None. + +### is_some + +Returns true of the Option is Some. + +### unwrap + +Asserts `self.is_some()` and returns the wrapped value. + +### unwrap_unchecked + +Returns the inner value without asserting `self.is_some()`. This method can be useful within an if condition when we already know that `option.is_some()`. If the option is None, there is no guarantee what value will be returned, only that it will be of type T for an `Option`. + +### unwrap_or + +Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + +### unwrap_or_else + +Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return a default value. + +### map + +If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + +### map_or + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + +### map_or_else + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + +### and + +Returns None if self is None. Otherwise, this returns `other`. + +### and_then + +If self is None, this returns None. Otherwise, this calls the given function with the Some value contained within self, and returns the result of that call. In some languages this function is called `flat_map` or `bind`. + +### or + +If self is Some, return self. Otherwise, return `other`. + +### or_else + +If self is Some, return self. Otherwise, return `default()`. + +### xor + +If only one of the two Options is Some, return that option. Otherwise, if both options are Some or both are None, None is returned. + +### filter + +Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. Otherwise, this returns `None`. + +### flatten + +Flattens an `Option>` into a `Option`. This returns `None` if the outer Option is None. Otherwise, this returns the inner Option. diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/recursion.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/recursion.md new file mode 100644 index 00000000000..ff4c63acaa7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). diff --git a/noir/docs/versioned_docs/version-v0.19.1/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.19.1/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.1/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.19.2/examples/merkle-proof.mdx b/noir/docs/versioned_docs/version-v0.19.2/examples/merkle-proof.mdx new file mode 100644 index 00000000000..832fb4bb55e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/examples/merkle-proof.mdx @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen_hash` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[View an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.19.2/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.19.2/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..725c5f4d373 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/getting_started/00_nargo_installation.md @@ -0,0 +1,249 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [NoirJS](../noir_js/noir_js.md). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Compile from Source](#option-3-compile-from-source) +- [Option 4: WSL for Windows](#option-4-wsl-for-windows) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. It helps mitigating ssues commonly associated with dependency management, such as conflicts between required package versions for different projects (often referred to as "dependency hell"). + +Combined with direnv, which automatically sets or unsets environment variables based on the directory, it further simplifies the development process by seamlessly integrating with the developer's shell, facilitating an efficient and reliable workflow for managing and deploying Noir projects with multiple dependencies. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). + 1. For bash or zshell, add `eval "$(direnv hook bash)"` or `eval "$(direnv hook zsh)"` to your ~/.bashrc or ~/.zshrc file, respectively. +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `rust-toolchain.toml`, which is 1.71.1 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +### Option 4: WSL (for Windows) + +The default backend for Noir (Barretenberg) doesn't provide Windows binaries at this time. For that reason, Noir cannot be installed nativerly. However, it is available by using Windows Subsystem for Linux (WSL). + +Step 1: Follow the instructions [here](https://learn.microsoft.com/en-us/windows/wsl/install) to install and run WSL. + +step 2: Follow the [Noirup instructions](#option-1-noirup). + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir diff --git a/noir/docs/versioned_docs/version-v0.19.2/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.19.2/getting_started/01_hello_world.md new file mode 100644 index 00000000000..8b4416beba1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program: + +```sh +nargo prove +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`.proof`, where the project name is defined in Nargo.toml. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof by running: + +```sh +nargo verify +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.19.2/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.19.2/getting_started/02_breakdown.md new file mode 100644 index 00000000000..9a17f5d6360 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/getting_started/02_breakdown.md @@ -0,0 +1,198 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +### Prover.toml + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +### Verifier.toml + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +### Nargo.toml + +_Nargo.toml_ contains the environmental options of your project. It contains a "package" section and a "dependencies" section. + +Example Nargo.toml: + +```toml +[package] +name = "noirstarter" +type = "bin" +authors = ["Alice"] +compiler_version = "0.9.0" +description = "Getting started with Noir" +entry = "circuit/main.nr" +license = "MIT" + +[dependencies] +ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"} +``` + +Nargo.toml for a [workspace](../modules_packages_crates/workspaces) will look a bit different. For example: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +#### Package section + +The package section requires a number of fields including: + +- `name` (**required**) - the name of the package +- `type` (**required**) - can be "bin", "lib", or "contract" to specify whether its a binary, library or Aztec contract +- `authors` (optional) - authors of the project +- `compiler_version` - specifies the version of the compiler to use. This is enforced by the compiler and follow's [Rust's versioning](https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field), so a `compiler_version = 0.18.0` will enforce Nargo version 0.18.0, `compiler_version = ^0.18.0` will enforce anything above 0.18.0 but below 0.19.0, etc. For more information, see how [Rust handles these operators](https://docs.rs/semver/latest/semver/enum.Op.html) +- `description` (optional) +- `entry` (optional) - a relative filepath to use as the entry point into your package (overrides the default of `src/lib.nr` or `src/main.nr`) +- `backend` (optional) +- `license` (optional) + +#### Dependencies section + +This is where you will specify any dependencies for your project. See the [Dependencies page](../modules_packages_crates/dependencies) for more info. + +`./proofs/` and `./contract/` directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory in a file called your-project.proof. So if your project is named "private_voting" (defined in the project Nargo.toml), the proof will be saved at `./proofs/private_voting.proof`. Opening this file will display the proof in hex format. + +#### Arrays of Structs + +The following code shows how to pass an array of structs to a Noir program to generate a proof. + +```rust +// main.nr +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} +``` + +Prover.toml: + +```toml +[[foos]] # foos[0] +bar = 0 +baz = 0 + +[[foos]] # foos[1] +bar = 0 +baz = 0 + +[[foos]] # foos[2] +bar = 1 +baz = 2 +``` + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates the proof and saves it at `./proofs/.proof`: + +```bash +nargo prove +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof and saves it at `./proofs/.proof`: + +```bash +nargo prove -p OtherProver +``` + +## Verifying a Proof + +When the command `nargo verify` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a proof file with the project name (eg. test_project.proof) + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. diff --git a/noir/docs/versioned_docs/version-v0.19.2/index.md b/noir/docs/versioned_docs/version-v0.19.2/index.md new file mode 100644 index 00000000000..75e1abf2932 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/index.md @@ -0,0 +1,100 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen Commitment +- Pedersen Hash +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/01_functions.md new file mode 100644 index 00000000000..47cdea0cf04 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/01_functions.md @@ -0,0 +1,225 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +By default, functions are visible only within the package they are defined. To make them visible outside of that package (for example, as part of a [library](../modules_packages_crates/crates_and_packages.md#libraries)), you should mark them as `pub`: + +```rust +pub fn foo() {} +``` + +You can also restrict the visibility of the function to only the crate it was defined in, by specifying `pub(crate)`: + +```rust +pub(crate) fn foo() {} //foo can only be called within its crate +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Main function + +If you're writing a binary, the `main` function is the starting point of your program. You can pass all types of expressions to it, as long as they have a fixed size at compile time: + +```rust +fn main(x : Field) // this is fine: passing a Field +fn main(x : [Field; 2]) // this is also fine: passing a Field with known size at compile-time +fn main(x : (Field, bool)) // 👌: passing a (Field, bool) tuple means size 2 +fn main(x : str<5>) // this is fine, as long as you pass a string of size 5 + +fn main(x : Vec) // can't compile, has variable size +fn main(x : [Field]) // can't compile, has variable size +fn main(....// i think you got it by now +``` + +Keep in mind [tests](../nargo/02_testing.md) don't differentiate between `main` and any other function. The following snippet passes tests, but won't compile or prove: + +```rust +fn main(x : [Field]) { + assert(x[0] == 1); +} + +#[test] +fn test_one() { + main([1, 2]); +} +``` + +```bash +$ nargo test +[testing] Running 1 test functions +[testing] Testing test_one... ok +[testing] All tests passed + +$ nargo check +The application panicked (crashed). +Message: Cannot have variable sized arrays as a parameter to main +``` + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` + +It is also possible to specialize which method is chosen depending on the [generic](./06_generics.md) type that is used. In this example, the `foo` function returns different values depending on its type: + +```rust +struct Foo {} + +impl Foo { + fn foo(self) -> Field { 1 } +} + +impl Foo { + fn foo(self) -> Field { 2 } +} + +fn main() { + let f1: Foo = Foo{}; + let f2: Foo = Foo{}; + assert(f1.foo() + f2.foo() == 3); +} +``` + +Also note that impls with the same method name defined in them cannot overlap. For example, if we already have `foo` defined for `Foo` and `Foo` like we do above, we cannot also define `foo` in an `impl Foo` since it would be ambiguous which version of `foo` to choose. + +```rust +// Including this impl in the same project as the above snippet would +// cause an overlapping impls error +impl Foo { + fn foo(self) -> Field { 3 } +} +``` + +## Lambdas + +Lambdas are anonymous functions. They follow the syntax of Rust - `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +See [Lambdas](./08_lambdas.md) for more details. + +## Attributes + +Attributes are metadata that can be applied to a function, using the following syntax: `#[attribute(value)]`. + +Supported attributes include: + +- **builtin**: the function is implemented by the compiler, for efficiency purposes. +- **deprecated**: mark the function as _deprecated_. Calling the function will generate a warning: `warning: use of deprecated function` +- **field**: Used to enable conditional compilation of code depending on the field size. See below for more details +- **oracle**: mark the function as _oracle_; meaning it is an external unconstrained function, implemented in noir_js. See [Unconstrained](./05_unconstrained.md) and [NoirJS](../noir_js/noir_js.md) for more details. +- **test**: mark the function as unit tests. See [Tests](../nargo/02_testing.md) for more details + +### Field Attribute + +The field attribute defines which field the function is compatible for. The function is conditionally compiled, under the condition that the field attribute matches the Noir native field. +The field can be defined implicitly, by using the name of the elliptic curve usually associated to it - for instance bn254, bls12_381 - or explicitly by using the field (prime) order, in decimal or hexadecimal form. +As a result, it is possible to define multiple versions of a function with each version specialized for a different field attribute. This can be useful when a function requires different parameters depending on the underlying elliptic curve. + +Example: we define the function `foo()` three times below. Once for the default Noir bn254 curve, once for the field $\mathbb F_{23}$, which will normally never be used by Noir, and once again for the bls12_381 curve. + +```rust +#[field(bn254)] +fn foo() -> u32 { + 1 +} + +#[field(23)] +fn foo() -> u32 { + 2 +} + +// This commented code would not compile as foo would be defined twice because it is the same field as bn254 +// #[field(21888242871839275222246405745257275088548364400416034343698204186575808495617)] +// fn foo() -> u32 { +// 2 +// } + +#[field(bls12_381)] +fn foo() -> u32 { + 3 +} +``` + +If the field name is not known to Noir, it will discard the function. Field names are case insensitive. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..a7f85360197 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/02_control_flow.md @@ -0,0 +1,44 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +The index for loops is of type `u64`. + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/04_assert.md new file mode 100644 index 00000000000..7427ec6cc63 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/04_assert.md @@ -0,0 +1,26 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. Example: + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +You can optionally provide a message to be logged when the assertion fails: + +```rust +assert(x == y, "x and y are not equal"); +``` + +> Assertions only work for predicate operations, such as `==`. If there's any ambiguity on the operation, the program will fail to compile. For example, it is unclear if `assert(x + y)` would check for `x + y == 0` or simply would return `true`. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/05_unconstrained.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/05_unconstrained.md new file mode 100644 index 00000000000..6b621eda3eb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/05_unconstrained.md @@ -0,0 +1,96 @@ +--- +title: Unconstrained Functions +description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to." + +keywords: [Noir programming language, unconstrained, open] +--- + + + +Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation. + +## Why? + +Zero-knowledge (ZK) domain-specific languages (DSL) enable developers to generate ZK proofs from their programs by compiling code down to the constraints of an NP complete language (such as R1CS or PLONKish languages). However, the hard bounds of a constraint system can be very limiting to the functionality of a ZK DSL. + +Enabling a circuit language to perform unconstrained execution is a powerful tool. Said another way, unconstrained execution lets developers generate witnesses from code that does not generate any constraints. Being able to execute logic outside of a circuit is critical for both circuit performance and constructing proofs on information that is external to a circuit. + +Fetching information from somewhere external to a circuit can also be used to enable developers to improve circuit efficiency. + +A ZK DSL does not just prove computation, but proves that some computation was handled correctly. Thus, it is necessary that when we switch from performing some operation directly inside of a circuit to inside of an unconstrained environment that the appropriate constraints are still laid down elsewhere in the circuit. + +## Example + +An in depth example might help drive the point home. This example comes from the excellent [post](https://discord.com/channels/1113924620781883405/1124022445054111926/1128747641853972590) by Tom in the Noir Discord. + +Let's look at how we can optimize a function to turn a `u72` into an array of `u8`s. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u72 & 0xff) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 91 +Backend circuit size: 3619 +``` + +A lot of the operations in this function are optimized away by the compiler (all the bit-shifts turn into divisions by constants). However we can save a bunch of gates by casting to u8 a bit earlier. This automatically truncates the bit-shifted value to fit in a u8 which allows us to remove the XOR against 0xff. This saves us ~480 gates in total. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 75 +Backend circuit size: 3143 +``` + +Those are some nice savings already but we can do better. This code is all constrained so we're proving every step of calculating out using num, but we don't actually care about how we calculate this, just that it's correct. This is where brillig comes in. + +It turns out that truncating a u72 into a u8 is hard to do inside a snark, each time we do as u8 we lay down 4 ACIR opcodes which get converted into multiple gates. It's actually much easier to calculate num from out than the other way around. All we need to do is multiply each element of out by a constant and add them all together, both relatively easy operations inside a snark. + +We can then run u72_to_u8 as unconstrained brillig code in order to calculate out, then use that result in our constrained function and assert that if we were to do the reverse calculation we'd get back num. This looks a little like the below: + +```rust +fn main(num: u72) -> pub [u8; 8] { + let out = u72_to_u8(num); + + let mut reconstructed_num: u72 = 0; + for i in 0..8 { + reconstructed_num += (out[i] as u72 << (56 - (8 * i))); + } + assert(num == reconstructed_num); + out +} + +unconstrained fn u72_to_u8(num: u72) -> [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8))) as u8; + } + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 78 +Backend circuit size: 2902 +``` + +This ends up taking off another ~250 gates from our circuit! We've ended up with more ACIR opcodes than before but they're easier for the backend to prove (resulting in fewer gates). + +Generally we want to use brillig whenever there's something that's easy to verify but hard to compute within the circuit. For example, if you wanted to calculate a square root of a number it'll be a much better idea to calculate this in brillig and then assert that if you square the result you get back your number. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/06_generics.md new file mode 100644 index 00000000000..9fb4177c2a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/06_generics.md @@ -0,0 +1,113 @@ +--- +title: Generics +description: Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/07_mutability.md new file mode 100644 index 00000000000..4641521b1d9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/07_mutability.md @@ -0,0 +1,92 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a }; +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +:::warning + +The 'comptime' keyword was removed in version 0.10. The comptime keyword and syntax are currently still kept and parsed for backwards compatibility, but are now deprecated and will issue a warning when used. `comptime` has been removed because it is no longer needed for accessing arrays. + +::: + +## Globals + +Noir also supports global variables. However, they must be known at compile-time. The global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/08_lambdas.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/08_lambdas.md new file mode 100644 index 00000000000..ae1e6aecab1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/08_lambdas.md @@ -0,0 +1,80 @@ +--- +title: Lambdas +description: Learn how to use anonymous functions in Noir programming language. +keywords: [Noir programming language, lambda, closure, function, anonymous function] +--- + +## Introduction + +Lambdas are anonymous functions. The syntax is `|arg1, arg2, ..., argN| return_expression`. + +```rust +let add_50 = |val| val + 50; +assert(add_50(100) == 150); +``` + +A block can be used as the body of a lambda, allowing you to declare local variables inside it: + +```rust +let cool = || { + let x = 100; + let y = 100; + x + y +} + +assert(cool() == 200); +``` + +## Closures + +Inside the body of a lambda, you can use variables defined in the enclosing function. Such lambdas are called **closures**. In this example `x` is defined inside `main` and is accessed from within the lambda: + +```rust +fn main() { + let x = 100; + let closure = || x + 150; + assert(closure() == 250); +} +``` + +## Passing closures to higher-order functions + +It may catch you by surprise that the following code fails to compile: + +```rust +fn foo(f: fn () -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // error :( +} +``` + +The reason is that the closure's capture environment affects its type - we have a closure that captures two Fields and `foo` +expects a regular function as an argument - those are incompatible. +:::note + +Variables contained within the `||` are the closure's parameters, and the expression that follows it is the closure's body. The capture environment is comprised of any variables used in the closure's body that are not parameters. + +E.g. in |x| x + y, y would be a captured variable, but x would not be, since it is a parameter of the closure. + +::: +The syntax for the type of a closure is `fn[env](args) -> ret_type`, where `env` is the capture environment of the closure - +in this example that's `(Field, Field)`. + +The best solution in our case is to make `foo` generic over the environment type of its parameter, so that it can be called +with closures with any environment, as well as with regular functions: + +```rust +fn foo(f: fn[Env]() -> Field) -> Field { + f() +} + +fn main() { + let (x, y) = (50, 50); + assert(foo(|| x + y) == 100); // compiles fine + assert(foo(|| 60) == 60); // compiles fine +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/09_comments.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/09_comments.md new file mode 100644 index 00000000000..3bb4d2f25a4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/09_comments.md @@ -0,0 +1,32 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir also supports multi-line block comments. Start a block comment with `/*` and end the block with `*/`. + +Noir does not natively support doc comments. You may be able to use [Rust doc comments](https://doc.rust-lang.org/reference/comments.html) in your code to leverage some Rust documentation build tools with Noir code. + +```rust +/* + This is a block comment describing a complex function. +*/ +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/10_distinct.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/10_distinct.md new file mode 100644 index 00000000000..e7ff7f5017a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/10_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `distinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/11_shadowing.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/11_shadowing.md new file mode 100644 index 00000000000..efd743e764f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/11_shadowing.md @@ -0,0 +1,43 @@ +--- +title: Shadowing +--- + +Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing. + +For example, the following function is valid in Noir: + +```rust +fn main() { + let x = 5; + + { + let x = x * 2; + assert (x == 10); + } + + assert (x == 5); +} +``` + +In this example, a variable x is first defined with the value 5. + +The local scope that follows shadows the original x, i.e. creates a local mutable x based on the value of the original x. It is given a value of 2 times the original x. + +When we return to the main scope, x once again refers to just the original x, which stays at the value of 5. + +## Temporal mutability + +One way that shadowing is useful, in addition to ergonomics across scopes, is for temporarily mutating variables. + +```rust +fn main() { + let age = 30; + // age = age + 5; // Would error as `age` is immutable by default. + + let mut age = age + 5; // Temporarily mutates `age` with a new value. + + let age = age; // Locks `age`'s mutability again. + + assert (age == 35); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types.md new file mode 100644 index 00000000000..d546cc463a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types.md @@ -0,0 +1,96 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Type Aliases + +A type alias is a new name for an existing type. Type aliases are declared with the keyword `type`: + +```rust +type Id = u8; + +fn main() { + let id: Id = 1; + let zero: u8 = 0; + assert(zero + 1 == id); +} +``` + +Type aliases can also be used with [generics](./06_generics.md): + +```rust +type Id = Size; + +fn main() { + let id: Id = 1; + let zero: u32 = 0; + assert(zero + 1 == id); +} +``` + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/00_fields.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/00_fields.md new file mode 100644 index 00000000000..658a0441ffb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/00_fields.md @@ -0,0 +1,165 @@ +--- +title: Fields +description: + Dive deep into the Field data type in Noir. Understand its methods, practical examples, and best practices to effectively use Fields in your Noir programs. +keywords: + [ + noir, + field type, + methods, + examples, + best practices, + ] +--- + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +## Methods + +After declaring a Field, you can use these common methods on it: + +### to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_le_bits(32); +} +``` + +### to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2; + let bits = field.to_be_bits(32); +} +``` + +### to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_le_bytes(4); +} +``` + +### to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let bytes = field.to_be_bytes(4); +} +``` + +### to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_le_radix(256, 4); +} +``` + +### to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2; + let radix = field.to_be_radix(256, 4); +} +``` + +### pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +### sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/01_integers.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/01_integers.md new file mode 100644 index 00000000000..b1e7ad11bfd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/01_integers.md @@ -0,0 +1,112 @@ +--- +title: Integers +description: Explore the Integer data type in Noir. Learn about its methods, see real-world examples, and grasp how to efficiently use Integers in your Noir code. +keywords: [noir, integer types, methods, examples, arithmetic] +--- + +An integer type is a range constrained field type. The Noir frontend supports arbitrarily-sized, both unsigned and signed integer types. + +:::info + +When an integer is defined in Noir without a specific type, it will default to `Field`. + +The one exception is for loop indices which default to `u64` since comparisons on `Field`s are not possible. + +::: + +## Unsigned Integers + +An unsigned integer type is specified first with the letter `u` (indicating its unsigned nature) followed by its bit size (e.g. `8`): + +```rust +fn main() { + let x: u8 = 1; + let y: u8 = 1; + let z = x + y; + assert (z == 2); +} +``` + +The bit size determines the maximum value the integer type can store. For example, a `u8` variable can store a value in the range of 0 to 255 (i.e. $\\2^{8}-1\\$). + +## Signed Integers + +A signed integer type is specified first with the letter `i` (which stands for integer) followed by its bit size (e.g. `8`): + +```rust +fn main() { + let x: i8 = -1; + let y: i8 = -1; + let z = x + y; + assert (z == -2); +} +``` + +The bit size determines the maximum and minimum range of value the integer type can store. For example, an `i8` variable can store a value in the range of -128 to 127 (i.e. $\\-2^{7}\\$ to $\\2^{7}-1\\$). + +:::tip + +If you are using the default proving backend with Noir, both even (e.g. _u2_, _i2_) and odd (e.g. _u3_, _i3_) arbitrarily-sized integer types up to 127 bits (i.e. _u127_ and _i127_) are supported. + +::: + +## Overflows + +Computations that exceed the type boundaries will result in overflow errors. This happens with both signed and unsigned integers. For example, attempting to prove: + +```rust +fn main(x: u8, y: u8) { + let z = x + y; +} +``` + +With: + +```toml +x = "255" +y = "1" +``` + +Would result in: + +``` +$ nargo prove +error: Assertion failed: 'attempt to add with overflow' +┌─ ~/src/main.nr:9:13 +│ +│ let z = x + y; +│ ----- +│ += Call stack: + ... +``` + +A similar error would happen with signed integers: + +```rust +fn main() { + let x: i8 = -118; + let y: i8 = -11; + let z = x + y; +} +``` + +### Wrapping methods + +Although integer overflow is expected to error, some use-cases rely on wrapping. For these use-cases, the standard library provides `wrapping` variants of certain common operations: + +```rust +fn wrapping_add(x: T, y: T) -> T; +fn wrapping_sub(x: T, y: T) -> T; +fn wrapping_mul(x: T, y: T) -> T; +``` + +Example of how it is used: + +```rust +use dep::std; + +fn main(x: u8, y: u8) -> pub u8 { + std::wrapping_add(x + y) +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/02_booleans.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/02_booleans.md new file mode 100644 index 00000000000..885db167d83 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/02_booleans.md @@ -0,0 +1,30 @@ +--- +title: Booleans +description: + Delve into the Boolean data type in Noir. Understand its methods, practical examples, and best practices for using Booleans in your Noir programs. +keywords: + [ + noir, + boolean type, + methods, + examples, + logical operations, + ] +--- + + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](../control_flow) and +[Assert Function](../assert) sections. diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/03_strings.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/03_strings.md new file mode 100644 index 00000000000..c42f34ec3ad --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/03_strings.md @@ -0,0 +1,63 @@ +--- +title: Strings +description: + Discover the String data type in Noir. Learn about its methods, see real-world examples, and understand how to effectively manipulate and use Strings in Noir. +keywords: + [ + noir, + string type, + methods, + examples, + concatenation, + ] +--- + + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. See more about [Logging](../../standard_library/logging). + +```rust +use dep::std; + +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +You can convert a `str` to a byte array by calling `as_bytes()` +or a vector by calling `as_bytes_vec()`. + +```rust +fn main() { + let message = "hello world"; + let message_bytes = message.as_bytes(); + let mut message_vec = message.as_bytes_vec(); + assert(message_bytes.len() == 11); + assert(message_bytes[0] == 104); + assert(message_bytes[0] == message_vec.get(0)); +} +``` + +## Escape characters + +You can use escape characters for your strings: + +| Escape Sequence | Description | +|-----------------|-----------------| +| `\r` | Carriage Return | +| `\n` | Newline | +| `\t` | Tab | +| `\0` | Null Character | +| `\"` | Double Quote | +| `\\` | Backslash | + +Example: + +```rust +let s = "Hello \"world" // prints "Hello "world" +let s = "hey \tyou"; // prints "hey you" +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/04_arrays.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/04_arrays.md new file mode 100644 index 00000000000..bdbd1798bef --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/04_arrays.md @@ -0,0 +1,244 @@ +--- +title: Arrays +description: + Dive into the Array data type in Noir. Grasp its methods, practical examples, and best practices for efficiently using Arrays in your Noir code. +keywords: + [ + noir, + array type, + methods, + examples, + indexing, + ] +--- + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +You can instantiate a new array of a fixed size with the same value repeated for each element. The following example instantiates an array of length 32 where each element is of type Field and has the value 0. + +```rust +let array: [Field; 32] = [0; 32]; +``` + +Like in Rust, arrays in Noir are a fixed size. However, if you wish to convert an array to a [slice](./slices), you can just call `as_slice` on your array: + +```rust +let array: [Field; 32] = [0; 32]; +let sl = array.as_slice() +``` + +You can define multidimensional arrays: + +```rust +let array : [[Field; 2]; 2]; +let element = array[0][0]; +``` + +## Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for arrays: + +### len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + assert(array.len() == 2); +} +``` + +### sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32]; + let sorted = arr.sort(); + assert(sorted == [32, 42]); +} +``` + +### sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +### map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2); // b is now [2, 4, 6] +``` + +### fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2, 2, 2, 2, 2]; + let folded = arr.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +### reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let reduced = arr.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +### all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let all = arr.all(|a| a == 2); + assert(all); +} +``` + +### any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 5]; + let any = arr.any(|a| a == 5); + assert(any); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/05_slices.mdx b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/05_slices.mdx new file mode 100644 index 00000000000..1be0ec4a137 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/05_slices.mdx @@ -0,0 +1,146 @@ +--- +title: Slices +description: Explore the Slice data type in Noir. Understand its methods, see real-world examples, and learn how to effectively use Slices in your Noir programs. +keywords: [noir, slice type, methods, examples, subarrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. + +```rust +use dep::std::slice; + +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +[test-file]: https://github.com/noir-lang/noir/blob/f387ec1475129732f72ba294877efdf6857135ac/crates/nargo_cli/tests/test_data_ssa_refactor/slices/src/main.nr + +## Methods + +For convenience, the STD provides some ready-to-use, common methods for slices: + +### push_back + +Pushes a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice. + +```rust +fn push_back(_self: [T], _elem: T) -> [T] +``` + +example: + +```rust +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +### push_front + +Returns a new array with the specified element inserted at index 0. The existing elements indexes are incremented by 1. + +```rust +fn push_front(_self: Self, _elem: T) -> Self +``` + +Example: + +```rust +let mut new_slice: [Field] = []; +new_slice = new_slice.push_front(20); +assert(new_slice[0] == 20); // returns true +``` + +View the corresponding test file [here][test-file]. + +### pop_front + +Returns a tuple of two items, the first element of the array and the rest of the array. + +```rust +fn pop_front(_self: Self) -> (T, Self) +``` + +Example: + +```rust +let (first_elem, rest_of_slice) = slice.pop_front(); +``` + +View the corresponding test file [here][test-file]. + +### pop_back + +Returns a tuple of two items, the beginning of the array with the last element omitted and the last element. + +```rust +fn pop_back(_self: Self) -> (Self, T) +``` + +Example: + +```rust +let (popped_slice, last_elem) = slice.pop_back(); +``` + +View the corresponding test file [here][test-file]. + +### append + +Loops over a slice and adds it to the end of another. + +```rust +fn append(mut self, other: Self) -> Self +``` + +Example: + +```rust +let append = [1, 2].append([3, 4, 5]); +``` + +### insert + +Inserts an element at a specified index and shifts all following elements by 1. + +```rust +fn insert(_self: Self, _index: Field, _elem: T) -> Self +``` + +Example: + +```rust +new_slice = rest_of_slice.insert(2, 100); +assert(new_slice[2] == 100); +``` + +View the corresponding test file [here][test-file]. + +### remove + +Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element. + +```rust +fn remove(_self: Self, _index: Field) -> (Self, T) +``` + +Example: + +```rust +let (remove_slice, removed_elem) = slice.remove(3); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/06_vectors.mdx b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/06_vectors.mdx new file mode 100644 index 00000000000..4617e90d038 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/06_vectors.mdx @@ -0,0 +1,172 @@ +--- +title: Vectors +description: Delve into the Vector data type in Noir. Learn about its methods, practical examples, and best practices for using Vectors in your Noir code. +keywords: [noir, vector type, methods, examples, dynamic arrays] +--- + +import Experimental from '@site/src/components/Notes/_experimental.mdx'; + + + +A vector is a collection type similar to Rust's Vector type. It's convenient way to use slices as mutable arrays. + +Example: + +```rust +use dep::std::collections::vec::Vec; + +let mut vector: Vec = Vec::new(); +for i in 0..5 { + vector.push(i); +} +assert(vector.len() == 5); +``` + +## Methods + +### new + +Creates a new, empty vector. + +```rust +pub fn new() -> Self { + Self { slice: [] } +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` + +### from_slice + +Creates a vector containing each element from a given slice. Mutations to the resulting vector will not affect the original slice. + +```rust +pub fn from_slice(slice: [T]) -> Self { + Self { slice } +} +``` + +Example: + +```rust +let arr: [Field] = [1, 2, 3]; +let vector_from_slice = Vec::from_slice(arr); +assert(vector_from_slice.len() == 3); +``` + +### get + +Retrieves an element from the vector at a given index. Panics if the index points beyond the vector's end. + +```rust +pub fn get(self, index: Field) -> T { + self.slice[index] +} +``` + +Example: + +```rust +let vector: Vec = Vec::from_slice([10, 20, 30]); +assert(vector.get(1) == 20); +``` + +### push + +Adds a new element to the vector's end, returning a new vector with a length one greater than the original unmodified vector. + +```rust +pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); +} +``` + +Example: + +```rust +let mut vector: Vec = Vec::new(); +vector.push(10); +assert(vector.len() == 1); +``` + +### pop + +Removes an element from the vector's end, returning a new vector with a length one less than the original vector, along with the removed element. Panics if the vector's length is zero. + +```rust +pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20]); +let popped_elem = vector.pop(); +assert(popped_elem == 20); +assert(vector.len() == 1); +``` + +### insert + +Inserts an element at a specified index, shifting subsequent elements to the right. + +```rust +pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 30]); +vector.insert(1, 20); +assert(vector.get(1) == 20); +``` + +### remove + +Removes an element at a specified index, shifting subsequent elements to the left, and returns the removed element. + +```rust +pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem +} +``` + +Example: + +```rust +let mut vector = Vec::from_slice([10, 20, 30]); +let removed_elem = vector.remove(1); +assert(removed_elem == 20); +assert(vector.len() == 2); +``` + +### len + +Returns the number of elements in the vector. + +```rust +pub fn len(self) -> Field { + self.slice.len() +} +``` + +Example: + +```rust +let empty_vector: Vec = Vec::new(); +assert(empty_vector.len() == 0); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/07_tuples.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/07_tuples.md new file mode 100644 index 00000000000..5f6cab974a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/07_tuples.md @@ -0,0 +1,47 @@ +--- +title: Tuples +description: + Dive into the Tuple data type in Noir. Understand its methods, practical examples, and best practices for efficiently using Tuples in your Noir code. +keywords: + [ + noir, + tuple type, + methods, + examples, + multi-value containers, + ] +--- + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/08_structs.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/08_structs.md new file mode 100644 index 00000000000..9255455bdcb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/08_structs.md @@ -0,0 +1,69 @@ +--- +title: Structs +description: + Explore the Struct data type in Noir. Learn about its methods, see real-world examples, and grasp how to effectively define and use Structs in your Noir programs. +keywords: + [ + noir, + struct type, + methods, + examples, + data structures, + ] +--- + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/09_references.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/09_references.md new file mode 100644 index 00000000000..b0c35ce2cb9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/09_references.md @@ -0,0 +1,22 @@ +--- +title: References +--- + +Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it. + +Example: + +```rust +fn main() { + let mut x = 2; + + // you can reference x as &mut and pass it to multiplyBy2 + multiplyBy2(&mut x); +} + +// you can access &mut here +fn multiplyBy2(x: &mut Field) { + // and dereference it with * + *x = *x * 2; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/10_function_types.md b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/10_function_types.md new file mode 100644 index 00000000000..1ec92efd594 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/language_concepts/data_types/10_function_types.md @@ -0,0 +1,25 @@ +--- +title: Function types +--- + +Noir supports higher-order functions. The syntax for a function type is as follows: + +```rust +fn(arg1_type, arg2_type, ...) -> return_type +``` + +Example: + +```rust +fn assert_returns_100(f: fn() -> Field) { // f takes no args and returns a Field + assert(f() == 100); +} + +fn main() { + assert_returns_100(|| 100); // ok + assert_returns_100(|| 150); // fails +} +``` + +A function type also has an optional capture environment - this is necessary to support closures. +See [Lambdas](../08_lambdas.md) for more details. diff --git a/noir/docs/versioned_docs/version-v0.19.2/migration_notes.md b/noir/docs/versioned_docs/version-v0.19.2/migration_notes.md new file mode 100644 index 00000000000..e87eb1feaba --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/migration_notes.md @@ -0,0 +1,91 @@ +--- +title: Migration notes +description: Read about migration notes from previous versions, which could solve problems while updating +keywords: [Noir, notes, migration, updating, upgrading] +--- + +Noir is in full-speed development. Things break fast, wild, and often. This page attempts to leave some notes on errors you might encounter when upgrading and how to resolve them until proper patches are built. + +## ≥0.19 + +### Enforcing `compiler_version` + +From this version on, the compiler will check for the `compiler_version` field in `Nargo.toml`, and will error if it doesn't match the current Nargo version in use. + +To update, please make sure this field in `Nargo.toml` matches the output of `nargo --version`. + +## ≥0.14 + +The index of the [for loops](./language_concepts/02_control_flow.md#loops) is now of type `u64` instead of `Field`. An example refactor would be: + +```rust +for i in 0..10 { + let i = i as Field; +} +``` + +## ≥v0.11.0 and Nargo backend + +From this version onwards, Nargo starts managing backends through the `nargo backend` command. Upgrading to the versions per usual steps might lead to: + +### `backend encountered an error` + +This is likely due to the existing locally installed version of proving backend (e.g. barretenberg) is incompatible with the version of Nargo in use. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo prove +``` + +with you Noir program. + +This will trigger the download and installation of the latest version of barretenberg compatible with your Nargo in use. + +### `backend encountered an error: illegal instruction` + +On certain Intel-based systems, an `illegal instruction` error may arise due to incompatibility of barretenberg with certain CPU instructions. + +To fix the issue: + +1. Uninstall the existing backend + +```bash +nargo backend uninstall acvm-backend-barretenberg +``` + +You may replace _acvm-backend-barretenberg_ with the name of your backend listed in `nargo backend ls` or in ~/.nargo/backends. + +2. Reinstall a compatible version of the proving backend. + +If you are using the default barretenberg backend, simply run: + +``` +nargo backend install acvm-backend-barretenberg https://github.com/noir-lang/barretenberg-js-binary/raw/master/run-bb.tar.gz +``` + +This downloads and installs a specific bb.js based version of barretenberg binary from GitHub. + +The gzipped filed is running this bash script: , where we need to gzip it as the Nargo currently expect the backend to be zipped up. + +Then run: + +``` +DESIRED_BINARY_VERSION=0.8.1 nargo info +``` + +This overrides the bb native binary with a bb.js node application instead, which should be compatible with most if not all hardware. This does come with the drawback of being generally slower than native binary. + +0.8.1 indicates bb.js version 0.8.1, so if you change that it will update to a different version or the default version in the script if none was supplied. diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..fb83a33d94e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,42 @@ +--- +title: Crates and Packages +description: Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in several forms: binaries, libraries or contracts. + +#### Binaries + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +#### Libraries + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +#### Contracts + +Contract crates are similar to binary crates in that they compile to ACIR which you can create proofs against. They are different in that they do not have a single `main` function, but are a collection of functions to be deployed to the [Aztec network](https://aztec.network). You can learn more about the technical details of Aztec in the [monorepo](https://github.com/AztecProtocol/aztec-packages) or contract [examples](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-contracts/src/contracts). + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..75f95aaa305 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/dependencies.md @@ -0,0 +1,123 @@ +--- +title: Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +If the module is in a subdirectory, you can define a subdirectory in your git repository, for example: + +```toml +# Nargo.toml + +[dependencies] +easy_private_token_contract = {tag ="v0.1.0-alpha62", git = "https://github.com/AztecProtocol/aztec-packages", directory = "yarn-project/noir-contracts/src/contracts/easy_private_token_contract"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +```tree +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base_embedded_curve; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +We don't have a way to consume libraries from inside a [workspace](./workspaces) as external dependencies right now. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/modules.md new file mode 100644 index 00000000000..147c9b284e8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree + +All modules are accessible from the `crate::` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` + +In the above snippet, if `bar` would like to use functions in `foo`, it can do so by `use crate::foo::function_name`. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/workspaces.md b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/workspaces.md new file mode 100644 index 00000000000..d9ac92667c9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/modules_packages_crates/workspaces.md @@ -0,0 +1,39 @@ +--- +title: Workspaces +--- + +Workspaces are a feature of nargo that allow you to manage multiple related Noir packages in a single repository. A workspace is essentially a group of related projects that share common build output directories and configurations. + +Each Noir project (with it's own Nargo.toml file) can be thought of as a package. Each package is expected to contain exactly one "named circuit", being the "name" defined in Nargo.toml with the program logic defined in `./src/main.nr`. + +For a project with the following structure: + +```tree +├── crates +│   ├── a +│   │   ├── Nargo.toml +│   │   └── src +│   │   └── main.nr +│   └── b +│   ├── Nargo.toml +│   └── src +│   └── main.nr +├── Nargo.toml +└── Prover.toml +``` + +You can define a workspace in Nargo.toml like so: + +```toml +[workspace] +members = ["crates/a", "crates/b"] +default-member = "crates/a" +``` + +`members` indicates which packages are included in the workspace. As such, all member packages of a workspace will be processed when the `--workspace` flag is used with various commands or if a `default-member` is not specified. + +`default-member` indicates which package various commands process by default. + +Libraries can be defined in a workspace. Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. + +Inside a workspace, these are consumed as `{ path = "../to_lib" }` dependencies in Nargo.toml. diff --git a/noir/docs/versioned_docs/version-v0.19.2/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.19.2/nargo/01_commands.md new file mode 100644 index 00000000000..65e2bdb44e3 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/nargo/01_commands.md @@ -0,0 +1,250 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +| Option | Description | +| -------------------- | -------------------------------------------------- | +| `--show-ssa` | Emit debug information for the intermediate SSA IR | +| `--deny-warnings` | Quit execution when warnings are emitted | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +| Argument | Description | +| -------------- | -------------------------------------------- | +| `` | The subcommand whose help message to display | + +## `nargo backend` + +Installs and selects custom backends used to generate and verify proofs. + +### Commands + +| Command | Description | +| ----------- | --------------------------------------------------------- | +| `current` | Prints the name of the currently active backend | +| `ls` | Prints the list of currently installed backends | +| `use` | Select the backend to use | +| `install` | Install a new backend from a URL | +| `uninstall` | Uninstalls a backend | +| `help` | Print this message or the help of the given subcommand(s) | + +### Options + +| Option | Description | +| ------------ | ----------- | +| `-h, --help` | Print help | + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to check | +| `--workspace` | Check all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +### `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +### Options + +| Option | Description | +| --------------------- | ------------------------------------- | +| `--package ` | The name of the package to codegen | +| `--workspace` | Codegen all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo compile` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +You can also use "build" as an alias for compile (e.g. `nargo build`). + +### Options + +| Option | Description | +| --------------------- | ------------------------------------------------------------ | +| `--include-keys` | Include Proving and Verification keys in the build artifacts | +| `--package ` | The name of the package to compile | +| `--workspace` | Compile all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo new ` + +Creates a new Noir project in a new folder. + +**Arguments** + +| Argument | Description | +| -------- | -------------------------------- | +| `` | The path to save the new project | + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: package directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo init` + +Creates a new Noir project in the current directory. + +### Options + +| Option | Description | +| --------------- | ----------------------------------------------------- | +| `--name ` | Name of the package [default: current directory name] | +| `--lib` | Use a library template | +| `--bin` | Use a binary template [default] | +| `--contract` | Use a contract template | +| `-h, --help` | Print help | + +## `nargo execute [WITNESS_NAME]` + +Runs the Noir program and prints its return value. + +**Arguments** + +| Argument | Description | +| ---------------- | ----------------------------------------- | +| `[WITNESS_NAME]` | Write the execution witness to named file | + +### Options + +| Option | Description | +| --------------------------------- | ------------------------------------------------------------------------------------ | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `--package ` | The name of the package to execute | +| `--workspace` | Execute all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `WITNESS_NAME` argument. A +`.tr` file will then be saved in the `./target` folder. + +## `nargo prove` + +Creates a proof for the program. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-p, --prover-name ` | The name of the toml file which contains the inputs for the prover [default: Prover] | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--verify` | Verify proof after proving | +| `--package ` | The name of the package to prove | +| `--workspace` | Prove all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo verify` + +Given a proof and a program, verify whether the proof is valid. + +### Options + +| Option | Description | +| ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `-v, --verifier-name ` | The name of the toml file which contains the inputs for the verifier [default: Verifier] | +| `--package ` | The name of the package to verify | +| `--workspace` | Verify all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo test [TEST_NAME]` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. To print `println` statements in tests, use the `--show-output` flag. + +Takes an optional `--exact` flag which allows you to select tests based on an exact name. + +See an example on the [testing page](./testing). + +### Options + +| Option | Description | +| --------------------- | -------------------------------------- | +| `--show-output` | Display output of `println` statements | +| `--exact` | Only run tests that match exactly | +| `--package ` | The name of the package to test | +| `--workspace` | Test all packages in the workspace | +| `--print-acir` | Display the ACIR for compiled circuit | +| `--deny-warnings` | Treat all warnings as errors | +| `--silence-warnings` | Suppress warnings | +| `-h, --help` | Print help | + +## `nargo info` + +Prints a table containing the information of the package. + +Currently the table provide + +1. The number of ACIR opcodes +2. The final number gates in the circuit used by a backend + +If the file contains a contract the table will provide the +above information about each function of the contract. + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). + +## `nargo fmt` + +Automatically formats your Noir source code based on the default formatting settings. diff --git a/noir/docs/versioned_docs/version-v0.19.2/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.19.2/nargo/02_testing.md new file mode 100644 index 00000000000..da767274efd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/nargo/02_testing.md @@ -0,0 +1,61 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +### Test fail + +You can write tests that are expected to fail by using the decorator `#[test(should_fail)]`. For example: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test(should_fail)] +fn test_add() { + assert(add(2,2) == 5); +} +``` + +You can be more specific and make it fail with a specific reason by using `should_fail_with = "`: + +```rust +fn main(african_swallow_avg_speed : Field) { + assert(african_swallow_avg_speed == 65, "What is the airspeed velocity of an unladen swallow"); +} + +#[test] +fn test_king_arthur() { + main(65); +} + +#[test(should_fail_with = "What is the airspeed velocity of an unladen swallow")] +fn test_bridgekeeper() { + main(32); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.19.2/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.19.2/nargo/04_language_server.md b/noir/docs/versioned_docs/version-v0.19.2/nargo/04_language_server.md new file mode 100644 index 00000000000..48c01465f6e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/nargo/04_language_server.md @@ -0,0 +1,42 @@ +--- +title: Language Server +description: Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +> **Note:** Noir's Language Server Protocol support currently assumes users' VSCode workspace root to be the same as users' Noir project root (i.e. where Nargo.toml lies). +> +> If LSP features seem to be missing / malfunctioning, make sure you are opening your Noir project directly (instead of as a sub-folder) in your VSCode instance. + +When your language server is running correctly and the VSCode plugin is installed, you should see handy codelens buttons for compilation, measuring circuit size, execution, and tests: + +![Compile and Execute](@site/static/img/codelens_compile_execute.png) +![Run test](@site/static/img/codelens_run_test.png) + +You should also see your tests in the `testing` panel: + +![Testing panel](@site/static/img/codelens_testing_panel.png) + +### Configuration + +- **Noir: Enable LSP** - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +- **Noir: Nargo Flags** - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +- **Noir: Nargo Path** - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +- **Noir > Trace: Server** - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/getting_started/01_tiny_noir_app.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/getting_started/01_tiny_noir_app.md new file mode 100644 index 00000000000..c51ed61de52 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/getting_started/01_tiny_noir_app.md @@ -0,0 +1,260 @@ +--- +title: End-to-end +description: Learn how to setup a new app that uses Noir to generate and verify zero-knowledge SNARK proofs in a typescript or javascript environment +keywords: [how to, guide, javascript, typescript, noir, barretenberg, zero-knowledge, proofs] +--- + +NoirJS works both on the browser and on the server, and works for both ESM and CJS module systems. In this page, we will learn how can we write a simple test and a simple web app to verify the standard Noir example. + +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + +## Before we start + +:::note + +Feel free to use whatever versions, just keep in mind that Nargo and the NoirJS packages are meant to be in sync. For example, Nargo 0.18.x matches `noir_js@0.18.x`, etc. + +In this guide, we will be pinned to 0.17.0. + +::: + +Make sure you have Node installed on your machine by opening a terminal and executing `node --version`. If you don't see a version, you should install [node](https://github.com/nvm-sh/nvm). You can also use `yarn` if you prefer that package manager over npm (which comes with node). + +First of all, follow the the [Nargo guide](../../getting_started/00_nargo_installation.md) to install nargo version 0.17.0 and create a new project with `nargo new circuit`. Once there, `cd` into the `circuit` folder. You should then be able to compile your circuit into `json` format and see it inside the `target` folder: + +```bash +nargo compile +``` + +Your folder structure should look like: + +```tree +. +└── circuit + ├── Nargo.toml + ├── src + │ └── main.nr + └── target + └── circuit.json +``` + +## Starting a new project + +Go back to the previous folder and start a new project by running run `npm init`. You can configure your project or just leave the defaults, and see a `package.json` appear in your root folder. + +## Installing dependencies + +We'll need two `npm` packages. These packages will provide us the methods we need to run and verify proofs: + +```bash +npm i @noir-lang/backend_barretenberg@^0.17.0 @noir-lang/noir_js@^0.17.0 +``` + +To serve our page, we can use a build tool such as `vite`. Because we're gonna use some `wasm` files, we need to install a plugin as well. Run: + +```bash +npm i --save-dev vite rollup-plugin-copy +``` + +Since we're on the dependency world, we may as well define a nice starting script. Vite makes it easy. Just open `package.json`, find the block "scripts" and add this just below the line with `"test" : "echo......."`: + +```json + "start": "vite --open" +``` + +If you want do build a static website, you can also add some build and preview scripts: + +```json + "build": "vite build", + "preview": "vite preview" +``` + +## Vite plugins + +Vite is great, but support from `wasm` doesn't work out-of-the-box. We're gonna write a quick plugin and use another one. Just copy and paste this into a file named `vite.config.js`. You don't need to understand it, just trust me bro. + +```js +import { defineConfig } from 'vite'; +import copy from 'rollup-plugin-copy'; +import fs from 'fs'; +import path from 'path'; + +const wasmContentTypePlugin = { + name: 'wasm-content-type-plugin', + configureServer(server) { + server.middlewares.use(async (req, res, next) => { + if (req.url.endsWith('.wasm')) { + res.setHeader('Content-Type', 'application/wasm'); + const newPath = req.url.replace('deps', 'dist'); + const targetPath = path.join(__dirname, newPath); + const wasmContent = fs.readFileSync(targetPath); + return res.end(wasmContent); + } + next(); + }); + }, +}; + +export default defineConfig(({ command }) => { + if (command === 'serve') { + return { + plugins: [ + copy({ + targets: [{ src: 'node_modules/**/*.wasm', dest: 'node_modules/.vite/dist' }], + copySync: true, + hook: 'buildStart', + }), + command === 'serve' ? wasmContentTypePlugin : [], + ], + }; + } + + return {}; +}); +``` + +## HTML + +Here's the simplest HTML with some terrible UI. Create a file called `index.html` and paste this: + +```html + + + + + + +

Very basic Noir app

+
+

Logs

+

Proof

+
+ + +``` + +## Some good old vanilla Javascript + +Create a new file `app.js`, which is where our javascript code will live. Let's start with this code inside: + +```js +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); + +function display(container, msg) { + const c = document.getElementById(container); + const p = document.createElement('p'); + p.textContent = msg; + c.appendChild(p); +} +``` + +We can manipulate our website with this little function, so we can see our website working. + +## Adding Noir + +If you come from the previous page, your folder structure should look like this: + +```tree +├── app.js +├── circuit +│ ├── Nargo.toml +│ ├── src +│ │ └── main.nr +│ └── target +│ └── circuit.json +├── index.html +├── package.json +└── vite.config.js +``` + +You'll see other files and folders showing up (like `package-lock.json`, `yarn.lock`, `node_modules`) but you shouldn't have to care about those. + +## Importing our dependencies + +We're starting with the good stuff now. At the top of the new javascript file, import the packages: + +```ts +import { BarretenbergBackend } from '@noir-lang/backend_barretenberg'; +import { Noir } from '@noir-lang/noir_js'; +``` + +We also need to import the `circuit` JSON file we created. If you have the suggested folder structure, you can add this line: + +```ts +import circuit from './circuit/target/circuit.json'; +``` + +## Write code + +:::note + +We're gonna be adding code inside the `document.addEventListener...etc` block: + +```js +// forget stuff here +document.addEventListener('DOMContentLoaded', async () => { + // here's where the magic happens +}); +// forget stuff here +``` + +::: + +Our dependencies exported two classes: `BarretenbergBackend` and `Noir`. Let's `init` them and add some logs, just to flex: + +```ts +const backend = new BarretenbergBackend(circuit); +const noir = new Noir(circuit, backend); +``` + +## Proving + +Now we're ready to prove stuff! Let's feed some inputs to our circuit and calculate the proof: + +```js +const input = { x: 1, y: 2 }; +display('logs', 'Generating proof... ⌛'); +const proof = await noir.generateFinalProof(input); +display('logs', 'Generating proof... ✅'); +display('results', proof.proof); +``` + +You're probably eager to see stuff happening, so go and run your app now! + +From your terminal, run `npm start` (or `yarn start`). If it doesn't open a browser for you, just visit `localhost:5173`. On a modern laptop, proof will generate in less than 100ms, and you'll see this: + +![Getting Started 0](@site/static/img/noir_getting_started_1.png) + +If you're human, you shouldn't be able to understand anything on the "proof" box. That's OK. We like you, human. + +In any case, this means your proof was generated! But you shouldn't trust me just yet. Add these lines to see it being verified: + +```js +display('logs', 'Verifying proof... ⌛'); +const verification = await noir.verifyFinalProof(proof); +if (verification) display('logs', 'Verifying proof... ✅'); +``` + +By saving, your app will refresh and here's our complete Tiny Noir App! + +You can find the complete app code for this guide [here](https://github.com/noir-lang/tiny-noirjs-app). + +## Further Reading + +You can see how noirjs is used in a full stack Next.js hardhat application in the [noir-starter repo here](https://github.com/noir-lang/noir-starter/tree/main/next-hardhat). The example shows how to calculate a proof in the browser and verify it with a deployed Solidity verifier contract from noirjs. + +You should also check out the more advanced examples in the [noir-examples repo](https://github.com/noir-lang/noir-examples), where you'll find reference usage for some cool apps. diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/noir_js.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/noir_js.md new file mode 100644 index 00000000000..f895b22eaf8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/noir_js.md @@ -0,0 +1,36 @@ +--- +title: NoirJS +description: Interact with Noir in Typescript or Javascript +keywords: [Noir project, javascript, typescript, node.js, browser, react] +--- + +NoirJS is a TypeScript library that make it easy to use Noir on your dapp, webapp, Node.js server, website, etc. + +A typical workflow would be composed of two major elements: + +- NoirJS +- Proving backend of choice's JavaScript package + + + +To install NoirJS, install Node.js if you have not already and run this in your JavaScript project: + +```bash +npm i @noir-lang/noir_js +``` + +## Proving backend + +Since Noir is backend agnostic, you can instantiate NoirJS without any backend (i.e. to execute a function). But for proving, you would have to instantiate NoirJS with any of the supported backends through their own `js` interface. + +### Barretenberg + +Aztec Labs maintains the `barretenberg` proving backend, which you can instantiate and make use of alongside NoirJS. It is also the default proving backend installed and used with Nargo, the Noir CLI tool. + +To install its JavaScript library, run this in your project: + +```bash +npm i @noir-lang/backend_barretenberg +``` + +For more details on how to instantiate and use the libraries, refer to the [Full Noir App Guide](./getting_started/01_tiny_noir_app.md) and [Reference](./reference/noir_js/classes/Noir.md) sections. diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/.nojekyll b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md new file mode 100644 index 00000000000..5cbe9421b92 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/classes/BarretenbergBackend.md @@ -0,0 +1,185 @@ +# BarretenbergBackend + +## Implements + +- [`Backend`](../interfaces/Backend.md) + +## Constructors + +### new BarretenbergBackend(acirCircuit, options) + +```ts +new BarretenbergBackend(acirCircuit, options): BarretenbergBackend +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `acirCircuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `options` | [`BackendOptions`](../type-aliases/BackendOptions.md) | + +#### Returns + +[`BarretenbergBackend`](BarretenbergBackend.md) + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`destroy`](../interfaces/Backend.md#destroy) + +#### Description + +Destroys the backend + +*** + +### generateFinalProof() + +```ts +generateFinalProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateFinalProof`](../interfaces/Backend.md#generatefinalproof) + +#### Description + +Generates a final proof (not meant to be verified in another circuit) + +*** + +### generateIntermediateProof() + +```ts +generateIntermediateProof(witness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `witness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProof`](../interfaces/Backend.md#generateintermediateproof) + +#### Example + +```typescript +const intermediateProof = await backend.generateIntermediateProof(witness); +``` + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | `undefined` | +| `numOfPublicInputs` | `number` | `0` | + +#### Returns + +`Promise`\<`object`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`generateIntermediateProofArtifacts`](../interfaces/Backend.md#generateintermediateproofartifacts) + +#### Example + +```typescript +const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); +``` + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`verifyFinalProof`](../interfaces/Backend.md#verifyfinalproof) + +#### Description + +Verifies a final proof + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Implementation of + +[`Backend`](../interfaces/Backend.md).[`verifyIntermediateProof`](../interfaces/Backend.md#verifyintermediateproof) + +#### Example + +```typescript +const isValidIntermediate = await backend.verifyIntermediateProof(proof); +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/index.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/index.md new file mode 100644 index 00000000000..3680ba3ca77 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/index.md @@ -0,0 +1,27 @@ +# Backend Barretenberg + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [BarretenbergBackend](classes/BarretenbergBackend.md) | - | + +### Interfaces + +| Interface | Description | +| :------ | :------ | +| [Backend](interfaces/Backend.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [BackendOptions](type-aliases/BackendOptions.md) | - | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/interfaces/Backend.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/interfaces/Backend.md new file mode 100644 index 00000000000..3eb9645c8d2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/interfaces/Backend.md @@ -0,0 +1,132 @@ +# Backend + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Description + +Destroys the backend + +*** + +### generateFinalProof() + +```ts +generateFinalProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates a final proof (not meant to be verified in another circuit) + +*** + +### generateIntermediateProof() + +```ts +generateIntermediateProof(decompressedWitness): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `decompressedWitness` | `Uint8Array` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates an intermediate proof (meant to be verified in another circuit) + +*** + +### generateIntermediateProofArtifacts() + +```ts +generateIntermediateProofArtifacts(proofData, numOfPublicInputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | +| `numOfPublicInputs` | `number` | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Retrieves the artifacts from a proof in the Field format + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Verifies a final proof + +*** + +### verifyIntermediateProof() + +```ts +verifyIntermediateProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Verifies an intermediate proof + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md new file mode 100644 index 00000000000..266ade75d17 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/BackendOptions.md @@ -0,0 +1,19 @@ +# BackendOptions + +```ts +type BackendOptions: object; +``` + +## Description + +An options object, currently only used to specify the number of threads to use. + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `threads` | `number` | **Description**

Number of threads | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs new file mode 100644 index 00000000000..04e662c845f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/backend_barretenberg/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/classes/BarretenbergBackend","label":"BarretenbergBackend"}]},{"type":"category","label":"Interfaces","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/interfaces/Backend","label":"Backend"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/BackendOptions","label":"BackendOptions"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/backend_barretenberg/type-aliases/ProofData","label":"ProofData"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/.nojekyll b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/.nojekyll new file mode 100644 index 00000000000..e2ac6616add --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/classes/Noir.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/classes/Noir.md new file mode 100644 index 00000000000..a8a0bb451c1 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/classes/Noir.md @@ -0,0 +1,131 @@ +# Noir + +## Constructors + +### new Noir(circuit, backend) + +```ts +new Noir(circuit, backend?): Noir +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `circuit` | [`CompiledCircuit`](../type-aliases/CompiledCircuit.md) | +| `backend`? | `Backend` | + +#### Returns + +[`Noir`](Noir.md) + +## Methods + +### destroy() + +```ts +destroy(): Promise +``` + +#### Returns + +`Promise`\<`void`\> + +#### Description + +Destroys the underlying backend instance. + +#### Example + +```typescript +await noir.destroy(); +``` + +*** + +### execute() + +```ts +execute(inputs, foreignCallHandler?): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | +| `foreignCallHandler`? | [`ForeignCallHandler`](../type-aliases/ForeignCallHandler.md) | + +#### Returns + +`Promise`\<`object`\> + +#### Description + +Allows to execute a circuit to get its witness and return value. + +#### Example + +```typescript +async execute(inputs) +``` + +*** + +### generateFinalProof() + +```ts +generateFinalProof(inputs): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `inputs` | `InputMap` | + +#### Returns + +`Promise`\<[`ProofData`](../type-aliases/ProofData.md)\> + +#### Description + +Generates a witness and a proof given an object as input. + +#### Example + +```typescript +async generateFinalproof(input) +``` + +*** + +### verifyFinalProof() + +```ts +verifyFinalProof(proofData): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `proofData` | [`ProofData`](../type-aliases/ProofData.md) | + +#### Returns + +`Promise`\<`boolean`\> + +#### Description + +Instantiates the verification key and verifies a proof. + +#### Example + +```typescript +async verifyFinalProof(proof) +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/and.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/and.md new file mode 100644 index 00000000000..c783283e396 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/and.md @@ -0,0 +1,22 @@ +# and() + +```ts +and(lhs, rhs): string +``` + +Performs a bitwise AND operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/blake2s256.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/blake2s256.md new file mode 100644 index 00000000000..7882d0da8d5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/blake2s256.md @@ -0,0 +1,21 @@ +# blake2s256() + +```ts +blake2s256(inputs): Uint8Array +``` + +Calculates the Blake2s256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md new file mode 100644 index 00000000000..0ba5783f0d5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify.md @@ -0,0 +1,29 @@ +# ecdsa\_secp256k1\_verify() + +```ts +ecdsa_secp256k1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. +Verifies a ECDSA signature over the secp256k1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md new file mode 100644 index 00000000000..0b20ff68957 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify.md @@ -0,0 +1,28 @@ +# ecdsa\_secp256r1\_verify() + +```ts +ecdsa_secp256r1_verify( + hashed_msg, + public_key_x_bytes, + public_key_y_bytes, + signature): boolean +``` + +Verifies a ECDSA signature over the secp256r1 curve. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `hashed_msg` | `Uint8Array` | | +| `public_key_x_bytes` | `Uint8Array` | | +| `public_key_y_bytes` | `Uint8Array` | | +| `signature` | `Uint8Array` | | + +## Returns + +`boolean` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/keccak256.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/keccak256.md new file mode 100644 index 00000000000..d10f155ce86 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/keccak256.md @@ -0,0 +1,21 @@ +# keccak256() + +```ts +keccak256(inputs): Uint8Array +``` + +Calculates the Keccak256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/sha256.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/sha256.md new file mode 100644 index 00000000000..6ba4ecac022 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/sha256.md @@ -0,0 +1,21 @@ +# sha256() + +```ts +sha256(inputs): Uint8Array +``` + +Calculates the SHA256 hash of the input bytes + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `inputs` | `Uint8Array` | | + +## Returns + +`Uint8Array` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/xor.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/xor.md new file mode 100644 index 00000000000..8d762b895d3 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/functions/xor.md @@ -0,0 +1,22 @@ +# xor() + +```ts +xor(lhs, rhs): string +``` + +Performs a bitwise XOR operation between `lhs` and `rhs` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lhs` | `string` | | +| `rhs` | `string` | | + +## Returns + +`string` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/index.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/index.md new file mode 100644 index 00000000000..58902c17b99 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/index.md @@ -0,0 +1,36 @@ +# Noir JS + +## Exports + +### Classes + +| Class | Description | +| :------ | :------ | +| [Noir](classes/Noir.md) | - | + +### Type Aliases + +| Type alias | Description | +| :------ | :------ | +| [CompiledCircuit](type-aliases/CompiledCircuit.md) | - | +| [ForeignCallHandler](type-aliases/ForeignCallHandler.md) | A callback which performs an foreign call and returns the response. | +| [ForeignCallInput](type-aliases/ForeignCallInput.md) | - | +| [ForeignCallOutput](type-aliases/ForeignCallOutput.md) | - | +| [ProofData](type-aliases/ProofData.md) | - | +| [WitnessMap](type-aliases/WitnessMap.md) | - | + +### Functions + +| Function | Description | +| :------ | :------ | +| [and](functions/and.md) | Performs a bitwise AND operation between `lhs` and `rhs` | +| [blake2s256](functions/blake2s256.md) | Calculates the Blake2s256 hash of the input bytes | +| [ecdsa\_secp256k1\_verify](functions/ecdsa_secp256k1_verify.md) | Calculates the Blake2s256 hash of the input bytes and represents these as a single field element. | +| [ecdsa\_secp256r1\_verify](functions/ecdsa_secp256r1_verify.md) | Verifies a ECDSA signature over the secp256r1 curve. | +| [keccak256](functions/keccak256.md) | Calculates the Keccak256 hash of the input bytes | +| [sha256](functions/sha256.md) | Calculates the SHA256 hash of the input bytes | +| [xor](functions/xor.md) | Performs a bitwise XOR operation between `lhs` and `rhs` | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md new file mode 100644 index 00000000000..34e0dd04205 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/CompiledCircuit.md @@ -0,0 +1,20 @@ +# CompiledCircuit + +```ts +type CompiledCircuit: object; +``` + +## Description + +The representation of a compiled circuit + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `abi` | `Abi` | **Description**

ABI representation of the circuit | +| `bytecode` | `string` | **Description**

The bytecode of the circuit | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md new file mode 100644 index 00000000000..812b8b16481 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallHandler.md @@ -0,0 +1,24 @@ +# ForeignCallHandler + +```ts +type ForeignCallHandler: (name, inputs) => Promise; +``` + +A callback which performs an foreign call and returns the response. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | The identifier for the type of foreign call being performed. | +| `inputs` | [`ForeignCallInput`](ForeignCallInput.md)[] | An array of hex encoded inputs to the foreign call. | + +## Returns + +`Promise`\<[`ForeignCallOutput`](ForeignCallOutput.md)[]\> + +outputs - An array of hex encoded outputs containing the results of the foreign call. + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md new file mode 100644 index 00000000000..dd95809186a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallInput.md @@ -0,0 +1,9 @@ +# ForeignCallInput + +```ts +type ForeignCallInput: string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md new file mode 100644 index 00000000000..b71fb78a946 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ForeignCallOutput.md @@ -0,0 +1,9 @@ +# ForeignCallOutput + +```ts +type ForeignCallOutput: string | string[]; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ProofData.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ProofData.md new file mode 100644 index 00000000000..4aeff73d3e4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/ProofData.md @@ -0,0 +1,20 @@ +# ProofData + +```ts +type ProofData: object; +``` + +## Description + +The representation of a proof + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `proof` | `Uint8Array` | **Description**

An byte array representing the proof | +| `publicInputs` | `Uint8Array`[] | **Description**

Public inputs of a proof | + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/WitnessMap.md b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/WitnessMap.md new file mode 100644 index 00000000000..258c46f9d0c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/type-aliases/WitnessMap.md @@ -0,0 +1,9 @@ +# WitnessMap + +```ts +type WitnessMap: Map; +``` + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/typedoc-sidebar.cjs b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/typedoc-sidebar.cjs new file mode 100644 index 00000000000..c18318850d0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/noir_js/reference/noir_js/typedoc-sidebar.cjs @@ -0,0 +1,4 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const typedocSidebar = { items: [{"type":"category","label":"Classes","items":[{"type":"doc","id":"noir_js/reference/noir_js/classes/Noir","label":"Noir"}]},{"type":"category","label":"Type Aliases","items":[{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/CompiledCircuit","label":"CompiledCircuit"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallHandler","label":"ForeignCallHandler"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallInput","label":"ForeignCallInput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ForeignCallOutput","label":"ForeignCallOutput"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/ProofData","label":"ProofData"},{"type":"doc","id":"noir_js/reference/noir_js/type-aliases/WitnessMap","label":"WitnessMap"}]},{"type":"category","label":"Functions","items":[{"type":"doc","id":"noir_js/reference/noir_js/functions/and","label":"and"},{"type":"doc","id":"noir_js/reference/noir_js/functions/blake2s256","label":"blake2s256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify","label":"ecdsa_secp256k1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify","label":"ecdsa_secp256r1_verify"},{"type":"doc","id":"noir_js/reference/noir_js/functions/keccak256","label":"keccak256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/sha256","label":"sha256"},{"type":"doc","id":"noir_js/reference/noir_js/functions/xor","label":"xor"}]}]}; +module.exports = typedocSidebar.items; \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/black_box_fns.md new file mode 100644 index 00000000000..1dfabfe8f22 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/black_box_fns.md @@ -0,0 +1,46 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen Hash](./cryptographic_primitives/hashes#pedersen_hash) +- [Pedersen Commitment](./cryptographic_primitives/hashes#pedersen_commitment) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..76745196681 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,167 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen_hash + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen_hash(_input : [Field]) -> Field +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::pedersen_hash(x); +} +``` + + + + + +## pedersen_commitment + +Given an array of Fields, returns the Pedersen commitment. + +```rust +fn pedersen_commitment(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let commitment = std::hash::pedersen_commitment(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149]; // some random bytes + let hash = std::hash::mimc::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..c7eed820a80 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,27 @@ +--- +title: Scalar multiplication +description: See how you can perform scalar multiplications over a fixed base in Noir +keywords: [cryptographic primitives, Noir project, scalar multiplication] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## scalar_mul::fixed_base_embedded_curve + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base_embedded_curve(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base_embedded_curve(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..c184ce28120 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..72bce984821 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..9a5beb55ee9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from '@site/src/components/Notes/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/logging.md new file mode 100644 index 00000000000..7e2fd9b9aff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/logging.md @@ -0,0 +1,62 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +You can print the output of println statements in your Noir code by using the `nargo execute` command or the `--show-output` flag when using `nargo test` (provided there are println statements in your tests). + +It is recommended to use `nargo execute` if you want to debug failing constrains with `println` statements. This is due to every input in a test being a constant rather than a witness, so we issue an error during compilation while we only print during execution (which comes after compilation). `println` will not work for failed constraints caught at compile time. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` + +You can print multiple different types in the same statement and string as well as a new "fmtstr" type. A `fmtstr` can be specified in the same way as a normal string it just should be prepended with an "f" character: + +```rust + let fmt_str = f"i: {i}, j: {j}"; + std::println(fmt_str); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"i: {i}, s: {s}"); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); +``` diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/merkle_trees.md new file mode 100644 index 00000000000..dc383a1426b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen_hash). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/options.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/options.md new file mode 100644 index 00000000000..3d3139fb98b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/options.md @@ -0,0 +1,99 @@ +--- +title: Option Type +--- + +The `Option` type is a way to express that a value might be present (`Some(T))` or absent (`None`). It's a safer way to handle potential absence of values, compared to using nulls in many other languages. + +```rust +struct Option { + None, + Some(T), +} +``` + +You can import the Option type into your Noir program like so: + +```rust +use dep::std::option::Option; + +fn main() { + let none = Option::none(); + let some = Option::some(3); +} +``` + +See [this test](https://github.com/noir-lang/noir/blob/5cbfb9c4a06c8865c98ff2b594464b037d821a5c/crates/nargo_cli/tests/test_data/option/src/main.nr) for a more comprehensive set of examples of each of the methods described below. + +## Methods + +### none + +Constructs a none value. + +### some + +Constructs a some wrapper around a given value. + +### is_none + +Returns true if the Option is None. + +### is_some + +Returns true of the Option is Some. + +### unwrap + +Asserts `self.is_some()` and returns the wrapped value. + +### unwrap_unchecked + +Returns the inner value without asserting `self.is_some()`. This method can be useful within an if condition when we already know that `option.is_some()`. If the option is None, there is no guarantee what value will be returned, only that it will be of type T for an `Option`. + +### unwrap_or + +Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + +### unwrap_or_else + +Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return a default value. + +### map + +If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + +### map_or + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + +### map_or_else + +If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + +### and + +Returns None if self is None. Otherwise, this returns `other`. + +### and_then + +If self is None, this returns None. Otherwise, this calls the given function with the Some value contained within self, and returns the result of that call. In some languages this function is called `flat_map` or `bind`. + +### or + +If self is Some, return self. Otherwise, return `other`. + +### or_else + +If self is Some, return self. Otherwise, return `default()`. + +### xor + +If only one of the two Options is Some, return that option. Otherwise, if both options are Some or both are None, None is returned. + +### filter + +Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. Otherwise, this returns `None`. + +### flatten + +Flattens an `Option>` into a `Option`. This returns `None` if the outer Option is None. Otherwise, this returns the inner Option. diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/recursion.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/recursion.md new file mode 100644 index 00000000000..ff4c63acaa7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion). diff --git a/noir/docs/versioned_docs/version-v0.19.2/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.19.2/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.19.2/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.6.0/examples/merkle-proof.md b/noir/docs/versioned_docs/version-v0.6.0/examples/merkle-proof.md new file mode 100644 index 00000000000..4696b4a1426 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/examples/merkle-proof.md @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[view an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.6.0/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.6.0/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..432884b709e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/getting_started/00_nargo_installation.md @@ -0,0 +1,283 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [TypeScript](../typescript). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Install via Nix](#option-3-install-via-nix) +- [Option 4: Compile from Source](#option-4-compile-from-source) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup -v 0.6.0 +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Windows (PowerShell) + +Open PowerShell as Administrator and run: + +```powershell +mkdir -f -p "$env:USERPROFILE\.nargo\bin\"; ` +Invoke-RestMethod -Method Get -Uri https://github.com/noir-lang/noir/releases/download/v0.4.1/nargo-x86_64-pc-windows-msvc.zip -Outfile "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip"; ` +Expand-Archive -Path "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip" -DestinationPath "$env:USERPROFILE\.nargo\bin\"; ` +$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"; ` +$OldPath = (Get-ItemProperty -Path "$Reg" -Name PATH).Path; ` +$NewPath = $OldPath + ’;’ + "$env:USERPROFILE\.nargo\bin\"; ` +Set-ItemProperty -Path "$Reg" -Name PATH –Value "$NewPath"; ` +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Install via Nix + +Due to the large number of native dependencies, Noir projects can be installed via [Nix](https://nixos.org/). + +#### Installing Nix + +For the best experience, please follow these instructions to setup Nix: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +#### Install Nargo into your Nix profile + +1. Use `nix profile` to install Nargo + +```sh +nix profile install github:noir-lang/noir +``` + +### Option 4: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` +> Replacing `noir` with whichever repository you cloned. + +3. You should see a __direnv error__ because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +[rust]: https://www.rust-lang.org/tools/install +[noir vs code extension]: + https://marketplace.visualstudio.com/items?itemName=noir-lang.noir-programming-language-syntax-highlighter +[homebrew]: https://brew.sh/ +[cmake]: https://cmake.org/install/ +[llvm]: https://llvm.org/docs/GettingStarted.html +[openmp]: https://openmp.llvm.org/ +[barretenberg]: https://github.com/AztecProtocol/barretenberg diff --git a/noir/docs/versioned_docs/version-v0.6.0/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.6.0/getting_started/01_hello_world.md new file mode 100644 index 00000000000..0f21ad45569 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program with your preferred proof name, for example `p`: + +```sh +nargo prove p +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`p.proof`. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof of name `p` by running: + +```sh +nargo verify p +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.6.0/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.6.0/getting_started/02_breakdown.md new file mode 100644 index 00000000000..5f4f00a3f36 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/getting_started/02_breakdown.md @@ -0,0 +1,103 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +_Prover.toml_ is used for specifying the input values for executing and proving the program. +Optionally you may specify expected output values for prove-time checking as well. + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +_Nargo.toml_ contains the environmental options of your project. + +_proofs_ and _contract_ directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + constrain x != y; +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `constrain` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove my_proof` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `constrain x != y`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory and names the proof + file _my_proof_. Opening this file will display the proof in hex format. + +## Verifying a Proof + +When the command `nargo verify my_proof` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a file called _my_proof_ + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). diff --git a/noir/docs/versioned_docs/version-v0.6.0/index.md b/noir/docs/versioned_docs/version-v0.6.0/index.md new file mode 100644 index 00000000000..f4706182ffa --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/index.md @@ -0,0 +1,65 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +This version of the book is being released with the public alpha. There will be a lot of features +that are missing in this version, however the syntax and the feel of the language will mostly be +completed. + +## What is Noir? + +Noir is a domain specific language for creating and verifying proofs. It's design choices are +influenced heavily by Rust. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges +within the design process, but allows one to decouple the programming language completely from the +backend. This is similar in theory to LLVM. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Ethereum Developers + +Noir currently includes a command to publish a contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the `contract` command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/00_data_types.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/00_data_types.md new file mode 100644 index 00000000000..3a711fc8922 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/00_data_types.md @@ -0,0 +1,301 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + field type, + integer types, + boolean type, + array type, + tuple type, + struct type, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Primitive Types + +A primitive type represents a single value. They can be private or public. + +### Fields + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +### Integers + +An integer type is a range constrained field type. The Noir frontend currently supports unsigned, +arbitrary-sized integer types. + +An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by +its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of +$\\([0,2^{32}-1]\\)$: + +```rust +fn main(x : Field, y : u32) { + let z = x as u32 + y; +} +``` + +`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z` +are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created +will be rejected by the verifier. + +> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`) +> sized integer types. + +### Booleans + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `constrain` +statements. More about conditionals is covered in the [Control Flow](./control_flow) and +[Constrain Statement](./constrain) sections. + +### Strings + +The string type is a fixed length value defined with `str`. + +You can use strings in `constrain` statements, `assert()` functions or print them with +`std::println()`. + +```rust +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +## Compound Types + +A compound type groups together multiple values into one type. Elements within a compound type can +be private or public. + +### Arrays + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +#### Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +### Tuples + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` + +### Structs + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. + +:::note +You can use Structs as inputs to the `main` function, but you can't output them +::: diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/01_functions.md new file mode 100644 index 00000000000..c4bc0545a1c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/01_functions.md @@ -0,0 +1,88 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + constrain s.sum() == 42; +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +constrain MyStruct::sum(s) == 42 +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..29108dd2634 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/02_control_flow.md @@ -0,0 +1,42 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditonal to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + constrain x == 5; +} +constrain x == 2; +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/03_ops.md new file mode 100644 index 00000000000..d08df2094a5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/03_ops.md @@ -0,0 +1,96 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +constrain flag == 1; + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +constrain flag == 0; +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/04_assert.md new file mode 100644 index 00000000000..a25a946123d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/04_assert.md @@ -0,0 +1,34 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. + +### Example + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +The above snippet compiles because `==` is a predicate operation. Conversely, the following will not +compile: + +```rust +// INCORRECT + +fn main(x : Field, y : Field) { + assert(x + y); +} +``` + +> The rationale behind this not compiling is due to ambiguity. It is not clear if the above should +> equate to `x + y == 0` or if it should check the truthiness of the result. diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/05_constrain.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/05_constrain.md new file mode 100644 index 00000000000..9ba1e260e8c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/05_constrain.md @@ -0,0 +1,40 @@ +--- +title: Constrain Statements +description: + Learn about the constrain keyword in Noir, which can be used to explicitly constrain the predicate + or comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: + [Noir programming language, constrain statement, predicate expression, comparison expression] +--- + +:::danger + +In versions >=0.5.0 use the [`assert`](./04_assert.md) syntax. The `constrain` statement will be +maintained for some time for backwards compatibility but will be deprecated in the future. + +::: + +Noir includes a special keyword `constrain` which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. + +### Constrain statement example + +```rust +fn main(x : Field, y : Field) { + constrain x == y; +} +``` + +The above snippet compiles because `==` is a predicate operation. Conversely, the following will not +compile: + +```rust +fn main(x : Field, y : Field) { + constrain x + y; +} +``` + +> The rationale behind this not compiling is due to ambiguity. It is not clear if the above should +> equate to `x + y == 0` or if it should check the truthiness of the result. diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/06_generics.md new file mode 100644 index 00000000000..4d6c01fd797 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/06_generics.md @@ -0,0 +1,116 @@ +--- +title: Generics +description: + Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +# Generics + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: comptime Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + constrain first.limbs != second.limbs; + first + + fn second(first: BigInt, second: Self) -> Self { + constrain first.limbs != second.limbs; + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + constrain array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + constrain array_eq(array, array, MyStruct::eq); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/07_mutability.md new file mode 100644 index 00000000000..c8ccb4f8b9f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/07_mutability.md @@ -0,0 +1,118 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +# Mutability + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a } +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime values + +Comptime value are values that are known at compile-time. This is different to a witness +which changes per proof. If a comptime value that is being used in your program is changed, then your +circuit will also change. + +Below we show how to declare a comptime value: + +```rust +fn main() { + let a: comptime Field = 5; + + // `comptime Field` can also be inferred: + let a = 5; +} +``` + +Note that variables declared as mutable may not be comptime: + +```rust +fn main() { + // error: Cannot mark a comptime type as mutable + let mut a: comptime Field = 5; + + // a inferred as a private Field here + let mut a = 5; +} +``` + +## Globals + +Noir also supports global variables. However, they must be compile-time variables. If `comptime` is +not explicitly written in the type annotation the compiler will implicitly specify the declaration +as compile-time. They can then be used like any other compile-time variable inside functions. The +global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: comptime Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + constrain res == y[0]; + + let res2 = x * mysubmodule::N; + constrain res != res2; +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> comptime Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/08_comments.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/08_comments.md new file mode 100644 index 00000000000..5b1d9fa38f2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/08_comments.md @@ -0,0 +1,27 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir doesn't have multi-line comments, but you can emulate them via using `//` on each line + +```rust +// This is a multi line +// comment, that is ignored by +// the compiler +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/language_concepts/09_distinct.md b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/09_distinct.md new file mode 100644 index 00000000000..03759d4bb4a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/language_concepts/09_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `disctinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..34f28a71148 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,35 @@ +--- +title: Crates and Packages +description: + Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in one of two forms: a binary crate or a library crate. + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..f3b40eb849b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/dependencies.md @@ -0,0 +1,85 @@ +--- +title: Managing Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.2.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +``` +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use. For example, +demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import just the `Point` and the `Curve` that you want to use. + +```rust +use dep::std::ec::tecurve::affine::Curve; +use dep::std::ec::tecurve::affine::Point; +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- BigInt +- "`ecrecover`" +- sparse merkle tree verifier diff --git a/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/modules.md new file mode 100644 index 00000000000..e429b336511 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Understanding Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +# Modules + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree +All modules are accessible from the ``crate::`` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` +In the above snippet, if ``bar`` would like to use functions in ``foo``, it can do so by ``use crate::foo::function_name``. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.6.0/nargo/01_commands.md new file mode 100644 index 00000000000..f9d9ddb77ff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/nargo/01_commands.md @@ -0,0 +1,130 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +``` +Options: + -s, --show-ssa Emit debug information for the intermediate SSA IR + -d, --deny-warnings Quit execution when warnings are emitted + --show-output Display output of `println` statements during tests + -h, --help Print help +``` + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +- `` - The subcommand whose help message to display + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +## `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +## `nargo compile ` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +_Arguments_ + +- `` - The name of the circuit file + +_Options_ + +- `-c, --contracts` - Compile each contract function used within the program + +## `nargo new [path]` + +Creates a new Noir project. + +_Arguments_ + +- `` - Name of the package +- `[path]` - The path to save the new project + +## `nargo execute [witness_name]` + +Runs the Noir program and prints its return value. + +_Arguments_ + +- `[witness_name]` - The name of the witness + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `witness-name` argument. A +`.tr` file will then be saved in the `build` folder. + +> **Info:** The `.tr` file is the witness file. The witness file can be considered as program inputs +> parsed for your program's ACIR. +> +> This file can be passed along with circuit's ACIR into a TypeScript project for proving and +> verification. See the [TypeScript](../typescript#proving-and-verifying-externally-compiled-files) +> section to learn more. + +## `nargo prove ` + +Creates a proof for the program. + +_Arguments_ + +- `` - The name of the proof + +_Options_ + +- `-v, --verify` - Verify proof after proving + +## `nargo verify ` + +Given a proof and a program, verify whether the proof is valid. + +_Arguments_ + +- `` - The proof to verify + +## `nargo test ` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +See an example on the [testing page](./testing). + +_Arguments_ + +- `` - a pattern to indicate to only run tests with names containing the pattern + +## `nargo gates` + +Counts the occurrences of different gates in circuit + +## `nargo print-acir` + +Print a compiled circuit to stdout such that the ACIR can be inspected. diff --git a/noir/docs/versioned_docs/version-v0.6.0/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.6.0/nargo/02_testing.md new file mode 100644 index 00000000000..73f91c72bfd --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/nargo/02_testing.md @@ -0,0 +1,32 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + constrain add(2,2) == 4; + constrain add(0,1) == 1; + constrain add(1,0) == 1; +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +This is much faster compared to testing in Typescript but the only downside is that you can't +explicitly test that a certain set of inputs are invalid. i.e. you can't say that you want +add(2^64-1, 2^64-1) to fail. diff --git a/noir/docs/versioned_docs/version-v0.6.0/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.6.0/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..69a5607f1b2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/nargo/03_solidity_verifier.md @@ -0,0 +1,116 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do *not* currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/array_methods.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/array_methods.md new file mode 100644 index 00000000000..701590ccf54 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/array_methods.md @@ -0,0 +1,180 @@ +--- +title: Array Methods +description: + Learn about the commonly used methods available for arrays in Noir, including len, sort, fold, + reduce, all, and any. +keywords: [rust, array, methods, len, sort, fold, reduce, all, any] +--- + +# Array + +For convenience, the STD provides some ready-to-use, common methods for arrays[^migrationnote]: + +## len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + constrain array.len() == 2; +} +``` + +## sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted = arr.sort(); + constrain sorted == [32, 42]; +} +``` + +## sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + constrain sorted_ascending == [32, 42]; // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + constrain sorted_descending == [32, 42]; // does not verify +} +``` + +## map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2) // b is now [2, 4, 6] +``` + +## fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2,2,2,2,2] + let folded = arr.fold(0, |a, b| a + b); + constrain folded == 10; +} + +``` + +## reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2,2,2,2,2] + let reduced = arr.reduce(|a, b| a + b); + constrain reduced == 10; +} +``` + +## all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2,2,2,2,2] + let all = arr.all(|a| a == 2); + constrain all; +} +``` + +## any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2,2,2,2,5] + let any = arr.any(|a| a == 5); + constrain any; +} + +``` + +[^migrationnote]: + Migration Note: These methods were previously free functions, called via `std::array::len()`. + For the sake of ease of use and readability, these functions are now methods and the old syntax + for them is now deprecated. diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/black_box_fns.md new file mode 100644 index 00000000000..3063e71c147 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/black_box_fns.md @@ -0,0 +1,44 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen](./cryptographic_primitives/hashes#pedersen) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_secp256k1) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..c373f10ca6a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,149 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, blake2s, pedersen, mimc_bn254 and mimc +keywords: + [ + cryptographic primitives, + Noir project, + sha256, + blake2s, + pedersen, + mimc_bn254, + mimc, + hash + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::pedersen(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes (`[u8; 32]`). + +```rust +fn keccak256(_input : [u8; N]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::keccak256(x); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + constrain hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a; +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..62265cddb1e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,33 @@ +--- +title: Scalar multiplication +description: + See how you can perform scalar multiplications over a fixed base in Noir +keywords: + [ + cryptographic primitives, + Noir project, + scalar multiplication, + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## scalar_mul::fixed_base + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..c2c6f3ae19a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> Field +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx new file mode 100644 index 00000000000..88892712fb6 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx @@ -0,0 +1,25 @@ +--- +title: ECDSA Verification +description: + Learn about the cryptographic primitives regarding ECDSA over the secp256k1 curve +keywords: + [ + cryptographic primitives, + Noir project, + ecdsa, + secp256k1, + signatures, + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> Field +``` + + diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..2d4ed0f8fae --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,102 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::Curve; +use dep::std::ec::tecurve::affine::Point; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/common/_blackbox.mdx b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/common/_blackbox.mdx new file mode 100644 index 00000000000..9fe9b48fbff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/cryptographic_primitives/common/_blackbox.mdx @@ -0,0 +1,5 @@ +:::info + +This is a black box function. Read [this section](../black_box_fns) to learn more about black box functions in Noir. + +::: \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/field_methods.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/field_methods.md new file mode 100644 index 00000000000..7cea9846102 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/field_methods.md @@ -0,0 +1,149 @@ +--- +title: Field Methods +description: + Learn about common methods on Noir Field, including to_le_bits, to_le_bytes, to_le_radix, + to_be_radix, pow_32, etc, and see code examples. +keywords: + [ + Noir Field, + to_le_bits, + to_le_bytes, + to_le_radix, + to_be_radix, + pow_32, + Little Endian, + Big Endian, + Vector, + Exponent, + ] +--- + +After declaring a Field, you can use these common methods on it: + +## to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_le_bits(32); +} +``` + +## to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_be_bits(32); +} +``` + +## to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_le_bytes(4); +} +``` + +## to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_be_bytes(4); +} +``` + +## to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_le_radix(256, 4); +} +``` + +## to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_be_radix(256, 4); +} +``` + +## pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + constrain pow == 16; +} +``` + +## sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/logging.md new file mode 100644 index 00000000000..649d35a3f0b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/logging.md @@ -0,0 +1,55 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +# Logging + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +The `println` statement only works for fields, integers and arrays (including strings). + +```rust +use dep::std; + +fn main(string: pub str<5>) { + let x = 5; + std::println(x) +} + +``` + +To view the output of the `println` statement you need to set the `--show-output` flag. + +``` +$ nargo prove --help +Create proof for this program. The proof is returned as a hex encoded string + +Usage: nargo prove [OPTIONS] [PROOF_NAME] [CIRCUIT_NAME] + +Arguments: + [PROOF_NAME] The name of the proof + [CIRCUIT_NAME] The name of the circuit build files (ACIR, proving and verification keys) + +Options: + -v, --verify Verify proof after proving + -s, --show-ssa Emit debug information for the intermediate SSA IR + -d, --deny-warnings Quit execution when warnings are emitted + --show-output Display output of `println` statements during tests + -h, --help Print help +``` diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/merkle_trees.md new file mode 100644 index 00000000000..fc8909a4795 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/merkle_trees.md @@ -0,0 +1,59 @@ +--- +title: Merkle Trees +description: + Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.6.0/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.6.0/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.6.0/typescript.md b/noir/docs/versioned_docs/version-v0.6.0/typescript.md new file mode 100644 index 00000000000..fae002dfd28 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.6.0/typescript.md @@ -0,0 +1,262 @@ +--- +title: Working with TypeScript +description: + Learn how to interact with Noir programs using TypeScript. Follow this tutorial to compile your + program, specify inputs, initialize a prover & verifier, and prove and verify your program. +keywords: [TypeScript, Noir, tutorial, compile, inputs, prover, verifier, proof] +--- + +Interactions with Noir programs can also be performed in TypeScript, which can come in handy when +writing tests or when working in TypeScript-based projects like [Hardhat](https://hardhat.org/). + +This guide is based on the [noir-starter](https://github.com/signorecello/noir-starter) example. +Please refer to it for an example implementation. + +:::note + +You may find unexpected errors working with some frameworks such as `vite`. This is due to the +nature of `wasm` files and the way Noir uses web workers. As we figure it out, we suggest using +[Create React App](https://create-react-app.dev/), or [Next.js](https://nextjs.org/) for a quick +start. + +::: + +## Setup + +We're assuming you're using ES6 for both browser (for example with React), or nodejs. + +Install [Yarn](https://yarnpkg.com/) or [Node.js](https://nodejs.org/en). Init a new project with +`npm init`. Install Noir dependencies in your project by running: + +```bash +npm i @noir-lang/noir_wasm@0.3.2-fa0e9cff github:noir-lang/barretenberg#39a1547875f941ef6640217a42d8f34972425c97 @noir-lang/aztec_backend@0.1.0-0c3b2f2 +``` + +:::note + +While Noir is in rapid development, some packages could interfere with others. For that reason, you +should use these specified versions. Let us know if for some reason you need to use other ones. + +::: + +As for the circuit, we will use the _Standard Noir Example_ and place it in the `src` folder. Feel +free to use any other, as long as you refactor the below examples accordingly. + +This standard example is a program that multiplies input `x` with input `y` and returns the result: + +```rust +// src/main.nr +fn main(x: u32, y: pub u32) -> pub u32 { + let z = x * y; + z +} +``` + +One valid scenario for proving could be `x = 3`, `y = 4` and `return = 12` + +## Imports + +We need some imports, for both the `noir_wasm` library (which will compile the circuit into `wasm` +executables) and `aztec_backend` which is the actual proving backend we will be using. + +We also need to tell the compiler where to find the `.nr` files, so we need to import +`initialiseResolver`. + +```ts +import initNoirWasm, { acir_read_bytes, compile } from '@noir-lang/noir_wasm'; +import initialiseAztecBackend from '@noir-lang/aztec_backend'; +import { initialiseResolver } from '@noir-lang/noir-source-resolver'; +``` + +## Compiling + +We'll go over the code line-by-line later: + +```ts +export const compileCircuit = async () => { + await initNoirWasm(); + + return await fetch(new URL('../src/main.nr', import.meta.url)) + .then(r => r.text()) + .then(code => { + initialiseResolver((id: any) => { + return code; + }); + }) + .then(() => { + try { + const compiled_noir = compile({}); + return compiled_noir; + } catch (e) { + console.log('Error while compiling:', e); + } + }); +}; +``` + +1. First we're calling `initNoirWasm`. This is required on the browser only. +2. We then pass an URL that points to our `main.nr` file, and call `.then` on it so we can get the + actual text of the source code +3. We call `initialiseResolver` returning the source code +4. Finally, we can call the `compile` function + +This function should return us the compiled circuit. + +:::note + +You can use as many files as you need, +[importing them as you would do with Nargo](./modules_packages_crates/dependencies), and you don't +need to set them up in the `src` folder. Just mind the following particularities about +`initialiseResolver`: + +1. The `compile` function expects a `main.nr` file as an entry point. If you need another one, just + pass it as a `entry_point` parameter to `compile`. Check the + [noir starter](https://github.com/signorecello/noir-starter) for an example on multiple files and + a non-default entry point. +2. `initialiseResolver` needs to be synchronous +3. Different frameworks use different ways of fetching files. It's beyond the scope of this guide to + explain why and how, but for reference, + [noir starter](https://github.com/signorecello/noir-starter) uses both Next.js and node.js for + testing. + +Quick tip: an easy way to deal with `initialiseResolver` is just to prepare a +`{fileName: "literally_the_code"}` object beforehand + +::: + +## ACIR + +Noir compiles to two properties: + +1. The ACIR, which is the intermediate language used by backends such as Barretenberg +2. The ABI, which tells you which inputs are to be read + +Let's write a little function that gets us both, initializes the backend, and returns the ACIR as +bytes: + +```ts +export const getAcir = async () => { + const { circuit, abi } = await compileCircuit(); + await initialiseAztecBackend(); + + let acir_bytes = new Uint8Array(Buffer.from(circuit, 'hex')); + return acir_read_bytes(acir_bytes); +}; +``` + +Calling `getAcir()` now should return us the ACIR of the circuit, ready to be used in proofs. + +## Initializing Prover & Verifier + +Prior to proving and verifying, the prover and verifier have to first be initialized by calling +`barretenberg`'s `setup_generic_prover_and_verifier` with your Noir program's ACIR: + +```ts +let [prover, verifier] = await setup_generic_prover_and_verifier(acir); +``` + +This is probably a good time to store this prover and verifier into your state like React Context, +Redux, or others. + +## Proving + +The Noir program can then be executed and proved by calling `barretenberg`'s `create_proof` +function: + +```ts +const proof = await create_proof(prover, acir, abi); +``` + +On the browser, this proof can fail as it requires heavy loads to be run on worker threads. Here's a +quick example of a worker: + +```ts +// worker.ts +onmessage = async event => { + try { + await initializeAztecBackend(); + const { acir, input } = event.data; + const [prover, verifier] = await setup_generic_prover_and_verifier(acir); + const proof = await create_proof(prover, acir, input); + postMessage(proof); + } catch (er) { + postMessage(er); + } finally { + close(); + } +}; +``` + +Which would be called like this, for example: + +```ts +// index.ts +const worker = new Worker(new URL('./worker.ts', import.meta.url)); +worker.onmessage = e => { + if (e.data instanceof Error) { + // oh no! + } else { + // yey! + } +}; +worker.postMessage({ acir, input: { x: 3, y: 4 } }); +``` + +## Verifying + +The `proof` obtained can be verified by calling `barretenberg`'s `verify_proof` function: + +```ts +// 1_mul.ts +const verified = await verify_proof(verifier, proof); +``` + +The function should return `true` if the entire process is working as intended, which can be +asserted if you are writing a test script: + +```ts +expect(verified).eq(true); +``` + +## Verifying with Smart Contract + +Alternatively, a verifier smart contract can be generated and used for verifying Noir proofs in +TypeScript as well. + +This could be useful if the Noir program is designed to be decentrally verified and/or make use of +decentralized states and logics that is handled at the smart contract level. + +To generate the verifier smart contract using typescript: + +```ts +// generator.ts +import { writeFileSync } from 'fs'; + +const sc = verifier.SmartContract(); +syncWriteFile('../contracts/plonk_vk.sol', sc); + +function syncWriteFile(filename: string, data: any) { + writeFileSync(join(__dirname, filename), data, { + flag: 'w', + }); +} +``` + +You can then verify a Noir proof using the verifier contract, for example using Hardhat: + +```ts +// verifier.ts +import { ethers } from 'hardhat'; +import { Contract, ContractFactory, utils } from 'ethers'; + +let Verifier: ContractFactory; +let verifierContract: Contract; + +before(async () => { + Verifier = await ethers.getContractFactory('TurboVerifier'); + verifierContract = await Verifier.deploy(); +}); + +// Verify proof +const sc_verified = await verifierContract.verify(proof); +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/examples/merkle-proof.md b/noir/docs/versioned_docs/version-v0.7.1/examples/merkle-proof.md new file mode 100644 index 00000000000..4696b4a1426 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/examples/merkle-proof.md @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[view an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.7.1/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.7.1/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..fb86a966e75 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/getting_started/00_nargo_installation.md @@ -0,0 +1,284 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [TypeScript](../typescript). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Install via Nix](#option-3-install-via-nix) +- [Option 4: Compile from Source](#option-4-compile-from-source) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Windows (PowerShell) + +Open PowerShell as Administrator and run: + +```powershell +mkdir -f -p "$env:USERPROFILE\.nargo\bin\"; ` +Invoke-RestMethod -Method Get -Uri https://github.com/noir-lang/noir/releases/download/v0.4.1/nargo-x86_64-pc-windows-msvc.zip -Outfile "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip"; ` +Expand-Archive -Path "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip" -DestinationPath "$env:USERPROFILE\.nargo\bin\"; ` +$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"; ` +$OldPath = (Get-ItemProperty -Path "$Reg" -Name PATH).Path; ` +$NewPath = $OldPath + ’;’ + "$env:USERPROFILE\.nargo\bin\"; ` +Set-ItemProperty -Path "$Reg" -Name PATH –Value "$NewPath"; ` +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Install via Nix + +Due to the large number of native dependencies, Noir projects can be installed via [Nix](https://nixos.org/). + +#### Installing Nix + +For the best experience, please follow these instructions to setup Nix: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +#### Install Nargo into your Nix profile + +1. Use `nix profile` to install Nargo + +```sh +nix profile install github:noir-lang/noir +``` + +### Option 4: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +[rust]: https://www.rust-lang.org/tools/install +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir +[homebrew]: https://brew.sh/ +[cmake]: https://cmake.org/install/ +[llvm]: https://llvm.org/docs/GettingStarted.html +[openmp]: https://openmp.llvm.org/ +[barretenberg]: https://github.com/AztecProtocol/barretenberg diff --git a/noir/docs/versioned_docs/version-v0.7.1/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.7.1/getting_started/01_hello_world.md new file mode 100644 index 00000000000..0f21ad45569 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program with your preferred proof name, for example `p`: + +```sh +nargo prove p +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`p.proof`. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof of name `p` by running: + +```sh +nargo verify p +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.7.1/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.7.1/getting_started/02_breakdown.md new file mode 100644 index 00000000000..64d04c4e062 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/getting_started/02_breakdown.md @@ -0,0 +1,122 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +_Nargo.toml_ contains the environmental options of your project. + +_proofs_ and _contract_ directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove my_proof` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory and names the proof + file _my_proof_. Opening this file will display the proof in hex format. + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates proof `p`: + +```bash +nargo prove p +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof `pp`: + +```bash +nargo prove -p OtherProver pp +``` + +## Verifying a Proof + +When the command `nargo verify my_proof` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a file called _my_proof_ + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. + +In the [next section](language_server), we will explain how to utilize the Noir Language Server. diff --git a/noir/docs/versioned_docs/version-v0.7.1/getting_started/03_language_server.md b/noir/docs/versioned_docs/version-v0.7.1/getting_started/03_language_server.md new file mode 100644 index 00000000000..e6f5dfc2faa --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/getting_started/03_language_server.md @@ -0,0 +1,31 @@ +--- +title: Language Server +description: + Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: + [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +### Configuration + +* __Noir: Enable LSP__ - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +* __Noir: Nargo Flags__ - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +* __Noir: Nargo Path__ - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +* __Noir > Trace: Server__ - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.7.1/index.md b/noir/docs/versioned_docs/version-v0.7.1/index.md new file mode 100644 index 00000000000..e56b24bccd8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/index.md @@ -0,0 +1,103 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +This version of the book is being released with the public alpha. There will be a lot of features +that are missing in this version, however the syntax and the feel of the language will mostly be +completed. + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/00_data_types.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/00_data_types.md new file mode 100644 index 00000000000..6ac494ad404 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/00_data_types.md @@ -0,0 +1,305 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + field type, + integer types, + boolean type, + array type, + tuple type, + struct type, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Primitive Types + +A primitive type represents a single value. They can be private or public. + +### Fields + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +### Integers + +An integer type is a range constrained field type. The Noir frontend currently supports unsigned, +arbitrary-sized integer types. + +An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by +its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of +$\\([0,2^{32}-1]\\)$: + +```rust +fn main(x : Field, y : u32) { + let z = x as u32 + y; +} +``` + +`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z` +are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created +will be rejected by the verifier. + +> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`) +> sized integer types. + +### Booleans + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](./control_flow) and +[Assert Function](./assert) sections. + +### Strings + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. + +```rust +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +## Compound Types + +A compound type groups together multiple values into one type. Elements within a compound type can +be private or public. + +### Arrays + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +#### Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +### Tuples + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` + +### Structs + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. + +:::note +You can use Structs as inputs to the `main` function, but you can't output them +::: + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/01_functions.md new file mode 100644 index 00000000000..54c618599d2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/01_functions.md @@ -0,0 +1,88 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..691c514d9a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/02_control_flow.md @@ -0,0 +1,42 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/04_assert.md new file mode 100644 index 00000000000..a25a946123d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/04_assert.md @@ -0,0 +1,34 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. + +### Example + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +The above snippet compiles because `==` is a predicate operation. Conversely, the following will not +compile: + +```rust +// INCORRECT + +fn main(x : Field, y : Field) { + assert(x + y); +} +``` + +> The rationale behind this not compiling is due to ambiguity. It is not clear if the above should +> equate to `x + y == 0` or if it should check the truthiness of the result. diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/06_generics.md new file mode 100644 index 00000000000..66f2e85e16b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/06_generics.md @@ -0,0 +1,116 @@ +--- +title: Generics +description: + Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +# Generics + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: comptime Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/07_mutability.md new file mode 100644 index 00000000000..5631a322659 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/07_mutability.md @@ -0,0 +1,118 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in Noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a } +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +Comptime values are values that are known at compile-time. This is different to a witness +which changes per proof. If a comptime value that is being used in your program is changed, then your +circuit will also change. + +Comptime is slightly different from Rust's `const`. Namely, it is a bit more flexible in that normal functions can accept comptime parameters. For example, this is used to verify an array index is known at compile-time. Note that the "known at compile-time" here means "known after function inlining is performed while optimizing the program" and not "known during type-checking." + +Below we show how to declare a comptime value: + +```rust +fn main() { + let a: comptime Field = 5; + + // `comptime Field` can also be inferred: + let a = 5; +} +``` + +Note that variables declared as mutable may not be comptime: + +```rust +fn main() { + // error: Cannot mark a comptime type as mutable + let mut a: comptime Field = 5; + + // a inferred as a private Field here + let mut a = 5; +} +``` + +## Globals + +Noir also supports global variables. However, they must be compile-time variables. If `comptime` is +not explicitly written in the type annotation the compiler will implicitly specify the declaration +as compile-time. They can then be used like any other compile-time variable inside functions. The +global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: comptime Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> comptime Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/08_comments.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/08_comments.md new file mode 100644 index 00000000000..5b1d9fa38f2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/08_comments.md @@ -0,0 +1,27 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir doesn't have multi-line comments, but you can emulate them via using `//` on each line + +```rust +// This is a multi line +// comment, that is ignored by +// the compiler +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/language_concepts/09_distinct.md b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/09_distinct.md new file mode 100644 index 00000000000..03759d4bb4a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/language_concepts/09_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `disctinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..34f28a71148 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,35 @@ +--- +title: Crates and Packages +description: + Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in one of two forms: a binary crate or a library crate. + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..2807ad52046 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/dependencies.md @@ -0,0 +1,110 @@ +--- +title: Managing Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +``` +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/modules.md new file mode 100644 index 00000000000..e429b336511 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Understanding Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +# Modules + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree +All modules are accessible from the ``crate::`` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` +In the above snippet, if ``bar`` would like to use functions in ``foo``, it can do so by ``use crate::foo::function_name``. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.7.1/nargo/01_commands.md new file mode 100644 index 00000000000..8efa286b5f0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/nargo/01_commands.md @@ -0,0 +1,132 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +``` +Options: + -s, --show-ssa Emit debug information for the intermediate SSA IR + -d, --deny-warnings Quit execution when warnings are emitted + --show-output Display output of `println` statements during tests + -h, --help Print help +``` + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +- `` - The subcommand whose help message to display + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +## `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +## `nargo compile ` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +_Arguments_ + +- `` - The name of the circuit file + +_Options_ + +- `-c, --contracts` - Compile each contract function used within the program +- `--print-acir` - Displays the ACIR for the compiled circuit + +## `nargo new [path]` + +Creates a new Noir project. + +_Arguments_ + +- `` - Name of the package +- `[path]` - The path to save the new project + +## `nargo execute [witness_name]` + +Runs the Noir program and prints its return value. + +_Arguments_ + +- `[witness_name]` - The name of the witness + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `witness-name` argument. A +`.tr` file will then be saved in the `build` folder. + +> **Info:** The `.tr` file is the witness file. The witness file can be considered as program inputs +> parsed for your program's ACIR. +> +> This file can be passed along with circuit's ACIR into a TypeScript project for proving and +> verification. See the [TypeScript](../typescript#proving-and-verifying-externally-compiled-files) +> section to learn more. + +## `nargo prove ` + +Creates a proof for the program. + +_Arguments_ + +- `` - The name of the proof + +_Options_ + +- `-v, --verify` - Verify proof after proving + +## `nargo verify ` + +Given a proof and a program, verify whether the proof is valid. + +_Arguments_ + +- `` - The proof to verify + +## `nargo test ` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +See an example on the [testing page](./testing). + +_Arguments_ + +- `` - a pattern to indicate to only run tests with names containing the pattern + +## `nargo gates` + +Counts the occurrences of different gates in circuit + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). diff --git a/noir/docs/versioned_docs/version-v0.7.1/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.7.1/nargo/02_testing.md new file mode 100644 index 00000000000..ba0bebd658b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/nargo/02_testing.md @@ -0,0 +1,32 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +This is much faster compared to testing in Typescript but the only downside is that you can't +explicitly test that a certain set of inputs are invalid. i.e. you can't say that you want +add(2^64-1, 2^64-1) to fail. diff --git a/noir/docs/versioned_docs/version-v0.7.1/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.7.1/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/array_methods.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/array_methods.md new file mode 100644 index 00000000000..8d8a9531243 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/array_methods.md @@ -0,0 +1,180 @@ +--- +title: Array Methods +description: + Learn about the commonly used methods available for arrays in Noir, including len, sort, fold, + reduce, all, and any. +keywords: [rust, array, methods, len, sort, fold, reduce, all, any] +--- + +# Array + +For convenience, the STD provides some ready-to-use, common methods for arrays[^migrationnote]: + +## len + +Returns the length of an array + +```rust +fn len(_array: [T; N]) -> comptime Field +``` + +example + +```rust +fn main() { + let array = [42, 42]; + assert(array.len() == 2); +} +``` + +## sort + +Returns a new sorted array. The original array remains untouched. Notice that this function will +only work for arrays of fields or integers, not for any arbitrary type. This is because the sorting +logic it uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_array: [T; N]) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32]; + let sorted = arr.sort(); + assert(sorted == [32, 42]); +} +``` + +## sort_via + +Sorts the array with a custom comparison function + +```rust +fn sort_via(mut a: [T; N], ordering: fn(T, T) -> bool) -> [T; N] +``` + +example + +```rust +fn main() { + let arr = [42, 32] + let sorted_ascending = arr.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = arr.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +## map + +Applies a function to each element of the array, returning a new array containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U; N] +``` + +example + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2); // b is now [2, 4, 6] +``` + +## fold + +Applies a function to each element of the array, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the array, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +example: + +```rust + +fn main() { + let arr = [2, 2, 2, 2, 2]; + let folded = arr.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +## reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let reduced = arr.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +## all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 2]; + let all = arr.all(|a| a == 2); + assert(all); +} +``` + +## any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +example: + +```rust +fn main() { + let arr = [2, 2, 2, 2, 5]; + let any = arr.any(|a| a == 5); + assert(any); +} + +``` + +[^migrationnote]: + Migration Note: These methods were previously free functions, called via `std::array::len()`. + For the sake of ease of use and readability, these functions are now methods and the old syntax + for them is now deprecated. diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/black_box_fns.md new file mode 100644 index 00000000000..3063e71c147 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/black_box_fns.md @@ -0,0 +1,44 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen](./cryptographic_primitives/hashes#pedersen) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_secp256k1) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..31a84cdb753 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,146 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::pedersen(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..62265cddb1e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,33 @@ +--- +title: Scalar multiplication +description: + See how you can perform scalar multiplications over a fixed base in Noir +keywords: + [ + cryptographic primitives, + Noir project, + scalar multiplication, + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## scalar_mul::fixed_base + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..0e219c0e5ff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx new file mode 100644 index 00000000000..0b800fdbc5f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/03_ecdsa_secp256k1.mdx @@ -0,0 +1,17 @@ +--- +title: ECDSA Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 curve +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..26fb4c09e88 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..8f060ed3316 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/common/_blackbox.mdx b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/common/_blackbox.mdx new file mode 100644 index 00000000000..9fe9b48fbff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/cryptographic_primitives/common/_blackbox.mdx @@ -0,0 +1,5 @@ +:::info + +This is a black box function. Read [this section](../black_box_fns) to learn more about black box functions in Noir. + +::: \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/field_methods.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/field_methods.md new file mode 100644 index 00000000000..4d1cdc953e9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/field_methods.md @@ -0,0 +1,149 @@ +--- +title: Field Methods +description: + Learn about common methods on Noir Field, including to_le_bits, to_le_bytes, to_le_radix, + to_be_radix, pow_32, etc, and see code examples. +keywords: + [ + Noir Field, + to_le_bits, + to_le_bytes, + to_le_radix, + to_be_radix, + pow_32, + Little Endian, + Big Endian, + Vector, + Exponent, + ] +--- + +After declaring a Field, you can use these common methods on it: + +## to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_le_bits(32); +} +``` + +## to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_be_bits(32); +} +``` + +## to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_le_bytes(4); +} +``` + +## to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_be_bytes(4); +} +``` + +## to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_le_radix(256, 4); +} +``` + +## to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_be_radix(256, 4); +} +``` + +## pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +## sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/logging.md new file mode 100644 index 00000000000..649d35a3f0b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/logging.md @@ -0,0 +1,55 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +# Logging + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +The `println` statement only works for fields, integers and arrays (including strings). + +```rust +use dep::std; + +fn main(string: pub str<5>) { + let x = 5; + std::println(x) +} + +``` + +To view the output of the `println` statement you need to set the `--show-output` flag. + +``` +$ nargo prove --help +Create proof for this program. The proof is returned as a hex encoded string + +Usage: nargo prove [OPTIONS] [PROOF_NAME] [CIRCUIT_NAME] + +Arguments: + [PROOF_NAME] The name of the proof + [CIRCUIT_NAME] The name of the circuit build files (ACIR, proving and verification keys) + +Options: + -v, --verify Verify proof after proving + -s, --show-ssa Emit debug information for the intermediate SSA IR + -d, --deny-warnings Quit execution when warnings are emitted + --show-output Display output of `println` statements during tests + -h, --help Print help +``` diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/merkle_trees.md new file mode 100644 index 00000000000..fc8909a4795 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/merkle_trees.md @@ -0,0 +1,59 @@ +--- +title: Merkle Trees +description: + Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.7.1/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.7.1/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.7.1/typescript.md b/noir/docs/versioned_docs/version-v0.7.1/typescript.md new file mode 100644 index 00000000000..fae002dfd28 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.7.1/typescript.md @@ -0,0 +1,262 @@ +--- +title: Working with TypeScript +description: + Learn how to interact with Noir programs using TypeScript. Follow this tutorial to compile your + program, specify inputs, initialize a prover & verifier, and prove and verify your program. +keywords: [TypeScript, Noir, tutorial, compile, inputs, prover, verifier, proof] +--- + +Interactions with Noir programs can also be performed in TypeScript, which can come in handy when +writing tests or when working in TypeScript-based projects like [Hardhat](https://hardhat.org/). + +This guide is based on the [noir-starter](https://github.com/signorecello/noir-starter) example. +Please refer to it for an example implementation. + +:::note + +You may find unexpected errors working with some frameworks such as `vite`. This is due to the +nature of `wasm` files and the way Noir uses web workers. As we figure it out, we suggest using +[Create React App](https://create-react-app.dev/), or [Next.js](https://nextjs.org/) for a quick +start. + +::: + +## Setup + +We're assuming you're using ES6 for both browser (for example with React), or nodejs. + +Install [Yarn](https://yarnpkg.com/) or [Node.js](https://nodejs.org/en). Init a new project with +`npm init`. Install Noir dependencies in your project by running: + +```bash +npm i @noir-lang/noir_wasm@0.3.2-fa0e9cff github:noir-lang/barretenberg#39a1547875f941ef6640217a42d8f34972425c97 @noir-lang/aztec_backend@0.1.0-0c3b2f2 +``` + +:::note + +While Noir is in rapid development, some packages could interfere with others. For that reason, you +should use these specified versions. Let us know if for some reason you need to use other ones. + +::: + +As for the circuit, we will use the _Standard Noir Example_ and place it in the `src` folder. Feel +free to use any other, as long as you refactor the below examples accordingly. + +This standard example is a program that multiplies input `x` with input `y` and returns the result: + +```rust +// src/main.nr +fn main(x: u32, y: pub u32) -> pub u32 { + let z = x * y; + z +} +``` + +One valid scenario for proving could be `x = 3`, `y = 4` and `return = 12` + +## Imports + +We need some imports, for both the `noir_wasm` library (which will compile the circuit into `wasm` +executables) and `aztec_backend` which is the actual proving backend we will be using. + +We also need to tell the compiler where to find the `.nr` files, so we need to import +`initialiseResolver`. + +```ts +import initNoirWasm, { acir_read_bytes, compile } from '@noir-lang/noir_wasm'; +import initialiseAztecBackend from '@noir-lang/aztec_backend'; +import { initialiseResolver } from '@noir-lang/noir-source-resolver'; +``` + +## Compiling + +We'll go over the code line-by-line later: + +```ts +export const compileCircuit = async () => { + await initNoirWasm(); + + return await fetch(new URL('../src/main.nr', import.meta.url)) + .then(r => r.text()) + .then(code => { + initialiseResolver((id: any) => { + return code; + }); + }) + .then(() => { + try { + const compiled_noir = compile({}); + return compiled_noir; + } catch (e) { + console.log('Error while compiling:', e); + } + }); +}; +``` + +1. First we're calling `initNoirWasm`. This is required on the browser only. +2. We then pass an URL that points to our `main.nr` file, and call `.then` on it so we can get the + actual text of the source code +3. We call `initialiseResolver` returning the source code +4. Finally, we can call the `compile` function + +This function should return us the compiled circuit. + +:::note + +You can use as many files as you need, +[importing them as you would do with Nargo](./modules_packages_crates/dependencies), and you don't +need to set them up in the `src` folder. Just mind the following particularities about +`initialiseResolver`: + +1. The `compile` function expects a `main.nr` file as an entry point. If you need another one, just + pass it as a `entry_point` parameter to `compile`. Check the + [noir starter](https://github.com/signorecello/noir-starter) for an example on multiple files and + a non-default entry point. +2. `initialiseResolver` needs to be synchronous +3. Different frameworks use different ways of fetching files. It's beyond the scope of this guide to + explain why and how, but for reference, + [noir starter](https://github.com/signorecello/noir-starter) uses both Next.js and node.js for + testing. + +Quick tip: an easy way to deal with `initialiseResolver` is just to prepare a +`{fileName: "literally_the_code"}` object beforehand + +::: + +## ACIR + +Noir compiles to two properties: + +1. The ACIR, which is the intermediate language used by backends such as Barretenberg +2. The ABI, which tells you which inputs are to be read + +Let's write a little function that gets us both, initializes the backend, and returns the ACIR as +bytes: + +```ts +export const getAcir = async () => { + const { circuit, abi } = await compileCircuit(); + await initialiseAztecBackend(); + + let acir_bytes = new Uint8Array(Buffer.from(circuit, 'hex')); + return acir_read_bytes(acir_bytes); +}; +``` + +Calling `getAcir()` now should return us the ACIR of the circuit, ready to be used in proofs. + +## Initializing Prover & Verifier + +Prior to proving and verifying, the prover and verifier have to first be initialized by calling +`barretenberg`'s `setup_generic_prover_and_verifier` with your Noir program's ACIR: + +```ts +let [prover, verifier] = await setup_generic_prover_and_verifier(acir); +``` + +This is probably a good time to store this prover and verifier into your state like React Context, +Redux, or others. + +## Proving + +The Noir program can then be executed and proved by calling `barretenberg`'s `create_proof` +function: + +```ts +const proof = await create_proof(prover, acir, abi); +``` + +On the browser, this proof can fail as it requires heavy loads to be run on worker threads. Here's a +quick example of a worker: + +```ts +// worker.ts +onmessage = async event => { + try { + await initializeAztecBackend(); + const { acir, input } = event.data; + const [prover, verifier] = await setup_generic_prover_and_verifier(acir); + const proof = await create_proof(prover, acir, input); + postMessage(proof); + } catch (er) { + postMessage(er); + } finally { + close(); + } +}; +``` + +Which would be called like this, for example: + +```ts +// index.ts +const worker = new Worker(new URL('./worker.ts', import.meta.url)); +worker.onmessage = e => { + if (e.data instanceof Error) { + // oh no! + } else { + // yey! + } +}; +worker.postMessage({ acir, input: { x: 3, y: 4 } }); +``` + +## Verifying + +The `proof` obtained can be verified by calling `barretenberg`'s `verify_proof` function: + +```ts +// 1_mul.ts +const verified = await verify_proof(verifier, proof); +``` + +The function should return `true` if the entire process is working as intended, which can be +asserted if you are writing a test script: + +```ts +expect(verified).eq(true); +``` + +## Verifying with Smart Contract + +Alternatively, a verifier smart contract can be generated and used for verifying Noir proofs in +TypeScript as well. + +This could be useful if the Noir program is designed to be decentrally verified and/or make use of +decentralized states and logics that is handled at the smart contract level. + +To generate the verifier smart contract using typescript: + +```ts +// generator.ts +import { writeFileSync } from 'fs'; + +const sc = verifier.SmartContract(); +syncWriteFile('../contracts/plonk_vk.sol', sc); + +function syncWriteFile(filename: string, data: any) { + writeFileSync(join(__dirname, filename), data, { + flag: 'w', + }); +} +``` + +You can then verify a Noir proof using the verifier contract, for example using Hardhat: + +```ts +// verifier.ts +import { ethers } from 'hardhat'; +import { Contract, ContractFactory, utils } from 'ethers'; + +let Verifier: ContractFactory; +let verifierContract: Contract; + +before(async () => { + Verifier = await ethers.getContractFactory('TurboVerifier'); + verifierContract = await Verifier.deploy(); +}); + +// Verify proof +const sc_verified = await verifierContract.verify(proof); +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/examples/merkle-proof.mdx b/noir/docs/versioned_docs/version-v0.9.0/examples/merkle-proof.mdx new file mode 100644 index 00000000000..6430780817c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/examples/merkle-proof.mdx @@ -0,0 +1,48 @@ +--- +title: Merkle Proof Membership +description: + Learn how to use merkle membership proof in Noir to prove that a given leaf is a member of a + merkle tree with a specified root, at a given index. +keywords: + [merkle proof, merkle membership proof, Noir, rust, hash function, Pedersen, sha256, merkle tree] +--- + +Let's walk through an example of a merkle membership proof in Noir that proves that a given leaf is +in a merkle tree. + +```rust +use dep::std; + +fn main(message : [Field; 62], index : Field, hashpath : [Field; 40], root : Field) { + let leaf = std::hash::hash_to_field(message); + let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); + assert(merkle_root == root); +} + +``` + +The message is hashed using `hash_to_field`. The specific hash function that is being used is chosen +by the backend. The only requirement is that this hash function can heuristically be used as a +random oracle. If only collision resistance is needed, then one can call `std::hash::pedersen` +instead. + +```rust +let leaf = std::hash::hash_to_field(message); +``` + +The leaf is then passed to a compute_merkle_root function with the root, index and hashpath. The returned root can then be asserted to be the same as the provided root. + +```rust +let merkle_root = std::merkle::compute_merkle_root(leaf, index, hashpath); +assert (merkle_root == root); +``` + +> **Note:** It is possible to re-implement the merkle tree implementation without standard library. +> However, for most usecases, it is enough. In general, the standard library will always opt to be +> as conservative as possible, while striking a balance with efficiency. + +An example, the merkle membership proof, only requires a hash function that has collision +resistance, hence a hash function like Pedersen is allowed, which in most cases is more efficient +than the even more conservative sha256. + +[View an example on the starter repo](https://github.com/noir-lang/noir-examples/blob/3ea09545cabfa464124ec2f3ea8e60c608abe6df/stealthdrop/circuits/src/main.nr#L20) diff --git a/noir/docs/versioned_docs/version-v0.9.0/getting_started/00_nargo_installation.md b/noir/docs/versioned_docs/version-v0.9.0/getting_started/00_nargo_installation.md new file mode 100644 index 00000000000..de30869732d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/getting_started/00_nargo_installation.md @@ -0,0 +1,285 @@ +--- +title: Nargo Installation +description: + nargo is a command line tool for interacting with Noir programs (e.g. compiling, proving, + verifying and more). Learn how to install and use Nargo for your projects with this comprehensive + guide. +keywords: [Nargo, command line tool, Noir programs, installation guide, how to use Nargo] +--- + +`nargo` is a command line tool for interacting with Noir programs (e.g. compiling, proving, +verifying and more). + +Alternatively, the interactions can also be performed in [TypeScript](../typescript). + +### UltraPlonk + +Nargo versions <0.5.0 of `aztec_backend` and `aztec_wasm_backend` are based on the TurboPlonk +version of Aztec Backend, which lacks efficient implementations of useful primitives (e.g. Keccak256 in 18k constraints, ECDSA verification in 36k constraints) that the UltraPlonk version offers. + +## Installation + +There are four approaches for installing Nargo: + +- [Option 1: Noirup](#option-1-noirup) +- [Option 2: Binaries](#option-2-binaries) +- [Option 3: Install via Nix](#option-3-install-via-nix) +- [Option 4: Compile from Source](#option-4-compile-from-source) + +Optionally you can also install [Noir VS Code extension] for syntax highlighting. + +### Option 1: Noirup + +If you're on OSX or Linux, the easiest way to start using Noir and Nargo is via noirup. Just open a +terminal and run: + +```bash +curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash +``` + +Close the terminal, open another one, and run + +```bash +noirup +``` + +Done, you should have the latest version working. You can check with `nargo --version`. + +You can also install nightlies, specific versions +or branches, check out the [noirup repository](https://github.com/noir-lang/noirup) for more +information. + +#### GitHub Actions + +You can use `noirup` with GitHub Actions for CI/CD and automated testing. It is as simple as +installing `noirup` and running tests in your GitHub Action `yml` file. + +See the +[config file](https://github.com/TomAFrench/noir-hashes/blob/master/.github/workflows/noir.yml) in +this repo containing hash functions in Noir for an example. + +#### Nightly versions + +To install the nightly version of Noir (updated daily) run: + +```bash +noirup -n +``` + +### Option 2: Binaries + +See [GitHub Releases](https://github.com/noir-lang/noir/releases) for the latest and previous +platform specific binaries. + +#### Step 1 + +Paste and run the following in the terminal to extract and install the binary: + +> **macOS / Linux:** If you are prompted with `Permission denied` when running commands, prepend +> `sudo` and re-run it. + +##### macOS (Apple Silicon) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-aarch64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-aarch64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### macOS (Intel) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-apple-darwin.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-apple-darwin.tar.gz -C $HOME/.nargo/bin/ && \ +echo '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.zshrc && \ +source ~/.zshrc +``` + +##### Windows (PowerShell) + +Open PowerShell as Administrator and run: + +```powershell +mkdir -f -p "$env:USERPROFILE\.nargo\bin\"; ` +Invoke-RestMethod -Method Get -Uri https://github.com/noir-lang/noir/releases/download/v0.4.1/nargo-x86_64-pc-windows-msvc.zip -Outfile "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip"; ` +Expand-Archive -Path "$env:USERPROFILE\.nargo\bin\nargo-x86_64-pc-windows-msvc.zip" -DestinationPath "$env:USERPROFILE\.nargo\bin\"; ` +$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"; ` +$OldPath = (Get-ItemProperty -Path "$Reg" -Name PATH).Path; ` +$NewPath = $OldPath + ’;’ + "$env:USERPROFILE\.nargo\bin\"; ` +Set-ItemProperty -Path "$Reg" -Name PATH –Value "$NewPath"; ` +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") +``` + +##### Linux (Bash) + +```bash +mkdir -p $HOME/.nargo/bin && \ +curl -o $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -L https://github.com/noir-lang/noir/releases/download/v0.6.0/nargo-x86_64-unknown-linux-gnu.tar.gz && \ +tar -xvf $HOME/.nargo/bin/nargo-x86_64-unknown-linux-gnu.tar.gz -C $HOME/.nargo/bin/ && \ +echo -e '\nexport PATH=$PATH:$HOME/.nargo/bin' >> ~/.bashrc && \ +source ~/.bashrc +``` + +#### Step 2 + +Check if the installation was successful by running `nargo --help`. + +> **macOS:** If you are prompted with an OS alert, right-click and open the _nargo_ executable from +> Finder. Close the new terminal popped up and `nargo` should now be accessible. + +For a successful installation, you should see something similar to the following after running the +command: + +```sh +$ nargo --help + +Noir's package manager + +Usage: nargo + +Commands: + check Checks the constraint system for errors + codegen-verifier Generates a Solidity verifier smart contract for the program + compile Compile the program and its secret execution trace into ACIR format + new Create a new binary project + execute Executes a circuit to calculate its return value + prove Create proof for this program. The proof is returned as a hex encoded string + verify Given a proof and a program, verify whether the proof is valid + test Run the tests for this program + gates Counts the occurrences of different gates in circuit + help Print this message or the help of the given subcommand(s) +``` + +### Option 3: Install via Nix + +Due to the large number of native dependencies, Noir projects can be installed via [Nix](https://nixos.org/). + +#### Installing Nix + +For the best experience, please follow these instructions to setup Nix: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +#### Install Nargo into your Nix profile + +1. Use `nix profile` to install Nargo + +```sh +nix profile install github:noir-lang/noir +``` + +### Option 4: Compile from Source + +Due to the large number of native dependencies, Noir projects uses [Nix](https://nixos.org/) and [direnv](https://direnv.net/) to streamline the development experience. + +#### Setting up your environment + +For the best experience, please follow these instructions to setup your environment: + +1. Install Nix following [their guide](https://nixos.org/download.html) for your operating system. +2. Create the file `~/.config/nix/nix.conf` with the contents: + +```ini +experimental-features = nix-command +extra-experimental-features = flakes +``` + +3. Install direnv into your Nix profile by running: + +```sh +nix profile install nixpkgs#direnv +``` + +4. Add direnv to your shell following [their guide](https://direnv.net/docs/hook.html). + 1. For bash or zshell, add `eval "$(direnv hook bash)"` or `eval "$(direnv hook zsh)"` to your ~/.bashrc or ~/.zshrc file, respectively. +5. Restart your shell. + +#### Shell & editor experience + +Now that your environment is set up, you can get to work on the project. + +1. Clone the repository, such as: + +```sh +git clone git@github.com:noir-lang/noir +``` + +> Replacing `noir` with whichever repository you want to work on. + +2. Navigate to the directory: + +```sh +cd noir +``` + +> Replacing `noir` with whichever repository you cloned. + +3. You should see a **direnv error** because projects aren't allowed by default. Make sure you've reviewed and trust our `.envrc` file, then you need to run: + +```sh +direnv allow +``` + +4. Now, wait awhile for all the native dependencies to be built. This will take some time and direnv will warn you that it is taking a long time, but we just need to let it run. + +5. Once you are presented with your prompt again, you can start your editor within the project directory (we recommend [VSCode](https://code.visualstudio.com/)): + +```sh +code . +``` + +6. (Recommended) When launching VSCode for the first time, you should be prompted to install our recommended plugins. We highly recommend installing these for the best development experience. + +#### Building and testing + +Assuming you are using `direnv` to populate your environment, building and testing the project can be done +with the typical `cargo build`, `cargo test`, and `cargo clippy` commands. You'll notice that the `cargo` version matches the version we specify in `flake.nix`, which is 1.66.0 at the time of this writing. + +If you want to build the entire project in an isolated sandbox, you can use Nix commands: + +1. `nix build .` (or `nix build . -L` for verbose output) to build the project in a Nix sandbox. +2. `nix flake check` (or `nix flake check -L` for verbose output) to run clippy and tests in a Nix sandbox. + +#### Without `direnv` + +If you have hesitations with using direnv, you can launch a subshell with `nix develop` and then launch your editor from within the subshell. However, if VSCode was already launched in the project directory, the environment won't be updated. + +Advanced: If you aren't using direnv nor launching your editor within the subshell, you can try to install Barretenberg and other global dependencies the package needs. This is an advanced workflow and likely won't receive support! + +## Uninstalling Nargo + +### Noirup + +If you installed Noir with `noirup`, you can uninstall Noir by removing the files in `~/.nargo`, `~/nargo` and `~/noir_cache`. + +```bash +rm -r ~/.nargo +rm -r ~/nargo +rm -r ~/noir_cache +``` + +### Nix + +If you installed Noir with Nix or from source, you can remove the binary located at `~/.nix-profile/bin/nargo`. + +```bash +rm ~/.nix-profile/bin/nargo +``` + +[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git +[rust]: https://www.rust-lang.org/tools/install +[noir vs code extension]: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir +[homebrew]: https://brew.sh/ +[cmake]: https://cmake.org/install/ +[llvm]: https://llvm.org/docs/GettingStarted.html +[openmp]: https://openmp.llvm.org/ +[barretenberg]: https://github.com/AztecProtocol/barretenberg diff --git a/noir/docs/versioned_docs/version-v0.9.0/getting_started/01_hello_world.md b/noir/docs/versioned_docs/version-v0.9.0/getting_started/01_hello_world.md new file mode 100644 index 00000000000..0f21ad45569 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/getting_started/01_hello_world.md @@ -0,0 +1,147 @@ +--- +title: Create A Project +description: + Learn how to create and verify your first Noir program using Nargo, a programming language for + zero-knowledge proofs. +keywords: + [ + Nargo, + Noir, + zero-knowledge proofs, + programming language, + create Noir program, + verify Noir program, + step-by-step guide, + ] +--- + +Now that we have installed Nargo, it is time to make our first hello world program! + +## Create a Project Directory + +Noir code can live anywhere on your computer. Let us create a _projects_ folder in the home +directory to house our Noir programs. + +For Linux, macOS, and Windows PowerShell, create the directory and change directory into it by +running: + +```sh +mkdir ~/projects +cd ~/projects +``` + +For Windows CMD, run: + +```sh +> mkdir "%USERPROFILE%\projects" +> cd /d "%USERPROFILE%\projects" +``` + +## Create Our First Nargo Project + +Now that we are in the projects directory, create a new Nargo project by running: + +```sh +nargo new hello_world +``` + +> **Note:** `hello_world` can be any arbitrary project name, we are simply using `hello_world` for +> demonstration. +> +> In production, the common practice is to name the project folder as `circuits` for better +> identifiability when sitting alongside other folders in the codebase (e.g. `contracts`, `scripts`, +> `test`). + +A `hello_world` folder would be created. Similar to Rust, the folder houses _src/main.nr_ and +_Nargo.toml_ that contains the source code and environmental options of your Noir program +respectively. + +### Intro to Noir Syntax + +Let us take a closer look at _main.nr_. The default _main.nr_ generated should look like this: + +```rust +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` + +The first line of the program specifies the program's inputs: + +```rust +x : Field, y : pub Field +``` + +Program inputs in Noir are private by default (e.g. `x`), but can be labeled public using the +keyword `pub` (e.g. `y`). To learn more about private and public values, check the +[Data Types](../language_concepts/data_types) section. + +The next line of the program specifies its body: + +```rust +assert(x != y); +``` + +The Noir syntax `assert` can be interpreted as something similar to constraints in other zk-contract languages. + +For more Noir syntax, check the [Language Concepts](../language_concepts/comments) chapter. + +## Build In/Output Files + +Change directory into _hello_world_ and build in/output files for your Noir program by running: + +```sh +cd hello_world +nargo check +``` + +Two additional files would be generated in your project directory: + +_Prover.toml_ houses input values, and _Verifier.toml_ houses public values. + +## Prove Our Noir Program + +Now that the project is set up, we can create a proof of correct execution on our Noir program. + +Fill in input values for execution in the _Prover.toml_ file. For example: + +```toml +x = "1" +y = "2" +``` + +Prove the valid execution of your Noir program with your preferred proof name, for example `p`: + +```sh +nargo prove p +``` + +A new folder _proofs_ would then be generated in your project directory, containing the proof file +`p.proof`. + +The _Verifier.toml_ file would also be updated with the public values computed from program +execution (in this case the value of `y`): + +```toml +y = "0x0000000000000000000000000000000000000000000000000000000000000002" +``` + +> **Note:** Values in _Verifier.toml_ are computed as 32-byte hex values. + +## Verify Our Noir Program + +Once a proof is generated, we can verify correct execution of our Noir program by verifying the +proof file. + +Verify your proof of name `p` by running: + +```sh +nargo verify p +``` + +The verification will complete in silence if it is successful. If it fails, it will log the +corresponding error instead. + +Congratulations, you have now created and verified a proof for your very first Noir program! + +In the [next section](breakdown), we will go into more detail on each step performed. diff --git a/noir/docs/versioned_docs/version-v0.9.0/getting_started/02_breakdown.md b/noir/docs/versioned_docs/version-v0.9.0/getting_started/02_breakdown.md new file mode 100644 index 00000000000..7c320cef9c5 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/getting_started/02_breakdown.md @@ -0,0 +1,154 @@ +--- +title: Project Breakdown +description: + Learn about the anatomy of a Nargo project, including the purpose of the Prover and Verifier TOML + files, and how to prove and verify your program. +keywords: + [Nargo, Nargo project, Prover.toml, Verifier.toml, proof verification, private asset transfer] +--- + +This section breaks down our hello world program in section _1.2_. We elaborate on the project +structure and what the `prove` and `verify` commands did in the previous section. + +## Anatomy of a Nargo Project + +Upon creating a new project with `nargo new` and building the in/output files with `nargo check` +commands, you would get a minimal Nargo project of the following structure: + + - src + - Prover.toml + - Verifier.toml + - Nargo.toml + +The source directory _src_ holds the source code for your Noir program. By default only a _main.nr_ +file will be generated within it. + +_Prover.toml_ is used for specifying the input values for executing and proving the program. You can specify `toml` files with different names by using the `--prover-name` or `-p` flags, see the [Prover](#provertoml) section below. Optionally you may specify expected output values for prove-time checking as well. + +_Verifier.toml_ contains public in/output values computed when executing the Noir program. + +_Nargo.toml_ contains the environmental options of your project. + +_proofs_ and _contract_ directories will not be immediately visible until you create a proof or +verifier contract respectively. + +### main.nr + +The _main.nr_ file contains a `main` method, this method is the entry point into your Noir program. + +In our sample program, _main.nr_ looks like this: + +```rust +fn main(x : Field, y : Field) { + assert(x != y); +} +``` + +The parameters `x` and `y` can be seen as the API for the program and must be supplied by the +prover. Since neither `x` nor `y` is marked as public, the verifier does not supply any inputs, when +verifying the proof. + +The prover supplies the values for `x` and `y` in the _Prover.toml_ file. + +As for the program body, `assert` ensures the satisfaction of the condition (e.g. `x != y`) is +constrained by the proof of the execution of said program (i.e. if the condition was not met, the +verifier would reject the proof as an invalid proof). + +### Prover.toml + +The _Prover.toml_ file is a file which the prover uses to supply his witness values(both private and +public). + +In our hello world program the _Prover.toml_ file looks like this: + +```toml +x = "1" +y = "2" +``` + +When the command `nargo prove my_proof` is executed, two processes happen: + +1. Noir creates a proof that `x` which holds the value of `1` and `y` which holds the value of `2` + is not equal. This not equal constraint is due to the line `assert(x != y)`. + +2. Noir creates and stores the proof of this statement in the _proofs_ directory and names the proof + file _my_proof_. Opening this file will display the proof in hex format. + +#### Arrays of Structs + +The following code shows how to pass an array of structs to a Noir program to generate a proof. + +```rust +// main.nr +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} +``` + +Prover.toml: + +```toml +[[foos]] # foos[0] +bar = 0 +baz = 0 + +[[foos]] # foos[1] +bar = 0 +baz = 0 + +[[foos]] # foos[2] +bar = 1 +baz = 2 +``` + +#### Custom toml files + +You can specify a `toml` file with a different name to use for proving by using the `--prover-name` or `-p` flags. + +This command looks for proof inputs in the default **Prover.toml** and generates proof `p`: + +```bash +nargo prove p +``` + +This command looks for proof inputs in the custom **OtherProver.toml** and generates proof `pp`: + +```bash +nargo prove -p OtherProver pp +``` + +## Verifying a Proof + +When the command `nargo verify my_proof` is executed, two processes happen: + +1. Noir checks in the _proofs_ directory for a file called _my_proof_ + +2. If that file is found, the proof's validity is checked + +> **Note:** The validity of the proof is linked to the current Noir program; if the program is +> changed and the verifier verifies the proof, it will fail because the proof is not valid for the +> _modified_ Noir program. + +In production, the prover and the verifier are usually two separate entities. A prover would +retrieve the necessary inputs, execute the Noir program, generate a proof and pass it to the +verifier. The verifier would then retrieve the public inputs from usually external sources and +verifies the validity of the proof against it. + +Take a private asset transfer as an example: + +A user on browser as the prover would retrieve private inputs (e.g. the user's private key) and +public inputs (e.g. the user's encrypted balance on-chain), compute the transfer, generate a proof +and submit it to the verifier smart contract. + +The verifier contract would then draw the user's encrypted balance directly from the blockchain and +verify the proof submitted against it. If the verification passes, additional functions in the +verifier contract could trigger (e.g. approve the asset transfer). + +Now that you understand the concepts, you'll probably want some editor feedback while you are writing more complex code. + +In the [next section](language_server), we will explain how to utilize the Noir Language Server. diff --git a/noir/docs/versioned_docs/version-v0.9.0/getting_started/03_language_server.md b/noir/docs/versioned_docs/version-v0.9.0/getting_started/03_language_server.md new file mode 100644 index 00000000000..e6f5dfc2faa --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/getting_started/03_language_server.md @@ -0,0 +1,31 @@ +--- +title: Language Server +description: + Learn about the Noir Language Server, how to install the components, and configuration that may be required. +keywords: + [Nargo, Language Server, LSP, VSCode, Visual Studio Code] +--- + +This section helps you install and configure the Noir Language Server. + +The Language Server Protocol (LSP) has two components, the [Server](#language-server) and the [Client](#language-client). Below we describe each in the context of Noir. + +## Language Server + +The Server component is provided by the Nargo command line tool that you installed at the beginning of this guide. +As long as Nargo is installed and you've used it to run other commands in this guide, it should be good to go! + +If you'd like to verify that the `nargo lsp` command is available, you can run `nargo --help` and look for `lsp` in the list of commands. If you see it, you're using a version of Noir with LSP support. + +## Language Client + +The Client component is usually an editor plugin that launches the Server. It communicates LSP messages between the editor and the Server. For example, when you save a file, the Client will alert the Server, so it can try to compile the project and report any errors. + +Currently, Noir provides a Language Client for Visual Studio Code via the [vscode-noir](https://github.com/noir-lang/vscode-noir) extension. You can install it via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir). + +### Configuration + +* __Noir: Enable LSP__ - If checked, the extension will launch the Language Server via `nargo lsp` and communicate with it. +* __Noir: Nargo Flags__ - Additional flags may be specified if you require them to be added when the extension calls `nargo lsp`. +* __Noir: Nargo Path__ - An absolute path to a Nargo binary with the `lsp` command. This may be useful if Nargo is not within the `PATH` of your editor. +* __Noir > Trace: Server__ - Setting this to `"messages"` or `"verbose"` will log LSP messages between the Client and Server. Useful for debugging. diff --git a/noir/docs/versioned_docs/version-v0.9.0/index.md b/noir/docs/versioned_docs/version-v0.9.0/index.md new file mode 100644 index 00000000000..e56b24bccd8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/index.md @@ -0,0 +1,103 @@ +--- +title: Introducing Noir +description: + Learn about the public alpha release of Noir, a domain specific language heavily influenced by + Rust that compiles to an intermediate language which can be compiled to an arithmetic circuit or a + rank-1 constraint system. +keywords: + [ + Noir, + Domain Specific Language, + Rust, + Intermediate Language, + Arithmetic Circuit, + Rank-1 Constraint System, + Ethereum Developers, + Protocol Developers, + Blockchain Developers, + Proving System, + Smart Contract Language, + ] +slug: / +--- + +This version of the book is being released with the public alpha. There will be a lot of features +that are missing in this version, however the syntax and the feel of the language will mostly be +completed. + +## What is Noir? + +Noir is a Domain Specific Language for SNARK proving systems. It has been designed to use any ACIR compatible proving system. + +It's design choices are influenced heavily by Rust and focuses on a simple, familiar syntax. + +## Who is Noir for? + +Noir can be used for a variety of purposes. + +### Solidity Developers + +Noir currently includes a command to create a Solidity contract which verifies your Noir program. This will +be modularised in the future; however, as of the alpha, you can use the [`nargo codegen-verifier`](./nargo/commands#nargo-codegen-verifier) command to create +a verifier contract. + +### Protocol Developers + +As a protocol developer, you may not want to use the Aztec backend due to it not being a fit for +your stack, or maybe you simply want to use a different proving system. Since Noir does not compile +to a specific proof system, it is possible for protocol developers to replace the PLONK-based +proving system with a different proving system altogether. + +### Blockchain developers + +As a blockchain developer, you will be constrained by parameters set by your blockchain (for example, the +proving system and smart contract language has been pre-defined). In order for you to use Noir in +your blockchain, a proving system backend and a smart contract interface +must be implemented for it. + +## What's new about Noir? + +Noir is simple and flexible in its design, as it does not compile immediately to a fixed +NP-complete language. Instead, Noir compiles to an intermediate language (ACIR), which itself can be compiled +to an arithmetic circuit (if choosing to target Aztec's barretenberg backend) or a rank-1 constraint system (if choosing to target an R1CS backend like Arkwork's Marlin backend, or others). + +This in itself brings up a few challenges within the design process, but allows one to decouple the programming language completely from the backend. This is similar in theory to LLVM. + +## Current Features + +Compiler: + +- Module System +- For expressions +- Arrays +- Bit Operations +- Binary operations (<, <=, >, >=, +, -, \*, /, %) [See documentation for an extensive list] +- Unsigned integers +- If statements +- Structures and Tuples +- Generics + +ACIR Supported OPCODES: + +- Sha256 +- Blake2s +- Schnorr signature verification +- MerkleMembership +- Pedersen +- HashToField + +## Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers + +See the section on [dependencies](./modules_packages_crates/dependencies) for more information. diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/00_data_types.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/00_data_types.md new file mode 100644 index 00000000000..abbadca86be --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/00_data_types.md @@ -0,0 +1,405 @@ +--- +title: Data Types +description: + Get a clear understanding of the two categories of Noir data types - primitive types and compound + types. Learn about their characteristics, differences, and how to use them in your Noir + programming. +keywords: + [ + noir, + data types, + primitive types, + compound types, + private types, + public types, + field type, + integer types, + boolean type, + array type, + tuple type, + struct type, + ] +--- + +Every value in Noir has a type, which determines which operations are valid for it. + +All values in Noir are fundamentally composed of `Field` elements. For a more approachable +developing experience, abstractions are added on top to introduce different data types in Noir. + +Noir has two category of data types: primitive types (e.g. `Field`, integers, `bool`) and compound +types that group primitive types (e.g. arrays, tuples, structs). Each value can either be private or +public. + +## Private & Public Types + +A **private value** is known only to the Prover, while a **public value** is known by both the +Prover and Verifier. Mark values as `private` when the value should only be known to the prover. All +primitive types (including individual fields of compound types) in Noir are private by default, and +can be marked public when certain values are intended to be revealed to the Verifier. + +> **Note:** For public values defined in Noir programs paired with smart contract verifiers, once +> the proofs are verified on-chain the values can be considered known to everyone that has access to +> that blockchain. + +Public data types are treated no differently to private types apart from the fact that their values +will be revealed in proofs generated. Simply changing the value of a public type will not change the +circuit (where the same goes for changing values of private types as well). + +_Private values_ are also referred to as _witnesses_ sometimes. + +> **Note:** The terms private and public when applied to a type (e.g. `pub Field`) have a different +> meaning than when applied to a function (e.g. `pub fn foo() {}`). +> +> The former is a visibility modifier for the Prover to interpret if a value should be made known to +> the Verifier, while the latter is a visibility modifier for the compiler to interpret if a +> function should be made accessible to external Noir programs like in other languages. + +### pub Modifier + +All data types in Noir are private by default. Types are explicitly declared as public using the +`pub` modifier: + +```rust +fn main(x : Field, y : pub Field) -> pub Field { + x + y +} +``` + +In this example, `x` is **private** while `y` and `x + y` (the return value) are **public**. Note +that visibility is handled **per variable**, so it is perfectly valid to have one input that is +private and another that is public. + +> **Note:** Public types can only be declared through parameters on `main`. + +## Primitive Types + +A primitive type represents a single value. They can be private or public. + +### Fields + +The field type corresponds to the native field type of the proving backend. + +The size of a Noir field depends on the elliptic curve's finite field for the proving backend +adopted. For example, a field would be a 254-bit integer when paired with the default backend that +spans the Grumpkin curve. + +Fields support integer arithmetic and are often used as the default numeric type in Noir: + +```rust +fn main(x : Field, y : Field) { + let z = x + y; +} +``` + +`x`, `y` and `z` are all private fields in this example. Using the `let` keyword we defined a new +private value `z` constrained to be equal to `x + y`. + +If proving efficiency is of priority, fields should be used as a default for solving problems. +Smaller integer types (e.g. `u64`) incur extra range constraints. + +### Integers + +An integer type is a range constrained field type. The Noir frontend currently supports unsigned, +arbitrary-sized integer types. + +An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by +its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of +$\\([0,2^{32}-1]\\)$: + +```rust +fn main(x : Field, y : u32) { + let z = x as u32 + y; +} +``` + +`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z` +are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created +will be rejected by the verifier. + +> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`) +> sized integer types. + +### Booleans + +The `bool` type in Noir has two possible values: `true` and `false`: + +```rust +fn main() { + let t = true; + let f: bool = false; +} +``` + +> **Note:** When returning a boolean value, it will show up as a value of 1 for `true` and 0 for +> `false` in _Verifier.toml_. + +The boolean type is most commonly used in conditionals like `if` expressions and `assert` +statements. More about conditionals is covered in the [Control Flow](./control_flow) and +[Assert Function](./assert) sections. + +### Strings + +The string type is a fixed length value defined with `str`. + +You can use strings in `assert()` functions or print them with +`std::println()`. + +```rust +fn main(message : pub str<11>, hex_as_string : str<4>) { + std::println(message); + assert(message == "hello world"); + assert(hex_as_string == "0x41"); +} +``` + +## Compound Types + +A compound type groups together multiple values into one type. Elements within a compound type can +be private or public. + +### Arrays + +An array is one way of grouping together values into one compound type. Array types can be inferred +or explicitly specified via the syntax `[; ]`: + +```rust +fn main(x : Field, y : Field) { + let my_arr = [x, y]; + let your_arr: [Field; 2] = [x, y]; +} +``` + +Here, both `my_arr` and `your_arr` are instantiated as an array containing two `Field` elements. + +Array elements can be accessed using indexing: + +```rust +fn main() { + let a = [1, 2, 3, 4, 5]; + + let first = a[0]; + let second = a[1]; +} +``` + +All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group +a `Field` value and a `u8` value together for example. + +You can write mutable arrays, like: + +```rust +fn main() { + let mut arr = [1, 2, 3, 4, 5]; + assert(arr[0] == 1); + + arr[0] = 42; + assert(arr[0] == 42); +} +``` + +You can instantiate a new array of a fixed size with the same value repeated for each element. The following example instantiates an array of length 32 where each element is of type Field and has the value 0. + +```rust +let array: [Field; 32] = [0; 32]; +``` + +#### Types + +You can create arrays of primitive types or structs. There is not yet support for nested arrays +(arrays of arrays) or arrays of structs that contain arrays. + +### Slices + +:::caution + +This feature is experimental. You should expect it to change in future versions, +cause unexpected behavior, or simply not work at all. + +::: + +A slice is a dynamically-sized view into a sequence of elements. They can be resized at runtime, but because they don't own the data, they cannot be returned from a circuit. You can treat slices as arrays without a constrained size. + +Slices are part of the [noir standard library](../standard_library/slice_methods) so you need to import the respective module in order to work with it. For example: + +```rust +use dep::std::slice; + +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +### Vectors + +:::caution + +This feature is experimental. You should expect it to change in future versions, +cause unexpected behavior, or simply not work at all. + +::: + +A vector is a collection type similar to Rust's Vector type. It's convenient way to use slices as mutable arrays. + +Example: + +```rust +use std::collections::vec::Vec; + +let mut vector: Vec = Vec::new(); +for i in 0..5 { + vector.push(i); +} +assert(vector.len() == 5); +``` + +### Tuples + +A tuple collects multiple values like an array, but with the added ability to collect values of +different types: + +```rust +fn main() { + let tup: (u8, u64, Field) = (255, 500, 1000); +} +``` + +One way to access tuple elements is via destructuring using pattern matching: + +```rust +fn main() { + let tup = (1, 2); + + let (one, two) = tup; + + let three = one + two; +} +``` + +Another way to access tuple elements is via direct member access, using a period (`.`) followed by +the index of the element we want to access. Index `0` corresponds to the first tuple element, `1` to +the second and so on: + +```rust +fn main() { + let tup = (5, 6, 7, 8); + + let five = tup.0; + let eight = tup.3; +} +``` + +### Structs + +A struct also allows for grouping multiple values of different types. Unlike tuples, we can also +name each field. + +> **Note:** The usage of _field_ here refers to each element of the struct and is unrelated to the +> field type of Noir. + +Defining a struct requires giving it a name and listing each field within as `: ` pairs: + +```rust +struct Animal { + hands: Field, + legs: Field, + eyes: u8, +} +``` + +An instance of a struct can then be created with actual values in `: ` pairs in any +order. Struct fields are accessible using their given names: + +```rust +fn main() { + let legs = 4; + + let dog = Animal { + eyes: 2, + hands: 0, + legs, + }; + + let zero = dog.hands; +} +``` + +Structs can also be destructured in a pattern, binding each field to a new variable: + +```rust +fn main() { + let Animal { hands, legs: feet, eyes } = get_octopus(); + + let ten = hands + feet + eyes as u8; +} + +fn get_octopus() -> Animal { + let octopus = Animal { + hands: 0, + legs: 8, + eyes: 2, + }; + + octopus +} +``` + +The new variables can be bound with names different from the original struct field names, as +showcased in the `legs --> feet` binding in the example above. + +:::note +You can use Structs as inputs to the `main` function, but you can't output them +::: + +### Type Aliases + +A type alias is a new name for an existing type. Type aliases are declared with the keyword `type`: + +```rust +type Id = u8; + +fn main() { + let id: Id = 1; + let zero: u8 = 0; + assert(zero + 1 == id); +} +``` + +Type aliases can also be used with [generics](./06_generics.md): + +```rust +type Id = Size; + +fn main() { + let id: Id = 1; + let zero: u32 = 0; + assert(zero + 1 == id); +} +``` + +### BigInt + +You can acheive BigInt functionality using the [Noir BigInt](https://github.com/shuklaayush/noir-bigint) library. + +## References + +Noir supports first-class references. References are a bit like pointers: they point to a specific address that can be followed to access the data stored at that address. You can use Rust-like syntax to use pointers in Noir: the `&` operator references the variable, the `*` operator dereferences it. + +Example: + +```rust +fn main() { + let mut x = 2; + + // you can reference x as &mut and pass it to multiplyBy2 + multiplyBy2(&mut x); +} + +// you can access &mut here +fn multiplyBy2(x: &mut Field) { + // and dereference it with * + *x = *x * 2; +} +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/01_functions.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/01_functions.md new file mode 100644 index 00000000000..54c618599d2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/01_functions.md @@ -0,0 +1,88 @@ +--- +title: Functions +description: + Learn how to declare functions and methods in Noir, a programming language with Rust semantics. + This guide covers parameter declaration, return types, call expressions, and more. +keywords: [Noir, Rust, functions, methods, parameter declaration, return types, call expressions] +--- + +Functions in Noir follow the same semantics of Rust, though Noir does not support early returns. + +To declare a function the `fn` keyword is used. + +```rust +fn foo() {} +``` + +All parameters in a function must have a type and all types are known at compile time. The parameter +is pre-pended with a colon and the parameter type. Multiple parameters are separated using a comma. + +```rust +fn foo(x : Field, y : pub Field){} +``` + +The return type of a function can be stated by using the `->` arrow notation. The function below +states that the foo function must return a `Field`. If the function returns no value, then the arrow +is omitted. + +```rust +fn foo(x : Field, y : pub Field) -> Field { + x + y +} +``` + +Note that a `return` keyword is unneeded in this case - the last expression in a function's body is +returned. + +## Call Expressions + +Calling a function in Noir is executed by using the function name and passing in the necessary +arguments. + +Below we show how to call the `foo` function from the `main` function using a call expression: + +```rust +fn main(x : Field, y : Field) { + let z = foo(x); +} + +fn foo(x : Field) -> Field { + x + x +} +``` + +## Methods + +You can define methods in Noir on any struct type in scope. + +```rust +struct MyStruct { + foo: Field, + bar: Field, +} + +impl MyStruct { + fn new(foo: Field) -> MyStruct { + MyStruct { + foo, + bar: 2, + } + } + + fn sum(self) -> Field { + self.foo + self.bar + } +} + +fn main() { + let s = MyStruct::new(40); + assert(s.sum() == 42); +} +``` + +Methods are just syntactic sugar for functions, so if we wanted to we could also call `sum` as +follows: + +```rust +assert(MyStruct::sum(s) == 42); +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/02_control_flow.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/02_control_flow.md new file mode 100644 index 00000000000..691c514d9a8 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/02_control_flow.md @@ -0,0 +1,42 @@ +--- +title: Control Flow +description: + Learn how to use loops and if expressions in the Noir programming language. Discover the syntax + and examples for for loops and if-else statements. +keywords: [Noir programming language, loops, for loop, if-else statements, Rust syntax] +--- + +## Loops + +Noir has one kind of loop: the `for` loop. `for` loops allow you to repeat a block of code multiple +times. + +The following block of code between the braces is run 10 times. + +```rust +for i in 0..10 { + // do something +}; +``` + +## If Expressions + +Noir supports `if-else` statements. The syntax is most similar to Rust's where it is not required +for the statement's conditional to be surrounded by parentheses. + +```rust +let a = 0; +let mut x: u32 = 0; + +if a == 0 { + if a != 0 { + x = 6; + } else { + x = 2; + } +} else { + x = 5; + assert(x == 5); +} +assert(x == 2); +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/03_ops.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/03_ops.md new file mode 100644 index 00000000000..da02b126059 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/03_ops.md @@ -0,0 +1,97 @@ +--- +title: Logical Operations +description: + Learn about the supported arithmetic and logical operations in the Noir programming language. + Discover how to perform operations on private input types, integers, and booleans. +keywords: + [ + Noir programming language, + supported operations, + arithmetic operations, + logical operations, + predicate operators, + bitwise operations, + short-circuiting, + backend, + ] +--- + +# Operations + +## Table of Supported Operations + +| Operation | Description | Requirements | +| :-------- | :------------------------------------------------------------: | -------------------------------------: | +| + | Adds two private input types together | Types must be private input | +| - | Subtracts two private input types together | Types must be private input | +| \* | Multiplies two private input types together | Types must be private input | +| / | Divides two private input types together | Types must be private input | +| ^ | XOR two private input types together | Types must be integer | +| & | AND two private input types together | Types must be integer | +| \| | OR two private input types together | Types must be integer | +| << | Left shift an integer by another integer amount | Types must be integer | +| >> | Right shift an integer by another integer amount | Types must be integer | +| ! | Bitwise not of a value | Type must be integer or boolean | +| < | returns a bool if one value is less than the other | Upper bound must have a known bit size | +| <= | returns a bool if one value is less than or equal to the other | Upper bound must have a known bit size | +| > | returns a bool if one value is more than the other | Upper bound must have a known bit size | +| >= | returns a bool if one value is more than or equal to the other | Upper bound must have a known bit size | +| == | returns a bool if one value is equal to the other | Both types must not be constants | +| != | returns a bool if one value is not equal to the other | Both types must not be constants | + +### Predicate Operators + +`<,<=, !=, == , >, >=` are known as predicate/comparison operations because they compare two values. +This differs from the operations such as `+` where the operands are used in _computation_. + +### Bitwise Operations Example + +```rust +fn main(x : Field) { + let y = x as u32; + let z = y & y; +} +``` + +`z` is implicitly constrained to be the result of `y & y`. The `&` operand is used to denote bitwise +`&`. + +> `x & x` would not compile as `x` is a `Field` and not an integer type. + +### Logical Operators + +Noir has no support for the logical operators `||` and `&&`. This is because encoding the +short-circuiting that these operators require can be inefficient for Noir's backend. Instead you can +use the bitwise operators `|` and `&` which operate indentically for booleans, just without the +short-circuiting. + +```rust +let my_val = 5; + +let mut flag = 1; +if (my_val > 6) | (my_val == 0) { + flag = 0; +} +assert(flag == 1); + +if (my_val != 10) & (my_val < 50) { + flag = 0; +} +assert(flag == 0); +``` + +### Shorthand operators + +Noir shorthand operators for most of the above operators, namely `+=, -=, *=, /=, %=, &=, |=, ^=, <<=`, and `>>=`. These allow for more concise syntax. For example: + +```rust +let mut i = 0; +i = i + 1; +``` + +could be written as: + +```rust +let mut i = 0; +i += 1; +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/04_assert.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/04_assert.md new file mode 100644 index 00000000000..a25a946123d --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/04_assert.md @@ -0,0 +1,34 @@ +--- +title: Assert Function +description: + Learn about the assert function in Noir, which can be used to explicitly constrain the predicate or + comparison expression that follows to be true, and what happens if the expression is false at + runtime. +keywords: [Noir programming language, assert statement, predicate expression, comparison expression] +--- + +Noir includes a special `assert` function which will explicitly constrain the predicate/comparison +expression that follows to be true. If this expression is false at runtime, the program will fail to +be proven. + +### Example + +```rust +fn main(x : Field, y : Field) { + assert(x == y); +} +``` + +The above snippet compiles because `==` is a predicate operation. Conversely, the following will not +compile: + +```rust +// INCORRECT + +fn main(x : Field, y : Field) { + assert(x + y); +} +``` + +> The rationale behind this not compiling is due to ambiguity. It is not clear if the above should +> equate to `x + y == 0` or if it should check the truthiness of the result. diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/05_unconstrained.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/05_unconstrained.md new file mode 100644 index 00000000000..6b621eda3eb --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/05_unconstrained.md @@ -0,0 +1,96 @@ +--- +title: Unconstrained Functions +description: "Learn about what unconstrained functions in Noir are, how to use them and when you'd want to." + +keywords: [Noir programming language, unconstrained, open] +--- + + + +Unconstrained functions are functions which do not constrain any of the included computation and allow for non-determinisitic computation. + +## Why? + +Zero-knowledge (ZK) domain-specific languages (DSL) enable developers to generate ZK proofs from their programs by compiling code down to the constraints of an NP complete language (such as R1CS or PLONKish languages). However, the hard bounds of a constraint system can be very limiting to the functionality of a ZK DSL. + +Enabling a circuit language to perform unconstrained execution is a powerful tool. Said another way, unconstrained execution lets developers generate witnesses from code that does not generate any constraints. Being able to execute logic outside of a circuit is critical for both circuit performance and constructing proofs on information that is external to a circuit. + +Fetching information from somewhere external to a circuit can also be used to enable developers to improve circuit efficiency. + +A ZK DSL does not just prove computation, but proves that some computation was handled correctly. Thus, it is necessary that when we switch from performing some operation directly inside of a circuit to inside of an unconstrained environment that the appropriate constraints are still laid down elsewhere in the circuit. + +## Example + +An in depth example might help drive the point home. This example comes from the excellent [post](https://discord.com/channels/1113924620781883405/1124022445054111926/1128747641853972590) by Tom in the Noir Discord. + +Let's look at how we can optimize a function to turn a `u72` into an array of `u8`s. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u72 & 0xff) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 91 +Backend circuit size: 3619 +``` + +A lot of the operations in this function are optimized away by the compiler (all the bit-shifts turn into divisions by constants). However we can save a bunch of gates by casting to u8 a bit earlier. This automatically truncates the bit-shifted value to fit in a u8 which allows us to remove the XOR against 0xff. This saves us ~480 gates in total. + +```rust +fn main(num: u72) -> pub [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8)) as u8; + } + + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 75 +Backend circuit size: 3143 +``` + +Those are some nice savings already but we can do better. This code is all constrained so we're proving every step of calculating out using num, but we don't actually care about how we calculate this, just that it's correct. This is where brillig comes in. + +It turns out that truncating a u72 into a u8 is hard to do inside a snark, each time we do as u8 we lay down 4 ACIR opcodes which get converted into multiple gates. It's actually much easier to calculate num from out than the other way around. All we need to do is multiply each element of out by a constant and add them all together, both relatively easy operations inside a snark. + +We can then run u72_to_u8 as unconstrained brillig code in order to calculate out, then use that result in our constrained function and assert that if we were to do the reverse calculation we'd get back num. This looks a little like the below: + +```rust +fn main(num: u72) -> pub [u8; 8] { + let out = u72_to_u8(num); + + let mut reconstructed_num: u72 = 0; + for i in 0..8 { + reconstructed_num += (out[i] as u72 << (56 - (8 * i))); + } + assert(num == reconstructed_num); + out +} + +unconstrained fn u72_to_u8(num: u72) -> [u8; 8] { + let mut out: [u8; 8] = [0; 8]; + for i in 0..8 { + out[i] = (num >> (56 - (i * 8))) as u8; + } + out +} +``` + +``` +Total ACIR opcodes generated for language PLONKCSat { width: 3 }: 78 +Backend circuit size: 2902 +``` + +This ends up taking off another ~250 gates from our circuit! We've ended up with more ACIR opcodes than before but they're easier for the backend to prove (resulting in fewer gates). + +Generally we want to use brillig whenever there's something that's easy to verify but hard to compute within the circuit. For example, if you wanted to calculate a square root of a number it'll be a much better idea to calculate this in brillig and then assert that if you square the result you get back your number. diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/06_generics.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/06_generics.md new file mode 100644 index 00000000000..66f2e85e16b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/06_generics.md @@ -0,0 +1,116 @@ +--- +title: Generics +description: + Learn how to use Generics in Noir +keywords: [Noir, Rust, generics, functions, structs] +--- + +# Generics + +Generics allow you to use the same functions with multiple different concrete data types. You can +read more about the concept of generics in the Rust documentation +[here](https://doc.rust-lang.org/book/ch10-01-syntax.html). + +Here is a trivial example showing the identity function that supports any type. In Rust, it is +common to refer to the most general type as `T`. We follow the same convention in Noir. + +```rust +fn id(x: T) -> T { + x +} +``` + +## In Structs + +Generics are useful for specifying types in structs. For example, we can specify that a field in a +struct will be of a certain generic type. In this case `value` is of type `T`. + +```rust +struct RepeatedValue { + value: T, + count: comptime Field, +} + +impl RepeatedValue { + fn new(value: T) -> Self { + Self { value, count: 1 } + } + + fn increment(mut repeated: Self) -> Self { + repeated.count += 1; + repeated + } + + fn print(self) { + for _i in 0 .. self.count { + dep::std::println(self.value); + } + } +} + +fn main() { + let mut repeated = RepeatedValue::new("Hello!"); + repeated = repeated.increment(); + repeated.print(); +} +``` + +The `print` function will print `Hello!` an arbitrary number of times, twice in this case. + +If we want to be generic over array lengths (which are type-level integers), we can use numeric +generics. Using these looks just like using regular generics, but these generics can resolve to +integers at compile-time, rather than resolving to types. Here's an example of a struct that is +generic over the size of the array it contains internally: + +```rust +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} +``` + +## Calling functions on generic parameters + +Unlike Rust, Noir does not have traits, so how can one translate the equivalent of a trait bound in +Rust into Noir? That is, how can we write a function that is generic over some type `T`, while also +requiring there is a function like `eq: fn(T, T) -> bool` that works on the type? + +The answer is that we can translate this by passing in the function manually. Here's an example of +implementing array equality in Noir: + +```rust +fn array_eq(array1: [T; N], array2: [T; N], elem_eq: fn(T, T) -> bool) -> bool { + if array1.len() != array2.len() { + false + } else { + let mut result = true; + for i in 0 .. array1.len() { + result &= elem_eq(array1[i], array2[i]); + } + result + } +} + +fn main() { + assert(array_eq([1, 2, 3], [1, 2, 3], |a, b| a == b)); + + // We can use array_eq even for arrays of structs, as long as we have + // an equality function for these structs we can pass in + let array = [MyStruct::new(), MyStruct::new()]; + assert(array_eq(array, array, MyStruct::eq)); +} +``` + +You can see an example of generics in the tests +[here](https://github.com/noir-lang/noir/blob/master/tooling/nargo_cli/tests/execution_success/generics/src/main.nr). diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/07_mutability.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/07_mutability.md new file mode 100644 index 00000000000..69798c7a276 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/07_mutability.md @@ -0,0 +1,120 @@ +--- +title: Mutability +description: + Learn about mutable variables, constants, and globals in Noir programming language. Discover how + to declare, modify, and use them in your programs. +keywords: [noir programming language, mutability in noir, mutable variables, constants, globals] +--- + +Variables in noir can be declared mutable via the `mut` keyword. Mutable variables can be reassigned +to via an assignment expression. + +```rust +let x = 2; +x = 3; // error: x must be mutable to be assigned to + +let mut y = 3; +let y = 4; // OK +``` + +The `mut` modifier can also apply to patterns: + +```rust +let (a, mut b) = (1, 2); +a = 11; // error: a must be mutable to be assigned to +b = 12; // OK + +let mut (c, d) = (3, 4); +c = 13; // OK +d = 14; // OK + +// etc. +let MyStruct { x: mut y } = MyStruct { x: a } +// y is now in scope +``` + +Note that mutability in noir is local and everything is passed by value, so if a called function +mutates its parameters then the parent function will keep the old value of the parameters. + +```rust +fn main() -> Field { + let x = 3; + helper(x); + x // x is still 3 +} + +fn helper(mut x: i32) { + x = 4; +} +``` + +## Comptime Values + +Comptime values are values that are known at compile-time. This is different to a witness +which changes per proof. If a comptime value that is being used in your program is changed, then your +circuit will also change. + +Comptime is slightly different from Rust's `const`. Namely, it is a bit more flexible in that normal functions can accept comptime parameters. For example, this is used to verify an array index is known at compile-time. Note that the "known at compile-time" here means "known after function inlining is performed while optimizing the program" and not "known during type-checking." + +Below we show how to declare a comptime value: + +```rust +fn main() { + let a: comptime Field = 5; + + // `comptime Field` can also be inferred: + let a = 5; +} +``` + +Comptime variables can be mutuable, but must be known at compile time: + +```rust +fn main(runtime_var: Field) -> pub Field { + let known_at_compile_time: comptime Field = 1; + + // The next line will cause an error + let bad_var: comptime Field = runtime_var; + +} +``` + +As `runtime_var` is a argument to the circuit it cannot be known at compile time and so assigning it to a comptime variable should fail. A circuit's arguments is the only way in which non-comptime variables can enter the circuit (excluding [brillig](./unconstrained) foreign calls). + +## Globals + +Noir also supports global variables. However, they must be compile-time variables. If `comptime` is +not explicitly written in the type annotation the compiler will implicitly specify the declaration +as compile-time. They can then be used like any other compile-time variable inside functions. The +global type can also be inferred by the compiler entirely. Globals can also be used to specify array +annotations for function parameters and can be imported from submodules. + +```rust +global N: Field = 5; // Same as `global N: comptime Field = 5` + +fn main(x : Field, y : [Field; N]) { + let res = x * N; + + assert(res == y[0]); + + let res2 = x * mysubmodule::N; + assert(res != res2); +} + +mod mysubmodule { + use dep::std; + + global N: Field = 10; + + fn my_helper() -> comptime Field { + let x = N; + x + } +} +``` + +## Why only local mutability? + +Witnesses in a proving system are immutable in nature. Noir aims to _closely_ mirror this setting +without applying additional overhead to the user. Modeling a mutable reference is not as +straightforward as on conventional architectures and would incur some possibly unexpected overhead. diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/08_comments.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/08_comments.md new file mode 100644 index 00000000000..3bb4d2f25a4 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/08_comments.md @@ -0,0 +1,32 @@ +--- +title: Comments +description: + Learn how to write comments in Noir programming language. A comment is a line of code that is + ignored by the compiler, but it can be read by programmers. Single-line and multi-line comments + are supported in Noir. +keywords: [Noir programming language, comments, single-line comments, multi-line comments] +--- + +A comment is a line in your codebase which the compiler ignores, however it can be read by +programmers. + +Here is a single line comment: + +```rust +// This is a comment and is ignored +``` + +`//` is used to tell the compiler to ignore the rest of the line. + +Noir also supports multi-line block comments. Start a block comment with `/*` and end the block with `*/`. + +Noir does not natively support doc comments. You may be able to use [Rust doc comments](https://doc.rust-lang.org/reference/comments.html) in your code to leverage some Rust documentation build tools with Noir code. + +```rust +/* + This is a block comment describing a complex function. +*/ +fn main(x : Field, y : pub Field) { + assert(x != y); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/09_distinct.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/09_distinct.md new file mode 100644 index 00000000000..e7ff7f5017a --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/09_distinct.md @@ -0,0 +1,63 @@ +--- +title: Distinct Witnesses +--- + +The `distinct` keyword prevents repetitions of witness indices in the program's ABI. This ensures +that the witnesses being returned as public inputs are all unique. + +The `distinct` keyword is only used for return values on program entry points (usually the `main()` +function). + +When using `distinct` and `pub` simultaneously, `distinct` comes first. See the example below. + +You can read more about the problem this solves +[here](https://github.com/noir-lang/noir/issues/1183). + +## Example + +Without the `distinct` keyword, the following program + +```rust +fn main(x : pub Field, y : pub Field) -> pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + "return_witnesses": [3, 2, 4, 4] + } +} +``` + +Whereas (with the `distinct` keyword) + +```rust +fn main(x : pub Field, y : pub Field) -> distinct pub [Field; 4] { + let a = 1; + let b = 1; + [x + 1, y, a, b] +} +``` + +compiles to + +```json +{ + //... + "abi": { + //... + "param_witnesses": { "x": [1], "y": [2] }, + //... + "return_witnesses": [3, 4, 5, 6] + } +} +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/language_concepts/10_shadowing.md b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/10_shadowing.md new file mode 100644 index 00000000000..efd743e764f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/language_concepts/10_shadowing.md @@ -0,0 +1,43 @@ +--- +title: Shadowing +--- + +Noir allows for inheriting variables' values and re-declaring them with the same name similar to Rust, known as shadowing. + +For example, the following function is valid in Noir: + +```rust +fn main() { + let x = 5; + + { + let x = x * 2; + assert (x == 10); + } + + assert (x == 5); +} +``` + +In this example, a variable x is first defined with the value 5. + +The local scope that follows shadows the original x, i.e. creates a local mutable x based on the value of the original x. It is given a value of 2 times the original x. + +When we return to the main scope, x once again refers to just the original x, which stays at the value of 5. + +## Temporal mutability + +One way that shadowing is useful, in addition to ergonomics across scopes, is for temporarily mutating variables. + +```rust +fn main() { + let age = 30; + // age = age + 5; // Would error as `age` is immutable by default. + + let mut age = age + 5; // Temporarily mutates `age` with a new value. + + let age = age; // Locks `age`'s mutability again. + + assert (age == 35); +} +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/crates_and_packages.md b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/crates_and_packages.md new file mode 100644 index 00000000000..34f28a71148 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/crates_and_packages.md @@ -0,0 +1,35 @@ +--- +title: Crates and Packages +description: + Learn how to use Crates and Packages in your Noir project +keywords: [Nargo, dependencies, package management, crates, package] +--- + +## Crates + +A crate is the smallest amount of code that the Noir compiler considers at a time. +Crates can contain modules, and the modules may be defined in other files that get compiled with the crate, as we’ll see in the coming sections. + +### Crate Types + +A Noir crate can come in one of two forms: a binary crate or a library crate. + +_Binary crates_ are programs which you can compile to an ACIR circuit which you can then create proofs against. Each must have a function called `main` that defines the ACIR circuit which is to be proved. + +_Library crates_ don't have a `main` function and they don't compile down to ACIR. Instead they define functionality intended to be shared with multiple projects, and eventually included in a binary crate. + +### Crate Root + +Every crate has a root, which is the source file that the compiler starts, this is also known as the root module. The Noir compiler does not enforce any conditions on the name of the file which is the crate root, however if you are compiling via Nargo the crate root must be called `lib.nr` or `main.nr` for library or binary crates respectively. + +## Packages + +A Nargo _package_ is a collection of one of more crates that provides a set of functionality. A package must include a Nargo.toml file. + +A package _must_ contain either a library or a binary crate, but not both. + +### Differences from Cargo Packages + +One notable difference between Rust's Cargo and Noir's Nargo is that while Cargo allows a package to contain an unlimited number of binary crates and a single library crate, Nargo currently only allows a package to contain a single crate. + +In future this restriction may be lifted to allow a Nargo package to contain both a binary and library crate or multiple binary crates. diff --git a/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/dependencies.md b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/dependencies.md new file mode 100644 index 00000000000..2807ad52046 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/dependencies.md @@ -0,0 +1,110 @@ +--- +title: Managing Dependencies +description: + Learn how to specify and manage dependencies in Nargo, allowing you to upload packages to GitHub + and use them easily in your project. +keywords: [Nargo, dependencies, GitHub, package management, versioning] +--- + +Nargo allows you to upload packages to GitHub and use them as dependencies. + +## Specifying a dependency + +Specifying a dependency requires a tag to a specific commit and the git url to the url containing +the package. + +Currently, there are no requirements on the tag contents. If requirements are added, it would follow +semver 2.0 guidelines. + +> Note: Without a `tag` , there would be no versioning and dependencies would change each time you +> compile your project. + +For example, to add the [ecrecover-noir library](https://github.com/colinnielsen/ecrecover-noir) to your project, add it to `Nargo.toml`: + +```toml +# Nargo.toml + +[dependencies] +ecrecover = {tag = "v0.8.0", git = "https://github.com/colinnielsen/ecrecover-noir"} +``` + +## Specifying a local dependency + +You can also specify dependencies that are local to your machine. + +For example, this file structure has a library and binary crate + +``` +├── binary_crate +│   ├── Nargo.toml +│   └── src +│   └── main.nr +└── liba + ├── Nargo.toml + └── src + └── lib.nr +``` + +Inside of the binary crate, you can specify: + +```toml +# Nargo.toml + +[dependencies] +libA = { path = "../liba" } +``` + +## Importing dependencies + +You can import a dependency to a Noir file using the following syntax. For example, to import the +ecrecover-noir library and local liba referenced above: + +```rust +use dep::ecrecover; +use dep::libA; +``` + +You can also import only the specific parts of dependency that you want to use, like so: + +```rust +use dep::std::hash::sha256; +use dep::std::scalar_mul::fixed_base; +``` + +Lastly, as demonstrated in the +[elliptic curve example](../standard_library/cryptographic_primitives/ec_primitives#examples), you +can import multiple items in the same line by enclosing them in curly braces: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; +``` + +## Dependencies of Dependencies + +Note that when you import a dependency, you also get access to all of the dependencies of that package. + +For example, the [phy_vector](https://github.com/resurgencelabs/phy_vector) library imports an [fraction](https://github.com/resurgencelabs/fraction) library. If you're importing the phy_vector library, then you can access the functions in fractions library like so: + +```rust +use dep::phy_vector; + +fn main(x : Field, y : pub Field) { + //... + let f = phy_vector::fraction::toFraction(true, 2, 1); + //... +} +``` + +## Available Libraries + +Noir does not currently have an official package manager. You can find a list of available Noir libraries in the [awesome-noir repo here](https://github.com/noir-lang/awesome-noir#libraries). + +Some libraries that are available today include: + +- [Standard Library](https://github.com/noir-lang/noir/tree/master/noir_stdlib) - the Noir Standard Library +- [Ethereum Storage Proof Verification](https://github.com/aragonzkresearch/noir-trie-proofs) - a library that contains the primitives necessary for RLP decoding (in the form of look-up table construction) and Ethereum state and storage proof verification (or verification of any trie proof involving 32-byte long keys) +- [BigInt](https://github.com/shuklaayush/noir-bigint) - a library that provides a custom BigUint56 data type, allowing for computations on large unsigned integers +- [ECrecover](https://github.com/colinnielsen/ecrecover-noir/tree/main) - a library to verify an ECDSA signature and return the source Ethereum address +- [Sparse Merkle Tree Verifier](https://github.com/vocdoni/smtverifier-noir/tree/main) - a library for verification of sparse Merkle trees +- [Signed Int](https://github.com/resurgencelabs/signed_int) - a library for accessing a custom Signed Integer data type, allowing access to negative numbers on Noir +- [Fraction](https://github.com/resurgencelabs/fraction) - a library for accessing fractional number data type in Noir, allowing results that aren't whole numbers diff --git a/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/modules.md b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/modules.md new file mode 100644 index 00000000000..e429b336511 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/modules_packages_crates/modules.md @@ -0,0 +1,104 @@ +--- +title: Understanding Modules +description: + Learn how to organize your files using modules in Noir, following the same convention as Rust's + module system. Examples included. +keywords: [Noir, Rust, modules, organizing files, sub-modules] +--- + +# Modules + +Noir's module system follows the same convention as the _newer_ version of Rust's module system. + +## Purpose of Modules + +Modules are used to organise files. Without modules all of your code would need to live in a single +file. In Noir, the compiler does not automatically scan all of your files to detect modules. This +must be done explicitly by the developer. + +## Examples + +### Importing a module in the crate root + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::hello_world(); +} +``` + +Filename : `src/foo.nr` + +```rust +fn from_foo() {} +``` + +In the above snippet, the crate root is the `src/main.nr` file. The compiler sees the module +declaration `mod foo` which prompts it to look for a foo.nr file. + +Visually this module hierarchy looks like the following : + +``` +crate + ├── main + │ + └── foo + └── from_foo + +``` + +### Importing a module throughout the tree +All modules are accessible from the ``crate::`` namespace. + +``` +crate + ├── bar + ├── foo + └── main + +``` +In the above snippet, if ``bar`` would like to use functions in ``foo``, it can do so by ``use crate::foo::function_name``. + +### Sub-modules + +Filename : `src/main.nr` + +```rust +mod foo; + +fn main() { + foo::from_foo(); +} +``` + +Filename : `src/foo.nr` + +```rust +mod bar; +fn from_foo() {} +``` + +Filename : `src/foo/bar.nr` + +```rust +fn from_bar() {} +``` + +In the above snippet, we have added an extra module to the module tree; `bar`. `bar` is a submodule +of `foo` hence we declare bar in `foo.nr` with `mod bar`. Since `foo` is not the crate root, the +compiler looks for the file associated with the `bar` module in `src/foo/bar.nr` + +Visually the module hierarchy looks as follows: + +``` +crate + ├── main + │ + └── foo + ├── from_foo + └── bar + └── from_bar +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/nargo/01_commands.md b/noir/docs/versioned_docs/version-v0.9.0/nargo/01_commands.md new file mode 100644 index 00000000000..d550e137258 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/nargo/01_commands.md @@ -0,0 +1,139 @@ +--- +title: Commands +description: + Noir CLI Commands for Noir Prover and Verifier to create, execute, prove and verify programs, + generate Solidity verifier smart contract and compile into JSON file containing ACIR + representation and ABI of circuit. +keywords: + [ + Nargo, + Noir CLI, + Noir Prover, + Noir Verifier, + generate Solidity verifier, + compile JSON file, + ACIR representation, + ABI of circuit, + TypeScript, + ] +--- + +## General options + +``` +Options: + -s, --show-ssa Emit debug information for the intermediate SSA IR + -d, --deny-warnings Quit execution when warnings are emitted + -h, --help Print help +``` + +## `nargo help [subcommand]` + +Prints the list of available commands or specific information of a subcommand. + +_Arguments_ + +- `` - The subcommand whose help message to display + +## `nargo check` + +Generate the `Prover.toml` and `Verifier.toml` files for specifying prover and verifier in/output +values of the Noir program respectively. + +## `nargo codegen-verifier` + +Generate a Solidity verifier smart contract for the program. + +## `nargo compile ` + +Compile the program into a JSON build artifact file containing the ACIR representation and the ABI +of the circuit. This build artifact can then be used to generate and verify proofs. + +You can also use "build" as an alias for compile. + +For example, `nargo build `. + +_Arguments_ + +- `` - The name of the circuit file + +_Options_ + +- `-c, --contracts` - Compile each contract function used within the program +- `--print-acir` - Displays the ACIR for the compiled circuit + +## `nargo new [path]` + +Creates a new Noir project in a new folder called `` - Name of the package +- `[path]` - The path to save the new project + +## `nargo init` + +Creates a new Noir project in the current directory. + +## `nargo execute [witness_name]` + +Runs the Noir program and prints its return value. + +_Arguments_ + +- `[witness_name]` - The name of the witness + +_Usage_ + +The inputs to the circuit are read from the `Prover.toml` file generated by `nargo check`, which +must be filled in. + +To save the witness to file, run the command with a value for the `witness-name` argument. A +`.tr` file will then be saved in the `build` folder. + +> **Info:** The `.tr` file is the witness file. The witness file can be considered as program inputs +> parsed for your program's ACIR. +> +> This file can be passed along with circuit's ACIR into a TypeScript project for proving and +> verification. See the [TypeScript](../typescript#proving-and-verifying-externally-compiled-files) +> section to learn more. + +## `nargo prove ` + +Creates a proof for the program. + +_Arguments_ + +- `` - The name of the proof + +_Options_ + +- `-v, --verify` - Verify proof after proving + +## `nargo verify ` + +Given a proof and a program, verify whether the proof is valid. + +_Arguments_ + +- `` - The proof to verify + +## `nargo test ` + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +See an example on the [testing page](./testing). + +_Arguments_ + +- `` - a pattern to indicate to only run tests with names containing the pattern + +## `nargo gates` + +Counts the occurrences of different gates in circuit + +## `nargo lsp` + +Start a long-running Language Server process that communicates over stdin/stdout. +Usually this command is not run by a user, but instead will be run by a Language Client, such as [vscode-noir](https://github.com/noir-lang/vscode-noir). diff --git a/noir/docs/versioned_docs/version-v0.9.0/nargo/02_testing.md b/noir/docs/versioned_docs/version-v0.9.0/nargo/02_testing.md new file mode 100644 index 00000000000..ba0bebd658b --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/nargo/02_testing.md @@ -0,0 +1,32 @@ +--- +title: Testing in Noir +description: Learn how to use Nargo to test your Noir program in a quick and easy way +keywords: [Nargo, testing, Noir, compile, test] +--- + +You can test your Noir programs using Noir circuits. + +Nargo will automatically compile and run any functions which have the decorator `#[test]` on them if +you run `nargo test`. + +For example if you have a program like: + +```rust +fn add(x: u64, y: u64) -> u64 { + x + y +} +#[test] +fn test_add() { + assert(add(2,2) == 4); + assert(add(0,1) == 1); + assert(add(1,0) == 1); +} +``` + +Running `nargo test` will test that the `test_add` function can be executed while satisfying the all +the contraints which allows you to test that add returns the expected values. Test functions can't +have any arguments currently. + +This is much faster compared to testing in Typescript but the only downside is that you can't +explicitly test that a certain set of inputs are invalid. i.e. you can't say that you want +add(2^64-1, 2^64-1) to fail. diff --git a/noir/docs/versioned_docs/version-v0.9.0/nargo/03_solidity_verifier.md b/noir/docs/versioned_docs/version-v0.9.0/nargo/03_solidity_verifier.md new file mode 100644 index 00000000000..9ac60cb0ba7 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/nargo/03_solidity_verifier.md @@ -0,0 +1,129 @@ +--- +title: Solidity Verifier +description: + Learn how to run the verifier as a smart contract on the blockchain. Compile a Solidity verifier + contract for your Noir program and deploy it on any EVM blockchain acting as a verifier smart + contract. Read more to find out! +keywords: + [ + solidity verifier, + smart contract, + blockchain, + compiler, + plonk_vk.sol, + EVM blockchain, + verifying Noir programs, + proving backend, + Barretenberg, + ] +--- + +For certain applications, it may be desirable to run the verifier as a smart contract instead of on +a local machine. + +Compile a Solidity verifier contract for your Noir program by running: + +```sh +nargo codegen-verifier +``` + +A new `contract` folder would then be generated in your project directory, containing the Solidity +file `plonk_vk.sol`. It can be deployed on any EVM blockchain acting as a verifier smart contract. + +> **Note:** It is possible to compile verifier contracts of Noir programs for other smart contract +> platforms as long as the proving backend supplies an implementation. +> +> Barretenberg, the default proving backend for Nargo, supports compilation of verifier contracts in +> Solidity only for the time being. + +## Verify + +To verify a proof using the Solidity verifier contract, call the `verify` function with the +following signature: + +```solidity +function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) +``` + +You can see an example of how the `verify` function is called in the example zk voting application [here](https://github.com/noir-lang/noir-examples/blob/33e598c257e2402ea3a6b68dd4c5ad492bce1b0a/foundry-voting/src/zkVote.sol#L35): + +```solidity +function castVote(bytes calldata proof, uint proposalId, uint vote, bytes32 nullifierHash) public returns (bool) { + // ... + bytes32[] memory publicInputs = new bytes32[](4); + publicInputs[0] = merkleRoot; + publicInputs[1] = bytes32(proposalId); + publicInputs[2] = bytes32(vote); + publicInputs[3] = nullifierHash; + require(verifier.verify(proof, publicInputs), "Invalid proof"); +``` + +### Public Inputs + +:::tip + +A circuit doesn't have the concept of a return value. Return values are just syntactic sugar in +Noir. + +Under the hood, the return value is passed as an input to the circuit and is checked at the end of +the circuit program. + +::: + +The verifier contract uses the output (return) value of a Noir program as a public input. So if you +have the following function + +```rust +fn main( + // Public inputs + pubkey_x: pub Field, + pubkey_y: pub Field, + // Private inputs + priv_key: Field, +) -> pub Field +``` + +then `verify` in `plonk_vk.sol` will expect 3 public inputs. Passing two inputs will result in an +error like `Reason: PUBLIC_INPUT_COUNT_INVALID(3, 2)`. + +In this case the 3 inputs to `verify` would be ordered as `[pubkey_x, pubkey_y, return]`. + +#### Struct inputs + +Consider the following program: + +```rust +struct Type1 { + val1: Field, + val2: Field, +} + +struct Nested { + t1: Type1, + is_true: bool, +} + +fn main(x: pub Field, nested: pub Nested, y: pub Field) { + //... +} +``` + +Structs will be flattened so that the array of inputs is 1-dimensional array. The order of these inputs would be flattened to: `[x, nested.t1.val1, nested.t1.val2, nested.is_true, y]` + +## Noir for EVM chains + +You can currently deploy the Solidity verifier contracts to most EVM compatible chains. EVM chains that have been tested and are known to work include: + +- Optimism +- Arbitrum +- Polygon PoS +- Scroll +- Celo + +Other EVM chains should work, but have not been tested directly by our team. If you test any other chains, please open a PR on this page to update the list. See [this doc](https://github.com/noir-lang/noir-starter/tree/main/with-foundry#testing-on-chain) for more info about testing verifier contracts on different EVM chains. + +### Unsupported chains + +Unfortunately not all "EVM" chains are supported. + +**zkSync** and the **Polygon zkEVM** do _not_ currently support proof verification via Solidity verifier contracts. They are missing the bn256 precompile contract that the verifier contract requires. Once these chains support this precompile, they may work. diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/black_box_fns.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/black_box_fns.md new file mode 100644 index 00000000000..c758846b688 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/black_box_fns.md @@ -0,0 +1,45 @@ +--- +title: Black Box Functions +description: Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. +keywords: [noir, black box functions] +--- + +Black box functions are functions in Noir that rely on backends implementing support for specialized constraints. This makes certain zk-snark unfriendly computations cheaper than if they were implemented in Noir. + +:::warning + +It is likely that not all backends will support a particular black box function. + +::: + +Because it is not guaranteed that all backends will support black box functions, it is possible that certain Noir programs won't compile against a particular backend if they use an unsupported black box function. It is possible to fallback to less efficient implementations written in Noir/ACIR in some cases. + +Black box functions are specified with the `#[foreign(black_box_fn)]` attribute. For example, the SHA256 function in the Noir [source code](https://github.com/noir-lang/noir/blob/v0.5.1/noir_stdlib/src/hash.nr) looks like: + +```rust +#[foreign(sha256)] +fn sha256(_input : [u8; N]) -> [u8; 32] {} +``` + +## Function list + +Here is a list of the current black box functions that are supported by UltraPlonk: + +- AES +- [SHA256](./cryptographic_primitives/hashes#sha256) +- [Schnorr signature verification](./cryptographic_primitives/schnorr) +- [Blake2s](./cryptographic_primitives/hashes#blake2s) +- [Pedersen](./cryptographic_primitives/hashes#pedersen) +- [HashToField128Security](./cryptographic_primitives/hashes#hash_to_field) +- [ECDSA signature verification](./cryptographic_primitives/ecdsa_sig_verification) +- [Fixed base scalar multiplication](./cryptographic_primitives/scalar) +- [Compute merkle root](./merkle_trees#compute_merkle_root) +- AND +- XOR +- RANGE +- [Keccak256](./cryptographic_primitives/hashes#keccak256) +- [Recursive proof verification](./recursion) + +Most black box functions are included as part of the Noir standard library, however `AND`, `XOR` and `RANGE` are used as part of the Noir language syntax. For instance, using the bitwise operator `&` will invoke the `AND` black box function. To ensure compatibility across backends, the ACVM has fallback implementations of `AND`, `XOR` and `RANGE` defined in its standard library which it can seamlessly fallback to if the backend doesn't support them. + +You can view the black box functions defined in the ACVM code [here](https://github.com/noir-lang/acvm/blob/acir-v0.12.0/acir/src/circuit/black_box_functions.rs). diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives.md new file mode 100644 index 00000000000..2df4f929474 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives.md @@ -0,0 +1,14 @@ +--- +title: Cryptographic primitives in Noir +description: + Learn about the cryptographic primitives ready to use for any Noir project +keywords: + [ + cryptographic primitives, + Noir project, + ] +--- + +The Noir team is progressively adding new cryptographic primitives to the standard library. Reach out for news or if you would be interested in adding more of these calculations in Noir. + +Some methods are available thanks to the Aztec backend, not being performed using Noir. When using other backends, these methods may or may not be supplied. diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/00_hashes.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/00_hashes.mdx new file mode 100644 index 00000000000..31a84cdb753 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/00_hashes.mdx @@ -0,0 +1,146 @@ +--- +title: Hash methods +description: + Learn about the cryptographic primitives ready to use for any Noir project, including sha256, + blake2s, pedersen, mimc_bn254 and mimc +keywords: + [cryptographic primitives, Noir project, sha256, blake2s, pedersen, mimc_bn254, mimc, hash] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## sha256 + +Given an array of bytes, returns the resulting sha256 hash. + +```rust +fn sha256(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::sha256(x); +} +``` + + + +## blake2s + +Given an array of bytes, returns an array with the Blake2 hash + +```rust +fn blake2s(_input : [u8]) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::blake2s(x); +} +``` + + + +## pedersen + +Given an array of Fields, returns the Pedersen hash. + +```rust +fn pedersen(_input : [Field]) -> [Field; 2] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::pedersen(x); +} +``` + + + +## keccak256 + +Given an array of bytes (`u8`), returns the resulting keccak hash as an array of 32 bytes +(`[u8; 32]`). Specify a message_size to hash only the first `message_size` bytes +of the input. + +```rust +fn keccak256(_input : [u8; N], _message_size: u32) -> [u8; 32] +``` + +example: + +```rust +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let message_size = 4; + let hash = std::hash::keccak256(x, message_size); +} +``` + + + +## poseidon + +Given an array of Fields, returns a new Field with the Poseidon Hash. Mind that you need to specify +how many inputs are there to your Poseidon function. + +```rust +// example for hash_1, hash_2 accepts an array of length 2, etc +fn hash_1(input: [Field; 1]) -> Field +``` + +example: + +```rust +fn main() +{ + let hash1 = std::hash::poseidon::bn254::hash_2([1, 2]); + assert(hash1 == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a); +} +``` + +## mimc_bn254 and mimc + +`mimc_bn254` is `mimc`, but with hardcoded parameters for the BN254 curve. You can use it by +providing an array of Fields, and it returns a Field with the hash. You can use the `mimc` method if +you're willing to input your own constants: + +```rust +fn mimc(x: Field, k: Field, constants: [Field; N], exp : Field) -> Field +``` + +otherwise, use the `mimc_bn254` method: + +```rust +fn mimc_bn254(array: [Field; N]) -> Field +``` + +example: + +```rust + +fn main() { + let x = [163, 117, 178, 149] // some random bytes + let hash = std::hash::mimc_bn254(x); +} +``` + +## hash_to_field + +```rust +fn hash_to_field(_input : [Field; N]) -> Field {} +``` + +Calculates the `blake2s` hash of the inputs and returns the hash modulo the field modulus to return +a value which can be represented as a `Field`. + + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/01_scalar.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/01_scalar.mdx new file mode 100644 index 00000000000..62265cddb1e --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/01_scalar.mdx @@ -0,0 +1,33 @@ +--- +title: Scalar multiplication +description: + See how you can perform scalar multiplications over a fixed base in Noir +keywords: + [ + cryptographic primitives, + Noir project, + scalar multiplication, + ] +--- + +import BlackBoxInfo from './common/\_blackbox.mdx'; + +## scalar_mul::fixed_base + +Performs scalar multiplication over the embedded curve whose coordinates are defined by the +configured noir field. For the BN254 scalar field, this is BabyJubJub or Grumpkin. + +```rust +fn fixed_base(_input : Field) -> [Field; 2] +``` + +example + +```rust +fn main(x : Field) { + let scal = std::scalar_mul::fixed_base(x); + std::println(scal); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/02_schnorr.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/02_schnorr.mdx new file mode 100644 index 00000000000..0e219c0e5ff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/02_schnorr.mdx @@ -0,0 +1,37 @@ +--- +title: Schnorr Signatures +description: Learn how you can verify Schnorr signatures using Noir +keywords: [cryptographic primitives, Noir project, schnorr, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## schnorr::verify_signature + +Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin). + +```rust +fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> bool +``` + +where `_signature` can be generated like so using the npm package +[@noir-lang/barretenberg](https://www.npmjs.com/package/@noir-lang/barretenberg) + +```js +const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm'); +const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr'); + +... + +const barretenberg = await BarretenbergWasm.new(); +const schnorr = new Schnorr(barretenberg); +const pubKey = schnorr.computePublicKey(privateKey); +const message = ... +const signature = Array.from( + schnorr.constructSignature(hash, privateKey).toBuffer() +); + +... +``` + + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx new file mode 100644 index 00000000000..3934a0338d0 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/03_ecdsa_sig_verification.mdx @@ -0,0 +1,45 @@ +--- +title: ECDSA Signature Verification +description: Learn about the cryptographic primitives regarding ECDSA over the secp256k1 and secp256r1 curves +keywords: [cryptographic primitives, Noir project, ecdsa, secp256k1, secp256r1, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +Noir supports ECDSA signatures verification over the secp256k1 and secp256r1 curves. + +## ecdsa_secp256k1::verify_signature + +Verifier for ECDSA Secp256k1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + +## ecdsa_secp256r1::verify_signature + +Verifier for ECDSA Secp256r1 signatures + +```rust +fn verify_signature(_public_key_x : [u8; 32], _public_key_y : [u8; 32], _signature: [u8; 64], _message: [u8]) -> bool +``` + +example: + +```rust +fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} +``` + + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/04_ec_primitives.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/04_ec_primitives.md new file mode 100644 index 00000000000..6e6b19b6861 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/04_ec_primitives.md @@ -0,0 +1,101 @@ +--- +title: Elliptic Curve Primitives +keywords: [cryptographic primitives, Noir project] +--- + +Data structures and methods on them that allow you to carry out computations involving elliptic +curves over the (mathematical) field corresponding to `Field`. For the field currently at our +disposal, applications would involve a curve embedded in BN254, e.g. the +[Baby Jubjub curve](https://eips.ethereum.org/EIPS/eip-2494). + +## Data structures + +### Elliptic curve configurations + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Curve`), i.e. the specific elliptic +curve you want to use, which would be specified using any one of the methods +`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::new` which take the coefficients in the +defining equation together with a generator point as parameters. You can find more detail in the +comments in +[`noir_stdlib/src/ec.nr`](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr), but +the gist of it is that the elliptic curves of interest are usually expressed in one of the standard +forms implemented here (Twisted Edwards, Montgomery and Short Weierstraß), and in addition to that, +you could choose to use `affine` coordinates (Cartesian coordinates - the usual (x,y) - possibly +together with a point at infinity) or `curvegroup` coordinates (some form of projective coordinates +requiring more coordinates but allowing for more efficient implementations of elliptic curve +operations). Conversions between all of these forms are provided, and under the hood these +conversions are done whenever an operation is more efficient in a different representation (or a +mixed coordinate representation is employed). + +### Points + +(`std::ec::{tecurve,montcurve,swcurve}::{affine,curvegroup}::Point`), i.e. points lying on the +elliptic curve. For a curve configuration `c` and a point `p`, it may be checked that `p` +does indeed lie on `c` by calling `c.contains(p1)`. + +## Methods + +(given a choice of curve representation, e.g. use `std::ec::tecurve::affine::Curve` and use +`std::ec::tecurve::affine::Point`) + +- The **zero element** is given by `Point::zero()`, and we can verify whether a point `p: Point` is + zero by calling `p.is_zero()`. +- **Equality**: Points `p1: Point` and `p2: Point` may be checked for equality by calling + `p1.eq(p2)`. +- **Addition**: For `c: Curve` and points `p1: Point` and `p2: Point` on the curve, adding these two + points is accomplished by calling `c.add(p1,p2)`. +- **Negation**: For a point `p: Point`, `p.negate()` is its negation. +- **Subtraction**: For `c` and `p1`, `p2` as above, subtracting `p2` from `p1` is accomplished by + calling `c.subtract(p1,p2)`. +- **Scalar multiplication**: For `c` as above, `p: Point` a point on the curve and `n: Field`, + scalar multiplication is given by `c.mul(n,p)`. If instead `n :: [u1; N]`, i.e. `n` is a bit + array, the `bit_mul` method may be used instead: `c.bit_mul(n,p)` +- **Multi-scalar multiplication**: For `c` as above and arrays `n: [Field; N]` and `p: [Point; N]`, + multi-scalar multiplication is given by `c.msm(n,p)`. +- **Coordinate representation conversions**: The `into_group` method converts a point or curve + configuration in the affine representation to one in the CurveGroup representation, and + `into_affine` goes in the other direction. +- **Curve representation conversions**: `tecurve` and `montcurve` curves and points are equivalent + and may be converted between one another by calling `into_montcurve` or `into_tecurve` on their + configurations or points. `swcurve` is more general and a curve c of one of the other two types + may be converted to this representation by calling `c.into_swcurve()`, whereas a point `p` lying + on the curve given by `c` may be mapped to its corresponding `swcurve` point by calling + `c.map_into_swcurve(p)`. +- **Map-to-curve methods**: The Elligator 2 method of mapping a field element `n: Field` into a + `tecurve` or `montcurve` with configuration `c` may be called as `c.elligator2_map(n)`. For all of + the curve configurations, the SWU map-to-curve method may be called as `c.swu_map(z,n)`, where + `z: Field` depends on `Field` and `c` and must be chosen by the user (the conditions it needs to + satisfy are specified in the comments + [here](https://github.com/noir-lang/noir/blob/master/noir_stdlib/src/ec.nr)). + +## Examples + +The +[ec_baby_jubjub test](https://github.com/noir-lang/noir/blob/master/crates/nargo_cli/tests/test_data/ec_baby_jubjub/src/main.nr) +illustrates all of the above primitives on various forms of the Baby Jubjub curve. A couple of more +interesting examples in Noir would be: + +Public-key cryptography: Given an elliptic curve and a 'base point' on it, determine the public key +from the private key. This is a matter of using scalar multiplication. In the case of Baby Jubjub, +for example, this code would do: + +```rust +use dep::std::ec::tecurve::affine::{Curve, Point}; + +fn bjj_pub_key(priv_key: Field) -> Point +{ + + let bjj = Curve::new(168700, 168696, G::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905)); + + let base_pt = Point::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, 16950150798460657717958625567821834550301663161624707787222815936182638968203); + + bjj.mul(priv_key,base_pt) +} +``` + +This would come in handy in a Merkle proof. + +- EdDSA signature verification: This is a matter of combining these primitives with a suitable hash + function. See + [feat(stdlib): EdDSA sig verification noir#1136](https://github.com/noir-lang/noir/pull/1136) for + the case of Baby Jubjub and the Poseidon hash function. diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/05_eddsa.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/05_eddsa.mdx new file mode 100644 index 00000000000..8f060ed3316 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/05_eddsa.mdx @@ -0,0 +1,17 @@ +--- +title: EdDSA Verification +description: Learn about the cryptographic primitives regarding EdDSA +keywords: [cryptographic primitives, Noir project, eddsa, signatures] +--- + +import BlackBoxInfo from './common/_blackbox.mdx'; + +## eddsa::eddsa_poseidon_verify + +Verifier for EdDSA signatures + +```rust +fn eddsa_poseidon_verify(public_key_x : Field, public_key_y : Field, signature_s: Field, signature_r8_x: Field, signature_r8_y: Field, message: Field) -> bool +``` + + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/common/_blackbox.mdx b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/common/_blackbox.mdx new file mode 100644 index 00000000000..9fe9b48fbff --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/cryptographic_primitives/common/_blackbox.mdx @@ -0,0 +1,5 @@ +:::info + +This is a black box function. Read [this section](../black_box_fns) to learn more about black box functions in Noir. + +::: \ No newline at end of file diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/field_methods.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/field_methods.md new file mode 100644 index 00000000000..4d1cdc953e9 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/field_methods.md @@ -0,0 +1,149 @@ +--- +title: Field Methods +description: + Learn about common methods on Noir Field, including to_le_bits, to_le_bytes, to_le_radix, + to_be_radix, pow_32, etc, and see code examples. +keywords: + [ + Noir Field, + to_le_bits, + to_le_bytes, + to_le_radix, + to_be_radix, + pow_32, + Little Endian, + Big Endian, + Vector, + Exponent, + ] +--- + +After declaring a Field, you can use these common methods on it: + +## to_le_bits + +Transforms the field into an array of bits, Little Endian. + +```rust +fn to_le_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_le_bits(32); +} +``` + +## to_be_bits + +Transforms the field into an array of bits, Big Endian. + +```rust +fn to_be_bits(_x : Field, _bit_size: u32) -> [u1; N] +``` + +example: + +```rust +fn main() { + let field = 2 + let bits = field.to_be_bits(32); +} +``` + +## to_le_bytes + +Transforms into an array of bytes, Little Endian + +```rust +fn to_le_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_le_bytes(4); +} +``` + +## to_be_bytes + +Transforms into an array of bytes, Big Endian + +```rust +fn to_be_bytes(_x : Field, byte_size: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let bytes = field.to_be_bytes(4); +} +``` + +## to_le_radix + +Decomposes into a vector over the specified base, Little Endian + +```rust +fn to_le_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_le_radix(256, 4); +} +``` + +## to_be_radix + +Decomposes into a vector over the specified base, Big Endian + +```rust +fn to_be_radix(_x : Field, _radix: u32, _result_len: u32) -> [u8] +``` + +example: + +```rust +fn main() { + let field = 2 + let radix = field.to_be_radix(256, 4); +} +``` + +## pow_32 + +Returns the value to the power of the specified exponent + +```rust +fn pow_32(self, exponent: Field) -> Field +``` + +example: + +```rust +fn main() { + let field = 2 + let pow = field.pow_32(4); + assert(pow == 16); +} +``` + +## sgn0 + +Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + +```rust +fn sgn0(self) -> u1 +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/logging.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/logging.md new file mode 100644 index 00000000000..42a84be1992 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/logging.md @@ -0,0 +1,42 @@ +--- +title: Logging +description: + Learn how to use the println statement for debugging in Noir with this tutorial. Understand the + basics of logging in Noir and how to implement it in your code. +keywords: + [ + noir logging, + println statement, + debugging in noir, + noir std library, + logging tutorial, + basic logging in noir, + noir logging implementation, + noir debugging techniques, + rust, + ] +--- + +# Logging + +The standard library provides a familiar `println` statement you can use. Despite being a limited +implementation of rust's `println!` macro, this construct can be useful for debugging. + +The `println` statement is unconstrained, so it works for outputting integers, fields, strings, and even structs or expressions. For example: + +```rust +use dep::std; + +struct Person { + age : Field, + height : Field, +} + +fn main(age : Field, height : Field) { + let person = Person { age : age, height : height }; + std::println(person); + std::println(age + height); + std::println("Hello world!"); +} + +``` diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/merkle_trees.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/merkle_trees.md new file mode 100644 index 00000000000..57d8c4a9e4f --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/merkle_trees.md @@ -0,0 +1,58 @@ +--- +title: Merkle Trees +description: Learn about Merkle Trees in Noir with this tutorial. Explore the basics of computing a merkle root using a proof, with examples. +keywords: + [ + Merkle trees in Noir, + Noir programming language, + check membership, + computing root from leaf, + Noir Merkle tree implementation, + Merkle tree tutorial, + Merkle tree code examples, + Noir libraries, + pedersen hash., + ] +--- + +## compute_merkle_root + +Returns the root of the tree from the provided leaf and its hash path, using a [Pedersen hash](cryptographic_primitives/00_hashes.mdx#pedersen). + +```rust +fn compute_merkle_root(leaf : Field, index : Field, hash_path: [Field]) -> Field +``` + +example: + +```rust +/** + // these values are for this example only + index = "0" + priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" + secret = "0x1929ea3ab8d9106a899386883d9428f8256cfedb3c4f6b66bf4aa4d28a79988f" + note_hash_path = [ + "0x1e61bdae0f027b1b2159e1f9d3f8d00fa668a952dddd822fda80dc745d6f65cc", + "0x0e4223f3925f98934393c74975142bd73079ab0621f4ee133cee050a3c194f1a", + "0x2fd7bb412155bf8693a3bd2a3e7581a679c95c68a052f835dddca85fa1569a40" + ] + */ +fn main(index: Field, priv_key: Field, secret: Field, note_hash_path: [Field; 3]) { + + let pubkey = std::scalar_mul::fixed_base(priv_key); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + let note_commitment = std::hash::pedersen([pubkey_x, pubkey_y, secret]); + + let root = std::merkle::compute_merkle_root(note_commitment[0], index, note_hash_path); + std::println(root); +} +``` + +To check merkle tree membership: + +1. Include a merkle root as a program input. +2. Compute the merkle root of a given leaf, index and hash path. +3. Assert the merkle roots are equal. + +For more info about merkle trees, see the Wikipedia [page](https://en.wikipedia.org/wiki/Merkle_tree). diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/recursion.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/recursion.md new file mode 100644 index 00000000000..4705ae6c575 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/recursion.md @@ -0,0 +1,96 @@ +--- +title: Recursive Proofs +description: Learn about how to write recursive proofs in Noir. +keywords: [recursion, recursive proofs, verification_key, aggregation object, verify_proof] +--- + +Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof. + +The `verify_proof` function takes a verification key, proof and public inputs for a zk program, as well as a key hash and an input aggregation object. The key hash is used to check the validity of the verification key and the input aggregation object is required by some proving systems. The `verify_proof` function returns an output aggregation object that can then be fed into future iterations of the proof verification if required. + +```rust +#[foreign(verify_proof)] +fn verify_proof(_verification_key : [Field], _proof : [Field], _public_input : Field, _key_hash : Field, _input_aggregation_object : [Field]) -> [Field] {} +``` + +:::info + +This is a black box function. Read [this section](./black_box_fns) to learn more about black box functions in Noir. + +::: + +## Aggregation Object + +The purpose of the input aggregation object is a little less clear though (and the output aggregation object that is returned from the `std::verify_proof` method). Recursive zkSNARK schemes do not necessarily "verify a proof" in the sense that you expect a true or false to be spit out by the verifier. Rather an aggregation object is built over the public inputs. In the case of PLONK the recursive aggregation object is two G1 points (expressed as 16 witness values). The final verifier (in our case this is most often the smart contract verifier) has to be aware of this aggregation object to execute a pairing and check the validity of these points (thus completing the recursive verification). + +So for example in this circuit: + +```rust +use dep::std; + +fn main( + verification_key : [Field; 114], + proof : [Field; 94], + public_inputs : [Field; 1], + key_hash : Field, + input_aggregation_object : [Field; 16], + proof_b : [Field; 94], +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof( + verification_key, + proof, + public_inputs, + key_hash, + input_aggregation_object + ); + + let output_aggregation_object = std::verify_proof( + verification_key, + proof_b, + public_inputs, + key_hash, + output_aggregation_object_a + ); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} +``` + +In this example we have a circuit, that generates proofs A and B, that is being verified in circuit C. Assuming that the proof being passed in is not already a recursive proof, the `input_aggregation_object` will be all zeros. It will then generate an `output_aggregation_object`. This blob of data then becomes the `input_aggregation_object` of the next recursive aggregation we wish to compute. We can see here as the same public inputs, verification key, and key hash are used that we are verifying two proofs generated from the same circuit in this single circuit. `std::verify_proof` returns a `[Field]` because the size of an aggregation object is proof system dependent--in barretenberg, aggregation objects are two G1 points, while in Halo2, the aggregation object is a list of G1 points that is log the circuit size. So for the final step we convert the slice into an array of size 16 because we are generating proofs using UltraPlonk. + +## Parameters + +### `verification_key` + +The verification key for the zk program that is being verified. + +### `proof` + +The proof for the zk program that is being verified. + +### `public_inputs` + +These represent the public inputs of the proof we are verifying. They should be checked against in the circuit after construction of a new aggregation state. + +### `key_hash` + +A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator. + +### `input_aggregation_object` + +An aggregation object is blob of data that the top-level verifier must run some proof system specific algorithm on to complete verification. The size is proof system specific and will be set by the backend integrating this opcode. The input aggregation object is only not `None` when we are verifying a previous recursive aggregation in the current circuit. If this is the first recursive aggregation there is no input aggregation object. It is left to the backend to determine how to handle when there is no input aggregation object. + +## Return value + +### `output_aggregation_object` + +This is the result of a recursive aggregation and is what will be fed into the next verifier. +The next verifier can either perform a final verification (returning true or false) or perform another recursive aggregation where this output aggregation object will be the input aggregation object of the next recursive aggregation. + +## Example + +You can see an example of how to do recursive proofs in [this example recursion demo repo](https://github.com/Savio-Sou/recursion-demo/tree/main). diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/slice_methods.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/slice_methods.md new file mode 100644 index 00000000000..8b93d8ea427 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/slice_methods.md @@ -0,0 +1,279 @@ +--- +title: Slice Methods +description: + Learn about the commonly used methods available for slices in Noir, including push_back, len, srt, map, fold, reduce, all, and any. +keywords: [rust, slice, methods, push_back, len, sort, fold, reduce, all, any] +--- + +For convenience, the STD provides some ready-to-use, common methods for slices: + +## push_back + +Pushes a new element to the end of the slice, returning a new slice with a length one greater than the original unmodified slice. + +```rust +fn push_back(_self: [T], _elem: T) -> [T] +``` + +example: + +```rust +fn main() -> pub Field { + let mut slice: [Field] = [0; 2]; + + let mut new_slice = slice.push_back(6); + new_slice.len() +} +``` + +View the corresponding test file [here][test-file]. + +## push_front + +Returns a new array with the specified element inserted at index 0. The existing elements indexes are incremented by 1. + +```rust +fn push_front(_self: Self, _elem: T) -> Self +``` + +Example: + +```rust +let mut new_slice: [Field] = []; +new_slice = new_slice.push_front(20); +assert(new_slice[0] == 20); // returns true +``` + +View the corresponding test file [here][test-file]. + +## pop_front + +Returns a tuple of two items, the first element of the array and the rest of the array. + +```rust +fn pop_front(_self: Self) -> (T, Self) +``` + +Example: + +```rust +let (first_elem, rest_of_slice) = slice.pop_front(); +``` + +View the corresponding test file [here][test-file]. + +## pop_back + +Returns a tuple of two items, the beginning of the array with the last element omitted and the last element. + +```rust +fn pop_back(_self: Self) -> (Self, T) +``` + +Example: + +```rust +let (popped_slice, last_elem) = slice.pop_back(); +``` + +View the corresponding test file [here][test-file]. + +## insert + +Inserts an element at a specified index and shifts all following elements by 1. + +```rust +fn insert(_self: Self, _index: Field, _elem: T) -> Self +``` + +Example: + +```rust + new_slice = rest_of_slice.insert(2, 100); +assert(new_slice[2] == 100); +``` + +View the corresponding test file [here][test-file]. + +## remove + +Remove an element at a specified index, shifting all elements after it to the left, returning the altered slice and the removed element. + +```rust +fn remove(_self: Self, _index: Field) -> (Self, T) +``` + +Example: + +```rust +let (remove_slice, removed_elem) = slice.remove(3); +``` + +View the corresponding test file [here]([test-file]. + +## len + +Returns the length of a slice + +```rust +fn len(_slice: [T]) -> comptime Field +``` + +Example: + +```rust +fn main() { + let slic = [42, 42] + assert(slic.len() == 2); +} +``` + +## sort + +Returns a new sorted slice. The original slice remains untouched. Notice that this function will +only work for slices of fields or integers, not for any arbitrary type. This is because the sorting +logic the function uses internally is optimized specifically for these values. If you need a sort function to +sort any type, you should use the function `sort_via` described below. + +```rust +fn sort(_slice: [T]) -> [T] +``` + +Example: + +```rust +fn main() { + let slic = [42, 32] + let sorted = slic.sort(); + assert(sorted == [32, 42]); +} +``` + +## sort_via + +Sorts the slice with a custom comparison function + +```rust +fn sort_via(mut a: [T], ordering: fn(T, T) -> bool) -> [T] +``` + +Example: + +```rust +fn main() { + let slic = [42, 32] + let sorted_ascending = slic.sort_via(|a, b| a < b); + assert(sorted_ascending == [32, 42]); // verifies + + let sorted_descending = slic.sort_via(|a, b| a > b); + assert(sorted_descending == [32, 42]); // does not verify +} +``` + +## map + +Applies a function to each element of the slice, returning a new slice containing the mapped elements. + +```rust +fn map(f: fn(T) -> U) -> [U] +``` + +Example: + +```rust +let a = [1, 2, 3]; +let b = a.map(|a| a * 2) // b is now [2, 4, 6] +``` + +## fold + +Applies a function to each element of the slice, returning the final accumulated value. The first +parameter is the initial value. + +```rust +fn fold(mut accumulator: U, f: fn(U, T) -> U) -> U +``` + +This is a left fold, so the given function will be applied to the accumulator and first element of +the slice, then the second, and so on. For a given call the expected result would be equivalent to: + +```rust +let a1 = [1]; +let a2 = [1, 2]; +let a3 = [1, 2, 3]; + +let f = |a, b| a - b; +a1.fold(10, f) //=> f(10, 1) +a2.fold(10, f) //=> f(f(10, 1), 2) +a3.fold(10, f) //=> f(f(f(10, 1), 2), 3) +``` + +Example: + +```rust + +fn main() { + let slic = [2,2,2,2,2] + let folded = slic.fold(0, |a, b| a + b); + assert(folded == 10); +} + +``` + +## reduce + +Same as fold, but uses the first element as starting element. + +```rust +fn reduce(f: fn(T, T) -> T) -> T +``` + +Example: + +```rust +fn main() { + let slic = [2,2,2,2,2] + let reduced = slic.reduce(|a, b| a + b); + assert(reduced == 10); +} +``` + +## all + +Returns true if all the elements satisfy the given predicate + +```rust +fn all(predicate: fn(T) -> bool) -> bool +``` + +Example: + +```rust +fn main() { + let slic = [2,2,2,2,2] + let all = slic.all(|a| a == 2); + assert(all); +} +``` + +## any + +Returns true if any of the elements satisfy the given predicate + +```rust +fn any(predicate: fn(T) -> bool) -> bool +``` + +Example: + +```rust +fn main() { + let slic = [2,2,2,2,5] + let any = slic.any(|a| a == 5); + assert(any); +} + +``` + +[test-file]: https://github.com/noir-lang/noir/blob/f387ec1475129732f72ba294877efdf6857135ac/crates/nargo_cli/tests/test_data_ssa_refactor/slices/src/main.nr + diff --git a/noir/docs/versioned_docs/version-v0.9.0/standard_library/zeroed.md b/noir/docs/versioned_docs/version-v0.9.0/standard_library/zeroed.md new file mode 100644 index 00000000000..97dab02dac2 --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/standard_library/zeroed.md @@ -0,0 +1,25 @@ +--- +title: Zeroed Function +description: + The zeroed function returns a zeroed value of any type. +keywords: + [ + zeroed + ] +--- + +Implements `fn zeroed() -> T` to return a zeroed value of any type. This function is generally unsafe to use as the zeroed bit pattern is not guaranteed to be valid for all types. It can however, be useful in cases when the value is guaranteed not to be used such as in a BoundedVec library implementing a growable vector, up to a certain length, backed by an array. The array can be initialized with zeroed values which are guaranteed to be inaccessible until the vector is pushed to. Similarly, enumerations in noir can be implemented using this method by providing zeroed values for the unused variants. + +You can access the function at `std::unsafe::zeroed`. + +This function currently supports the following types: + +- Field +- Bool +- Uint +- Array +- String +- Tuple +- Function + +Using it on other types could result in unexpected behavior. diff --git a/noir/docs/versioned_docs/version-v0.9.0/typescript.md b/noir/docs/versioned_docs/version-v0.9.0/typescript.md new file mode 100644 index 00000000000..8608783784c --- /dev/null +++ b/noir/docs/versioned_docs/version-v0.9.0/typescript.md @@ -0,0 +1,243 @@ +--- +title: Working with TypeScript +description: + Learn how to interact with Noir programs using TypeScript. Follow this tutorial to compile your + program, specify inputs, initialize a prover & verifier, and prove and verify your program. +keywords: [TypeScript, Noir, tutorial, compile, inputs, prover, verifier, proof] +--- + +Interactions with Noir programs can also be performed in TypeScript, which can come in handy when +writing tests or when working in TypeScript-based projects like [Hardhat](https://hardhat.org/). + +You can check the complete code for this tutorial here: [browser with next.js](https://github.com/signorecello/noir-min-browser-example) and [node.js](https://github.com/signorecello/noir-min-nodejs-example). If you want just a browser boilerplate to start with, check out the [noir-starter](https://github.com/noir-lang/noir-starter) for an example implementation. + +:::note + +You may find unexpected errors working with some frameworks such as `vite`. This is due to the +nature of `wasm` files and the way Noir uses web workers. As we figure it out, we suggest using +[Create React App](https://create-react-app.dev/), or [Next.js](https://nextjs.org/) for a quick +start. + +::: + +## Setup + +Make sure you are using Noir version >= 0.10.1. + +You can check your current version by running `nargo --version`. + +You can install version 0.10.1 with noirup with + +```bash +noirup -v 0.10.1 +``` + +See the [Installation page](./getting_started/nargo_installation) for more info. + +We're assuming you're using ES6 and ESM for both browser (for example with React), or nodejs. Install [Node.js](https://nodejs.org/en). Init a new project with `npm init` and add `"type": "module"` to your `package.json`, to let `node` know we're using the new ESM sytem: + +```json +{ + "type": "module" + // the rest of your package.json +} +``` + +Install Noir dependencies in your project by running: + +```bash +npm i @aztec/bb.js@0.3.6 https://git@github.com/noir-lang/acvm-simulator-wasm.git#b9d9ca9dfc5140839f23998d9466307215607c42 fflate ethers@5.7.2 +``` + +This will install the `acvm-simulator` that will generate our witness, and the proving backend barretenberg `bb.js`. + +We're also installing `ethers` because we're too lazy to write a function that pads public inputs with 32bytes, and `fflate` to help us decompress our circuit bytecode. + +Since we're with typescript and using `nodejs` types, we also recommend to install the `@types/node` package, otherwise your IDE will scream at you. + +```bash +npm i --save-dev @types/node +``` + +:::note + +While Noir is in rapid development, some packages could interfere with others. For that reason, you +should use these specified versions. Let us know if for some reason you need to use other ones. + +::: + +As for the circuit, run `nargo init` to create a new Noir project. + +We will use a Standard Noir Example and place it in the `src` folder. This program simply multiplies input `x` with input `y` and returns the result `z`. The verifier doesn't know the value of `x`: we're proving that we know it without making it public. + +```rust +// src/main.nr +fn main(x: u32, y: pub u32) -> pub u32 { + let z = x * y; + z +} +``` + +One valid scenario for proving could be `x = 3`, `y = 4` and `return = 12` + +## Compiling + +In order to start proving, we need to compile our circuit into the intermediate representation used by our backend. As of today, you have to do that with `nargo`. Just hop to your circuits folder and run `nargo compile`. + +:::info + +At this time, you need to use a nightly version of nargo. Using [noirup](./getting_started/00_nargo_installation.md#option-1-noirup) you can do this simply by running `noirup -n`. + +::: + +You should have a `json` file in `target/` with your circuit's bytecode. The json file is name based on the project name specified in Nargo.toml, so for a project named "test", it will be at `target/test.json`. You can then import that file normally. + +```ts +import circuit from '../target/test.json' assert { type: 'json' }; +``` + +## Decompressing the circuit + +The compiled circuit comes compressed. We need to decompress it, that's where `fflate` comes in. + +```ts +import { decompressSync } from 'fflate'; + +const acirBuffer = Buffer.from(circuit.bytecode, 'base64'); +const acirBufferUncompressed = decompressSync(acirBuffer); +``` + +From here, it's highly recommended you store `acirBuffer` and `acirBufferUncompressed` close by, as they will be used for witness generation and proving. + +## Initializing ACVM and BB.JS + +:::note + +This step will eventually be abstracted away as Noir tooling matures. For now, you should be fine just literally copy-pasting most of this into your own code. + +::: + +Before proving, `bb.js` needs to be initialized. We need to import some functions and use them + +```ts +import { Crs, newBarretenbergApiAsync, RawBuffer } from '@aztec/bb.js/dest/node/index.js'; + +const api = await newBarretenbergApiAsync(4); + +const [exact, circuitSize, subgroup] = await api.acirGetCircuitSizes(acirBufferUncompressed); +const subgroupSize = Math.pow(2, Math.ceil(Math.log2(circuitSize))); +const crs = await Crs.new(subgroupSize + 1); +await api.commonInitSlabAllocator(subgroupSize); +await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data())); + +const acirComposer = await api.acirNewAcirComposer(subgroupSize); +``` + +We should take two very useful objects from here: `api` and `acirComposer`. Make sure to keep these close by! + +:::info + +On the browser, you also need to init the ACVM. You can do that by importing it and calling it like: + +```ts +import initACVM, { executeCircuit, compressWitness } from '@noir-lang/acvm_js'; + +await initACVM(); +// the rest of your code +``` + +::: + +## Generating witnesses + +Witness generation is what allows us to prove with arbitrary inputs (like user inputs on a form, game, etc). In this example, our input is a simple object with our circuit inputs `x`, `y`, and return `z` (fun fact: the return value in Noir is actually a public input!). We're wrapping it in a function, so it can be conveniently called later on. + +```ts +import { ethers } from 'ethers'; // I'm lazy so I'm using ethers to pad my input +import { executeCircuit, compressWitness } from '@noir-lang/acvm_js'; + +async function generateWitness(input: any, acirBuffer: Buffer): Promise { + const initialWitness = new Map(); + initialWitness.set(1, ethers.utils.hexZeroPad(`0x${input.x.toString(16)}`, 32)); + initialWitness.set(2, ethers.utils.hexZeroPad(`0x${input.y.toString(16)}`, 32)); + + const witnessMap = await executeCircuit(acirBuffer, initialWitness, () => { + throw Error('unexpected oracle'); + }); + + const witnessBuff = compressWitness(witnessMap); + return witnessBuff; +} +``` + +## Proving + +Finally, we're ready to prove with our backend. Just like with the witness generation, could be useful to wrap it in its own function: + +```ts +async function generateProof(witness: Uint8Array) { + const proof = await api.acirCreateProof( + acirComposer, + acirBufferUncompressed, + decompressSync(witness), + false, + ); + return proof; +} +``` + +## Verifying + +Our backend should also be ready to verify our proof: + +```ts +async function verifyProof(proof: Uint8Array) { + await api.acirInitProvingKey(acirComposer, acirBufferUncompressed); + const verified = await api.acirVerifyProof(acirComposer, proof, false); + return verified; +} +``` + +## Now for the fun part + +Let's call our functions, and destroy our API! + +```ts +const input = { x: 3, y: 4 }; +const witness = await generateWitness(input, acirBuffer); +console.log('Witness generated!'); +const proof = await generateProof(witness); +console.log('Proof generated!'); +await verifyProof(proof); +console.log('Proof verified!'); +api.destroy(); +``` + +You can use [this](https://gist.github.com/critesjosh/6f3ba19fdc9298b24e90ba4f736247dc) tsconfig.json. You can see the script [here](https://gist.github.com/critesjosh/4aa36e87a0cc3f09feaf1febb4d11348). + +## Verifying with Smart Contract + +Alternatively, a verifier smart contract can be generated and used for verifying Noir proofs in +TypeScript as well. + +This could be useful if the Noir program is designed to be decentrally verified and/or make use of +decentralized states and logics that is handled at the smart contract level. + +This assumes you've already ran `nargo codegen-verifier`, got your smart contract, and deployed it with Hardhat, Foundry, or your tool of choice. You can then verify a Noir proof by simply calling it. + +Currently, `bb.js` appends the public inputs to the proof. However, these inputs need to be fed separately to the verifier contract. A simple solution is to just slice them from the resulting proof, like this: + +```ts +import { ethers } from 'ethers'; // example using ethers v5 +import artifacts from '../artifacts/circuits/contract/plonk_vk.sol/UltraVerifier.json'; // I compiled using Hardhat, so I'm getting my abi from here + +const verifierAddress = '0x123455'; // your verifier address +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = this.provider.getSigner(); + +const contract = new ethers.Contract(verifierAddress, artifacts.abi, signer); + +const publicInputs = proof.slice(0, 32); +const slicedProof = proof.slice(32); +await contract.verify(slicedProof, [publicInputs]); +``` diff --git a/noir/docs/versioned_sidebars/version-v0.10.5-sidebars.json b/noir/docs/versioned_sidebars/version-v0.10.5-sidebars.json new file mode 100644 index 00000000000..a51ebf87643 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.10.5-sidebars.json @@ -0,0 +1,111 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "category", + "label": "Data Types", + "link": { + "type": "doc", + "id": "language_concepts/data_types" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts/data_types" + } + ] + }, + "language_concepts/functions", + "language_concepts/control_flow", + "language_concepts/ops", + "language_concepts/assert", + "language_concepts/unconstrained", + "language_concepts/generics", + "language_concepts/mutability", + "language_concepts/lambdas", + "language_concepts/comments", + "language_concepts/distinct", + "language_concepts/shadowing" + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/recursion", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns", + "standard_library/options" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "doc", + "id": "typescript", + "label": "Working with Typescript" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.17.0-sidebars.json b/noir/docs/versioned_sidebars/version-v0.17.0-sidebars.json new file mode 100644 index 00000000000..a9ec39925d9 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.17.0-sidebars.json @@ -0,0 +1,141 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "category", + "label": "Data Types", + "link": { + "type": "doc", + "id": "language_concepts/data_types" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts/data_types" + } + ] + }, + "language_concepts/functions", + "language_concepts/control_flow", + "language_concepts/ops", + "language_concepts/assert", + "language_concepts/unconstrained", + "language_concepts/generics", + "language_concepts/mutability", + "language_concepts/lambdas", + "language_concepts/comments", + "language_concepts/distinct", + "language_concepts/shadowing" + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/recursion", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns", + "standard_library/options" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "category", + "label": "NoirJS", + "link": { + "type": "doc", + "id": "noir_js/noir_js" + }, + "items": [ + { + "type": "category", + "label": "Guides", + "items": [ + { + "type": "autogenerated", + "dirName": "noir_js/getting_started" + } + ] + }, + { + "type": "category", + "label": "Reference", + "items": [ + { + "type": "autogenerated", + "dirName": "noir_js/reference" + } + ] + } + ] + }, + { + "type": "doc", + "id": "migration_notes", + "label": "Migration notes" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.19.1-sidebars.json b/noir/docs/versioned_sidebars/version-v0.19.1-sidebars.json new file mode 100644 index 00000000000..6823055c5d3 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.19.1-sidebars.json @@ -0,0 +1,288 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "category", + "label": "Data Types", + "link": { + "type": "doc", + "id": "language_concepts/data_types" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts/data_types" + } + ] + }, + "language_concepts/functions", + "language_concepts/control_flow", + "language_concepts/ops", + "language_concepts/assert", + "language_concepts/unconstrained", + "language_concepts/generics", + "language_concepts/mutability", + "language_concepts/lambdas", + "language_concepts/comments", + "language_concepts/distinct", + "language_concepts/shadowing" + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/recursion", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns", + "standard_library/options" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "category", + "label": "NoirJS", + "link": { + "type": "doc", + "id": "noir_js/noir_js" + }, + "items": [ + { + "type": "category", + "label": "Guides", + "items": [ + { + "type": "autogenerated", + "dirName": "noir_js/getting_started" + } + ] + }, + { + "type": "category", + "label": "Reference", + "items": [ + { + "type": "category", + "label": "Noir JS", + "link": { + "type": "doc", + "id": "noir_js/reference/noir_js/index" + }, + "items": [ + { + "type": "category", + "label": "Classes", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/classes/Noir", + "label": "Noir" + } + ] + }, + { + "type": "category", + "label": "Type Aliases", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/CompiledCircuit", + "label": "CompiledCircuit" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallHandler", + "label": "ForeignCallHandler" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallInput", + "label": "ForeignCallInput" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallOutput", + "label": "ForeignCallOutput" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ProofData", + "label": "ProofData" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/WitnessMap", + "label": "WitnessMap" + } + ] + }, + { + "type": "category", + "label": "Functions", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/and", + "label": "and" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/blake2s256", + "label": "blake2s256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify", + "label": "ecdsa_secp256k1_verify" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify", + "label": "ecdsa_secp256r1_verify" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/keccak256", + "label": "keccak256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/sha256", + "label": "sha256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/xor", + "label": "xor" + } + ] + } + ] + }, + { + "type": "category", + "label": "Backend Barretenberg", + "link": { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/index" + }, + "items": [ + { + "type": "category", + "label": "Classes", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/classes/BarretenbergBackend", + "label": "BarretenbergBackend" + } + ] + }, + { + "type": "category", + "label": "Interfaces", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/interfaces/Backend", + "label": "Backend" + } + ] + }, + { + "type": "category", + "label": "Type Aliases", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/BackendOptions", + "label": "BackendOptions" + }, + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit", + "label": "CompiledCircuit" + }, + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/ProofData", + "label": "ProofData" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "doc", + "id": "migration_notes", + "label": "Migration notes" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.19.2-sidebars.json b/noir/docs/versioned_sidebars/version-v0.19.2-sidebars.json new file mode 100644 index 00000000000..6823055c5d3 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.19.2-sidebars.json @@ -0,0 +1,288 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "category", + "label": "Data Types", + "link": { + "type": "doc", + "id": "language_concepts/data_types" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts/data_types" + } + ] + }, + "language_concepts/functions", + "language_concepts/control_flow", + "language_concepts/ops", + "language_concepts/assert", + "language_concepts/unconstrained", + "language_concepts/generics", + "language_concepts/mutability", + "language_concepts/lambdas", + "language_concepts/comments", + "language_concepts/distinct", + "language_concepts/shadowing" + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/recursion", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns", + "standard_library/options" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "category", + "label": "NoirJS", + "link": { + "type": "doc", + "id": "noir_js/noir_js" + }, + "items": [ + { + "type": "category", + "label": "Guides", + "items": [ + { + "type": "autogenerated", + "dirName": "noir_js/getting_started" + } + ] + }, + { + "type": "category", + "label": "Reference", + "items": [ + { + "type": "category", + "label": "Noir JS", + "link": { + "type": "doc", + "id": "noir_js/reference/noir_js/index" + }, + "items": [ + { + "type": "category", + "label": "Classes", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/classes/Noir", + "label": "Noir" + } + ] + }, + { + "type": "category", + "label": "Type Aliases", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/CompiledCircuit", + "label": "CompiledCircuit" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallHandler", + "label": "ForeignCallHandler" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallInput", + "label": "ForeignCallInput" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ForeignCallOutput", + "label": "ForeignCallOutput" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/ProofData", + "label": "ProofData" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/type-aliases/WitnessMap", + "label": "WitnessMap" + } + ] + }, + { + "type": "category", + "label": "Functions", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/and", + "label": "and" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/blake2s256", + "label": "blake2s256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/ecdsa_secp256k1_verify", + "label": "ecdsa_secp256k1_verify" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/ecdsa_secp256r1_verify", + "label": "ecdsa_secp256r1_verify" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/keccak256", + "label": "keccak256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/sha256", + "label": "sha256" + }, + { + "type": "doc", + "id": "noir_js/reference/noir_js/functions/xor", + "label": "xor" + } + ] + } + ] + }, + { + "type": "category", + "label": "Backend Barretenberg", + "link": { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/index" + }, + "items": [ + { + "type": "category", + "label": "Classes", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/classes/BarretenbergBackend", + "label": "BarretenbergBackend" + } + ] + }, + { + "type": "category", + "label": "Interfaces", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/interfaces/Backend", + "label": "Backend" + } + ] + }, + { + "type": "category", + "label": "Type Aliases", + "items": [ + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/BackendOptions", + "label": "BackendOptions" + }, + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/CompiledCircuit", + "label": "CompiledCircuit" + }, + { + "type": "doc", + "id": "noir_js/reference/backend_barretenberg/type-aliases/ProofData", + "label": "ProofData" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "doc", + "id": "migration_notes", + "label": "Migration notes" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.6.0-sidebars.json b/noir/docs/versioned_sidebars/version-v0.6.0-sidebars.json new file mode 100644 index 00000000000..7323ae1c504 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.6.0-sidebars.json @@ -0,0 +1,90 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts" + } + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/array_methods", + "standard_library/field_methods", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "doc", + "id": "typescript", + "label": "Working with Typescript" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.7.1-sidebars.json b/noir/docs/versioned_sidebars/version-v0.7.1-sidebars.json new file mode 100644 index 00000000000..7323ae1c504 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.7.1-sidebars.json @@ -0,0 +1,90 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts" + } + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/array_methods", + "standard_library/field_methods", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "doc", + "id": "typescript", + "label": "Working with Typescript" + } + ] +} diff --git a/noir/docs/versioned_sidebars/version-v0.9.0-sidebars.json b/noir/docs/versioned_sidebars/version-v0.9.0-sidebars.json new file mode 100644 index 00000000000..190363917e0 --- /dev/null +++ b/noir/docs/versioned_sidebars/version-v0.9.0-sidebars.json @@ -0,0 +1,91 @@ +{ + "sidebar": [ + { + "type": "doc", + "id": "index", + "label": "Noir" + }, + { + "type": "category", + "label": "Getting Started", + "items": [ + { + "type": "autogenerated", + "dirName": "getting_started" + } + ] + }, + { + "type": "category", + "label": "Examples", + "items": [ + { + "type": "autogenerated", + "dirName": "examples" + } + ] + }, + { + "type": "category", + "label": "Nargo", + "items": [ + { + "type": "autogenerated", + "dirName": "nargo" + } + ] + }, + { + "type": "category", + "label": "Language Concepts", + "items": [ + { + "type": "autogenerated", + "dirName": "language_concepts" + } + ] + }, + { + "type": "category", + "label": "Noir Standard Library", + "items": [ + { + "type": "category", + "label": "Cryptographic Primitives", + "link": { + "type": "doc", + "id": "standard_library/cryptographic_primitives" + }, + "items": [ + { + "type": "autogenerated", + "dirName": "standard_library/cryptographic_primitives" + } + ] + }, + "standard_library/slice_methods", + "standard_library/field_methods", + "standard_library/recursion", + "standard_library/logging", + "standard_library/merkle_trees", + "standard_library/zeroed", + "standard_library/black_box_fns" + ] + }, + { + "type": "category", + "label": "Modules, Packages and Crates", + "items": [ + { + "type": "autogenerated", + "dirName": "modules_packages_crates" + } + ] + }, + { + "type": "doc", + "id": "typescript", + "label": "Working with Typescript" + } + ] +} diff --git a/noir/docs/versions.json b/noir/docs/versions.json new file mode 100644 index 00000000000..ebd565cb0ae --- /dev/null +++ b/noir/docs/versions.json @@ -0,0 +1,5 @@ +[ + "v0.19.2", + "v0.17.0", + "v0.10.5" +] diff --git a/noir/flake.lock b/noir/flake.lock new file mode 100644 index 00000000000..5a9f9470a1f --- /dev/null +++ b/noir/flake.lock @@ -0,0 +1,170 @@ +{ + "nodes": { + "crane": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1681177078, + "narHash": "sha256-ZNIjBDou2GOabcpctiQykEQVkI8BDwk7TyvlWlI4myE=", + "owner": "ipetkov", + "repo": "crane", + "rev": "0c9f468ff00576577d83f5019a66c557ede5acf6", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1694499657, + "narHash": "sha256-u/fZtLtN7VcDrMMVrdsFy93PEkaiK+tNpJT9on4SGdU=", + "owner": "nix-community", + "repo": "fenix", + "rev": "2895ff377cbb3cb6f5dd92066734b0447cb04e20", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1695559356, + "narHash": "sha256-kXZ1pUoImD9OEbPCwpTz4tHsNTr4CIyIfXb3ocuR8sI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "261abe8a44a7e8392598d038d2e01f7b33cf26d0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "fenix": "fenix", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1694421477, + "narHash": "sha256-df6YZzR57VFzkOPwIohJfC0fRwgq6yUPbMJkKAtQyAE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "cc6c8209cbaf7df55013977cf5cc8488d6b7ff1c", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "crane", + "flake-utils" + ], + "nixpkgs": [ + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694484610, + "narHash": "sha256-aeSDkp7fkAqtVjW3QUn7vq7BKNlFul/BiGgdv7rK+mA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "c5b977a7e6a295697fa1f9c42174fd6313b38df4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/noir/flake.nix b/noir/flake.nix new file mode 100644 index 00000000000..0091a49f240 --- /dev/null +++ b/noir/flake.nix @@ -0,0 +1,285 @@ +{ + description = "Build the Noir programming language"; + + # All of these inputs (a.k.a. dependencies) need to align with inputs we + # use so they use the `inputs.*.follows` syntax to reference our inputs + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixos-23.05"; + }; + + flake-utils = { + url = "github:numtide/flake-utils"; + }; + + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + + fenix = { + url = "github:nix-community/fenix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + + crane = { + url = "github:ipetkov/crane"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + flake-compat.follows = "flake-compat"; + }; + }; + }; + + outputs = + { self, nixpkgs, crane, flake-utils, fenix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + + rustToolchain = fenix.packages.${system}.fromToolchainFile { + file = ./rust-toolchain.toml; + sha256 = "sha256-R0F0Risbr74xg9mEYydyebx/z0Wu6HI0/KWwrV30vZo="; + }; + + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + + # The `self.rev` property is only available when the working tree is not dirty + GIT_COMMIT = if (self ? rev) then self.rev else "unknown"; + GIT_DIRTY = if (self ? rev) then "false" else "true"; + + extraBuildInputs = [ ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ + # Need libiconv and apple Security on Darwin. See https://github.com/ipetkov/crane/issues/156 + pkgs.libiconv + pkgs.darwin.apple_sdk.frameworks.Security + ]; + + environment = { + # We enable backtraces on any failure for help with debugging + RUST_BACKTRACE = "1"; + + # We download the Wasm version of `acvm_backend` in the barretenberg releases for the ACVM `blackbox_solver` + BARRETENBERG_ARCHIVE = pkgs.fetchurl { + url = "https://github.com/AztecProtocol/barretenberg/releases/download/barretenberg-v0.4.5/acvm_backend.wasm.tar.gz"; + sha256 = "sha256-xONt5pTKWf/YbVnX/NXl/VNBbtKd+CP7CLkB1jf0RHw="; + }; + }; + + # Configuration shared between builds + config = { + # x-release-please-start-version + version = "0.19.2"; + # x-release-please-end + + src = pkgs.lib.cleanSourceWith { + src = craneLib.path ./.; + # Custom filter with various file extensions that we rely upon to build packages + # Currently: `.nr`, `.sol`, `.sh`, `.json`, `.md` and `.wasm` + filter = path: type: + (builtins.match ".*\.(nr|sol|sh|json|md|wasm)$" path != null) || (craneLib.filterCargoSources path type); + }; + + # TODO(#1198): It'd be nice to include these flags when running `cargo clippy` in a devShell. + cargoClippyExtraArgs = "--all-targets -- -D warnings"; + + # TODO(#1198): It'd be nice to include this flag when running `cargo test` in a devShell. + cargoTestExtraArgs = "--workspace"; + }; + + # Combine the environment and other configuration needed for Crane to build our Rust packages + nativeConfig = environment // config // { + nativeBuildInputs = [ ]; + + buildInputs = [ ] ++ extraBuildInputs; + }; + + # Combine the environmnet and other configuration needed for Crane to build our Wasm packages + wasmConfig = environment // config // { + CARGO_TARGET_DIR = "./target"; + + nativeBuildInputs = with pkgs; [ + which + git + jq + rustToolchain + wasm-bindgen-cli + binaryen + ]; + + buildInputs = [ ] ++ extraBuildInputs; + }; + + # Build *just* the cargo dependencies, so we can reuse all of that work between runs + native-cargo-artifacts = craneLib.buildDepsOnly (nativeConfig // { + pname = "nargo"; + }); + noir-wasm-cargo-artifacts = craneLib.buildDepsOnly (wasmConfig // { + pname = "noir_wasm"; + }); + noirc-abi-wasm-cargo-artifacts = craneLib.buildDepsOnly (wasmConfig // { + pname = "noirc_abi_wasm"; + }); + acvm-js-cargo-artifacts = craneLib.buildDepsOnly (wasmConfig // { + pname = "acvm_js"; + }); + + nargo = craneLib.buildPackage (nativeConfig // { + pname = "nargo"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = native-cargo-artifacts; + + # We don't want to run tests because they don't work in the Nix sandbox + doCheck = false; + }); + + noir_wasm = craneLib.buildPackage (wasmConfig // { + pname = "noir_wasm"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = noir-wasm-cargo-artifacts; + + buildPhaseCargoCommand = '' + bash compiler/wasm/buildPhaseCargoCommand.sh release + ''; + + installPhase = '' + bash compiler/wasm/installPhase.sh + ''; + + # We don't want to run tests because they don't work in the Nix sandbox + doCheck = false; + }); + + noirc_abi_wasm = craneLib.buildPackage (wasmConfig // rec { + pname = "noirc_abi_wasm"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = noirc-abi-wasm-cargo-artifacts; + + cargoExtraArgs = "--package ${pname} --target wasm32-unknown-unknown"; + + buildPhaseCargoCommand = '' + bash tooling/noirc_abi_wasm/buildPhaseCargoCommand.sh release + ''; + + installPhase = '' + bash tooling/noirc_abi_wasm/installPhase.sh + ''; + + # We don't want to run tests because they don't work in the Nix sandbox + doCheck = false; + }); + + acvm_js = craneLib.buildPackage (wasmConfig // rec { + pname = "acvm_js"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = acvm-js-cargo-artifacts; + + cargoExtraArgs = "--package ${pname} --target wasm32-unknown-unknown"; + + buildPhaseCargoCommand = '' + bash acvm-repo/acvm_js/buildPhaseCargoCommand.sh release + ''; + + installPhase = '' + bash acvm-repo/acvm_js/installPhase.sh + ''; + + # We don't want to run tests because they don't work in the Nix sandbox + doCheck = false; + }); + + wasm-bindgen-cli = pkgs.callPackage ./wasm-bindgen-cli.nix { + rustPlatform = pkgs.makeRustPlatform { + rustc = rustToolchain; + cargo = rustToolchain; + }; + }; + in + { + # We use `checks` to run `cargo clippy` and `cargo fmt` since we disable checks in the primary derivations + checks = { + cargo-clippy = craneLib.cargoClippy (nativeConfig // { + pname = "noir"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = native-cargo-artifacts; + }); + + cargo-fmt = craneLib.cargoFmt (nativeConfig // { + pname = "noir"; + + inherit GIT_COMMIT GIT_DIRTY; + + cargoArtifacts = native-cargo-artifacts; + }); + }; + + packages = { + default = nargo; + + # Nix flakes cannot build more than one derivation in one command (see https://github.com/NixOS/nix/issues/5591) + # so we use `symlinkJoin` to build everything as the "all" package. + all = pkgs.symlinkJoin { name = "all"; paths = [ nargo noir_wasm noirc_abi_wasm acvm_js ]; }; + all_wasm = pkgs.symlinkJoin { name = "all_wasm"; paths = [ noir_wasm noirc_abi_wasm acvm_js ]; }; + + # We also export individual packages to enable `nix build .#nargo -L`, etc. + inherit nargo; + inherit noir_wasm; + inherit noirc_abi_wasm; + inherit acvm_js; + + # We expose the `*-cargo-artifacts` derivations so we can cache our cargo dependencies in CI + inherit native-cargo-artifacts; + inherit noir-wasm-cargo-artifacts; + inherit noirc-abi-wasm-cargo-artifacts; + inherit acvm-js-cargo-artifacts; + }; + + # Setup the environment to match the environment settings, the inputs from our checks derivations, + # and extra tooling via `nativeBuildInputs` + devShells.default = pkgs.mkShell (environment // { + inputsFrom = [ + nargo + noir_wasm + noirc_abi_wasm + acvm_js + ]; + + # Additional tools that weren't included as `nativeBuildInputs` of any of the derivations in `inputsFrom` + nativeBuildInputs = with pkgs; [ + # Rust toolchain + rustToolchain + # Other tools + starship + yarn + nodejs-18_x + # Used by the `bb` binary + curl + gzip + # This ensures the right lldb is in the environment for running rust-lldb + llvmPackages.lldb + # Nix tools + nil + nixpkgs-fmt + ]; + + shellHook = '' + eval "$(starship init bash)" + ''; + }); + }); +} + diff --git a/noir/noir_stdlib/Nargo.toml b/noir/noir_stdlib/Nargo.toml new file mode 100644 index 00000000000..d2f8ebcb636 --- /dev/null +++ b/noir/noir_stdlib/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "std" +type = "lib" +authors = [""] +[dependencies] diff --git a/noir/noir_stdlib/src/array.nr b/noir/noir_stdlib/src/array.nr new file mode 100644 index 00000000000..bcdf56dd7aa --- /dev/null +++ b/noir/noir_stdlib/src/array.nr @@ -0,0 +1,85 @@ + +// TODO: Once we fully move to the new SSA pass this module can be removed and replaced +// by the methods in the `slice` module +impl [T; N] { + #[builtin(array_len)] + pub fn len(_self: Self) -> Field {} + + #[builtin(arraysort)] + pub fn sort(_self: Self) -> Self {} + + // Sort with a custom sorting function. + pub fn sort_via(mut a: Self, ordering: fn[Env](T, T) -> bool) -> Self { + for i in 1 .. a.len() { + for j in 0..i { + if ordering(a[i], a[j]) { + let old_a_j = a[j]; + a[j] = a[i]; + a[i] = old_a_j; + } + } + } + a + } + + // Converts an array into a slice. + pub fn as_slice(self) -> [T] { + let mut slice = []; + for elem in self { + slice = slice.push_back(elem); + } + slice + } + + // Apply a function to each element of an array, returning a new array + // containing the mapped elements. + pub fn map(self, f: fn[Env](T) -> U) -> [U; N] { + let first_elem = f(self[0]); + let mut ret = [first_elem; N]; + + for i in 1 .. self.len() { + ret[i] = f(self[i]); + } + + ret + } + + // Apply a function to each element of the array and an accumulator value, + // returning the final accumulated value. This function is also sometimes + // called `foldl`, `fold_left`, `reduce`, or `inject`. + pub fn fold(self, mut accumulator: U, f: fn[Env](U, T) -> U) -> U { + for elem in self { + accumulator = f(accumulator, elem); + } + accumulator + } + + // Apply a function to each element of the array and an accumulator value, + // returning the final accumulated value. Unlike fold, reduce uses the first + // element of the given array as its starting accumulator value. + pub fn reduce(self, f: fn[Env](T, T) -> T) -> T { + let mut accumulator = self[0]; + for i in 1 .. self.len() { + accumulator = f(accumulator, self[i]); + } + accumulator + } + + // Returns true if all elements in the array satisfy the predicate + pub fn all(self, predicate: fn[Env](T) -> bool) -> bool { + let mut ret = true; + for elem in self { + ret &= predicate(elem); + } + ret + } + + // Returns true if any element in the array satisfies the predicate + pub fn any(self, predicate: fn[Env](T) -> bool) -> bool { + let mut ret = false; + for elem in self { + ret |= predicate(elem); + } + ret + } +} diff --git a/noir/noir_stdlib/src/collections.nr b/noir/noir_stdlib/src/collections.nr new file mode 100644 index 00000000000..e06c662e658 --- /dev/null +++ b/noir/noir_stdlib/src/collections.nr @@ -0,0 +1 @@ +mod vec; diff --git a/noir/noir_stdlib/src/collections/vec.nr b/noir/noir_stdlib/src/collections/vec.nr new file mode 100644 index 00000000000..43d68e1d1e7 --- /dev/null +++ b/noir/noir_stdlib/src/collections/vec.nr @@ -0,0 +1,59 @@ +struct Vec { + slice: [T] +} +// A mutable vector type implemented as a wrapper around immutable slices. +// A separate type is technically not needed but helps differentiate which operations are mutable. +impl Vec { + pub fn new() -> Self { + Self { slice: [] } + } + + // Create a Vec containing each element from the given slice. + // Mutations to the resulting Vec will not affect the original slice. + pub fn from_slice(slice: [T]) -> Self { + Self { slice } + } + + /// Get an element from the vector at the given index. + /// Panics if the given index + /// points beyond the end of the vector. + pub fn get(self, index: Field) -> T { + self.slice[index] + } + + /// Push a new element to the end of the vector, returning a + /// new vector with a length one greater than the + /// original unmodified vector. + pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); + } + + /// Pop an element from the end of the given vector, returning + /// a new vector with a length of one less than the given vector, + /// as well as the popped element. + /// Panics if the given vector's length is zero. + pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem + } + + /// Insert an element at a specified index, shifting all elements + /// after it to the right + pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); + } + + /// Remove an element at a specified index, shifting all elements + /// after it to the left, returning the removed element + pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem + } + + /// Returns the number of elements in the vector + pub fn len(self) -> Field { + self.slice.len() + } +} diff --git a/noir/noir_stdlib/src/compat.nr b/noir/noir_stdlib/src/compat.nr new file mode 100644 index 00000000000..5d80c422c33 --- /dev/null +++ b/noir/noir_stdlib/src/compat.nr @@ -0,0 +1,4 @@ +pub fn is_bn254() -> bool { + // bn254 truncates its curve order to 0 + 21888242871839275222246405745257275088548364400416034343698204186575808495617 == 0 +} diff --git a/noir/noir_stdlib/src/ec.nr b/noir/noir_stdlib/src/ec.nr new file mode 100644 index 00000000000..86fb201408f --- /dev/null +++ b/noir/noir_stdlib/src/ec.nr @@ -0,0 +1,198 @@ +// Elliptic curve implementation +// Overview +// ======== +// The following three elliptic curve representations are admissible: +mod tecurve; // Twisted Edwards curves +mod swcurve; // Elliptic curves in Short Weierstraß form +mod montcurve; // Montgomery curves +mod consts; // Commonly used curve presets +// +// Note that Twisted Edwards and Montgomery curves are (birationally) equivalent, so that +// they may be freely converted between one another, whereas Short Weierstraß curves are +// more general. Diagramatically: +// +// tecurve == montcurve ⊂ swcurve +// +// Each module is further divided into two submodules, 'affine' and 'curvegroup', depending +// on the preferred coordinate representation. Affine coordinates are none other than the usual +// two-dimensional Cartesian coordinates used in the definitions of these curves, whereas +// 'CurveGroup' coordinates (terminology borrowed from Arkworks, whose conventions we try +// to follow) are special coordinate systems with respect to which the group operations may be +// implemented more efficiently, usually by means of an appropriate choice of projective coordinates. +// +// In each of these submodules, there is a Point struct and a Curve struct, the former +// representing a point in the coordinate system and the latter a curve configuration. +// +// Points +// ====== +// Points may be instantiated using the associated function `new`, which takes coordinates +// as its arguments. For instance, +// +// `let p = swcurve::Point::new(1,1);` +// +// The additive identity may be constructed by a call to the associated function `zero` of no +// arguments: +// +// `let zero = swcurve::Point::zero();` +// +// Points may be tested for equality by calling the method `eq`: +// +// `let pred = p.eq(zero);` +// +// There is also the method `is_zero` to explicitly check whether a point is the additive identity: +// +// `constrain pred == p.is_zero();` +// +// Points may be negated by calling the `negate` method and converted to CurveGroup (or affine) +// coordinates by calling the `into_group` (resp. `into_affine`) method on them. Finally, +// Points may be freely mapped between their respective Twisted Edwards and Montgomery +// representations by calling the `into_montcurve` or `into_tecurve` methods. For mappings +// between Twisted Edwards/Montgomery curves and Short Weierstraß curves, see the Curve section +// below, as the underlying mappings are those of curves rather than ambient spaces. +// As a rule, Points in affine (or CurveGroup) coordinates are mapped to Points in affine +// (resp. CurveGroup) coordinates. +// +// Curves +// ====== +// A curve configuration (Curve) is completely determined by the Field coefficients of its defining +// equation (a and b in the case of swcurve, a and d in the case of tecurve, and j and k in +// the case of montcurve) together with a generator (`gen`) in the corresponding coordinate system. +// For example, the Baby Jubjub curve configuration as defined in ERC-2494 may be instantiated as a Twisted +// Edwards curve in affine coordinates as follows: +// +// `let bjj_affine = tecurve::Curve::new(168700, 168696, tecurve::Point::new(995203441582195749578291179787384436505546430278305826713579947235728471134,5472060717959818805561601436314318772137091100104008585924551046643952123905));` +// +// The `contains` method may be used to check whether a Point lies on a given curve: +// +// `constrain bjj_affine.contains(tecurve::Point::zero());` +// +// The elliptic curve group's addition operation is exposed as the `add` method, e.g. +// +// `let p = bjj_affine.add(bjj_affine.gen, bjj_affine.gen);` +// +// subtraction as the `subtract` method, e.g. +// +// `constrain tecurve::Point::zero().eq(bjj_affine.subtract(bjj_affine.gen, bjj_affine.gen));` +// +// scalar multiplication as the `mul` method, where the scalar is assumed to be a Field* element, e.g. +// +// `constrain tecurve::Point::zero().eq(bjj_affine.mul(2, tecurve::Point::zero());` +// +// There is a scalar multiplication method (`bit_mul`) provided where the scalar input is expected to be +// an array of bits (little-endian convention), as well as a multi-scalar multiplication method** (`msm`) +// which takes an array of Field elements and an array of elliptic curve points as arguments, both assumed +// to be of the same length. +// +// Curve configurations may be converted between different coordinate representations by calling the `into_group` +// and `into_affine` methods on them, e.g. +// +// `let bjj_curvegroup = bjj_affine.into_group();` +// +// Curve configurations may also be converted between different curve representations by calling the `into_swcurve`, +// `into_montcurve` and `into_tecurve` methods subject to the relation between the curve representations mentioned +// above. Note that it is possible to map Points from a Twisted Edwards/Montgomery curve to the corresponding +// Short Weierstraß representation and back, and the methods to do so are exposed as `map_into_swcurve` and +// `map_from_swcurve`, which each take one argument, the point to be mapped. +// +// Curve maps +// ========== +// There are a few different ways of mapping Field elements to elliptic curves. Here we provide the simplified +// Shallue-van de Woestijne-Ulas and Elligator 2 methods, the former being applicable to all curve types +// provided above subject to the constraint that the coefficients of the corresponding Short Weierstraß curve satisfies +// a*b != 0 and the latter being applicable to Montgomery and Twisted Edwards curves subject to the constraint that +// the coefficients of the corresponding Montgomery curve satisfy j*k != 0 and (j^2 - 4)/k^2 is non-square. +// +// The simplified Shallue-van de Woestijne-Ulas method is exposed as the method `swu_map` on the Curve configuration and +// depends on two parameters, a Field element z != -1 for which g(x) - z is irreducible over Field and g(b/(z*a)) is +// square, where g(x) = x^3 + a*x + b is the right-hand side of the defining equation of the corresponding Short +// Weierstraß curve, and a Field element u to be mapped onto the curve. For example, in the case of bjj_affine above, +// it may be determined using the scripts provided at that z = 5. +// +// The Elligator 2 method is exposed as the method `elligator2_map` on the Curve configurations of Montgomery and +// Twisted Edwards curves. Like the simplified SWU method above, it depends on a certain non-square element of Field, +// but this element need not satisfy any further conditions, so it is included as the (Field-dependent) constant +//`ZETA` below. Thus, the `elligator2_map` method depends only on one parameter, the Field element to be mapped onto +// the curve. +// +// For details on all of the above in the context of hashing to elliptic curves, see . +// +// +// *TODO: Replace Field with Bigint. +// **TODO: Support arrays of structs to make this work. +// Field-dependent constant ZETA = a non-square element of Field +// Required for Elligator 2 map +// TODO: Replace with built-in constant. +global ZETA = 5; +// Field-dependent constants for Tonelli-Shanks algorithm (see sqrt function below) +// TODO: Possibly make this built-in. +global C1 = 28; +global C3 = 40770029410420498293352137776570907027550720424234931066070132305055; +global C5 = 19103219067921713944291392827692070036145651957329286315305642004821462161904; +// Higher-order version of scalar multiplication +// TODO: Make this work so that the submodules' bit_mul may be defined in terms of it. +//fn bit_mul(add: fn(T,T) -> T, e: T, bits: [u1; N], p: T) -> T { +// let mut out = e; +// let n = bits.len(); +// +// for i in 0..n { +// out = add( +// add(out, out), +// if(bits[n - i - 1] == 0) {e} else {p}); +// } +// +// out +//} +// TODO: Make this built-in. +pub fn safe_inverse(x: Field) -> Field { + if x == 0 { 0 } else { 1 / x } +} +// Boolean indicating whether Field element is a square, i.e. whether there exists a y in Field s.t. x = y*y. +pub fn is_square(x: Field) -> bool { + let v = pow(x, 0 - 1 / 2); + + v * (v - 1) == 0 +} +// Power function of two Field arguments of arbitrary size. +// Adapted from std::field::pow_32. +pub fn pow(x: Field, y: Field) -> Field { + // As in tests with minor modifications + let N_BITS = crate::field::modulus_num_bits(); + + let mut r = 1 as Field; + let b = y.to_le_bits(N_BITS as u32); + + for i in 0..N_BITS { + r *= r; + r *= (b[N_BITS - 1 - i] as Field)*x + (1-b[N_BITS - 1 - i] as Field); + } + + r +} +// Tonelli-Shanks algorithm for computing the square root of a Field element. +// Requires C1 = max{c: 2^c divides (p-1)}, where p is the order of Field +// as well as C3 = (C2 - 1)/2, where C2 = (p-1)/(2^c1), +// and C5 = ZETA^C2, where ZETA is a non-square element of Field. +// These are pre-computed above as globals. +pub fn sqrt(x: Field) -> Field { + let mut z = pow(x, C3); + let mut t = z * z * x; + z *= x; + let mut b = t; + let mut c = C5; + + for i in 0..(C1 - 1) { + for _j in 1..(C1 - i - 1) { + b *= b; + } + + z *= if b == 1 { 1 } else { c }; + + c *= c; + + t *= if b == 1 { 1 } else { c }; + + b = t; + } + + z +} diff --git a/noir/noir_stdlib/src/ec/consts.nr b/noir/noir_stdlib/src/ec/consts.nr new file mode 100644 index 00000000000..f4d67e7a92c --- /dev/null +++ b/noir/noir_stdlib/src/ec/consts.nr @@ -0,0 +1 @@ +mod te; diff --git a/noir/noir_stdlib/src/ec/consts/te.nr b/noir/noir_stdlib/src/ec/consts/te.nr new file mode 100644 index 00000000000..469493a35ee --- /dev/null +++ b/noir/noir_stdlib/src/ec/consts/te.nr @@ -0,0 +1,26 @@ +use crate::compat; +use crate::ec::tecurve::affine::Point as TEPoint; +use crate::ec::tecurve::affine::Curve as TECurve; + +struct BabyJubjub { + curve: TECurve, + base8: TEPoint, + suborder: Field, +} + +#[field(bn254)] +pub fn baby_jubjub() -> BabyJubjub { + BabyJubjub { + // Baby Jubjub (ERC-2494) parameters in affine representation + curve: TECurve::new(168700, + 168696, + // G + TEPoint::new(995203441582195749578291179787384436505546430278305826713579947235728471134, + 5472060717959818805561601436314318772137091100104008585924551046643952123905)), + // [8]G precalculated + base8: TEPoint::new(5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203), + // The size of the group formed from multiplying the base field by 8. + suborder: 2736030358979909402780800718157159386076813972158567259200215660948447373041 + } +} diff --git a/noir/noir_stdlib/src/ec/montcurve.nr b/noir/noir_stdlib/src/ec/montcurve.nr new file mode 100644 index 00000000000..82d22837b46 --- /dev/null +++ b/noir/noir_stdlib/src/ec/montcurve.nr @@ -0,0 +1,377 @@ +mod affine { + // Affine representation of Montgomery curves + // Points are represented by two-dimensional Cartesian coordinates. + // All group operations are induced by those of the corresponding Twisted Edwards curve. + // See e.g. for details on the correspondences. + use crate::ec::montcurve::curvegroup; + use crate::ec::swcurve::affine::Curve as SWCurve; + use crate::ec::swcurve::affine::Point as SWPoint; + use crate::ec::tecurve::affine::Curve as TECurve; + use crate::ec::tecurve::affine::Point as TEPoint; + use crate::ec::is_square; + use crate::ec::safe_inverse; + use crate::ec::sqrt; + use crate::ec::ZETA; + // Curve specification + struct Curve { // Montgomery Curve configuration (ky^2 = x^3 + j*x^2 + x) + j: Field, + k: Field, + // Generator as point in Cartesian coordinates + gen: Point + } + // Point in Cartesian coordinates + struct Point { + x: Field, + y: Field, + infty: bool // Indicator for point at infinity + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field) -> Self { + Self {x, y, infty: false} + } + + // Check for equality + fn eq(self, p: Self) -> bool { + (self.infty & p.infty) | (!self.infty & !p.infty & (self.x == p.x) & (self.y == p.y)) + } + + // Check if zero + pub fn is_zero(self) -> bool { + self.infty + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Point { + if self.is_zero() { + curvegroup::Point::zero() + } else { + let (x,y) = (self.x, self.y); + curvegroup::Point::new(x,y,1) + } + } + + // Additive identity + pub fn zero() -> Self { + Self {x: 0, y: 0, infty: true} + } + + // Negation + fn negate(self) -> Self { + let Self {x, y, infty} = self; + + Self {x, y: 0-y, infty} + } + + // Map into equivalent Twisted Edwards curve + fn into_tecurve(self) -> TEPoint { + let Self {x, y, infty} = self; + + if infty | (y*(x+1) == 0) { + TEPoint::zero() + } else { + TEPoint::new(x/y, (x-1)/(x+1)) + } + } + } + + impl Curve { + // Curve constructor + pub fn new(j: Field, k: Field, gen: Point) -> Self { + // Check curve coefficients + assert(k != 0); + assert(j*j != 4); + + let curve = Self {j, k, gen}; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Curve { + curvegroup::Curve::new(self.j, self.k, self.gen.into_group()) + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Self {j, k, gen: _gen} = self; + let Point {x, y, infty: infty} = p; + + infty | (k*y*y == x*(x*x + j*x + 1)) + } + + // Point addition + pub fn add(self, p1: Point, p2: Point) -> Point { + self.into_tecurve().add(p1.into_tecurve(), p2.into_tecurve()).into_montcurve() + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + self.into_tecurve().bit_mul(bits, p.into_tecurve()).into_montcurve() + } + + // Scalar multiplication (p + ... + p n times) + fn mul(self, n: Field, p: Point) -> Point { + self.into_tecurve().mul(n, p.into_tecurve()).into_montcurve() + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Conversion to equivalent Twisted Edwards curve + fn into_tecurve(self) -> TECurve { + let Self {j, k, gen} = self; + TECurve::new((j+2)/k, (j-2)/k, gen.into_tecurve()) + } + + // Conversion to equivalent Short Weierstraß curve + pub fn into_swcurve(self) -> SWCurve { + let j = self.j; + let k = self.k; + let a0 = (3-j*j)/(3*k*k); + let b0 = (2*j*j*j - 9*j)/(27*k*k*k); + + SWCurve::new(a0, b0, self.map_into_swcurve(self.gen)) + } + + // Point mapping into equivalent Short Weierstraß curve + pub fn map_into_swcurve(self, p: Point) -> SWPoint { + if p.is_zero() { + SWPoint::zero() + } else { + SWPoint::new((3*p.x + self.j)/(3*self.k), + p.y/self.k) + } + } + + // Point mapping from equivalent Short Weierstraß curve + fn map_from_swcurve(self, p: SWPoint) -> Point { + let SWPoint {x, y, infty} = p; + let j = self.j; + let k = self.k; + + Point {x: (3*k*x - j)/3, y: y*k, infty} + } + + // Elligator 2 map-to-curve method; see . + fn elligator2_map(self, u: Field) -> Point { + let j = self.j; + let k = self.k; + let z = ZETA; // Non-square Field element required for map + + // Check whether curve is admissible + assert(j != 0); + let l = (j*j - 4)/(k*k); + assert(l != 0); + assert(is_square(l) == false); + + let x1 = safe_inverse(1+z*u*u)*(0 - (j/k)); + + let gx1 = x1*x1*x1 + (j/k)*x1*x1 + x1/(k*k); + let x2 = 0 - x1 - (j/k); + let gx2 = x2*x2*x2 + (j/k)*x2*x2 + x2/(k*k); + + let x = if is_square(gx1) { x1 } else { x2 }; + + let y = if is_square(gx1) { + let y0 = sqrt(gx1); + if y0.sgn0() == 1 { y0 } else { 0 - y0 } + } else { + let y0 = sqrt(gx2); + if y0.sgn0() == 0 { y0 } else { 0 - y0 } + }; + + Point::new(x*k, y*k) + + } + + // SWU map-to-curve method (via rational map) + fn swu_map(self, z: Field, u: Field) -> Point { + self.map_from_swcurve(self.into_swcurve().swu_map(z,u)) + } + } +} +mod curvegroup { + // Affine representation of Montgomery curves + // Points are represented by three-dimensional projective (homogeneous) coordinates. + // All group operations are induced by those of the corresponding Twisted Edwards curve. + // See e.g. for details on the correspondences. + use crate::ec::montcurve::affine; + use crate::ec::swcurve::curvegroup::Curve as SWCurve; + use crate::ec::swcurve::curvegroup::Point as SWPoint; + use crate::ec::tecurve::curvegroup::Curve as TECurve; + use crate::ec::tecurve::curvegroup::Point as TEPoint; + + struct Curve { // Montgomery Curve configuration (ky^2 z = x*(x^2 + j*x*z + z*z)) + j: Field, + k: Field, + // Generator as point in projective coordinates + gen: Point + } + // Point in projective coordinates + struct Point { + x: Field, + y: Field, + z: Field + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field, z: Field) -> Self { + Self {x, y, z} + } + + // Check for equality + fn eq(self, p: Self) -> bool { + (self.z == p.z) | (((self.x * self.z) == (p.x * p.z)) & ((self.y * self.z) == (p.y * p.z))) + } + + // Check if zero + pub fn is_zero(self) -> bool { + self.z == 0 + } + + // Conversion to affine coordinates + fn into_affine(self) -> affine::Point { + if self.is_zero() { + affine::Point::zero() + } else { + let (x,y,z) = (self.x, self.y, self.z); + affine::Point::new(x/z, y/z) + } + } + + // Additive identity + pub fn zero() -> Self { + Self {x: 0, y: 1,z: 0} + } + + // Negation + fn negate(self) -> Self { + let Self {x, y, z} = self; + + Point::new(x, 0-y, z) + } + + // Map into equivalent Twisted Edwards curve + fn into_tecurve(self) -> TEPoint { + self.into_affine().into_tecurve().into_group() + } + } + + impl Curve { + // Curve constructor + pub fn new(j: Field, k: Field, gen: Point) -> Self { + // Check curve coefficients + assert(k != 0); + assert(j*j != 4); + + let curve = Self {j, k, gen}; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to affine coordinates + fn into_affine(self) -> affine::Curve { + affine::Curve::new(self.j, self.k, self.gen.into_affine()) + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Self {j, k, gen: _gen} = self; + let Point {x, y, z} = p; + + k*y*y*z == x*(x*x + j*x*z + z*z) + } + + // Point addition + pub fn add(self, p1: Point, p2: Point) -> Point { + self.into_affine().add(p1.into_affine(), p2.into_affine()).into_group() + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + self.into_tecurve().bit_mul(bits, p.into_tecurve()).into_montcurve() + } + + // Scalar multiplication (p + ... + p n times) + pub fn mul(self, n: Field, p: Point) -> Point { + self.into_tecurve().mul(n, p.into_tecurve()).into_montcurve() + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + pub fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Conversion to equivalent Twisted Edwards curve + fn into_tecurve(self) -> TECurve { + let Self {j, k, gen} = self; + TECurve::new((j+2)/k, (j-2)/k, gen.into_tecurve()) + } + + // Conversion to equivalent Short Weierstraß curve + fn into_swcurve(self) -> SWCurve { + let j = self.j; + let k = self.k; + let a0 = (3-j*j)/(3*k*k); + let b0 = (2*j*j*j - 9*j)/(27*k*k*k); + + SWCurve::new(a0, b0, + self.map_into_swcurve(self.gen)) + } + + // Point mapping into equivalent Short Weierstraß curve + pub fn map_into_swcurve(self, p: Point) -> SWPoint { + self.into_affine().map_into_swcurve(p.into_affine()).into_group() + } + + // Point mapping from equivalent Short Weierstraß curve + fn map_from_swcurve(self, p: SWPoint) -> Point { + self.into_affine().map_from_swcurve(p.into_affine()).into_group() + } + + // Elligator 2 map-to-curve method + fn elligator2_map(self, u: Field) -> Point { + self.into_affine().elligator2_map(u).into_group() + } + + // SWU map-to-curve method (via rational map) + fn swu_map(self, z: Field, u: Field) -> Point { + self.into_affine().swu_map(z,u).into_group() + } + } +} diff --git a/noir/noir_stdlib/src/ec/swcurve.nr b/noir/noir_stdlib/src/ec/swcurve.nr new file mode 100644 index 00000000000..e9b6f661843 --- /dev/null +++ b/noir/noir_stdlib/src/ec/swcurve.nr @@ -0,0 +1,375 @@ +mod affine { + // Affine representation of Short Weierstraß curves + // Points are represented by two-dimensional Cartesian coordinates. + // Group operations are implemented in terms of those in CurveGroup (in this case, extended Twisted Edwards) coordinates + // for reasons of efficiency, cf. . + use crate::ec::swcurve::curvegroup; + use crate::ec::safe_inverse; + use crate::ec::is_square; + use crate::ec::sqrt; + // Curve specification + struct Curve { // Short Weierstraß curve + // Coefficients in defining equation y^2 = x^3 + ax + b + a: Field, + b: Field, + // Generator as point in Cartesian coordinates + gen: Point + } + // Point in Cartesian coordinates + struct Point { + x: Field, + y: Field, + infty: bool // Indicator for point at infinity + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field) -> Self { + Self {x, y, infty: false} + } + + // Check for equality + fn eq(self, p: Point) -> bool { + let Self {x: x1, y: y1, infty: inf1} = self; + let Self {x: x2, y: y2, infty: inf2} = p; + + (inf1 & inf2) + | (!inf1 & !inf2 & (x1 == x2) & (y1 == y2)) + } + + // Check if zero + pub fn is_zero(self) -> bool { + self.eq(Point::zero()) + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Point { + let Self {x, y, infty} = self; + + if infty { + curvegroup::Point::zero() + } else { + curvegroup::Point::new(x, y, 1) + } + } + + // Additive identity + pub fn zero() -> Self { + Self {x: 0, y: 0, infty: true} + } + + // Negation + fn negate(self) -> Self { + let Self {x, y, infty} = self; + Self {x, y: 0-y, infty} + } + } + + impl Curve { + // Curve constructor + pub fn new(a: Field, b: Field, gen: Point) -> Curve { + // Check curve coefficients + assert(4*a*a*a + 27*b*b != 0); + + let curve = Curve { a, b, gen }; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Curve { + let Curve{a, b, gen} = self; + + curvegroup::Curve {a, b, gen: gen.into_group()} + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Point {x, y, infty} = p; + infty | (y*y == x*x*x + self.a*x + self.b) + } + + // Point addition, implemented in terms of mixed addition for reasons of efficiency + pub fn add(self, p1: Point, p2: Point) -> Point { + self.mixed_add(p1, p2.into_group()).into_affine() + } + + // Mixed point addition, i.e. first argument in affine, second in CurveGroup coordinates. + fn mixed_add(self, p1: Point, p2: curvegroup::Point) -> curvegroup::Point { + if p1.is_zero() { + p2 + } else if p2.is_zero() { + p1.into_group() + } else { + let Point {x: x1, y: y1, infty: _inf} = p1; + let curvegroup::Point {x: x2, y: y2, z: z2} = p2; + let you1 = x1*z2*z2; + let you2 = x2; + let s1 = y1*z2*z2*z2; + let s2 = y2; + + if you1 == you2 { + if s1 != s2 { + curvegroup::Point::zero() + } else { + self.into_group().double(p2) + } + } else + { + let h = you2 - you1; + let r = s2 - s1; + let x3 = r*r - h*h*h - 2*you1*h*h; + let y3 = r*(you1*h*h - x3) - s1*h*h*h; + let z3 = h*z2; + + curvegroup::Point::new(x3,y3,z3) + } + } + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + self.into_group().bit_mul(bits, p.into_group()).into_affine() + } + + // Scalar multiplication (p + ... + p n times) + pub fn mul(self, n: Field, p: Point) -> Point { + self.into_group().mul(n, p.into_group()).into_affine() + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + pub fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + pub fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Simplified Shallue-van de Woestijne-Ulas map-to-curve method; see . + // First determine non-square z != -1 in Field s.t. g(x) - z irreducible over Field and g(b/(z*a)) is square, + // where g(x) = x^3 + a*x + b. swu_map(c,z,.) then maps a Field element to a point on curve c. + fn swu_map(self, z: Field, u: Field) -> Point { + // Check whether curve is admissible + assert(self.a*self.b != 0); + + let Curve {a, b, gen: _gen} = self; + + let tv1 = safe_inverse(z*z*u*u*u*u + u*u*z); + let x1 = if tv1 == 0 {b/(z*a)} else {(0-b/a)*(1 + tv1)}; + let gx1 = x1*x1*x1 + a*x1 + b; + let x2 = z*u*u*x1; + let gx2 = x2*x2*x2 + a*x2 + b; + let (x,y) = if is_square(gx1) {(x1, sqrt(gx1))} else {(x2, sqrt(gx2))}; + Point::new(x, if u.sgn0() != y.sgn0() {0-y} else {y}) + } + } +} + +mod curvegroup { + // CurveGroup representation of Weierstraß curves + // Points are represented by three-dimensional Jacobian coordinates. + // See for details. + use crate::ec::swcurve::affine; + // Curve specification + struct Curve { // Short Weierstraß curve + // Coefficients in defining equation y^2 = x^3 + axz^4 + bz^6 + a: Field, + b: Field, + // Generator as point in Cartesian coordinates + gen: Point + } + // Point in three-dimensional Jacobian coordinates + struct Point { + x: Field, + y: Field, + z: Field // z = 0 corresponds to point at infinity. + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field, z: Field) -> Self { + Self {x, y, z} + } + + // Check for equality + fn eq(self, p: Point) -> bool { + let Self {x: x1, y: y1, z: z1} = self; + let Self {x: x2, y: y2, z: z2} = p; + + ((z1 == 0) & (z2 == 0)) | ((z1 != 0) & (z2 != 0) & (x1*z2*z2 == x2*z1*z1) & (y1*z2*z2*z2 == y2*z1*z1*z1)) + } + + // Check if zero + pub fn is_zero(self) -> bool { + self.eq(Point::zero()) + } + + // Conversion to affine coordinates + pub fn into_affine(self) -> affine::Point { + let Self {x, y, z} = self; + + if z == 0 { + affine::Point::zero() + } else { + affine::Point::new(x/(z*z), y/(z*z*z)) + } + } + + // Additive identity + pub fn zero() -> Self { + Self {x: 0, y: 0, z: 0} + } + + + // Negation + fn negate(self) -> Self { + let Self {x, y, z} = self; + Self {x, y: 0-y, z} + } + } + + impl Curve { + // Curve constructor + pub fn new(a: Field, b: Field, gen: Point) -> Curve { + // Check curve coefficients + assert(4*a*a*a + 27*b*b != 0); + + let curve = Curve { a, b, gen }; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to affine coordinates + pub fn into_affine(self) -> affine::Curve { + let Curve{a, b, gen} = self; + + affine::Curve {a, b, gen: gen.into_affine()} + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Point {x, y, z} = p; + if z == 0 { + true + } else { + y*y == x*x*x + self.a*x*z*z*z*z + self.b*z*z*z*z*z*z + } + } + + // Addition + pub fn add(self, p1: Point, p2: Point) -> Point { + + if p1.is_zero() { + p2 + } else if p2.is_zero() { + p1 + } else { + let Point {x: x1, y: y1, z: z1} = p1; + let Point {x: x2, y: y2, z: z2} = p2; + let you1 = x1*z2*z2; + let you2 = x2*z1*z1; + let s1 = y1*z2*z2*z2; + let s2 = y2*z1*z1*z1; + + if you1 == you2 { + if s1 != s2 { + Point::zero() + } else { + self.double(p1) + } + } else { + let h = you2 - you1; + let r = s2 - s1; + let x3 = r*r - h*h*h - 2*you1*h*h; + let y3 = r*(you1*h*h - x3) - s1*h*h*h; + let z3 = h*z1*z2; + + Point::new(x3,y3,z3) + } + } + } + + // Point doubling + pub fn double(self, p: Point) -> Point { + let Point {x, y, z} = p; + + if p.is_zero() { + p + } else if y == 0 { + Point::zero() + } else { + let s = 4*x*y*y; + let m = 3*x*x + self.a*z*z*z*z; + let x0 = m*m - 2*s; + let y0 = m*(s-x0) - 8*y*y*y*y; + let z0 = 2*y*z; + + Point::new(x0,y0,z0) + } + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add( + self.add(out, out), + if(bits[N - i - 1] == 0) {Point::zero()} else {p}); + } + + out + } + + // Scalar multiplication (p + ... + p n times) + pub fn mul(self, n: Field, p: Point) -> Point { + let N_BITS = crate::field::modulus_num_bits(); + + // TODO: temporary workaround until issue 1354 is solved + let mut n_as_bits: [u1; 254] = [0; 254]; + let tmp = n.to_le_bits(N_BITS as u32); + for i in 0..254 { + n_as_bits[i] = tmp[i]; + } + + self.bit_mul(n_as_bits, p) + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + pub fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Simplified SWU map-to-curve method + fn swu_map(self, z: Field, u: Field) -> Point { + self.into_affine().swu_map(z,u).into_group() + } + } +} diff --git a/noir/noir_stdlib/src/ec/tecurve.nr b/noir/noir_stdlib/src/ec/tecurve.nr new file mode 100644 index 00000000000..849b45ff012 --- /dev/null +++ b/noir/noir_stdlib/src/ec/tecurve.nr @@ -0,0 +1,407 @@ +mod affine { + // Affine coordinate representation of Twisted Edwards curves + // Points are represented by two-dimensional Cartesian coordinates. + // Group operations are implemented in terms of those in CurveGroup (in this case, extended Twisted Edwards) coordinates + // for reasons of efficiency. + // See for details. + use crate::ec::tecurve::curvegroup; + use crate::ec::montcurve::affine::Curve as MCurve; + use crate::ec::montcurve::affine::Point as MPoint; + use crate::ec::swcurve::affine::Curve as SWCurve; + use crate::ec::swcurve::affine::Point as SWPoint; + // Curve specification + struct Curve { // Twisted Edwards curve + // Coefficients in defining equation ax^2 + y^2 = 1 + dx^2y^2 + a: Field, + d: Field, + // Generator as point in Cartesian coordinates + gen: Point + } + // Point in Cartesian coordinates + struct Point { + x: Field, + y: Field + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field) -> Self { + Self { x, y } + } + + // Check for equality + fn eq(self, p: Point) -> bool { + let Self {x: x1, y: y1} = self; + let Self {x: x2, y: y2} = p; + + (x1 == x2) & (y1 == y2) + } + + // Check if zero + pub fn is_zero(self) -> bool { + self.eq(Point::zero()) + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Point { + let Self {x, y} = self; + + curvegroup::Point::new(x, y, x*y, 1) + } + + // Additive identity + pub fn zero() -> Self { + Point::new(0,1) + } + + // Negation + fn negate(self) -> Self { + let Self {x, y} = self; + Point::new(0-x, y) + } + + // Map into prime-order subgroup of equivalent Montgomery curve + fn into_montcurve(self) -> MPoint { + if self.is_zero() { + MPoint::zero() + } else { + let Self {x, y} = self; + let x0 = (1+y)/(1-y); + let y0 = (1+y)/(x*(1-y)); + + MPoint::new(x0,y0) + } + } + } + + impl Curve { + // Curve constructor + pub fn new(a: Field, d: Field, gen: Point) -> Curve { + // Check curve coefficients + assert(a*d*(a-d) != 0); + + let curve = Curve {a, d, gen}; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to CurveGroup coordinates + fn into_group(self) -> curvegroup::Curve { + let Curve{a, d, gen} = self; + + curvegroup::Curve {a, d, gen: gen.into_group()} + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Point {x, y} = p; + self.a*x*x + y*y == 1 + self.d*x*x*y*y + } + + // Point addition, implemented in terms of mixed addition for reasons of efficiency + pub fn add(self, p1: Point, p2: Point) -> Point { + self.mixed_add(p1, p2.into_group()).into_affine() + } + + // Mixed point addition, i.e. first argument in affine, second in CurveGroup coordinates. + fn mixed_add(self, p1: Point, p2: curvegroup::Point) -> curvegroup::Point { + let Point{x: x1, y: y1} = p1; + let curvegroup::Point{x: x2, y: y2, t: t2, z: z2} = p2; + + let a = x1*x2; + let b = y1*y2; + let c = self.d*x1*y1*t2; + let e = (x1 + y1)*(x2 + y2) - a - b; + let f = z2 - c; + let g = z2 + c; + let h = b - self.a*a; + + let x = e*f; + let y = g*h; + let t = e*h; + let z = f*g; + + curvegroup::Point::new(x,y,t,z) + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + self.into_group().bit_mul(bits, p.into_group()).into_affine() + } + + // Scalar multiplication (p + ... + p n times) + fn mul(self, n: Field, p: Point) -> Point { + self.into_group().mul(n, p.into_group()).into_affine() + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Conversion to equivalent Montgomery curve + pub fn into_montcurve(self) -> MCurve { + let j = 2*(self.a + self.d)/(self.a - self.d); + let k = 4/(self.a - self.d); + let gen_montcurve = self.gen.into_montcurve(); + + MCurve::new(j, k, gen_montcurve) + } + + // Conversion to equivalent Short Weierstraß curve + pub fn into_swcurve(self) -> SWCurve { + self.into_montcurve().into_swcurve() + } + + // Point mapping into equivalent Short Weierstraß curve + pub fn map_into_swcurve(self, p: Point) -> SWPoint { + self.into_montcurve().map_into_swcurve(p.into_montcurve()) + } + + // Point mapping from equivalent Short Weierstraß curve + fn map_from_swcurve(self, p: SWPoint) -> Point { + self.into_montcurve().map_from_swcurve(p).into_tecurve() + } + + // Elligator 2 map-to-curve method (via rational map) + fn elligator2_map(self, u: Field) -> Point { + self.into_montcurve().elligator2_map(u).into_tecurve() + } + + // Simplified SWU map-to-curve method (via rational map) + fn swu_map(self, z: Field, u: Field) -> Point { + self.into_montcurve().swu_map(z,u).into_tecurve() + } + } +} +mod curvegroup { + // CurveGroup coordinate representation of Twisted Edwards curves + // Points are represented by four-dimensional projective coordinates, viz. extended Twisted Edwards coordinates. + // See §3 of for details. + use crate::ec::tecurve::affine; + use crate::ec::montcurve::curvegroup::Curve as MCurve; + use crate::ec::montcurve::curvegroup::Point as MPoint; + use crate::ec::swcurve::curvegroup::Curve as SWCurve; + use crate::ec::swcurve::curvegroup::Point as SWPoint; + // Curve specification + struct Curve { // Twisted Edwards curve + // Coefficients in defining equation a(x^2 + y^2)z^2 = z^4 + dx^2y^2 + a: Field, + d: Field, + // Generator as point in projective coordinates + gen: Point + } + // Point in extended twisted Edwards coordinates + struct Point { + x: Field, + y: Field, + t: Field, + z: Field + } + + impl Point { + // Point constructor + pub fn new(x: Field, y: Field, t: Field, z: Field) -> Self { + Self {x, y, t, z} + } + + // Check for equality + fn eq(self, p: Point) -> bool { + let Self {x: x1, y: y1, t: _t1, z: z1} = self; + let Self {x: x2, y: y2, t: _t2, z:z2} = p; + + (x1*z2 == x2*z1) & (y1*z2 == y2*z1) + } + + // Check if zero + pub fn is_zero(self) -> bool { + let Self {x, y, t, z} = self; + (x == 0) & (y == z) & (y != 0) & (t == 0) + } + + // Conversion to affine coordinates + pub fn into_affine(self) -> affine::Point { + let Self {x, y, t: _t, z} = self; + + affine::Point::new(x/z, y/z) + } + + // Additive identity + pub fn zero() -> Self { + Point::new(0,1,0,1) + } + + // Negation + fn negate(self) -> Self { + let Self {x, y, t, z} = self; + + Point::new(0-x, y, 0-t, z) + } + + // Map into prime-order subgroup of equivalent Montgomery curve + fn into_montcurve(self) -> MPoint { + self.into_affine().into_montcurve().into_group() + } + } + + impl Curve { + // Curve constructor + pub fn new(a: Field, d: Field, gen: Point) -> Curve { + // Check curve coefficients + assert(a*d*(a-d) != 0); + + let curve = Curve { a, d, gen }; + + // gen should be on the curve + assert(curve.contains(curve.gen)); + + curve + } + + // Conversion to affine coordinates + pub fn into_affine(self) -> affine::Curve { + let Curve{a, d, gen} = self; + + affine::Curve {a, d, gen: gen.into_affine()} + } + + // Membership check + pub fn contains(self, p: Point) -> bool { + let Point {x, y, t, z} = p; + + (z != 0) & (z*t == x*y) & (z*z*(self.a*x*x + y*y) == z*z*z*z + self.d*x*x*y*y) + } + + // Point addition + pub fn add(self, p1: Point, p2: Point) -> Point { + let Point{x: x1, y: y1, t: t1, z: z1} = p1; + let Point{x: x2, y: y2, t: t2, z: z2} = p2; + + let a = x1*x2; + let b = y1*y2; + let c = self.d*t1*t2; + let d = z1*z2; + let e = (x1 + y1)*(x2 + y2) - a - b; + let f = d - c; + let g = d + c; + let h = b - self.a*a; + + let x = e*f; + let y = g*h; + let t = e*h; + let z = f*g; + + Point::new(x,y,t,z) + } + + // Point doubling, cf. §3.3 + pub fn double(self, p: Point) -> Point { + let Point{x, y, t: _t, z} = p; + + let a = x*x; + let b = y*y; + let c = 2*z*z; + let d = self.a*a; + let e = (x + y)*(x + y) - a - b; + let g = d + b; + let f = g - c; + let h = d - b; + + let x0 = e*f; + let y0 = g*h; + let t0 = e*h; + let z0 = f*g; + + Point::new(x0, y0, t0, z0) + } + + // Scalar multiplication with scalar represented by a bit array (little-endian convention). + // If k is the natural number represented by `bits`, then this computes p + ... + p k times. + fn bit_mul(self, bits: [u1; N], p: Point) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add( + self.add(out, out), + if(bits[N - i - 1] == 0) {Point::zero()} else {p}); + } + + out + } + + // Scalar multiplication (p + ... + p n times) + pub fn mul(self, n: Field, p: Point) -> Point { + let N_BITS = crate::field::modulus_num_bits(); + + // TODO: temporary workaround until issue 1354 is solved + let mut n_as_bits: [u1; 254] = [0; 254]; + let tmp = n.to_le_bits(N_BITS as u32); + for i in 0..254 { + n_as_bits[i] = tmp[i]; + } + + self.bit_mul(n_as_bits, p) + } + + // Multi-scalar multiplication (n[0]*p[0] + ... + n[N]*p[N], where * denotes scalar multiplication) + fn msm(self, n: [Field; N], p: [Point; N]) -> Point { + let mut out = Point::zero(); + + for i in 0..N { + out = self.add(out, self.mul(n[i], p[i])); + } + + out + } + + // Point subtraction + fn subtract(self, p1: Point, p2: Point) -> Point { + self.add(p1, p2.negate()) + } + + // Conversion to equivalent Montgomery curve + fn into_montcurve(self) -> MCurve { + self.into_affine().into_montcurve().into_group() + } + + // Conversion to equivalent Short Weierstraß curve + fn into_swcurve(self) -> SWCurve { + self.into_montcurve().into_swcurve() + } + + // Point mapping into equivalent short Weierstraß curve + pub fn map_into_swcurve(self, p: Point) -> SWPoint { + self.into_montcurve().map_into_swcurve(p.into_montcurve()) + } + + // Point mapping from equivalent short Weierstraß curve + fn map_from_swcurve(self, p: SWPoint) -> Point { + self.into_montcurve().map_from_swcurve(p).into_tecurve() + } + + // Elligator 2 map-to-curve method (via rational maps) + fn elligator2_map(self, u: Field) -> Point { + self.into_montcurve().elligator2_map(u).into_tecurve() + } + + // Simplified SWU map-to-curve method (via rational map) + fn swu_map(self, z: Field, u: Field) -> Point { + self.into_montcurve().swu_map(z,u).into_tecurve() + } + } +} diff --git a/noir/noir_stdlib/src/ecdsa_secp256k1.nr b/noir/noir_stdlib/src/ecdsa_secp256k1.nr new file mode 100644 index 00000000000..61687f557fe --- /dev/null +++ b/noir/noir_stdlib/src/ecdsa_secp256k1.nr @@ -0,0 +1,2 @@ +#[foreign(ecdsa_secp256k1)] +pub fn verify_signature(_public_key_x: [u8; 32], _public_key_y: [u8; 32], _signature: [u8; 64], _message_hash: [u8; N]) -> bool {} diff --git a/noir/noir_stdlib/src/ecdsa_secp256r1.nr b/noir/noir_stdlib/src/ecdsa_secp256r1.nr new file mode 100644 index 00000000000..7af37407edd --- /dev/null +++ b/noir/noir_stdlib/src/ecdsa_secp256r1.nr @@ -0,0 +1,2 @@ +#[foreign(ecdsa_secp256r1)] +pub fn verify_signature(_public_key_x: [u8; 32], _public_key_y: [u8; 32], _signature: [u8; 64], _message_hash: [u8; N]) -> bool {} diff --git a/noir/noir_stdlib/src/eddsa.nr b/noir/noir_stdlib/src/eddsa.nr new file mode 100644 index 00000000000..39051e23233 --- /dev/null +++ b/noir/noir_stdlib/src/eddsa.nr @@ -0,0 +1,58 @@ +use crate::hash::poseidon; +use crate::ec::consts::te::baby_jubjub; +use crate::ec::tecurve::affine::Point as TEPoint; +// Returns true if x is less than y +fn lt_bytes32(x: Field, y: Field) -> bool { + let x_bytes = x.to_le_bytes(32); + let y_bytes = y.to_le_bytes(32); + let mut x_is_lt = false; + let mut done = false; + for i in 0..32 { + if (!done) { + let x_byte = x_bytes[31 - i] as u8; + let y_byte = y_bytes[31 - i] as u8; + let bytes_match = x_byte == y_byte; + if !bytes_match { + x_is_lt = x_byte < y_byte; + done = true; + } + } + } + x_is_lt +} +// Returns true if signature is valid +pub fn eddsa_poseidon_verify( + pub_key_x: Field, + pub_key_y: Field, + signature_s: Field, + signature_r8_x: Field, + signature_r8_y: Field, + message: Field +) -> bool { + // Verifies by testing: + // S * B8 = R8 + H(R8, A, m) * A8 + let bjj = baby_jubjub(); + + let pub_key = TEPoint::new(pub_key_x, pub_key_y); + assert(bjj.curve.contains(pub_key)); + + let signature_r8 = TEPoint::new(signature_r8_x, signature_r8_y); + assert(bjj.curve.contains(signature_r8)); + // Ensure S < Subgroup Order + assert(lt_bytes32(signature_s, bjj.suborder)); + // Calculate the h = H(R, A, msg) + let hash: Field = poseidon::bn254::hash_5([signature_r8_x, signature_r8_y, pub_key_x, pub_key_y, message]); + // Calculate second part of the right side: right2 = h*8*A + // Multiply by 8 by doubling 3 times. This also ensures that the result is in the subgroup. + let pub_key_mul_2 = bjj.curve.add(pub_key, pub_key); + let pub_key_mul_4 = bjj.curve.add(pub_key_mul_2, pub_key_mul_2); + let pub_key_mul_8 = bjj.curve.add(pub_key_mul_4, pub_key_mul_4); + // We check that A8 is not zero. + assert(!pub_key_mul_8.is_zero()); + // Compute the right side: R8 + h * A8 + let right = bjj.curve.add(signature_r8, bjj.curve.mul(hash, pub_key_mul_8)); + // Calculate left side of equation left = S * B8 + let left = bjj.curve.mul(signature_s, bjj.base8); + + left.eq(right) +} diff --git a/noir/noir_stdlib/src/field.nr b/noir/noir_stdlib/src/field.nr new file mode 100644 index 00000000000..b4cb9b64e3c --- /dev/null +++ b/noir/noir_stdlib/src/field.nr @@ -0,0 +1,98 @@ +impl Field { + pub fn to_le_bits(self: Self, bit_size: u32) -> [u1] { + crate::assert_constant(bit_size); + self.__to_le_bits(bit_size) + } + + pub fn to_be_bits(self: Self, bit_size: u32) -> [u1] { + crate::assert_constant(bit_size); + self.__to_be_bits(bit_size) + } + + #[builtin(to_le_bits)] + fn __to_le_bits(_self: Self, _bit_size: u32) -> [u1] {} + + #[builtin(to_be_bits)] + fn __to_be_bits(_self: Self, _bit_size: u32) -> [u1] {} + + pub fn to_le_bytes(self: Self, byte_size: u32) -> [u8] { + self.to_le_radix(256, byte_size) + } + + pub fn to_be_bytes(self: Self, byte_size: u32) -> [u8] { + self.to_be_radix(256, byte_size) + } + + + pub fn to_le_radix(self: Self, radix: u32, result_len: u32) -> [u8] { + crate::assert_constant(radix); + crate::assert_constant(result_len); + self.__to_le_radix(radix, result_len) + } + + pub fn to_be_radix(self: Self, radix: u32, result_len: u32) -> [u8] { + crate::assert_constant(radix); + crate::assert_constant(result_len); + self.__to_be_radix(radix, result_len) + } + + + + // decompose `_self` into a `_result_len` vector over the `_radix` basis + // `_radix` must be less than 256 + #[builtin(to_le_radix)] + fn __to_le_radix(_self: Self, _radix: u32, _result_len: u32) -> [u8] {} + + #[builtin(to_be_radix)] + fn __to_be_radix(_self: Self, _radix: u32, _result_len: u32) -> [u8] {} + + + // Returns self to the power of the given exponent value. + // Caution: we assume the exponent fits into 32 bits + // using a bigger bit size impacts negatively the performance and should be done only if the exponent does not fit in 32 bits + pub fn pow_32(self, exponent: Field) -> Field { + let mut r: Field = 1; + let b = exponent.to_le_bits(32); + + for i in 1..33 { + r *= r; + r = (b[32-i] as Field) * (r * self) + (1 - b[32-i] as Field) * r; + } + r + } + + // Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ {0, ..., p-1} is even, otherwise sgn0(x mod p) = 1. + pub fn sgn0(self) -> u1 { + self as u1 + } +} + +#[builtin(modulus_num_bits)] +pub fn modulus_num_bits() -> Field {} + +#[builtin(modulus_be_bits)] +pub fn modulus_be_bits() -> [u1] {} + +#[builtin(modulus_le_bits)] +pub fn modulus_le_bits() -> [u1] {} + +#[builtin(modulus_be_bytes)] +pub fn modulus_be_bytes() -> [u8] {} + +#[builtin(modulus_le_bytes)] +pub fn modulus_le_bytes() -> [u8] {} +// Convert a 32 byte array to a field element +pub fn bytes32_to_field(bytes32: [u8; 32]) -> Field { + // Convert it to a field element + let mut v = 1; + let mut high = 0 as Field; + let mut low = 0 as Field; + + for i in 0..16 { + high = high + (bytes32[15 - i] as Field) * v; + low = low + (bytes32[16 + 15 - i] as Field) * v; + v = v * 256; + } + // Abuse that a % p + b % p = (a + b) % p and that low < p + low + high * v +} diff --git a/noir/noir_stdlib/src/grumpkin_scalar.nr b/noir/noir_stdlib/src/grumpkin_scalar.nr new file mode 100644 index 00000000000..d05158488f4 --- /dev/null +++ b/noir/noir_stdlib/src/grumpkin_scalar.nr @@ -0,0 +1,21 @@ +struct GrumpkinScalar { + low: Field, + high: Field, +} + +impl GrumpkinScalar { + pub fn new(low: Field, high: Field) -> Self { + // TODO: check that the low and high value fit within the grumpkin modulus + GrumpkinScalar { low, high } + } +} + +global GRUMPKIN_SCALAR_SERIALIZED_LEN: Field = 2; + +pub fn deserialize_grumpkin_scalar(fields: [Field; GRUMPKIN_SCALAR_SERIALIZED_LEN]) -> GrumpkinScalar { + GrumpkinScalar { low: fields[0], high: fields[1] } +} + +pub fn serialize_grumpkin_scalar(scalar: GrumpkinScalar) -> [Field; GRUMPKIN_SCALAR_SERIALIZED_LEN] { + [scalar.low, scalar.high] +} diff --git a/noir/noir_stdlib/src/grumpkin_scalar_mul.nr b/noir/noir_stdlib/src/grumpkin_scalar_mul.nr new file mode 100644 index 00000000000..06d30d62332 --- /dev/null +++ b/noir/noir_stdlib/src/grumpkin_scalar_mul.nr @@ -0,0 +1,7 @@ +use crate::grumpkin_scalar::GrumpkinScalar; +use crate::scalar_mul::fixed_base_embedded_curve; + +pub fn grumpkin_fixed_base(scalar: GrumpkinScalar) -> [Field; 2] { + // TODO: this should use both the low and high limbs to do the scalar multiplication + fixed_base_embedded_curve(scalar.low, scalar.high) +} diff --git a/noir/noir_stdlib/src/hash.nr b/noir/noir_stdlib/src/hash.nr new file mode 100644 index 00000000000..157d6518367 --- /dev/null +++ b/noir/noir_stdlib/src/hash.nr @@ -0,0 +1,50 @@ +mod poseidon; +mod mimc; + +#[foreign(sha256)] +pub fn sha256(_input: [u8; N]) -> [u8; 32] {} + +#[foreign(blake2s)] +pub fn blake2s(_input: [u8; N]) -> [u8; 32] {} + +struct PedersenPoint { + x : Field, + y : Field, +} + +pub fn pedersen_commitment(input: [Field; N]) -> PedersenPoint { + pedersen_commitment_with_separator(input, 0) +} + +#[foreign(pedersen)] +pub fn __pedersen_commitment_with_separator(_input: [Field; N], _separator: u32) -> [Field; 2] {} + +pub fn pedersen_commitment_with_separator(input: [Field; N], separator: u32) -> PedersenPoint { + let values = __pedersen_commitment_with_separator(input, separator); + PedersenPoint { x: values[0], y: values[1] } +} + +pub fn pedersen_hash(input: [Field; N]) -> Field { + pedersen_hash_with_separator(input, 0) +} + +#[foreign(pedersen_hash)] +pub fn pedersen_hash_with_separator(_input: [Field; N], _separator: u32) -> Field {} + +pub fn hash_to_field(_input: [Field; N]) -> Field { + let mut inputs_as_bytes = []; + + for i in 0..N { + let input_bytes = _input[i].to_le_bytes(32); + for i in 0..32 { + inputs_as_bytes = inputs_as_bytes.push_back(input_bytes[i]); + } + } + + let hashed_input = blake2s(inputs_as_bytes); + crate::field::bytes32_to_field(hashed_input) +} + +#[foreign(keccak256)] +pub fn keccak256(_input: [u8; N], _message_size: u32) -> [u8; 32] {} + diff --git a/noir/noir_stdlib/src/hash/mimc.nr b/noir/noir_stdlib/src/hash/mimc.nr new file mode 100644 index 00000000000..10c0a48917c --- /dev/null +++ b/noir/noir_stdlib/src/hash/mimc.nr @@ -0,0 +1,125 @@ +// mimc-p/p implementation +// constants are (publicly generated) random numbers, for instance using keccak as a ROM. +// You must use constants generated for the native field +// Rounds number should be ~ log(p)/log(exp) +// For 254 bit primes, exponent 7 and 91 rounds seems to be recommended +fn mimc(x: Field, k: Field, constants: [Field; N], exp: Field) -> Field { + //round 0 + let mut t = x + k; + let mut h = t.pow_32(exp); + //next rounds + for i in 1..constants.len() { + t = h + k + constants[i]; + h = t.pow_32(exp); + } + h + k +} + +global MIMC_BN254_ROUNDS = 91; +//mimc implementation with hardcoded parameters for BN254 curve. +#[field(bn254)] +pub fn mimc_bn254(array: [Field; N]) -> Field { + //mimc parameters + let exponent = 7; + //generated from seed "mimc" using keccak256 + let constants: [Field; MIMC_BN254_ROUNDS] = [ + 0, + 20888961410941983456478427210666206549300505294776164667214940546594746570981, + 15265126113435022738560151911929040668591755459209400716467504685752745317193, + 8334177627492981984476504167502758309043212251641796197711684499645635709656, + 1374324219480165500871639364801692115397519265181803854177629327624133579404, + 11442588683664344394633565859260176446561886575962616332903193988751292992472, + 2558901189096558760448896669327086721003508630712968559048179091037845349145, + 11189978595292752354820141775598510151189959177917284797737745690127318076389, + 3262966573163560839685415914157855077211340576201936620532175028036746741754, + 17029914891543225301403832095880481731551830725367286980611178737703889171730, + 4614037031668406927330683909387957156531244689520944789503628527855167665518, + 19647356996769918391113967168615123299113119185942498194367262335168397100658, + 5040699236106090655289931820723926657076483236860546282406111821875672148900, + 2632385916954580941368956176626336146806721642583847728103570779270161510514, + 17691411851977575435597871505860208507285462834710151833948561098560743654671, + 11482807709115676646560379017491661435505951727793345550942389701970904563183, + 8360838254132998143349158726141014535383109403565779450210746881879715734773, + 12663821244032248511491386323242575231591777785787269938928497649288048289525, + 3067001377342968891237590775929219083706800062321980129409398033259904188058, + 8536471869378957766675292398190944925664113548202769136103887479787957959589, + 19825444354178182240559170937204690272111734703605805530888940813160705385792, + 16703465144013840124940690347975638755097486902749048533167980887413919317592, + 13061236261277650370863439564453267964462486225679643020432589226741411380501, + 10864774797625152707517901967943775867717907803542223029967000416969007792571, + 10035653564014594269791753415727486340557376923045841607746250017541686319774, + 3446968588058668564420958894889124905706353937375068998436129414772610003289, + 4653317306466493184743870159523234588955994456998076243468148492375236846006, + 8486711143589723036499933521576871883500223198263343024003617825616410932026, + 250710584458582618659378487568129931785810765264752039738223488321597070280, + 2104159799604932521291371026105311735948154964200596636974609406977292675173, + 16313562605837709339799839901240652934758303521543693857533755376563489378839, + 6032365105133504724925793806318578936233045029919447519826248813478479197288, + 14025118133847866722315446277964222215118620050302054655768867040006542798474, + 7400123822125662712777833064081316757896757785777291653271747396958201309118, + 1744432620323851751204287974553233986555641872755053103823939564833813704825, + 8316378125659383262515151597439205374263247719876250938893842106722210729522, + 6739722627047123650704294650168547689199576889424317598327664349670094847386, + 21211457866117465531949733809706514799713333930924902519246949506964470524162, + 13718112532745211817410303291774369209520657938741992779396229864894885156527, + 5264534817993325015357427094323255342713527811596856940387954546330728068658, + 18884137497114307927425084003812022333609937761793387700010402412840002189451, + 5148596049900083984813839872929010525572543381981952060869301611018636120248, + 19799686398774806587970184652860783461860993790013219899147141137827718662674, + 19240878651604412704364448729659032944342952609050243268894572835672205984837, + 10546185249390392695582524554167530669949955276893453512788278945742408153192, + 5507959600969845538113649209272736011390582494851145043668969080335346810411, + 18177751737739153338153217698774510185696788019377850245260475034576050820091, + 19603444733183990109492724100282114612026332366576932662794133334264283907557, + 10548274686824425401349248282213580046351514091431715597441736281987273193140, + 1823201861560942974198127384034483127920205835821334101215923769688644479957, + 11867589662193422187545516240823411225342068709600734253659804646934346124945, + 18718569356736340558616379408444812528964066420519677106145092918482774343613, + 10530777752259630125564678480897857853807637120039176813174150229243735996839, + 20486583726592018813337145844457018474256372770211860618687961310422228379031, + 12690713110714036569415168795200156516217175005650145422920562694422306200486, + 17386427286863519095301372413760745749282643730629659997153085139065756667205, + 2216432659854733047132347621569505613620980842043977268828076165669557467682, + 6309765381643925252238633914530877025934201680691496500372265330505506717193, + 20806323192073945401862788605803131761175139076694468214027227878952047793390, + 4037040458505567977365391535756875199663510397600316887746139396052445718861, + 19948974083684238245321361840704327952464170097132407924861169241740046562673, + 845322671528508199439318170916419179535949348988022948153107378280175750024, + 16222384601744433420585982239113457177459602187868460608565289920306145389382, + 10232118865851112229330353999139005145127746617219324244541194256766741433339, + 6699067738555349409504843460654299019000594109597429103342076743347235369120, + 6220784880752427143725783746407285094967584864656399181815603544365010379208, + 6129250029437675212264306655559561251995722990149771051304736001195288083309, + 10773245783118750721454994239248013870822765715268323522295722350908043393604, + 4490242021765793917495398271905043433053432245571325177153467194570741607167, + 19596995117319480189066041930051006586888908165330319666010398892494684778526, + 837850695495734270707668553360118467905109360511302468085569220634750561083, + 11803922811376367215191737026157445294481406304781326649717082177394185903907, + 10201298324909697255105265958780781450978049256931478989759448189112393506592, + 13564695482314888817576351063608519127702411536552857463682060761575100923924, + 9262808208636973454201420823766139682381973240743541030659775288508921362724, + 173271062536305557219323722062711383294158572562695717740068656098441040230, + 18120430890549410286417591505529104700901943324772175772035648111937818237369, + 20484495168135072493552514219686101965206843697794133766912991150184337935627, + 19155651295705203459475805213866664350848604323501251939850063308319753686505, + 11971299749478202793661982361798418342615500543489781306376058267926437157297, + 18285310723116790056148596536349375622245669010373674803854111592441823052978, + 7069216248902547653615508023941692395371990416048967468982099270925308100727, + 6465151453746412132599596984628739550147379072443683076388208843341824127379, + 16143532858389170960690347742477978826830511669766530042104134302796355145785, + 19362583304414853660976404410208489566967618125972377176980367224623492419647, + 1702213613534733786921602839210290505213503664731919006932367875629005980493, + 10781825404476535814285389902565833897646945212027592373510689209734812292327, + 4212716923652881254737947578600828255798948993302968210248673545442808456151, + 7594017890037021425366623750593200398174488805473151513558919864633711506220, + 18979889247746272055963929241596362599320706910852082477600815822482192194401, + 13602139229813231349386885113156901793661719180900395818909719758150455500533 + ]; + + let mut r = 0; + for elem in array { + let h = mimc(elem, r, constants, exponent); + r = r + elem + h; + } + r +} diff --git a/noir/noir_stdlib/src/hash/poseidon.nr b/noir/noir_stdlib/src/hash/poseidon.nr new file mode 100644 index 00000000000..b3cb32cd357 --- /dev/null +++ b/noir/noir_stdlib/src/hash/poseidon.nr @@ -0,0 +1,95 @@ +mod bn254; // Instantiations of Poseidon for prime field of the same order as BN254 +use crate::field::modulus_num_bits; + +struct PoseidonConfig { + t: Field, // Width, i.e. state size + rf: u8, // Number of full rounds; should be even + rp: u8, // Number of partial rounds + alpha: Field, // S-box power; depends on the underlying field + ark: [Field; M], // Additive round keys + mds: [Field; N] // MDS Matrix in row-major order +} + +pub fn config(t: Field, rf: u8, rp: u8, alpha: Field, ark: [Field; M], mds: [Field; N]) -> PoseidonConfig { + // Input checks + let mul = crate::wrapping_mul(t as u8, (rf + rp)); + assert(mul == ark.len() as u8); + assert(t * t == mds.len()); + assert(alpha != 0); + + PoseidonConfig { t, rf, rp, alpha, ark, mds } +} +// General Poseidon permutation on elements of type Field +fn permute(pos_conf: PoseidonConfig, mut state: [Field; O]) -> [Field; O] { + let PoseidonConfig {t, rf, rp, alpha, ark, mds} = pos_conf; + + assert(t == state.len()); + + let mut count = 0; + // for r in 0..rf + rp + for r in 0..(ark.len() / state.len()) { + for i in 0..state.len() { + state[i] = state[i] + ark[count + i]; + } // Shift by round constants + state[0] = state[0].pow_32(alpha); + // Check whether we are in a full round + if (r as u8 < rf / 2) | (r as u8 >= rf / 2 + rp) { + for i in 1..state.len() { + state[i] = state[i].pow_32(alpha); + } + } + + state = apply_matrix(mds, state); // Apply MDS matrix + count = count + t; + } + + state +} +// Absorption. Fully absorbs input message. +fn absorb( + pos_conf: PoseidonConfig, + mut state: [Field; O], // Initial state; usually [0; O] + rate: Field, // Rate + capacity: Field, // Capacity; usually 1 + msg: [Field; P] +) -> [Field; O] { + assert(pos_conf.t == rate + capacity); + + let mut i = 0; + + for k in 0..msg.len() { + // Add current block to state + state[capacity + i] += msg[k]; + i = i+1; + // Enough to absorb + if i == rate { + state = permute(pos_conf, state); + i = 0; + } + } + // If we have one more block to permute + if i != 0 { + state = permute(pos_conf, state); + } + + state +} +// Check security of sponge instantiation +fn check_security(rate: Field, width: Field, security: Field) -> bool { + let n = modulus_num_bits(); + + ((n - 1) * (width - rate) / 2) as u8 > security as u8 +} +// A*x where A is an n x n matrix in row-major order and x an n-vector +fn apply_matrix(a: [Field; M], x: [Field; N]) -> [Field; N] { + let mut y = x; + + for i in 0..x.len() { + y[i] = 0; + for j in 0..x.len() { + y[i] = y[i] + a[x.len()*i + j]* x[j]; + } + } + + y +} diff --git a/noir/noir_stdlib/src/hash/poseidon/bn254.nr b/noir/noir_stdlib/src/hash/poseidon/bn254.nr new file mode 100644 index 00000000000..0db6d9546dc --- /dev/null +++ b/noir/noir_stdlib/src/hash/poseidon/bn254.nr @@ -0,0 +1,236 @@ +// Instantiations of Poseidon constants, permutations and sponge for prime field of the same order as BN254 +mod perm; +mod consts; + +use crate::hash::poseidon::PoseidonConfig; +use crate::hash::poseidon::apply_matrix; +// Optimised permutation for this particular field; uses hardcoded rf and rp values, +// which should agree with those in pos_conf. +#[field(bn254)] +pub fn permute(pos_conf: PoseidonConfig, mut state: [Field; O]) -> [Field; O] { + let PoseidonConfig {t, rf: config_rf, rp: config_rp, alpha, ark, mds} = pos_conf; + let rf = 8; + let rp = [56, 57, 56, 60, 60, 63, 64, 63, 60, 66, 60, 65, 70, 60, 64, 68][state.len() - 2]; + + assert(t == state.len()); + assert(rf == config_rf as Field); + assert(rp == config_rp as Field); + + let mut count = 0; + // First half of full rounds + for _r in 0..rf / 2 { + for i in 0..state.len() { + state[i] = state[i] + ark[count + i]; + } // Shift by round constants + for i in 0..state.len() { + state[i] = state[i].pow_32(alpha); + } + + state = apply_matrix(mds, state); // Apply MDS matrix + count = count + t; + } + // Partial rounds + for _r in 0..rp { + for i in 0..state.len() { + state[i] = state[i] + ark[count + i]; + } // Shift by round constants + state[0] = state[0].pow_32(alpha); + + state = apply_matrix(mds, state); // Apply MDS matrix + count = count + t; + } + // Second half of full rounds + for _r in 0..rf / 2 { + for i in 0..state.len() { + state[i] = state[i] + ark[count + i]; + } // Shift by round constants + for i in 0..state.len() { + state[i] = state[i].pow_32(alpha); + } + + state = apply_matrix(mds, state); // Apply MDS matrix + count = count + t; + } + + state +} +// Corresponding absorption. +#[field(bn254)] +fn absorb( + pos_conf: PoseidonConfig, + mut state: [Field; O], // Initial state; usually [0; O] + rate: Field, // Rate + capacity: Field, // Capacity; usually 1 + msg: [Field; P] // Arbitrary length message +) -> [Field; O] { + assert(pos_conf.t == rate + capacity); + + let mut i = 0; + + for k in 0..msg.len() { + // Add current block to state + state[capacity + i] += msg[k]; + i = i+1; + // Enough to absorb + if i == rate { + state = permute(pos_conf, state); + i = 0; + } + } + // If we have one more block to permute + if i != 0 { + state = permute(pos_conf, state); + } + + state +} +// Variable-length Poseidon-128 sponge as suggested in second bullet point of §3 of https://eprint.iacr.org/2019/458.pdf +#[field(bn254)] +pub fn sponge(msg: [Field; N]) -> Field { + absorb(consts::x5_5_config(), [0; 5], 4, 1, msg)[1] +} +// Various instances of the Poseidon hash function +// Consistent with Circom's implementation +pub fn hash_1(input: [Field; 1]) -> Field { + let mut state = [0; 2]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_2(state)[0] +} + +pub fn hash_2(input: [Field; 2]) -> Field { + let mut state = [0; 3]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_3(state)[0] +} + +pub fn hash_3(input: [Field; 3]) -> Field { + let mut state = [0; 4]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_4(state)[0] +} + +pub fn hash_4(input: [Field; 4]) -> Field { + let mut state = [0; 5]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_5(state)[0] +} + +pub fn hash_5(input: [Field; 5]) -> Field { + let mut state = [0; 6]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_6(state)[0] +} + +pub fn hash_6(input: [Field; 6]) -> Field { + let mut state = [0; 7]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_7(state)[0] +} + +pub fn hash_7(input: [Field; 7]) -> Field { + let mut state = [0; 8]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_8(state)[0] +} + +pub fn hash_8(input: [Field; 8]) -> Field { + let mut state = [0; 9]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_9(state)[0] +} + +pub fn hash_9(input: [Field; 9]) -> Field { + let mut state = [0; 10]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_10(state)[0] +} + +pub fn hash_10(input: [Field; 10]) -> Field { + let mut state = [0; 11]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_11(state)[0] +} + +pub fn hash_11(input: [Field; 11]) -> Field { + let mut state = [0; 12]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_12(state)[0] +} + +pub fn hash_12(input: [Field; 12]) -> Field { + let mut state = [0; 13]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_13(state)[0] +} + +pub fn hash_13(input: [Field; 13]) -> Field { + let mut state = [0; 14]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_14(state)[0] +} + +pub fn hash_14(input: [Field; 14]) -> Field { + let mut state = [0; 15]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_15(state)[0] +} + +pub fn hash_15(input: [Field; 15]) -> Field { + let mut state = [0; 16]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_16(state)[0] +} + +pub fn hash_16(input: [Field; 16]) -> Field { + let mut state = [0; 17]; + for i in 0..input.len() { + state[i+1] = input[i]; + } + + perm::x5_17(state)[0] +} diff --git a/noir/noir_stdlib/src/hash/poseidon/bn254/consts.nr b/noir/noir_stdlib/src/hash/poseidon/bn254/consts.nr new file mode 100644 index 00000000000..62b5f4b5212 --- /dev/null +++ b/noir/noir_stdlib/src/hash/poseidon/bn254/consts.nr @@ -0,0 +1,192 @@ +// Constants for various Poseidon instances in the case of the prime field of the same order as BN254. +// Consistent with https://github.com/iden3/circomlib/blob/master/circuits/poseidon.circom and https://github.com/iden3/circomlib/blob/master/circuits/poseidon_constants.circom +use crate::hash::poseidon::PoseidonConfig; +use crate::hash::poseidon::config; +// Number of full rounds +global rf = 8; +// Number of partial rounds +fn rp() -> [u8; 16] { + [56, 57, 56, 60, 60, 63, 64, 63, 60, 66, 60, 65, 70, 60, 64, 68] +} +// S-box power +fn alpha() -> Field { + 5 +} +// Poseidon configurations for states of size 2 to 17. +// noir-fmt:ignore +pub fn x5_2_config() -> PoseidonConfig<128, 4> { + config( + 2, + 8, + 56, + alpha(), + [4417881134626180770308697923359573201005643519861877412381846989312604493735,5433650512959517612316327474713065966758808864213826738576266661723522780033,13641176377184356099764086973022553863760045607496549923679278773208775739952,17949713444224994136330421782109149544629237834775211751417461773584374506783,13765628375339178273710281891027109699578766420463125835325926111705201856003,19179513468172002314585757290678967643352171735526887944518845346318719730387,5157412437176756884543472904098424903141745259452875378101256928559722612176,535160875740282236955320458485730000677124519901643397458212725410971557409,1050793453380762984940163090920066886770841063557081906093018330633089036729,10665495010329663932664894101216428400933984666065399374198502106997623173873,19965634623406616956648724894636666805991993496469370618546874926025059150737,13007250030070838431593222885902415182312449212965120303174723305710127422213,16877538715074991604507979123743768693428157847423939051086744213162455276374,18211747749504876135588847560312685184956239426147543810126553367063157141465,18151553319826126919739798892854572062191241985315767086020821632812331245635,19957033149976712666746140949846950406660099037474791840946955175819555930825,3469514863538261843186854830917934449567467100548474599735384052339577040841,989698510043911779243192466312362856042600749099921773896924315611668507708,12568377015646290945235387813564567111330046038050864455358059568128000172201,20856104135605479600325529349246932565148587186338606236677138505306779314172,8206918720503535523121349917159924938835810381723474192155637697065780938424,1309058477013932989380617265069188723120054926187607548493110334522527703566,14076116939332667074621703729512195584105250395163383769419390236426287710606,10153498892749751942204288991871286290442690932856658983589258153608012428674,18202499207234128286137597834010475797175973146805180988367589376893530181575,12739388830157083522877690211447248168864006284243907142044329113461613743052,15123358710467780770838026754240340042441262572309759635224051333176022613949,19925004701844594370904593774447343836015483888496504201331110250494635362184,10352416606816998476681131583320899030072315953910679608943150613208329645891,10567371822366244361703342347428230537114808440249611395507235283708966113221,5635498582763880627392290206431559361272660937399944184533035305989295959602,11866432933224219174041051738704352719163271639958083608224676028593315904909,5795020705294401441272215064554385591292330721703923167136157291459784140431,9482202378699252817564375087302794636287866584767523335624368774856230692758,4245237636894546151746468406560945873445548423466753843402086544922216329298,12000500941313982757584712677991730019124834399479314697467598397927435905133,7596790274058425558167520209857956363736666939016807569082239187494363541787,2484867918246116343205467273440098378820186751202461278013576281097918148877,18312645949449997391810445935615409295369169383463185688973803378104013950190,15320686572748723004980855263301182130424010735782762814513954166519592552733,12618438900597948888520621062416758747872180395546164387827245287017031303859,17438141672027706116733201008397064011774368832458707512367404736905021019585,6374197807230665998865688675365359100400438034755781666913068586172586548950,2189398913433273865510950346186699930188746169476472274335177556702504595264,6268495580028970231803791523870131137294646402347399003576649137450213034606,17896250365994900261202920044129628104272791547990619503076839618914047059275,13692156312448722528008862371944543449350293305158722920787736248435893008873,15234446864368744483209945022439268713300180233589581910497691316744177619376,1572426502623310766593681563281600503979671244997798691029595521622402217227,80103447810215150918585162168214870083573048458555897999822831203653996617,8228820324013669567851850635126713973797711779951230446503353812192849106342,5375851433746509614045812476958526065449377558695752132494533666370449415873,12115998939203497346386774317892338270561208357481805380546938146796257365018,9764067909645821279940531410531154041386008396840887338272986634350423466622,8538708244538850542384936174629541085495830544298260335345008245230827876882,7140127896620013355910287215441004676619168261422440177712039790284719613114,14297402962228458726038826185823085337698917275385741292940049024977027409762,6667115556431351074165934212337261254608231545257434281887966406956835140819,20226761165244293291042617464655196752671169026542832236139342122602741090001,12038289506489256655759141386763477208196694421666339040483042079632134429119,19027757334170818571203982241812412991528769934917288000224335655934473717551,16272152964456553579565580463468069884359929612321610357528838696790370074720,2500392889689246014710135696485946334448570271481948765283016105301740284071,8595254970528530312401637448610398388203855633951264114100575485022581946023,11635945688914011450976408058407206367914559009113158286982919675551688078198,614739068603482619581328040478536306925147663946742687395148680260956671871,18692271780377861570175282183255720350972693125537599213951106550953176268753,4987059230784976306647166378298632695585915319042844495357753339378260807164,21851403978498723616722415377430107676258664746210815234490134600998983955497,9830635451186415300891533983087800047564037813328875992115573428596207326204,4842706106434537116860242620706030229206345167233200482994958847436425185478,6422235064906823218421386871122109085799298052314922856340127798647926126490,4564364104986856861943331689105797031330091877115997069096365671501473357846,1944043894089780613038197112872830569538541856657037469098448708685350671343,21179865974855950600518216085229498748425990426231530451599322283119880194955,14296697761894107574369608843560006996183955751502547883167824879840894933162,12274619649702218570450581712439138337725246879938860735460378251639845671898,16371396450276899401411886674029075408418848209575273031725505038938314070356,3702561221750983937578095019779188631407216522704543451228773892695044653565,19721616877735564664624984774636557499099875603996426215495516594530838681980,6383350109027696789969911008057747025018308755462287526819231672217685282429,20860583956177367265984596617324237471765572961978977333122281041544719622905,5766390934595026947545001478457407504285452477687752470140790011329357286275,4043175758319898049344746138515323336207420888499903387536875603879441092484,15579382179133608217098622223834161692266188678101563820988612253342538956534,1864640783252634743892105383926602930909039567065240010338908865509831749824,15943719865023133586707144161652035291705809358178262514871056013754142625673,2326415993032390211558498780803238091925402878871059708106213703504162832999,19995326402773833553207196590622808505547443523750970375738981396588337910289,5143583711361588952673350526320181330406047695593201009385718506918735286622,15436006486881920976813738625999473183944244531070780793506388892313517319583,16660446760173633166698660166238066533278664023818938868110282615200613695857,4966065365695755376133119391352131079892396024584848298231004326013366253934,20683781957411705574951987677641476019618457561419278856689645563561076926702,17280836839165902792086432296371645107551519324565649849400948918605456875699,17045635513701208892073056357048619435743564064921155892004135325530808465371,17055032967194400710390142791334572297458033582458169295920670679093585707295,15727174639569115300068198908071514334002742825679221638729902577962862163505,1001755657610446661315902885492677747789366510875120894840818704741370398633,18638547332826171619311285502376343504539399518545103511265465604926625041234,6751954224763196429755298529194402870632445298969935050224267844020826420799,3526747115904224771452549517614107688674036840088422555827581348280834879405,15705897908180497062880001271426561999724005008972544196300715293701537574122,574386695213920937259007343820417029802510752426579750428758189312416867750,15973040855000600860816974646787367136127946402908768408978806375685439868553,20934130413948796333037139460875996342810005558806621330680156931816867321122,6918585327145564636398173845411579411526758237572034236476079610890705810764,14158163500813182062258176233162498241310167509137716527054939926126453647182,4164602626597695668474100217150111342272610479949122406544277384862187287433,12146526846507496913615390662823936206892812880963914267275606265272996025304,10153527926900017763244212043512822363696541810586522108597162891799345289938,13564663485965299104296214940873270349072051793008946663855767889066202733588,5612449256997576125867742696783020582952387615430650198777254717398552960096,12151885480032032868507892738683067544172874895736290365318623681886999930120,380452237704664384810613424095477896605414037288009963200982915188629772177,9067557551252570188533509616805287919563636482030947363841198066124642069518,21280306817619711661335268484199763923870315733198162896599997188206277056900,5567165819557297006750252582140767993422097822227408837378089569369734876257,10411936321072105429908396649383171465939606386380071222095155850987201580137,21338390051413922944780864872652000187403217966653363270851298678606449622266,12156296560457833712186127325312904760045212412680904475497938949653569234473,4271647814574748734312113971565139132510281260328947438246615707172526380757,9061738206062369647211128232833114177054715885442782773131292534862178874950,10134551893627587797380445583959894183158393780166496661696555422178052339133,8932270237664043612366044102088319242789325050842783721780970129656616386103,3339412934966886386194449782756711637636784424032779155216609410591712750636,9704903972004596791086522314847373103670545861209569267884026709445485704400,17467570179597572575614276429760169990940929887711661192333523245667228809456], + [2910766817845651019878574839501801340070030115151021261302834310722729507541,19727366863391167538122140361473584127147630672623100827934084310230022599144,5776684794125549462448597414050232243778680302179439492664047328281728356345,8348174920934122550483593999453880006756108121341067172388445916328941978568] + ) + +} +// noir-fmt:ignore +pub fn x5_3_config() -> PoseidonConfig<195, 9> { + config( + 3, + 8, + 57, + 5, + [6745197990210204598374042828761989596302876299545964402857411729872131034734,426281677759936592021316809065178817848084678679510574715894138690250139748,4014188762916583598888942667424965430287497824629657219807941460227372577781,21328925083209914769191926116470334003273872494252651254811226518870906634704,19525217621804205041825319248827370085205895195618474548469181956339322154226,1402547928439424661186498190603111095981986484908825517071607587179649375482,18320863691943690091503704046057443633081959680694199244583676572077409194605,17709820605501892134371743295301255810542620360751268064484461849423726103416,15970119011175710804034336110979394557344217932580634635707518729185096681010,9818625905832534778628436765635714771300533913823445439412501514317783880744,6235167673500273618358172865171408902079591030551453531218774338170981503478,12575685815457815780909564540589853169226710664203625668068862277336357031324,7381963244739421891665696965695211188125933529845348367882277882370864309593,14214782117460029685087903971105962785460806586237411939435376993762368956406,13382692957873425730537487257409819532582973556007555550953772737680185788165,2203881792421502412097043743980777162333765109810562102330023625047867378813,2916799379096386059941979057020673941967403377243798575982519638429287573544,4341714036313630002881786446132415875360643644216758539961571543427269293497,2340590164268886572738332390117165591168622939528604352383836760095320678310,5222233506067684445011741833180208249846813936652202885155168684515636170204,7963328565263035669460582454204125526132426321764384712313576357234706922961,1394121618978136816716817287892553782094854454366447781505650417569234586889,20251767894547536128245030306810919879363877532719496013176573522769484883301,141695147295366035069589946372747683366709960920818122842195372849143476473,15919677773886738212551540894030218900525794162097204800782557234189587084981,2616624285043480955310772600732442182691089413248613225596630696960447611520,4740655602437503003625476760295930165628853341577914460831224100471301981787,19201590924623513311141753466125212569043677014481753075022686585593991810752,12116486795864712158501385780203500958268173542001460756053597574143933465696,8481222075475748672358154589993007112877289817336436741649507712124418867136,5181207870440376967537721398591028675236553829547043817076573656878024336014,1576305643467537308202593927724028147293702201461402534316403041563704263752,2555752030748925341265856133642532487884589978209403118872788051695546807407,18840924862590752659304250828416640310422888056457367520753407434927494649454,14593453114436356872569019099482380600010961031449147888385564231161572479535,20826991704411880672028799007667199259549645488279985687894219600551387252871,9159011389589751902277217485643457078922343616356921337993871236707687166408,5605846325255071220412087261490782205304876403716989785167758520729893194481,1148784255964739709393622058074925404369763692117037208398835319441214134867,20945896491956417459309978192328611958993484165135279604807006821513499894540,229312996389666104692157009189660162223783309871515463857687414818018508814,21184391300727296923488439338697060571987191396173649012875080956309403646776,21853424399738097885762888601689700621597911601971608617330124755808946442758,12776298811140222029408960445729157525018582422120161448937390282915768616621,7556638921712565671493830639474905252516049452878366640087648712509680826732,19042212131548710076857572964084011858520620377048961573689299061399932349935,12871359356889933725034558434803294882039795794349132643274844130484166679697,3313271555224009399457959221795880655466141771467177849716499564904543504032,15080780006046305940429266707255063673138269243146576829483541808378091931472,21300668809180077730195066774916591829321297484129506780637389508430384679582,20480395468049323836126447690964858840772494303543046543729776750771407319822,10034492246236387932307199011778078115444704411143703430822959320969550003883,19584962776865783763416938001503258436032522042569001300175637333222729790225,20155726818439649091211122042505326538030503429443841583127932647435472711802,13313554736139368941495919643765094930693458639277286513236143495391474916777,14606609055603079181113315307204024259649959674048912770003912154260692161833,5563317320536360357019805881367133322562055054443943486481491020841431450882,10535419877021741166931390532371024954143141727751832596925779759801808223060,12025323200952647772051708095132262602424463606315130667435888188024371598063,2906495834492762782415522961458044920178260121151056598901462871824771097354,19131970618309428864375891649512521128588657129006772405220584460225143887876,8896386073442729425831367074375892129571226824899294414632856215758860965449,7748212315898910829925509969895667732958278025359537472413515465768989125274,422974903473869924285294686399247660575841594104291551918957116218939002865,6398251826151191010634405259351528880538837895394722626439957170031528482771,18978082967849498068717608127246258727629855559346799025101476822814831852169,19150742296744826773994641927898928595714611370355487304294875666791554590142,12896891575271590393203506752066427004153880610948642373943666975402674068209,9546270356416926575977159110423162512143435321217584886616658624852959369669,2159256158967802519099187112783460402410585039950369442740637803310736339200,8911064487437952102278704807713767893452045491852457406400757953039127292263,745203718271072817124702263707270113474103371777640557877379939715613501668,19313999467876585876087962875809436559985619524211587308123441305315685710594,13254105126478921521101199309550428567648131468564858698707378705299481802310,1842081783060652110083740461228060164332599013503094142244413855982571335453,9630707582521938235113899367442877106957117302212260601089037887382200262598,5066637850921463603001689152130702510691309665971848984551789224031532240292,4222575506342961001052323857466868245596202202118237252286417317084494678062,2919565560395273474653456663643621058897649501626354982855207508310069954086,6828792324689892364977311977277548750189770865063718432946006481461319858171,2245543836264212411244499299744964607957732316191654500700776604707526766099,19602444885919216544870739287153239096493385668743835386720501338355679311704,8239538512351936341605373169291864076963368674911219628966947078336484944367,15053013456316196458870481299866861595818749671771356646798978105863499965417,7173615418515925804810790963571435428017065786053377450925733428353831789901,8239211677777829016346247446855147819062679124993100113886842075069166957042,15330855478780269194281285878526984092296288422420009233557393252489043181621,10014883178425964324400942419088813432808659204697623248101862794157084619079,14014440630268834826103915635277409547403899966106389064645466381170788813506,3580284508947993352601712737893796312152276667249521401778537893620670305946,2559754020964039399020874042785294258009596917335212876725104742182177996988,14898657953331064524657146359621913343900897440154577299309964768812788279359,2094037260225570753385567402013028115218264157081728958845544426054943497065,18051086536715129874440142649831636862614413764019212222493256578581754875930,21680659279808524976004872421382255670910633119979692059689680820959727969489,13950668739013333802529221454188102772764935019081479852094403697438884885176,9703845704528288130475698300068368924202959408694460208903346143576482802458,12064310080154762977097567536495874701200266107682637369509532768346427148165,16970760937630487134309762150133050221647250855182482010338640862111040175223,9790997389841527686594908620011261506072956332346095631818178387333642218087,16314772317774781682315680698375079500119933343877658265473913556101283387175,82044870826814863425230825851780076663078706675282523830353041968943811739,21696416499108261787701615667919260888528264686979598953977501999747075085778,327771579314982889069767086599893095509690747425186236545716715062234528958,4606746338794869835346679399457321301521448510419912225455957310754258695442,64499140292086295251085369317820027058256893294990556166497635237544139149,10455028514626281809317431738697215395754892241565963900707779591201786416553,10421411526406559029881814534127830959833724368842872558146891658647152404488,18848084335930758908929996602136129516563864917028006334090900573158639401697,13844582069112758573505569452838731733665881813247931940917033313637916625267,13488838454403536473492810836925746129625931018303120152441617863324950564617,15742141787658576773362201234656079648895020623294182888893044264221895077688,6756884846734501741323584200608866954194124526254904154220230538416015199997,7860026400080412708388991924996537435137213401947704476935669541906823414404,7871040688194276447149361970364037034145427598711982334898258974993423182255,20758972836260983284101736686981180669442461217558708348216227791678564394086,21723241881201839361054939276225528403036494340235482225557493179929400043949,19428469330241922173653014973246050805326196062205770999171646238586440011910,7969200143746252148180468265998213908636952110398450526104077406933642389443,10950417916542216146808986264475443189195561844878185034086477052349738113024,18149233917533571579549129116652755182249709970669448788972210488823719849654,3729796741814967444466779622727009306670204996071028061336690366291718751463,5172504399789702452458550583224415301790558941194337190035441508103183388987,6686473297578275808822003704722284278892335730899287687997898239052863590235,19426913098142877404613120616123695099909113097119499573837343516470853338513,5120337081764243150760446206763109494847464512045895114970710519826059751800,5055737465570446530938379301905385631528718027725177854815404507095601126720,14235578612970484492268974539959119923625505766550088220840324058885914976980,653592517890187950103239281291172267359747551606210609563961204572842639923,5507360526092411682502736946959369987101940689834541471605074817375175870579,7864202866011437199771472205361912625244234597659755013419363091895334445453,21294659996736305811805196472076519801392453844037698272479731199885739891648,13767183507040326119772335839274719411331242166231012705169069242737428254651,810181532076738148308457416289197585577119693706380535394811298325092337781,14232321930654703053193240133923161848171310212544136614525040874814292190478,16796904728299128263054838299534612533844352058851230375569421467352578781209,16256310366973209550759123431979563367001604350120872788217761535379268327259,19791658638819031543640174069980007021961272701723090073894685478509001321817,7046232469803978873754056165670086532908888046886780200907660308846356865119,16001732848952745747636754668380555263330934909183814105655567108556497219752,9737276123084413897604802930591512772593843242069849260396983774140735981896,11410895086919039954381533622971292904413121053792570364694836768885182251535,19098362474249267294548762387533474746422711206129028436248281690105483603471,11013788190750472643548844759298623898218957233582881400726340624764440203586,2206958256327295151076063922661677909471794458896944583339625762978736821035,7171889270225471948987523104033632910444398328090760036609063776968837717795,2510237900514902891152324520472140114359583819338640775472608119384714834368,8825275525296082671615660088137472022727508654813239986303576303490504107418,1481125575303576470988538039195271612778457110700618040436600537924912146613,16268684562967416784133317570130804847322980788316762518215429249893668424280,4681491452239189664806745521067158092729838954919425311759965958272644506354,3131438137839074317765338377823608627360421824842227925080193892542578675835,7930402370812046914611776451748034256998580373012248216998696754202474945793,8973151117361309058790078507956716669068786070949641445408234962176963060145,10223139291409280771165469989652431067575076252562753663259473331031932716923,2232089286698717316374057160056566551249777684520809735680538268209217819725,16930089744400890347392540468934821520000065594669279286854302439710657571308,21739597952486540111798430281275997558482064077591840966152905690279247146674,7508315029150148468008716674010060103310093296969466203204862163743615534994,11418894863682894988747041469969889669847284797234703818032750410328384432224,10895338268862022698088163806301557188640023613155321294365781481663489837917,18644184384117747990653304688839904082421784959872380449968500304556054962449,7414443845282852488299349772251184564170443662081877445177167932875038836497,5391299369598751507276083947272874512197023231529277107201098701900193273851,10329906873896253554985208009869159014028187242848161393978194008068001342262,4711719500416619550464783480084256452493890461073147512131129596065578741786,11943219201565014805519989716407790139241726526989183705078747065985453201504,4298705349772984837150885571712355513879480272326239023123910904259614053334,9999044003322463509208400801275356671266978396985433172455084837770460579627,4908416131442887573991189028182614782884545304889259793974797565686968097291,11963412684806827200577486696316210731159599844307091475104710684559519773777,20129916000261129180023520480843084814481184380399868943565043864970719708502,12884788430473747619080473633364244616344003003135883061507342348586143092592,20286808211545908191036106582330883564479538831989852602050135926112143921015,16282045180030846845043407450751207026423331632332114205316676731302016331498,4332932669439410887701725251009073017227450696965904037736403407953448682093,11105712698773407689561953778861118250080830258196150686012791790342360778288,21853934471586954540926699232107176721894655187276984175226220218852955976831,9807888223112768841912392164376763820266226276821186661925633831143729724792,13411808896854134882869416756427789378942943805153730705795307450368858622668,17906847067500673080192335286161014930416613104209700445088168479205894040011,14554387648466176616800733804942239711702169161888492380425023505790070369632,4264116751358967409634966292436919795665643055548061693088119780787376143967,2401104597023440271473786738539405349187326308074330930748109868990675625380,12251645483867233248963286274239998200789646392205783056343767189806123148785,15331181254680049984374210433775713530849624954688899814297733641575188164316,13108834590369183125338853868477110922788848506677889928217413952560148766472,6843160824078397950058285123048455551935389277899379615286104657075620692224,10151103286206275742153883485231683504642432930275602063393479013696349676320,7074320081443088514060123546121507442501369977071685257650287261047855962224,11413928794424774638606755585641504971720734248726394295158115188173278890938,7312756097842145322667451519888915975561412209738441762091369106604423801080,7181677521425162567568557182629489303281861794357882492140051324529826589361,15123155547166304758320442783720138372005699143801247333941013553002921430306,13409242754315411433193860530743374419854094495153957441316635981078068351329], + [7511745149465107256748700652201246547602992235352608707588321460060273774987,10370080108974718697676803824769673834027675643658433702224577712625900127200,19705173408229649878903981084052839426532978878058043055305024233888854471533,18732019378264290557468133440468564866454307626475683536618613112504878618481,20870176810702568768751421378473869562658540583882454726129544628203806653987,7266061498423634438633389053804536045105766754026813321943009179476902321146,9131299761947733513298312097611845208338517739621853568979632113419485819303,10595341252162738537912664445405114076324478519622938027420701542910180337937,11597556804922396090267472882856054602429588299176362916247939723151043581408]) + +} +// noir-fmt:ignore +pub fn x5_4_config() -> PoseidonConfig<256, 16> { + config( + 4, + 8, + 56, + alpha(), + [11633431549750490989983886834189948010834808234699737327785600195936805266405,17353750182810071758476407404624088842693631054828301270920107619055744005334,11575173631114898451293296430061690731976535592475236587664058405912382527658,9724643380371653925020965751082872123058642683375812487991079305063678725624,20936725237749945635418633443468987188819556232926135747685274666391889856770,6427758822462294912934022562310355233516927282963039741999349770315205779230,16782979953202249973699352594809882974187694538612412531558950864304931387798,8979171037234948998646722737761679613767384188475887657669871981433930833742,5428827536651017352121626533783677797977876323745420084354839999137145767736,507241738797493565802569310165979445570507129759637903167193063764556368390,6711578168107599474498163409443059675558516582274824463959700553865920673097,2197359304646916921018958991647650011119043556688567376178243393652789311643,4634703622846121403803831560584049007806112989824652272428991253572845447400,17008376818199175111793852447685303011746023680921106348278379453039148937791,18430784755956196942937899353653692286521408688385681805132578732731487278753,4573768376486344895797915946239137669624900197544620153250805961657870918727,5624865188680173294191042415227598609140934495743721047183803859030618890703,8228252753786907198149068514193371173033070694924002912950645971088002709521,17586714789554691446538331362711502394998837215506284064347036653995353304693,12985198716830497423350597750558817467658937953000235442251074063454897365701,13480076116139680784838493959937969792577589073830107110893279354229821035984,480609231761423388761863647137314056373740727639536352979673303078459561332,19503345496799249258956440299354839375920540225688429628121751361906635419276,16837818502122887883669221005435922946567532037624537243846974433811447595173,5492108497278641078569490709794391352213168666744080628008171695469579703581,11365311159988448419785032079155356000691294261495515880484003277443744617083,13876891705632851072613751905778242936713392247975808888614530203269491723653,10660388389107698747692475159023710744797290186015856503629656779989214850043,18876318870401623474401728758498150977988613254023317877612912724282285739292,15543349138237018307536452195922365893694804703361435879256942490123776892424,2839988449157209999638903652853828318645773519300826410959678570041742458201,7566039810305694135184226097163626060317478635973510706368412858136696413063,6344830340705033582410486810600848473125256338903726340728639711688240744220,12475357769019880256619207099578191648078162511547701737481203260317463892731,13337401254840718303633782478677852514218549070508887338718446132574012311307,21161869193849404954234950798647336336709035097706159414187214758702055364571,20671052961616073313397254362345395594858011165315285344464242404604146448678,2772189387845778213446441819361180378678387127454165972767013098872140927416,3339032002224218054945450150550795352855387702520990006196627537441898997147,14919705931281848425960108279746818433850049439186607267862213649460469542157,17056699976793486403099510941807022658662936611123286147276760381688934087770,16144580075268719403964467603213740327573316872987042261854346306108421013323,15582343953927413680541644067712456296539774919658221087452235772880573393376,17528510080741946423534916423363640132610906812668323263058626230135522155749,3190600034239022251529646836642735752388641846393941612827022280601486805721,8463814172152682468446984305780323150741498069701538916468821815030498611418,16533435971270903741871235576178437313873873358463959658178441562520661055273,11845696835505436397913764735273748291716405946246049903478361223369666046634,18391057370973634202531308463652130631065370546571735004701144829951670507215,262537877325812689820791215463881982531707709719292538608229687240243203710,2187234489894387585309965540987639130975753519805550941279098789852422770021,19189656350920455659006418422409390013967064310525314160026356916172976152967,15839474183930359560478122372067744245080413846070743460407578046890458719219,1805019124769763805045852541831585930225376844141668951787801647576910524592,323592203814803486950280155834638828455175703393817797003361354810251742052,9780393509796825017346015868945480913627956475147371732521398519483580624282,14009429785059642386335012561867511048847749030947687313594053997432177705759,13749550162460745037234826077137388777330401847577727796245150843898019635981,19497187499283431845443758879472819384797584633472792651343926414232528405311,3708428802547661961864524194762556064568867603968214870300574294082023305587,1339414413482882567499652761996854155383863472782829777976929310155400981782,6396261245879814100794661157306877072718690153118140891315137894471052482309,2069661495404347929962833138824526893650803079024564477269192079629046031674,15793521554502133342917616035884588152451122589545915605459159078589855944361,17053424498357819626596285492499512504457128907932827007302385782133229252374,13658536470391360399708067455536748955260723760813498481671323619545320978896,21546095668130239633971575351786704948662094117932406102037724221634677838565,21411726238386979516934941789127061362496195649331822900487557574597304399109,1944776378988765673004063363506638781964264107780425928778257145151172817981,15590719714223718537172639598316570285163081746016049278954513732528516468773,1351266421179051765004709939353170430290500926943038391678843253157009556309,6772476224477167317130064764757502335545080109882028900432703947986275397548,10670120969725161535937685539136065944959698664551200616467222887025111751992,4731853626374224678749618809759140702342195350742653173378450474772131006181,14473527495914528513885847341981310373531349450901830749157165104135412062812,16937191362061486658876740597821783333355021670608822932942683228741190786143,5656559696428674390125424316117443507583679061659043998559560535270557939546,8897648276515725841133578021896617755369443750194849587616503841335248902806,14938684446722672719637788054570691068799510611164812175626676768545923371470,15284149043690546115252102390417391226617211133644099356880071475803043461465,2623479025068612775740107497276979457946709347831661908218182874823658838107,6809791961761836061129379546794905411734858375517368211894790874813684813988,2417620338751920563196799065781703780495622795713803712576790485412779971775,4445143310792944321746901285176579692343442786777464604312772017806735512661,1429019233589939118995503267516676481141938536269008901607126781291273208629,19874283200702583165110559932895904979843482162236139561356679724680604144459,13426632171723830006915194799390005513190035492503509233177687891041405113055,10582332261829184460912611488470654685922576576939233092337240630493625631748,21233753931561918964692715735079738969202507286592442257083521969358109931739,15570526832729960536088203016939646235070527502823725736220985057263010426410,9379993197409194016084018867205217180276068758980710078281820842068357746159,20771047769547788232530761122022227554484215799917531852224053856574439035591,20468066117407230615347036860121267564735050776924839007390915936603720868039,5488458379783632930817704196671117722181776789793038046303454621235628350505,1394272944960494549436156060041871735938329188644910029274839018389507786995,5147716541319265558364686380685869814344975511061045836883803841066664401308,14583556014436264794011679557180458872925270147116325433110111823036572987256,11881598145635709076820802010238799308467020773223027240974808290357539410246,1566675577370566803714158020143436746360531503329117352692311127363508063658,212097210828847555076368799807292486212366234848453077606919035866276438405,7447795983723838393344606913699113402588250391491430720006009618589586043349,7626475329478847982857743246276194948757851985510858890691733676098590062312,148936322117705719734052984176402258788283488576388928671173547788498414614,15456385653678559339152734484033356164266089951521103188900320352052358038156,18207029603568083031075933940507782729612798852390383193518574746240484434885,2783356767974552799246444090988849933848968900471538294757665724820698962027,2721136724873145834448711197875719736776242904173494370334510875996324906822,2101139679159828164567502977338446902934095964116292264803779234163802308621,8995221857405946029753863203034191016106353727035116779995228902499254557482,502050382895618998241481591846956281507455925731652006822624065608151015665,4998642074447347292230083981705092465562944918178587362047610976950173759150,9349925422548495396957991080641322437286312278286826683803695584372829655908,11780347248050333407713097022607360765169543706092266937432199545936788840710,17875657248128792902343900636176628524337469245418171053476833541334867949063,10366707960411170224546487410133378396211437543372531210718212258701730218585,16918708725327525329474486073529093971911689155838787615544405646587858805834,18845394288827839099791436411179859406694814287249240544635770075956540806104,9838806160073701591447223014625214979004281138811495046618998465898136914308,10285680425916086863571101560978592912547567902925573205991454216988033815759,1292119286233210185026381033809498665433650491423040630240164455269575958565,2665524343601461489082054230426835550060387413710679950970616347092017688857,13502286133892103192305476866434484921895765252706158317341618311553476426306,686854655578191041672292972738875170071982317195092845673566320025160026512,9315942923163981372372434957632152754092082859001311184186702151150554806508,17166793131238158480636170455452575971861309825745828685724097210995239015581,4443784618760852757287735236046535266034706880634443644576653970979377878608,21470445782021672615018345703580059646973568891521510437236903770708690160080,6932852445473908850835611723958058203645654625170962537129706393570586565567,17078326120157725640173982185667969009350208542843294226397809921509565607842,19251873001736801921864956728611772738233338338726553113352118847732921831266,13062907978694932362695258750558734366820802962383346229947907261606619788585,16576609187793673559170206379939616900133457644695219057683704871664434872406,17140499059660867342372156843620845644831519603574612796639429147195776838516,16226688173010504218547945848523900236290532501559570164276462499487632388445,2806068123803905806401128967330263340459046260107112845068533446899070326517,17788735370835052317224182711467216134690146479710634688273650370951230404901,9840665370904113434661468973557421114403401847108482949465899631150766783733,17357287363046228581837055771327121704742940914150998420465281177406182088510,8956082469997974864521346025916496675956939495318858500685756691488425559998,10583741436561099911914917245130852199607666337956354910388730829023746895549,15241902639811607164983030447109332729761435946009172128089506810551693978973,10889882303914055687481932975789161945462141459528413507160087442461090813788,19789561133254944544821898921133697408237804586549835559829396563401674817160,20741336668287037026472434608739333171202674306575625457456116338034432647230,17864073449995977742930566850933082711031717858550870842712972350665650521079,6017691253505466300212182439349954426085752315661098358839308909771637792741,5209125836207196173669497054522582922896061838702136844305036341250990710540,8138726312837322624537330169363664364899441867118983214176695868443641051381,15491983986041746833254372934846748393213690608865689646440909282144232382678,5054332867608171303802774230688792431028169804536607979111644888500809938980,15427030776591294577308915282298854681562344215287630895931797573417982096417,21754057982677295571284116502193272661309010996970316384923307174180521790164,16265286590463120486705206231835953324076688991892805307349612983237844034032,17679791107777049796013011282788633179411040182820636236163074053597517790779,4281652562868629887097957174897458165728741859103571825874408386197225591996,9168010397863299719604788533602757515513214141450093775967322808686129400625,17584182367226175071087689123358883902969885218985589531538416263709138156515,15671512310414658663135385639435845966109237059155734764323312289873534719186,10536294659491685326297777845632759824567028904726211134518740400643540109527,13431319759608247201135260841651365578663315527795431484765940626659812285319,9584697124715190200241839387725546204368618031045071660911490086723434692561,5180327104839158483066851400960171505063442195966219343315555549982472660055,18888217223053385111625483360538133292128748730565502371803782424772027937822,19535732913737027522540340630296365525208404217634392013266346283017745945894,8577759627886344995887423695190093296190181539234301534326157005220006624466,16793670928407147476673650839110019799844249677846432113010280456483595763987,13926032620965299897272071104154310460519723329016284975305942957859374938463,4794697578055472890255676575927616606591024075768967985031137397587590174501,3529566190782060578446859853852791941913086545101307988176595267965876143250,3975008029239568933166738482470827494289192118694622729549964538823092192163,17739094873244464728483944474780943281491793683051033330476367597242349886622,7367136451127531266518046223598095299278392589059366687082785080179161005418,11175297939460631138047404082172242706491354303440776362693987984031241399771,21687543815463985355165197827968086406938428974327951792877419032069230058777,21156136641989461785420005321350884477682466566148802533375726181416623358719,17347558768803521970212188258074365309929638984714303299899732035040892048478,16293716234695956076322008955071091921491953458541407305955104663269677475740,4206144021605871396668976569508168522675546062304959729829228403361714668567,19988050626299122864942213847548542155670073758974734015174045163059179151544,747972634423324369570795147739377097591383105262743308036321386836856106229,4612470951309047869982067912468200581649949743307592869671537990797895413707,9630852913694079049153027193127278569487291430069466630362958024525616303220,17941539917430916523930519432495442476511211427972760202450248798031711471474,20332911350443969653703295317915788278109458962706923653715140186132935894113,21764801803055897327474057344100833670291402543384934706514147201527191846513,18792043166429470991157980448329308661526906138700725174612608941551872082876,12308177224490762720061048892842527800271687977085172836705858261595655154325,6234555076867437297776538521925679658360922070165740193866337972293380196151,4651047048822067434403056477377459986292934655827821636179452835839127581305,4762047093602693619418269784972874862577325737690375448572644958129932507374,12373514879531674477721132062882065826558811149582829246378921774344318418269,452512704634345955634014968317367844987135264395068376894497483188243356523,21642936370936057063268550589361090955573362743817395689260298777690935495218,16170209200627740434842090607802586195654207376087117044989637541681675086276,11682826760471401430136435257946377996085824742031456481961511737883954750045,20628055165039718158878805520495324869838279647796500565701893698896698211929,16438375313036818694140277721632185529697783132872683043559674569424388375143,4855690425141732729622202649174026736476144238882856677953515240716341676853,11680269552161854836013784579325442981497075865007420427279871128110023581360,7052688838948398479718163301866620773458411881591190572311273079833122884040,10339199500986679207942447430230758709198802637648680544816596214595887890122,16310974164366557619327768780809157500356605306298690718711623172209302167675,4572051236178600578566286373491186377601851723137133424312445102215267283375,20933392620931420860078756859763708025350478446661033451436796955762857910093,10145870387395991071594748880090507240612313913083518483680901820696866812598,11173854866888110108878560284050142518686158431744851782991510385755602063727,3895357290105797542988795070918100785105415165483657264407967118738833241858,16358886674154007883356717944805100413481233709808000948036974385803613296849,10544067501284177518983466437755150442726536257903869254459488412549270232123,10495171258604974589451578238018388630585794890815982293891430761424812600427,13820724103604550843562070971473423552484851063169471886037640613650155173554,2334954333435579600152488915208745055087482119087065911968347050969338669409,15100284614446277058846085121308897497066957549089629374506920751044105723791,8493821960754696376711287628276980042183127459347650448500304251148421115590,18612435536889941393944858783110719304584209891406420832295898519317994950798,362101794940079733974215941991047456600874474038781578925062694203564740952,11020033081956343850903875701444955317664141075326494650405276926536449284939,9396289482656518627529185765935649373549564165735162258912975312413185691167,6879055176150676925438486069371149089824290576271090206945130252868108043422,12466610601804566637227883322591924115458766539177061670432424956205788935144,6570302110526154075173287644133038486970998888099669190857256824048085590052,20997862990590350605775941983360263378441519274215787225587679916056749626824,2642485040919927233352421501444361753154137311893617974318977215281720542724,18832940311494549247524002614969382413324906834787422940144532352384742506504,18751288968473015103659806087408412890105261892140397690496125593160830694164,13938622158186434739533995447553824444480420613323252752005511269934155122652,12878982657080117316101160964182202074759312554860119090514406868768962707099,13757859113119127982418426758782225628393556023865807897214601826218702003247,11817871682869491875135867072669251115204978941736982465520516648114811792373,11336448548896065624515261709306933490181794458266726453198857687608284871020,194970717714150352477887371297168267861902418496792228400198694925721020795,4999282817977533227652305360183045040853565298259070645110453061034932285549,17094174197873140035316532568922652294881600587639905417701074492648767414173,8484251464872873032022789624790167173458682056313339863651348894878144808746,10260366716129057466862964875306868898686918428814373470382979997177852668590,549263552864476084904464374701167884060947403076520259964592729731619317724,10052714818439832487575851829190658679562445501271745818931448693381812170889,1735373362835209096342827192021124337509188507323448903608623506589963950966,7998373949540733111485892137806629484517602009122941425332571732658301689428,9035170288660659483243066011612158174896974797912618405030929911180945246244,6458619567307414386633203375143968061892762498463026121155477954682976784731,12314261817227551876673777186352972884847144237148169773300066404053441924532,19869454329688183813243851218196625862680921049019496233616575272637276975230,20326917073492686652690019138603910654692396590122884746951129061818467704300,20403270805536666081472738304916561119325397964511536801752236086414818653063,2865941730880218719188224311916978807415673142487507504983320505748719154068,20614246027521726470902405957496110178017768563127335842405314212897493119848,12060194341463088508348622863463208827312128863463014006529428845777217660299,1128906798719793375274166820235650701301189774851381709919492584451845983197,19670876372911656158743764425809421400123168087389888660308456184201759209723,5647230694522866559497222129254930524469944430191328619422533907417776118543,318629082509194371490189248876734616088516535434806492900653650176451776632,13685970881538585172319228162662520285656571966985351768743970447782846353365,8283840607829148567836919316142994745766280854211662326632930274668867638198,8968895518159422029900464138741638511289476298837958524156654785428413265371,10061801991000917366002570579819627134666386452411986168205986791283562415829], + [16023668707004248971294664614290028914393192768609916554276071736843535714477,17849615858846139011678879517964683507928512741474025695659909954675835121177,1013663139540921998616312712475594638459213772728467613870351821911056489570,13211800058103802189838759488224684841774731021206389709687693993627918500545,19204974983793400699898444372535256207646557857575315905278218870961389967884,3722304780857845144568029505892077496425786544014166938942516810831732569870,11920634922168932145084219049241528148129057802067880076377897257847125830511,6085682566123812000257211683010755099394491689511511633947011263229442977967,14672613178263529785795301930884172260797190868602674472542654261498546023746,20850178060552184587113773087797340350525370429749200838012809627359404457643,7082289538076771741936674361200789891432311337766695368327626572220036527624,1787876543469562003404632310460227730887431311758627706450615128255538398187,21407770160218607278833379114951608489910182969042472165261557405353704846967,16058955581309173858487265533260133430557379878452348481750737813742488209262,593311177550138061601452020934455734040559402531605836278498327468203888086,341662423637860635938968460722645910313598807845686354625820505885069260074] + ) +} +// noir-fmt:ignore +pub fn x5_5_config() -> PoseidonConfig<340, 25> { + config( + 5, + 8, + 60, + alpha(), + [6652655389322448471317061533546982911992554640679550674058582942754771150993,2411464732857349694082092299330329691469354396507353145272547491824343787723,21491443688002139478732659842894153142870918973450440713149176834049574486740,20196926676989483530222124573030747187074792043523478381149800153065505592963,12986278951352369831003505493892366673723882190521699331613883287145355738793,21126146258242782643168619000295062005037298340836817770565977031890883232034,15509665795506578582538177431401381655815033647735781734613703976071034655246,6989769181472743404364681671283889685042701491627165526899522083327752110839,7062179885254277466334896166987547257487047183881628199983668518000910197987,13842521112365108087725039904948872289730786568469683976372377853164252494752,3830559505943186272618534143266118508463381443414165428900505002474439179836,17704863473432653834041116667846189591617394753001613253930974854399793083900,875580502229441633079974792778818749112423694973231971690365132230865385439,1971134273535892826573832061354985059300866001765691176219451252512658771248,4865738840363990164915013008693722144676933915103280504727326977328013515878,1148603338028060679975883868174895825055359423662532941509525326937127571764,17506086433923270253695698017062834613463718526046463655503742220257039588796,21580033018107258179208198773211859664893072138803756118939260252922297665067,15411900706973212043830142913959920716501447427702082030760032355626616412240,12219699506725448409610279620972339448030565224304464695714944121760832152291,4525719544192047521328360848269156485222470829314314216955024799558286708479,19667371373588322336224317159113441765198420040800065314868656839300028747331,18916925604689704279265158984702141998345424765142129953154245912230835240445,12789343981741773931665143789673052782408749041041266509485929045869073416222,3094428508959717445577232225505810354980663487713729230015754183012845687401,18544590634480965569098056786078005630500574069468005220462377474861119476492,20990087440247450018723844204951613913840993427110495085701200965767234569705,17552251989761134508416634118845221324472178264364440017634233349418103869223,21000797802575507763447855752602183842956182733750968489641741136166640639409,19292751508591545849778577901067988044973302547209758604667395356943370737868,18314088316445539319869442180584299715533304874169767778761887632882728399870,15003745150856597539000559910957155642193629735521291045949652201905498569732,7839443900003691950104175747634267110464104444913379977500178134209666299140,13568305490393393394812598233983935295266242465548739772708079888867621061127,6453005227995051361096639028742707098785560656441339640433794156400437698140,1420171596348195609536167209221442141824294918625468780931400849866478645240,8347329128252205996443084339884155586061343024498283583400215109265013719709,7893774494551056447960817286805128884970061671041428326788899872964096959040,8970476243368194065341537088653900235777512204874037182428362347342487241690,239049405935404678508864874854718951364753739466303321590415544572014148257,15772878921699764223771017074289335629553777447709755479885293350677783703695,5416082112919155131434995906647355834510201879607888732259087164602171650389,4384524908062410354304345761652962203632712291085564157560146286207296352050,4210984612917608245844011498198864216639269565627982123611519493203177283139,18816442907032290878644773027005263628136050677095986565400687355912498966559,21443510232279945782338486087712914668515437675585863788610958361560172084515,3234314779308300525339049581669531363375743827111579883853941968586490182859,11029499234949696730080035941750777601416171837281021031653841244636590396063,11145210633226924132308292113124660576759662647204939721872338908644906571564,4583160563963432761409369246361117506465307518522062239686649163525543782173,9813992026757562966842771727657080117609486122615087352428596024939855084450,10084171857039480706430282187972782725948479260179367780776125786119489581409,3874212709197875589640151274548083098712939093643165182881681226579903752816,21595542491397091124739711708612983479307589335640792812157875295064235960610,2068530815441314105493629066002923150651375034543842424822712297257260726954,2673459852071215292298131389250564595426361004231758522146794940265552265806,8591046256746588406353455230465605224309754008961178558834659065898923355164,1020055192431352394776887540248098706183934464205704158014904833376067287118,11085709480582865378042656141271006552092494690130782253913953070642865919312,5673844083530503489429922596812992664928167369104420134641855283771127716005,10492199162275168254265892158402955076490959375050993042712629236807564461542,2280843393156259739329331366624245275580688891778782679394848304764573859886,6807797027131305026345508953353882265754363485246407959111359919046340709440,12692191384043938397944633973317584101723715998700063415107128429315536223446,19818676957110967644349139912613239435706480354664804036688552936554140369382,18055602608192644695569077694296748842203151828348990995792087204755925787339,20934555391215769430553078793246717148484784880715746179415906355043590089450,11420705181439111353998210442417752592951340005396931802449360401461783159557,19878854521263746227125001670931867821366047088989510542865511663910116386085,8568201846715449867087132677683368912214864824182424933182820310911278496552,19198701614488576617610339232794062430644024620523684127268879880793305460015,15262122764244854433806270478871594904740306012582364033343126589996733802868,6412758421155818207287638337822550233376667015263373809976157264137577776202,17371585001641430978766734501830788427263945848682170096055857509304472649262,20262970042379497707724791203314262108784948621691331141565359315001027736581,3859750447119748295302212198327542106766447958113540005985799287718502362717,1172269945800307665458943534144481495673510885455899148864236015097947176746,8164247467959680477306326470118519335673181279975551434197731340070491876250,4513977811114181395323888111232002391599397736872779927267726121435887238972,1075250595927474080680862736233039825365918646878264905022213616210377518447,18658420120424372681792175914064174056413842231969276203770574969914576681364,17769673440848360838244654765103041739044212539359630263894092078288342647801,4319086204044362848967484441065231939136453667264715596505827197873119273506,11221173270629292820060668122527062274557317856738971635698169204652845111606,8635411372759272135249379415383299350267629947167809163276219879514948820576,926977621651476360285369760355547766944001783780761167546467658394097283069,17702143780592866375901805387463459229828093905183622296234691441436877570082,629612289140842594504574984021125242351317893847688437087866691775821981724,19990548577495092294245865870717186004301934545721835081514347926537975465539,7124830628609719908679298707909792306162298058570958688501370177898647946696,14620227791860703231425817538142948793892390269806790476396226159679984968174,18495581997440241868332244230687799183899751339442721677540757155760745277888,16922065056093401385376103551657968760602009001905886435813054626317776258714,9969610601962874779035054685661667941954971427956866645694064022029705170229,15281641269114187762159685323068136816556739502211864119670902056596295644116,12114994625438879103001132949163961965524612903017200394727056658298824651596,4840986177718281128440833017205097196672382395936939379498412745183060615212,12847307562796769659308999092658905656250954898192781948610713494470441775991,20290096217351155282642224215178246911041509999959311313223857240001143893317,16151664509646153154405691138084115125600386733136285504828908979176781265710,13848845391482751436287906247470303487958950799995701248612703022979890932133,6335716166231441585596963683321661194889815181545222079376536449814718259931,1824302750039354704619545544386637317858342555634601563660279997221547953768,11327469654081586239268713126961534952233559223228327222485848924908493444712,10077703415170135154603829433031861799853903739210136452726077323833067256620,16368073884579385814331927334821006319227867093692644942500207970751483237405,10621580796499573269115131164341885791299038227955222944695715163010783205295,2099241376651019397894434242565225315652133572870234550073686122343103853816,17104632243449417396641550271977294699471083572885397875525767745512335891599,1935453754847256492223646005402770357836971113012418013930273797463411526183,7492761611332930896292052363224494314920390056637668407353957465667515477934,16836705924460095689555600825174696605443212968244843485187771119291716736958,16995495500678141665340056658079449793587669420913589967848082091551329904176,16097379973857697753436437302681608056543122759719328497348770844548177814262,17476569537128329379528694049566216604638194592812108658767104922628767500420,17997217989870184804787026924935938133194070033518938653831611194683423549591,17573343771046232580761295935281170028624495346579002725814597714902588657750,2450087639204541254902859018960918562514681200270997307467560465282168310665,17288084325555056222618040923753050382954155896826087372317882602328092535440,21837047676579063581498107773514419735425738753079336764356909012851439336687,370061273472837873736743292149368449614309676635341873070086681342317566380,420725183996224279379885018872359102189091670793820517618337092091910692771,4966571645678139143731798992823327185758562224229132271884647901363447388530,5039558223429273757296118284876763395391635773837549121798873235133698166026,14663152729953724779401067486012084029581847325524052152795817923033297673686,7201040456590575809960214033959496417566605177095808543357813677845263237276,16872945504528960415453618286121813996587432836152082188694652370255998768595,4914824783780909279212078186433590922437371437384817332713271291839616026466,17503018483514413315464207189113334433424965178631599286655188843769810245465,4087750571011463387872022799241315348852213278729592692674275176152296405923,4006961923780091252337105595934918049936238157468198971234322013673884171131,4481908842184366902145805444001507554481032302978790080019710161108326487967,13532316826436461968093937893872910736305115143550039673102602344678825540956,11602986656925867325907196773754426955346837006705269228226729102186031417465,15306992574062791537454541745213815567999895856471097922112648012979731636068,4497571735611504561173050536899411999551839050319538712220770383407135602945,2571242673174714867278075260451133687893879636121064640779554188161591611843,7070272070524747733177730083966686149849667613589868731851816020060781720851,1308310289745495626002351437755820460104812708071634598163946330870933261232,9483468192990391193401121929514821570714432121414330663623018046165053411090,7317568349845215930675847155716598288688799068821709820024570206796617676748,1918505733423704616434273602054555051755671749253598966287072464475922854850,15158168161084905689406532256983805923258003804476527617207287404280855731962,6855540174355511438343304861678411868002455139032857270673849263857877330771,5989863238360846166935911112885654223487221280254816980802479355446167746774,20283337058688740322296928691341300752003492063748410749625272920572074851396,18957132189629332408653055312790838576277703952267542471751593810468444454136,15764518568966520670995753676429154315765754748131847346608706222194564055358,7192524197002826721654253762628934164676539329903087107420445743247046038858,142950766663597487919643890566358241353679421113406309294925836697585309311,15012262168187689680572958978610204856600235635916074406168861726626292993057,20795666834671497603181209610179324236645779324677512349797033323222380300794,12650341271833683789775531792948185319868795529390391267833516836256688318306,5597700232877580665749288204589530549415282468176625525368428476461504532052,20949303924691159143653175365242293984396858344688574262804199947001630916385,10746523145835332938672833282581864816136388045771578294905302886974358762209,4998982766221590779170630035756820066555357949247521575936385387288356143784,6936999580131731861735955554005106460473097800566952971315565150681540640020,6670695360676548472482680016233507548657051302712214051977034166870814430578,12210816592786563975173850937247594401582085430897698766795696447223454826466,14933901149105284237676334791785996160108290333321693498322435129559137152007,3848529433916624869590379003597911090976938589461403388133685310398004369431,12778805225074604003024964969486878839359935515509480774809299341511161183802,3288267180428684202786697419666969564766921974531343432588030535602163038467,1272672432174256751826350693883913844502039730140570583479554071765667798207,21130828804874452930669244946376257892693846272313548250936991077452679117587,21254559353072473881932828401787134230282801383134765683324465204971002861493,4116075860631781527931204624078712926526805345818156200756399332393348685924,17435888597009729827411190999389277840088354756277916760187756022854497211746,15837398163415665169712832984380121382150588321621493928953938599666110830812,17988638446757562417082379159769772097890681265659458369075768452342579854303,8144561030363576879343874888624208577604401139613622673042754207987577727758,20020299925602421262203305284307419339160247406220693128040712457114283033661,2945951415037890626891130390523013930737768652394758977777336357159436605764,1505954324723537402640844232704189835623922400329086438898375859826553573763,11851584491756305117491374581845512067704002072833714119284164514457248861803,14471204965036278214508938537949717553799007630471016532866101610339050785912,7163557293233604902868673807221391042191134560333950452577270522828534690707,17291625782465108601367695465389799786592304061550212130987221355832952230827,10240907112109243116543462081552827576656826251172050843989873656917271396422,20702261919346727858635106264046787321170414155594199951578791234276181642650,16678253307828004252292273162411388452019952018258857370242272543091326285541,19810917631941180098047817620026253706643400683524412974923209268916769874447,3357220165225360610202375608872621445880880830154732998557832689480921421791,4392285438534542495332422274902727975330102148971785438164412161504066619105,14642025133729666610167675086855441462580619607677226879159952689184960379911,18142623439987890999821892559271093087005885278955082040377769578204898750505,11769399023330099592616157336702104329646487200891911089287290893650532639221,7261353756299584174448625214367175510387913706095214313669922259027644778060,10406994568199070863112470594593301582798997458844791396920771226539013327304,7475277967562870216712397220016587384793504784585573136176313471517144184018,9598064630327104406929367986473441777975480987434868213697837347643980267620,21137410002545951849752865514437404724653771608225272412595423069852350320648,12345612867231779996383303763804719815752861524077922121654106906093103051400,16461750199070055335468534730937701659470268635084522644824623393184528879703,7829250842543018165409887731515254191943527926556191989558018633300783421935,19801151644322693878208767560968285812646931156576102755771403150148125880648,808770634664491371274943928223981161442027957963181999892266696287962813461,2298122748772261447929855283951027113218922003687701626762072351622993276571,17407798064458858450209051887305178872029674498718760624162479511390762310526,18585562277464562541666582720366573863334618817908062612923861658144918595030,733976598693219656339731904831283238690050114241501938501377743874139460889,11316063986696838098122262534148335669847478050407756877728672233736962269417,17614529714381496379478130066245111825610297227468263851608027100133421612826,12110694197729365219340374599835523099651939156213930558791147158357810646901,4337343008663255658976574468931581484970687989356019720784093082313510905405,1379188959674402095268172673987199124815512095460112504778179157481327937561,3116148242507754420428768481157196067508084836097458698846114802493377512591,13306507137873332434793374848948087993544118494881134631519748904811343155566,18496878480807017010077624766326681523549495609998881196570603040242554712562,3940126764022508707486095199473913866137718790062498893812401335738707507732,10030078765792498033316282784150304209584388923549357286679864120250994473810,18519871685760382462428068450331593474924737719734568498029727699878543899254,12599428893576891013523136950822667754415283296587096197120138265392279834128,16038578953099895530943034305356008247313649524436132877362941968861459073483,14319233878082524834510736727226054073026413911339853399113450188859080424272,13710161613540579690732775978855380876556751245265568031703536595040993113748,14958726446649273856607176275240008023824615720456760403465034344703779274727,20935428111942360630758629263346308597806819928838924586682307174931367773605,5826394436548487315966647466017047216786257295199620110266250301500717796281,31401797997389676486806123612280306684597605608110075525648021056710776011,10784171495708237485952707518956314344821522727746927291389338644844400581452,11604345371765580191117799693565193618158448665352599382713281103552305960442,1378145039624937931836538950217364481423707761527018494355648047365613434790,10284294167221806561993937798090888689421933711157676807977401896199778472860,8233695574758520342808807499924062869636681352769371531557726871630696672029,6570581391072134029876349038190171593169496519436674767949949730275868319732,4026501263908027819614805027945064360196399012004574117767831931274788631138,21091098569404004244061462065218203986433580687172854429523306262593782053656,20711772916118045406356429185975897495222240215931761100801599257137350834799,3165519312799351250309462589160165591299333587158531489859211268084164422251,16470663723473939739601217501478624726068461799539012562455639586886033078064,15672299304945968727435591100602007503785845873606917887638890765525875123857,21393538327627889838198844493522533627143658125568123117776524944297103649079,7688819203734248199049004650451546300187194458173935784579101984183800649342,6609663518412297884695057080546416278366560290439222127471462938252865438638,3476303650597281786976907813110835564442121684386467570637538230409080744769,20633582549754495054832414039299188930065286005370053173386561254823483851717,18067076834611402459142612082327591538480657933568191619109271502102126814407,157209609820117793892254328219308970217366919934739036156851508233236414461,1848396116513925340973398423998379465460554039715233953825786874352442451413,188642786730195655565401615804782553245486295156304142809552609651873793325,540089254487190924787439362270708251103955915909358626209177199653451469720,12796274768956950589847157187031845061404119522843128177103898080653493269942,1785666356337148874573621868025910291826158842346617719666738769156993598966,20649919247042517528354490854561347316237285929352042389729444382153378749538,9568390566108569727471722677925269460696523515877621230569682954652430518787,8590683334740232786825518158771304803451657249486419816607179533515442407283,9321198393538172042803957409292145345834077448228642847843261373640165958582,3651905214805616378360839954289447530035139753215923648216350128870943481828,1324345422558073117779462079218851558068746895262914344818945294328678893083,6666363895154434021620869731925915051086919707989020578203743660669796175288,9850757893972463103359995012900314323213006625927501272997539940766979170137,10214293226445704940138790188111862069675188797488928722469679760666574484266,16862124085118494177559484642483513597285992646267864845521573612482278871023,9172340118369291059693735314505606817316211450324955429310200429408035954801,1968992755714619414656181112336357119271845800144345284299978250769356388249,17192498940296212027365280042755701662136570107224000496521552617655679821443,10063385968535643122430064779260670089120686456635080613693015398478175344193,20101961459945738562625328882763768836449780661345042148985756598106706734632,12704305975772252539534386080950631076046431529894091327218544197389260775334,3008242816727585639441748210631464697850194693570485141354082562181236010097,7797705698071555811456747812384107102104184812467361013142453143842134807658,19323240331433203844038522035479659453946066968727795017745942269828428751105,1698137797127320576751729191866734754105401103859852376273763815257758421427,17656850887825900397821271738817912328294075224643535784810269137125067875996,20755447986835730799031196367323817361150623932048563112034040627213597261325,6221130271964372280138992636208062417325313096379273438539556580491430711297,11042709376363248213366896208587241517252100440844476816212498352999929578287,987361321094619571176752720390429919723900732295551211263814448408232028205,15077982986114392945859048373768437818569856001604485167476360943078774679228,6278894644165961404521866714059972066255652200107181684047812674333675794053,2649747800006903047073625320829560088088800522557851927539477888486006072675,2636278052351769676017824297717609512488651850924228608531372135635042762078,816232991472315395984098922575496846552245086608787214581606973359616326446,14372687274434205592004117128588852491871014819273428668840779210928924573820,7351401720390274950322621121981079413650308506660552567079785209176949174210,10275293929161727274572318228903710245677747557851999483919909420098936352013,14869686444606195206734119702227763209172799407142930791211203702643805341518,937617196362766626935279232045712623531859540210120280128165029613358941709,21331527351771920568751070369057714014285398281585036009305608379072813379081,4305436470381074948146072259605215282335211631970525440530773004228212378618,5894273721571292784412707230481346442881109207745969297947253583203466014760,6512250441044591603946512492071171861967500633638753443182294740883123881284,20863871952569294813936866452848141274047362082838805921071316386912981651979,18788566662709810970880679984141390717017951403407913908833463086244783373013,7784927597396249543149135503684024377171301321636804832597181795981969626201,13818519831569592521516488188127966399245767953522268350556654747680372036664,10515208647860053151690062640705322684876580250632027862984821874343071549235,797604926079325807488629085866693514275115789253871397971708541758696512985,8741784289526985522570446847275649913333939699807282742190607491216732972386,20966712704043418981047968701828936463778140093909973286855779694780086635828,11359697297415630167449040380538108774924967116147664240213257348125754475868,8070907838094569287067982462230761680706116783989613960066342967469297961118,1868550288036217638713133945402464194193242298015503906068429633793800456561,198709459347510170000840600179608479136663571567208109852828485236018304733,1601154135701845545733926027872374554514541574822026314034696802419388627041,4363994778006302991481199477873248350039564117453810275561422974475581105893,773054378219982710451611471050404495804413666789496412742983455527754059148,5209426340109575519362014651321132459061755868557415513439993327176584352934,16124961412020675839394907565568143713078242978522632778625312854364651991011,20812496670075231301471694692369245988519082317145989298573032859079075730004,3312489967581906638742585802390894285073229440039144559060030129184388053832,2967475373447822846542676378804990140732835322255774209561143670843223463335,19744585401442299381952694102570931935735276268739851233412754166721728873141,20026293345566344685499234599699178313754630774489046573312844763673073616936,2611303659034102517884318354550433047021831422518437228002960700934925644951,6230291832603218406134986471162106408091661326026848531605999413028246206577,9126162046556730019959291776456914453189657463686708035601186672661595109020,18827736146609035067773173111376739253733288103277133456626928961785293662143,2328703958261360872869074208611873245571971231035163763965210852182760438390,13796410059666172174899788866809560044715551934510722965495280798363043241416,1593663256684781552813616365605526150610454082601584196604084376715746899324,1565874145189898288764434737762721576951043839540107044892767693968417810945,8709849304563896945461696717753976956465219721409993781555147204068634555572,2994256803561260177499267243802460581941891553208150783951937342406846377191,10452746656507347152042187616753027475507881362159944564077673851918869542550,20130580998875572619695450234900655050996104101008767761546912649074040426200,18926933358104691474037431437316089682088433006245222723356764715400831411716,3783551594057498940671877156409957274854990650480535806320220142873170375307,7919031943604095374667473717154511882451510130166237539514111182596247372692,14518552587329209714850286012780632801030157943402419401997576700600952906519,4770764028263701271241862755569969531641408032906982530346384375773459918490,10866502826034731763529371496585294375373238783964914673031891984092997621879,4234148117462322266937279401468367908013627589417699250592523530383852950379,10747942066055887965185603234524367638106812660210378090215017248140719240336,2587411532912868255102795810490361867789634574022411742057853375399270197531,17350061113113681344498080520518808976916692173267298878258722510332360424059,16490282364669098969805528215926442920328903121380947471680517193373377657129,9274691782659584680377375192682066090127280485689527337429804211265749864190,7630965482352419767782717986075793694403609453648729580916814032587325374653,9483872310024003776681196467845329825094379763716541754956796450187787638623,12182966986735661215639970080491757244218854808156498220088212871061979325833,1853790963611367149183440339188924598268644281518961106776656221408171642714,17425077915972423995335545370701802959607559878032910147159424242864219303096,14571075346526399549826264845894977639678567831720652860528738036970272895919,5627701855249158721927849603102149698163511782011562166637339712383551336091,3620805686755372260289125555061886982808014642356719556961142525373021656729,11556995641752009899073583627136467840237831247117281278719511600076965602980,18960242154096055221658318882298412299294886669455506299567210308762501113202], + [16789463359527776692258765063233607350971630674230623383979223533600140787105,17179611066821656668705197789232102741366879862607190942874777813024566441829,18653277315487164762584377009009109585010878033606596417396490909822722930739,7373070639853668650581790286343199505413793790160702463077019294817051722180,4823864393442908763804841692709014014130031798360007432734996408628916373879,19196309854577132760746782449135315310664418272926255500908899397538686486585,18123132816088485879885148351452823314623055244145916622592591084094232513914,18436594886553181913092702411547018228276047601279727265790147051821171174455,15167500404313194506503404655898040457721633218143681920692711693000769735187,9437986152015460505719924283993842205604222075968464846270136901243896809793,21445376105821232747280055223032050399373725161014449207033808524504027971613,49684738714301073369749035791061182456037935161360748355432247732088942674,9826409059947591908303145327284336313371973037536805760095514429930589897515,8494798325496773219358794086647759478982958403252584257436898618394561204124,21251937175072447337747316555423152807036003235223125066270735279039060889959,5539100337780919206842837176908516952801756637410959104376645017856664270896,6297628909516159190915174165284309160976659474973668336571577778869958189934,12792263637464508665199868777503118105486490400267592501708855807938962470650,17254685306085558791725544672172906900581495686070720065168939143671412445514,3590396502942934679818900672232030233017710909687947858184099000783280809247,19055249881366445073616526879263250763682650596233071589085239500077496415637,7367697936402141224946246030743627391716576575953707640061577218995381577033,1322791522030759131093883057746095061798181102708855007233180025036972924046,20456741074925985565499300081580917471340328842103779922028754640077047587707,9059147312071680695674575245237100802111605600478121517359780850134328696420] + ) +} +// noir-fmt:ignore +pub fn x5_6_config() -> PoseidonConfig<408, 36> { + config( + 6, + 8, + 60, + alpha(), + [9174141306060971809979631725764298697615039980311809306145004207410652431953,4847693924685156250211477469465516228032151306221739650606132660616428517315,19669833054057639609249840291533340493211768292967819468538893000195036768991,19800508893433268850924828171290876015556093796000695603651522426066333836892,8244699449852279148780456022144420353408196866113049322676048275081354214716,1563672068712965454176533719400672258364596155638916268717470967009721945171,12723223712027468580318230235559705540011996847167975439677647504573149248849,19944398841194165937952509356635863229327574447452745793253427406349161295763,21218058308392585368594275702746106483411305671883946244077923955757637296177,18442884961885927579732373746933397748806426938144021013884176466434407012116,11138408360119814115926439449668526422561003790198269766757675305576549475808,12724564576884231109847024566806896391934587839830522481308995309797961575379,4897733190252075532660075013731462724561461746919488679609618967302541674417,4797748331306263412471031924618974997396620231469532262170060449304337691527,8626839560132907403537141283531395025838110825355541158539075100658769738351,6096293906324574249636975851522292408228519044739444932687579741964974917617,2351617695830568421216396081605990689071283678701192113347036659596049514149,3045682390398203085155257535118136303069379656645406266260961816947178911890,6935829264874515341379952008241845470659188886156484974987865751370715745075,19847439266968955911971997829840067368072860877451092633069920565944933744280,12795097343831149148337906863235678514689648096503928066579129201713661539889,10424580232112390318877053133877999442988769389050776486274146627765228950235,11651452649618223740363812212607761589812354035139843126315028745587570714609,21307929358023177131550002602820591970791247513576735567457471459920519084552,2579908580162153663820021562014873149811195641589016321720930006635393981680,8198198178555784054784079137247244121807775986273563786249987394640289859893,17176088986876377315956611075288620878117708836881362200541916957398026761276,671389874397910339333118510595007038137908096657753354622355890021074216004,19161949137729278558310070194809106779119877882343914445178348849980058405327,10827554013954037091657804154642286174226562252063767377995268439458401752538,11693672899474469123468133710607776304784343543318650064064636202512816205843,7026547767612627656560992117440221331093280829523426249915938274837157551621,14422968137896343032446633683271253661000603582016449215470992885331170459671,7685352543184863430081115767111935982586458632527708735083385591291346555502,14089009391529192464370954954330128327830078875414722902347666490457756695535,8424161061743752192085022963953944100289245618074575727145394775891645849043,9809236779073852557054640507912802523501426410996355424610807253990040160483,14100245203768962710288059230665566265892855964739454261791429988929622355986,7775683622333704945225255741567928967674629526812606133980425422182282014012,8739247215686497264451630351996892836638898510934389758205488381695687859658,9431876969679115468275053745264413939426444105271849398322497961102606290132,257914055321743732506701382989022126153391940932933566664491918941925247878,21801414068435960590201256257290267142214176965736081788536576642934903066059,9465495933537134443327560834432669768951376466867005153580146079082722525723,7862366214258716333873810314803222267215825847232397599183717032713290878315,10701164906390193792620967030790214270231326273599373762943959252633779929633,11951628827727068395937910010248864431667047516686609553745879936868276916066,14268744039571470490378560085356767818183790841094115879980723591887874138419,14468215915818797151199796266933432577607248341385185700017147731054148927023,1523824033338639123415809477892820349580561577160869448927791050266158538520,13559991428776910947424645696251487328999214391124402586267086012691140984198,18151203063828433535061866995346135260543721730169485344610433976436663085882,13436242600153492361692256644258899977135098134175123174795293078081801647137,9384556671429507406657070680351030238568956203341356106463890924933167416522,20321079285577981781556986944841048777999006905303986053275199507771332527205,13510502130738135726695195328780836716597947131948116750163533622597187969844,20903049289119144354363108865308751668897757360882852151457514926552553533040,5611953645512225417723205546533389174830971368309601830751921473015551069534,8816886019615642422040038431962872654062471314244185285424018745071289038220,16751828354835345790163611999302863949792305206769993810746019449909446216365,10421654749141018171116296259626916395875529220250947127973888230084671091757,6065225315766552671037285757918350882361743810888619479819895087632281975681,5737755346739850738724717271213687543479332312420206954339242459110768587128,14770522272891919220644639305274656491731294860310497013287297810648680944682,2777394791070450473479179489594969793054480209411136328689318984981401732197,10039559932930709555975364107098145624058027439566384376771787183526929807647,20757756003754261934858081777796652436155530474748550156383127600004580439167,13253166894715452480712170898662712132411702335275401581167208877688374856806,2037004052447343668129085129987646907388123739343356363273464870501805506884,21829471491172175426560705585746893969222010633542962882847909490991398830669,5130395545419191392223692116621486075405299333195732914002649716762739787586,20333821730990393095934147177227294218344864602777744425090741435432040213391,13629653802252084129446975515814037702423511189484562534040643669977716900228,18489091892360842692678715136565494502607711254719045543684163289077857041829,21380328601365035012832876315565064374684993115210423862017233170195286906080,2280052193465635727584791148501382679094142036232980037838088033232747821762,21415541711468815972744677841317235994302058341802530962394281077076174148777,17146992672828650459975820445250769505470616910596779130798889014378635881076,21676475584514120109058208398560066698690773910598518925936412952356431597439,18337052978997482578725645166749278142628133291693686105612531426715865276143,14864089429815580405957698645045711801464462794754089671996837547347950054532,10834607317840698149140890207826430113987295440254355899459691878793978994131,1157143498448645320415276909137008396665083714591338741616893578930275511205,5027542104048754930085470328670427788489455916338375169351586496298129661248,1922685817237874482932428650501872692326329693528175054457715565489676406535,3071473720617798005831658342971536643616129392641449174655528578463370685788,21091078808046042460442535848913779439792606439995062001271357804782672390627,19773167374024045118471391738750949555178717045037157435777574972149053404157,6418695831178793575992210834992785624340084513619644969535805236049937971859,6317875495482489567338519005308431806047606843913867465201005132273298011425,18001249545956637376455848019549801116909661454019565655561439372098476761813,15530167556609139699164228289904946047951254183080358784988008899829027775935,8702757129830652230304011519426558036441096750485189115358314568895250616455,6369986882953061252605652398893489899416599935424066958291402945530517772170,6842894437627604179732847187262933342846269043996061072487488027804029200046,20951621154051947571647917571547811655800779287153833018533872651413529893817,1219277535080749134805291725937516331501172121638812333911793209536894469364,11704605822590166851511022757496386950530399074796545751042566537118336773236,5983427701962592508775640503988144495847156070437130549832329402380170245893,20169091361583397776908351163571343158517532527313940288212943504015977979442,3347733015762117176159731683196584632702931062411889821726902331981723958255,16217509027282489850987935065936382820558307489954122630844029918951230268972,10781269196927764524006466217779648732772805761839205677745819812868343369087,10568911823766972365218731330080733630028238366288098114239172953421915095075,5568774544682750792074131352530555554984876659733959079036284517928264996437,17854353469028651373397049175548228061144941710027186166132671198740388767529,6573034112757039329551886086829829282007989555105157401271097204633906940776,14069627287078359391137554212536883450595451640858724555679971658981340584258,21119713641590541511025673864154852875977162278614553796484277752677323191505,12802116677235410441672624559825044917295689876859311183079161588690810005363,16037054471696658545113065872215787085337497333273419984439267709950724531124,11698654309680908244303850432833183602706804558317993513795996394673734185716,15147889780127043019188099948246961619198549928908180192590946633702778981583,3657342516407201801006680507925024451922115018712017224805778401726428603983,19776786467141868744713630352693556348834540992018636838044610844396164981103,7980994848490005281733955776875257044050741738176865989521982608944874160873,12415191330803073018395217955802011585094769098717180100014182475381600382452,9300986814650530426668152137665814177758578011365736727321578452726378799933,4412208980274764197258090802604347599791567698589180187154608728755887977460,2582317668924231956058541757507620542434237159213236485179804217989764223164,19860814395849792324574773787600734118308975251437485131415273418632757301303,2765909129639570206766170018363951893338720647679193401532780051354569922989,5402210382809272147099442645489124829067576777592680891367494969197685281513,21011104174655621871977821285307554463403659856745964274018020456838460357574,7018364707286303918877589672878574811337524823085078243421192184715151775983,136380103284908296988715215087018020601815024625535396780012012453684253071,15953315437474610448052466140270091879233956524793052736202793153707558909889,5912305909658884889781037379491781973092020933879206417274479331390062715252,21575635295587180789566592951559325743281772394055590203112195979769645712827,1541325805478255472079288730846072146731241030100908414806224735345400173350,17207219201921814683730773200330679841907450967511507012179337438654141678023,18266907794578843029196926509122804272900478710738403531664855427655744759655,1204224895193276222782842236712348692319665277014183965830735736728887994581,4023246588034712778784328407820569751989619386134504404739514704773521558127,9064437981037864995763386367268294611921404895425171966596873454090899491243,18733802217274421976148972926716884457128521840010001893311936746027998476583,684088380644531080099595788833220377905013807951051638705160997709156627273,11994830816367980341637110785269531718699655485484715851375754143223090344544,1831724566362300629700078416489434571462666430381219293205871349415506993475,476710745682537342427691635955087951551678644045621275039835625280220347951,3586272766499559446129476613035465343616602918105042144185864609818186807939,21220348736799044560439132291243370111879983677197111626309132298278891334631,13683795063599185801186093771702503913590598475095473714851383723199050309401,16118007386401646906425171859166434660243697555307927508268622819509657450614,20930641024767526790605168032291665313905337763598128831404465184891980632233,8098646212401100552303711812039666794078834386731698810205195111722330322418,11585783577173465460243373201831086724911159484415020913089605532852648999143,6939053275662244505087635417541857793206828446247848992283188764105131966721,12798043540382494855660472922674138947867597503468216532170157050160462426199,20713389801600667412553956346192236970217099413304167366340548074880917096741,8708207547232102069057776099666995672015399188924281674772351753887161579745,16016293152251662056020528248861487281148011452459422778601663166015837379163,14324897997637439510797191208789711173129460994362368408063402682894248793270,5652996184880208428967511742390474289004021508049280419259474250332590598159,9877106633097964013050071703002221796318046172981334418310092241450453368579,5385816971548914185604875069230499528103133871233951354186676373318036241822,8683091293306949708478955451280670950858818602696102489349595054818146782362,16854975838650963077652189417311897888852709425835763860743171659164792100482,2485160816649177905834265823672532710299580013309324666453183278408904845122,13571692148185502188613896013359942531817915076247598483272449919094247957149,11899399615412173136098732970606292047945698835588882297719609812145308198009,16827672312681684936590464376780346837611857292837989006980972390576065571472,15588237822592586948064701827497915157359094833395277985658706133691498343174,18356642512438827417103800170157877145465512961188328254773957819312191285168,21642368145757804795143182901389223409544979732781450480847315495418822041608,13104082060493963869934085622104709047787444250961437496674916673804812287386,1561532086277971111804773016487251313460788916643968126116038406859074212104,2718320602791009266532615731130512762296058687816604986701989820504700684864,6182683520717583142027400659687593712743548729948584058329789905227082638908,5757242145794370726637363237313640925174531077560764545993554185332488520899,13688467192244237790806289073845563960119021610896694359815485764764608925981,12528461541936459922472167643986446262977222390263675720335825628163511159437,4897268894447399415795897967133432014527122426051771866816059363418177665482,764332419588242767884018802335623760055144509861323437945071732931233600264,11755468878196093893190753985692714003062307843033761257593209352165323938879,6006022813561851182403581780143813226749481175437001910923100661321563995672,13901542382190510449243772206670622017835690746895066410475076631498053123535,17648853891656481911225897080296737974064729032668806126284849597245044343224,15106333841965710929952896897521673254279668876709612770907537801609875568099,20899315415025260484895459315726322363345188136910564549344894025053466430346,1409310408943258102775009950750654615881913956151269414096059752250092035807,3899088673345731523976816322438172722785832982334214339521575164464706226294,21406686765584824639201351330529610299177537976609066339927938099572420696135,9121591670793901722224770893633585291275002987585289305307167711146944200595,10711764678410479049841945177317023555168593838022414378232020467195337241279,6599257303974597452501135281719536074294806740553273627128065549267140155175,2142616913275380526921597026822750992917222975992774063376747381991404337593,16361086527663411948363284957489078505159658832010445114438602510508720771278,17122647864721668762640781848678028227021534122268561738445496382823789619088,21708018685042482318786273055293241752114005312590172460099480713746031274624,8303630654111760473056607545365338851734309857718959193970615705292826806179,3658686547507488906491014260011151850549759409901579684176172268581462329020,7720024124908065424512743488999250878143598904717873371853608249805302871508,8805244918657836956533473437651380347005779399042661429698187314657501156241,6303681354794120075893215838935586592706844702088252970663343726024171795351,21512507181643408509426104627003618425209526633080701556628608990726677651135,11835373417333287523801757951049679177935522717858158305516568595764125190183,13059698839045014411602727811400239840163533672024084777768305507840091151855,17635240655824524168378284083397931667938326555447077097306236826752492079430,3374412791113107178205006579112630099131939030015047870738873452427211677886,649711083340882271985565833699379436167716866997851102439037906608755280128,20002805138014565226408902156524463368767807620908543995020210484077706418135,11071355197960433041624284534649121637702414580710232237233568479006159191217,1105441595020980635809093220782460032826849883993030969714432603468135735502,9652765957610682812348919340146799318537766051849796416434577860126024594091,19248299650856496267902926731608572596705132576830681367365128976226233392929,15285802367070100569572399512275861017714681455564415244982064571963339715277,19970416835730683993734843405673457882587154729456022607061085470691843864556,1017865638757684714433500504002748241987153668285974836527484933462490771227,17284848056169793253916338792235498052654877955690514601079806604278964099314,11718277105372928962350331838305733149270432706448484259807630484543527733952,6670793378364949883511003949124179112275066568088468958915163969545409700112,17088789393958965094855662340742013087397643056458490270185660553870734946796,1930788514812600942005320214284180860980345276633471423966020111188605196111,8844343159753729614645407314580317697758296041737296276765583948670245312842,16657939543606018325703787748629433167511611178952563626096990460124133990109,15333343644239485619497914931918504163396626751908652058758135581206765801100,16533875915742793452819179569144271760125646811168930162441077117553849625884,19679534317472082858641184998487299940737032844519038845860980362664393659234,16385719932525604857740698205965045007053424961009717093945644387917936681719,14490521084213123170781774542655088188106794646066074998587858678154251198444,6386781978322405984893078797365492485297499058328348606653460996474947075858,17508047533433736707046937662428611868296556965172642086594091783148965906980,14904597000414815084666285064575232635645852687797347860862157463159487771060,14979972442969995336727018758631782107138089738395941038626891064816880204567,5299243186271864957800928637599294208954109271450189950375274196644046222516,16189884555052883188473617525411302750109401983487269295700675997730645714379,1645560170870292006287241616671417605853047420339675073261660626733726665673,17866745974872498136933906591373095763114066893081150553715211393380040095383,5744849574386643500716045532645657520001448510343827372577217716983339773799,14021966200238971589811034967347517039341058556783068950884921208853167419283,1201178089866013320759085637098781870734315826415474628546655403142858044361,5875644793836087035760988842421852197052681650818034527831700615895391179258,10875065950479466897559006840696567433921014267247530366235539292597441428702,2221662399199449388725697795500999209427453463134383582414172135385907744785,9758513532658579204941116584445291102215928928145103503086996542188799521709,20879593323317766577775570558015407573466986714590017262168011643343469361329,17225846522404915080676699509636264825833159640824918876741681229188434930856,15189442986691997434021855855358620506645387296294217783597931695143376252483,15973617135551858849206811241799666696907820418171736027820254766840973764431,11888113439449420418408437784450952639345990804839507528208325036625374967083,12365920814385241227394825974928370916184942218042429533600397623369545597697,11966175169612449906889690852332416255478894176917636726028104087408060623141,11163554022908212145274813635928762748847331295589087669583554722521180712379,15273476004030808005186443499782264987539818978741159793745891769358221570633,2013969196885866182480519514425192091338553670034650196068995589691938248955,5008975446746271526106846692137145404766553748264648461545948417006052208130,3926749194225734582453671614337621250954608160208554883789519551411469033731,1635544156808471185144068767649088695307748439189898784051754434524720057896,17144944482517962143604430553750908864860079758005337246916094084534304051981,13823503533305241872793740090687668844401004819859520464168798913603662683770,16335911272023134851779534303717879370955813837529588982953758998930285394340,14467284210444150699969889681308566002886261365990840091849371665183151060295,10578205764525658336257882813734672799527733392763965031628376897794294290414,18771425328697137255453620743509164311086906349726510394566012237817674245865,21804626093983212038528370352039806004465345685985435415809095637323683466452,12056805308954301132385034564357716323176447186932453788072119595595483786736,14307195735327805282612857510308008767450554777122724855715789120735513378827,6848201070063637295416045855906784325422580350462489495889308309540335269587,631364713487758647973016689203003205602593076699875191323345338325349259049,16214655556434201961140525501007839859074077768660052713461045928979956365067,20940788212183642266181811368870506130164462254923655617893660245551698033523,8257440848494309435270838240795567828478627302119374684511017376568090372435,13701089242130867705897643891164147923878521147124165292045879194108024940909,6895272953337895406509859406973110417619874994579965619097329249292199573333,530437169778092455975584310016745919549274205817234464915791595041990209639,9008612822403008353420189298381046023002474279157557733428254452507266389025,14863423501786052071018008300345884780479084379412157784789951872243409629758,20091026239041315645045502002997446404106877721183777765607724358538559881231,11103877261161399045807234470901399725912406134008627937945079980590775715243,21529163495181909351665093277427712610965764606448489357319207727176092439794,19540446772694448035410067193880900774391072899517686330271100773183944540294,17549510450820803306426739851959754252204444648959723652883552677325100583689,12252518814610348662318155253547558779974557529822012236107550517806390105567,8058115132085119666951861652409945532276905989404523986413207631657437321956,15916100116790431839835734530362130437167135501074855072245598938219364570910,14256533476494466694764843270015662315303617568641801280831873052211753536970,17865471381417606502707639037418669122823481329049436020149405646709537112534,14015711483636570179335132940981982618090553643653746531174110949872682031017,6075776171664976866533080327142904134938121198707020111533599997509054627652,6357981809351565370498807027309828058036389418343890944791766504532174516243,15145296985037303761634018005118672316118004891352906450983918852209191841446,2473672396516437070485250176897956191104549656554290725379242542480862701754,11059085933391482002269653121188853142706883316754376424538662772943167665341,14804069155713123448375113552227724310276294677318593116834685772120057819258,10146378656966122923223443263705119557842694560695035707977826044606938090895,21828309590915152213768434346306434851424116996828875020020066586363340244814,15568879616082229996551157805731419126872501425454775741945679993142071548779,17504079509060638501918729619244098692140123800571022969294759717277257664716,2998311560047298465700351970612785742605093777116697796464434026101441410385,20229972737818088327107446854254558628041027965197447598027135778783710740259,14884874200763033520375899992902136897590350894844904733314191389520252900641,9619409751736964504139815024141276029474791187139050183491749032619248817404,11534029087676783672833531415041588991838838078174102967049055562568798961925,17106297093375816944137015955705541133308466659538554159312635106186252148471,21676736161168806529097919794022110433487869702564846859065695507460463414524,12596447704589377083704857810305080195761099125652005594925931498073219198049,310943124066162607352831846280730445558498286205117614171844835745706684432,16013029710570597613246104892930389004941711962070683476555063566372534206859,14282564976066063966062366540992448474634085812789771416509095817495183298269,20757241092771652500911491636894210910134068426068355089789205706892703219255,17084251309147907751212619949757520468224028014308500329099194408342072624132,14680350698112448759886861002622963534698534998651150537754386791270019720748,17739512731440543100681958009173086667000199263945053345384367808940651002571,8967486063900234709994801661246451094429250620940593387993430620369318619734,3906067814916986286272005884942051451306945488494283077675304366798199289520,2517004675157816404807349457307096161030587393097616279110332574293494030636,9995302877359286298434340810356550712107485295049220989690824504445305103587,12849909876017357260683411536833847986127911582040960825577300322066595609115,18074515800779889507358182860997188274134395074469953155084226981497567860114,6692811728183968363967959295970424292426462800383828091752006855360167264617,17859827663908740084792157440799065184931609649811664442236242315795442091367,12243409340804252499520308602187370739653046835019551522661290645230850934962,3009118420068966587115224335717185828292538080040896739662684632413054772046,15856202298588272962175258696610233941787471472716811521132004805327415486141,7549804594729480554341356998842376772514802673462970334329441043324983960866,6390806437030742378988258255983502109201709511321162596105974797942236431761,17370236522182003753669946647208335160124999930136364231371998757664000198520,2261672244214630177095236704932243497157963117166120717011661647779055001646,17325026196605130064689259977831126468940872193987407658419640959345091161632,3631641025220845885502691330008982895233731506600778684638817282531001457735,8656561399441987116927438675277763317789561532507396244334062468892541066084,4069166732330197412844703565599514109399373916243310212229125901351402003915,19808198732373520522982274785888742523226720967259539531129335924093928174880,8555796834031869022510134190573521699378201702450788201649007358450530423866,17759660636058865290579521740750449606781204755231964378855563896473545202303,1335826395218609619260020055566056869243760115287254209950063597653055872566,21596200365241795669701682696176077888309278223833581800772036945674858315765,12619752319673193899296833725747186284394167228468888029626464753793997178599,17420588547980145067421969830249755561311178399975476925894947008643385243007,10337481272389772505654575850886249605422739785111225132545740838911222864209,17928431631046752749930349099366498612885288622404560316665023363985966878427,3075798659324203306711977985120251896073145961913793478792728028765206521425,4639500613932181914847461422373341918892878975546430906324216810326467690534,15396322795715441250300995201889120935591602515487993982711884319616897970533,6391276937505284102735701938724106665734769352007891548547667448647832351929,6811373320779057384916660178551330838095673247430496448933336925226142036083,6590973140323934807800215988687710942074412987201753370126190631819398102173,19364648614154949386936259588484266535262135334799266379433252509193375956715,4702754284612371917466042550086249683933140314858807272591351280832918881874,1081036249074169248236179367049085684430282426446509768147097371368406374049,18548093223441988703029589168425055383154624592689171393242936199350770119589,11098999608073377668352846814752381891400020647878345005629685447730764310163,16001262992680194260590639872321865154716987495605624862471107193457192704714,21696229443869118415905915570780926763029898831113534481730746953640692230062,11716215712634983607563947056324900205144202447594949676250978337464771243867,1778908113733035314726603632369389424542091991692308812147944884836647395775,4019081204388123040098634987844274011285321286777408246805308194144238418480,3473266952388383063447927231564219811787341139731701190625605897592140631276,10457881304788072618845101933412333126160339089704353596608910674508961127232,14926101732700077295531234099443522459232814784151318061435025890154852791802,4036967072197259618286839959572768559469665646019907384624959071646231971399,12776716624632228928613396031717959431597335742467953143594165782617234803915,18894783424164609284436913400522166453255844750192864579927645453695213022195,6303809107919167113924303987533838414137996606980561570652539716097058487126,4729698693443803882717817492985796053343431875965792864932005291979914613160,1645790034267553926884568714540144778649055395816210525904813567839945991808,8138260225269705405100573121045873922755899939885385491610389913906979427176,680936760009829486282006800072001712155424246576949107399338687767760991887,17240357869291182045663678468827695873425113788704614245279840174870850373113,19100963939745621863641468371111320143895293700517367016077996431570157414340,16188989656090417148189510820963186890780289777598053654241741803194118100843,18027402882394597868782011288920739982398714370069420860949975937357531046151,17780529984916796963712255733293310230026423072958099290880849386941451922559,20004531511171838591303710792081846238092292916166965045929062171308088520097,13855731634251510230399834192704620793850325654395687428672253016405315169901,16872938837392115669581040432902657478544143723662502779821325505282093696739,2541555081244462826761076743762714962901590548271316707071685417008817634653,5136424039269088350807839181761422963254683236279333039713142751702136147963,19216238128964101420135465007632926445321991494181045543846024053552797518994,18868537488540023742258053821537824724371813776839672880900985865823137839953,18246710415801024039719497716350501105591286880983169809863166130543617917249,20608694004331631709610739723463009412162748201282986294016482926528443868949,11318113915971658853560322943565673154831611543653209084299774855226816037778,16240989418312335385576389959938922684406585560688799437547298624184839261343,16171299673760267132909753100946681733778389681324959987573199154235691694977,8036823955656422391918380552495301547890420665617977624790236120392727764522,20269862530534739231936251654244170650781428788816658397167110617927916774329,2368678892744667199202318323282128737449992006513656480477288092472671147090,4618078962163037429845764284139891171861860687111566735174912070413086829215,12695350627501306162901105159009497730633599768443844225981772758225613194238,16356283146491744069785034066388746989409816380917535719898337817088223419024,6407893217596287850421377738867081146106659458551198123106454022096864887316,18168868018352364136212098098453930600797374324006271488950341490483455519349,18352629174410142476418438008157117497168118524562206830585500251463010761689,4344169393287991961961456515301754172943022039566219343212376057129143739343,19424839806870716108478074501405697296961947409763509419111261767390677718987,5796037897847804302272999466834285170265203646465480652521088328457333766863,17402105801450379889120987010453669096275392789725153915905747267778100864362,15540989618743824352651126288511222263828123668208146479603617243655978402205,945810410725426921570254447269595873973858272778720657523509910503434094174,6962323734045776666289031609372270190654631739266635759799844631053633876675,11382945272742312954364642163371436855283161775445664525053938433459897196647,18940251871958826726849623572811640436342841713786099464305053400421580490631,13969540696178305383564753026163726563325318478290740131984853424331762285147,4841983966001277917879506889862519614692143906356361564304719688757862622407,8939049562492171082419559182596894186639203815268680721033389307282239000385,19265363396776097866041313346787101192508520582744521467413665478819721956884,337106861429123598189388456471513480497137213511877011021531147545809512194,251367482782327915297484770356856386307188967585026711663629212746150191478,19506616511267234489421548744907283107923549136620297132842391511025844759064,20633589633280372440758096707466273580151526293980868749421563697429194761212,18833062060138888612708634036427140134887774731041742144004707524569102994071,2927291160590267909596732410727396533948837350308818016906834558527125752899,7095572562193114209617459307511041110255341231707924363346373597653253806883,14274988113217913224290208839851596837329960221329537670822013510325939323091,9965830780560026128320556230399915681196410289456547935188741323403719404039,10333365845496980935202034863900757172839454015352626511769637076650624839070], + [8266021233794274332054729525918686051968756165685671155584565440479247355160,7947823415909040438587565055355894256799314737783432792935458921778371169026,16508811191852041977017821887204137955816331040385276110261643892701458724933,1804800467126006102677564831888710635194614232739335985819349312754063580223,11189892034806587650995829160516587240879881493093022855087765921356611070470,20567450145123179140729389574352706949280207113956641415022972885523439610844,4666756311257455192796774305229624459258864488677689058174087310651786875914,11389253665835451896363091846189307652796786468610595637047377864063404843117,18793736599347263150867965517898541872137378991464725717839931503944801692688,4206344588923325482680116848820594823631536459347642329098796888497153867720,1739462481670645248707834504605096139894257554120906850613041004917967456145,18514227342636266640333254638454588508118462110178719555586534011641424431745,17887039315911403193186866703775654467672391491657957999455462537283842145802,2824959020572825365047639014537190268717891749361604043531643698340708119767,12521547103713919592301476538318318223836047611311454785951907894055964264287,8658146183671258251984364885894342376430874614261222570603159082682815800788,154390145585284450772861151318029820117470958184878116158462181541183085587,7593705166056392393963956710828665339496927193740869686529339432486182720653,5529559239163081088908568555890212324771345012509269613465629182165427812002,3729910453162885538930719732708124491456460687048972152311428493400220125686,11942815243552870715777415109008273807076911177089425348095503288499102855779,498938524453430895689241565973888863905147713935369405079343247530256066618,3976257517234324421403708035200810671331954932478384823208414346189926720724,723540703523219510043977323240437576248315561543814629392162302024056718473,13306548824219676333032339487546407241767961556934015003605485324283250885682,7970147269291664639740298762956131361316495463191268382513594527221399186752,20633313939958767604804835838065337107615699351647541991788258289962727735454,17162090859520817529294904484646695645841022315617926715432606252643123848792,9181379842957190051440498041153333325098774266789773971685141362947015398641,7051606617662816798224904133351061549832959857069896192072217769241273559278,16619522548478824222688310091434959542211899852679631815023615875678448806029,14965311177811968100298579672135357167599499478246106482433786066289128683961,9792733250919070275775594069208673385381167169182805600474820364274865306108,2069253833779081039049908513863485270550301879399727430830923273191877809560,15847298987712771667136245955631872888473964330474501593909263901393348546986,12244443532166430060291409356011430759892629145539185535677568234713942157668] + ) +} +// noir-fmt:ignore +pub fn x5_7_config() -> PoseidonConfig<497, 49> { + config( + 7, + 8, + 63, + alpha(), + [15193892625865514930501893609026366493846449603945567488151250645948827690215,8655680243784803430516500496316192098841666200175185895457692057709359214457,11710807066713707084726423334946631888369490193496350458331067367713412617049,15442364818086019103203999366702499670382575019009657513015496640703659810202,1358747428976145481402682338881091555771254635226375581638965497131373838774,15658002471767984962034589730824699545808755102240624650914676102923421241582,6420480504329990097173256112095253518339231893829818344055438052479612135029,15457172495394305353698644252424643614748461590123908880271021612601244389162,5745943350537490600340174787616110056830333091917248931684290284533019091654,3877253492903478989342845512796806320713689655633086736499730391667425329322,11257677301507982757739320943403112189613848490812422490591766717141506751601,16906586852467953445509312290627525856126394969718997799028223470195783329296,15263589725854108297280528692120758129000336125328939290924952731952242586386,21735940039489460025710098364749096267519151075908323637361429746399161905338,20023056608360522105358681147781839024069418874082333862551226466128829664291,5677500725280079960679484373333947430817198394184436922575072427342643665917,3080516739494460477657748111767941482024045797587058388950619118994388252853,21486496065617100719537932626843898998311175055335457507845650282870586541596,5371049178920102602305531530023787518286335086323221270202212974241707302466,3074817222296007572297581554183445947239252698770067839721345984255386069425,19180807038569629573914331337874446591506172622522351734982093457681161813141,16937785199372956273358037645552299688842385008757508130180245705952406225194,1688218397616770248184651775433764527272029131542529408516364801909017591719,16315958669815317541884966612581197291281164499674338063931623110684590850347,6218230753007070123505625054833158632732536069700963073464625252554943737669,17774528060285257656595928889288330429565059134928074258373583886985960212139,16197131592052727313460949906369199026477758140133103701908949020106767192893,13418604038232148873269488320329340508522225417123160144993642839875173062296,7265658443160253752317166706266927598319661172006072732797351716897681315157,17200150079219747370109251547638276280610591698078334228421747259741754887,8627121890622175767416692555014275717515106888840919734160364408960047296494,14546964505431549758350267964924534495477687922558528647552728692912697049247,17132720822762740343718421124251772119916072270451579802112353604446214831761,234333065870376500756753915306346778417056884715946003873280290982247600083,18375643491701271245209094287106352436174133929245169725584150600992143374298,5158448692161567615645197008737390561357077078129599243188536485308363800282,614161645152783610732075198073600394068518413590650990586931263981193439341,12661793104597977909223565537293318966803153852970198322604479648383643541371,13041905650419760925682179803296711066088286278603171065755078690359168540579,15006023590144168506070897325649191051975999212058008674224953860265667513015,4983349941266961584317889823965291023669365981564144622292227613558024302012,482274340065333833495445682213681402212945945150526736364263233985449810602,3966893131006556898236790392613869798057510088913626163333804949895810673044,20923301526284527685000591080290190641416245135554916208054502046381491809443,20838692384005825835959734210506718428443540957544929066941550833051093000166,8282357714606447781782716442854085217089572080066047419459610560432999443766,5410651444876169088887579490283094453001167796545260026969919887357676973543,15276966646285075387317940436655285872037988805762800567413073418506412856419,15066911464727337689573664613158712498015597773345106524271610486257089622849,14583790985054968382519116885383608902981814292128186470697458065499359610203,12059090796146479535492139954279038037217093044815277624197659219529427760034,7273811886044732271171500579064359282424476926867187108258957006777685922641,1463086899665237074608503061872751147444637332808872866814340325832200880984,4403177494620214359779479537027014449448686844655371530169401219256448130398,10860968418848589590932601250051274256181778387706764281989724391784015147562,5268786978207139542368199165627108325282167169564314266747401266496556301775,10683355823176907476704511935094343405052640940909677712096702771871787224727,12998090263935761477316698114799901126086030852595294916463464609721875730852,21401280461419124637791689956622923839426783908187419462727763377498739154778,9827224472048063173905906705579289843819400982583185823840008976971109664519,6215804144039763858354471461864183189301201862376216122255322421321775987311,15461308489200344015891625455653488930440613755785081602434124530381300882814,19336334695450889400681207491394600659946256404722006637851709906131899294790,1712331165786355540802697725399423752392267480553199895882357858951999960061,18153038525983970702748717571053178456148003321236490384959117581005013333018,1080183517033034908031748897211289245459330899463186432840251241943892326023,8948022108193679628295152361559653763100984324221629445749311939820327674857,9553342289560502306921915013446606435600388298465288181461633559299564421155,12714965617376828547637017050548818007690047452402682720666099310241001848988,10945704657865102635748104464461970844653553427083981539165832149959193156197,17511714411688352203059545713591160825310809755917403629838415797949261359373,9253691969419856285051096287845246422848295397226841130282244592511676512433,12218945350859454581754463621617733341764245716874083264842931063272433793037,15268139709971695434346690496076067658968455677120655340969837725391575270485,7948825129295102283421620705853168119104356217418364837218892682579042520651,6887299291348589691868712194070626390224806410428583073294593431810559288717,3610235157455454109573625364057240708256027358184031380521552355839155549623,16532488069063334064099666525339953823111673083177894678898823509406678724969,19317517725107761280217103201908049748015068578935276576200982249386084367574,14980901224290526859762385599553818204548992110637275324411078408232697158492,7741797285700915051013289492475875831764653137095445146268474269974647962596,11964233864746181868467810392101989052496076326472717372132104394243614334823,12746657111181947224582102380049766839578185276220682311596480990298620200286,6408726946032901840418309506578019708113712492100046332894630652186614300568,20959261828945984489015610988397031913577918654575078054490013338416801523934,3173674599420546165852740604987014294355430358334465189504551707066179193914,16110281513253204315524614633789708146700074483476149119440509845258215816735,17135377580103690088853370572199271964414896742342749305424508776150797285064,1405769920008485935711505753346340073052795087429311991287498566024570212365,19088073362945853867763169651582894739272002359692597239222895238839593467749,19897231284455588615416169252449008151349728648961637517447194842672488184146,20476415629812014715153863754869742189693986277342067785614833846523246536739,11074321446706734150375041020583051611133090415774365192315805856051215270782,15231367549323128694183572409135806408519505225209496441892541205465727777072,10515952069292929457050921929301902464262874744159361114100398880194109971971,3216370118771824418364829250073852356774095079734089790620447714552849459645,1940445924652458480775282556203659335417827058983719042726494187979000691704,7899310668555694144370607061960060230071621529123669746309839400642332452086,3125410912833939638823760577011271607678545358020637189655641109813198731542,2980079409624774815878860133121670095839651294537928173829312563570356348730,3766498515736372882285796238406751547889526137955288498682767455795237989580,21751217522789414135074956130080241003845828660310903627224390345319859795839,4947229586642010378772262640583556676497656670779800090478805824039760706318,2168676839236948809859825591626629233985269801981092020040909992251312517552,21172906642114648036685108008020762271569381607092920279879047961076646303327,882675742500939602754673078407141697482716600335919344527751158504426951699,20942968937722199705624825492102184647835614761458159157410261242387423597787,21880640497503102067412608072166388563991106464538369680846671301780353850077,17593472026567804917122179982860735087124786197105685847979050530954084564297,4492875530722152383516030266828166766820778742874238188105265500984280376666,6799763500412433367637987497601148507907071065930142757525839585946238894092,7812331664758167657763399273963290017340604299019483750344476103319142702775,2222332747647756867926707541092465789402467819000336747029352557749400316077,20438798382149666667185974604464532451975024544676922060351031604444896151494,16155157103796724378615022758633778903205872772589663310774455593497441785913,20281325298063880945091623185126257485818350714264176365501683813650871716911,4922178080989486450454493110764936742315495846015561426329316977670113220071,19579063976700768282784922967523980346960151903154507737857728349662090787824,2458828873355000645851832396764221987760639423132968569631493912353159373462,21166618206785010755521994106737991950548963896649678270059527421944129497211,9131643699583013708059191290958290089892787165715294157378879201986981390031,1820371114511473946932363841206094088983972935646887524223011276305844153307,7264184404232663540867032945940974372967974872966180860960243405462016972362,11228656105550475045610757902396386402555430893045183008968975441800824215261,7151503559113638565935009743218857812859208253653498318591469659718664783964,16876040581364499037941813142092448836399042253618385783944016186340703846779,10334125383426918152464737478646460879481305348617711177774418125714273980769,18900559046103390399749767994653107625464807708680067464279674225251110804100,18685667289312169245526749652972366835289568864080726348092618145885982989561,19970582871354083670567197978171723431124602481748785146813441774826500485907,15873472427137024971035326229485784626398898771525077832924901475242073457867,9090803292122260583635467396769157643561973206888822931647063181944243467413,10156295009710074552070572489422360071526675259143523597882131082376797944708,18600630374968456966046654667577076758720435487386724419578803020365834014000,21292291483064245088298314957584631356250347533568992016547598449487977536460,2784266893057214755054197979675795184619614089277590464548240934105557638370,21206743389683892419024645604723431382001453245850423743581664552645211926469,7915761821775326316473924816837591351530533394717381318596295803119061411675,21881095237485064870468603451853549262304643738646051878343976465227744077912,2011784725603622472271597952122938645154942022107573948889667939904597454410,21059869383015715705096974077910228193608826877524913363323189378554601804559,13660545486380051482020817701263881806531607595506890631732662177505270213284,10831091042775967380899180760062457635694790868286967266013231823406639854653,149288128407476550494800886735600251983375852319258454101603889073198917321,4032475033542195421623899365282946172767274020529645277615759958662043553317,17860535012887415629230166789742533149365132198763199254812432302158542514395,611194463774512114860065022851497908950074400927073001695280142990812150583,5518364261187313845085346561539515049557757056751872639492957432879259341390,783263978868449790737487156609432867806742277074765259237378374864740012575,19059339826992310300213673274315612374137067865428300882729551175173242291657,3179709304184015397125565132235783368222831063701934511986753856772139349894,10954198701843076039176000728742415722273043852061382139560487789741501275316,16411266672500930935370066093245284646483148609897099268661795671514664627451,14614816948231085620934132277599546641612327229810158468490195811014141518325,2458257206135880430320027516329707989817636936777744813891328347210486074414,13549483340434455515002570470395006683062583844603627042649952800864870013910,14465927800403373425828183741641078057513049263889255157342086762479739044711,4039391352709218793104596256671892882216573882631238721514928981154171136548,12750457082077152291009387792121930725761848879916565703854704756389714536037,20703941646953337308096638741387402857948436803334980867971163138332859477843,20148755487317949638981041809982361196106823990400472213765926589941031736503,19035096428824471222963574043396024781574056587456391309795571372815435282399,13597108420431213178364236660710194375344287228654817880431599113069659963625,16737817219786305757887002253067607822378794077688837656791543060369162185533,5164935079689729145670846016031605160169301936105766707946436049006171651941,21653381930704765824477248798502813954284378782353810890869232482999795586793,2062605478140760101860087118379474541965619844748678233207247884294051836812,6841505950265078437298089354417829781031272459823272323626556598403583002674,18723551101558427097952125661588457059960574026361073828482106612260297969553,7898804490983679270754258611113569895515918945891808074921872907759024464249,10882278698112390755842292529204069263813359338030917602809789513528936860051,19447560013395173052961224723195565400117958329259001072560983848146677205053,6251288025262210726686494480483550276704856797649458538460443509657307219922,13176666617050786358406074057104742181338809005466316548399895981897535342946,20703225796049910173111490454489910459787604528779911406172217267261190895618,20336720518722954780604743873837334696992422089627753769439653667292899832714,21420427865372074512365684526694872695798980614525900481233709853915806389425,2498895690812694987926199054702295457557454143930759961192198950277119149872,18753512301709603592612141197073246313430368834576850495154922324845448997662,13229612292359498096055458608547157785066962647476451239567069089111704445000,2690879919643532184588441383789963956137193400890598777054187145581183393168,14142396602342548413722428497204107502988046500369932366351553161157672540408,20448725195660080278132534867269279218381543910636641344871383714386318629041,2559459540570011016181396098001618067535109329950570139376049832813577592045,2209294835847631004298393339896770055851570184195462947318472391473531519454,14610669112573509857774678749257346364319969641690596877040685661582231189775,15281088465087253563674405311018738676067395725444151577815750152538449780965,8600553033773805414817363397077178137667131851961144771667772828459236208319,2748346039979601666392027583251905158817539034260921486084376270967628661657,6854960712378511006304629447898292218014632388505703802374806527561178043857,20207552563190343462280438839438087615024485494479390954719687107061991587248,10281541252271366635718295778088948309847900730867531177275273130071062184625,18855605847424121529776135453072696981767402526737712879984848146282568841809,4160214035780913418097601322951078913381556877408879904436917334405689553255,2122867135885631508183413043949777333811557914428796322029495785048111325437,18793959580906171893053069386015945646795465354959679615181136313144978078417,1043591673717355695648236328597936528752358227297053230241551190351813693314,15686469257015275311444450012704351019335987785561570672026138336552980987277,14048856209379833670666148034655599475317994357805584661156301746235313941815,1011563953969880478397969933799483261900428580241502003261587014788238280391,19240556623066672446907714818724971233422104071815927265423017590508305430997,2121904286573815063480388650799381683473766736407678915747169455786741101182,6724437969134367395210139771738563153857495313330774537559578422672993498270,20206855573383441961836932177838081339503382415601366823182724056749038447809,3659051978213562322887447057085386386485486575515693147713900345497451171308,21246119528547168535908718411570119652856799993958321864163737649108920924448,10446114322905404392321651684574668727564081327779662579984472408056125404335,10052242287865403393859620372179811039720807230902452334457123873762222543944,6373462744579965543231173757071025010089494620309953425653057223643612177083,11716070974813426833631730493593924834405915845847679294742728105127112594434,6451284530793440411577197006976867289209413848762574411101073727224316913966,20143217291446069633369261481904349401356557325260758866598205109039367201468,7741896897172494958877302103827661518814930985518070029789560123401964418102,7414486245715284930410091802521351113719159777210731898112598211035848096490,6480506916211642204624111742530825907262535747743645014149694168805302825019,18349725066341807634895742572304899830893334427067633858521634672944685466440,1838291082333887710851505844271184097051704051003105078056248035350245616867,19201915197596065583046168024521824662441686729039260890206806469763190071269,11253788423541320580105520117231178489492440242200599071301755928628199128159,6048832714406694444296771635481934823208451249770515560893368035838759154821,6398008918881249487422929614611145638894557821587972164243877575640548705346,7013037564266297435879776776659289982125632651326438965546874242685502904730,5942504790082366811245813670914617310604940200824079289270465669331434165301,14344789199380317440464969138686896230070901882253997360605407637865754361287,19920212380356573378521292048728904573841049083972983190424200459025557666792,8983390577894750782268266038315113359711163721228398686939390484499979421166,14953991148867572055684497824790735528852361750007063016470842397064705671772,5592033578501586280289038012647352732276003389059749788953239057845882297561,14076883072716069263619564306953450824526010844333044566762059693672378725675,11108270411921226463443318601950168860230077781212396032908932369105145901793,3681277588815101350213324449908372578846563884174807724121308021640034446476,7194753190480156904207319938161903897566477363779122267985209483435838216959,21241255448366937244332942306324590869759761073985963892514045368815880517382,6203071960722514588958553813186803009742459823360660333787981951206442471249,19041823565851118046937769551785013706136778514067168239416647071096062639366,4928136619692555022185087228378238193895894009623071873887735418398682287593,16266329364886004534411977872528706660422476743809029518681886596981922182359,8814684891729998059175829142248330760704444206534875755023421115211106199303,11072277000652722690981202459933101924925520292174200155471966778637063588914,15889576313969861857250394875354819627977602318110620311480656842740292435237,6934515229262494305594741689326968268143898236690173897991110238064230886755,16212991575388366798683594066983659236103186124339324856776288894513503543244,21100508914867482363389012032457112622475533432309937238082785660233880354422,10381104469089401657446748653199843213201270332853172509558263968565255702795,8849389605935865968361613766905708889092097013638425059146677490704442276611,4826404934194100291623537890117339503344940312401101713754206109744511979962,9981819567268652304810465083896863711149056310505889216307212434682251812603,16218484218588441290424553684558267080330286201433140852298971691458926313766,21317661296916247018967238829275056855142711494630067664736600708605437812892,19523923008662567951910986132173659591346561824926093935331274289896011695634,21439241836891927940168832009944210084078628922824257988298290967895179737163,3818036890597976956138669961319975835941979944306305168232209375279960168960,10212547715001519604442389033695156945619060410131175896383181616280631586732,956283172524544133830416114111944076629240232397666924807554743752464221045,8545109273807246425343308224167362024331960554428088718932211551700420545275,5647769597708100114837534314408246331518385631750569421373379085922684908872,21776221280695269311212391423788179027868152904973644113087833004348746215729,15989020831232836203074762591626149244364214836699154611339161287030952623233,9384665943619921791886218744024370375464874104981653298499433530463000935024,15469006121097295841026542766455781293432005131673839148320165243166330403027,16103671377537767724271717097892044266704736999841135349844319906338275108222,842367229428650719054831004741080336526228967970570607897528985803108607790,8752325400224955775788313769797750158375262384121380328719514077259567119347,4803861091350023344885030428100876947830986453029412601567992550504530969575,7917553047944370948250445233027936387189889293110390303835890604428798853681,16378323148632546424902611135263436821435778030958161546757828745002247975096,19873719885630097137106352132870659633926425645300622070145979694717581586592,20324790419158243246762098227260178678767896786893299456278167341205663612964,4358908354524026935988729716331497263147669784003421920394531784876541301801,14403952632095852077754539203207047943619815438482171213105824864831554185165,16410713482142323347391147127545553384558868490870150984280601225023662513809,7304216341846662695189617252648753140769311862815448449926830269690397729157,16792943782280077475956215580025612636120139194657275471595325031090407485768,18494329391227402645175320826355306995912366111176422593669423022411884295357,3277597348237827068690736756050060740435013727549848360800059544123155276133,9396765756719511114743964794180256605700037182617127755220919249774110852382,5637053961584389263881381098869862042993858662768294676971865632259649027245,1752142832257643043564515360000718468888861086573246457619082905919623770956,14504506574384680785750882507533398260948836347427103366421836731538357314790,18947994518078004413210940685748534988014581551965984303066903086446389273117,8931855168578615387850254663107425567403115805663142600825724478150698936342,10982092525200624040399870568387498905840578524691489797530932831401946309626,4738907023206802373255186532236849256768509848242049657234258536668430260775,10888145285628319545262252531874405309329869513560101920454793431198094714989,4767721624212785367044047554655794533816937807005608600525762243335180089923,4054394679973840378112083329204220302222586590732553688297938891619998137578,15390471663419625573793381445844013245022413344196724396864223784781333233143,690498740448849288977645176879593806019080276382495160049117613302192708860,3326968907274045758110436838010900592335267522219473049427145975873344598768,19461545874830130561487975864151403334363998126023624462211037468138940028328,2255249425919459031033123095731665691066980364231819200773725596456576056043,17139538647342063569964264947811360956712827863014723985947727876623459280539,262834317961189780923232082352297808796511874872711860311746704570027370416,17784213646586812350819691264737755884800773322574478474130308351003659945289,9206479615073686723914227166450906925650471865894639492301222855979337534393,5955379232184076713510750681781395826148323482009739159408415185190732125682,16345512244217240951729073298135981012471478596479891072149124888060645303490,20053701095030547796310908765544502773063879272854547881438596069907281565287,11519146559536679602608982593432194283609736022486509747046459824035493513614,10868663839942247532249591973192159672852196011910414460124452013501564199585,12668355291693420029179738224611760713369106517542315102687346083105601320689,4091011252347209563858280520339886760216002486858313383741839652119084430270,11416347683590132388448480763970462739172261435271326798646502987745949753371,4462763980178675172541782335457125059884067698347130082276003539434128058577,21728891122467658477520865529973242372850367356840114983386033432316519759391,9556106604731806817435679463077765288658189491612307664294729425381901530224,5086982973132652080709554654284904229374030594786774699435814748257879554118,2278505454992311041650060186856758463754878439802195559533882189615578260695,16123495070352975934848591912315341924608875638550779884194576881433498909405,13177225503435100563531015597038445430211235761527278782674200718068329833622,11626932451843299545922103072142674578946680165802341368625957942237790110177,8872973246419344365802198448930136062421718851114220299577394844231810068090,11920016786052130191738519934437207519332291620474831138559948859328822621221,2773753221970604083383541092979093729869734021029185810064937974430862835870,1194583082499114147792330367943150006952486615245506995832323057119894886077,15293312601348482070373672684782686300692505365845870624263228679370968807837,2292156760291800990693425534213440357167359161992251338587906324724034592198,20920049766730284147153707151387304988393631464951398563908410768221002588086,3587899345078220957148828249287269521408604837648269936718299413697642586126,5857527906708110948691023855516662527925762284342493618496858248142623857037,18312267494676788897591109008609888960798722042916784593521762607767538629817,18354455618287562133438807735729369657256664914390381320892039403006410339493,18594037435499535688023807489676900345345731643180370940972090155512943637000,6361231157299815359812386352981667048590510979947935475914610076041390336883,6503045850716008738909204934356093641022474278658078426701342798380459107813,15826908470360778431798326530563200301151807861414464213699967513881040969457,913167165738148713876672473302437265273760468892350716109373788573860454641,5163418960719047707254162004625467116036830361107107814320243058319914687515,1852750695670141634014249062360862036043602867770163972096325792863710036947,16164029969996795952250343426848596535809001568622155377829217918121790073916,42291476149937488089591434144089904529405222471677684973768504172369443350,1329340386229357940610579826659090359930768580941108555938139535621252899508,14087936453397725507000489457270864434699508074557952952329368237400407748133,11454917885298514922755456675259734718428103879515668717779418480236210705323,17749966508430836878443008025013283275306943216523661550528505419303121693213,16617298839486771009961431205770630163409905047728421465641369616889696635464,5622873871440608391107520706189063847917690892897751818294742462879871297589,13537715561706278379083684257583804567523085149672090320983273122424669242274,12609629910090871112615676094781247031353826207267723991911250780907380059468,11881347692420971451998583525696964339513193164613288356598017302547676912004,3620434358220496198439193226313617496907852030586214671337652678218740406153,16586456872124455799862826347901525401871594428044067424833235946565396779382,19602593015746956165116919928045364895525104709835703557292833702385934632182,2465427491077301663150648330772125184470808854603184374760649420983178107738,12521323976712195518272978277895155774288446093713549157148428964880747896725,361951232333654306694462853852464888974834703718677826403016226307188397185,20048343816024297162848487251896481827914904696805156112188099141327595641104,997638030405613623344188782838773314122493364653596616029491564227193697621,10932007654988104622042938184134556963651043067553327861790671211490960094259,47171599193060570819891696279547021610376047998583333086685382152080932821,14669115378939104862697280661831896914139331878760241858539421915983017116504,17868874372855679948405169936193924176514630305572838555185339642210810710203,10178296575837129106771098084407669500326673901243393867574658658064222502028,11497182727976130924559852428316615034304736115488257034951588831868596612725,18847036158089242140209840241495282890278502700082131513222116906134183113862,15514518995390761662346743876733004358408187550386554449789531199638765348953,11474102901522012346251529527050392650125347221410246734211005177721289856415,6612195415835443084676700243243174090072629504450965229103970796390091290688,11572474094368358234669561324969692616275099241307798860733942350364532366113,3855324911963410548772360326122995145790506408472649961229511965629894550308,8802640003128749594245736338745752744580147773009816234644244502373660889677,15676839305513015047736600040932186843826469281853634239081282896349443894145,11124722103091011602185413968164672678635980457394627450785290630813993266691,15087674670944618980358596427703842917302233637812357643695687556421910213028,457555060782651847600218200815104907046227486293278645126081160142069992497,5340353060455057701755599760342180989590806327490432497082435572367648024359,3289809733259936118731355294329652879189400852472418229718273887860572748363,1821386174933044868215348232606758690922944887434531299978498726875279584854,17399236630582894158137572250502674699298844870791766041927951699287421557453,16772722824042046255416248879357647708113647471330900665176012648038469814744,331374066696126093678097185404981758791664151917354547180452342655690460271,5482079579065945934120471179616600325379965440378196448353560421120276746028,11861638874356162254375133266687016527365630872709665703116365332534843803431,19751278476934230895840638614095718373810690662562196455711240141902305648888,21017623330912840225230534280017695045717261514215145256795880310933667407841,9692530233397639077769939390011937602190121885296235066426091743618448584134,7914031992737639503490179289412369887137436318696390718781298556229610513180,5046304088054212585035723354298412694927209198400753780585596829596665931980,12735457541003664856181534137486291132119134214862779086936585300598349629287,8144204472889944485922664106370529127382213990656088602566223875490414163362,5526161442679804982165840590640681348630369336752481706044759543203459722566,4665464612431440885211271075488840033628676516298384234452346107374012633528,8451965709652752887539585363308640999657377914501438391781526068371105983117,18990458193856163728406448194111866469438835810342179114684453609893347662421,14602960690767985987882800342208585041637986661619503513589079723840776294824,294650277854196485752526848096008214721988745350555311479128101695333774927,9930361494944692931597991649915857642608730961125454734483697613693272941776,17972565769620820679641368732920396905240248490243886868922250461473059009007,11842743032528966560856860268344505094861546674985872961254820091273444880060,2260251491209762630871337015316066081541066308706934094017641769176593121838,21336986809148977544823484666876006147697590184356254785752148187171367963063,15637234083283356311249527335446193685599985235080555266374006156231977517227,7637477891046186378249227336975234440873859617986704147458186423096226771577,10435340982947407847927678888878882924793449778165415690957335683641419176012,21071574044063633264442120715854514033847137356154103023224485568597330648075,20085745552872944745120547909310789275453780111307008151203836541147270866122,2369255222739182549768488367357061329939116877812397072967912842660453854658,3320710154094663715463854219978294133429318041799642537800174050047893035878,2437552820481788519744888712380245016748276158860265401041560980354471184914,6687580113987208531705167517979176727449238324356562435678492283111952291541,13835828959457330678345759960614663723017667326485961761361157914420441377430,1823843951353887792473925888956554516299304358703549730900495356152013614424,18229384804985230011714562427207966412342158903455811854157839446374012856695,4983049472282717134994110428470567601005310848076496400503178535459679438524,2047051967230753763135778305592853785901616983565528680886843131244871631064,17059505494771925862841990046823342770591010831955480339095397897088168520686,5845823714127413134610517798305104245114036685335948729450609519089263487144,19810252752845594230307894817800427820113926573704856490871938876757561680148,20741340243371419379519807725035036726040739024854919427690724405113594586449,17305746835229988220561638584011917989169628535378748397361130724475478785704,16273970657972145440112726408308019138099820274904080726219726815138597785735,4927605725478881247988642936459897069651251926499343645614635597380235002430,4076655226193629464789557616268492785057128805549395585385432329518368497686,18134767316186963456589895259454813585756254459227058992203617493951135964914,20798436806114056077588608064161229365173163847083955162560624566238528904361,8811900287453512972593412116532745098600991077158875340182906101108258578231,1611466530857794066271650650204918615746591649578992581483080164777650137733,19520757346022691586967284723955378385034675472244175822936613026597514818901,8258287931139503595713718829279050060190693609290797346704848518381891359704,13807143439443425137076128013998009581746894329904809421858222329599144124143,2034200548964915935625429760202284220693125881760822084201315022529206424506,20594375914400911567795140472107624446159181622166676420027082349633992663301,17773828019575037451999782968066986504577459910353828196403976545023426528432,10645884969014005687699860915213473815514464399964009808411811895545112650817,3135829883501342672772973577699379927756997243617424917654928164800203666496,21807676600134151299257078976418813484444183016737321278512745883771478511369,14168063038909284721702678019083222059818438340503980617872573468231611140141,19022539506931505257153342575586362988716958060936788031721967221986624233067,919797128086310623571009200546035983274688764270933413427846490906074137487,10651353481391913627770814216074873532920753703051075188645774021198634943682,21601553598752750925049978818528421110707879819831249175157596816870100048288,9544964974935674319204796617933096476421551193682156030394816088243121582636,17113833205578964054057051521784698139661258340576694677296240312431808476286,9889647672195559279745677506312894570402108521106900082889976819798270827735,16028191999932520938901585234936954312994452706490572504997534210876573833649,19224701772787524647172128751148104366752057774529591812815327738829591289117,8065294760892477625290114823800398061529770004833832691347498933238361039736,8385011404987806129246014860479833290406969218526611328586242951296814426438,17626526623257098006524211054563886193098683828265081734658432468695686509315,9760584950604786147191288118087660976225563461953070125437519145090832114537,3282956645059793949082172795607530130101621492305193365378997603911833418463,3788543541342252822847978185963388795825378340921321139695221828685330606335,5728277403393912877393143174229934529937061751983246730506397742038949251701,20532577038632159357383817240596922896191478140446876998140515404169184846609,6138500779693128517529525961343097735306947649093633133232282430353593175172,16387038830089541476468870208162294639575042754761542956218362331966004300870,10184264376398708852688445921404363179240954227345322711923845040842165453208,12576299651793170522912156101640799825541149618303513174146382191633847258859,1340015400080181141720946234858756484323564628916867888877667239334982793481,733959369856163480135680991009606990817015555938726628110611986599242143578,11467033813562140192244869512537566463715027496952375979909160849747976831918,4619667645046391146577435774790188488541561222783010406420406869960248783331,58552761198135931030902257754896948615688045302818928845814661296914920622,1199849881730507352706524556330002080538296688430736582840314007371442152147,7124502590511184113044595527748024819132713282667933641439666531514739645089,8623660134669459112474551498616256867375253975034970808437732784494772311361,12655669439191191182341423414424342421477486764113555800095493091893820045534,18432703875775002490514477493898870315422995231506677048275960580528644904682,15467220287938881354678249472400749704814316816035426814619089032223454845193,2851120240492392321044027263769720216640877441121430445737594074121655318176,20519914249934881206828098454303256358482675671718589102535780334267934987941,17275124961392392047135728713829752470490098022504524438869454049765356211723,3323710067527231515807603961736782048796606296990840839366613937968342331886,4468708240622802562056471128793253296493002925988003094771284205007772045098,9006494818135081033869830730030943407240565201693254355620348420258773924028,2624130417875598753127999576825019766166727976335690685433712946223008520912,164131399455376615654870570697119442360078693174350746600132391198500093412,14931668887432843139264972187415200544679230597820424081936926034478502874299,1638753880783574431267395352024193675000113296497173968722590753809640941864,15505380865926802396097545843811910443367233632805651511272732002583232431557,17973744614207669251901495093091561913998272050499760575282030108740677066624,6137688223696761009295745609563284204827706564566466060484103844265403078408,14774243062532823236792831566222119634320864630838624098798648826842418775856,15864970393171078370207775103899428499600152663946379517190945807315353544891,19010063123357565300336230971672519561204810737546730911549311353159512986740,12607162829921425080830052984475623157169603642577010527391007035133383807243,17803108634879437217723652777640120469990779759700458421844361066182881628345,10065874953507223318296028499872542865030107611981933577973812883589535269142,3276471432535144390388324850641020151392959100393035635141206272558418581928,7532054601401798035926415744768772852833516520318445183340725930886329458991,18893822928119227829016544343228228897166113682019317256005502643243867377334,15940597493253236451533839310728876441657428995464658827726295547815292644378,4268009387843764409267791203070919313017052533005657826253994943184768120896,21611251949238422413354051947529388972078300717392131751061464498329326474580,12516447001729804412674006874184731098280474050775388553768469608793631490618,49838549447142926741568525697026885045023997277705726329780325103507790978,19763902910323896567698991616245963026306943100978479625077573937114135803058,12029297973430627253212633299020402005457460023136429653800185001711727387314,17676997725594777991384952086633589048516371093397126876621255518370680168503,10567543371894667303450346380722020266352683222046730266924342174164712049360,14583364850544999818712646438016435003942847076919084667364987497592599663937,17348091487238815837308569582101875357715798351834275089190053280855958465528,8743083090296259283603789316855921930102444739264013461469099560398359267240,15114064505647935792598848256320570567717917317803629185764147361301698519005,18332675991829764561879941291908436508530604635608341316693114747813051532006,1757567731797951053080580099911774643896363235228742197150882457231133285549,6526388717947413328592956348507481629843816325885832861915399601868279124246], + [19332164824128329382868318451458022991369413618825711961282217322674570624669,12346323761995603285640868741615937712088302657627126374070962894016296466118,3913895681115272361294397190916803190924061797587910478563401817340941991811,7048322889096718105055545382948709082135086733564574465991576956878202831861,10375086910057323893637057154182902576957472442368661576421122036461645295833,12765622911241487148932810040772504127756393086809438933166282251044289864727,266900212758702307861826326591090138389415348463003233900705815890364224151,14435131616556129905356866638030823183270286404767286105643513738132789033353,5780976801287540146775934937953368730928109502001687434229528186520268917700,1618320442446662026869390273942730786145909339107736579759397243640902802126,3818399583522206096165108192531271582827953520684743806492664825009577810261,11764506724346386316602508039052965575734225646587104133777798242528580374987,2414215974836165993714858157462355581258152126063378817495129367240311967136,17609437036230923129211608175600293197801044251801590649435913902851695334081,363438080029711424794236047863047716381155074181485245036621530063262917196,535766679023716739184211613469394818313893958493710642899297971974381051070,5305068908469731303772738758164870877638068032868328180355958394150421214337,10807632568240507366657354568432178961148417327580695024415275247652313539292,15964415873358391713354948903242729080763777490509563223190335273158191600135,20700362719972015883260687302741075186857660623182772413609788566925949033885,10135127975676256977820296631533839366076919827597067890970660746228807376456,4251490167543116819728642817282216847143714366441358372252125244838181656331,7745587495915033527847242564710473705100826890903278244320948416581724663023,11741113129223221800185946819924457344647035336264986754437921049066977440806,11630296782890656599545188109639399768829653360050213193782325240600583381364,16861140446185941149398487176581839232380972247302922484807333229513905651035,365879246117123675211400356410703684399715291171114630107795112994207447819,21725607857580053522363567649763546934441685061337033780528788383243719579033,9222866548596464928765000608129177609426964853736257576074550520759533736918,10261578281201197531384003420612639018011405529775212563256392340336951230146,15644037447921591571869862919382888810859308861783088910843592577202362807673,12752004188139535619565478547449108772137477456363099481095747591698702436636,4205805109630387448825516813913983509046636797101589615147198457314360427718,21047095155106717901091873146599497621258071512562421967648909471775919992713,15624165295872926124160584750951090817255240214488120310950503163805737026315,15064589937731741958666763896598138037875460434244947486199623542160035749721,1801577872277160959016940766173040841160105238799805406938450020949902989173,2896766420608048344829901127120623317655260981420052771341833288256800199953,12828791469509204618898135640019714232831708508424682785876476343251730674999,21363471986981372923191391880511344708743312828234098289107697080824665183315,21372706354350795416381912271616633829725494570576895047490974943034914894898,16006531510217730955981102005088687858079561573088629102219485906666961331083,2389357602244845938251345005183369360523566673990464798041306722747500447645,15275955107196234672088664710679934029171843237458844492987233368659104714648,8038797517535218686870517662905230585331773059774130312418943649247287196930,17923922393436914864421862212181654800719733137689602673604754147078808030201,12890519745320143484176500044628647247549456778462652469313611980363507314914,8058516556024397257577081553178859094042894928866720408652077334516681924252,768425396034382182896247252731538808045254601036758108993106260984310129743] + ) +} +// noir-fmt:ignore +pub fn x5_8_config() -> PoseidonConfig<576, 64> { + config( + 8, + 8, + 64, + alpha(), + [8243355230504186170667337521705529968548180153769821936979698914169521362326,21549235422807751640146583237936799392598740234259041629069949854834009192195,15309683586299089746803554818142261058154570215179112411063662706557055610156,12007539402495575255755232938576927941514879725482443887151392201585760698040,18793669376013417649313139054009540629720623019893420956495818743913188610515,6637074549079529416739232814950531409613090469922787253991308038219905474403,3042007484821627445120830225760006405192082634864137749621636257026891883326,5337388510268581167254715112479133594089770138749507073603490761032513368106,12325446798142239188409242319577957593792614990556679862642230477712636037037,676789245562467194073706116744095779362669155912771165373940448756070927910,5854747984773506278911353281567883752585612596682487681686710970786834920041,11245406467967785626327694659468342056789182160059009120973665143197638081760,10395601815816075071544509552592627172226369015806880764151195346316980080894,6756096862783612163697577917108261850810460757753491809406999449771712474223,1708595072322964393019739105130946639405776432058599259998973103484499438306,2817817145890818701877539103826217929456570347854153048034669346981432211659,20337270972708498869284875601749656006552838338471813066271573323209168221011,19192338172842323468707146045612196807750411464817516820711948717057036544820,17223253657227310295312621282100531845543865578630870272599545474783775759681,15004735209586276209064505708625280228119288986650187909395010184201059452346,3875652974956649356154345677088455126258183810851242537013757276075769588050,10514447960615206081458524578173743817818597124482828867666984705327684376752,2087647010835075851760610474040959236825470174942075295716631067964093542910,5927163251920754154392384551305623830535034440727310604898855074616515892551,20585333621997037505291454298836355589763292536744926081563336065939121006537,19320876518201905459682928158170419256739531666800973485138890064423348282196,15942638804716709831210239594904570403189415026144938623559274984027906868220,11197022744936474661934096628367688581641778841814728682794507017845346201383,11034020922250561671038205476395109731446686553549026383358725302157324264144,7574933006942933995255906769787776608010920618615581322603847524789684181970,10061361506744906780155460423367413099657465765582917482575074226383566926764,18611343221859570540963418999548488653944851224739716224660835306206658947980,17094203924957299390365889251598099482992645049968199405515681968938743421467,9407145832890449495071969940777105644547801064593141904558463573167881762713,10921438560879150587765515492087524756046482460218342400194862909363870270743,15101279960899220452674629307354995123411280418550386595937683027146194547144,1872357133681596467751878560069114718371273548294363719900935160833598069645,15505500304018853111989216259257978796595506623204851206292254759641600763191,2079667978353221447444850850900204451820443725835104896018664141845782871343,2852655320672908960411014862634757863509253400797831983637863741066632490909,2702824031197306101989338159138451445088523866133498139857862801497066633794,14553308731276493692643101846551382187575566516925133957384350697980935154102,4314969815396483242407853639218064117498232660761075778657880116870422414637,20236724297078811959918602376319440958076910292454596856154100774072250182183,6360017115980704736383763605019264589498600998515606807745670287390050560160,20856970531105411628054833058646203890148287930330473527735908484791842390307,17691356258507144960616314395885779533907781694329041597441621553108536658757,4464167934150673174817562382299722091160711333547138388803048452674668158635,11538922347277268848344412167140306567742076984016453903533772667841006045703,15558861252260038101730449864896864763293561339637017072015859069059083288561,931980552683520059135814229579184511049009637966018180567726214946979768011,12746506550979326220422215987591117730943427023997792332255149062957909690818,16416138987000536018990311324687201169959549714116951891693452597169869821726,7473835750915837381583185047008243788613524206396316652305987269933344653773,21223994082372071324452834147900730753626104062167370333103771844983134656961,11102363694946721470818933128034696027504133564649607436252022322296041603786,2666835000155694643357391634256423691785613060199379949509682292216642706081,16883033667413528795407641102416904598130659502290474063092941543309042023190,13093053604456598783294628038129487761924241298889312497497820946915331319389,7426349812936697309541457521193139970366533826612714195359894150484429907425,5243217285990182677741567384304278362485372018078770234262925321063263504918,21185490040917275396474067542756068684704036418473170810170344320388557093876,16181135763579884029508432324330748636846464150219757303321560798898398598349,18088358880437096005757355821526785623101357556483672471222924931365890201571,20418860027198053484245336569800730261127301261293595190270103940460998981236,2058948081811170389115771489993053947061173620273801887242248130631460165879,6353796008567532863300373986154930294334380098977007704532496889557690195858,15854609649070278722833415779491666201355987522519101725393408435189057056690,1355942327518086746604287131396672941922424788908995789539897301592998007690,10194046920666955610804398522181498854525794643476895032285888778350918459761,18342608728256650520630397534564293474806178807929639999068140223470256007117,16101948218093381908101491223075947943147313203969904451859930796280152622017,9866645853452683082481412876547916795343134459981103407915522925093474319332,9309485422719740772955698359258466728180120624442685713365406080485336040166,5201701081505060757054562398073722930344229781365241858092054974705598137660,5279555243870694216927790669819597822350327573071817682265773244733785382064,10661662716572743893824841881707597899963881485303936548294117975770384660590,4306964326426793675768869124893413588264762573088622132302954501394542576141,19945975928045383298785833694292459276727208605892865429301546022994613804030,5037834331249812829239656466783521330249138768989720606017856991559732121456,20693877087308232030611148201802513236570270737947270986743265610517665094074,17748932969923719316564673051784340920943155490113289807023660243301385585070,16950307665556055391386715682532553772527550247031548278958142572490582126842,15034211391483347494286112687349366897258989065045859280146461213731663274520,3455096385235320554100221104677124747996171720170690637998043454239897385610,11220329458242704347549150795173830262585759464331372299692251819012138352257,8230076319752658879891285909687940775399748755759819661970430769188439691274,4178690445391578185009939705412120505162313641744671740163024993195883735198,18632680236376151061913536149173846032710756800956417249233907621575802688710,14168747730472612819827430620596085566004981811676505988180237018638188025380,16777617016129912124437138351698263064579177499617525409625791377061066895460,403267570119386144603206457308168792379980670187570608148634410971295877610,11045890302538505532103216886575539246473207034538532950483165910580782953337,2632893274667647784827087132221744991131294771819888858265016332574437797556,14022461303364013571172470728150898521630042996798160127819093871974124417229,18349129573612583311962846403448135938849737390546876598640066736462315682295,8009723611300112743690923532773238474616291315457276539919568488041436720507,3287586297388209299132232426281031982329712892122181769502106059441842217623,19893256464101780566218598404932657965361824655069879954668551189408491121155,21779954643920608321663779655887581582907923850271820082121309309571440586162,13938145028737822338330333388496944993576078307754676998341398757402576278690,17280605833933949866452995551396279974325968699794264573823990818913515933775,11562775307500290654949270847967546133812416593099094805234457839659652146289,21556021192476590536800970202944195471695121915357500612310904064652863447972,17407055226077297021071802288772735837293135175537846248261973015744713174949,21295838064085671525042198277220548723525913660103018392096215316189390548013,14589917958236435754986191512564058641868109230240077937707647376289105324812,4538073055458854134606640263494592220617270326115451287834630189270577020111,21247609438242282269742265796811514090579388884916478939008977411932487423659,19263560475610984724826226948356735903574936974192558145730920786586162783055,1898614508331499418660051276594019416852890004788354240344418815409520758722,13346547977920686435662774643991891597826323722140876186086635239306340843003,12144969177194297999321084025481801838621405926243412487948189180755523714531,11624156909934489978766768065107924627236090741698411458481638802308500352917,8674349037900011131899280296161700067911742760618648557038290076406601619864,18627233188669469962636721109716646416813512041955577645627776298400086440228,1153719160094308748956884656041023320488424966635003188538565876464091909764,8000003066081501211900754070779689975656073731442793160620896624291841806771,12069801117560082050163959286673266840809976769131514316118288648293224324822,11694828863372498882861202648883355759680038037706633938668096525787115759720,1181495201505177954430275085371953511604847831716865494220845031383860562941,18321980275956746302814628602546438645691886543647725888694024551609678639266,2785661975937033521551267460848061931764727388015171856456622007438303671899,15557886094116287182932984983441793820379366058597052543066101158081817575352,175179830261452669822497364983291141568331314582563701393865403724263011876,10455128373814266139918350629083299308526836847946708764631040462916637941146,12622681406523708498691044494295298210175441851465578469593208754136900020434,9624138424345877000077746656879336097173254842107184716328214933320809030543,11726383465426411877912203592949370178096897707629953853811352568008881233112,17566146584557385507728086844334319515338136183689530813551207417981719751958,18423839150858891406289385710861955437811779173242111498197433255650436048047,17408376662161624435555256564084894291578222902661202310977717110546842356960,20995943422377609225953642092578140203148330329113983394181012996247925741957,10409490873284794620245703460832015892256721643100501421596423100640512505920,15047062105747285153444463303020356100177963702386173227676803770571846532695,4535940688608096040988822900684697329863791065464226849059470519882399535780,18980357680792173392910397806033731294240363676914829395702138582894418363978,16468042735091009392571235146440392007609078458297170996132218787642722263238,1869769403621899262774247370472546961521039203681166934356431996537822108263,6151829532330885020831674048300360431343535966534922988242884341920915237665,14373964388615044752046531046884609884388869283450342961030080770253954449754,21429869771065858399481388829822721985084474326196139156050788103070270663923,11836916222341149344359827526882466618136359738495035945807998286429671739008,4542193081188277792793758113018430324598765345700596639963408884670534634317,17262340128494663310404052919129368521415818617921877469042393034218456907650,11614110585474201606235056157412783071151951301104822431509283035322273244217,17241248261774133453753660970137875514052923171943595080766050681996607133130,2990875140768570679733810173464987023133165559726680992079139149034178002777,10032389096385585741539206260012253444831624820404318451026478423856181568200,8391217416130739565515338215591963109158836617019021044489286448654465296819,8553700889274799411012667201578367398970695661169430162294018618925895640041,13529692770771168133213371031275281478756443444824139121847596546264553079152,14478949636372928879378459122088894160202116364833386541382488835123981766413,18528743543311452855194545818079449921167163839226390851954136986727320245809,11724222260540829258562889360923785293478512718704276634048783603461995522859,2652532822068043785753514309321715043229885635900630208154874285707479247265,16473666207635815797882774885364997250503755116232911726426811919269547851975,12436631741803099512327160776479880302093882812091908650798222524569929954222,13061081443094122428989571162147084312340276850316867585582410062467362267361,20909566607465067204267258789556187669343825005173558971220332255443231196363,14278016202378252898173761523743422243750790190417896338147106476354187349947,7703701752136585609667768350038563449121231460368808945757767724712186009894,1622258312841010773225479468430896972269503924285598181547410615000034107894,4706114868510775588142857635375822293570353199661120256611528287780303504954,12723022498690150801900112713057006417552064300221766812928489357200260312668,7736508633931646965699972944684083339925061856252811104228904321699984469949,195095354858363944780141950724441876473553677166595890451203685104276178612,18877614091447727762374351623731936445361116363480970639310200637662433378180,17239262588506530491210045452642505719938421789517734104955853192075731537629,3391556611912995522919492308422471958888145521362922265487749943660431330300,10164629656754294522862462407441648133619259920942013682702008716587122474446,11939828733425435518898229234599966533928666730047925120030711579782543312731,17335155958861138542643885799966192412363788951639890938680530110842555336617,21068414996957890621467676209673805582866493104159841584377567318112060433438,18041291613104743972430309067462668732698702146146761776321539150844598296986,6149130772490689572076747194977244577047643214871016443290724757756394340290,12105848363324940274456322072887282559016226587661485273111872063034847034485,5683957548001811989600472365740829603387405501208071642225953069881259762607,16529542077365261070047716411124689196456625611983373158922227651721798753876,11961524596519782767188645738887896272947446382672325012202336646508449392990,9785728068011868312995387469680578201705397880590293454099364001157116688561,18127416268588083447440821307938591826251677223119815897950307944959875167560,19296461637807972438220899702591874518336722552660488565818484435311224286288,6801016831512114134395242293457679538495311188529990156831889204433183626116,2964298470426582070507861407971247200639242211740381994158541687335361446525,13485975887078791259342768620261671076376983307468484850600890777864999230190,18842264035089067687391583729082424222425351385494040849910540441253540345719,14703642210510851071131854548671393020078600676544458548174965732036621712435,21220214849253889952179905879367949668848598115028365535238742829171770487419,11808561815315084933226034934054773302447242219261466208644893422841430468026,13540888692913543742580940929469376532537583430034252053023468103862294761259,7244161097354558003276348625436123965060461415149286453943040900234287411785,14838699086047571226987010390426316539929576717533827724866261274778253262656,14556703155521968503536618488028548581329555701042498979115582733446728182407,7681623302896593715513288894378158777679657507901023568046253058158573848701,1088441387469941348668229287331864702951247349577784177659963097331109780661,7314603916265509104428110912296267885635061026393352039011815022900719549691,3986211915826218802854255636104488183733664187834078111248006041750140814882,7773946401984571616670752866609685859292708427659817737120107917606152933392,2842014599902358831415178364343115068084073955515903534808862171830738904933,5310724334723991338015239276468023426385678184604207589409781216959654582406,5255222348968955358505450804240823699077014235887887249383824524518164498567,4683270496545943333741165516340250527555279356319043788098737100323469078711,1419863943011284607504318632953959861647793372073243840131919334395882404459,7983638904317557271319561780754076927110887040374328063199742162092282580125,5569432847705373609838086039153225563020182698189928344759413994203981320990,15459233133041758499623402905899885787129812358908703405750502906067055055230,13557004098047782158753673078158469379829777184696159361573537670440394932233,15455882302725774286899673141535924396516348007554186719344822187820635072053,3420919058826876625284567898132572990967515410265578892047210512917031439632,20100418454140979684745740106982178755085746706837715848777042819378494283102,2569258507332519764813672456351707773863376375715947817185409500202699032309,11051426796304102496144764766958179671506736496976882366028801902480842422589,12740229748287653735988491742372785228070141556372656548689214318469788908817,21628842595664718258888324339774974922449098458375293925060310284267692457557,16339231976272978519029290439531768093693541721039081313180796119705575069472,40124736742096746520902512885311967045111742860721554225254094895613700655,17732965892472841235257958105891466451086090480423956940377743815006013439,21822629194074446176794925064792912534191501981075390813302606875002422233533,9308214945046921143097017249780654286051601646816113552080893008307002107495,1407926751839535775233537792971129618756456590720440342541085713782189375466,5640645423977029900985251540406734874840031539109774937559862819450972865688,5033216407501194252797695593441325021622991729008118693554186469034086370061,8067057037475400447259522316648004416684453970851364075976857314405950145375,3763719773038467529952189678629891209905984306908045328296798459182240539135,16939797418368521863388331657892541744299855742774206972703171911218723184714,4830944198856568835319759101429165879092462296316662230100861015921313890231,12704214658232136513943612645116991664417275945120192627735782298715562058820,9273823420095008025667777982828688153052061387261780450903573585273931011552,11055274871946976331353174512200687536982312509623944578515862663278819898965,6608499500253253446996042326570359354182967780655057286059057541317584758989,20888058022129906086941050692798413401844596394165346138911969309287247738108,13297667979268130800823342819300433555314639138313483863899090834749801969571,18968104066692458124571065270953767119743779337036553042450471941512165236867,14932841303199490878640323744926137685749952622800747995690439854118498001885,6250599214474930878673138968631643032807502364864165001640712550360147900771,13872044280192246670253542029636668414586465840988190477111017540404431909403,81456119668307937036914780206985985650137679027930766352442712034886058018,8178364156193615628946078892680068624209694278864784660439209878556857933585,20847565685305938921688196081711559611104247746032524045765048360946563554616,14790603163347071870110696142274029411377352843070075577069234486581346354229,18977464663780407707262531952390299277523056655145169930121579582916387871374,16780630803676794749613238124686604459373604071531057035207376612438682381040,20186476042367781999034353334494913683828163385175556939730585228743410724033,6782638209588187356802454014110236225878206067794807253486060610876934918759,8993456778572039939715813797180666624819850516232234360679317411311388323391,19966302498904269727099815984264954717659138861990152509516897188319443441697,20169703794592063233917650314404110898564218327366603108408586484609331826027,5979829627203584558315118820578826847995466683728103070319484562170838879477,8237679343008214539352062545936737645555361114339038346011678993504862443129,12382432100828502258569798167004899872248210099869176340581848176730802349663,1568185664985590267262857882936657784210740515169196983171026814738347336756,21214766447038120613598232832812136678657988502205964335817205381807920739938,7692941991237742474520327457310452870153482370889548010226143053981890424652,13595129445265049664221406027681079958478209116108739005508499004805469917071,19188096071580221579092496028987371780642557049389322053081699235155567772173,17975673380464001374676034638564230054429981676012676440863525293845130019904,20841685157342026757711329464299804445471940020955209397956987009823404283299,7510778644672212989684926383821874729073504800968951172295535413714975603558,5412964648109092367425127656145675316528154462488440576988541278054587052058,6998001450950528857399821530729656471745472711969582871968416561472553420135,10017795190513370580285083759517584035694996563220913850722002288744022757377,12113185651597474067026664715619946415749981707739597619454641751791169267554,20451540737363571466111039734160615184627155382583098695879349204357410296631,729116950403569953818905038668361626861855541652418271170712441039707291924,6874571610670154627346562968411422088198077609945741147515101915358108207688,20307824547105117373454598908217917152093200208838326389260620574762152675045,8758875530447210792904496135011086289851932865540018278850670496425499052683,13224694410602002105805224454797207933944742532123981533211431845662395381395,6621493224766717216701548708726891168784911176896760330321592836065310482866,13937858022779991611039558948054774910543950212969141252259896915615778617893,4917806030251482092362529677296731621677399228082641707762616055246746126061,16304922224312728276104330461175394847795848175925462853738047204383447573035,16678452722472429203861326329044632626530032631343862086351886162579978046420,9974691111613144697061424119079539196535411918411684404824080439336446439564,12391128852318795781829794456501239823062804741032268163807689059014957151322,16376931186038869228971542812469753097050036606517944132293138523631153279825,3057841358487505418761470758562979965285993261118087156094367416201750095404,15045409518037090814105826994439679855639635253710791541219370329682069820225,13442376736433669968016223589180307683361433436806777011753497283272674012644,18917174176736242961299708438032963296686220808211170958894252981698475343631,11380920704380401611525239094209208940853859054744619020167150893676619275400,5399632748693319676480270098239871368958944610827825094400876104909425716392,3072779406768337118240884091792704214322792415195488652476136252175179362880,8351873470285292321562674159922105545256148886389216816367528787141186556758,19039526722628732399365091326361517675801947890934047817293511021151913744591,11316453563295765895775061205389385485172841919365628835333993250531664655988,7850755275953939062184858524678116551304016605992491147837939252676680785208,189663666172994057560830062107872734380479327839628938168402275701561917176,8944554955574110171273295960753608410178793391130829960067372967633462961614,7116498249918759493875054905542634690892118438594298685578805598675410965669,2535963611074434631003149876163530430931993688129878286594756194015465278460,18022460558081751594574692271414706303627866472796139479944146908393139741182,15341193598946540230880135952221211503846552166425406354080863978843527894671,2942431717153385426545606490874257811230086292797817271859433296359160259239,3009774438756820489964746831334449123894740822794580986556997529296717581423,9496138301121689616049759054935646143502980987880350156990306735995260671175,4076156724842725224174300000468119057699244699381290980710548119313376968129,20301500572584246879220468905731058339249778940966192891128325027181404226629,12240449395531309263037726882974869058539543342019721791945417590157321444565,2734576041547526732946886809654954568832411068107541730145912482251139322538,1913611111144137178181099357504813610426696502807761974432419767623037547574,8323981703091520786969788588517080546120036429535328021157459160571413370125,17608089795804665912003122420873117027406690592641558991713120617999818930151,17954961401611739290579723858653246962839079599354059880628870682426849304674,7693642591048722104105715300765742636898670019493041402551952316778508785882,10925165536949195683545612102300879902373347522535838874708839717193999335745,16740598974035404805544189925980303793846400946043080633235004418045311113846,3028458114292500648266975052798389647613432243149006395166123161184170940972,2817600861932061603203157785548222970685465773360278995551965365313604217882,2811366666795973435332404603090484498270752802044239619104866535127344245139,6901007103297959557257110184636027233977945890205420866896244199105220459744,6811040256124961160848956238308470640308462502755753004833080999365205628787,846642049586630199735666112786431409696508103735494916428842550432654381594,13061166881718302681365231291832588791959186056326831853549555763101859584396,1581547457654855644173875819143310956457964952802128135344084991507959176621,12591698412731075291488515328885878994038884715020576113812619060374399968487,7129047166046749599109058206849766841261983329246180789653876287940952140294,17780920041966559015242418384239510699940753783778307759603993814380170147815,11411967002648206460094819913767451172535988461576286592244752756526683869398,6535147980143805768211908880661065989475773196469834562468932004056012068981,12872366293792794368642323198969017581196463071340612957009439105182673573396,3845096876544992085668616039795853840768469571100517631039776002796484609549,20386025860348257305841141103130861239832870083066852913792413739711579490278,5663975388273723452136125938377376330824298621841190787892884430812699456136,20880523335705106555101009571713688438858731841737802690910851430800496104934,8664815262171336902475127109386834836220742848950659183106085559300961747316,15212672296023611959246835252860546019670000046804751249547303425954183847429,3786255974807528210793957400325837912933369979823637013145025357556219775102,19646410587152058982763388053845872310164493339475512721275474101828150077273,14407426259630290801648546162995549804322572985407158009259933675410180400077,1275955073103101917295562169849127375209112030395179332033340866715396722452,5487750760448101899937260261898752719887276580825994742322208269609306618405,12414079753210256499611439235670285717945909010061941159696368398137523291140,18058271753030912252347026705895506604519018890772902865355002646910918153759,13935235821735626611156505080089322797654275868806802361406549798199236177528,17110498079878546324718511787669387410942622969712445909354000807236690314957,10687508266469903792000405420136150569946636272800228999781195239976105560612,1277956894120355360649091990517188151791867400124079104247693321263057601099,929982009519538400155920125117423265869657236620766216139182914925009802954,16559970949358997473575123467518158994842000800881347427572300986319432656507,863852544580033885106607226598354103099120172650200980695458006092725115354,436810575313416269983882563851323926836428928449351162094565391723605483516,6334913013691170767138698286357556285297887475783792365865857018173994149486,17785859069146472999908840832788077051672090890508101583397157534162626183973,427206014337914391283601765560115825767253196347193816620589108299037926541,15115704735938262072587983952645382098893412471333885175144579020987265065203,12017969315449748476118643575203596675122272214009056004034938899095907760206,20642434407226804845623813766397536183962927868804716012482833199686414302852,18982318327848493301474677819747807686491978396022748137991684529478469330097,2306193794828709014215315860179466106408084703631347012188232489780230095671,7060813397820173935956757571314686808083877731722252822508055423697679476893,9925864312610988474999359617458205534034473691089101964213562993662824159034,14036238569106986370932971272638702550236692459418895654245682921654874601312,9509048813859143088347263336607686057099400727479311504780670742158653486206,6842166521132564137619008158396211111980991013087076743268157882198576269675,10217353423046013950417213172971567565900229914457220187215408404202554351836,18220384419265532097596052952017594673237799959023133602933674050572298730193,17866822945198657177461453619458294532377313634196332518543246556611008452933,17694368679979949511817467967015330546905282492241200905890171992458134240678,18971922685739566979638356009544944454629162680819328093994329160719843056737,18684937612086669383439812199377945074448160740155966772829350355651237261795,9235876281667970051504588287667786944160228843888838710239865727309603061015,6187574163551283282357553100017400574873868151705871779659681332774938473442,17196369096305464930639002419417036905613312721767481044644254878990952814786,18296927216321111202881056198300973553112302777685079899199090840516364581791,4983948188027170589078739023086929105628955321978589464920358286161528573448,2276814237931645487686771259585160667452008745791625290365802841496721618760,4138273157833414032755498052453436990872835066620446328921138739885868998379,5835580830979414828575054128735121537583042482361311845838347096674448689116,20992630219061340843601881100837482710979119542034786928296223633950908472388,1118381353525339785976839119511758587763620520383755136959051018516094253090,10337002023922138844951367775712178432524190386722995225923120494344904079950,9765947418137225404722546740514250763898752374389411503005283184253024586058,15411836962046751164622748177831913963909013265942110958658714173394711125370,20722527012138131360820192152290968950993396481440050289358737370268218859591,16585853587281811014582898583977502965045639444130273779047322749735299560207,21436098743421172924014781240823435281025352300035264733201366114473419058727,14178112462860881459540462916598447735177675761773338824394753907217898488960,2590560710846804342662010467713568407285290476715663333366063002353018991264,17949223181156469858379065899254284317305309247290121304422294912030586532673,6940063127036366626640075420306454154706369567406835284901717013872681276911,13212339415583029091219180722363760875223983190396769244985733901171214077679,11143838426689049623360248250302972103117784521940658207527698432687552942591,4994693363062895106345077091869420711664571716019971952890352464184561249569,7785839099197795033948112451740381108555553042322704038905686323540025631473,15291655295654923849266753004503491258117644584862711291502217292211074445996,18223946690101945712849081159295298164630378278313069852577349403051751559726,13247893325056509281811135293440873471348664328435966021736203439379360560346,1838627965154116499570588511051176331708387980121591719463695143475045130831,21746931323535899361372833028120884537569529325326959379977185108159655128847,1569229799996373000993208676467175871896208509249271061977636872731081653113,18668959729045139805375896352501526759923123936419773886979446262254907152787,12698285530824454564359053510831159718450594302921296519937334733529589738160,5743752602883180080321224936560739109224279187008023590149271256478879997507,17615461436426765950762679333452659818080751337498512367037395397687644820677,4379963027402443949761342437016192165148025657715626365315450970388283739261,12622442863880120105122485141053297017921305018805552070109568547893924027508,16493349884995741255319414030015325273883108492981717376626952633010860098410,11501183900713163689133184470477728399861217340901493951105967658399341986313,13184464903575565740074003127437693743650101614906307232173855163739473476900,19056993236227362680720448341933549082689888775458266843506880469982452347227,1180947252747369471066257076205537751320494098262241412291924855089764608729,16229532924404554580195616835338949126663348103713418556119694233568376894947,8604714607572995451336310555882946070542334844212691610961393592348706930493,8362594100280133221998296898045505539071433915735634439526614339277300552370,16399159148365956463951582514857891684943332179297226423628752792536028483990,20791958918883897879651946680726738927333774947616022833294686415482396438838,6976099533465307077876553477341301102578695004868981952387720840685240842560,17588607896443047770053818219711270035985826074286753981361920802895326076124,12865981806811655044812914486873432317316688987331760480657262748139002813688,19080259696546964979932036247707282742365340353585423017939782931928015046575,5475353703257038456872747308072401784844227202792527428899399083236860900298,699444932025038530835460727165156424336147795146205258896894678525124927461,15695622674480818777943366659102932349783785381339274197766151422625765388038,7644428489984569999599080644830401450294253782967784792584750934960812468382,2484044190398385977417569061356693291812041338880061938702052957819048506706,8456986467797277421685766156179980502998860530369856189405630837033584471075,5054041625001826317568038929780665383894838531896986763764007995985738029810,5197336058480822437408118036219119090707158130910220019747427914262297331861,8896147437242770809876821567936215621570430903276974181159659855796295866923,20755757167342693300106178757642141909843395817794855978028122598254488316281,12495257799325917448205113238508489684392516282807104246531380538192500498286,17639970982424592615983334078785592256655637539816187733799215839326807071148,8140016957188286078776165555436655378303814378750387793587919949009492167586,17209468066776420206923060639618147772644663380208004030591040036263548572020,2619409586309117922582791327977378099828554504012201484641253637770276078843,11172679254412598275301264634812740710430873755458899712228629497147611473029,16829502099778629987235691213955928527920624415791356237580609633148661633897,592799060717298365629187138482067858694007427100574367745567028165989185342,16864381084532235865281462338072964457337415344658720676113860956416999505572,1015589663070446561434523645329239389344944669662180065723984179503017360337,9982212112174542265411457778485410853904388759147308861218634697975431894510,5412525702631618381358272227447367851318305617863423359948039591381065713581,9852930575259000100332996271562617389630146990442517175422889296173516799181,6036993105785310658467845672504384047591296265363803946714632979523201713762,1821500632172143873156399122734194851200445368324858351038486833883177057468,21556520116213603298246786137688925835788594639953568860110645708136881336676,658318860971707056155247027603536846915894897192791739866840963356575472681,602842622617647573132938965729563329852165494525296971607175031334298950242,1151063223719891516862415316972915766442753873652837551132768558136109394634,20030054542089253165409106868864476953251573918915762537158006593968012247497,14455078111822464502989472874268580626098857184523941794725425258923962713053,1699191450188970110166570608380346465689006650580298122024202987580198200132,13971136504849280501801880342723497383580392506287195375689019810750613223527,11259011415071078991947983706483998982146186263873384729739331890304233635860,17741270384736018529047001790810396141344433078911295725171243367964019815741,3617456068852846022110280599700245470402025130645759911795429861830057016581,18773989857774369564707484486703863617112883499664601804221477949481034222590,391101570414854801618801587626783162239406618115954162053108159404294160435,3752824438659815340558915518196975380567589032517034180452547083690665271869,13652227089592801810376789544861979384538590096633526007583054323554301421745,5753030785259259818058977992956569985665739253964735992489420513570911607,12794765444364718066463627091127875266371595037234762762560519184694440318642,1844165267423966444579133456200541636533189889959706801468771335509321515822,799352162562582415493264759184613437140226428304061991778193411771388762097,15915114786946818157476898276501926276831197920612814619300062353559927906953,13041871949144831370743756131359537126101784549008553888408794912277392285626,1684702427149441531010110315726002248751792272226034774456204740385384491604,10195318610969070608511028432066597876456281143783329459466964443360549551082,13714193389971576085579160116206487363436474313560046541969781285568217247624,12202470771012770210445954644081270058473831351768121852596394422757629850892,7784616613742667796197638965440313242748565680231200921682296807888993222090,18581613859576442652033888735999982405110741068271804741467526764394720805037,14828223806255884089537896775456938290494683211666564494946175120085694803958,6191868112332934762674478056112840408041237177775248347690069948259811627101,6055199518589075551800066499277675747934144570099354689629636497613775458486,20043219892592698889412649805669712950039510114250762278667968995416842502234,10591576812697540586115991527347511638405122244793393962099090930538459086772,8146910292072979142616688207315340017602882692938548874592904341871514175303,15451576003386544225828312996072681331940167554848966592330715947662789205180,21156998090948310800651324456525534600543417534335507361948830316109451323115,21421497039083336739241851024868234958744697872115637345287618993148799764131,8835309990713613011240324096693076755485475658999871502819747407829989219746,13102158958973358955423565573049580406238531533936309830903999596178966162490,19927703189662863743499379923522860979653455328626544661291243971618992342837,18417771183154820005238210056528713167003520086953806649233005148247829186154,13242250186667974182640987653516460478853973058739850129463954545512907574522,10971901023853281329361069638276077765206234747340067637718378767976633645829,20436550472837870181409690438226695091760115955076127106091878852797639823191,683842651763399941903331243661454687566310039977770092715404267515366625429,3304534668380354910105587611199035768704466410761708200478786163367382500984,14327892159763789670354328059011011973128878640806462164819794130243254129821,13712101990593648405837473744314130986494510088132644940425089514662460031793,1270386163717136732049662990020454155453019401464056820650142849751291739739,4559668312052315567004252521434018809625818725552950834596073025095274632653,10289456013947128246221059115194021747046925564818529566042034047888244657473,6981981682422059144716871555026845840161063380660424650450978975416029699739,13275723002453843398308458799872954358948259042779675411059905047590837397361,18372074965684100000331046096891533070433189717560527825752357282553296305210,6007153627662867365254986874716350833679184737288669421698890656788831322929,11557682792813633323168221751485510314542594132819842305598531070629168100143,10536598621155464430657941977974614272794233321865085717974545329727298277125,20566123440884795144385782557360498238445700080133152934423121801124172346047,5484210585392274768700243869223282957415576141086566136019633416151230114084,4675266041161206862174450141632759296562489084453522360678052892725376421684,14506966485061491552710372008504993235111668026216492386033611735228479487468,3682565950309631924420685101131217452257499881999322497664342243267291843503,16753306733039910894513530708776251948831720207834805689601646616427039909037,11892397629144764406188085785897237236955294380381710017192179450763501663923,17027229171478232498721421673139332166581061755210509139252013418924500461243,3560458480908782960366816146149753544371185355186140843210760460011482921556,2523290942811919827064721825289040221770310594770466909167316010377190569820,17586848354290518015476851435178627882600199642491204839902589087637701736514,18771893348474501482962831973790983143756587183687952333177929270650139940171,6788202157749582404834375771398928959748074435244246320016871403739257327326,11025631863450004428764861086496374449453982180198151399523240056816657483248,3256907622263919521402687344729539839835290137654795380148237049547054026004,729757374802086603625382264910105909740146180896096383332210024077887641124,19863253866253150070643618896444516678169346690564661550005769233120838139485,12468569017378925985548033310919519222810416238732327538088208928920140959143,712344748962578398623451251358410865586764243720605242158768608887082462846,8546087066371010720013920767653366050032317738437010080974697619001241722483,17144825509786899110344839698077839239721239583625175190269757913667929043953,10651563297701188942358589203989937961905153035428112097802788565849122022100,19602341346389413323180922571631527509531683866957468565049297030414658843948,9238186664745057178430953403953596421917515090260446457039212350976296818523,263640414028390180122517954487976369901122460517389747631764885875587715955,2311641918305077640172935641310996393584851078677397516017312506521775283636,12911852110192471656473443086611566556755106535388637084532737811151296554463,10436700004928765835031725654432267178079115705246966695358470216435798181674,12755555289896266917759922247555708737024386059041699214870911784508162783525,17390583422165077903045260639521919716984664232208360646931078032292219709718,7412526952366864882775200227476857681850213243362827192310877977391550357930,5016060582872027330190350728607317487069057897723717249157495640519710863591,70447200134990075406173842139872041532268968648265338736409860251327029352,1545500244158153586647380894391367444874762740407966854865957002078767363820,2082567114283705201161441383508830647153064041365131752708347264051557391980,7773933577113494097575644205473257493685202208592412633139277067190461074505,15907352821797623044340355088248954282080052141018731890243639338361458586983,2453390435048874114321626738320866552399505338711520013030652128583351121221,9182038581165182763924458518550360578443802241218652973210280653624820005202,13176557622325900598244222336641110473108400343854387783748570353220729582767,10599983241136666078578113335543683963633036808782400964809769571709020578918,1430816790456574892099931300141571059151141389317227589818258647628212654923,7207251746626434553568433426934231676780727971853793874008147862305418016123,3847365229378532841231862621068765430417579646617713430532944299440264931969,922422158589085666348657924088867593873646110588554410818179794404300446471,4298485174770134050325487753075508760849575591910135387686931072102416450479,9475141350581193757416877790061277619494551108434152557051757495614692231364,7750163624390542388958191386016094472536166330496081849246099823270737686866,14363173695671306304956071467171940429435853698217676411185837490356013810171,3402134714494071567155197273072160417049647120230862441840621369782667867977,11378968132153772980874973211734670604659991740586197794619174704886870525408,2500862781199005154907185089778932765489906994365960644306361544820582839768,21880931942133046355810983155922578513531850539420426025723154879488808270315,17850206894189265929807971665186479441938275634968267590809377452033564010382,18427883853363251276513100116480886898434829323430684895879968439179171503760,18758795974827407022563870795763356401215175366078230621502388363785425038612,15672649260544536516531393740985073476934112035694203841471047634286525005174,14497479780124030172334631091033639981498927489925809517218125709975200816290,11190855071574099336548308963044121660452976926988171712775481672446931541539,8339442292395337481335048552147626044800877206694030770577319544121541364092,2461178629683239975488518502624530284391365519847067341739449204945212652770,3972313936510404965199308344697399140590038866586718833591813109326652018667,3224811019580618549699828950033477378112059204060062023677479068506440937528,18443657715765406615721041820828109800966587434816919981514222787674698772960,666201271764511484388505793135876064418452477237751508215203932379618265382,4434899717815685275523711262432486808621984251515429736982413712108987655422,14584918585762085382434085071460369807803840154636220934254933165793423091295,15646480282455307022430957975574008173154630787861430193406352480280577045711,402840791633175231660910669665966910050981784044822648466848382615330599909,15437492296189220094817534101128968523410729375545135146260659057729649968314,13987760171743052442513877961667805977500573882586118554487715622045738218279,12589095501858681021442730872878907609617459069328956803139727387371467358051,17551064250089164193025672794811675406761638177060737129533175904585851772273,13500706213131978087516005477128059726177752268287240395927379509000435850498,7331629294073516250840302816971095420668983701195024195892939287001016568514,12949377725980318589136021850295478499564248427839661600142796482665024587971,3988955063770305621858590171391799353484164878730082586815877210936858093890,20512156157023978986265779260320491356890557397261515752540394821171756173724,11624190532749034673782735319581023504009231230729490439584417709012081446066,12473562150323140802035699452896239306300376623759190078147999182702752528013,21504777935543484323252258287484534200045631968996932563017737909760083499017,16104745906544338230790783632377375683831341202924378150021598903321494336736,8312554144734150053969625169851557776466370096299754626528722906617398229171], + [12051363189633051999486642007657476767332174247874678146882148540363198906151,6387692555402871022209406699166470377527846400909826148301704257996818597444,5501161701967897191598344153113501150221327945211106479845703139297020305204,11704372055359680530622226011526065512090721245437046184430227296826364812961,1448611482943320179763394986273491989368427112997509352702795612841455555221,11429145481524962708631235759094055797723504985787912972575745356597208940857,18021858528471759023192195347788820214752298716891162685115069036283008604659,19817577944622399780828745167469547332167999743980557486183403063955748437619,16868980302925985719076889965831700407328155411673408077166038059874616424216,14717432944340806781505761211058502775325970511884444497202848327581753493322,6273484270523289845253546319956998489830555038697388950038256377785540828355,7726043103954429233325852791166106732104332590864071922310309250010129731951,21052353119157611359715869265647287129868507410601603360127523286602350622783,14881796557136180514390287939887071460258251160875710427576954128871507002642,16341327439981153879863707938117355436152690262312411284193970279829974799334,10737675906107372302108775622264379258926415910493665638388971468924879578019,17652699767629314433191915267767147860052614073432922215674211498672835339113,7457854400138129895665591719907473144796504905294990100367501377050420942800,2136850802972823585140870808569264373787409642804109426616292140046700710743,14029467347298896610468190615212519453678316548442709087191045978401072380889,17927699952921266007590534383984238136710494507499176330493504416180410161683,1404719213830610030709583332543456268094679432456284386108188509031502237811,15774757292079018355173698870903422490868220545526384876021336136892926326596,13992040374687149195439840459922227749294794072303579532004750946306028893274,19895094843870397064274579657905921299619388074084417486420154568847155746891,943833985612967248618844364501030453998731991825395875139617731659343743483,18334641092245356682448009823797080853859186519922476229272838591594967878678,12440287044655505483131716236615633401781045711053210640202766768864619378050,19130942564098572936370308509908873069169152245172660555660369853346605570826,13687979327148217614616687417475244897906227789285703940171633508277844471062,16887921327479880141959363366262254722342925451159884082370074726344024008329,20378003125024698406589040864014894045124234695859352480989552885205935609512,9961553412530901953022991497331082655746860319830309417179972582392489275965,17755268665220780466271147660314410613992814315871705414495724015443459797439,15394131279964876131165951719955566821453162041574233072088124095626652523043,12668230348320365182085867728169435383987570924921845106243310905832768752125,14046812111383844816383347755263287603387502282980410255379630204396960343368,11590093969266595252327261214735156204516524792938909229175092594303424141199,4623517074925959322927421514289132524032863498392441375476410779446526502799,11550389531965919926150256242174358326491059727918559332939872696684299343135,408487396317981846281976563618407581852133413686169882346565860317912856432,10717757571561029382519744040791773994731123262749372629687813122941078154016,21323787615496251932181222397986048515693661833099659753170924658480548866921,20780799310067873093555276926357624414275975377319941015818682052081980020892,9948385944800296129032348634683354181546876394979291412116493575442898426065,4957033413111065858035065225611730571499258914257595411830870977545212164095,5227254936689728148737265263965107718869714128941995977191096572191110991079,3582814872786080867997255427740166393615552773099677831398251586195329933975,2136737803483410555580163900871515004623198990079556379647848364282254542316,2965752098571712086281180512370022839542603960309127077035724860894697782076,1478525086510042909660572998242949118476342047444968703549274608283885678547,3563375996604290844805064443647611841824012587505923250907062088840679700555,15461452581843517997080348781604020486994675070532901120353124746087231692278,20472517020063295821544268171575414161230806406668271887185150097779785573889,21058001005918321995459971112208002381460494177332965873048074199074929946172,15805746645980285645504697043988763170971539673993759868487715403982423015009,7141240965656437676130015766799708612940092856280620325870466265817008351948,21418010338098024788434337801477243267248314524079104488811186206038748626642,20272108634229595317682817969506273496034097230124371921628691470754475805838,16734095147399743907618148751687506877774623133599770145304816136018239803101,8439324632051181834455499457268557602816180314723268640869118054114888151316,4953900961796661020464968131122569974581908893169105485631905994366550928492,18071625983692455679240094911529791119099077429122520426399552756115503123111,19638917592063029281156873227053827678889868373299664608974791764751784473040] + ) +} +// noir-fmt:ignore +pub fn x5_9_config() -> PoseidonConfig<639, 81> { + config( + 9, + 8, + 63, + alpha(), + [14715728137766105031387583973733149375806784983272780095398485311648630967927,12450793357728630597819493697261391961392738728208603858426218806728799382497,4427733724068610336929510244982091587998132283636864368924406075658439074153,17863554236640577761956319447874252524561947852685470820159498661269344021716,10723868775598272126873918500257797117892409794706524915527428530195343520361,8041366806917098496431513544630989490693774700064656765914266570204855843526,13046986480231887538692223126751085950758763070227069247275787663666591811005,20228999562936372999611354929112125019466353738760451044697249912024766542482,14238976012080913074226552202264063302466135977295108038770514743089287570221,19486717852389551661121716850619781027370627632295683938875312739716376501717,15733057748709959668511822511174594221965585899587926036013893958610587491491,12041333229715539748857491855115983195198694619439452683631630426350435252478,1829888811413627407640409778757789140470123549237476514374669162490680512211,10288898018349095056494632386514957183841700001184195479721999387950102580094,7360553146019695788111059047354435502690072975650576744373916804385350955674,17476063720528136669048514677420727796180556343667231122803521620226101935369,18384724266969916899691009636435516722111206340289089258767862754828208946542,11046121967047431151707881264774621308937270618998625466342467829704953599782,20018232138773775379089542131722766973741687507582662224374276186775807685863,7926534193496947015875888176706209291021745851605316909116853588598743879034,8826996877877607049084007876351017199517432230182001641783930871320527792100,11760708819943554023765145606995747732169597984739408998714117029765838566505,19598000655770319703844060561747179253151181702222064644764822676806532882514,15036675263180992517064890091049355832990063162957265821390555448206776251789,1053420874580688637503969479036991299021138740018858993455108201424412879748,3723543690610038931361367959096800720510056325209292666118208798533818425035,4599370243050726453512484851927735252841106375733105184316191846221056036380,18291400382386598447603657416871816375751118990979359745849342284893280004873,300341627009231088404894405580745838091318300821994947846008201887884150151,13332605655619720841053062902143052543375741442250678582318225211621890248982,13197729598850829723360679245789196039442968018972826673455394330035263151299,510788688496484172389408566109007465667555285205327059265048317979249570221,1685584118031999835794907889275254096486823415278284757369286336252006457602,15103945090904102223538479231258677032197950627619049222966748226967974852043,6653802896618953033344296077900828173967467309849915708475948018848254380036,9254803560511166426410537422101769642611302194250107918342410310963831784950,17006557344160230194691541621666219420787918477303225545533644141096551358258,773112329554511160545400721342977593377624843987783062638455005748446223137,6671483881284330250685026918783029584764740571210869197688044338476895092050,20812941492969561606721983530907505914064782270990490150214736286311482532652,1156984923268097592347582093730300227184163551449762803735684309575717323017,15303159756724065068145651405407765401796657934219121639364061501460295743948,18999785075801878445291021498876384414176522501978873700451842582224940767334,3782716983967799050957535371991538595453996691838733068933109780481907925378,810443910646366078824923626573819081371243815242873044781414798707744583851,3940687718063184864573934886068875138239553970085689518511531571139105765743,1222092197964451545227395363538155091563596468425395922702697716100572937718,11901775018663948557424314950737290815973735008800495766054692238446226616230,21839369981774608005059280910009281502958794510307248992429390932011110951241,819873152679629471918450179717035855395702808145570990556719950289951175212,2918016794043041559376798791171848118057043459636680115122516324180788251680,10788401265856066217998495397128704450484607734353922353470809976686155443188,13599498756047543641157208425687419183141596017402196474108059160235795892976,4993390793677030007023804867617329393931635615810976661139461248253851471412,973050533401342110180605419751137563184725082821038770229241448201970125921,14313276246574487682858906899808269544140218917497205965354285099641091349756,18746777136177241043722556179260854313319807637092383577312657349740719965076,14517023428366357570216698819722831600577825429761151189605029742824536459972,20223198094330596704408798588338060788093323967112845691364940702136543962642,2924401185705980722600796492514644487545258803954418619331883216838542308543,485440919681570468713530641755278841324413691217763990572458853294843435089,21560476826107225363638525612645382878298890750874072774141701406519608285783,7856508582404120415593106596945280577031904101959961641860467517902309769386,1505151890969527772884247006998953879441745452105187039442954300997320053301,18861812597641777105968621029392243993700881183944538936666186678355756609806,11964609307983840306843122014689504510236749206766494519381451521217569407396,17764783391855759749651949748230026302359698415337858912932633638930034077791,16562247632438820849068750036602367255890087581186727955070681252413797347277,3341595358840888933968836940161983842834749603437573997372892853189756769506,3198140245778498430686233550970322127895441994253754893043542706415030678798,9829840339700031668849847901844029075426216057792062644639239580989060312114,5999422607425238131817993672620301343082348300090537110946144186609066413585,19901271533560906428202710740924807375620638454776660078183104891177283526156,16697165654181109350158134734382046723004976300078845885330478879604895897280,19171906568090360833249366643372143476587242793789646446664643684138123124668,5557557332632668793539639636185643553639926364115539987556075445308999628265,4797522865199880517123583692586561796505378758857130153602827907909887751116,15409514194242892627651944305634286919424076146534027188938906487506413405089,10407013998132974348561594118793213466618426284969698091916131778477581263008,2534925381155806875978186916525958864791165037467997034976228683909613017312,16140842893634434452708565053572928560639256480905937421023970743339301598617,7517617592925372620130293329989654305076737363747701594349097857054039164182,17572708764253481596340159581412737527195601517063980704204677005617144607526,16697796470163537491131716229045730242536059781538196375577575057386248458494,38275164685285960308550480834951641755153240877853193094138358285155638204,19780228589871041196871406056718374983456578990309085234484187723923738516508,4573417308961077301452769955811063226515352449986725327722241421281202736681,4768055042642730073498433238804346134649067788593835428664493008393684000706,17566912618951175959416490797476610679702184562687840273697859062459883449046,11477598695424707935165112148975667441147635429812599883095916948275334113413,3408907078049921938725945268376819484694115736385272440041090673225197146180,2488590561390551829094067182419871806900177001183027832070626654223650976899,12116557895894464059885135778994901345424716569754903115015740397131803733982,15881232965640921626180413777392630630338847181632662075996983398726326426432,20914323757596181391651855665547258251038466184617935369425714249299063760685,4275923143992397246911855313401177253209967573031785993454148836244404305934,13098973753894185378061607442839048669135765294488505596582737281481575045554,7995472162206735324879506324600884378126850726543803581430135236761716527753,3690915804478314734124615543749602171459078573370790663994412906012450478823,1256453655839486811750227055618146120819862944082463957526146264573763714294,4406492967670422538631080907830590263463047897583684262207883537903678091970,13380843970691717863215678292643800288491103227905602355694129412234174194363,19680159398793220289979983679401118779763854719759576408245027038965290325739,8515713472495355510508289305321355004480161123461789103991491891201940557902,18392703846804297332972535728243845000077361414687818948278976164182674947067,19823604647876421559318429394175186838817554072847524297827763377975574273192,17719715026846703054856559310322577442906188886145763860157972477138788247667,8745282777320550983079435446349157218001552450433897097227622172209480270781,3259368608255603766247016957318442624095407655100612967940789373312058996520,3379679235619387594255002628664818227413294377266729211815713998759100259668,10282673789366804521601844018863748004632586596870138135887183100195194767004,8431227731426467642712572981755086675999345721043460063547234289139267810255,14117058124827023634266519281629142766485227596060997608233088670325722698559,17113232771025226173986361792697170950811880770802373827827162227101499645884,9906220434844104062978204733717072107397540599291396561476275675218575564970,711369587296778404961826907371863989722457674941832862265420496583620086218,10995654568685707735109869974152491589223292425449581061000447170660561828729,17197923097868441003908860864777521604587651639410061820516916970875615238246,3121715947184842829391029463556305441693293825061846129844634146823663627601,8817835750782344079827519863863370969960597321588294656839911940551490704717,21074199894730915603594812797833479514843396752652846676596119472522115586998,8903588044620722375103549330291845285230849782400990458525441823641905996819,7157451412319473873395155428325762769952294079544485671397508107346256362850,5366933733103001902997281886950280717532636892191522349820059149392915169558,3729196254269053915687004590799382892429870424157270200083981101426772909827,3918096703119862723362353838062260616080657756068272173354821697584630247209,11073027330528765229119199873305594827907404967404841004751556462671634016839,16424651511178205757967439516888026957937418127900739730326874335888617161971,17036562818332519536292487256920458988625450115083747105277938048739292827058,795554890382567685751618566957270321871701261784565632343709559354970377145,633072079840093073847779349151531317793918731920375040247534587265858418734,19421194221177975514787747427021411300539454454371387008642591623632727982196,9954719107136377193496025917640974425520732567100168938432529522254697824571,8674312532180246290069249621352567303340886011365637785384772665860996736758,14809129550856657213168714888239735820810817787153747648450536960647330811703,18479959092813678391370975524549834571584338614798320263799188362327888537937,11754080849414921164216607793483937490683185256818320971638570891360029327056,10287736699385961112844233987245832756528102056561178731804188514133469579013,14370616700332892416887680617217669883953806003377620695037833373409292189021,12131262377053219810698216976753909777223459611599034218924662817794274728701,15129974113281645648506209149692470898425572316691306513209191313993708898437,7871644959999350003348485402403894487663479920989578076708137744830000430296,1576915733292398470896862707357585951921545131195468346129170132189223165938,13316238922195025030929715018519212370128739646325014577776776032463179349855,15160020868051885495078648274966503057453505806774983308629511566464684311627,1692269682153339201433258246771340974628904846837119864247013056373782718416,19628837155426033423644376042848583705054394443378101622337255362403724735047,19222966046507618124793516210121558272031295169005274768240595331459420997142,12990748614547458190976906297393525840623470679364771518133250166378979874463,10124996030376091099517250678153357142212975502206884325977282211158514276950,17630673366223237394418802287655202715156124721482801416980858260564381593966,6743037447395702022066513290929048145404894812633440602191382691018136524423,3910195434942407507599129230554588207801501224467133349280934483448828467487,2025953242925331197360540874793022332074847486979998082380244277507702608951,17290925253475198968609624243667228472127383792887388480830073536530705682760,15557314422719360545874148111856256188428921052029295715627017447052250706766,19758557148246918190283097589287660972538989627091387035573386136809005998935,10859351185398338650386876904094285059182038967427299340069909694684844129362,3496018793417449121342556434800740598384008787187762642325224753304909741349,13695501250971489187692201493870442254612771332042272465953359508617675704938,13572242195808512474816152630443442412961099907068902213470234329372028271256,6257061132956659095252686302119011010885219692712894010340612889095488866530,4330599809632843338876238530496396340118064854909940219910748808728579051913,9157987606978264109338780586425009211347479724574125407732261019832259951031,2328698634372378957406958821467382289342903425118775270878244960387352862845,20636525922386221727012980541907198653039323429055563362662406273278160984146,15847894355448175995216566821171916679432807087340467956339517156584053817157,1942360378421747943668019094002571732886982847410366696537432314848905467679,9512432294361739988724195228775769058251373607278744642461344881575127503031,7373765909536890992660842391636719615263272667672747352621337161184389163446,16805165862480928364732162070809175154629112007405963636466097184868514458659,7667777941325858499291332847392489530780564386762784335358233711706517931292,6446208647487337326336908745536052288215677968074882840304817109073334759485,11285516171986135785540153632137541881991922296507010937224736080386568662797,10115214387228124714106659470937696440920497755599449040012569123044717722706,15485618097017003479590081826451772255273462073640651108645768569284210541135,14933383877101576453093795963534828854771957327481830015228527838452944594646,12699366929120600543724208703956381057734625711467645612998923493410472579972,12636366946456086231704939526732303791619337704833963854669708252203542584210,12149350767700952579168066320091211427411187251056390220529300991824437924228,7521252564104984899409328139379375498829232271563704354107116269254046402507,12033991121152464927378622393121300999333393690763174606686511857615848602007,17232776948709347607296344257668859070263618035653710252910881198999758003380,8692908682458431891302516268928916165669902656866484222966303081483718910104,1253076047322637463481069610081050841277544153675308425513468857300598987482,17753389824587331559955818909257943804816005297310986968447179587639048799696,5220269242560242526244582743085713945173060875457087963936380952653150665967,17126848126303954156127690428371193690154903947228604938919561454676410821149,16844245036721981603144243350071451732279678956963696493069130132912694448751,16797761350119564409426534689125994845767740388070744929816576998448097719798,19353620610135120026060560134469588460709151673182029068633909633596535108020,19135326024992044270104645311242450367403619348108625528873986701416220617679,17665816362466043406415418194780245586053150534372814020191541209753248047067,11399583108978058354832763133747562621839059603612742599115200702193127837394,10094334549114303273265943473013412623520307578724043117639269488721170750917,21601458494506173036246860827162868889968956934810679234022762622742359366252,6386580477827919478878489737663301647954047211008970416851133263802072756591,4792043837032853062947152822210390150724912812294333339974827814683543135564,20876886123310865680023706563792643033695666593071136348323857270657128199374,5931154799422838405687052216230902279350178420072288819326391251206607447359,5239679324690579237822809044372316561806419523557737441242604861240795339076,10385003741667422202343482240152986976068622687279646189490976516013598227432,8464156248644168452015929033942509092145250244998026718035923409819766539834,13177537753162628205208392995644675716264814191265988042404781479197639366733,5919477377826036950488668794024141041792143979412430063956231337921980979482,1351402666854456730370541080745509803482004768817122599092881844387000676155,6818673776641149273361875347660949176445649468306471072411086367313332518455,1366646945884507587781123424154966453464902291438811059924651777083838835678,16219293249111347900064666257423013936256436002819357345030961998874555359000,779230149490072246312543789505064727370429119089791148581854356816464370377,18480337167389263493513952937037301086055810692872257722500635290543939189393,1345414110418158215433956620396568245327910182467730711109133441878095212920,12518315654451653143886317929532883727219058399486775127781649065277400104111,19716171362713656659833259243590727588692449255201500490000859973307782246016,1865072487559894165339723956247507020827160163812334855490266264867949416605,8915174456326318257703177400411158958853446829269268103252573093652570933472,20191934956657253997484040571514242713447218897800997897558899754776252309230,3900170788760364547006546697350123842323924137566872497612605525517074710000,2242244954905694264442292936230335662862827521454977184433268725352453968501,17212753633823250440920113486091598217346743686574392123683302470302281044057,11939276774333100126191320505078174289237596631307779156488772314461752488631,361355126674011999247836373885105218009746852422112563922207274436194144681,3861054771271956681986534133247127581996350841974597302976225613765246291116,19968479093411941747037123171825881488638273087679549521610505739311299462846,8537196135596544183619390135426012949552627827993128615534814021127294540392,2438879838432432949185118142364194193697006515067980632650379470739663214843,10769366200854175394348657213265947929465261545591304593688343101111720627317,8455019976119342575889554308499186802278388693477937667704910645050957262689,20644389417984700539779514908032253651696357386572813102276555909201716748299,8820039786383750409041489202684137325382534899692778928304664068322226640076,8636461459675525672530300171201543901107046823820677414340465229975162161919,9061524648737340075438868917468774023866583922769991567001812766008277156749,7602969742956570438827438826124187210014769304752116695796494779120606534919,17880480383024583813657184645997268710007005482705400161841684734099773182094,12468433127385453618607022105559942067759302463679348320088817783890080634670,5227335513133160328788197758812517500875193491652227971114102085123079105787,6151293357148965084809035339276030775032864902311425722089088413878852880603,13699219811250783019541356007733829713463891996344484242492968708316395244276,20523944015644472920486129305620987253227711059638489683670518491277805771642,10421521516830672217871475174620176828341870738569247402138774913961149048583,15243709334491280025949017219424981672670169674700467979049999809115231651422,15516151337135073170256217447458198066207320794936363948307836943072374966170,17337341094266438501679457986886656365327787301649468585664115813920643670255,13262611487153423909813660830277859169133522588408913308784951544213550636850,18531665394082016871726276363920851282983017715104457591860421181826617619235,3700454591945927209171569025131477008196191968736477330379417168348613474972,3604972001659087732761769946443190920343158947813896848729866695375607825911,20952949990925307134028293094501736726689724950451065635729323134614933963162,9405357171465854081502883779215538022417071330241830295392540662303830897477,21638057691528924765719568024989208898293733581278465977164525893773900371884,1423261214711655336057796638966786076518765517452404205191550645234914655224,4051452662373209612509106830833400151748328181316060758960838588997502328136,18894191275634392250799133342573131067016712303481664374003128715704286175519,8319722910647187566775047002603641370685637216565762886509056643924765393708,18376807271218398458453428415456722166053637869198381036620575958015471551748,12035584964270041086110602893321059914382792217135345721427943800456312398294,12648928151571890511419082198798501903838843998709266232987169892491925610349,21412038262513052722667255278175073999553643537758589877888129674442282140610,7706735190856341161262212613554225730619876208755452623628315796884166016734,10999966015370832078836488333389544875338251739488999274500058322944383211399,4088296406085952300442596245852961024918851819760395990644634222875937267642,19399822412575078284884340953745677500886533272999950579143260384703504507006,3008499431966541245607724530938385192395211534821775780577277325698653345072,21447244586691806434401916456546893987941039399147865009673973728056412619884,893624395222035047010673050230651164575948871010677581303166873938544655581,21402344785412208717452894839332459679574051179708007417742748857146495441368,9392712010553327328684355664342647815409597079361837524976044019430681532876,11566000613582826375650817776243972243778859250974226949316472392849073658674,12900046757905605731200852057204734685283283637014313056501123642345467590346,2147232762440136333246788660102778148879449441151868600321283583777116020664,16301766972982581403924204059742972933467455194833897714073756335881543890771,9546560122931098895129690583175071306095759562194496054583390881525378967396,3814097068175987733354103462855355721851435755267819873064912557751073632829,10704509016547426355599213335456446765914211024738080860797634337598031536580,11921271012710313311785310319425095342886561942032945429395596578758895308264,21265249694322068914280109016742517903125526413969519857556032179013285196924,7207578215754030787157150149235357460121567678249968060366462431427104673093,20820013978092841458072065536574129286011620075823185493370309064760526240362,16441600678335369077753559950421185577542163640313037056248177018465084864223,297097313501884278852369638329400055327872945847645211148627847628970916078,18298084629287541333205519012404334789930413367615524379442280529941257264699,15206243674059814574375077493088319889784970587286591062649045683132661681752,18726053049188513051286348977772545167577661574609708038977390139794201099882,20262858185621074639529176348089123044694437795099449154711162805012934737131,2249345697973053772423677422936999849381692933292653912080014325442939977122,20814726663898441680439335735982981967722006066824203970896314191676769388296,3816485989624386223507317175678560807682224519267326958526058565555245734714,16741230612980371365533431648017361867585544111098407772560748428499802539906,2436865301432265520692873922135716828388518032014231744012990863912440945389,5265261577128499220460184630262997769060828863581478135168474766310582001180,20550548783058990082416235781987882123241946829605049684648813233836863290502,21523044301008793877416122201092687874337292497403523925455260117417170777735,9283421400783174646451499708802113832695004549893166692004850391713463380536,17813773547838391112844362681067751767404443478918792865885006908077545151618,16486730475669947890512191574075897324037778751496940417084163322433837359720,11367125189013824464048785896422572845103707778462525259651446893275289247873,4759445724467851058773503846834304672223785226936531021666916376323562671488,782273457631193956426744043048759353979593033245260492990657945904665284910,13487130697992008212099652811750242205045881544509489831523448570173633517977,15621563974535086891768796441515013364217522966350445838133979748032034816142,19364835034502915244801518193980688426244659266819997726035650961451415757173,21037385853462058267099182407141652124171361973889761119816789091401609511088,20434791917020905003166852059282129255412677606775079570484129378535005615291,4835039666519156760310260600042269943079463379265872618778854224413385690994,17796521681519947552208651467058827825861565135255248123077469895978163706264,2823350440792171019111081223801188552138104039380675927963458669980277420276,16030935304664378631941573945857397096373696981104104381156313618686049806120,17523561865544155408760007908067668065236326734119657233234283826019015377013,3861341406966982603014220134107636493882146780655211775629734223927755221098,1327887013530867777305056212037691710827939709365211251951525926327942169414,16874372098146373517691588057974501095408377103185981262983559391956463291137,1335930538845994150082853775454018356383085560294444442667355553131066129276,16846954448852864630121063053695845658867759327963014776419090787323732938912,1910615356880143423765930148112668984411979710628153215580997630269783916489,8793723522335768214688108364110927144836722932802666660252079036893034856492,3725321587522884864935206279104882080790553804758085564413847527197687551835,17549397166194503933313005107479073474671951786436058351827338574279485542057,6575272615526665941236934551769345604089554458721499014263130089965203838692,19479945993771870488240738504390121923410154808673876321101554256856036124677,15218540520084042504179141700157006972641510542203443030571191341196460163766,11605382280428426652337162672330854829498688801746852913129963366330544359414,19452583367341408020642116770501289011436457479987875413223766731278874726613,2498463382382553480222037299113185800507848748313035345734629490930688205092,1815123960727364421144419865126922339611466868807520419660969560789979822474,20531692711768862540943545541715345229360673134388506876856593310216372259130,21106443640856542784867046664180461359993554892163126756059125921876166419615,8538925154199646282458477113696635826112766123791239931164489946578874271866,6179996393486486548378164504724190431464526698002381214818146508779777698063,1334556948430115939422649531996020210538905726908545666936164977436729124944,14555087544451841622469763698691954343538388285983305607235034906273022598676,3263678860186354326206053303615515256258748076250020171477442794745232038780,1342606052959540554052550853649027290857482440100275878202185177537473434874,19067318604617984900108104413860593038444834168491290140413988853573796446193,11453576191720077983310542494091726783885546118293459348522522324645101050430,3772400828106882724656632136643514300687950364203707059277582466654856015909,19928616354232846804233301414766074864065580313304404532140360351457581578733,17669618023197654971616078177762451816976570462585423216749814198562722234016,20487504497482961764356160511764652912371612840137405927810776425577238052311,15959943319286858239034503624455112049217253792773599324329593237810330429519,18384331160163107383609864825156022277275076414745740108239579270660154123750,11807744905122445070761653068499781933485269571078706728521902995972849333739,21636069700028297640587439425598371999203459272489053044479958900301869951268,5974406255004817187688462241155741022204236935194897255519053490391727654963,18655439470676485950283686008645538637216956533059508817637925480405213882893,15164692255429309369428108531856612257028649418370969640920631880841690009016,12342219963417210875401056442100023070134657858086394031902694268469750570612,481209231155250366998260270814874408671884781003382050138985430923825730090,3242985953168013112117560001466320034030784952490866310190327264524235633420,13671160391160864796369771052335315926068131063004086507703804642392143876725,16716228406804746939632807079686149044089946710213611348848847599210659020138,9496049727665863372935045496498617414460003517119878231671018103126084599100,16483340875218689502751737973203780724082025375353804209734656041473116836207,2627597076078148403546873341483726933849452415436198036537442451261384383723,20527956374075302103516613197928664717455732919429461243667758971357150882342,11711450220231538029408058975978592998998598526983681112180323327131923215776,14877293714143600802178367397934915488570060506993092692625720179311507474506,17326201000468992158693082078045140389930457394232528033746431682308160431934,8241890704089720408679017565592201736334812957892898769189351788325500937732,6134985085876540657808139826388808003135254271482158519839818774839726308917,6944918715501093472287921248184355748547193680657762762284351108190443908482,20293371855859360749476040038457808453751087076170457949707661658124460443795,12686929429491234226470786986230897140429036877303905464553700071658994784104,17469937611674874489854850805106365496296990924579100118175990663783068480118,4389315288495042551686883151731749050970801790377604942482415778510472384968,11356013296312574683565144017425132580728729177241949155779586695189495537084,5103616537832821778796048073410908442363049367034544148603830689894368565040,17797731362169406634431131949969435652804582561417001546024888062211188454886,14413974530545126251158359344156378502844867672748912889426381728267720393327,18860675036245741580291857551498220749884348391920381715922087052471051304459,2078681010293955893545295223175290151677764183673754633340142745613957031877,11594462210573371469687203943585180057860108341927961420756260896877407822187,8232172476137304604696594035794651005660416081930158074561971898151387789159,16234745736110953717672420346414210260779855851076189537371942811750295876135,12403261277735118438898936378116787991453555210970659659639856670648844247938,10260185954137740247486488192570496092684935183379388125044125653647328054023,12655661577981598013787126068450556825218951206788052328715378240540030673155,18875782029492829253540920061867800401544385695523240332551730645990253683286,13000939909369679921538945109975441940863265779072482929455684540500587590629,239651505606383903278277662841450805219997298453219985892834268956273681444,14053674646208577108881262953518523519057705122297176784230960366018789686467,3606574524342197944154321263420984044427893927972300192386619594198948706444,4925738689374393290519002876270198297196104042467164940497567711764321354393,9820857610236925174040210045575219513594477725958302510866127781620764675531,8644935227560188528158307606853375529544842899940616765747319983176480635667,12589563927120228887319930197852404057542625019034806374830349240796880735981,13728987671030134173563628755348391107370774536000844606094840710456114349003,15280672692530045491619672502933299001869276703035606138561063102232345967821,21236672540209166733321925277807375026701626666734236841532747395149863205571,18193368154219306112046312834283644566129199372283662927472078427038205531636,17828956732555553542546753429670551891943977601119756829631880115504235233984,16641047964358580103472953437535358748387376425127849904658691126285684204504,7196281413799658043487145161620082973834461754768351228587249162400339111893,21279455923934963235610861427104388147894350922169838127737714784897083581830,10868227810739752166142906769497786680491652628709341836398414527811509748689,2545479497580424357309396388184225593698470568625667945691755386799845345027,18560104754451358950174079457178017278416450108044438296553162755384040068059,11209544817144484509471895492404241079181269159060632258040504564376475442191,14007605578670373547623429803718323316371456029307063658189484725071020560017,19316201371814679831554697580647476192318282119512681720915001227483533198021,16788142218280927569387096932066591137887806957079516944927766625343518189548,961359518362994763330685811948798278197676602059504713988410706948791494727,19776591693739287332042935252284088014720557305781829207369487992244783048185,9480779019638564372864984254416095889603560407402750333423136372713778963272,7812061847536565125280880398757948966749177710701972331770694629380983832516,14806224217889264732099766866344263686300132511433376375954468192761174167878,10982734897602724370866115596864634266746118759609469486863878972425453415519,9054801238670111257982773992849940941038784597792282084645523468554872244495,16788499373458165601983802204061832376825550128562541027433580619384299691535,4361212778425224413929793165968418385407821814716394404713983701050982051159,21198869506404830651226227162808186595284220877501140400488215541390720176503,7255012904510681544072472510832565052731304049336267892176928038570971034121,9737409770400739938717035426255379270654933363992002237053138761832402079248,14206577906412186888550704503752653056320975796075254442765439825369882967977,19036632138581200062386943078412086222459679497578993523004498970778925638274,2855178582526872375806959544405581665248537620420194093904041355969926293337,12896727255458884273207928529421874672712973447260798892551468479503233439215,20930350939164528694912500193219456539952966506926646436560438515643683077210,184093243282405111677536457857692693581379037444126410664343605529966199122,15658149328429348710722591333703516363901544310832580304722884306208924451465,17544235160628712643216064131303569753533519783718786133736357990785709619346,9378984995834426590515136439048146470293781405649183047514776402081048834772,15827462476470655610816981948418438654022314364182315935007413461648751735708,13474113844360907776462232979612140726930720201237003164521648175005015977732,1846676454601041085237775396212630553832771346942418764660365576890630152018,8958790186410745003596973786908460746144469347369569174866696175944574520886,16716100142556090678395507171596864615262575578180211444515549196841601774046,17584363243087108058467208592097637069605249776196694465943790236027601639916,15462568643993327150997687623907692370120490318886920754261967569094539968909,11670427917584674115542198398366950879185738970881616803513412243898491416455,5883010686944177614793479335292002976406988590121850032334552332298599405710,20848023045403944451304856285219275218146149181988087184275301094312642906291,20892609628755793476767683891284835591758207667306100001065280698890821585620,11041559416099382923560246079300939393371149141074957197352566129686429429340,17004024027027164912556351303862470964296900000646134239805113699616064012220,110742314120280698533248152539115345099402903868297760208823130532853128340,13611598917097489441998314826578736196564311189470688979687759717921520208428,20362978391139708024092837231934567580385484740720090300868417284017430844864,4130975720087443718484415210347908638971321493417335260526136858657572592254,15799784358302997284875412214187555553319485274948108081666806701893845835839,12410480753305882251320943831026503736012757975027018073585110506521877824193,11835843853657957571888855948788121206617247107501669280697395787347649231752,3326313455005237548503557557286834479752096887215379141590090769222516357133,3193633369267878319453517203588676707547172638050950764150162277144428673066,3543696055990388683071939150214505536733386566291338758519836333135488212473,453840133795717001022433249997110059635014609516452256954528366651276289770,10086004265216215714804100477403907145516617200748655771783383139854288214070,18938459257787140207383332020952460039308194017940327258304986766920440675756,18017538799787896442217663532610710859333377084532654794368604069493775630216,5517691591172342790575564654696650661133600869824307632295945043592492062300,5846204096126701465613249085053971321249645306247508562697696901334354225619,3177064511134248081568628736306700282095095665917536853000298191943047784014,7886005759395499452194553110700824805018792487440311729836576312028682853862,19249432464407391173245558257296856631584193393398113008165174416171947900609,16818455958785909569371690525990846776263170512884599090849081099178789681425,16250344336602567919050898941410625842485562539342327155695417850618940905704,6273998461375119044609362240019558608655450921258416376794979330773412610302,15933077340738498731035173703791932079747269039222967104684412531145625747085,17631878023023477567294765381542867314814954498487832435087010633074888584009,3387656327342575368928488173891176548794878068816523542226413637288662472792,15770343706243316227190526252701886989383556270818375222569120097305537622560,21025947829537149117391184273139276031347299127217645728072786010534368285621,11728430055160129100077268133090903533902452454196978455625432056779499908581,2184576630760971645143677026393147474439766939689140114811262608230414186937,20744811853491523948066896610767067484129121010717068573365370365324040781186,5378129452609441814399329369785055593231824205814541852039878139773312247469,18082900764136659604287793533371380099349929291808230688664846500365863263118,10463958995559323021196963984934883570109613942564610388110191948063546468897,244120224370345949702567256216804961153505781666838608095297311545160357032,17924705581798291273661662368787600134425123985006190354093511903371507000154,3107793385049037773698181795186417899797325916401357881664725445733609110598,5665818573123185227274537904890713907625420710982346291959547939830358917272,967322682615997637785254033877348832211978156650281338584051044602311410196,19419941178285529854771216440310658103611219351729270204884834098822007849679,6901963792883328370624032472781824547409040392368725235274158498520441238159,13721659825627300509722716825333808233371435398666022190921612703736274379535,2784281502858555298249063959836879135450746982163416748737579846439268828933,9904373282060708277943634486822397019446454722637742217276784802015824898651,5782567592658163731724098371574354386783075175203877502094122152538152467682,10854330629450460532485325799036675355255970975925867222693267730198057197195,7162558805520478103072398765799613453839879264508883857822705210986309908966,14561060495007338369036260685346480181377385446422680685283066135483167829865,11521954935420160563214644175207412771411940789064933791820101643809540481492,3893071612329582305940837979511590531534863287842007408024123330272447072664,19982770443796802008915975147614604175753586689418309845602797606117149147490,19714753609495058998670661272525609201695470529132258598980221623379639411831,10656632215192474178114431876399520721084839753473211054259843433641616176373,15519943627473966175746342389219894179761085602008029155282295063466585111230,429220418726674010600368106136723992478318707196454289985261340376476917460,16943119555428737036287647863079565463224985076466268175824843518378134856246,7079268853451648384434335899135383974808119657387366504271184409878695702895,5787261347913259367727842908192773692002199385877294080619854106978539332397,8254314874636465273639128395147895313719165057850599581478980264860146008069,15417738281457065064716789110361253613929614783743035738325702945037527193953,8995940809050737092434676062651493038351424361820394016896779859938155003450,8930952966754141446126393622188683431566029237395186071059700311531927009283,9012970415439810859538557593310902447051948348093454112737452817814629449500,21700461010267441715993595978543322483687194036588160210184366057201658507847,19191426116308521669196161733982754533604260068907220372422504926794231257150,18022413735343984488479130392027693687461867574196874267731354592562070094392,13853879871506882218224060020827336496729967255850404386800036291019021382781,13303720125164503437055631247918150173085142868095887759030649510172293881844,12463581809293287384469946044562671884924464520288697069370030386140109068261,20468619377263375923071378952981485015200979956112400596511865225946853604157,16682148710681177357125570715056314888342059670705617513402649433802720432267,16299073895000203963165709887505572454180623116454760411179563591228007694413,6439155427163506786329349605983728674821430800627321435200421453561910062302,16531483734580605436075637034861280240342858648848575098901014901746112480232,17413802217650584016261506268242623594956116228659732892682224912798301233645,19833018739354446018077109493089909435818386368530968355647208939546565982905,13005203599293796776324509750491064421128717423989464867065044987475986374420,15433711189444672576513248931602290892518442446252602686878477157678233603772,11272192842480959445178012145556234469776261923967845001064211055340129168135,21349777755000957327199310930646977290027138137542241555905014230683052104267,2414795183415356147955181901405712632718942970568205736628916600696077941534,13910388410253717440990758214044472114511432613509643223811561885135488623236,10073917454281511762447567386654530277776617831005093724557094001489771821135,15674657915196276639699997458656008228696751013801231738985398708672037426000,12030695425048598984176709301472822771003849589255577773183310838231109921591,6658172369461756755506276881582345916252610724131747740625283609123100367529,6460801016753822141904293563006139350014125998787400018150863192907944207957,10798491465896968361800574703868612181389697312199241920447162078078725409638,6331917501914253534943383807348566698937757752033630507696817298838693259937,21521172968280414216108032807577565012642487518706778276505136864150789112592,11443202152743097070847729825799673217706162711935940510632741405015900516668,10360970774813507384412119692215277392320350056791930702078433469299837875151,8111678922881662305935841208620197469657237670526301850210945861223648259810,3828566775247110089904016755996284741548002327940628727687176763639903716661,21019871488460899469684764817167629979753844957147537040703291790231271795829,11744049805554498869931942573519884330545637954557542018916739662277241821806,4521092770491436085084640166923844634777984445583984077999595768778116564222,2428018726292924561718904390333390438951211767580762396913313600061529081905,2672992591753804066533616673591169777906973091506536575810912266557203322920,5631180351966611479340932319081124575466459942666630580683510336616679680271,10149209329290376952496655294191511204529081153402908137750268385347783758010,18292794133971639465196495021864699906132845458944945214425906730119328661326,21442863185355178191454777233963814974940050392649316620141474331670970354424,3768420898310640667772098495371174917665155708578905018940113026409140957987,13677778555119984843885943251631654212176086447994430552012266440677394344669,13884681165958999171515885225547717032289759601884108191367706162606597842698,123196094575938824660055152882088188411485715788351262262924974166600702398,1121836698372380581784934880625694675020871234049336489788624481922395781738,20941331435492311592529607715649713508861806194386837398916323083940590908651,2470912827043971002614412337239267059969980871643559631900987795139200233821,10806505189594612637071931546921663393081238567888534876058498530874738324701,667951375802630033661777802749339877422061577764798227349674331630120025667,18416355600415187627018330134584431345513028652497077471935121971918269469363,14167152054564590179475064444026440101215733530475912312508414765738108715862,18633695428427030575173671831485026260967985663658201463236228419717189642766,152822669216765741203342297512101138657182497046533047369566701489981099230,13835701173750333056481994253160471551109858589047436642253159392878873667798,3993942321148722649703549241999711668949060533276325947207349685002693878681,15582244332423092177434976075689385819450099629893355758782548118218073388706,15110236879710270343688993144525012407319759236015974251051640787524859884359,5104405092803829419537383694663582438349376353030379488011426113631155364320,11034886586481561934231698674217393887518948538322130743646058638919797229737,21614370562083755709911993869347579638113152610927033622836963904672826178593,11909716327216431973191112809713028257963610176155315584304717743448686635887,9670047520194835060472941420215502268522351803257892125345072551055025494562,8752044341583145728028411582583224350471084864272507077624316823400738066962,20685513123216586620977713797881862528998788503897607377725195418550074311551,20219162196364967181713755472576994456615542213293827108438968625041058321145,18287830464300889532838439052863785386620820747210980263612361113628554829988,10146051396529576924597355409059465520468869175466632446875430377637660889879,13466459020798488583841582724067017412922317425102130151754649408559458307937,14062280191830459071860023268317938748180670907089383563443465249500572357980,18486553995294693573565546696966437493113894571993019524170031057367640632085,11156566424349445901806390826392443373766529722049710427351550423908421767094,209671637225069235519570008386635562520193585953162475265417907100134848923,17226989944018790920809176115775819865824823495740082575382169759054625372382,15644589951345053163188258692419292119540702867922222648564209455819510994564,3689635641036835670663293726548900381724135109917216986885298700630212836435,3367607896403464195671402279459329078003744183784952830994679539910724667259,6227320552634621985217890398406127207902736210419315868051857823685244516725,7357930890687295365886228617478473072206575811998185548162905341534675558305,9337019296542497689612612043175604595811913796434346282222317112981594913389,14658782859891978670907070276103444826326577838777644289370207112293812556778,1700861002075407761970169168361393086239805454951858464329713573177596208454,8422307882422345667268572118847227804767508317685246864132851358134342544918,3824678171886439611637777800578730196591582015637069631407414390326082519384,7520989644070067743500997565082513560943860081670904302057616063200273050286,5278276919931895959830110725703210158384647399821914390314400092195592076331,14590632939277529585876696200177152214896495867542780671631701634592299041714,14365499645924743985349770983085181263329435144891175678390938245209017764418,2519790270252875654107597063434691592006935573176284731324585122712988059511,17688843544040778657269233842324532395371012201506418912518394656290716826075,16584068781164994465207120381716024087231836173689783891650623302438290695506,12224860044594664185598615945328866758529752520066027818906177267571423023661,13664317767999211366109254182438581912610775541954425083255023643648887081779,19324196860555787958873349597666822462940695051471419602454830948112942481945,15338841226759355791277440652242849878000656382388414806186764010001628984934,11076363155150973228897602285090741665942726007445165132980573631249449594126,11228309866140794620879641097623963859536328868056691748463227126359575786386,4762608512226640372168720665137259637840828925512114281702049841301872652787,18282645934358125859102195916568492018711932725386725562892735740355836227532,12803228415054755333149187333584509982900042807310255834005394843350472605458,17675693156369747720817703064233611574822178844066411565804543111769294187197,9900029048144575309490519431063332695303076438539483419053219772370202428926,3684590949621971596368895784562632626464811455818343794800044114209066071601,5443335602638685057982926800093482287199751584817191972983546508574786160090,11352900694666160844325992247118358443639716695965864728670968730093466793722,9836739435541786452166525951732520477055729763398281521212184905286650567233,8222926590877635625730738050718327099397892409701316035188479123499338707893,8154558268770648194631329585722892880905143452138234292827603893129808716905,20661038342485310632612091028394348057035659683250957045340774030445861865592,9136910062528018177460276667688174167129493547069053533874280111057356360561,4362513385797089229061458501847196255783651860098500705320631416351847846956,2061137061600029258110405980965338431925491466724330216028866028449889153371,14607676885409772552908782897874144975643999944034675480739173900267789420534,215346512487318428553079809620502708407272005519315271404209452927497999118,18044026902282362371439577283764019415115969502361960218708274179281044595578,9652478245641134951513165220881528043195466248948069255527062590256621034842,20994154929281322813927859895894589885437941429166007529912073756113466975582,20752721666010515144550782025078875036488075535083563976118804420187462745253,20857028711523544595627940704882176284224509745902984714255291431664146535922,9631521770540523913735742126933921923952197512938165111866628665235591582568,18950423265182779471595998716023482060645307106263127634953888715515988505533,1436791836740130330138273456892846001841969807914099860317370076565131805680,18145299176463660895047063984288790313564980703886502044680749544519011424826,7008134596456692891696131297028980612714475387065733972352529833092170154127,18054087496593103261596842546955317831262607456582498514349407492750291465651,2460661191051979147731673103829326449069370361298340160666765010767300969003,1121019547339042268901204213478561141018690742635442229019134496736639790078,13486140142607002128358893931572108539446504181590991898872881746144618091798,14485083458755292442253176062192342099468601222388603924363708902524652589634,17684636079328478898730536417772675839399177918554869673260926729643471105206,12382939536995562937141167025903251534081453604974163882762565576243762872206,5191757256912351314880102858899907666377813090645991709894707944196053941770,18397247107649643640823283145149323187327745749077714626730537494597891967945,21508632378351416585385353654317189405917247727406155133342616741543833680788,19108354768686907995261340253443420621814860995097718380505789237761300853182,3649609518051015699386442513879956346519312025847003339036530556474594795760,11893851425092314587513815253407979901615516208632062595457152391110352908805,13296593391067251947204447959241604616835056311051696511507435925462940176830,18493557674615580922923001229788184231889430766683327472934879670006059540367,7669746659590113244880799806073731587177781693253502772068846650012974230120,19370654200032786851343971085637480775724705092664059950989935645178139099864,1331955346226787928500793024038189892044219824334532771311923855914410290305,14488880297827410405382492933041130286687512096290491259710680579157544248910,6760882547908259908954677726421351194118695606292587659467769365205068189814], + [708458300293891745856425423607721463509413916954480913172999113933455141974,14271228280974236486906321420750465147409060481575418066139408902283524749997,15852878306984329426654933335929774834335684656381336212668681628835945610740,14650063533814858868677752931082459040894187001723054833238582599403791885108,5582010871038992135003913294240928881356211983701117708338786934614118892655,17817167707934144056061336113828482446323869140602919022203233163412357573520,16618894908063983272770489218670262360190849213687934219652137459014587794085,10883405878649359800090160909097238327402403049670067541357916315880123123342,7439184039942350631846254109167666628442833987137988596039526179738154790587,2727663760525187222746025175304386977552466570311228286110141668880678011929,16992375884417886634716738306539629570444547136030480542879886913528563834233,4178586893949624406750122665277033849762243490544460031634329370298105635905,2517914797385699886738929430037355069462619900197972886482360691236776726214,20164173810534657634631187494276970100735049909727379228976555863615716408280,19970958827248077001061220127605534603528515080207197493660642269195127427214,15606275977308968307194602612931727810866183872589808138812916593200446820753,12261436001550634140750381230737452634746867040398895669545077774504957433511,10405309809257831434323731445544896504541938387524726028487604098725193737428,13408856444092113657034337770571899796129642125690066226794939383190876435468,19768080898957882918527124226120459667739640387901357739011662191034806046251,16749889646056241484852997428132695501278739424507088920371060969471495213919,12331609790192161246735870679870317366088443875784324655482358218146673901073,15769331739277556832196167201116801527901089923090632364403958141614820528626,5227172275505968397128736045169568430462701766148126842874241545343535393924,919073378344729780131814412541912290691661039815032069498359347682919854836,17858725475505870077023114050620337312678855554361132257763133392017321111169,21805188450184460363143840112266872832328782034569970452376470141743078343745,15808413311863154368918155104905222670782553225279887458053980771135357021692,12828907214414139667587331812274388831051429093098655261887619166452245292431,19323880880917307340820066456419195877039970908109908221992925424585030574269,17591732412986269470826282099678922890996647592922237928486497997144096433314,5282593184575641056912422403901924986019740793240905758215569065763629999318,16013130707598525718519250412251656096494468043256226360413191733653074896117,928381583587170989315021718439506896903185927814675820160976165627097308915,13354336789663524324458402003354905134416094005220899335023797754517805691310,8780135673134081873589118311874067764073719549433574820315100541871522642766,3334957744389892864165113989538814646945861179021194859030934481494560681812,10553413566358881045095498839713459314577909144176577153981801574128014927353,18894321506279909207228932263261226433242541255661384643559047811974513999438,20211894014628303327332299342564779073614790317614402383971270594430055013904,16723480621932556506775906903415088312771104391224076734252099577243237899106,1131872547334579236404174618548801749854242069301712398106619948805304881636,17386814048141719093058723520379257085987299288710382497237609774141718421404,13729980537487612221640320393867198844745491357830417754869369043292518007370,15860780436383591737179656321807464721751913977397035980422407138400867838633,14708550460111247278740231297332510059116901767161326454481923990389610737973,3132820559166321299152015048428879769905404947939291493327190426785911502819,8658132367999084824971296219169212568783540935524918908332001856872807119287,21064783047501777742084787259676320053480170916619513986794406566953069418035,20731000104011695148048713576219525164619502119638555785381543866326561323,17189725817866212967650950297463469529475851286172280116066228706121595462088,3310440878606659516028312898499559492876015493892608849966645073367377278233,18463918215326370595980949760897480127622730018343709491036454088497976892863,10894192430593140913557164014343360386192963621862346779515699758352916852228,5060610877870389107953459328006060153180283860738879092399406248484265273634,9068988823145592214189961315730261367007076042069390630024839612151270430414,13160707893890865447331361630522644819624543031829773191665491273833460019183,13920568292534026180186486064598876780779571940988254327823480971820885713801,3894011501178134026216736522445829906312115650019712122802932677318433032635,17895318821130376385979570244603067634449453259842805202694945793852667231847,9777993060458301797155055013115849176281006051494461044565335406558308324220,16521293541516305251718414192107787058980727971856888501176820100904791554730,7744063601405355255689420547832904761861257642931934580021876189691881462544,5444730929053688962452159157646022068806222098484627080046464163159451208522,1524118152994294864739915388438939180298324297960159419600850033701763764640,1334622237342346242862023763160346671504959163544406543315614662442562816653,16126317914306849967682996412350336172782726693375105190424151365140854833923,6345975085253358297751050638846919833013142450462810543971050115910612860460,2703875280053263252177031410407166981522153304496807669518295313468095058674,20550626512184448884716175825490086259235894802178999642552696391947509065676,15013718986700828670892638677446258841869291160144196138236407826511808592486,4682264015512203762723381542642871160915706748420642731100634327658667608042,12834108073603507925748862283503586970613250684810871463629807392488566121352,8422606792378744850363509404165092879785007388646473871019846954536829739979,9339209090550177650528715604504958143078492516052997365409534971861874881780,9141831918422847136631159987994781722269889810731887947045878986971886716767,18329180549061748373684938917948729366786279119056979983310618862430068636631,2009551904565170718789964252583363785971078331314490170341991643087565227885,3859729780601667888281187160881197567257456581829833310753128034179061564519,8535335342372994336873304745903510543599314397287086554558824692658347277251,14148514289641991520153975838000398174635263164584825009402034843810351225518] + ) +} +// noir-fmt:ignore +pub fn x5_10_config() -> PoseidonConfig<680, 100> { + config( + 10, + 8, + 60, + alpha(), + [6377232663526537440095439257883018477761342422116697881186123375221738885878,851539971462439380385862352460596759101811723695394639617127852578681769809,8777577262325190174206575699458733195047013200879424709893142671840513604890,21694543997668766291509756109744969193435163886467863962355853609369758783238,9577278996811393500051721677710083593799044422389686435650597107832854019185,16323954252044716897246121150114593642230197187021287621193086593549237094775,9789909425016820105251161906130605326280235056822272235912508431951118212950,5766700650277227528545902607164112169119010038912902265869378685414299620760,14342521005374081251816746055115831251291272287569749723238975882435091047876,2566050045458470252423704003188705777658084864238473334290159653618543192811,8762700051029310248153110133778709519032029454737126719215892745208105815416,4708553466520767412303631379034292236924119642035476122997253385705160556618,4755252554118675759917549980023743559070421272488077422007409392838436797712,8781462767081720534606018702554359272062136386754094559457527802951016005606,19167810216492792969016670752653089791475857662598893252819620255611011677188,12379801295054424513880366937656969081677178004556540562031393564676230427743,3873349522143254287251699452075145107916086554326675869006906246349942638560,1683302064923931554193379270562867202085645938091131834974486624990867609624,2777362700160137801933468204963311934247500177582714816722898763176642740860,5330041075666088752029210636784758218847391095319460299231210692948196701638,11849341704739004206642161112350419905150271791787570525216826204427280723792,7477184099861050355308565098520563835117942875101546634259876195229073147282,18811741129290507103385501216699521500514849038287903802256059864942452310117,15644162092778325718506673614750051639809307056147336506838023349115605106787,15072682042494620166496832302000289519302436589952610199010633012972669445593,7385535266916101728534366006042662339391797772494836337087929961280561819695,10606300178546340442574451452231017670874690381506662581848460294140286741651,343808333592012682122858022517390819973432303579818622412786360520154826142,6686378289544833739489172513893542192299224296746579469451376125664696638046,9325668720082019512834072623751272154060473105966456255302021143714657867878,13237356616132921941407245964289360960304194019926733744472216846697663447262,1723892942664599421365079138681309575413323508685958773158319650163306910931,6845174279248890961319599668687600484787455619619716546069389087383603254137,14429592766972645051919899517480716657546426049902884218808698177731678278944,2012555589304829161260427679955782678928810146332132910441113793264100264511,15162287124358358727307007568219331690174000191414576263088727973180750593247,6171544970310792508799412092397912280594923286679674322244394636145740843662,11560360683323732335070294251287274796083850957500974817278726137032659811346,7954890646285422519425515982220441977570181574595597355546782742910060927756,2121066076676892095526555416241546752515994960009188371572036715916593676611,1030002705665772802770205305890036009903459272665864721338890073927102958060,16664112528630425414995233349042921759383114978671010908728891678245502701008,16224205339340335222764551648549356562936176805367408466634736640263613613659,5567916191875465998022755280584031341089937668974064792042640432034217833475,10561503261915825576621563677167739482566911623771072553907339314680805249099,1281495108038254322634503929806042733441491866895195579580212370919762081047,9600700315845518751455006692480832601523246124684033595437676082879283709816,15989333248905201890715282122260615227836016238448185882687783867814184655170,3846245593630362971844915233982274952290718501967612724027782949411933001202,9981027954269438386336412342904724691774209648042702865994578173145958992921,8623595877941915162474742420309695649920307514068323484728910858137792561119,21103940025922636831675399050467233863786411927021772979799068688191712316972,18892924253208304354853962839524897599416779246859691035714354037906441368765,17137414752196927825772499610314584261795745874954692214656847237011815603711,20412422497099028107138997806006051244688526968840932637543351831550882135155,11225636734520002481404086272590673372060731353304957503311626880321065568136,18380442589598191047463232737740533198002604231823107797039491680652883496794,1080201698768913889646664841066956319958767123758689784419321296338840961295,14348402455238680465583355269916779409600823120873923092214453448424409970818,3841435364722615893087024818655055436552226081083242159440517874888324292581,3408210599862246992363134715624815235769905293647431849706383726509064300506,12828232946525727915578787875290899244261094596690184893334123105536745936334,5483797730688489537248191960281635992343565537360149542110268773175134131314,15646042484365011867018844828962923289034117590475224947755290094723626891273,2658047411395048849255440353544966399245817841159701280361972904541325691434,19496407504291857422030801612379213952698163884670351003527359060477191854359,11599969200544990318778456235768317543324325704256981991953010275435791017626,12534635949431553834868179572769836881352677117158862189611147293522496413113,14223314197724082301050736397492110631416043159307338723464864105007185825079,19822547161504065277026677714514212915462043072809743766437313193660041742198,18248624683501549165279508462273639851850239430868786828229911137041335077425,1772507929668430466250295341031184282507314702999122972093244182511342701791,12698826328883589821004991321815018437184890565199562478819948777685095680390,2107256591274868946942358544310209350935597133418111664653447540003390113607,8347096431391887603955816523197766644723983907921702200049607244690524226105,7546736802459880596530318577784618006564482951653292089248497980343037655783,7337317896163766810388205540011597034395961854295494001017429381228506327036,7657535373588628884973408484470050620893383237179421367090832333743641042323,13132621069544809006163499228792832380417930375502811639756010731409020775733,3045981446877420174701593721028589257508837379178848429319604486793747007869,1665034234802535695418712526119528879364535660712727125979361452433857586005,7153904853002570654968228858836861252211159237410458977141045356668538557384,20486065252261216388496191302294274939758504298167574880569796877079451248375,21146476302842253436461025615017889905755773199293419435978649511293941220143,4692883070549935264853696204165792104522817067387529940796053065681435988854,6240088307004733902463222083449545201088681283438656231355545734118814247048,11555561118019341206516697020813127391202363312629469259248586095720628837415,19260547999655668000047734411254185932378393753746099027853756019009568507886,20469506109273046972497148219051635976793704979896239651651205124084812945608,1236647274759658638933992315999684238758461477931896092313814863963831171033,11384423918232921171964979139440160725835135313593824548598134875347314405204,19785250372370249720518667471906851686135385809175031332352733767471970846466,4246521523867165828929729227115582186945308737715737226156399485201514735146,9952732737001449699912255226665360960719170484486452179287528363081995818191,16411145939754797754686024918808322973332629854064127851496226070432060579489,18478056933955827759744830164752062474839918604932227276753757763884050277828,13204687970556138498219183195522996570326298997850204255083662628089078309770,6486083806326529246393301553077241033740361238170679962888274443184188794118,9215573806816888307072467120643373006129084289252457249266574218300367297487,5157456141970297671458245970390083650482632128904852982724214364911239574334,17822680498490868828738779948851745357227318213932493146619109948725716270324,8322423511882718045936027421959946860221136505721064786938368517081088404769,1146280240837664421126981150154328736275224000612293306261498532925677882509,20006445160687044351950305884447426432577260116801089758873885688911862838124,13132217654381318972692935199671458140461723506405656953229384472487720023845,2321904844688587860096390475332685957247396755436885306389445060312694195758,17673723499361727802425795357032445257876321564734597671004472729727016538966,17836648739374245973743495166940645001620159031723548669336786509810303589036,19509523664323410269318198214695596019790796169778932865716910251136766472034,21365014298519541792222476772118358897898683224332026502540401938408420183049,2443777802329356458012563966932795162347891060116795715814546844741577072487,6373148417441446230918754690291753760232604931431996749195267137425734054207,17543938461501434657363693054851238526018672792888706636605942303973500302856,13900881200135928840365427722717255359580153642574547892815287601924416317614,9982616108044216660339683982954165936737826707471259937628917232293660834440,16457765153339087464480638859689501343872608914611554385236118860039346779707,6882633521418674793651640056518599843365736128725139938457347614662141371026,6558481420440543921623853603383694405865402572023705828527015346924767906364,21119564418700154632542186570611885700968350571284986971813890102274419338575,15668498634043584871060292933787839904928585875204605204028656239629550300891,17754567428791571673016885915321661773655444664247443414002133544771398853149,11486839919314218506003227795241691164988634920977758623356018460082101365168,7521215937712438604222096500164256001666624136838511497877267672752282058366,1168385489601974578347279341199760237159478798101796567718644776242789923601,13117296414138131801834212262010987517820472685866772554743932452738843734333,7749628482107487230728683638475509704638633069294493147970362304145477016517,17102526463093059579604328209955502975564943362848110499048688895825859834607,11877937469390065191819717631885427975032604373385026940117533544572408798485,9490483077873795676333795591814325768750891664453067983811838122306462917887,10191097995163502256819397252907242166733175440759424521233105453843778654820,20532048353899648065110204116821557712236052515292993984913500569982446829913,17354150523998248091397848718695616500251280749145663998809707730330346369346,7747355680464214426243190602078017576496231133574539162185621451748634683393,8756715326391069596985357282435500586860011252775122994945356255643854963530,21536474090524236379254986352553305027867958936847041677436373000730213533274,19764807787330426181831011653714787282097837960248105858049804952757136862708,16451394978386784206980716591328721244692005310628203853347165858510983157051,9958807580185090358651106618892828843813431270139145526116189671892797920190,8667474404638571999095228348352836564567923532278597424241711463350637692261,9754527193113710990714009078343561220541479581342251031659489697296746296505,11755501121260346797952875679164705763574741595098729931802001980529024314166,17343653273660706017905395390969914833245644319150049521732399082825162090569,1010378412861729818622385301577181571311206842734096023690850995284550560689,12422787992288066268619146495902983268274452848893191113634050431879037454803,13351916057777123695069150362950067630454763506856720439068955445038740053267,3268740447474291563746626019604727880178668296496938516526099943483641022899,17039539378002212101604857371251026489627400179253250833603358068705093844865,12719626976782614661983190476189661930540289684710840404911817755168256363569,7334691511591452788631693316255271478502517924558055271367172394856435073355,4177321927122082121158728850724807513004613701936483594734414988911849675880,8517156232219806038206488131493677748028421797072860831547349043281348142926,5916342138159497146131772146268734765710150180676587683832045824388433290036,21136252379072914855830890952695340864582847490462136128874077543348574696616,10470343058787342159878702644341062172468027793693540114390435145428370707552,9367903847960780027900264774906616911120367129803429048363499797310012009648,9181708529218875829085211480957344367690955470310754169594385873272587183681,5161879954208731149141751476094480416185338457043041781556700389106447006281,14144603730790033561496908848503636331176898859925995171200576238014458649562,17528475461722173509900495818763366567939364295306035018228011778228457876695,449678858200791083139507971543902712490268199763356935472396275788444419520,16677139862336739737616497869711537864422474730319606529800927093596292773684,5307258894824770781811695261046705160386034275400321369052582330095447609528,7066455454850758706236264136180958260707829859148436565416678574940588976717,17464972536694182038180604993012612781624892485542021128713500864406129068272,1827574381303563082711258077787177320452649985803311391711223171032580182910,5005224603218153811845694200896301756909926774436577539307979565859865998867,13761569869627153404623558442531816440237410187883129666707204029577726405280,7377645231791556592153877817212695036000405157132509030366572797100109551371,18929000938053222386693378771208400814166536156735504775432130183653620422676,10277912490419902146704238375228669373848088391763413912903062245600018539005,18100670309576234559559738539779745691447892297890679181953368845735547051936,19792596568315968292503371918803163404916721074550555295039247624601141857094,6568943725774928078767297883788056758405958920376813493652098209237338819058,9708751028820311560873537735196353024741491886920686045780276405320332052014,20999195425108372543557431885250084840784235258564621629580763574508120639473,4668167020556593094762451685509419403613005848434427529155545560914783238805,10260166712816802791730167674468655124354432849926388591536360669342400828562,3588854010476278115364011192514859807683141010842317346600561233941024545452,955642453625490778540666824328669289325333312941525596301926803494785606357,4102026113333601512449185655242077481750021570821512149654744152647996823622,12901729067332459436197297782018174449541114313233855185609986472102830633274,1432400515841095916662233518576616625504866912337953671606919993429647264779,13448330934580056368019676193029108114576729981976748604441994201646531786832,18698774355061680075847219006041299002465669495077065798256778682757699200357,6114255237222848342826972972054203376750041293553715842262723528673741797160,8290432657858704891136963220676191057527195528510584103201077577863568506432,10245893420315465808958329213978599152040050245022584266757834865645078424612,16235075160725310956334026818354575166666144493784149178325740173109469893465,6096223185593495310139379444667947750109489326578429517185410779366192202063,15140535409353326038030605492985074291044727716595244779768492745470176024609,2176086602170005476358821348469239586548222322021168089824748815230407069862,13619789468668594404222482251836770591464929359372018436289664558758704681508,8310543107961996371575168146304294641952910047046695374038288287522235989972,7738370036488385965043396010845927300705713772735513648600973583706126470834,4479339978160586717158719172802732929733916533373426058515465717943672025882,4249199078635815430904933856748414549211196022798648243994671515262509861644,4217767457132611540965149700331359170343442048612092095364557557503970133933,13153296757017742961007840475261159306564053749538202546045661292791402275573,4396888098805340064553349190742819413046668458070694926676742098287729413444,16734434548572604008363129496559919254718993826492605430831689587940707338899,9015659000250675923210953833943081286931414181352124970688626484896488861379,7859006238840384066905305454236928888746240833462349287375399918976884871408,20111156231978127386472936347996655414872475039138926155687856551161732442682,20628144438246471187747981572742727430082255446467380395647482352559593647287,10829450719086027299358038584474043478547531034689618353624096053194488185624,3900905003848877440680433966861518022290921312029158328541666844523704712962,17855611209216805679188603521771950395726550847102335142668673883933213178620,3545647030011914165273791133303433140616659042668342263053968795372726840341,12285059161807384662955183653994648298401051593713604819454219983692697182696,11819552939527124997493513022814576182004246358800352547817016502521627790011,14301577158059901977856927221571457807294693699285069296999743154546478489569,3571634356329355229397931369891424491520267531585441552581855575412868351910,4493956823795845864156868703591503758707793967931549819151350879135230170242,18261935892851512416084887686097384445742684392402688030129684935728742717201,11603603642132262206403092178979219208473125803069223229133184466185736048060,4847487817017177565347080569283215504545281846426948697937793918200171528656,4069745589764729706654816299792297539062872486670505242875943264008484198412,21282151145529600768369623290936085172906963145870658008436208961308948924585,10721916615176439690683002129869911178402752315827226965537395702918089626824,20400924989628432852029073867249809947097995745931036434033577251949709693425,13612038717302251316998414209460162307179960669236088330389280060785328588738,2142054298626034610320009155682451576863946725173133307732467701538715335347,6814074799679801916559787533428482395152765022569535278039545933747386331226,3320993272550636151137746220977818986579019792097013138902071906802378678391,14404588996507110096126959822135132305375204264088975725278990285893078946890,19449156048766944910033639666691724350749810714682158108539166281157709899569,21600390672948543610212878389553096169635598817477527886039588952230732642418,16122909565998431497578901034409662715618749437754826295511086000491610510803,3814026203802323919937341565517130280297397500968227915639071188757380515963,6912908852134560099979027891279882003635111070588372993239339154823206466274,8991012532130902495044589989450658026455069044478725949828656540931441650779,19794616058753707346170576299297623557371037336156984230370345545981446397931,2577593820399732466692625387687370505160505291664134162589397465829320209836,10545990182245838392125531729060296377668723705525703355179325185018108067002,12532592142366733026886391992589159605208721772700692225488484422366892623887,19135911891605926936423877585461852787990719411437518367185457251216578059981,11635603342092216271740512684448806260427922119693878652222869987036671146111,7718247137511759231158297248913810065531288952022630354624599924037308251451,15449533941190926955831618735652142785144234166497064450979389633622292725920,14793399192194938994493676084408874396657844744757917843286252680102153699293,9379880417179271734210305738187417887144762048262218697049423795232738616822,10001585874846875226646763599153358317197291234293545431914341192928883246454,17564611789675170872923370710570629576001514727841256489502945348076745512773,13526676577413987112607573245391605865887231830025935262602066777025060147701,18771091487566471187260929156402254761992313431761027006794035379840343952064,17672790933843778353408361605666344788858296349839035375070469185645819063077,10136925806345148466019786355963896194230642602748938687391144254701550469628,11669469369568255529354542182318275079656673415035219767446071893709388727608,8717156787967537877037123555054580463721012975068417092258849467938967272751,3574689732222366081898222156809576015147776290993716837975298246375762980084,2936447189567283726966987004410103389002644634186413346432130822474131530801,1699723231413680239740710996339133622208402062115605498128909025253321290927,20239438661176091033530372775196947702401783521122338633601531691101072063415,509222199143055079823531599510182326541217708021228426946045537726376153595,12460587031004227589188413497497959758507406039249371767737225675508588807598,9172361948368872306701383997811949982264909388810393902913358291336142380374,15024321518919789320143737927991052999071746110692384451602809887435324670247,19363337726355099236128975299462078599854604247644073095764375371642393487744,11352512845451687563998689687452223516295911399723160879302208800753615647616,5033097489048897691788022265636063060230313291173145751178865731392231547832,9342768693529219155995840295623046316860027403351256239528640640660995546250,11343407235843410518451234635552443892628096773317032816539735746541252484029,20271637634427257791277080766628733956630399511643807969496831759934416995624,12979118904307784600641734806775453265865076574307149193300157552133646759000,2609049561347471594361989318849223604030501563821990609941361801853208873325,16638136645184843973996251461253142824084602885453534706330402604048300209367,6290150467317840195062942193162131367777911299731759519747208884085640022080,21846903793348064415550139579740558481601211918214432128739680250084492380404,6881355315007836102200696266576401649721953812561017678365140505591991478449,11991852144633415808902015898168146769921125504309617193757255165202163636329,20579180498569037366675392921380645532641402855187025365767529341564826966764,4127941604046459390852849136716344563624191244387948802112999500161867081345,12726445769512078351769013120614118104254671239018619408743816227993876252991,12822824504588887927083519548290538468815267612767490908011540889502830894241,3525790082239104371118456157894419087904422095178764587616607951352330724979,5534817540911273750657456222142677256882873311813581893871590176089715612985,1615881228089658726040568147025008122728572958650432110106281742560315865517,1471725164982594409495579793735446246197281099521356897919523009694047660159,1375309198078109412495220212570536673190607625762682203229827372752214429058,19114911117517497826908513598723039822664580418797141695087511229965144677908,9628666313906709051161166309431160628627430386029173286325286404453712266410,21852518218578549606473925058864730694915463701150591631085298334480610743316,12775432117186202301959614842766511797651599815903402927721712100175714308106,139892473068642488659633517109052420816080027074176062905422560867217142259,8678567564479314009205848092936065091488089332028298130303782323700697895584,11749646464324896227459490085151303579078783519261033148424203540751860385879,20522934943803615109303532925965718163549240564060985032796290524829499285217,20661244899066232726889114470941159662948096319289349895724712936883638757146,1712076112157842791409364964341168524175271666408017461435914200921357859979,5274198338007371549113715286886410970476178374473353058525495747031417868052,6737897812641394021946938592351495323837784050553060267876717564065727066209,7802413308864463219891658906834234180067201307743855789866460725804890591074,10598878996622948168711729113266592565050867869138946404948068606726933771770,8999501853368885436259381006393167420075229434053961224100936590306072807402,10154159140828416502096070052350440839365634698281866510618130671547713671046,10116420503162714112005525549243891887026278400783073704446798028762825422117,5545266571933610687233921232979606259360579780771113897229483385986421780729,21233107093610116862049125654360754386798111684938073821049243264439651570366,5307392033140435516838295705521564813869712246929667484768640666687057034707,21375317482759736213193607973501605926935171024163842355374965533706641104549,2517892809920213533018018674089754443879541674948230773132283920676903837393,14360345633113115894388501084706102426582517876835778852281477705852716869669,17053269301717416242405268053150416723822210193991005718303172171427452536837,9906602428995106334942925928993621430906117671319208771657883136890126991982,10354603022009709342018106446249264303223237761462844795940043835225457441783,13398916116699661698644750814188836272580610770712272177556442659081018605804,3191149493139822128538617654520106298782669019011287540692938944153323592958,4691984423256762483396977170887219469164634656601998705889064679728271695271,17844101314007938193168524989091446035911779338131517299817551328197378135054,635635940269936042377013194809642013073936660346940411744079076043939544740,12630888356903717277892931534313436641457206712723665520324533786104375264085,14140466574121870700874387789856251566070511990708575066948924661369491559256,20370174501238434846223710470633284656345430614321812270231526837854520663574,654339196866659831266130941576738975707930915283825590200406138066808189370,5107706503321722709363385752813500904785775244074262870879244969961234309572,12198789333458214522406820255828653820578540569170284513887146039452722146485,16249136895399135618027043741098607972773831911496869243661084436243711109565,11074204104909151859533339603597929732173550047640253831218390211736882449440,17207343273400097590016935219508528858538698779767314862863101225959250875891,21262587236682681589242692923329018584317630804742733118429592061667487058638,2280753183511690306986430331340197673251265546818209861935234085004534230414,10254003274920664842497725816382563578440196723429688051808776569200020879745,7759959068226022198572347902743272598191759849179433231578496544131111538092,14214316923200364820492127575076874888948881174491573576707716667988807435892,9095544195644789922175839073929462149959586189940443682544660563790242551416,12649782796197868227327830841571149621604197483943737926454728454326532192518,16667983042241619901264223140344714132852698906756725392221839503187142280785,18383173644675687530390651274503384113459403614974472825953064896216388971884,14628141534803375030737634780152921077373561843078668533631869027351905379871,4561456211241649459019745200365185624320798675863426759321227045069329801664,12289778497980320566229781933786841623485008232338420865642173363101571189872,11975067175623680843959076988032062157059134808170430074549557650028254491562,13608090049838182253377471459358669610089588259298499702848843266957511619603,18788677463812827554544269966162484344784391485047475243938219549074331613206,4881667965195655156201239071358064948072146968570883219541497388280721871638,16809375763554448903183355905513828131657823301396908506126469252462160193891,11654980193951434743713680917141406309927211470940308818720103124789012440740,5948986090649283108120495678646398398833638108013243775975352725637369743753,13726437662355203524944601292802877111764435687388166013301616156301223567122,17457684154769676997584569814978347304006793119360850469355899127743508915640,12768218426713967613672155360932690915682228245638743313771591055379281067565,18615157783057763780308448635283319685644271696762198401466573335150909781420,17036103965935103170115214353570299052411478859579659720326549902160146217969,7150547909167136034355368387927463942994048322819447869013206336674786486676,2719491185384365067577935615529406253538979948934035375021293885648964670289,855254098406697810192507782360318218871612459371212156821698546331701832542,17895542168549626634871327801987932137768300191314912757298899767762396172426,1291731410872228901975204398582554998148747251553901848273154130903421546804,11405841699040163552814729751623598889450140001218648787184675782417123019196,20354628821067577915648505449000078769730992376974982139779446148223962828730,10728669080369994464716817080074001337835696213713101955141340296929303809038,12274798389677182426524706446934567986140214102647161938159083665963012760572,9739537323825422719175243872981907235223292084323462340852187679763167385510,6755543715589769777862111458854566169790920787355600259792850662088606657716,12126305553295538434422174339664597983843351746744739132557070380077267264590,21398878068159838390422213444802849205194012142590812651530393856342428295355,2774987220129009778448086748836270418387857350731020745311729965596748575420,12913355749231079157637607439722332211156795881932799993926379679617800720875,14002442102691266344434178456827064608589741346471232083579257521903268988567,3222000382376546717389770889292702303294866053055569943089969635516575396692,3351662579522271904655802780809448930926900026265684873057471441126697202347,8791346592452796050710862947776730913908702488104309880248248201823569029744,9103312554290751080966931020955359921020213554904162168782078094097630022273,11400762474859869669799163954742952133400547669811496311736883651700759825519,21705862854411927719091657128107442151318579935925212397760983799549487960024,43293469326476059594440269130071583321324378720711508957751360314337673988,15189563636069530033236842376689049504908622054060814965474910283072587672143,8828581874201341688220445093730125081012615712886123840297097551587278948881,4848334665131642773713411076824550175891079883511516252808850475348208758729,12614662329834759430739626588497950629642362637723265950380896878486239042155,14266355110863104530316810105072189601641436180167942829728212140901379263956,17294822327168915058983104150822364346325840621309612804535067234675456850670,455077676048323303580854786776522812365753723694705688462762996845811407009,1883008531326217838820507370543781882290544271112198177704053499351851681273,4529982458238957976485223202768823175919650810452913863593242825418350872543,2955110035783314707155321084983433537364088072013879095266124577362993635626,12967684942790110900749491528799008728014372120122130310632754743394775825471,2505175694719163834796124853767853797404065196427012487113935936321224863546,3664644243909527501109080877083112285282350623935581596506736195569817810680,13149615309511991949247749473495035486060198385636687198656459619774102038819,11675634552285986901460163850174089221624080337542386824203554725353862698973,13792241875469760333807839408609766753472484847219134966123237707758891089388,10227619387285566606296112062328719372414665296090743089679008143127205545123,12205580044090621048077686897527020579927082420674484835775119696613313405371,15208177648579495968812696435767989756568450150931633443711377393141060828911,6203604398339912597796330237774861234098507297133105016255969208311447220376,8763991852009928642943035844463232737815423121200913107779495834216057423172,94997075732443240393502290740081268967228130793200255689370554790238240979,5269706528648934838705302424114829386876854870088873864481541735257304941866,16262872163060208420029150392453401749302720607531142669546071916932112668551,8143677473154806611855981628530143157024134934286519271401846470427527147543,11345763412284980808950171535310000445785575947246043879446971501610507015402,11334003190684962190461352102674801284421167648666972792173808801060633658405,16679481501466111466382494296272414977838924060754574747550155015005991797168,8717276046214261706367755700328685033217888501922395351508483646143935055357,7961818553714372394804939036958306706260485011393197807672306728909086465660,11525513262393719593247460022637862437588876074380005892794471847411833011017,606475753731577839300896422047168640216288859417610094202862133247546805011,16216814510391154599441870283663624434960433363418315765904453229709017881340,15952802892860522124812654660125132147349553268606042022775941410073735145502,21186206422036180717988803903908106965745591204944021637150186904241796046981,6944713991333056327587649834988524981544213700413795245346955488518554424877,10185921515443194095530439914620341794217076478391514698779175769548747359464,2855919726997577698604215361496800379220625688194012864111223639042676660976,10433229026112136773123800168383892031427061365180473556460194903407247351339,19427072191035469870347195569940358526740232693667547123354147821192789102650,15644214414239800285411872105206002044880495869535621299007907341206661859610,17127893436675976263942308327239908450163069123121279064123261885014993455970,14398850115453023364458586202624524741971410970483408578015632196929131043640,2352925542671141920909613532344506652984644250240272091365991738093178607788,10172679680316429884824619312723045840067903978738893283037233244389430249509,5772194565812391639885669321239603226420464592665765672957012371288977540856,1472565977275775489403659554782408548523807638115405629626295474159727078930,13025952383827165156872004962772766979272981810832459552230024272976389350529,17564758020035152957739819749712385631015761969283204715352893305611222727560,16405514590762165467156068648660873304776064039873164250553927264160414855875,3690038285204558326066250230248548873947936562327070117434442040765096220855,17531140782998595396669833094850381400841695523035934903128529012616296113949,13168227885444297954910232183764567700890648537512256626187184942939569199780,18839532764289221356950914594613087164434882227921649252297932780104554074257,15690093187279544523035828189537219904387587938956853550130942856247262425989,4880718242480815050016604653617276367751146942554754727539176934739417585000,5767740184065294852679113060036925102298292735253600173647375101014669432601,15274885987576180935369267696345371924274924872703997373047266442038483500100,3761934589481780435501384301483991135823312027596840500386086136996196777919,17076314579416028845718050745024649043011795764818118471181221546277962595385,15977291426665432194805519962451891500931039499992781917651419845757747435870,16614058019242709692964725060926415535596693985378737640811775269245183858531,1462290731020299561638622134991867491216642860791478796650694102212515942203,15285513431606451603488599544624561225569394909979737124945690710031449859251,2108108609418057784389651014871434275919186190456064517027979476451544519949,20785453923508177251995968212118965193411372702846000862603422090322205734041,10673883530097564269607463521683039178512337022363698173454334902283390457863,5454676180617583613153450533396644120109614173104204009158828769649771925347,2308424025465899393970422846699273218513861797562089060060302466408498727592,7521209677407171946300925747807233725946342430543358547121236461545495788103,20573024021944297233730031260403312250074182051596062256738574515403295322803,9021049816696497696749267473705619787233696328020950183323376943545740004437,1865524799085825018345305851095200435959748376626055576269783687778950437080,4246459257342056987998012962024687622955192847494871592608632692951161262129,19427245695591302750338395658196139112041609989862338102918570832807123117503,21526088318229932910068935959652342185575362039375447361171773752278498069664,16191911454644420751852228901282854304136684923356871310294001321086062307024,19158667047991453406718020435447139785846629820299132383267410641682384370576,17700355947456307421977232728703295781949761612179494776757369350093380226828,4397993077875324081650432554749300545148338322818494126385494799541152486594,7333345984549245920976934899658584162392463672999208699449239323807521633803,16152786000399924760932165522677937364378936868710087711558780050692283598645,11094138063712503930108269043784479707229515809275605844595768164840752472377,1142389644011176261530925136868504263430131536560167284105696375014595703389,7947253178759456244011070491140902256859556283134055577001208685178146652802,10134714213573683528928794197545260748403530346308318902760067810116839777206,10883490621674448000789965625707254871804535943755669299023415555830424281655,3066669045698349285650257964282463204141692000014900401186330770537030238642,20081606580658665084706560391544166403289461596409550084066896490552960642479,6155695406737593769799569079058291297835886186017961489006277167996716002247,8515542419918302650566740947332213674125125387478669670818010011334680546574,20110138544602147391149732696810223660265845787019234225223667638537351747051,10742562600839811890186721654855708402836531506887842079602293928208078373859,1525909842404376057305890458989201366856740974115647536551418424527131666169,9234236770964972467234889051483942687447344616202849085905582739078803045160,2606008597707158849245186414604531348516676367660138989733829835914698874012,11796760152309688912186437926169763667717914107947289133346750725444306914631,3851377590989618761627509080069107348568977801140383151662774695134986557597,3154796336225549288800236024241376487736097402096695364582935878596928093781,5510420220665221034838403251084456079592641926247054056939582862556776533398,16879696361470925506825934570612427394067380616879319126544582610342257894977,17284649816450637986813517327310560148892948427878914253815654865007623581799,2833030338755501226260678429168722114253235114087325082893557705288230185302,7251727070132476220556183457711849452579027647540936257172964240637390843337,9575600794079237337218029036087316899348403790684983148717343996829930177678,5979306342004680208572077566967420789575741134560343288662733429960668391430,6933647198431187357226909706624729057428619440859131169201765838043283476077,19168763196217781731628598897969332495895458624888700544934409934147951462602,19829437720109810470479999873902618673477593710269745617035524777507262876935,10801527657674630131387061424571233632050383122132208702068470808513632048030,3324631869609728132956796851449123815871495758162118183753705724979320742705,15660020223439851550062020388305149722004313049334322631321250103301499692604,5967221174170233933880215190156392465136752773253659731223749128915793467895,11552412840249358443126681313794466948899653896063684296070673264241626555196,18888906666917921069717332466525186303442592625253328171173131193932302764004,9002714106167484391528827546180572105064179104525774089102236612700713696717,11048302793662652213631623254022096575352405761944396370134943300004028917865,16407259962762436968310192538354523615684343650696199890141991953040162326636,2164382359471710099213275616027528225843146809226250465653585796261822737346,10534211142437421383941598776341383955315039281979396571221999789915575101599,10666069653734320813631520107249402109728041265475244772290972049841823847727,1065893272480854115563003062650162503958098706206084024581187831004515125777,7996693710845330472615496754914137367924796497947601638820266498225398515015,779460584637732468426955849206233546264346430125102128427414524469939157403,18123487244613769854380966736011971128129435530397043581264858565849669710522,16483639590865705054952634993109499660754781472434181022666579985294889582777,15847717171578788545161470441065692492419364914649476971042627117577578420712,20212509548766945890162316166677458350544092615956421310024681889193656903241,11915838540527285091679839305488591026042934314354878896592571753630253407873,1911170159637126384084881836969666801716554202345435461162520643252230842951,2519681707616189243873692429706701363981726227724944939887394039132311807155,10525548620009931418869190498282964825273460634626042574365806552478535675090,1007287689974936217568163398662729361983046876939574893360458678319961439943,8918601076290071318953673276836220960249911431394510238963515695083601259416,1730552670090087588255812224149698933189694835321291448382024953001539943933,2692212389857059051251821082045515561682372012597270034725442717100828072430,5182752960118030069130081328243349382982053565156074602369672154634481788415,4186223293158399083027342405464955373429347225209836842209182753945871255191,20698226478040525601636369286446332773903307913544069889209490555501069209140,7848961029873906562639009619165977234892385836769337804546327846501965814365,13921935366749820642106107225856381492084238464963488385755265898574906919842,16615913254044390064369275838835406299949293202833109553557777908673881552518,17884323890135880903838623664692905800576770771455839982202688346472867240539,7671240599961467753478651569648667266853727017714987691902517051845809028276,20540170969725852651721054123169504183251616229771312133024479630289328600435,10885911618876068300178014171685162848957603467763239389113505729594133953822,1821956738503711086168534921235313501143676686594517809385967874500584768914,13900019517803309945097308036151373598859036005433194049333364013307418921490,5611521340578197244418404931199594069340846248086844299279812110836336410894,3871676825880602831129014665958446397148564007925285835033897270539554583982,8660883522091722908446182204212531338997991855689061026827047565345925404852,21369377758054514487929500216341215576252815582773920801000959327560535036910,2412441365534353741053138780929948381707801794421791967644299920632399699760,3962365750665624098182798369136001622041855947680873409890054621414139629589,15001230629104674518532645948322038846835064889071294141298776340346988584355,14880674002301694876681052915629907300219131310128131182663986425102259721980,1824158054562585980316309768551123828629842232225429989383412402628330419987,2859240361399565691265380107352020662064288346296545444794991049234114013603,5166447910779952920543762328108096228333459621541947567522578212254733957716,1007490453560275100906582245944853446313521002614529198832736321283620962455,12357031909288499920427512282658173574064133416008366625033457013843709684703,4908601693798278768903637729333835430381717019653632816739154645536641464365,3707521788266753982537350852704241176639571081938875735935799519005785641932,843648473424733414090549470297108007717585086811320449394192229155836735429,15745469357122732280411707850429686485179261034785562466267026969795211925342,10805521614324416411410037641243182724170403739698507241460822321812492198235,12065996971764501469604703952781437881524721789450462435182323617647626062291,18470487586372818033539023969236693307855263683332928699228943202064060965843,9678881733477238994400069917737562227773718359505757479334487914298656155782,14188770590313091787681039051598250350716760439974403531322107017294575035366,1689506610383677575502055715917181866056070036146379850885318902788859831848,7506643906911078844726412866492372822643011138706243954480387034094577464841,8878900588521598109866546176968107824348718386295453778616479348498221694856,6870283245627392817090238076492510507322368840526195161203457308149059064709,13770891113056770539767147807436112954402870897635701688432832537357791153049,8780360192411651104527843471573635887257900701816701590232913021169255451999,16171874311798197525909736376097249943669070404511356154621097034937309906406,5735048971584791925371366175024708991668126697294479025115320761565490442773,13229825087263355390945471875664433936256658682181329545626347347763439801377,7075776235062840728475772028477434335481293337646194082436681309306082067951,3621624535897102185304108550400513064448572525424419762329290603569136345699,8909048763816678806291702062491546272181098732106818908949274412295033032278,5679617488269393681126385387791795896201443046828191787132461584904242222704,10105279386430545635207898937992374339634464824905552041741267814807859103503,1875089455725008938828188584567435691926878726057441578850433616115151436992,7477746898926143788312536189451854889707733370802231032871868774692083118085,16386910598448767875426039948412876247096832715449382492730559004257126956048,6033432876275593677037331179852069653085950234927263672572175689211500790655,791047936106933006999775822964245334290371384592876255418502363688874468612,3694863804142244539430013086697918876101028434198177049748051320963196192691,13376682105243214738309576815193178135837123827716063891638620885853287922296,13805679067029770984721773402288418271927678860935425166689344094492548637057,17136756160106085935819446871311843510549583818138636089816199715569134828084,8109923439508142364330425377154151984256104223553589804214354752109994937475,11286249512402084538299269911568404171399278286810916548813396237061620605376,2584359677745194465235893977254941998996461095474372764450843406506578038395,416048929518775256195106483480946138344969950953407172345234478269849793039,13382468529403508085121262401866099849753365548098731797553497976873204205709,18439376867491626480684697800985907843592103465829293677253579863338320195923,17849262151524731521717998935547978553691621192854239431428238124396600612632,14944765584636478787586231666077419063063746476683640145827104348311750508175,5770158920816863002535760768793204546036568907423666489027939717423021627834,8964766646616906071571735802649575322546984330618572612076303377141821583837,12741361066585979303854420163873489016934487106922559130204774618881492938249,17155650977068989655844853330647332708031817408933941319367040661444377002549,15853135222927269109853709968587618568449580274775781838704992776508260190624,18643405831130205120436044797258461126994691116505008303058249039104682298143,18381699905134802759607923737176411134148483921733890751508148644565049938661,20771413818150322305462626795715653983446198751749952090107489229813229842550,6565230743597462418756949526565014729968376635326046194605417268756666319845,7773589221172310936780704579925742277511016906417542067089964629576305572209,14322739515259154048217383149571029180760938501429981700631245079741667837826,2211777926093208827662641428669122029599076421656786665814449320380720581777,11959359909854207341226535525210590494408522984553921513181278512110987087969,15631964544474412103208297614910610111786652867610037534463100143218625118186,6469947677147265061709088012775208497425320831040679910475868641704170242154,14273192286218513903657400373354426033843730885130815917604222619132646117025,1642305946822726119533692746690241550779067996073465721872854402290979482744,12434472654594642340204970901697561562492434882039006954954548364905225683590,18258333676501263903599077497799178704676070138517903780843551776313851126197,3154393734777301102615783657097778679162307608952237328943250741895135803910,21442924273325571860480847088112128477994226721014369494483203254968684948447,12633492209679682779165226815843032818326050497846354378961630197925565487104,5676035885913185017175294353150288993325590895201150557890586619719458353554,7971989338965840486933559372839713095797443968865735128939127037392334228821,21734085994605079916025200907658739534755548178328895704833631044593482792710,2240615781815075893018901266381250882106533308854256044823388761533658366337,19418757086351270137870941178188715468785231202435740939860626745964359442005,17658978545567285097910442499706845586224912649469751675828983048696346031860,5266889563561183172939683250833485521316204021724495164611029326138684723583,11128996685041402949333841527417312168812141699419947558499636572258705639448,4876070090528783965375514438749842173086453529590096369168455769565070437109,21181864929467364713132566956143162901336986129207766576689052262132856884478,6923705508410326350945166370499325965219890886201185955752583121521122421736,21369826512764035509040463750392604795868027299873193291279213169276615858803,4704097774288345414783119239472343512761071550401447208590340029300816575296,19335571041256357691347835994830129551703141581491004773597606130380555930148,13594634273515260829141229000646270213542265375428591690952060475706589483636,9015254066149037983117828022107604427546915195306105494160093361353622246415,4212072016320343773172520900223699632828574585381041109390033407447488634385,1102272748190005338904701274717935307889530536456982005034282115032583335111,2736300324710728232038909644774832551915915663932530690557461126955645530086,4835822801818378290852301048163831283974282641105089345434084063764482095069,8984658187927452678459930452346646248663512083082894198317485712426204609811,16633394668571656740012069555016467267297836103775110968049070854163114237249,19001311544890254637467757524866604779430904938238046630395635640108752440416,1519708912837962563938791348422981399413816048437970967955664087668434079252,21331841844372791543710397499630585987940452814579176990050363535517182938392,8907423080053260966677751803467685389883909962381980865910698188903614425511,20461083176034684313938738010980183835826228331514122093950995340802162488751,5841016603634386755712428070725428370463826644379529834480138063613116133165,6169966163271811065481708286709332934104602048421028222790926506913444959185,11123503881380576416779399092503011764979780788355198614717104650873109848686,5910862578643213547409014086432565110080048906429291885019036113399453987536,15326247930625028665035962093121096584742207235393215425729927190450227004180,11869108106148533163877422279522558694860624980410176225979111384418155447592,11642189959177792725300751489041811935498998846917246538427709581655066866054,17383982459896791073091103411713034950019457760840905433100761135071197717377,12914884881288305014413720371780941499071473169305332026567402160980899728234,1208570539962036907751277903184876797538221568150857585830629441131315144451,2323312703274674937703540014228631818729280611690694743543061204714949346767,17526158529185414889134597474769916490357130956125485429641429836800727655323,16037781653504828212828867735133494813590828457250361954137565662868257318996,5407222038113928707955890035984954296613370389143420455278606330416003035740,6601323218218927237946555844476405370566012808107313139506360075146521702852,21534867504549849931394770956914633425223988570769925897030241609788158519056,11391084204734238133980784274225569005339670690396227409155789097373857915450,19888681657658973285687297761078939800531741094128408699392512189997402853670,5332577406232753436405602237019361733171667669604896195130680826397119398314,9059600173937645065621009092166260440988612068018047518892978276246308722168,5301647598491778367767843695092267888185214608095464352349739315757388259345,15071875841892141860455823800612444188659593796102096590428526661356131692597,435778089283152858387915635050172265804266241934673566488879021420875384052,7253178577349028822394834490127746885621571949621301778647260365262978601526,1165301643600280009322317413038719889346104283514223548696059636052018656756,19642265897347119192967952847445594557926149874981543320111550169192389374838,18546070171142820328487316603855788669722411491547154393382552167546945234264,7547722208697813989490512139624144757215998986985181672151192221427497361833,21765466939205480830726051696775103538365853268148356693813986094780619132689,18066916718526031105430041386116904278122614509807635157495047212689329422097,5567247965934318360602471432895130358745239227464728512128895794990091560111,5268155242325913085615961568740884974081158441192412337454790453319219641639,15275184776514682919662155241139211655693258637032715569152004434925162363584,2179932316974455074499483491372661376888522799119184614149917286749483028849,4621405833740121725678441855520519041228014222881228746009997774516764304847,18479339496682302897017710580780845640172065272400836860950352488372424120096,18557033214894447033261016367420154444088029564584596463030003672186270737859,17200647521217215683722635843299601233863161230648748208816378327209201596867,2688200399163263049122461117289599907708945179806531635658550456745433215543,17415923022624960613510570384321832458760537169605919976471719634183381965151,8535568676654346647569376193583594529721160524940659464514765031328360321359,2988350233499987577118772810582267364198360724494195915351933486792072227259,6210620559937378902878629998722853418159056595764204463986805098114518009318,18310997638100731876764014221687199913435941820864752235028122857262977059320,13808863093029019329144013239638801163784179422135484562563156294580677444841,12914098780625672320372746314998075565042263956380764233047047668841824625393,3305953095296069725576430940963322680842934544212876613078125492458854044556,17822002370183286453254419050088898676184956527990121400547957986510775899261,14649614548507754711891632411080554775651572143141206447218484052001553765684,8109105787614676314388565737575005920261787167569229710081822989465469152070,10883787415840547710621559198296269932318487849486120162467244238276174398529,19330421887539219495728995383446553835046303504116353064676615752269857951508,10124601385542856860656799235536724683363368315551234368605365576161456958605,12586681054057195636996904714881904902720157016325364273875514276164279959735,3757165144866249284026269096089043031459271594379869902321741804365836799544,462405354647627586345675602760959074379157140949064478801734872040710235207,1920260561025181767428737283255569518557618670101985233779064285550376374001,16427781514757709627041602025461703818581117100125480080881962557048804215419,11285710669637766333985664845741699850953316015510407645702772350620723934913,12651159368793078896654108663982020308442449053255003548814357252262150375808,5416603170144910655254279621683623582654125103494176617805338836184837812634,11735378404903665808621855768545179642393017572035737886573368447383433091210,12201557541429330882554855185927797569372240536806738921957792139394552229540,12315234857861194987612137097457466405047598720463755079786381945885951345726], + [5029285279710800539227619495938136407778783814400587102957398897867261120664,21661833903534656620291231766157513264428291380933208423519374035927473262119,21013170147855726227668315492699186959893088673047129690411646575996043835024,15893628062504267735591398483514002406192781085288489283447316241330749546879,9860639032243003377544947110034203265885715041305770375052648470285182020229,10431760628292478929366440566994655480900443273305000842144090945543100651218,4662341343242273661833461144031815716144681076466659112993661636426666579986,6674279191498784183427663914511569570797862586816649467168170855788360268943,16895097041920841073767278653214275321407577186751547609698446652984399225877,8168606076413192332279322347673356872630772122089948509553934257426773045038,12091567755121016869657080116466607855522522017768906776539212195551888602502,4684576201081771194613696765517034834984066296253124029929753160055156611363,16693488266039456124835102259365515976900969074532557489095946797080826193662,7638443036775258881709317582832080783911189229963788890221615286494482929025,10111436214822932149781668218956845833675824936886829015449750181332010388640,896682691957564465177669890535917423987915406885797833670239687119295318467,12612639059115228106858238115822505521432423470330120640591982767272085175034,1851711744209473345586117150836616408053748535684022739058625441026889320297,14132260688735080257390420980422269734275443926576061985351678038992087770902,487493866037948515547037886552479973316400139387425953088274857424154262588,7712516772901240105339429973116360243232161870164307482409826131312962380842,20295556720945067049585659016570679551265845058805648954004989969704769135170,378208946912325140295069471345064814132951473534378635003955801655986417900,15111601008893945567629460471315838423301021468457758533702272669431620017222,1503682435556321218669089857094247703956565058167121192612334331910088441071,13084874799693933186811120569396911285611047490876409383659779579088985591229,17464483161247836988344436558341194021876261750085348252730901647076441211862,6628743087463083391707355927377412170189936607932592258517748766250528223430,15153763588458144568353947674975114179172744555450771328418442212716084083525,11217853102739260248713425002157925483291370125178251466195670948291389406199,11275485266433075885440484136400353724892671196084163231314370685019444807048,20167106354875398113371399754994549089359568833089630824992752829251678891797,14151330869211746069130604993916224881047448810615413435448712767752320095045,17260356243574396880210370581740651566334589568095587416844511054569255137183,12436078462666286197074526218535647721230687376129721353230123441759960021666,12001627458343654011606323250787666795709808266974343548842843520227918922255,15944850302839498288636342399223012131590208876255723227505947857641523034493,8444103924869263585176528654612076203716402818569041992813095331662367021655,13015682914180762871967848617514355587762125694235380084430680565032083402270,16200183380426364054409550129683752323493215428097334915015688753327665325485,13717643109958965551675619584464549580820722892266661529182798599670194908199,19801725181447377274232761944437523251067599053402428862557912155522673980500,8260354277364856843022982286494019620277496829494935775254726797533957063267,124621144162335766862972192337737579448571172779117809776129849377329817478,16488884047551411705397223604196364132975353217876182634038895586664127388979,17336432076451490238716890901095007360946878388179175784603587179384718443321,1210338460555723584699132156502555539583432069430631008706741082485009017102,5933432012048351362807861976737945204535374770355507745694008880123055490802,5127952499969178010015035020598142881788437616516517827214405489972695632240,21100924218139544842807404598627913291698574448527131003096325470925085906016,7683521602764604419863026286445694988900727173175219514555132623764360793654,20928394065137007852706990901925870323120588543710137320004640014111073449000,21375535333469484792161302750563386607223088895810564711097025913956371171769,8663517227154706072248636076587789834246541965140682871530851124960776424787,9182938389356039217318590654716613493414550996824701664670650439783557720226,8327338979442122743919832154397496089418582414082199116629974300650113777515,2474727241701323049333019668054716886184808783449917153147248751503852312804,8543922237501430855864877057711792269479294116675004771113148647309219620030,7863611214303285947093025404346084345102544167615769255495752297507346719791,1448902069752048144992778676670381235906144579949631101518897035253311063307,19501657783346989621892787238946890715709847672294934508902622542828235185048,17076525025777667838921778388186176564387475624769926249793144074465528465933,2381176586418291387279201678056498732033435079507661703992537801751492053086,20723508866659831749949206314442193102431573526415976696387848305764994281574,17461795780729443663350296040956479984433953861306521086706732257263430387445,14849025218838139413138931958408289986915143240245452275066866730847749323920,21207204042106390965753782189145584243052148578812105334769740484186308017901,3105302592226642624386332562899903659948819667537402316192380465808886843623,8765266846991616382097124552983206033439769882065573909634090515268812396114,9950016446092650730639179912416912603745831292536616469358668786853463197224,11739731747351277092817771330729393674312591071236310446088293450266807414263,5424991773995591044103668717299468589013142114099340604018933512575789323446,14582885509715812510585748465607279869582209618804039923778041514988867577359,12468934763690970929325823037406509081405444759649987929912706732364016057892,2792793293657306144108993077959195845478902430027171873963281969527327256602,8841327809851437433386666692145437950603022633472031964220924157605803799391,7845859360796082275932181771457755704129556353505380746504571839006944723429,10731793207832149137187382442869034250153492853628224932026933458041993639295,5597792614864287090861003890414825257635680048696075527563498604714157576447,2638669099010916296300870639816763122907432841565512299246441500223692345671,7150832464835357604208338666096132398994318721877322228060899549998179405057,5470477812928960639347760417261508685840724903499112719517942324191018679706,1063854480993555660259858748055514950231824974684462401269695511649059715242,14508243449586598349750829047481358081191713699373322296041764577478835760927,14872220983064543437506211589956319796231014912750035729896461676577407407598,9523202653584689553554068772241228948237208444616905879849472383190180438058,10557133197819890801524243760013157188954914093770589635201319240903423455316,4973822148190287060777561091733583032026446820262414806412485028147721872972,12017319043066808147670914562193696608548297038020764496633388575589573229927,20958507279974171556413354796214800332148109902768069171659933168603089927180,16142225389165963605704721785850680620029805525816101628767304750729950332962,21691255103889531967215183091383836488808797368461467004501598817850515277674,13360009791215314413428942977255018953699328534302248245107197249816193370823,5270206696221786165451075835596925139630328202641350960582852969440862939023,2626561181956261201864606929566987806068271006198808163435823619705436605447,5520368836328496672510351296660387187466158872913871354651108826881774455909,21597143280250120305740582323272730661347349587666707484376745221123282421748,5891209530846741397700015863630938364586207627850850447237189083999656313978,1202436381171550812585103405636986166232789491390007497511342220946215395818,9920320882147650877649039705433660083926352954797066179512349368247190410310] + ) +} +// noir-fmt:ignore +pub fn x5_11_config() -> PoseidonConfig<814, 121> { + config( + 11, + 8, + 66, + alpha(), + [3312280834382673867321630616941760639861515464094877629805120494360011490649,2977163727414618213643725802224710174200189681501907689708278449275625624600,17077799405481633745546679084486353025600250694578521370656758513725453934742,16210306379465933080277173890273457210762404430253284947889895341785601089390,12306944281360832043572721821716739944034354411349456264300159795863030116042,18510116198433364516004461541873904955505055486081639325191415467980353992665,20171004681243290383397478639749648403640483231061520437292129889020927831789,14216817867363924461443287436236130110420963767734530602158091056747850914504,1744244489393376249430799522637230427855625055124494576876957852023791759325,7129585843913921821110812028399979173266826966429993304814409727296136874103,13988404968409685403326663187671698975733642730286219911002602918437679901860,16920638563061193407835052036305459051417920006020130846290964059193276218943,13427470979587753937642822251845898994765547507421045262408080469011197338416,4951343674183369875263494313821909834781608226183187917185914650592996842297,8735432128376864913532575297691608527208524295369583136876379560735670033436,11506191123509320764309490571835590914265043835723578099434891464809664894670,11860937155601787389575216601739962955686948385964703064981923542694893487713,10828014814384016644406621862814561467981545748254521286078083584574739936124,4776443388323724363690349417451836132533385226194261923508005690866227183177,16639991477904781874568583121789695884424899367435699700192357030587346907362,63646460855616590932366082663720069120195784636826940928051354727568777173,13872046592464170980392921000435473279488582870563366687909512908597101541579,2903974073963148433036990643522953333905364588702098342158750794553468542208,13972003294927197976860685316247379324920372226280483226377669417062686947906,13868504415208879955736997036981136359599594082926486546672963310629609974499,8628454286960990606041697926325623221475249983044062173729208432417417750989,11883151436851199698252725037318235080760967011947670552161788839027156740653,12343286145222861673187914724623142745362406729785896500578210646320713733295,13240444180513188371213070455300718988708567038226911680564203350475184135088,17225520781620743741263824011599257737446498734177523099795883619924078366351,19655364901125310778629982245392767297984820167114789563931170716695750865678,10695212283696096281132213692300627346215324066996398339089365835910730561368,17455827037964560948521638828961298975187156274841334841074216120311558804710,4382628454630801450077593442523632674983545561122254229775876033334437860489,2989679808908579687765205532943224072820070594304724633625888454150084631070,11805110513334566809098991762079653200819786354513225301120697798603509678793,11155601993809199490094826448585668454159517005968097566996288487138255635079,20815808565222781796761554019974947099963702926722486604443826341123930622896,13761986205307878615460321377264044874010177269812603883540272922422883198979,4128370443753246025606114169149035926146394950057754901868026654335917771101,9124459754124711043815747649012164723935008821275709951889811488049411892152,9090302853448501945809598864330384875455576758214379286451409039855851539841,2611158043123761410817152601927516372222739024190920897371539155273224585905,7810155525349201315441227323507184944737106980192978514457375337581213081055,15249792920950763850993517571920601821568311809174912509031437118050063777525,9921562618684201533699293485620188871082795988970107962425978745591461148033,5414565587238798987874533039507833069864773781235217517734130524969939419113,11085088558016600803149927568829483866020077054827488081829062938808919799801,14625818170426402577283649455001357862456467374537021301451880577607106726350,11633423263664104506250995123678976351167359685182986641330218055115412525059,850899676511673590463501492472742017261347013078251845952824541653369171366,1151196396804070641219917031443763313740170846357000808196046482153806050391,14335865562369989392722415692597018596062508514718062574213639729550753584518,16165235837546690396792041022833296046736592940683337326949013823518030323769,6408098377682813619850142098164780329355428625834955152400958576961120931380,21423078154100258346688828020904418548554497199114189102725137286930868022538,21410217312460027364452766052404349950133415202888862471159726884511205456308,11096458349387432633781125315606380225216758142658673665437375204143306261827,8325016245207932555950059013310928498109578689420634828690059159861280125058,19120379171572846193451984132488836287003157955913585086569467602620121544962,15548527549295346334479152412121638073047322389003226521019746206475690857238,18510388922178653264949279980605433471616208226685385338922150015851847524587,10348792093961922144290405029634579505420677504732581441616360506905620826544,15620530873228503134208333316448182712901874887467615537478242394290577386453,20675095206674416295505702734315255961699360732886837937979451051773488542601,21623072135556656816074223163769126264910877148099315666172910436076676028248,20081866552983231525843337497912436927329172443916196026679813450860013966767,18951602909834406133815764463249536936478826139929746486734639774975812472830,2378298801465585253495854322066504889300467395616155363977621341822205588163,7488881447347091058309495011922138185162376888083687541108039236558708660027,7225960736862847948475548065508931552528126330579521291190635548005260333390,2970482373109443685421063487292183827150496377598629996362474558885993864176,21734396161383902760672518999845141937065773419899625136190973118533490737305,18986003927424880427453510819113519633513383085919786483726156674699889468820,9438591792749742425198760386567115998731905494024392289196006582112950891516,1973470346155075248881651300830631935042830364217214073906277058522882105581,13791817954605171888781711015587425735543149752618332811612012047724803625120,19907506629242812934309078271817109951335091294976452370249234742626462372763,7913144809845970358468253448033359382532594356254540499933138806226450398795,18786719915196826164016145948631708915544945593653634575689240810328854731069,6216910690440344513687669938632060553287695043116654216600911463719413604341,13963849909448408572632889978998938642084255012365277702934245702305832007005,15044749345099947962217476120263824356898437745229321420257770262954985403569,16364542436173489908162544844694842746117292595057249540926274681176755002520,18582462045999492294572047486602601352613220856614634390669602502489215736186,17106926147340558311732938581031578597532846523271406141897942990261560966411,21322204968737434192679865858477095835509790782891920152044718985713652659654,5180799590809942717590072710973007480225145652031514943521639316776384894144,17327427769240537767056224186269899694170666500703858813203303301835294225360,12795226231932513901983143961810913124288321956641191561823103283353203953207,21372571405151778511626450096485639101933984498294796899325401511071517993005,17332300051629640554924347563178488077648079908152291094969979591786473880576,15196566643676483159109284476812079407469293035334983717971092729005139246767,11231435533605861369104078150337976075098864909987541459896164149690464379912,2542242881481757350297627187544723135156543853134475677976341602496676452300,8414397814915895101029770303847330205837773505982623383796193602695811122514,20884120591077768210550361293303217187539921930869577755703150175746557517590,890887689926165781226591337399563217015154445631688026491595317246205069769,7911456647213080390137926613780820211986390960677915664339039845274033704843,8086506254215085366863905182926378819432294332631815038288539116592866850975,17073560037383161517623747613125771654997798954263090273202401066518468858416,7837662874931236958961077774488634261606966280628598881837875736120392183663,1858593536177571875355498014960393860692560832490490994119420708212532861823,2029815832061982114925482969267067531992443107339599745974909462412297854269,9638056659007828434670080110322180928336402529095853481855440674860675897358,12340090961747329883452841216385303705169146011720720105809463143491658552866,8529510825845236935037301291679257193837435275552609577171369718448324660013,4191225223853834143599110761318464286196261585898512902425773974473427757456,21023319679135760820789157052868478773370737850886002789313940767424256194356,2142526213326613906831098262446296658577569180284637200640763867788179991570,4585042017455545746057351957720948202590802829528217263388726369695890670411,10010708638531752335740573636867640657039858389864446260449096531856416238708,12350783923218275606957028867683130968505845112714635024839732952215498877130,11964414264447046767815837108295373861475122940092369903025175128013924386713,18615506936496648840383399989920850970951406181285583088268789582149764054418,14310480127014971068920522498055725465578544829224822580493909725079522528728,19209887743481507043830894286806384055543596834772181434542567255388724841969,9558553005299269735641084020216560749888705968385627813150807919487080187993,16359179198438658598155755638987769554841536772865629517841526255130745409879,13009386603860183254204895522650012288119732961876401784040013994677688723325,16165167702867558446013999607792716532235725666199142971707303433269257270111,9526255138490973975321568846030367381138407886665647949792126204681244064012,11173959697998471600463637717719289778917744248391051771189332133876606070906,8924806383303834750473706479936998674798746387089627706877519918521882863256,12086306023907343271920056592137012844278234154616893254064962297944646888123,20523426725749375175935122656912302902564898343946638208821839160006976692150,5207650950010803883388912523741229153368067016192964642079270816449299041225,1323145474328028634780912405048390126320417262412962953050466352509016682042,15985641921260285694054233699922160344414776687043687582488491933807565444789,13031771899737217701535545098380455304311851135903656399978477292561795000214,12687226379083740035799525440904048416465917656850081330730343990236073218003,5180214195408850700722613770944601169370584228844657891855699394648642429923,1934847650429153525882808430984088614158092322287601778579498068360011630130,13221691213669397834454903625729859574410480120034103769424898865047475910400,7358428584159841472154153892839275459119229492180053472830555381908577651936,10890590867941343184378544765218808644776443230231834463183835780142311216436,18106794932751537043075991633023418950145862470753313409722049187095789146702,20653121417027117499755994750040261936029675942959877982604976723194002882577,14917693547715740204091617501230563717468258023142717832164274356453628117609,12588115399854852983923905079011727575933343603816172388719899888494451203866,8737187804839661132607601320524529444256555649101505512380882940221377341037,20181178129036534248081631452735124104458169744675071995191727629040780050092,11847774883596070919125373409969812806188814542338127843683622869859801757028,11792352762436629909341171173296810156800556812208317414203786807634354583560,5039046929001603921830951923781308597413960825857893817665425268295870771062,12894400705986579725245788498699203221654445738734999525700614560206785491732,791109735149055364851227398853119460170782218988367975658618461497391330160,9962476109282060862882002156903460806939219308562214446822701651882476052460,1691961422009775486402337895262889415967004356867228407841177856000156435254,13137802539241815005932694907183711832661205367415214501122657136334369092290,14887252261014844625921142022701177088174316290502741584519763408145964517832,4710184813279024135486906523528903891606006797755655291767343324947631364837,3801875732725114698561125696836343357073399124260852478317754268545097096329,9198233237012512530002016044631468704269680036230256629514440524866699707396,19696310211066978020836317292330659233588020682368119069383469865122133603780,3893729283153055478198590025767324126269879907832064182575052081004216821718,17970322286541481482483545514302125656124172449128411566036569217140609597331,3173691464765770821621367532348960211199783691357143005417355252781889173280,2243542900289123996173306626857758207765925487218044091235839910321809834188,9813067765525696381929832954440764980538359181380263390331469145209686852182,7510903347384066721813722580189668539045635640361656120910145998846374499699,6798424040308056706713925899327404372610976624998869962003671422212921682045,13151104198292309578579089832681402880200764912297978086539824832412224275732,2808835590734075710953411057250272995919027932824027538775542577464926767888,12588027297759258617444062604210692398005597744782878589643963326768133974361,20852428689501418456174033597851660248293428726014401905473174242849532966301,21296758342898944987847487225137782473520558597036376704831839057822676021941,17749269130031982625604134600446353874123371420684509963863640790293640598822,12696062143950532198094822890688877675740383270827145944853466311043725527586,10234631072965977425954576972633890272283449053659669736631819751429358646105,15090656934406651728161310654614148547687401766770336347796859883364028754099,20297283938807526130287519089364625872430415084303524848853727877999978340129,4196012712072569404315829685460688625941300450108222372646584487742105064258,7048902004425912498834833883033670218379565315927717075817051690008258707008,10997088676112427186865690409423506551772833502185768664867716439827194601092,16660341545280246485425051709291678711850828822636537086457121822086705580853,7507040282824500274626435275567162035280839409294222666356976034789594111255,16582934771732736721752353176711248084060824111646755305570354937871610952840,8438441158635690733311342509710555256926785449251473129940736660330253698675,5997879363655967621652122271982901641685668225243330913415373444659935275798,377781155818540738714095913828188470350179572448699653767572496979822660266,21256042944489939677834126729197446597005830228623173527229465226360970832340,13462424045682641929202812263623136219335301688716109209361496824976128063539,16369985325316675741289392258637854017776166143141100299636544614904713590628,19352389303901189710313048379405187204819083083443266317372096723889889111665,10276552469336314142974101263431204498273961662600910736694134016860746072245,18939965576088516958025629296747895354615121399053610843001474455787438484084,16990956322664851054201977827659189601868639970054898553161570861097544812211,9274107214677498542007885890977699632511964198928324688228114708372115109190,19938102848869576488504727710754065647382136279175127752338128473551869244856,10947279549049485525804912961584261533182913140524900494781425525696586998449,17561385783620224695956276284426542193322408499898012489406312644517964425011,18549237431132768472559432396178388563409301393950605704070488347475233640622,4658944912168763919889884489643908669977608714692544551960581141528777169667,14358732577825715965736448712278683090180078342840106686279626250756225140484,12281258853616996819181958497578187729715864708853144319900642420503103456870,4069586715276899433893814672543891090785738315323966746105563017207510306537,15392338154382717986608388646339008932890583126043490476751054331156284554276,4517279215584833397018875849825808766631742728356316383241841280072723947253,11495036315995422771228762992950108862694073551665420165823433137577472792783,3488400840286926839516544735442894876148193865245875295688572119503866691461,4483680161275568275540790250446502401130629200290761781427443716038558729253,3942379126490099533582685851970104926928015397351808560877929535138811915511,11401623410099323944960285754389435394954200879740972352984594598244147798394,1704354226179051409424294551695786920602664449209459493691051505451583669264,6126483205301561395856828080510799275633402498512671992649940369928504550860,13606061849345999397793916269931170782757704442972401347887622528829626440142,15164492401059698496285802476110470458129619713288710918549993367398699891422,3351459252264231792942138342057542378418534651418845818443384064630601195925,2825813294993932054460723098369264495005871082754465730530978747926493034970,10630213694333677464069113775948160876773011480314305970870772509710784295967,17166444840808098079862920467594387590120730690478215313452389257289409232274,15584725536763467888732670366582920601197464509911998898151204840990765872853,3842723796922381697995350228115144219456021393259361082360164730224542750465,4831891679443026612628331848829793784542170442278947325598774522135713804734,7600866468317146506151393588648544489445105617254544624521183070936649742997,10583687645778325936823793169279337717905917984785560251868239070559362307278,6634607933824414124502549710741812867975263049249231353927669720791801705509,21200609344869125199593456019818101515444150712862469998882355110348140005358,14361714336789127058022203168794208348007919167174968797533361168719704534209,1575806469795254200103212820564180016945577757735332906646132503588215912546,10628306906313535336091114056786842183955113155572070406112143573768388478883,3089301712473516586340147971264840334080312453733093398291612940108596635146,8645795529068430110488497380845362622141451911891312096721911200350500642213,16022924422796267113820566797422451700895182144910797483992348492987850640540,21668559624091676943635408329170173151410363888407430983622558174006481336306,2072754212505196807037151376956574080111414803663052483852517767215769333105,344312312360359816789223515659978323664333965848417356296539814750513103748,8220091259162471818305840126401210949950597324344081712931466340258084434570,8081153019090920515448830088459971939645826679918559179389404338475619307845,21449241241855558649730447089457892378091011965030006823417837265982774602267,6067510299282418337933484892144351034696356612154920492037935939636907603847,21026143172839641048848076059364862575379425612028621103404211601411048352556,6070438567473697541030303531314185338530006003062193748841965554522662407077,8255130291759907832990229603685682560848952190335394603030993899908706198932,9546680581091867708464426246566048171085730057856647964775027268282058986619,19031748019605060953238957886441808197649034817040423262874632275713470713752,17096522586030137478189913833428299115382271406265963567569748424828047092166,14391874539708946761001075594593462740437739522325069415219274013650732876769,5044944855410335767979170189040984719402886766879289090117403978287180516155,12039442478120524220891851909305716836138223152615593874775855237995395028479,3523930243951081542915282337519662387190599423550808129910485998252637662407,21645562630446380089971004272761942543158290220498842219097308729146973947053,9635476273420949200636403482900193969961822409725076345852310152023632001652,20108896868320980092863545615065555118659548096203643467891646750271137801454,9185755445384903374596265352827852278482253313517817304360514098507824628136,15729448650969486701474329849747687235995473855623732466626603841221282908291,17997496197003273211403721001065741564292124821674411166555153239941325690779,1543484160386036195130212436149054066156454121707864502325718576708010327712,16363634132599571248968010449034783328746466576733841612125967259037812456762,11430550344567145066773020651025090506980499195413761807852670685184554749682,6562474642758509619875130343887830140546824045253242049540363976665708088792,3689788469446976140319903688077885060368720863836266384022598571957269060684,946161443553297471232017467760713330784613638346698353392670707850882897488,17775152994890017803033120420023910950366134526347402563464114996856742054838,18013595561755224808896799093133992096629438550898908281663802197342115179235,19550347733494203322271272376490635125389454301454207200256111665786140278650,12387591141491143807678990173849961323772837586376210707337202980616282598236,15615445216195972598868146032329101929277001754848917412471279643674750521844,11157377570334948360516367332475698893237579888172217677485190937247699033770,7130958205578403403951515578418204249480908544151977781217247531796937245530,13077463747714835214281685128657845926832593706922024570198457201391820941874,20874866618752897980777992983172936086725928829995747401713185587049763764007,9529341163966534350579350780474173060797076273832542721772111561732792505333,11142469391388881243303156644691476683457853027534314004453288809998298235798,15759641247899199119184149872340402267600476479959598970774176792522105838715,4932052011278518183097054145820640615211087138945458940865038794988474891006,10432003521315545222242540576886148188507417318972677351911763831484066879233,17415623007807480250676335953220588929877876653555913668269587494499596716638,6058502442301803313347169632367675883843035525640290470399543491756905404121,4937981332834016148179351587580087161307555148093009345111656135565068163315,4767276541447291442260238717093680167532207332378535289044385385412677713720,3479278227276561004751092786681066281912177752486503430342235086646969267132,7943278285140068849348170498689330975011840215116541312829451500334428180149,17789865444817191695636689430256327163274376252861234888599341795716694863906,11313788642745794682263060233193097297009786646629777858110154245289610960322,15451318802981646436556355654707114069777551322432702430595933898879175343955,7517270022604650172540378758621070031306040808100514057036893386092388842581,10009597627594120061689516706238257978394705225993629762944338270984243419952,16287228641302237661911798504390175297327206600486567815634358152959586818336,16488249714776419229986970659608164306511103745532215897060984940903927940510,13354728687549843942265910857129412843774195483459170542959107134210371522923,5514821690255816781301952402733589181643174815400146100135235253605240813486,5770103106430309708547950317514210165673407448643264387718101428086149468878,2694023365380190286709306630457152471177911482921639231487592222438630988204,2596360308486910596331175398746479488324950265788021808703834738076552537175,9039714509260386661160667890165090643713802650277924766536703740888044388658,9604908742305952316295642934650340892998619318487917447839433792965436657411,10397877232904834686750242142278095498016920001087513253065011131758634311960,9647356378465005298504489726754445992380752731297711041297431711301119823740,2901124847048448064485279495316677205686659456282057720583010224075223188929,19604711253175713682339631659824057587938105276478055043815802354580551412854,13814073762260094871340458282144499467492241477826265605381954643255652812563,19191277082146641271114112092268339387374938745710902056016346575725741574791,4351438127825195342433511764688522108908810411430938576079426214421798123584,13791103210113222833666019051739255444684344392875106989928046003279497788407,21004705702783423413965111534445421935934565517891538415275359891592731977145,2271618466337144497382665490697115072125990892802659816927722507215828359501,17558902460062424775395394774553055038697408789830072471787389990226026812332,19541727150539905151936633341362726755459275099586077305409909896489919664394,13692791587272861333747931194991249996571271400946738920492512367046518055252,16261859926552105019169611795692937520291616941485096436900016176047007140288,13364750885171681175943985569408970262762845797040643237076315743322239541667,13621972138767941419375174302334978784396954063748685093059444353200957635883,7816366958996751828525267034982378444982423551198678280151852851213963203655,5387588357364980194077356588147257085032575072648295273044945567343418708153,5561769804258805723102666784326040807434856561620360208220095378441903055863,2759015372384926293713393955452664141507032820282479368223024343744582995438,13981134543106614704319578938205751472742054796552637642168049339888724312989,7990257879146478669584929211133379459065259065980981194790047745364505663434,11876127927930413842997415069288338406075999315865409152476435081888707100248,16570551097531678234333612414250188586376313376162262758608423816369347322204,2912142129158840181609698148893520848427743435752721748118484524307819669362,21302711682094568025057587941584825132522581272692339045586256377620698610739,12312191496853376716581371884132892074646637957572159612619070514615509157537,6766172753918389200603997763713298721859536050788836585740520353915599111166,11495484070470791342676704007304510997655718568304345126153023374072812971624,20811664890504244597768955277493527673608205732118233091518542968150115526854,16063703627762167667966504135478113457485558849729490090362731172389730931393,14866560644094965611504947304610358591133796414154206860995591970456047599477,14070826318654672995642970624813758954945583937085129314124463556918282721543,2479865882631638665546581282869746245766113042059506929860680221143260292935,17398990555602339276684995684280302899074008602689308101178965669933564447317,608876042484390223586509032355843816374709085426455763238940304845396291392,19093816648588316664468783915406437520968219066632631005915358745999525844761,6752057404464894771427129594636749868828376343179986455821808045648379935245,19888182199106435309043037013966294783272588579928340631894231065863897158437,10082296017960550499269875102368612265371627577709879253045116718197037435449,14616172738414901831631177911088055616005574740810051337096702495520738285374,14075121030661423148825920501776601474873747801291899275268094618775991305078,186569155903133115291205664388893859453551519692185893083420327670792162388,21299949831814715974370318270705239305629929085336938013302553408219032200083,10073139629403946009284887013173459030563893496973388848686052378045073830551,1412198475257996126786641438141729921783447169582336707894995512036569315500,7779964092821851708726534513875342218194584080198381624983100710844846404634,948257338952437735532120031007610523249359469819114853137850805544224196883,21258332661476723168534084283213459804574003007208501208541743948207937371185,3571248067320885077052671052657329120832155265049255115581589211873377624342,18767668432875868101830472546043294158876614861521938962321471373462978174897,9300839292250613795491408219504842564421473000721822643979051375966405606193,7064697496603343927134791624768930499810256237088252983584462738613126284623,11853953981626198865163123682396255427116155876021473995289924391523536239496,19771876990095842377875081223218001588478929046615599374496234715810020326293,14316898881193279100266501073998404340884941240727243537292505454856307190130,14519359582636080510571261582400983934670011637905562203617314435861115398211,15526562931305845620715599917553561556373761549853248996847605985788604583130,13078262487107679022841832022599167182597313495640194703513299650288211974881,8245559318515118189428376002847388656528865763199194533482833563489439004385,14003329258302578586391126522614048791257224051921678844212914592624869865893,11725000422609501650997806599141176528384787601555518111375908215801780233121,16350891150329350826705554113837971740496662498788954571303936439413078899269,6411076187467760129645481080704474318810486795627076355267125729971512535475,21018151777353913573383620107187764987866574825379316352340980146357643078382,11358423056150266238825561031091840555431271536659827607676154506546242135862,19065833030377987569441381994102534825367123386452612836837050555888073644388,2562667974917478689245733861669928078902565222389031120733094553006681886960,3471326938285931978123873023764646019622642761349433536231294291602304868485,2563009390241284210001442885151389460822558817932742264596703331331069807625,1840397005312580276560341795534676176103474806443827954038672349702326279641,13608853165319143662474434916965520937512197511217746962619929048696566631710,19629513285164329969551640449451527909298649847319347893901982383162686335860,15394390010333989214892827255905093646577605209323130947826658910240751517983,12111906652703403073758441298171362667165880553934054594322507856217299245492,4297972575899320549167090598678621826992022863628750628394635867928789323371,13452780308396674980210210234355016032880538147426066947029982271570560372078,2831837563806484576977992168295535809035697292555489411927347217736327891352,16435334356674630023459784576727565801947528558756855054741604645713144334059,4127342592978010203327455190780821692230702238156658795505993209368069797198,19169399182658468533946629204100516992531108319585640665183465573285725904462,8598406387986750884545663645357594697293280337319305106433909682884489291980,13371924317816745712309163118606793190008424593275425616115063429517298127531,6966840677637301630181597160079353321163372268840965853806074036299182143344,7360050884120437815429010939441335996325758450523147733433611465713273074289,18472779235592140583651215638681270421642809888489121199352426980884551699243,20418315222771285674269327640703205319629639584244730201946908647328012868945,17026399731940643956418206353642733600139323525975091345342870617418039094945,12615211028716399762155462346481728092959316603121559521948867446476882144221,12396056279980752806946158389419170236239219009894918041607073720841998512650,3020267183116758520311575446823726815087071183512473845404855371056317502914,4656542918173262538192266136796850668036544742787442489947994092170369122585,6651580153776746866797134628474708113133308603326248742448594405127096716435,11937440848975251505322944134185172341897441221500443657141975704868428110206,1361826966800566560222081321267933925488529241685130208478269338961124266689,19943953771229014728170188452413560878330164558859793245021220185499985258316,5000555778712004519940673290591853777960346285299451454158729230859752281548,8421588432304272431559534311544652626307929129739056740355326524785204863675,20295164315900629557422352618552527295246432971816033569783057482727719683327,19373368537162638225474243050103347264636555313351270279300938524044041811781,19301584842175411162376576546656332386749822306022512981007234449440059593206,10803063363791701506227503212696578672701333662552932509544627248354076467851,21190447586310863247879892773912245039992873717104751727825265558975676297878,10001943442280168315414950100438358800275893831224620600570013850341287546634,11419108205602584425734602189435177828356990665164795815514509894518490834107,9176365528060199110731574560388345526295591893454204513780413140739307927521,14645264015971411259428809172021065485340465742768211283864072707152051283922,2059680394752128527783641175137415159902594391639901766513696812385555753758,1362210878544210374207986445190412893419873862912439530157828224644264948744,1767020623225215375042202191031932704135774649037849280381750341452687445659,12814227243430147774278313161816717185894261558098935373927981841389635793984,3650392274313221017884542662769899210301363377135174682150190146413571526895,8605030053804448166307797789010404548793085578661466947278557642849458591843,16243873345435203695859375103717652101719490281058055690129195139240095336348,18253688126813406708458581768662237883226849901952565733241285746065046225854,16894577548232574374120767026426945561995165201786189772245769116072691636300,6423863987901820348928069732046971656713531289251833729857903917381295249467,2313252375346549956530493743826026444705500798866360084159932659530274395286,14351648867218654569586186362113600409735374191851776253843321710353903071560,12748602702906129786642754668169435482057869301200357523545630557138115816573,9709541611470508424169916733595066328177420935464065317839768365879702321494,7178910033786777709713498702843323736165699178795466682345863412805925816311,3353312211975166615897632007255179570864390972587901806985844706830647691440,21333017166590824659869638126407263965780255207193356400088734092911593056348,5028007188794597820037691911407426228966175740057746443994889279713514676932,10712123321028508395224612143524241532236128389312765281020405990000255535908,9585591632158092894254183832493550005011787447364800638915694118244958639233,19409055735214428219964362626158681016506721676720000843605743187110212915626,7013515054956821958187738653419570061640238138610196975216698509582854871893,14195757172805460680435532998286722310304400118130745528870652671654335152142,21642947172805342858920270288264451136332732954445458690700494722054302963125,17447291201981220908729619112892222175870413627521563259423394750686485556049,7142752135376494645636618098683429493620847661912582079125447091506892873792,11965386305718013298615263282817897360134689279593443592649060011294217114060,3269287439460269094755519346810063037578116295811194645623863516503159243267,2159120529508493457616143785556394024190164584915596617279717229000244189542,13216089736556667969033672749174760723927614320685905176389819791237404133418,5739580235677403106179902507340026453834485061930671765794215270028117113169,10146496637166180435280660177294964473638207568055892239396905092844948797979,1559489237751880726567698923572583310388557924219345825351973445625480867548,2596197625765120503438747432434144655985802369868414306286213301002200644404,9161937832793127953923149604860857118908349157525975074572071369698144813595,6530106539927673920262526515085998672101393587740796643755609207665748320714,3454043461578374982297475090824066193432500488323777575207325753404726668622,3344507163548616813143529013320782527939556912905450999614978312225536850079,3495919320773160724078129285494188621289377270658655167666727615227933095154,5516726577701478990891722326081439827260225708304904918582005618283443949920,15205180713187999862939063125387810274995561110852513151225711366795547591281,6648123555675422871529580981673252698816139021904779960285680145979314385726,15841058754930028584592543963971426098015345537516384042315342065435733026794,11980445534925903182700789375967305825089780148976633769394511063611931605378,13752792603594569707463845404055123799321888887568435005345905056744143696677,451907199992567080921227130990235823262116394775607208182891587168397627680,18806959341268394516719451015233616843300011700855654586308376758853129828525,11666933396513215238559883168577675591860013867821037377342211197150469047378,18261858072527055096686249862512380033913481610225001662137639137871862029384,21560391742011390943072232187892257373961479111877969400490351307926336615662,21610883506787217615067001898587573081135488752397283684823910785658887961932,8408073424459585535553155824732179764716727837637392334926567945546036849813,15210371269884178529776581719481988665617111145372052101377092280056914506280,12126920168856651470145408021353708994570254510986190646194434994722466503351,5069682791790920726869832051575701989172948895827442056320603681340757243410,5206562653380935478898854557078389821615981777078527007269200218469247241072,20147037355698495391549064646435751868583938479186070809834102358533096530919,21648765692141622487379563405180427559394486974406039602691179361899957186441,20151743655500786952430656789085402151537047806266385436562459773879995501836,5934394754413383977455838937623522376367295023125030069688154658727645145368,12603931706566171371403975785994747990660901389421654410200684089833302667483,10026374951811566765702661526223829303823304592138671853309110795200798195351,20990348049520375634430049514368373247447730079841716683325070058824866344618,21619384435032220705428130345438986008128830023896849505537357845578039663569,13891656325513979012692764566925054630715484836057215275096343649598208636064,10516755320080836193722788097986010349704472844888704193817055904209452357159,1187924241706018031195408222997566778745910130631759501304388015015493122577,18176236836230977144874543476758297865658817104610686283126581582188371550406,12485836949850082215229286502965907740610097753180405472080386359153328488121,11294821091195763819640094447903397628795163768975434879119673473115769322204,15235618132532149904626305329048631193060570832794115447207190941624057752196,5247748280389397626917162873894276536157877881047135043409628106456158304439,12327729816009770868743571696284061855435639336028566901611215454206952326402,16602949418050455338609614423670909880567257158111141482461606053345944875474,19481131052077011331591495382924133179323957631986844309716638852480977994007,14534922095860994138017014871440884145230839148117198707882202478464336849118,14698138249781405938575978017673685687915842935570150501408655390412744761438,2268825110634009232539217412695133214837154986621027045784924577498202527005,48564023730318244345588908855562476416102457310638224830024196372769683274,13911429573364091016107598756829373924944177606409768266066645212252032518222,3072739629129037084628601278178937800555134277149245900071628775426363271424,17673164704069533606602950374212967524179027652656167791832581708629862878595,13337993423730131992645864661190106010697884214050744564788997133642079615746,10864361443255322638825945640705455870794346349925711501403405779308411872877,12776251935559898232336391171201768361485692108948381787636663233683642720570,5216617488642405414264845781989153364217494006051772154230377224854279460364,19003202417167005941636726827739223707886908723467287344441657245420838333458,1782933238160323149082341139973263731861637960761110984576354403382733192508,14049307335094461452125704957817909153045723261672970005965857346428556786126,602292860913070228058919352868668861608870961459967730841598276439118039884,4532222937868395031497077142687900610420285824272982687191592830322532698890,2099811981776987988652353966067242893298763890123265819355994207644365313244,14963517993601358850130080519783504904964131507655857293183966569857011289997,5628630657751613134050345890283140633799644494629647136869171968642164797575,20616991532748403949152312405329497795753361035307036075488592441729795933793,9449735601866166994904286297362590639752895462487835902681383517319419222042,4855933188947772127110139132590210785552455770275991391814399396690242166773,5236021116842873402180213939626155398638345682608182461380158609761274518585,8831771317829874397651604675303149337495578376535991692269465791612651585623,3088758799070584868972772977513492687395394215140736055156925465547111629717,9647320052871832007164877116869148540664111922421469306708391658695763892785,13710265959446629407575266748628250489155448638018691055085275421674700880156,3990937300186809757319839603902135620837406120640478356311388415953195593911,14183797850975043036582133930342253303942122026304366900989797745492038794070,7977072622674677196160507229659485240881624765782396719467815964585050639939,19241094982310069445586766283605264689470697759972104264399773392459234417767,1955047691838825101723033568109446280275825112435318858983042058841632309045,19123726709557210987172343550395139275104840920797922301604764165695899093438,11017985516143054945716095457545428692165844636350104202156363406141221710733,6698050162913212144220380056054973138261583127187888344395668170533632399574,9966258961247618428931643789269822918034016436345337589754558490493039380634,5992044103018260979899747087179477222620402658511576502983751749529532417546,4323136703775346257297028867845707816483717723305960372757928628051725499745,21794175040927871006132858751099842549067139289302899933403157116500725993565,4135205477235797120209733594064542822286242795709961420067213468324705376738,10502424667236605030274589825431626273558506810276755098371543260305259735173,14846816339594032738719600614652189538461600190221870378597670293625955865265,2524366986896165752091070306635323844562001546653320749202855717200081979142,20323646694453380576115350130108187509393437723558716335846490151009228206070,17922328316124774235198837264790120266787900323072144966876142176581863552114,1182636510606531787673615350114833983759075243161678674924493347851641505038,3207389967170019411093119580069334588690357331504170475184259410760933425232,8369192092815635351510306100580533943309224255100566350954698456188479225517,12030967886392195699293618525716046167148513246572831396936379799444387335164,14022141444250217995147289887822373716179013971005541169826207913322588624137,1819830254074794257713310243249746692467827341614315920377358118637602832394,5214222934428733796770137135908910242359102117443480657729178969918179851403,18138416073511031005117669443972799853597050093891426716335475360173308913456,15787040542336098200132680028140910620950068073851656692331927514281562129727,821824702031897351041935750619058900741428025283533564678462466715419856156,13945650681120508256113693182498673378848691411623235404408416652983710360306,21565424898814963463657730321537398782420569248706699928677873449861325896156,19609389297655053996872511820224772969554473578452634334180619061868015512289,11052162512235765382251445485034453773059444701618444976454738201341222665559,12166351899911550354968692629609980749815884172876848625284742219657445788950,9357004866878440721090407569238169828150449366762652916034388742054494762892,12114234396159313460221530030197986658691629189646106573755288837341527114909,20697910091918282046230152102481351960195609070206375824763685775389954486953,21217736707553075351032987119547432929010871168087324138739787787951139001106,17381364776399568820088774691862728632279841729367582228657079823795538435769,20943148878105082737615418415826125298002846495574584317442899738454169666093,7269215523851335046672197634746347471983448536436098948086942864058221294848,11453469784625194830295468663538063129244082440999065497133984430619118688913,21018146386490226380790917971415394820859127890200962707883416995754459780694,4499764602796942905287899120539899295087557389188509075023605344029409757976,6253534478331781543005728896589051616547370996281199587944537185086057029207,11552217017582571341399470106065323830802102428782340770897703340827468796773,10819374663920577173719455195284609222419659549106826920462161534187158953031,14349899656862395011953779288216924779057701185080247070042551534943737976358,909510146269051589147289065017979551607491214019225341737807929286505047312,7822991049400510485087251716608572124487352922137650148085367861004077510787,725869830997965165130427627260429551001667760503255008495920045139979612999,16876874328062330437058858063404447748425817762641981976045186363782457609729,5386742002628492275210178331450945300388007254427357938003565527570148075266,5628231453725040085705711150750978455046683883113398227942371706440013519778,5207331605257641510707403983352805778295440159078505882865873548456617745902,10535586157456772677635305329613970037048119551546559771279117980166707049697,10634858349767776643334691454267563140934605084766184133586786266071708634005,8194830686373761187394649827049013218313677678976649876752071409303459578949,7100588172111463994475475315895964854310052675103208262359133193362837864219,12698529806569743134165801249102690453926582725077752506169518961941228191732,3192504222109013167359339531059877081526474219178099463731713708944911915094,4863002263813052668246974534880517465192842993905851311847938713684622052826,5692128778265216733946522388190452257048514412064102477216511313048856040820,10126422206202050217110361146045359045967276838268265874082659894234609632351,5816818864633980489627669987512782856651289984181002178349070605011354887917,6571596820513333489228887403836877987952738840623146829273932098108053062770,14089943097204317257370418561461590134190932157472606744328891293369209454647,15650892875459028952140088123225234819706577582764200222337535746289113550733,15234537030902822319330116055095343429285315370864285347784850359841976501754,19442144493035982963093880999374393289974808397308087180018619507528159896278,4787721462177588970261549242306006751465139812381940463247588627972131957846,21188266388402646362923963971922131649215999518682418035026104849712460470697,7670120618673949888866627327541465118295930474243507723982310418317698793909,5278076033158881738611446681468941913572289692389442858337761263328869905538,6812114686357362596670812436414685361641526159356770435320544521002690748983,14512519858142345768369977582630083215640443350401036244408402584958380156234,2883669043634370578290606585906686768752718215322315377961330865510599230166,1390031372189262099215439174834826964629551818632345640955909690959488475368,2621604580741170950714666893803390793334876512814103152393976192943909783864,16238046050182542127054230631321316896861946156551854572617517416519877517341,17244586605437271554745538098470023522850216211045683035769492251097903894816,19367233841767536085266806989570452145418274769895229567119343509637411304432,60922694691641059020255299196606231058588207683679919735176896931621476211,11404572340596870708576661187798839793333697334049619025922813709736021654992,19297195320049214749532857744175644917624562154332216539771469808458364580570,20000477679980055675786972902810034261882771620364631737011618258163102706803,5145215345848317594229128468995966108988375785838942899274867896011577909800,12745405048448113216886186019434813760835051470566703617056298583393105029140,6134671602520394562619244398452258969460576801019889394876295515660617122846,4914589878992627637690178006894707570950584383330674027731006564533772285206,12220903700447451099363813812957915640017509928028867600267100643383476677026,11628588304761135026225316417404056298817057087404654319307918387873030085506,17423007615206678675839176821651284038190814226425327926691523730687305701329,8965704645750924279210398083172931641857031322145961884520939048845530423732,20213900813945518409362660921232075042618186257655700796304283970465683248159,14023473417795456589963878717505287517669917599805973068283274798230783465678,9113725901633633321816296721315176702107873006937820201651085782607150391484,548172112211359610960958872299753762974328909291797522208085351481742658142,21706861375052844683595820457538688901531393763031119579322611763049792865067,12400834297098033195346480176669546452877127463842848395269580039592533946307,18693408652472113120418656602007998722418946699666834214243410738193362834090,5734025542584829419095063290697837279993460564092839068131370421231150830964,18924630076511631254945042871273344212804227110396594419618744375738473997458,21814215076304113439159605823570645338718666334965210428557308969012775849083,15874497347478704100595228569012157674761828758432798819588001847304550645894,15630701992043410338260010633128892269216736379332650587736588580296378591400,21182316539430719202319661920312710080481096926576230463259085025268931402724,13427632056110349253603837202352903590918428276805663374267217475392463207302,10911219508671048309975190269088900191221091803425594935965400900508004506426,9158857576095512666804740759126852985161480036845995629848333137432364744220,3061727900948996735547324485012991687515955796128872254459502313385493651603,9484087600338383596528641950981362023967545451847364854943599173866192324557,15244438304843092101886329998640757457334825678432810119480500702489267475870,966872391220567196912397735096848312956568724961332613947113843660023937964,11463695793311663093741054432425795718511021724948561649345772770204331282701,4301779131461344863695073848029046722184482171568650483218315300688393400530,503085225024315480816360605760267420357374543116157267432728664696709665901,2152733644489285468694016160698899213530839938744988003049661235638107035210,15311799268435674361916200869320882308334015315600749428161144697607223747926,8821276262247279528293843357774532114304424863546634692022624148120506964899,15012215707563410212327951685975753138452396938302623171526151974041926043490,3832600555460338220245921307060619972944914111584149730708347861160918312276,4945512356937128186743764272299580525076021077689098424357488427223926571902,6352619611110096346414873193740535134097751304211531527845737802795592283759,10487432688972604512516548109465855881572886261854521534610720416206960307854,17622489873780167264774227253975567347204222125869234241462457566132215071928,7633353550826098030742486107449393642153730338494606903118637850284315354119,14024635247358847977026819464107185157647377185834445176147145227141238505750,3839080266490755896783758766005919524636645447105234209420661161997449147283,14295400414627547924873035695592309131547135626435254888679625991957098691157,9699346383521400413122931609905328425995515996718354291677850659748262244552,15892775179188924258683368801772704553840476123482448500492733919344870447160,20199645131225911044918007618559374867899861460760047877106143132248914945273,12001320852019564045161245401305456578767647373680507608908849898281736831048,14109337051994798438391426281455499687696832970217465295841248395157195678143,16327788711327335703187954019173408665382603544801329348791567767829649582022,14165345295389244679058422302892574411018017024852263235622041585515310700440,18098328140605761490641355018350075852862336947591383947449899194910504851997,17531934292095415392849417096338882004139134123682574245576387314018394586354,1733676683546726275638177172968959379163822515869952716090548401850898249951,15390925956113897743988821133394062442365524479421281886945584164621467664839,6308234777769318028945248133710542338224131559387923000379414195599812605031,18195940437872982705964842501287028751711989848794835251153117845868361639502,17490283477945958076039190253339223109810835246475119772790163703167194121322,15408396829836728115954873718864748500411741345264521674331031030247235075214,3551438511462216897614311415123740632223550882497302889988823516019801455881,1211190935634033568807015118513121103447278874630092924424376539010769615279,17406162668797550222384115208538224445727151774389004540678231208053715695274,20479453675762626017106163313206256229631927324901802475043478933123265498282,14782425647559744167182627327791886056751281195680302914811546501028210982186,925131908338441634745517290354664216337826881101842522634123686010539186420,8849707997196192490777875561563208206085973382242717199438345627124299133090,2076454320990941741925816538401596397546951763404696804371822796867698785368,17173134576726258494214130646402838956462459094351663199002055284799185636563,8278507153110957550422039807446721030659313329793830361362606551912544734153,21454855413436031867439010732150284197408206511012140387650556740240705522088,8938141846612216610282603832016394896549074914747256157702516831379429923666,3753004427655295864092888874901033504634515083469621309422669489429783662244,2366435134561993720630980767268361780485124472309182242565985427615594260755,16165357231356434631067514709216775568766632800191759830231349057343507534434,19619001519241758891959372143573350428188652312535228885075978087065138604446,18529730720102625006097708392875275467779439015225330756494090875760858662324,5652897308997297007169294392190006281027830654965418415676327691132517009477,13575260089385236342970650047136574844156206796954949409405285738862382638131,13051488122183433321152129519814259420249179451391427892934958106760313757814,16675947070785780493219656951197382898525312482169747446344506906972920892954,7175175603774065686796811506353067100604576034944842446058484596637779839013,1400986416499873501628131339252214540318552035055662222249409246587339999877,3464466866466806017745751012761954006390229805750136348643137486103734148919,18217858987033907489494644734206558680641423556261333390037659204834788684410,8406086726746620686898224574302006639796660679494669881199476338693847188630,17762341698784805474670945153199304225802481228485479435097247827908738620552,6223712186181276291315191942450380783893133091457934083606193355728586611122,4282900419919891825156385371067226030543529098387005106356966928605004273721,21245665052422749020204481966374990873300815343268950998971123603215733315757,6982432590923765268313576400153302843651774940912624901824133236148956994132,14604328114465343527250129263480156133215257207190011581958944554537477242146,4419171346687102376610201013900704798965178967312178557853149472731770706501,13245918223750947891398096117311260221538002135539665270124077712098715822692,3347693769680689230259648405537595614327886881079646330652620517715295020391,11097962153704048182055796266608903112109780112107618586656031611021161690259,103842991820173997936966388104541957651469231887516072360536421395334472158,10458487052445928020397135451416595147106158179032040258831628955988702925482,10900270612365580629478084761129851570116267768979394602611763172198923647648,9903203205178879991225339006690459919299342990467545909511182892622541268992,7206476963459461034052924246171589839665793743462578906114104789862742647145,6264046538214382166095990603552597379083154170591970728068583459736905241469,15208506074912456921421298757607137779904668310165212805848069781063650192568,14399898497646210477881830976333295219807765057833256267205543494652425724063,14270878504405431259159385066097540588788179903719271466546150744452837482681,2299469207691207005105135549235035285287116575059039549352935321891742095084,16821622844104951063765780536072686283845403348056960050391910562149383647957,9956020421344380373447956054462292461416421439742573500231969663699680679093,15930825774426452340437887971015387876460967360948156787859264923789690195070,10985728214199775151782154608793108221074450547445302100877022826701613291080,11760641126739413999815391346325702178866867588284525333479386263279622799779,12964764722311909921385583909124655151898642200440943348322605636391779313939,18379853927966213921019716164768637873544788239921704156188954474082485441441,15296912762863693782000299085702814599512114536531293086824435743573000852798,11055306663322542945964813101077231103838051414460193023274311763885249453027,8057951225246999526336336507654165264870114340865557474750852826611325059180,7217454204491887928591297314854022623729750971598154127245160014826014134117,14565102336180706753392276751790538414003260023904084675564779334184014612773,16932806574869520697162166869588187543526028859439455500295852309668070598166,9179898117866495045233038402762881324885778157159220317172535561846474551689,18779105085403868166483619694881906385652758088668461143173550878413116028260,11214136111470281555815079365242861297786837712776840366750250043823307862209,11442992999493383524983810131599863922453401327420664873617599429059754849857,16271323289864628346209913310699661044288655850612550590359075955707090062050,17108025350334840622180169650569770852833940341473970170517727066627050749958,13146248878892216294361188166665572028549000139712229260161108594416711673870,11427372820077962289622241022478467149286157602797953190515658164839928300751,893014835995617411380095483743111031917691099253220683676712243294883268295,8517095300100078150575343693630592663417209558229239005971749331683768522616,17927627171733468726764817859266182414919024487868681391571481635385817509424,2910874756516541331498135086483127887295864033618596807255973264881493597680,10351245804237587891981133156579115865490473264567370459691707360959684413970,12694211070090545997357986982035119982901819345677093614248046140600061957940,20283022323110075954579979019632104756139185475301167929737027848763705068147,15931844873010780159923673780071721836876296130477744289335217834580073984287,21827223850924748993974869213271539530659373002293617263857321497283795014386,2216130285102621170883691491664557599377015082391517585865064633069426967470,11373405503815639839270612384753272139664561558477978654573651197371057815151,12313875735580427829620793313088533328915412934622924938520740599744871213525,15142465061035421304605695594042142745567585293979295525147576522422528415408,19911123862342914329674984568751978176595422003509172434076759943963715219260,14262659769499978824697304563726231560538953195673261355416096174585413608681,14610683638141173050828300939153196590488444327501938863403192781649951814095,6637311287977459850936997036417480664822288091481538821362996372726159029429,15501657635921439788956110615190078759397404083654787694613599184616807587119,12415917438013473637314666005336278137449129158908612828862230927356476129214,3977073659694868689017260754925680384676839395821102222683036599314487912596,18021973030966989893231530982789547568199608264409750239459349680822956679629,4358661372125150502295103743733014495017362384424029473164385391234779773434,12150574573348685676904261170022340625206210894206500162919624199154445311926,19059564947466261856206182248882637129860510906425942015878496836349348075264,457803388293300831659933030795457353247367081441494540658944608302089214573,5212046878650303869536834084593989055518385481488493726863247051727387374999,10866963984944634834508529257930003255650324224099527428753028080514409460102,1567398629202166035061920213544077752133493577343656913517034032663760331227,1641623291671542299150077964313362112100008772415510478337935841080756871031,1814807183609065925468700221459835599229505862471630844515076416397596161921,18676591284813153230980779135662585498854259214169962891045023401932640144792,14582715392475730800118541203172619815507444658499922254753619352141615271717,5971201190012257917828174333108220091030383280212145099110362036705465802488,9745736062659480171553506036948675113562718355498342585124081392171087285152,20654605762814031873434196876396785695406369410937473580199071780191334325949,11844011087342569590330041590202444612516395732736950853259915342942395929104,12960729918447154570349545809398065983315955190065107446283057843674060399978,1912969365260456210218541172655492769437123937988143458973053151759348812779,6751278463897225433246228986310134589363747158535699169746372748837067912354,1405433090804402720301319240257714728362644500702704160642087476923303165683,17334203531491537592342457272578981899701055200802551766264091441355104806736,16575765689548766530893504204590870417122916172019674976779799591211403721688,12220976854598379181285138460526335801169364473128100040253401652070229420610,18565358629024373944198152078259356971563125515748886809957420832630624111647,18999218340435052500780578040305741910732238048488832712380773170203478504280,828469997232485965462944215365058139980461203417902215718115878220834198655,2385864265255813442011864217087321326832147642514277043179825610035123479208,11753087538734344167619786844012793078263845468062416000491296071906848786208,15297341509659920002867070368227904487875907462849401568145592054120947559782,17451904737564664855895845058410281315610351460549944647244100267528838462231,16288687708586503845827496209229686543350756101251970070831852982828263987682,17372190154611010904681208309570706747429785600046317069452832284803213135091,15112572862198958048036722322696004521384539985617885597335257056722713402392,3090030985871039557449539908126365491166718509536148045184016492804246563853,7579986120189318071341140006570025802626137718385790787108832330451957404666,4656625991418301006397045145531617124589866163929416672123076523538862286851,19496020801558863926434816068743011465607626373023757648812447085667986307007,13805329389975072362759970417944582121050551902725997016013251740633448473430,18188229086122124131780255528737492392822604407289151260248713532509782736083,14611835504502434276576475613524726992333885650957002636192032800434268523844,10917400920268125157880112072188560060076995206390296416305594303287585051306,13972231301490257961012583958703459454850999751676553092417436936263553366685,18328503113772388769765260234570641415081417900145352728842854263561232438288,237123037398988309289930744284813441581716633481073379308753775064025864085,1703922543704124573472350868371820728886443372137290454699485327716109471338,11303106151640297276547682977648977961130813769323129464984120148868796657869,780835119818217499025356174332702814577120774118181250962295467182217505278,7513776436281774240010548782707301011961852707217067098086617267751060890346,7053386733865795782344919942070418964042982090173077686333893187474076408826,15388377229685250353999590264475768848666849601695837177100149716633411294502,18619784384287698574679414094727959444475916860934398666937358687019863556637,6843956467116800550015577789758902600855297665349663446001269088726857226048,15027464760260005079316932218316611292633334115528481474392667994765319146064,3113497944921123135464097580210634621999169473508798646842600013742294203321,13922875552185745353363519166943408041900501129716418917715862175817917028807,6529143033058355347608548436453630783222625692384446386966623567146527415664,10224300829854530831381318053279338710395220281107133842738514322747972858570,20406735123273907201110501114056492687992916259913310564107896450511212255632,14266011897697023567365526625467367950062937074006135166584691625548787309637,6266823350995327247595338658995148275348018579417278062676982980758032485160,13382224019010393958018966744541120649420499028243672845532376433487586111361,17219221786488657036851893458562210759167416100910882352030211878162886142909,20162856829897101788693886235042939518715128237037117615656868509223185121680,19255871117980259796107225408238738190418971755264416661458453217281817348088,14978990393744959794726413403754476561984809686673856442658550453303982912228,19671827853594912540136789344716532059747421261482796306917878259275666282337,10732390517629598846596313835253769945253387192277550975463036830136687386844,17133415435299159639005309603217597288690767318016826234871049396559867937550,4238294829801619171082019239832000810131476156600856298143082034448277968560,7722327574874647121890494265704613777043492303801725732359520952354380593844,12398521387704975769381094211621106917110829744392349946808293674617176531795,11200776058775831613393435187103560072186926574904464246036376746754002391683,1438209332219971409989076556134294085612745796338690516891328286502107803440,2937570830929161760131625263024599999319751748792625900610926821498514203833,11043761204766219739712866580984621876221567501998807492499956572251345283273,17161703263657344245212174231645949667297741070344916641526821962829393621412,18619070492541478298708071132730313137437250499943292747935022132254737182602,8379242582671699656964937417808578910591927550726975853520669689659712748923,4461581878275014470922963327129159901508275066328903674248853463321568123734,8814779309876923204577653695802478749454337142645142889405691969158642344463,5916090197404556150255058868159426544438846565532168821258584401868379000295,13450130187167769463125976820336122102195298233114472585228206936434118870547,16312137321831916960674847439149202523298938366384118998520447019250845846949,3523905992883153108179926090860559860264215076129040324355490516029055984441,9941544263434232818617581658227915119072214833223636007382930887032695504069,5866421591020072450638507367259603444231034674337808358938713064987239652864], + [1098498142837982582047608372723518751721607512716925277273595859756333857326,498382712248562027578374863343601618793781182132084383060312181008958381971,19040726265283429618662679510157690394832296024968480927415996691029230011306,10367579130776133414495805974535693744211249758950881275217429221792836643614,1229596364469449066712193908302977020022727834238778132871229393863406546866,5594347757215876411130934611555467571639435097442631641074898978663329410864,625275312666547608222628560378372315159605662141936411119837279426221363981,15485529557721639677666143827295121022852505628489596851713462276650737776670,12156576509577081554587930818670905775536581975823788207855134544267814269606,1981640929928975005466842670997136169304057407742291166386016130552621471939,9375079124430521740651903984797221620963928972304905809259607327125669559872,268697279437287801043057266739136500465135819021738115532631740070584831216,9310725094036396036773344350803037792624399505581573214229419814378683970851,6144934044671205976376028664002834283864020049596457260475210339996948797436,4985941506647510031967748765284991041503308370910665002557248958100799063851,15851062719909725150709309168582658649310704358483047683106225599004779349418,9869770840966008659377598457679699092337106962689936558150689057592239644963,4964286354328869036674130011248598806906438908586967212984901377099285878228,13408525694456518383125684465410538061086669117275911801498275369395798296201,18263306792332242197764383101132914152275840410710698264525919817458731671889,10401786441956087930118823951510684636068781082958380915651220354850381871543,12496745101887166473879957440401384727148915595227764657145046356182346897947,56825204182651219072479187681186238157981743937496557304633023935549648224,7949519580094467639897040111470236633243836928348452962417270559805860514707,3509286722306670968352119363633866055096352721394520084890481975258162907251,21359945526252146173553061920944871506626324563977081669248710516265311530589,14649491209868365229844087258057697734286269047837985905275053819765825128984,12122186136173879572357400046587658543826161883897136171993927935307093999926,2666476328185593105035429309804341325262753927547102747066987631391232293139,21005241858197204874543384881533661499138265185107903730534607574687765896488,4866331653274711303641000079325074227730641553230218424779550288347820225149,938689939079340009195180604139206414955240264736983491692686499992823741696,950493909161345219342597929783079468041198261349024441783356363638640688155,8227093387774305505218050843028014038423742476679149203160700406235271548925,298899716277443866412562171123535849674476895336539413683307522836440058745,6985094123716229565713211140430519589886023406928617334981414752732877292051,4561102873171162160916461632027561255705058072826965137552144392802414262261,15422356128912397775473168682864290042256748428952418907369066530964035265216,21534011877473706794700774934355764894917955655606512952257743854629820348396,9461908500272520643111839486963426035162115487175673718316249722520977894185,9042969964854694648113546554619141983055960736166619708191725199599555275062,1441104948831954255692318866730011748129225465895791664253095290347818907280,19417400621113450826458192671383621002793369580946623762558060167661227354799,8244773274459817591888745631242804467035454174608673362960589130536385507190,17088086767144106377842029064730946925009348520592888187451688601493882340857,12886019902209719236096958359125451092745638766392722988311451127550961945660,20280862819329644063010032903732505647194710429034928708829957501178343790858,13239701144341900586601825324587185682073736334523805955933121583949546821724,2994618864933374534869864629648211464657674590007913715843569952783382900518,3072221011986428615228338853345294533299624086589539664037325300531050793357,13594276105600327401961157952766116939399999497643063180657161489419638074478,12904364780884039213184464580277965622079185353283126471569179129906875486852,15088962493677593800057541234990587773412340265413268221386103386021880406010,14138285403526705785804535000245522290348086552790608567368815987904186155718,13481415964846572771441311017814910258609608797603836070350286657768815710822,15459769479990273742477151452466966963353767555965255520456901549474045452607,8586052864861352028352866296665876117392195296860481710367953704812400661703,180502622991267551120688532508657597773982647209049478186474242637299204110,4785745751361586866577727263713743688205421961646731269452058881240942369409,4583871856798894230250707953295146343968130822948818555994825096960225600041,12377924729639905725281972784629126900954187435957722012223715002490809152047,21554415644278070156493674075483844873249829791940344144484983897474364915950,8390225843490125870104241611355504124284851919520955291024552578484662824128,2330476067094130593913781764168287559468546989640021387799865123741354870445,15749497374252464770935521609391859230015300749964554524771184068776070217841,16817654103281917947623051388088441309787140809596505043937473012669498321704,9987656178378986905964646161927549614205785047077068310684205046327286932204,21450061958292240283686535241652971764195183478875921481624114699420928365160,3904617432242099936494425054740854886663050476318725032541401300619628714123,21454964104289781104446533610149551385791852085041524046710270949744081353102,10768409462143965702783360646769759623397882338491564999208626639994081655791,19385613828688830964519526099114207553837496617978489639408163709100497624509,9385292780799468553063371906778802189174789542685475364513544798199315486080,19882577122462819381545089778080532575686772634821281258975533828284349988146,1462201549484596350490921057903425036211202388283463006651220816599917679116,16564642856725628254155356607086672564976261497486137590399143770170930986182,11606470848655267736219046910932382494518380844147406842964119623341701511194,546921055225672463086391798419385468083264065960104350335293012629066408625,12676737821548820987278730174038033161886561534502963159950183188070064038340,16429180804851559661054910451008618941371882312211198495282444364589225325606,8318514508896823373027050528521007144041407638548138855564062559664141902892,18546910687432012966956995548470714600618104024117576926439677823609854961263,12006683905722730408249989907056432037202625403043550391187503858618155798348,10816814135685807143320832554644398181525372167669730953193258726693903362148,1969445073620598650457101028079888612893685228913473332116076918643068711808,16873795316557869761040796336264749169213884122126281483001377666183529927793,8441268321647668856014389726368355391497206989491787976537908376817970369132,3378086906271763133245748026584767009750550242946195995254881868035794898559,12721353531573613369892164015903035636498816100971168742462654106875931342664,14969430369156214890953989610124286618925370029259450629468188666450865580556,8545723361883060050915916338313252821252873299513393695440138873537985282439,947668284380905375962163908708231363459059635485281084900173592739603282382,4418352807772484492818068921024797225893951828921880350002134747344565378254,18146914067008843660990756743559427698617136456156926109157771781314720068545,2353279078725994188579023195684884389261433430819033940093641668202046052763,18228226015329570627220992288018909552101992748538110505558715089403194764144,2251557590571495628913478692960173580728135227602564510397207128937882297417,20421664597091787362209209474226188711714308866665750343509458297343168321800,8187951594294388715811532560312339537604737243977265499957088579012554679278,15810834190411667509425096842396102750984990364193499272150958331088983323159,16884308240478579935994044823717491481297317573500280152191710196639752382061,234497484353824748419812158321111328486478789224631887096763967543932891899,21452418791072076854500976656696245147472896609273403517249960331326136475572,10860322289080285812992522532751459911253736747190334349942615321085283282595,149826608572716492570322179195234088797160854886751475825283168005807771516,11491761442863092383423796629001188933840969144934642247702733820824608517603,12099180244453415217270377899736157198045626379801787493348249001794558732373,13177983303979037999809722097100345612970493007300007493855625634642663397908,6849052800275826145043024580348093078809773712986428314364827674907764829568,21486255029472594818259653174918852363002807142725698741685253190938680807594,11451503340703054732459437884000132607423536025797075877436151438425159994269,8462539135531767509735697608276067216182907546891182278996691315801807234639,19944711893825824667372913293784300313762563232409638194240029859435259601775,10396631238556297232793544122243237485091433966091043100758266678889110827200,20667999270580360504376758654763163152764187226267414436968564661080084475852,10424436665500877000658892169756884171624649701456443210945810183301667922053,13894422482417998868290238401966517700776990643618129177567797594771207188055,9076475964444407787992938909179730031379198268423789105813333967195259669658,20479003631920854685589262232015009286810147171298477411667705150903826855301,9928015403359312830073752955992978705151208358029077246413002475277600546387,13981618256931763962905358530247354996931923386029793318275706908114940457317] + ) +} +// noir-fmt:ignore +pub fn x5_12_config() -> PoseidonConfig<816, 144> { + config( + 12, + 8, + 60, + alpha(), + [9531912189466476916568861603725087174113765795321185751191491139118805372511,19478790955972117697384547134063865214385101762783978876290106323878777065880,1060742683967616999946346623778902980408439861665078741681079083728753884980,903807389911706192945621790390189278582333785459643079682311503388875632444,12234856961774107626670146718644057065701939000315796085771709903680607765980,7144222788160875459149511026237781941826966456792731247241581603475033054157,20698157631699630824067955298548696950174021158305550220448729049898476869972,2568732479597962725718653653192533652726437462680484211279054254158600287844,15284734447838568972934847154537240941736455475374750484902463133334986327455,11481338136657097309136761414013103615752281785975103234128467186355727286020,10612154017018914947135783711517517074090274235061056248497547614631916723906,3055604116750189009829046286798613018321687824856056202070161812694453230232,15724356578668121294244613323219019733691132614053416867337612541744349705307,14233178571890186223833398248040498471414046807101676904418988635462870136058,15569884202072601673299042953201725479510195453493088500579693825511613908294,2457655896277475748047646151777860503559023325500398204274047419681119270433,18721554772384051287322049295337473476448259922773695010270945658995924622719,14475562052679553333706265906284533085428658760049287899372861273825967798347,15603408794229592986464670990674550905587371918421438132217255356917740776753,16291020844798157226549685169153735235751877205762229274467406522127105739380,1562912009705461355815110217333069399929165391790667011738168557818438924927,11269000847557922376283381139665491298931690005135341373215203639253515983197,7952882227157644034022652849613475711023423321505769231128945987664804912273,8477623463686474590677390307150152439632807913002306242882220286965657503044,16240923770208341542260111895431885216031871921759466016566105290964433552216,3342849074804996662671621919352322750206307938435597035721084610748972602222,17931702006999673813463835283048793204134166638699010505988519059393386641671,20775104403560355444897460398679593487716638645215251442678183285176599574637,5119120619161234799144523865081220455479981813019860080498855561756227023701,14966757356872002341966020507506536570537078023526508344654458912397759281515,4186575643717625662604368224196455420957673000117335440321019421096129003102,19732993039041335023904970539797704576579318087957672270477209415993860238993,12070985110749915673363345667648496564808814323429491368289711883810537898097,11426729904237322553170474047093755836047277723343283963043397762276736900525,3316549680511845723553051012477874001156246623643069548980284069093192393275,8181145696278572952623145148622555644838658979012817598939443116317742063663,5285104126733708771192424010645473580676014333664755598112717745696037070786,20879460004955312065246827250994614761073401947673232470833608851757692374701,9225423353187148331993357472363957540141522302215231248106234750413173980751,15882456781720382955442431000301149138213435084361689595107598612703885378636,740238561845104412391944006282242126007894120431256540495139829806405656182,180417058725083825889148913143008776006125349068680455724690397852076567353,14174293519955274733372251014027762210778831326913295280840585355009025244339,8589132560109336742397080501737400189892522466285798728529721670916644735009,18608579889305084432265993644262889161778187018060113992221234915464772250895,13255562856310211555141734542720764165551582487712004861593515585281326120780,20040426996876166323258012360708147873405329072458300306708975663127708222443,3623806905318973096995680510049954452579199046783492207512283522220396562822,11410684734000900004860241940266501902598169149094443542781697771532926351566,17135477854627682759515989387435395911766329083966273406049980901836411403416,13593359321772915930716800157828568438953037754245269488538472861500074218774,8851367853862849158416384345517193602505667487160151588020171989122435915705,8486258745426030087193511835657366486234171438833758681014633470174920075557,14747490337504821136965789527401826047053378817043597026988257648138435336926,5328238162919446506214025777104049372124957345257645933410622558507658284713,11965770224330607826076459132274399741504292999992921785782448737931531131492,6397958737008655664539418210486834384969900796875514632281024739857683313517,19298424785220686762403958616740155152857782164943661260316780711617884649980,20019455348785333548837795973650078300677031008828877476192963238765813699604,498876295068369039941891884133922605442597373275805987652958540603151502762,15673948845182330978914854481229214769118100412263880346214990198207268219918,15636974430517603355685549955558840639961287398389993551242671229593610041279,21849352155479133596816471850644588093828045783688624472176874329078465894038,3710541309080539224803365587698192640065043989988405183436118622332060826084,7400908409303343897763329119747918294591391269311551693625176644493777241247,19095563460120996369257805492605849292942048841569757166438202426234116219528,7450358777752652255259382961368280387692895530851667830759412613948095056314,12616362847029801456780520061399223912377922714639139395311897747307063246381,2962396389753936883856793158008198181187288822144777145656778061306062270271,20597083262311447290143345580862519411179427096464102505623468932397345199901,5990063075931255958499395880323163728626495197217954905778613462408195572191,9361904499252311797420064091418454593805808979929563324171298064587942042557,15745983602860127054098117502599813732367772584805282887983680577406906842509,12155753549127535852899642287036910835293646693799050941038502705904075221647,17784550108352452858546269360461997898333463961938370347697582728197589684086,2486952113321483072183664368099776164387734014933893158352223909214365526945,4903545427310923282188595180893897246459463256398425200307382903876773643166,4976787025628832138140129068285715692634473783721132777844066348049003658995,17903848557396420363857191109854268785343114927997153696759251220232810232708,4112316506554809604392743006504568448930584669405889138267627731770713169451,12564921445775298869601661793895717261354052767541351424764087809438338341443,21338339987232841174606235608205622863643553456415651377028015070388899605425,15088854240518267391884187352051335059960134381458770666979402557846290860043,6521785672326022155410896706891346109402758862672817874198014517122929534795,17713017733654015756718215699238009705617793897969373435335184169505068045344,17520588725173134454654213370481559878188684108641520017594192886986887410727,20370353420481573040209617326772538556774101029132132235011046989968543481853,1112630910445876674622022594317693604373148988518983600314476620278857862788,13947879294001229379895373879944689637841444307211953543137372048528771620266,19992733820130513366333925886960985070219788486605690639975080516132656879852,20463686239191469605722985205294798392601180601616445763439546206772797296794,2399836272490730222789561326076432853292090595513010294231690669763899804691,1034212741378241815550350670737161423052400169194393567236687087583799668630,11440929010875860174917763753574001672473682534215635955505970318252592490865,14189960926817818424784917441574757301766760887770685069486059337906765736963,12315331213328078044898516229848174792421271854142211159524426707506661472774,19715153274097520886062594899069030152815615989925596868748132112713500919606,5263645674775021082527379900656937946372398687742691252725061831191269814647,17116922705336407879424247270343125398621621836566941362988393678055183546962,12965075932786028962944831711285166109972351055088920502397645336995474504411,12016029264981766758974787101200878559176627961323691741528038308088561486007,5729800253105809140207889626731612970039128485797787837679696331851897001188,12918441439057112476878371772096947366502166083699226943980929800631997660377,12122801182972566919042281354391366131886072331873675435499031824985283406080,2001381046477673840829875588313268487326797326656965151814712798463828403972,19581992323872865003173357646589705276192927057599589666190396129558198469295,12032241883699803399815479981073900218390137511663730251199663857029681112519,4486673663248066106745570699596745555749344770988892121755846988206654958447,5880818668316784480273321916242537222449799562687899946001667784663774949284,2395463900919111658295342588362130947823185484448880299307422522723986076206,12950983061674357110606111858229311283119838941890561558124046774295323335099,2237414129351562764861995011211505967387529547007150899242139479636758409691,11297958435815311160313316754342324739290776717531068730041530178142477489469,5317255860197359110199894572100590405469568868980740298600361799734023336258,20883201721979021051679862781044901365707874143019054645125857460321063446040,8182241566037373547703812967620649098015366536333588850170211599244447070966,9597640642388296782056528355964209027337895123387144965957122193392739912194,17036534143228977344737945793420370811715806669058615712195620745133828881359,11612810822316258618979762480131695561483235138506664012253801075650313633340,8933421864748994361777741056369848147887887317449099739627452478628920292098,14444070019150868677613599250973948199109012042816076287250439535772792130077,1409252976182963241946410463334709182528602279352691338387472032099813179046,11952347912832393217697966069578145988700552783923451999893230696985016550129,20459418532142116378042115609733769114184932636063412849272885250416180990630,3551971311295052916014184741437675944777358383038912487497306982998424802991,17338671457268891559841041605089015291458737421392337141908035764681448452092,20968343054904260510606682646995696017767749421435540168583945905747214877394,21712394213185895207403184789091961285240129068046002376558625468598692072071,7634967402785998572909457534910529497063727153788753124164657866643377741907,19849927917300065970782875128524194424999119369431340457180683372405088384137,15012913963479022629048645986836271605475934011232886489828149973693122241964,9429717687014890707005420840742234597648724772846627377968206537995029096421,2567188197501474210757971384017028034832891166328657542206945684532913152990,8254698320328328672738727190211578815599233720695888584349629846354725718490,17284254811803472776585305793072871837922263190673228934354908231725144505079,14935255735939697495362584034949670161356891451287847368207930876840786524288,15799240079228766996307573606262831147697506141321254927976890662889015144612,6455095726770008351501849656650198371508317633852287113372325351871125339180,13561632639572229898860364095655372109051739280251390860766414218384828962360,3063643914261015068338656198636076696013594289440915753234546912875968584726,523490668760084285231907250925228161954264885492417167368043075448446094968,8963235882996992436242593243282162189452480942366129170093695041925502792493,2822355405499444122504244694377602321152414880107322020961544617958820110728,9900962978347352867015759419877923426715239847996616012083851486863818525240,8479746689369630997477042503538860863372007378750903762662394891426272525808,16389683851395581748247134197181679668454182692374139436248933773102047859911,53288238128999697340898456182379718764153689572603829218558226366719788005,19367926616347613140684682635393090785537600078242140764999539757098535716540,15865351283225378120524944291419029041302905726785499676495076019805256191362,3306541431760940351422576606963790342897050957331449111434563465335195596604,15691440019263506851813897307599578949230726834044329611626721124859202292981,5471927110529676053035425189646230106778686168719884591627642899285735629074,21754232156244379849332999145646221923063494235010275675811923863906511018870,12691978963824033486319665437354495198660382717956695927101804737187302726210,18287930615191907073854709805749959615454583394829992950666668999967617218809,19651897318700114806760486800306423305046969021116395207725042165875775288623,14108212236437313184992367338426565912378398742941435667080068116020546770682,16999325425454851471000400176480399381440753089661500361295692310681628123507,3115621817064730307934070024882122808835435845590131246374645701268123516395,7664237802103239138782764325077413451892718354904226049706189059570344004578,10628974555344045044380058670185713528581140293158876652923633181919907860739,14113596208322488293154755998142305972509624369829087071590744312673264784912,17464956897498328434098241327703906248729109105264442832066471889452262140737,3306236514619936703817193243747225028048646569484446722868278187142340885606,1623642646505969781806818562148062924427827461950798461560800231691312453957,20812904557023426950178015281581063697341146335603865156046444216576536158479,19408105996475064309045111496637572365855316086113347445820645560307476671120,19899769975875815048945884537401834080401837433178820364413791122141366658704,19592039825831921790276944621603771771915464940035526138844575559711905257984,16653297576149039984587104062729832787430849403617977005988111857683169262526,9600749907793807254814822662348056400280037933879058284466549496283747987313,4481371968429561669477332540784950497549507725682080986909471734800926537000,901971752662861027246344512729868409066847439697888994727629776003122477075,13205641411901359105414809635566186722302364256582520884685762468367549487609,8771921370123544696277176259984315154171500395079224159374189372693912295384,5174975161282723002634664972730414710732925114695376584668768207090019053678,19270513804464040100949263044402755496385234769453916866026752765439740596759,21159175882383323828715178134104379154154907971797847682741774730382256211237,12713085776674794152643870369276859988930155976989577699924346924648017649124,14416880591724909781230787197474161383703110620356522560207527702042764430665,5782775977590089860582593877799736603230821040322957359619681360364621989990,4476458740184410293724437897879594951652562625859170065641235900450054752275,2721806229175990973363729919729809746838498228946916302499795336059265315654,20919749045138523262313225773151110447007311142131682485436367417448435698000,8313744079461516868330165973726769605125778482558912200259619501953066297351,4735608165219550054732197605756732753518722979705458514715803339137012677807,7197734920840596436781335789800800949073525267054200029424794448358957228282,21023118349982419692339995216673708826739468972915634059252379895041124776477,7361684304536881013610906796097454038829033466585052789468836114776912784525,20982662530655024673207268539471241193218964077396502472563124088553292010609,16223276590978113205386347640415975693035764887550533934078089596214147119142,16855050273631391834996719887442993598537594692357829619807594900987141342279,9447886870473301829371932239272857617552029212858469830955734178259213680272,20832064076469714454949991237859093636177561963691091143340405814107144265638,8639667923938888615556970427023258757087537766667818930469506422086574042603,17264766416417856804513499340974616744303058001571461329697855072803549043449,17850880215521300838724196369662075783108857625488733013926883881070746974079,2555423581835096020752363625782761123603321345233444467023623837801470232396,287393475373800420687070196983041262901299109116957212897422666775745916878,8502409129845334137896426506380979458386453989629214624807418474240644490658,17018903560361810748608552810594034468026623560117430817297647108682661433399,3048293276213593502083356886493678223968770697826563060833194090969377703128,21410637907835525984647506144589609474305790431496436733818309371828966617019,11884766464429332615888730245830253775469158860120272524933094891366345545984,1404751133279371734382153067811682787285007352946819870030827863597870240066,18533103709771766357713924189614422821669511650512088621974348524596673777463,2245746843374377731985282335022648129668387693745835052018700591124673151499,7164798246992914028921284523335117888604816694373355756451086598952914018661,6547792475751145534229851742995938089417776974069115284886265458921995253635,20902177810420148842648372790754609922473216539157084210657172695295335305053,6725829188763173291829388608607411327488468861041838394166490103857184986505,14877246205681405878429147764831613204208078224683457409980647858475648710211,12044111044800943869325640584272709159106488829628178962818078442934011738582,19605231155471418918091518582371485038913937726379108169052428896528644150703,7703294969707260451899023373169584023358521879520637237253564638222384534453,8646812596577526500078198446696820195057640949335282980927180585777038852172,21737243780210633072252501142816485256289884504027720271756348514717163502438,11106629219138713431737722416937344915839184447234152498273695046605412717853,10776231601191535915748483208366958548059216019309096513250460388757814780540,9570793764533387448268417521329594330897759769553789809193103230402046525968,17679865315281322154038759337512810633677645281028940369384987651076506608513,20575490035801628850469464797342943234291317406364190353186174477643080398289,1245923103633930975302215942611213577964303545113844948930979175833556792302,14007490679559289327503467618330290757962057021886611213555145469946035182448,11028796735236022300483437389742268989348582903251651368706557599156682851942,1556450270937619861275756908441730263281625715497049030992434005539032147429,7378353234583563315614681819214067843031828330274954124783678863055213281539,14666996645204144598922205770204386241062541706976832276647424877691625110244,753795180391574509648864319525512763100129705111118203505048417049290278879,14153559413038217294172720643039696432149555359470735393924921410988488820985,17643076982867120574893553230100217333463357095994549461637738074442388603622,3578933943193517852178000450144796032210613197873582924120228282439809826887,15520463167953252157432945917399723977264972626433304226673421190651502497625,17211537329205623730168383274756825219539545439487707555783029872192419895198,9802003881898384149235538364488830129822967333024012959168976309447054827302,4277753965394311084543194762939932271526308682615262493526499362805330624922,3936260403240718180440931086768355327655463497858616640513270218914599723610,11517607066800361513856730397176372083814736323098377670788083637850655404741,2243213365229554429675654538157029776597503775940697016289614299870958139625,19764298184704281654348385808308820923079630109704889940202178107926508921613,21440201729469627284915716136426033084639303793622913729895539439609852676483,18865357344271429482320975819341476664123167289165510208121280487753271844163,12062934463233700754743031150573591813637006411260363192982014497532786059086,7253500424782653645261846666860267886758998073654253013071356444451212225059,17688280285743970528696341296072681725398428119833052669003422836815517127146,7296931094727393709963826609746626294291079390951795401509403882666626382710,8944898010968990710934167772370816765379846965311172103743060979737069116954,2895100563060833104606048044246656016901407622471819180004918143679777127583,10049128690674011365994516711808882356477362224046294433720641467109283787161,20809590643316933764584815864182144455784236186778450054494378700964393080470,2552959198983852034601282535517138215015669324552132996051383405020865478519,90024510729703363025920398892759893841503303159824575434815310687587906738,2438402150656393945636277445769226062775867161339657212187540106747284678617,10290839327200266675482043018636710429195359786802953032677212989307055380477,13366445998820331718698457472184546771717827833722684584206646838628538349970,12045715338147601791240214774093449384918104627310882799600088155093595426276,5295711531017416568724842720044505396040371477829249515344865310124246197980,16400063927954668864214504458520657934817841218321732614334739112437744352318,21834268150215228276838182444784793459928322632598421948695291555558497507284,4036405082017497222204927366812040809401891394189816634089482334837550533053,16758010699927998006904853632308429832737059675503937996784758385473294734767,6851323788614107612891077153396783509346340795017622764414273403342247098685,21242220940510077461844092816930517552035812681947928514550083154475902790925,13803558028343943472219115813916734264304316037691831164863336831915596589841,3876897423511600793257560948470150518761848801469200306022138001232700430094,7873917719931107857936523614722924550340227737594948157729078597073258431354,17791290553613199208672721864188024787529313403544902623821727403694762316966,4509080040196139117885863635009327583647452661266153933806446923314670630597,7350149044068266301432651752105457672961955568647004218727518439545294630219,11503072465150450162639608555774152895393875487845468619329760555955360089418,20146546283112595992038998747954746814923105695946909075842241737548546646215,3500661581148278300592438598016870333493992384875150415517341312342838567317,16461061867640825231072403805782329353930546739796841505995525047519357319535,17419473457085759867681212087981664406569947154579733189885809269345147937957,10330084554893529954763451132860402555512473901655458870771994310647661645739,10271306411842332407495000297515719691188342515212338700550984155237667774587,6010614376730465540824294088181704678570427743830238021642540164120787031818,12211956821531047081164047854393417207581329108889222238958146335322243725690,18026227011560759880520787750218090767851915271628616216035782860818091527867,18039053385352422125173521135868691523650276298214786020953324823686654441993,21572961947836757087236508142423227244602094617521885308238188781724980380450,6952631457061838308719934275464119179697248499343745875411129234786468691942,19811900079804396120677471049757957457743518480096470411626681111649768726526,163137711020707070877550733174177256426010367795106166965347507600009523229,1531253433144642057738530256773902523524280331634644205392973718192895734956,1179712150612295194734157884657760659826346075044485388437451245699680152105,2729710616419138683641657553469892671426309689560939345577118202079250084236,14266054344296739494440365684098525973737250786286154516241047965660978988270,15026169712587706365294070206936700891511371850326743083547381843796350317368,18744742519058537072956390943103111325221767611576688631532967525091526599212,6993198712278030093898597400393962073007955430382142820465138278710889662382,2553141820754951085470014997086944345325965756649326165555729099768987826967,9720940197604032044323074196225989267295799246574437528002073812640512558241,17856885570331180579712689563952926777618369125836010409080422245803122826927,9316647413775248445962902207564207480723728241070369123275732644991331488677,14494957198204561202111268006350266984666563257512595231100502951029167863544,20990514914454458611724181917618445270429441499421925167963524958552424564602,4471904645719453756418626304970674400441871174741396875599881395188613340474,4684361390046158999250125407700867527620809473388545037966531069883415383449,21702205249470184149930308057282607474924454457414198304211876480322358864836,14125417641286741606705374243071146588481196226954437992372061774013416347499,3703736300177825900679993762695155186404123107499914435631005694624510941992,11732888492654216406505460448043873705030240266921135732988822696780340208946,11933466978112969006229130396464073172307879223153980062784019174478752039844,15171000950368540171664824924290660122824429581656415561069429955358449308299,10369486846273450968605452628621668108353399309158716739554974304206007657467,13426080534643441487992009643036732384216019130391445221701162507604477874092,17202835976136422766224805235458239972845135749171745123647755691905320873240,13003013510914746051603710434071109936447243726946691715828935535255320452661,1672563195387555152025850519159013960714433928303467231569405674199001377183,3249806644396047380745964934114987054912135505311534093405371566690536038255,10852655605415322578561541069174913253244788503288539822168510897694861970183,21180450898750475729531605846185254439124003420647553715507766256141444893981,17598208134643261198923845998804266441503487273381944592003474913329048411161,10560430398658881239820534975865220513135495522309722014743734708940471341227,15940735766678288146218967299383564752403182243037693045705028442779781161429,19840721391058424508364187473208857771270089687968326863727366457103504697646,15270655938735284505864085399423312069359806468400434801172200215370037695961,1774340315063362619348165557959238806046379939754082379283600857530102490105,1931473872849034457489264575043647960104881629328524494861951197166741512954,16037503795660448209256659529206619750469738788435653064537663524466496564778,11157294725944164923451173319705000360949753554936504404517553331688337467555,1860977382172821235372346764481514761526862185187436148114012977011560461667,7554608809888667328824255380474433026692004240460849082770678269699854930661,3812849161473445621072899414157938525926417912914872301607900000816805333995,3248257538394266288019799770714987078883986769586407060306626631267726656239,8987711810247040851774885826425578893413569065851274558714617106373602624631,7002808931888012021033077336936962976185388694934605760542880449764655464580,16260071391005121724128685673030785454758719454582904114834030329423907463299,17301316944867831355470414388420250906247821380560618462329913428602672908525,19139125176792761113369565771916762091089412261263410641074341972472699592037,8186463001964086803315373078973607488567538876768905527322257145549601226661,19715283945499391078117757449557157262014864431503022516493444981357377102136,10201366877793384824708227219959809605313335011896439133665539069386849213406,18657679796594390529926518390837962343392692362549805385222541270238612706361,7486580570539115306934569904905950241452751461260355433571179343632374451808,13210602081373832317780583229140785143149759155013988676929972636959898239126,20547921916591862189543062064340935912295194861078724580978244369580188659785,11184938862747662895633149920437248716375494917732149572183883382335006977362,4564430184172465843641043220857544376847031874739611967386619487659896927977,7141474497649513954000384074955704105249233034539438859110223132506810864380,18152904455695511183625765039917137650094202440231199346119983777378283365068,3538073603808733813419298816140509998806938194073503117538238879763400661830,9176198085009858977059589400831647890975463959467315677036348254379008625292,5358677810755468005042017406822742639656433122059352601335552810789858869197,14917263528903508585499167331159661105708948785920472586609175307188322712065,17459264445642522670023202416244479198596207282984954048459225794985333792860,18314375996391380435570814127239902609672007999779514985166492867417826496725,3831982114680501270333115239154594098561342624259756350309439921335535690506,20912918104665637113589191778450022009791755974254243256571842103252066396138,13641033990672188411010402475025484333293999311081344333460071084676167264579,11812251882211406110219542299092601278938747815723382992634003397593468524422,6831378526897417143208721431885442730179700977603214290972417120210221051272,20566372962271447276247738296560940562676849411310335464134428317792972599703,12645078398048087182293658191360551774451388858142913314124550234755654392800,18848512616065065931619133098070120448249278799586409723288680340437325332421,1336951976108001940844939305921535183133161033109848951359362159969984671656,12850569062942139371781102794220985236887099863147625303610933201225464388254,17095240610637692323679811976243261972135774635008876108449261858372552686880,9827905280236638995189439521379169431346954052078412963417337148237294494508,21756974284757687824674400821247092844224232050435881799264172836701664225928,21071024335098050648915070341467331164448998348673899538194227711074199728981,4575704980288845009798550678411618457862054601563658773482638217288811407473,17637889149961283902802970141414602882266203898461797433796173000208254839889,11333768795263093043465906246853631488076833683398258097056018834885708094795,13237413177387831469342322098638791101575804381099372225484902457329675766563,17644690723564191319649063794394358703071761592119981992193950976485565800738,4591566130221102246468298018361020201365534301234509687763578673293960293459,16880258892960147740975242226985692424894589139379261939284621634132328476631,10753253761433799332298845732798867046726308621524332340930656512278172577964,6294042736878992012448357827249736553756583459648169754872627240315677645950,2668606416345354198548309314080005930475082556427535177631964192773305378348,5244780336143933367304708103198860683485779489995095073384345019218674347056,6113177497707123341972721698332981926287006839555002718473535918066824223034,19824522867272770281143825792424101858356781501070734931688923418771980499872,16889524920861245550560790459946848535789402393200784095555799980201051324212,8007523897573727144887255293212203546407757295680344011669395834627039767919,10043972607564040581522896355091368769007227979993058004755493078808025405133,10815879623965899246220301442969866254505652264417667341661157537312485515831,11534947289183790267549825879293816175921818072299730180286203718992863665552,19282679238458671513808783870622522462539288436443040483594699323647255140729,20993973658899710060621174143488118082242133512002997296378188507484929417581,2207137584463635998515616548473102748156816296061395772266322132360447742245,1906176303891379788266254493945992658935732580384991589403254257107793504984,356009908103458769499047304270411564071705602811825215044685668712377389204,21267156990661889558161221297711049481880243497825013463587260785886036981575,9511026544995595131578865949819301816364113937202346971334793771967449171857,8732150772674776446232653795368043280414095192666412295836279503085501609742,10433912179719211724964521733928883750833304291050102060071171195374738464494,5892753211405353458072760353770523366305643800457149832130812257775605711230,6072173732058843459603530982418555383917328480859906190255818160437636798624,12537411810282601586400313857613201485446415283134353086651901233218273826014,6917382548294560607950289035591212885648538608975878502811670462230179895717,17522466317865452308300593635805699602531255301383258028599652149794243037329,13441087273853521452830121325700732493909228483089386934391461759499905593163,16343244966838333682425984150791963916204788641990311583878776392583665902296,5360331632046740140575498209972912123753748791093482084409464010367952817372,17326261745640411514384830391871497358293487167841563962966663074154000109605,11832463539058003103012764436368900007479300735896611859760466513560696030373,9332530307651641794919337618798260519292245685937263028043423079258661105173,18589656636963228136343540063542372097923688201290293330159927366465643313091,19867733544550615468612533273987508641098463295160374186223389748717034468502,21122779377039628476144200947919650885809091682970982371472379500808529828990,3027016623356326893238890601376138710903222026620502687697483362378227239102,18688538985571458464198537125324538836996766056814806096466271703920561848229,7011851562043637216927989978271187524190844597096440024970832115577672150682,6976276474543022394298383474157051715295086098335344328214084449502467982887,17332130117530488369551999111592288939240424248347612731261799228734373086235,11760005773828232229811117479200618747574322788890348748345009852749579147876,2298592572354833593457878362078773063587664198044761229360308644323231458063,17955258451898615415362730916130728340133607644716002859752428726933265234272,1495160066997898368260698151648234013994510168440470178901776412293213577673,9194083678217569822513593808499809262580238989709793956568701401108176409146,7873147134182176342443626581580817861100691419143183095128784103924898338758,16767569430250994260298195321407617265691776202802582359934917139510241475993,21740623993440608033243076692676917908105712281956015230238773795741552902992,13259811027098062609299383180292487555512077058811432839971137250443197786014,9862179315713982904488948286370860706178740748908626205136774943873439543978,5283798667794826693954690769969228006851703579605314207478989967594232871036,4252584733067990475653166725237187089775889157323429734580856783776820381431,12973205666610532230766585121029838349435114222222352682635156927179891214439,287633827640277544463301235265949941438188349560881553375976425107945733447,9088334958857736274159987824864641712847858830802240840003039491617952671684,2339929702478917712535010770935571285116447513742167345028949204167372785538,15676860121778371383024352289403909294835655990865877574625753945822204636877,12764603061737711341313014678756180651482961849974746341425597804386430732092,4838308895208597109198370123135942497394705098532245211834944708850927126449,15227615340505775109084051882530634970803647261111629470904659446755110863564,4983488923883229416538630982432842594678976476580011041728398828823305128910,13108944499697608875788753758764556629418014383923261351989967790696566041318,12840723598548611269818280989252209606886290717050913748780108061152527561849,2952676596403552231673795576822772308483388566436384169804788313391241403511,6122163114479319080164532464109940924328926458633830912986940513870140253539,10991285734105320972904604247873526149047475605919579896179431815938092849653,7998273930160782917435322581864589776803914924450929021174489205585585635343,18738565009620163104846733922742158284630011729404799909319718271414375079555,5267789578561581666385683546519898747246978052550117863765974145167441262779,11531529707082144080873135819545917882620969294873081450175882450957416920799,18780101368050367674291690806832757013309591034560713102040071432479406757422,4294785451272921756656022299749163922793391211928749628139961864310109196353,4709384663557124742915933403093691049837232917871836683405730215659929289723,14881387167977166163300411047605462807380624840482159906092434632182882848470,17882364021447094903093424534075826770336257800280425962604559742290433282224,11702502532561044172145178834042891352292518800414731965233576503757342967409,14059864978850405613608096166397211820819484772138676470000521070869797461865,1780174207952381531321288553792322300359882548955331030522024911690744446923,13028727766195703514931384985263026051594836628118028800883341509333550916528,7588265429164678210439639249095081332309245305288210445601269417147124081569,9642265589138009721420730439928969906364025440120910401773575492361904450076,10203823545087224726196594521548654230876294164502500177215475003344697986058,17120058099854629688232575694825768634386944759592366006492580522962871073389,4222192359475448381394699451673800507222765289015074154697111370954996368735,3993784121910007141124454385846036053674166308991223986620192089439929299772,8723933019744566416337803833347252328328807961776170035099333968332078001000,9712660217038548658606833881897330347907173853654574936296015219821374200265,2760535358459121107870901826259907500576486637522442431581134088651955908758,17117109873353435959712351313249763994000699552995926658366410602189225375298,15834046942685590805387820842211523319635967093317938586307927436446892526328,20540611330857822392080560199608407622162192943120548518785800532555099780387,859364761671967022958373408533303411107861007743219314752373993491065278500,2969887420026581030514962118165604753428498019600416703008438822193590952680,18165207804423071202274226128984095583162198441473954125845000361590859071975,1625906472120027348769657238152772240899619610263515830625917309020852034930,20463932955653127762144495520150037479624855783264043490725916287067071124695,4638144661708592747026214570394653618741348169520846615537958570570478926642,14161574596481971299443338101939032775184122775644932228990090697003591542529,8347184524978696917103428134030602422953969299144482352589164719698955992623,15813323300222999983430155647025925955486314051966513470055962106024932062990,15881789235120065904292616653574390818033995432226550640643889297228035707625,7140692095240485283381028349925581289679980854833888018152159900503732423858,19010917339674038277064587622527941116247281757743905062456743932291367865210,14626089726879708665184866329935404127909714172968102824599946119716141024551,7794590602415713436531570478653055404401179384350609462543106242181653823825,8762400452539506415642761970628528841241237486958209742944443338295503154358,8591771034219068368320608087757251879675617969654197927442982939795060041474,16722135923767200283514351262528880285637400101562656889998995533577538049598,89464124861540540773346410834052352014308242060847315373495379383140228595,527363371365063907312062782674442937761539145521639367736772902232593392996,2507841963726490485511335482108618130879932510673214677761709746737826243610,11600559113928855816564236457966654301430060930571013803772049573600205529037,4588632959705258135254026492226920833318427708514752831324568512946022675194,10614112216523109461118034753484116653637318222297437542653638803709000476069,9172525851971416839816439437260881435627775489982516326698553647792223169716,5792656644651436247861358501481981837063028644438334753333821264192324104118,12896881102412475846285309217744373816727588379892851016206737393174951411645,11468716910877986153680082696909131615615571055661580004775449060276352989554,16433370238306953119452573705529989067794419309147323079675422756276020408035,1273883504219371718563834088540759123243117439006904940363157254976913033897,12035946135822991823593467599431819071656367730183582372112230833767543617935,1584468415480349659495095652095228645182004993793756033988320959253925346826,21386287619427343417104905630296265178906342440158736945069239788114458023785,8353771053561995945612416527531464945642582086497086814556341372197660908215,21451387710023590786286131498774138351594763095518652036485484549943942198584,4310607037909191923700937557843586755810945477870372794480216273434853743125,14760194187040766562518106717503624683554510559335502353786749509033100485706,1989722256243159180961728174407914946336713030784288455577084756567680416269,6686508185527220254925691658356528598024140978521686081374828691583660936030,10702736220547282218129581824426150350875608542279410979052446031034395032616,21518832429688884430739158604898893220375510075322761868526168806092202700739,18894734518217824473490018310535147336620281698236505678307171602214420149474,13651080497325379255207286313267854150042736096310351308026009382931418587349,13005423795701931110183481387065874846108794433756894029607220148510576563022,1791508640954698127256430696076954377556671221508186631495000025000560314469,17328036510202475587667192203250772802218778208191122529787186719212302087427,10657963758634548274685968417226435837089760791121929723402922305566484150027,1373906129582260565717689440357805911187492936689152530374097510483815842229,9959127778329368795108284764279846598110110516049484774588901738715030294501,7658768549089819420025961609972525260083323240153758777076357709438863924071,8556349016311563259984530239150734383111823917689615136867121162886430935013,5584784611907644257624218172047384219563403421449130896517357173082649535408,12250428484720929053394094480089037225116943346244386549438429776642627577081,5894587027805929865241808030013307622768224687737099108946198448930484926182,4640000227377695114780725548825120725107463526354871525420448370293105443156,14209260856334030476503172714481690115491571124367768551485878619193949022436,12847259932859893012278918973069680996469229489435970735462165583338364177587,14707765228045361126133465815432967736466274565508518646993164305646449611538,4776938221827642494595066454007024055266353658953900973539209110395754289252,17345634507638246813894504405651157443245008745673515073520154967327741083655,14030342049076255140305545268617582878430218358427444316024303212302433090888,3081608613732784391792246085705209806228642369232320349344206761814264266822,6925544598968002128460287121334907968171640408686960604018975554503413545297,6436833790683001261207201071187060041301666725391276179040664384301147754533,15822971282077757697408895884235910303980603368062126288859779292088533186609,11405645516905544384081084440311050207481018746793339445931815864373601814301,8057851956466271394801907096296448157702512819801554261185443997708792484686,13400701029177845728937105456192536667124279186738602373189177143094323643048,11966218129646969536507242899486947493941404691279766045602150839476320695158,15426703084090770508053125497176086377457196612492405232875849008237608103107,6284964429736232174040445851307654679317453722810844133660225254133335862235,13541475439682330895175095901646773164410091796597408681295206023344696136380,746760486363018018017386520506969904420399625886684141218702464564311095236,17524104887381990279039312517306518062132617046713819525042298049738730617133,879502104476554315787832344079612181105511927448955207253764010183827781938,3322243116889956217287455917347322211093649776443788544812848110324752380511,20993304704177227988946248236539217504266305909163005794546179470620336655896,15297086470600095823350435092749336605284701364464412627268330863173424318784,7926831990131610326614433341787624222916431629609577848917665290693634271603,11271157869866761687706729926953398656059815012440629723619426315368733378302,18299023753364987381538199358983670915973737470621191699559419975990005285294,1896523269277706381575521315908503178186583134996425770080392278759498041496,12890346501512276297101448381578516979954988837373044432656264176509301317397,50683999778726139626379750772467319774169558910797110829251191014869406584,2535823474764747710030290051647541950275171691698903262059516064562837569538,21244438525273542723000364561332886617309030482024380299212725538173747919525,3566180332124074953578668480009215478053830658040437750684892555496819182968,6934760873335280553519652185111971021084408206212600990256329557702647231767,10716990663016621229729175818785901525044168020825517922453745625674725718755,16032906457960033408967366361214250817346739568272864358714497113973437241307,3843556041176221664914001975628278428195138883854078534543734996192939783081,20159201956050700213417267403145919082229292739510798606395981692137742005549,3946206250066677142194595031646387588831888396304269420593204783498093935566,15041638172488186356886629449548027800133537204416329580391498341162500701165,13278796648404195845011313500265526847654531008699937318834233691653233844557,9401997027308433525669054020953469816624994577441846092561461184007344721828,1983197599992175511555068756140439953159901969155075046465287261273690782516,14404434816783701517710626513536590424905462755924351795276920360393132910619,2265153992995968786485646516094566778663253373238301922539677847420824091645,7566790081073938501935204486802755123563765476651717380300659543531475311797,847895502208273199247564103189534214890423186204714047221696858073193176165,11963011786171849258296957535441472428283852585041548938428326288746833247421,17377294274187023009074658259347356248383537938503682836124988411002248431249,1025753579901801011233785198665030697958075722777337374303401815648687864152,19284019504590857558072823196945292661333776228606049953803221551974077538854,314204118013777455817026750462293710777754680076389729833422020056750157783,16480262479960754021966845575947830901794064422051876558808623512389290214607,1118467174052506904085279606913979573425427098904935496893365844271017524128,19632743231294128529717484081406317899334378150630214776880617163102648968680,3911642624469919820429547144355740104724495930390962678347147942124333228884,2066832981312040153658964981292230050110396574171753029116180129049784719869,5311750082320962006044746418239249402583149931726835813032955695199748985964,1668605805291951132468779303736499626803321838797652736089353191224211818512,8117527083300107176240321998574781132203045054266787492339353711594335529709,21295747743511951700871264160352432803897824342737595930859857743511472313518,17388383598447322131131146498858701344049179581377651662282122447439867066027,1285164961547283134680842635704675169007050470102043475645519044978941760131,1875066966449664224570600546742926101175136253576702799078476168727336032193,376316574400845651365366460471492295014146006765806307181242245707469972823,17926797393698382320151787394969682377223530524132422415508830165925306730854,12888413344274698384267384086384474622307363694087246755565655858542934044367,2287154516202749380541196057272317720805230156010471100500251268302509398358,12091269896021030725381711946583875149737687962883250402694805482865888072651,2866048333839936509265230844807967492604533527765757660355779329791008604324,11835071699154512268334373994146252361488263767766913426957050581680705629365,9769574961167512396467538163460983111263497516872198932597594846643533678886,6652717430998307400653769850757364796566010885765190753303419969578998970914,11706514210298927940240806568375915039663039872151275540599047371226868127844,14503173259289644850389467422758670421081762433800521230764199189580041755978,14819563269715549434612532555018280611140077716865566327825448288943759458075,10680481968851597237106707337987338182186447633463836689709242917734021556532,8842568676211857695295830062491586931539601201165478151045194686251206282625,6530738090493870852939715092085577161577833016969257865187421674974986108366,9122348442271830670856465114634608231502719005088669868106730029655164877153,8276880496499930549062062890222235677345093568048001523633692507246467514288,9159103567267771525632277936018480854652194329966882107551346987942837974086,16469319105211987147868896414457254521940280033150431057117354850784171354412,10187807714948737954868581824072203418416253898435396377923197796615888421106,12487902950231724077418777903531512931204649041424531773792238730349062186046,7128847500406995361903929050204217572789701023482188856789540128660376992648,5624482939513897521205456066520453513748417048856589163079298385117683428424,16435310041815433976313715464222273283215148709695464992270777828213079073600,6053110243546717824144224394047966869215089006720239359415188827006018953287,12155283178966050547567835509058470201630806787546132608678364857190533906654,4516299433052637321210501303761417706907638446979735686067715866937355560218,12667848710309960989666753249292981950689410172688589690222261363826904222200,20798966719534261926649504156624517814254561351583702314533431478871413942185,17967549743799112209110259394081841952094330269294500558315036929658897218889,17847714150935110939206476281446907230585782511584357788270839909827513843593,3706525735092193828297046649401002937097518714707649753675691741717374375329,7951431498272893618049118070591089643051946670270891223821638082032777246372,18050610739452223409884731462410705437134574403721907246909018802102148878228,7681233452521913704953218921671929208806506209990716853575264423980840711485,13423126358538883907022095116894303361057277664724853411599423630968340874618,16385186307753207860551232886321416660506143479955163989130433021552655688751,19863338799254785908021006319182666048802363286601429063342266271260238637645,18613864443384979831007688916611349052439959929170133474546815634162799183324,16332951432721718166552572222119667287478083212745997662304261644978474988848,15183520838042840868796366239500461619005160337097541115133209726620419190272,21819632461581352219365791577295628387565956152415171439862191463144627141459,14048533271709057229957508911818231901369646548751751133058494379648714713155,5460165509823151384714546779805746551465260311624889230527298343216031522426,7812320479950772901428223193019468171803323319794359571259026602925413892220,6861047298949697363524436975701264276161947671796912946484193048676968364570,15350000814702190667768044439440847568690389883802239839819456575900015807805,13617689242559757166326885110516025083265117478902533337635065578646035372109,7476843340092386505769477537028758806323421556263090744578424892783190404262,14826737006932111183364733677544376863485041173382717893595766527131815613201,20482222533304950354756700764919164516648372491559583778492129756055561547902,20761958166613639518991371846609568602964716408676516216766187562459779452764,383428479364004198529582849470440881390404766297544454256885030893768964772,9096063532469724072461386558496798312147772678120608720218640484115240695555,2933312980053872879818024429044461919397766967639471518371949595510364515880,9299316327986512295931957414766538459714522358165090755549540858707887390215,13488092390166418062347006407529577052576958127764741552594028975338262414671,9829077383468426688376344724031102291718825262406301642537010429132676001524,17306252922949843274941351200908184305715966839608017699204279919732909328171,17087445274779483487397521683084452362124400111143021068068404568736590545834,12957176730411938817539171430465916443660534484629425102659921020718336935547,13051137677735706323786222675600013609665436923061132301167672971485926193799,16896405620483797393236904159048703206424672638297382666760526590725313874095,12982786219003483259026043754729673677479461289605569386777999422861331902406,2025152781178874327274493576789397778291707054468278801142821085671743579422,4335304794121497318666085856101737871981186359433585080678838732369068576376,12639022425423716913754007933194900468141465623346480681305462334218095484056,8623058240535559764777469232729047628411050024996927445391922152785990079007,20506335897603554545414833361572976187621941529253485759521266317325651663673,21253532477517846630911098846446871983813752932337294199438073014278982612265,7690372912700906813961714562821752274841425123411432854046237798188463759714,14774079281706150157728885377093724231164512116594840467791057304501073046227,2057509476014278951878531863305791034496952436217061173216277825372715694262,11541539364361827516114507593054831030438985642093836719960774810015976254752,14751271529818502394785288765886130704541730104426205431367858892918636267768,20653824984831671829709191706456216192511770845470322444515326861038843106056,21794617070379980226628233360507465028625654800811478227502718633923944312665,12337675699660313500286885345145964244870355316351529815248466118884457457726,9527268832683847687152279087478212995292048665053951255936397859316414854388,9676848840550815858798680133955006115514366150476209999729932493584446713554,13718457801302749437654397628557435190188493872576865462727587887532950355038,3867324761996955514268635801392015956546058763053808698121442586705196957126,3945177530905850250597694151686052963152292050981415927393741981018273529029,9473309264240097344589730948390594137445381539328377904021534848676986947654,9996385364578703060792470002743943020203968343080025005448261317627854389642,7671875350824730767796781844941080563527207835942241721783016221076158519589,21342545963270813418079341151020475012992255268798567166496112378940512106806,8273987785742417777035293384288140933989540189974521462819168552306151314447,16162516432221515902182136237589464594279404001688534734264317844425059661177,13403805360231306331901242144909690435939614369536490494604700225511328976179,21640586272648741017978258285249302214133507217427529405059807093199643534960,13103298902142682492657114828016226525668797790480257241873358498200705227711,3251016042668618943397347852790038985788901898321438389540422820491143534512,19418047092207786422594959190763286166909227118034848590779428639908706128141,16018739283901993654877226905623763753431466873170287728134253742237701259452,17444946939314191179654576411859454283526068144165928707555552999432295774923,15128585121813842824984220733706899232093493608422847549831681212432769497258,14256042951767483060181875165067417249801798477941578288282791927486641413650,9120441102041865153472829977920901798404277796873323854759847010789551358565,16824614118285494743762017938800453590083305489658290570438237922163546634147,14066296536773839458459021526010711790088172526749593960873828093107983908643,5017173601281838065126812757441844223954524936921765951283764327160567691674,6254306109691187702602819001106221686689064495376117914248886700342291435542,8093845266500847743481398069264511597137596242374064050252920004891985410254,3578536483838573103029984288079029549393340013685219142070711310306738904812,4046636520929111297180341957015914921052723918845140326762981717454102872515,7446649718318072281388998859356555024817100796345520325890349758135889404482,12366828085438268177090003236704251656102820345668679675414643578247762288715,10235336658636336826692093860668421345161445948384101191460476320469211290719,21557699385719674753050624572282725191612933706864216121110471118396873804204,21676195031234643974566056999169564975565168161106308063972653296222128822558,6363029841115916180506080615867336124807912331702908898766344258887335068638,6363363442473598630315975560083028488315295047134858188348763022659100540644,7124701104304155953181957655778532711129611550814127577450223681003954918096,7205717562822389401795306034882449236003182581929449060008168502546885140420,9228704321577313703028591075278114440418729713968708821922150367010520752433,17614180549151511016628006398127365390131305608457060951973438257438000114647,6418032200333926158639440620980173724897942384057810379437154014285875236793,1563831431103246736895130173427149853201118983353993792302858411456255839836,2319462743404521965297213055024756354349733992588917297296444679195296432311,11927767606932195981021511932625975307755048477176557643420944859867328059951,11544836785666122785129617591037772824479186137515525949187438698705551844116,1594554937757396474339277849284988438779469013126014780880063013190163371374,3090898925598297656723114627648156566177591433413115455417582215942083585019,7446365483911748580722671015415226813450613606623816089630076567220802142731,7277804562221458254100595374565579800145724793164291138831756170012315181874,6742114513180059066582114839865181272182587124666919323239785847603969045455,17639336822454434815461281360929380680585323524008927548062809039584978130493,3577053914395256679157728351997326335158820293078866565158939674077090010647,8416461669288393104752370629542582785060946946477447413022986748926853429341,6094400991411029253990297530870616276561743402531435382960598226029406844554,17249210115827920255165876773266699947215322191164909559927557290769226533383,16910579881016588643870584852395328514859173042128957721312044020554328803878,18548800605828674358041671058553674062230830447893195908258772241250469878618,19911311709285615075760278233929935358167599770457743440215721586291252049005,14163239340563250030474254441824385465013759375574504142110478434407678615583,11636512441693145656185679602762396225011813780067642639202962721478584613773,11627821975451263242823912745820712501746551642630006051017450144021728526893,8744830043459757570443313311577350804214757169018319227421153827794333111861,15502529014760684785001315229904504412899268461167235130234930235025949266727,6349631474781311552829280885666605465500111601027794362415725063684145078154,3750521632595755853919734934063554601358504982902984744970328457148877834110,9151149071511054371049219579896119997746835784236581257692741291133486546793,19272083712610290647942715418077844472245445971738771938657138000646231164194,4825691749471936225587218745193692386291702673577201485716323799193545312215,10104595857457718843210330892798628518507052980455210862700838136878095844947,583353789674136864282067863249996585561603923757420881823548159264798915805,9605601189839871334439279312434848410060547509366999421152290140420275791851,9086947882810130237770476626970553738390827239675874433366363671998428155733,939087130792625935525433768373221635016459152936104283115879791761930303865,13281505022430256926767514868008519612680654933479762886734630854898956588159,8791789091182070262897704714134448615861594471173394864103714557845783501440,21362425094620759937169033441239641099917726266745789893288044988022041089124,21264794594588373773536904588090499011630449220310853635095227724956212914745,2201440000983888343103152416697093803247262395826184450099145084240341640621,3661470436482399872770855708635287053510507688269721514323020960038319367739,7839180633039164608733079650881737341586893235460147432870429877862925246133,1364292691308802542355455613317294540368840799230835218243676354771769346816,8772467089802087196594680904948784186594877728663145042664601336273257169460,3528294282612889297228918585517392070857581849271784732463382671241778115171,12283613789492092234060914364373118974353698674396863245366831728069561564466,12820604492590938203463369747918352644874868843295488782427665387357902190399,13019897240405241197543377542947534699610589548844172163916774096781016951470,8978439745720039208900766235834036199032761881062736449080983584518864263026,15222275515593239598230012498885809744566950744378381699594010392927659453864,6158846143100676033784762660398310184837175038752344358512599894306514737286,3419255917977463022603617504775890366430819682320515293245827217078337799273,2797549320616484645720845216321636133654549511963540737715630452964584943931,17033753202496389008484483700445909344644255293271694371709019653557282454651,1896525136564670388001069429586407694373044886658459111231294687089652643180,15410846104953506982390647924353051056630524372570695181992786623509940504512,19568185152800187670153137856814273221696851955003399523563214963248234462015,20371827999905064832491002071821973934784290275145413746617942892257828998608,18823477734276348993184895526705908983521278925070561827518170646437136680627,5656115226652970780235535706189807810471572029095698537591078819723656151288,6421434687984511183440563950015895899135677057679953590513947822215985604920,12040384754225464077155439050798210419160821091649797103441177013046869869449,9772259825341200622705640733478002328903138705997041039987261797557503104066,16498280031288829288227785307302736352936199535492502196962915104633784174443,2797879572297199909334218711222177900854374704477138347081058961121300793309,15644078107885262244699428484967291897698559437568086329631330880220396182101,1929505350484341295824323699861178332578728141996333839839142429658318709684,19829107623275996909068882503976730773632786622439634235897400991781002387336,2349581104996259830058120951667460730076264470159293978617685139254844279099,9982268711644224005105745225708318829304834159499232155579405472268549361372,9283048909915207444384413611285315401509676836116090349272606584736947471535,7228184586853275989616881380719765868918305938029647325846170897121335348738,9356148801854782728189493667017091537583121935960987886599900693915567464857,505609318575290577159607039016980344147219758564644283699477849237669899416,14366218774993226370408163695258733389122646477999733966996434517776361579764,2089359639878444205205504625611416181841134778729917955490118311877471215733,698820948911402576486200349924367867353277614409335325450207885100392818369,17294754169238631079500422194295778880256675645147530605338890302947026045725,5743114444764763990137499217919738961538814043960695215081370978081114004215,1532354676442440269809361487929394117850339080897231885482935144216545001511,15429279362464933048379761813318395642886047028548664371898579661267949218379,3996365200571187062769515782559269970838089444839642643284597375210723401466,13855942579438265547807447657820171102227439902714241541267837936207338677600,10017315263017624310653373895363026608166903346797759979504062819071927130663,16907630432341625239068562338272519243551636457245225084107387534876995927261,7499064872525146201613148795250282369576850162788310832273877734938523830020,18958126705503391332983508022395142836904315587480202621370522508346095401093,10592492611778631944134585106195825750734295091365114316628335289401976557048,10233935978161235645487498670591630814869863266947595645533111837358567006403,18003113120454128964459787917100973688362112412222897499908177070949705432002,7039143063746813662581342159908917130120555794319120640254054115394750527325,14642639620523941644124538953496946557379420056235185193901717503194398478844,12510354962778923417991098874785395513418703200631409704677335762559702597729,10937907264762102220987756825649855260366448774314976509103469790406549413612,2856291402269285412222070625188683697884675330846580808282552440813379388545,975737765008679829063246253813268073237541742979444038400325932865440884821,10846579585900798888776933082578183338805087990458930175500622018769094956268,4529602228982157635664617353676370544979061743349920696434925695574883870240,3217171861525061655884750653752887679288235310048470832136609603512214131719,8115945363448342140068934999604399115922267391140037880996539055087195710388,17017061429975823256838374218603998280878588780557395344098357759667769523464,17414822882733297737417491176979790219384604825369331340721407024843872424842,21674124478965998545524545297025636759207453169144537816299040483190680515948,17404327139726954519140759696696303110669221199013129437266401728134593481209,17114525865368445983838697023323950751616885090116888636158517909348665004808,13606067029568271979635008642466621607360271211611257253834134991337929444625,12697011972510852002753203688496604009044404157472710768958968780456921052232,17908262237776925120663573891641823998363270265606050465713306950786509533013,21456469759562487171462776687926242591840822996019886989101706511495101340835,266521013932216168881283771008004557613060760037591295825839278412991410595,4426122336489578598096667658844019947877597098504167195068107491300030650784,9386708946433085177945274757444606300245243689157314090008872819375610588441,17571201661176038894845217669278055388543910674470132087585433795958011317108,4455879691406517778738600662496288227132258098615032267607735047373372289231,10411615872931007756022633910690379435607807745769276655537160609832149769392,1369325193519585971093564667957731115918550810109208821335573114054160355015,11701493479673417478812558973813785951698004134589804881992366063053267216767,1604976076096057025943679983359889701146704427744088265030663068037609417365,5807894190026658662778129602314598491833803649976558289016319277596337255402,6604568830557716159440870492208510177395633789687151427836556682055398194130,13221322798326908033948171538573182873220915914806870794442015701313412462981,4276423994177015753526554880283981182675757973382385661312000468093685717116,20731982721228405909675906960993136550102478961136398510514645316644217252635,5084416110782735943752807643199425478022977025123417839387489101289418017943,2080632875247898509655097068576655654491657659787279629928499240720334125890], + [20214838738486568883466588390719332066160511773018226407137866846447805607366,7161524737853996242838650618412058002168848579199128467811556550737619970970,2264369418377007316930430297757084139629356094085160360541578125176213258694,18691044064909968568998201940845291098399339626807500263611343942450116503516,15978743992268694554518277110515494413411623432213713029162001242329212269562,6711615239704822975151699228936015251056551262955961924747531220602950448829,14954997163751606686696628499315041796272082739441018134122451910369305642115,21573550100361192110069886620445669562472881453105471211193858578537227040439,21785281999660091964290541777959906196912107196794342243439922177000502203701,2946923208312508080510106804563669422427642075683605437758174474435322095802,14039283821812338763616072949057938719426671560747126284782727998420210694521,2531474643515410792989587528850930504447014242967363822821359471367799986101,14281461695965914110119049602449207565231627068856382054789426564141005041994,2155595480001027852247471998853878746887483662385654030663226564169133356539,6212474220474204735846033034823136351584003532895558668927059407038678087162,21589299957493491709069669042662513245508573637668760884022386808061869005942,5228547858762057503048110033821407961973668275986265942002757629551762149969,1151995769496843179907951142523838829938796346663877830241077357918848539138,16195901973518083237059346288792924649902586274815274684503783828189220931050,6205461827971201267719191643863468322713562983419848159871959495317073732623,21004710389082547785746156915318076260017385298749146368429985483091499557183,10094301525352802553607719810440185681054064961117719137647202357989110756759,1174362264673060234121108394303385502501621739298129145129042091221378391858,14586772089804608057953886654898255839796797046217599185042293580394420546552,704103301411330239947625288325002010320119746677418877341164806595452864925,7447867166827402056774077383104558156866119014007569966692643297177923018546,4252152864489296917539284690826221964698345550054947572793948075436067436040,3675525234832046985215853449128143168168428943627479235047788418993254287405,20125795627598431311475910664717716586147044241536953058242999762934679572886,9159576094573932436478222856304524043339640337232471953289062354187369243885,10410289328536677868407694844650868516861553712016012272941004725559785872650,18813119519933909103102649065156934680537361290190751928265976568411443987994,15043786404237278119878717250753259786450872051876817420168142382486008024593,16614805203312302723146840789675006378900903626996105116400354962001922700157,899949298359737140980259063526066233582477211127560605822280959405167872532,8350589775626940122507262589996655703528509795097550101006133878991750882468,10881253968160794744779175936360108103824976232977458894007732866457848744711,19359742822671794584060954988237182553116341604406926658049749172292672638977,10716853194721085390661796797973316855886234718612858006131046035921078793777,1194676839570189281149587289656564753779383829131008000754135056646064455278,11530412134598354110310733773537950950490005376234226554463355736782774653810,7158806839647137330333220334046918613209783693378018773439140974716028082046,18873459493111992992450800068055835432261777460679870727272006783676545919785,4597339034364379110034269874329162788488647975988086437272199171979371177111,16047595573111403874356093398802733070084530893238592035018321960924442437232,192949463851654477795020911703008125546432931266166268873310745978202434603,4826544617576366487123936439697751633333779280970103286526767080486441353413,10372441609969764399977561535165700928227575842447057367716683958896898456242,21479608666927871465054861416648367371602717876964759897062141685818604541372,18757812710789932354215078701254559681588101606101822541277700443926569010598,8502339138598356500092304059172334649791727023646195989902300809704249803746,21240184871409684692673423121366677112492469214890212851758021155034260698420,2702659403779176675766431784851669876796725738129029887042678538644093630255,18760062461290937265331504644060340132840729161526164449611377215801441916965,9598514148929007169331478849372274288455651725546984183500169574552892743616,12460679873938368098608659480431260988399308425323633114529665233186673892475,20582262751655750693560201069767758489467289978119794831247596435694971251287,7495462389257720258504478831214292184152544822380786356126692935003910627822,15847020891468169726540675640439992039404102490965287792626266482436024810091,13444178956365729587956577087448840645730541657243126743158358416431709484781,975733333906184480394673719901416555779305044861384485566696694336272649841,3016935868211088289963870855929013645268121688015888423636516996750583017171,20123197829824640950428347870445510232078708523077317828689832072338303017047,18496031799198869774970797646230665906722932354114482887753612521775690376535,448875332457320150287933426080386825611557032389972932765197125881964153702,15686083476904717209874986881961195356503069952883501862704199048297926079733,7399632407841430295111381086121470926608686430000074868388902950170939693998,19157441199146430337309347165554892283908758853741856357912555742738097866135,16120175937370916934366957179931217076202557540631878137626313655342796978134,17363463873417672052573440102339969267068334412527908172228668014397269133762,19764937897808275673467150361977575240242645746672288031015882089680753193420,4264866715026149043371443488601547814355809386242957666273811883512215893986,15361071774597522987390988933793735468585435977940286138223232105339041682390,13444894080484049025660420839638753203298145906295848687612728375851966859563,21344396291142953621865942956005813155481114773979414786364869990164493168988,13658955537084761077271566555621122724333408573482369456630860179831273897019,12249794154563702076745009616085271813195258124596555920372455161542247237218,2325936171131642979629131064685171177284405924159468319138840745089808621723,3077792516542862676300186898187316876000625806438082696997401720196346610884,21531439209065692564653170259849715075994439889756241721092517464459744953429,765723669836774164873260120197059605145439283015732643840276151768662398969,18430565163341347334129211602477703661982280889871625277638214021594755964149,15168574820004856312411802521805000105968244665018577358614174215627811033660,15609931056593305381714243964783225295053513474263648739398875586829969929857,13057901697952283349663465856361305032896972742145291496691475939407531431061,12802339382735521870414423620343194986509343830854539673006232369799979885569,7880620299082787885902391014823825400306816285911629201048471522567587002433,11085221899164994413080236199596538381402309021910771788195135649489784323294,5662061777175931509849062158785593075054461300898808576328927259801174692172,19620207415640534190314969542389551464821476135583607027506853686406083753807,1396012663571482634431038119696061726217340333644346862093678929991918911771,2833239640477482582925766504780450890721725782645633022528100604619065406714,9289278993548596713194730547769009982667061443580050906003394115646319823584,255970566924787837673441110425992267446525707891905710167559324774004600788,1607914894461957709182037732125046273691353312066921168498378132410220447224,18182823650001333075321511247233769219797858542696762318647781137777390858484,7933393968545943401801081658073805133658457161128306876557740191220424567009,20347911076420909832061080138703827506796370399337016973599032573292195453934,21705355682416154516146726727072637540254191883301906287097797468012136754530,4393707213821090202627671673506613966066953344462172841905371093203947245835,20015218870609611793683104277034599032802947064261475029925414549380954228847,1857954279082383201486002148223947538500417662449637107611316684336169564836,17075622394357639776259605879156105089449277115338468776425087829255085998708,7849339039625631210191134106813689727565217371730065596482503614929894173038,21512601485458872387622978217203423557092449252654722032828165846830386134980,18829825907628826679915224363735067358668372607988097049308159580108100510295,20145344934445170391525281095510437469996020214770888614087514859850402376676,9313354461544201805378332544085825218707302313348145137439630918018863309279,10073510764514576042491642785075889098754556687860419668420630560526859371108,11174613823246619246542059297257164876488140873425479553593597508295299674750,14486836623332191458290523271325176557072260063250466764030358280051240942286,1932726606175618877183776650118686155013167275195994452359992776843317764341,10586981584735794740885178709528523597770788130558769643251430679627096503451,17058731514535449611097320348142652958393616886312564975789110366863616539420,21546144187559470183347034044609056404441744756503592317087407561629774536920,5681882870231768621749544290358493454695957383787481123871436386675876219635,6603033703828934401094376159910456525337139277249114676008536852402499584614,1075347119451441392402288921187671249679641364496638526228862984392689015760,9887880282527621962449293235959776308591956208594163166185549404667941094205,3081779595493746844428351914840666042619592907445560123915127502392400574614,11109844704163389102553826717541117344605357734084342755776036340022417198082,5060345909602600407449982784585458050225699107485058131116856520723613936306,20049893406143885619592680397871697055896501875354968455865404394786911398458,11740809795693360891733016778293494519471041728488086332325924371909574885493,21414777615318644939200434569971788107661288737252832241371433802590137831626,19926309906539946638451151936495517057597377615887396199326446649447508281702,5833294070005894544680949322571753681474561462111500624110195335953784263127,20316262126697618722223967532370347145297985363803056816800332573538115921683,20118897454905330779316757365327082825225674670546613715170828215358297124461,15893782176793316439240260419014348246083695310846638270933249304684265430800,12847296795001788271556697499714377689095182754228824085698104180563585670787,17258109440267943312537478894153608811927087776527641627893802618672319064807,3727185744255496747036491258134142468721926815259510264718979349995349167789,2377620008282598351802066487452475263179928244128123362464911386705146759528,20330733534745333298462159658402131849518313653717741882717272744687077336453,3063488930518144343621406800230347607891775381984489334408858649400823600099,11822391183098027641060542512210687183510613996100060945754635806285989372827,2697686870567304805976687716601580249659499813659634827192211658186812105269,19466890284409856892962357589067669895394760875472697889494886746493744150398,1006970646211395884475799222625896618366447925898943829426435645426534803620,18668143903499292595688863135570950175417970684200058312498191992564173409237,374118929819602952730503470915153310582862106749955863047933775501492632816,8098759627317959799834443934069068232617039455327629644555780572940389866941,5647931789489182000343586961287147762347200093731102535565999902997464444183] + ) +} +// noir-fmt:ignore +pub fn x5_13_config() -> PoseidonConfig<949, 169> { + config( + 13, + 8, + 65, + alpha(), + [8798508051216852101945770298446195263426534955832706109793971883081428107277,18986509933027080134736570007084643366993581436980149915398754460582000677690,12888632176077676513526604615863975427335143923557716212154194444095746278696,15218363940991075171925464923999816479227567707705088260324253815128900522726,5123856245344699442960347063644568841985144075867098178729206123344695866632,937497109650566529304426914695525196119182564119552807475810542139513078711,824338985948318627675352935105995425917124279032809525354560876904860400681,13942203133811236390194976449250445722833065335401645546668049734024419803027,21193497547768556525501812324063541319364865851059424372272833186043647143451,8250588221665279725951753271334754148372733354841465281007604695074534688729,19810263445128123914159130235504848033923366950322026683325764129239721093372,14320576994914109414332501339118128158228930675887122896979269439627163060693,18889264041663920880871940494605753485014632588652805059026615325416030193719,10698608730721598729809918763148392473410663742558667693804099019738511427166,5471531298285601691838160103499608876767872950664004448938449413930813358696,11457601248269622750970644898105156673192281665198367584690238105651871243849,16992951642443963917535033612483493956841253647152989134657936764458589935104,10681874111209657199770620844475073359855652721773538207614365548304774934508,21875342192304323235337862160226992419479798345905340775869689347883470787957,18783598503862573040343207522848147282351537545213737188311758281500392127423,1221270316640374234025430293653174054626512367600614548099335037611485538579,3803127350594514565431185919859613836470412459545124433755604579955078714169,4692704173297526575662787527414813729052368393667564364621548376076502682045,14877344233698668087821753402566363996983618742746012792982725192235615274582,1054560579819817802724755404438987869385528807680314510667741074193700268397,8052216208184446695555642950254618937388238814298100142455645263386380520432,21528486310986712871728288619461268100617012373791428855787397091733571140849,9607239927604256097021258716815750648977424271874860033430637795556811442682,2196312812082021938532541315765264710074289763312450521728804241715253452502,6605540160838083938636248853297421723407665107595785929587574408377531474397,6525948153406525772960169117380395975817023461160134354401655738067058124631,1003556227519998429556476568497227440137917634405973503866888411893650518666,13677584968475474622689223355399150668790874783709262452797580070344541448836,4272686670447940608576804106249107479440735969672981187306042096242258850880,7723948150633857131095670967217469617626942590283045283879017721699420758313,9563761958679910727099148022742805150896356950128100201760652748527446140573,2850052690445041465388681891454371728435601558220304706587137488583335087257,8526775100524058290507772716277462650712450825299014127801740914862834880076,3867865860920444582361195032750323847757212456942796852256870663055781206979,9531131437985240947539412881613144640386246585015365913532093261866651903759,7876176264763636659141490167245054739857019306622806711043600468363729864093,19195073274099628437757763039411307254419435216466391625117296911023053159082,17201596318516267959242478674525331020962456681235714852429128354797936423512,16429987001981270427843548313178399452962937303668954688438246688799503164984,2808058398896238113910841463946229560728543614115874664163904810633100174930,14219106904819518684382581834179422938681605045169559176622588393807041033595,10530037691301443797595179975755234137332257307745168342967468344289118325757,1780683171090951191330938815635375996828930714110381590102230999415067289139,20631152509228411005601100836698224543066495368069041690921190101674287477942,808499207021654020396580110067573161997188131641925849629551231827774305643,16396331554632517617174441423319546296247483740125085437207362257874071846324,2856734177282633594896606301173852733142847026457749184584827572766646232552,10322006004350928347565262203595059371944943723449117022023179276501731876345,2683049508597401695548071522846046195699870016352617057472448981851954812059,16247545910658018105089170383534659574306111291405960552997108542031333797235,18622054704352443244328095600847746501599243235049513145116519278941866455272,8702183185743408572844482710294629749653378107594727106707156268893318308842,14401120539669001367195063486710670290450638416936122540739824928865783084126,1008932491940705147356558882115440120351684984366727805937095853000783157110,3335415470820584035672268458205991064638866247863327497697585974180788121327,675348271572506248948949205284720732296364868854507020989147277054109697307,11425495584918585085965114263893597096866227224211705734884180990929134229634,3139501819004172358132939651256683854267531704642601593201346365873114559764,5783084359807455756426365693604321435940832494660634548089377362001475784943,12095094864547001070709219304829411865589880746021553931719922191437710414601,16318907049539057156624360879403805284297767691522365017367114160528018468654,11395679267999229912686944592292906403252965050428182621076890662342583575672,20304144520028193526915712162937805381528012861129116050582705669151951550558,9782367134866186358061353221055410602027546275400836771195060684844149613708,5028029607389470804476265609647401798747012470860555590083631854016382301797,9007627713847325367341162188681367076476205669132463414398773746849014673910,14471089911822534831111187815987523323244485794708545360218598163622346282781,8019180100611273479652907195647951337613619920735853449223048779220663542855,9047131412613791119405208650892730556330287685760678509615107996866748231916,7335839265467743759482091707230237155828204454352010285192894893585057443442,14787708665825803366954624175778735065630831061644057898061768895034788739773,13527353131634051756987040962797036674382517083826397597671775590484363794989,14976182354818370036095296869648510633049821903988384882639150664375161429327,1560099560219605560187324067315095140041097722845226997637592687804174779694,571671177230396783003670900588907847431348620829409362554250135027808522430,3595401819266532411007886403698316446251107730632935527816690692561072394769,5582619801223860759886119158956613012355932421337001876528290847176002785551,12913958465964733555039885816821695149723050623118481194340346951472209298707,10229385924925018504492473674441213223237935733123654864337438778499472034702,21343876046925805512584981384457719270702482935633311830189677174062117124219,6420204451041321645976980917151646516083600244123365393849746698818033299571,19251614427061141498566572096097506725955838624383486128732046911906166384020,3637855341628865891325364423447146770285076487178203925892266081818756628695,6291095057555542758591776864498618016939082736178179913313186141723218066258,15680673126007380386463552533962308522676179674235002556809204723523731273305,14161910492383069106925371061927425194676913565753916851706224000847740857190,8408124204639665996401588312942126836254203358943885876199057731364731921137,1799578340300310412035304211591366593871976523584701800579066126447600019902,3622312705549913151631696033404711371424834689912295490477655370864706883384,13273792131373119117124844835198348538764494606049066494384531598904652565002,14270260908863510838028225519201826231421616414346395482851862560529215543207,1633715375341396582749269086363023314520014551113162582725277839347569228786,3306641014838747329624593360740422499925312234577578401365800985267347686108,14198045292969051397674853108255956449504264447127690313478218267366467132592,13392638089393029927126006202520304645547980480174653070691229667854016527907,3343885948493512216041748082192584170148231918609106413514016808164860398278,3168199878854830552224332084447744849594328418779455928665560385861883941432,4414580242526682670231711868212166617171432599055299074136917305689841663873,14102753845056293060191802617344737652392043747319090694003879675100249630273,5573924339361534820906966230551252047468623512376332682801232194633308271653,21326161716444219551593862645873877150197335577674154159730974795774063715301,19432958264517639868400987651848393946587739437911153002798497064389336859842,11213890749343283806487445619338898013466071000086191642490563684623068539710,9198922780305686612592947154769134303077110139729181291466776593119643796878,21136183246673473125620223552691909911094171966517655547561646692807715461191,18418245895226184084223713341727403858051315526021187444511237652982687814864,10761950212602122725874752124635327020166823895511275020048089638533400314021,16715137911831586771799460729625653907150059087921720918100590730689273071536,17773351327415330719066508685011039352345666357995827941409702750841801825772,20231347041576378765333233596636479502524461869780149044300194060543432934519,18064563634590190884918686050639690971635922850408462075670660991277444012424,19311806793959939929201104461555154688516767798907269687984909834335608414545,18574604846458382436863152415585348247597412723601050266815439019897542533749,6791419133329459189167506884324613003818238896866734783035998091675242101498,16020026112470750192482231650248429937269643957555877460849721131766422051297,20044512180053459577124670295358045421070313597307221323295226934357969810703,5766192039785553259974801912149788259566859976619902528741727877731329189756,13160650100556144411626475539530712035286115503483655434606927361569861225444,9256036311849117781394603817644061414251138927392105895934210116699839233747,16660304826343536533933296919943639532544710122612011090406376521894383168856,5613106871918486982198177086366936520094704188389198685078718794779139126942,13070598684216243718425316519583985756848433332087820965201044383296972346897,20442537178749694119236982549472062379434941056035907413284316764767638577672,7934380525369255820244941077363404413659578389361986061643146925957595190009,5098727584136148023264970031064585917675686576590855834683443649082028079965,20311250985440103383589841574737981968195820548330595923330987127317084128947,3768224286214159313341476585351274256214081884717440852909749729584659454712,9851045187544813632080431293737874643968516290829960553238754661188963821885,19015242154372799267961042586541854827581444440949327264389997835941454171864,6579883332160451787803375748174162900180016921849643588581107525271529605849,10040045688615204420748720492172111994988850765670088109590569954563466338788,16200830095429004437461800470410149972585288873073724430176128378316485348605,9682955393234868764418991570718636989945366768432593131049879027562290804128,12304247432606946020923001398973669839540045070461170795482951827192644001957,18191542513141047176662091981681722742011120542435182371090664849144982674881,18914155310347961884616925389217412880576183372588965807237661684331120845382,13251661686687775186900604006618374427674252707179991219741046747323389941232,10249194086135063113459170280632696947988284060709952681203426883826751049011,18372233147890747575375422462203968154682646712463764047424428288714397527619,4638790386282413677458315728120268440302827185471341027696814407017634332517,16623961311962310335126734990913554770362581939583424145026358913546809927380,17860493200690068167535851968852986582339867469465298666834410487621188113531,4608305735853858774877121807982873005510358307902418229099062852681969399389,14245817054597951763417586258404021745844024655622942045401677661648532977993,3809843434538253198074703856325693344260532607506586917570357443895551048805,17962207143381407459791220803798424686492359980872541932770670422523978330935,328196272784453082510222579442282995329426913454628381427614217629272010096,12374354866281475555079168690683958365929973901084398491477273797832999248789,20853802547446175043916531515983184048009878116903616041233975407782898112824,21496110961478435785328603969876614135441859248001892605282920516413194792470,174344306580108774551764089189043165870298462272157912012996952342994211137,20687536797191141044727224925607387673330130224876076220260820047611716395831,13067331728561732140381851790951434625007152955086246816336518249186949048391,3797862935019829095677036741096081889651388634128316641681020782687008662828,19718547173056417343715166978970272483152981364164960220358919266690668222316,4038867288048886379019053981446145278427073511478003014108759946240227146792,18486919751583655613568544119169758176904901075587096135301780773087898879007,9808503221335286135961820380426080374193561918865479543141400875074697503967,11673653729232546119337900700609058880494248359777926756321171038104786463073,2206576012107962093523647385331312771747616647783007209109500521090968991064,9800772269959998996051474306860888030671933506518907174943285018516216530078,704115937219213713489981656324169840669771632134921090864597729550810437103,10450936455424589171986477572900171091143445830786569605988162504754224051029,21102186642636060890935221995324710172830713161820423345683707273376266063905,9163879187976750746407679763920281609583516506018439539723656773309855786163,3472157821801145643950882966615731480318387993084591537527672102896556538908,2411890225861629547000508300507629335095483162292985158748687911181232049540,4985409929001444812993021607654361988376208034496482520498705351994820408485,11553789937761176964063895958945223002657928340200203811287735666719305693830,16847788791386791842258653027481339013349340413294800029138566625971691859716,6760556724223230789549789607828387138865070021837886343220335025271850431529,20596400847159894247975659733452116044170283916549483164302854789226390584120,11672317719239435686809215238371249803784157167042393847476181444969645566102,2540677976918908199177572390470632080272842549139729131369041579508211107531,19442658692908544356400723297250992586408893464353224580638700020103731410947,3126219492402213962620193562481318950501969435505738692018385930122987610651,13815812651475874136168661258439176421344570120756240838952907916838907109528,21443943680756083274641262528830913057368026549878765925197792130996882062057,4605307168758134905354332635309004486671872776946937049460665298426311628483,7482893834680785986692353891953868933021236845332400077427554963067657007377,5511796194740668281350270549653399801893104530256753635073935873703864854017,1743641818114051150153510266165400817966589635697948934570080374390326493276,479348932723256576178997677888058436058269610751399398192779646687149113652,2911895727864385123299618342188487304466499987531177084686132082340794352256,20721945554748282229818069151690746976633856763939126384250406858494706697945,12250582445106986808691543043877193096050336861542243284061992098674816799798,1203513568724767846410309911297210537295690041996158208540636591896498697618,6015583439542775167098811213988699848659623500530189193065070507681443523926,13090526755326389175310761634465981673176179379933796187486632857997253599596,5204691423542830100481358117753845481374238423707185894207602712512441617128,13451357406880550276974168929055560555273701366887507611491312211347374906677,10327523031922710495308957226255708193968398139079389167803483310323608563088,20154372727310541088852354530646786495003018189623626400646862775892232254942,14022574434398251358742711545518515409780772767696241502841372748111287365393,5800935164580219886597276061890276866350374777469717717325353972942679889986,4950159996548574497193804912590478284182513481419060390699450490223901282265,16651189959199821925513089100199135327590269582473005780223712025001916349248,21313574815160763657406207917526347065428582824748947465014119238740065134827,16527537328830884258876707902602749401809299353104838028680907493128406403510,15328203752181180061659863584748718494669846163715366299567183721088123843121,12748724793783078481516963303490468110393403014501561235873124284244901317221,18960625031156828010763136389916953653374660277691326636541170359289051172470,3539001622988573864365704884620979405364663891195701665878843924015974631139,19440492503123228668247641573804742990539424862427319298139890001019307139951,20663734806319981969735713814960326046259899097186434280597673603867647826563,5638550801924521462873676353658824547611149604620661155399127974706744652941,1371302213304057480201653073728712066696195910046203705054614806040591336203,14916746318031473743643312292935459967335724866678950897137588157969538011797,21398978398848411648231431125400371920346497858046605440294787662089399525957,17030308547789363149594169656019066171879481623126106541463663868095060483032,2440921987343876776494963936103708492610319137255329185550543355589457647052,16578274606037635679209783094809437790602872464993592428997022911117833097149,584917957795662537423624049408930838570931949382380283787668885015699442922,16787159358764578324620871006477408253726184555269443751955596568136636185295,16078611438600534298861481344414944861682463507987217038328914463538066716267,8692607842423869778858860521189757647588004328790444839011233818764128397786,17461551965098847063794186994739508584146822190403534677972847044656722703432,19452713388671907333636730760656181158378071792518077405629847148635099895953,12121230247359921951208053896624893871654915559955364031951409301929413070034,4704830575919764561517254527427722789804729564629801789022427396957683932024,10670972751746137966064978863033768730585193577203300636726301560193269271720,8049285218762936069773906017628569610476710004139648882735854791085139873871,5327956364112241273910968805653529609896670219677653687154759819173833984314,16209531049562245939203780811684066382629831507349840609244051677227948603148,2041493598600414785071850826176044493717208172684229753087779307523403234108,14983712813504746225033809615975227528832540720868897893292242774973221269350,12085999002734552992271490964670175347983721486216238101789957598273374406404,2010148192415347724117376912318888220341164166588569584654147279107677185092,14204865408877079652583508111640133693635228399739312350971609944706493769468,13330601146337713429471908542961289712020817519764634531830442337284933922809,9363311761287060295640718461317428792455498134298183595944737677775311452049,326899109513011756995862753231193478723114246336082392308214181273112126881,21599711748797254989207108046977874436425859822146104148381410251216892766416,4801349866375335173289265243677780019445351052028447809305464229839535867723,14155733033291624452674783678844450106798515225633669031829757876654937709468,6249525168453913775215814309255487077884826362528424439922890888603955052499,14928369633463338040897134982481546746234350670771618196847518086862393490357,9125617238450534926549876296505645845116172794938106232962454586773357787390,17103886312678741706528259762965004480595318892735191450742885850881411200483,9561133527164819548073730465187187729026229121272078865756229410363525806403,15499339092812475393717971205752228601033972883632736148845868837711619810573,4039978125105304479934956398755842410107811106124175538862554473225969256475,2947887467809254352800319275622693352512539235808226814612313636217910816213,10793550355337981917672616521499626144068251539193270238994640132315408061844,15282024117559604646251556024222379207458577842775127240432856222129525583388,4938487600404790095807201685235688647996095712925228362099985579653367819830,1580271313232748704254579894100134003454608977989565849293374431242287188203,17650488790850180925611249978112046323146336603695505846749648092705166179072,6318477650409317961441518371381185077182540555690253948041195660104038462403,18703841587534276582593528858657361438697750302064291203982535124189673569022,6570410039872146139634976314211122538651252189045191357367613723647837080131,4058984348953256905202616995215664252962770887032362374636631606975462596559,18730155671005907941866324013560951043352315199408210078231145351355402093830,9651860366009425828519962206873795166909640005109793700260660519169015873934,5838396248515026677336009419348618624164637668061855829375740686597759055073,15333954343347884216807246400300286008899152705372200767215516907035196412750,1930765848863686695612705389177613542562429368163669004940380022708446841540,10766617427881894379670242247746203663519351900247145805786260703840625869300,5568751333625760749025074267385171935854368145626703295693077672484816860148,1572988267140272358245681202814159120843671145631424724491020423275325461878,19938390788588115516825752214441323822601991108943527563767657270216212171610,7571912702211887911260059806577378242621772456912160075153794388926572849145,6858979093205494695976875629144179789647553123886814202229119872013338208712,18762692183810081055439753242004382629435200839335768813270546391733006575124,15741259924712306779754554541398522471185852133913466875986860727321229948852,2627808396704584386154002253183040546217470699174068260518444240974395718442,13588659892026426409480708338634242111974891480475426278869635762077927444692,19520457627758833811699878500944809253730386938893290068023237193482219846683,8924178241223608091232956607418048641173985923478293687667819226283386788940,5816806026738575389886097663948769844875803508574710698349454181988557080269,12475579687915690911104520027833630083645170013159764349224529153441972577879,21056333315327274333873056478119184274531121536034759580035646721078602460263,21444457911856423029054975409869505918084415765420838103204937942386934191806,9510785855264774762445687543927870120017463057252636764104600528992946593471,20924833468200564542464376523632289762564405387275694375761127017107713239560,10520571364539530696429244627292574117914912315372596265076914837029323332385,15676633242665585964368692080238475248556973102970746891067091503318954352189,7605218463440663468653884707661331637891252539306862971462289235362996643878,8655416175027898012639173297596079731611447754405890380300192905812736625807,6587158966606269464624627411770696301475420343587060761712532930272301692115,17855802086555955087208003626983743721607218545075932831175321330674668519051,19637270878895908891611772385398729322367589125936403809351999767233932966110,13844120079506591315671522711954211929776840478156307979285069853392230439385,3896487627666829488959793133071741228529962458688538373863209568407375861949,8072922412250331052234441827200394762964253395032633720559799911487619573310,3446650687448682504274462997312106041057536787701884723175991150707212663201,6750980474265223706441237350209360446038939446132826129894534048737231433466,7932667749655660682554204871450377554998925079055538597319130615505233358592,4551937123821223485620220711817547511116227596903370212234130807711068597972,8450248183513826743946014093205824327880033986070570398677443659142729011179,20523087403588105156975104084680617581362696346833272310988747947340344564064,8021873326844086700417206574915335220587232800373998588094532336448721297757,21537680614486477925570839538957839593006098192503694567393749587557940631967,16568393458463797316294547173419555682646841229029462217197639056287054602566,16910235738263410812877183305130636228751042299094737782744154576712268208807,5629150734321853465674510845327410940323442617216962413835214171701329559576,12765131184498380847448550948920304867469527623961001350816744753387093810315,9954645632746218155245325585480173993199044803581756137160936155060542951690,4353999640943599221118281386228426498583991413938542575297776232303344359940,4598711079993417664489400987736110506328223791894077517963275447468098340703,17317745377506102303500052440899062192892945727209124468437255966617200532771,12259326473392165107331141130100680225887121989921120777667514143912156322366,11811238683014115897858309619999599808008425203222607881921631505596453270838,16699081706307776306233318220897168744889069844294482997417168581249408879966,2568026780472621467236485312283731374848886964214142251868040165224695316461,14887991441574434999687627633546581501365901473545173785249018184685706196387,3569299155477721143892535842178855295807355615071744617918410766174933059043,5498879700681283951662042539400107058426136148099967700430316029080607629654,11559660278391175834668360323261696294263059777402960440249595574565141656556,2245933817469402341452987887837905070237745132811239554297372991710914298182,16951354954717164970902473060335333600574402706601527686301478774700332367102,21515931335312240603168050753263038826093559960430063520103206567658032925825,1249411708644964091210440756030782120444589186855809089574669034358018078687,5918980335509160299664261285796224662727132279493574691223062837411060350013,17739377184579332650035245294019601185834503109963479023132769460626331642282,18469744224495747473457470133545294362819142862108342977835066995529981406258,5759336781416534390511113561800934668877971293662332789437681884454072500101,21332416097583521698710421619829192185814871724795352151990455290564854827164,14991738373834450996520664429440490206770501447625984036209559286781489862494,2292383959319987392245961291693765909376521855421393945872334290076611679644,20271880109317422113691100242542434637543023179088091376781918851828907851136,16343203714510839250939280610780086672320399980775100100207359519193914733737,19668001496569040779289443981105684833630116796777138243208746501411413314400,14867270521039301446053304216390047301289545979306959364422905455339336587211,9929001722154986846461251622116577110986506194975595510541659282347340459331,2420696236635890839197290329114608036709859071844599545644710485458818798726,7023164250260724184662962208964026963022579890290101367655364067452762770181,20508512038053113727358039673385440054337319672353371627416928672143778575477,824002554707189532054522614675201805472052085843409216867120989167259938133,8081396930643908204119214488991799751072819763127464506132047127093449268743,6146669896192112367311424975035875525640347544666981144388229137148737996133,13917552221424458749711502489369248582964839439204214559672563587245770000377,8550914481815010035465313609214308578203171728075688232687655725801893823141,17861710896808118014581828397113186358973121215643160735097781787683890541230,15595160929818874035046864313228963482705740989418337036962890306288699599497,19810339910854592376336564454416808551332919752503671392907063850461349060479,14234414635213293332305234819580453743707554476430770368421971402668862484872,19388187253394163585379147543203559718098061800153070411989058669962446974654,9996031022330018431773704931033232677865134703871368350999928908636869707277,4533799599412452199761684722747577946145532223581271248962115254510905734009,21793143524581931493773122340799146504825838409926910431529124937257399233338,19692292712401787423885461139555179726227035221831860547833110141089023723875,15361825934066824966062130821388513267446230286103312548685290096230989843672,5736434899097417592114701714539404395501559559582922276628268708302331297718,6034516841645751575815362526363553327142008775019507199148571280847313939846,3103941851061425456578524836013350351780973108926423482048781831843642166611,5899337062497322191697133509006899741055733585263214548357752956989422491317,963781557317112122222004641921550021210279319264222273713987285679221730138,12218612067667826360750451807845242059538814081271178077944945859470451709133,19859087159769083790343803575983864397266266537354870798907672197319357964101,19984410602577911276019354715470427122599274838994470055478829965861962241047,1510088699001180548764185585999030426586790568209473093795384481408826277110,6626530934788897049551186952232009297818099583639020036000874279734503731588,11102385732315753875246033828526944990963999730005798544082045825035822583016,6109966799003077547022556221879889867437672084424732190493586606121191686895,11639465666095459063122039730377449150155515188121884615987948657973378713177,5087119226269603720517452201720024842953062937909041658414079638720935374157,14200979596305023031605438052846373683912540635435718213758112152603438068044,10504614528473632996392119937661213820553616805799536317962705212982659337252,16896136248461578519387122861681641687612480673542507251813953270071486348436,19381803511891750827107737252264239897475475490344583112691529084617905175082,17541407330179013144706644068775388402691308134663811736351559302382670708984,15072973642203756087665519422382641458207399650896006837784917038035882610771,2308847250281515017414251485377760361489324048295236605725148595795546323946,12235376578863551481515043248404435233298457594750687771966106520323367004722,234919702386651406701334351738513931283772159856053034152613436560637774413,21637694258900941342752268794989465303386552780774074413553118735507317693719,5017784917192017182377763628730148212610872485218540677293490321169201123948,770314504054605850178900177028157853527192178178763005605945816624700149604,15876814891128030074112970202145286137873841691080700504603122203177789175573,21396093758862368540558980838454280107203592525118989209906020509719986520353,12395505038782995420136281017345429633379095201006284425785781752730355509942,4615582568807690433357570528319145785065741006112040062899881545600179737110,8043772689074175830138340191606864001269151441770005593654367646112660385954,5087060495541107066427394344208368671085864351635929517190622637786924485857,16943670806889779731197043466545390303516518769717829999301840370920339407796,13534112488771797914884729261168139500575711545907958816183168317604824618336,16825197446319806977233945546803116869802796446301133858223973227155555550786,415637162126135168159032709770391274308945193836031409779140830879628784155,18387406758235678040900363524694503366739497074863830200933011303909731885356,11179137042211084753827842203552443809484306307318317082624519139125401844623,21558283039234113122805760097265638181763687038555764258857715920818106215523,984886258318300688046776785673289560458722425831829175079944141959971496951,15742677322520864401961943379313620949320295584851281667782848443614715444083,4674404119733957791400958869998857022224647524150794463860851329191601384751,8650727403827795422786989886519743572356271096745868930429292580249174286422,13805664248894834838953946033892670782284990791974158822573815009987148935892,16425836039758852245186956621689031634149287919733928973102442742483370034636,12636984265967190523588079564146349074168180793368546716527682276529007569774,6817261026014072560057398041777830163991050944713581458081292224492038152943,3842591846766588833800550804121369117907947886204778461433916219752157723658,37271592202861207450496704231110333036724082963271323982767766566562691532,12329580473492550135339911865680237906360631219143722403158320079104416996484,15059957190605121115530324002634619045808465757564252411076061916764353063726,11049964099753534691591813062197785153610766318641253048434615460367998657091,9547664187984679827610628603629867733891345475510185082362431432235944303887,18137012162384412674879864487567137486356542869085283721914855801046173331814,3685098687651674532509991642879131752314328195366675630043049707942891170584,4350994188192128309646975341689829464702598370274816402210557114155641708487,6257821888636845714306847817710237763041012260573089876542080703522920377274,13253018959425522927774577647502632317700972755867567550168937147898302735178,16128520328840705715994832968486859989808820923410546017533359121760378044520,20170678152633918405966535017048153387865751946705242558406886703664743352398,3126527212972403378701842254033672681067914451311377332339121677604578433846,6867262232134903047018643171960682024396916574079628095990181177262447593546,5158367668931323144529189475506903329651812153505452886267986731006143844385,12754662355373887343223103245500264953264637968818954284520990187567577818296,8184207275666143481387081482876989547621596168672026673494737134509515879012,18182047594483210481213043235431614943690478827150601132558952379296218497290,4111619186005075315994626077421177613466749589414703176717884282581714875444,12594743600504910896656839099899310633582995354714016930508253088263104106919,5906863249972407611468323572776947701049556100204019241509444413033282677489,1980080210708070252092652836439362225685565242001269004929621280778029319218,5317272650834519781155258400716302959016815255066834148961703371077671280690,6755929511172704567967900822149236127789264783942356076752317952971695408598,756653592358533438118443361825151465623048518178327516109550024774438883797,13279387228067311574007940426672455425799739197632963751860641037826906383836,3438061374000905227745499451129047661964429059615559246017344409320261233525,7182178722730387940200728260680152279805701386434851756285719594136478079342,3232238101879637288089008409532896629862152604458430213480076264229233742462,18349073713456068979069801924492847615265826078935260207982474961526062084683,14669461622305417414928378093274931180941168738663334898025953986981156308555,21025953377099738424497295026970813014051167806216418684116056037559447904210,5255626714680656571286256248936450375168592101301691959500945926924371301668,17282802977887473307860913184523745285865757781571388182716814513918008763083,7631811346302144382630250446520799917692672405169780636309223495193617534466,20646156492067995141068212601070346054539051558428492870963989969028947901818,11672162857509134152068238052735772663152403666766041363264045356497052787977,11887096806532260110007600390059506485935624620297229185953255478078857108029,21264877166054737412301473554803422700628127592263555002579170780541880711583,17943121804479032447858025131006451946994591698842739992603829945304217132668,21741868983463662771047103688885133076855201341036000119862339617136906339944,1382607011220387511006322153920014038613273342046755883486188937618436917353,15178143370568504520122235741397126257210602740650018201900729283546561696689,19508797361068986472532319429763120919434246449052564653746851758275251767862,15432472447501574952637182729640656917161000067956855273526749406835661136043,3646314932117173966129769917469131878046956851972292537742853525040261895364,9954239280150263233476434487622548184763162539776975088510280448547072413987,2860206851873890237457963710655623849107446413141590367626845970849894602577,7624884329556925103103971646513913063945080531848229875878001163429377892391,13360943796731806773064110741074091445121635972973177327949717322801106153527,11667836424651042501953164038576384835169183507720986280095771344954386965055,11905856768069261907772799745883705412557691028383268959241049562161180720782,12186322648958524087383458213507970038354441682650936942717890758775537576715,6206377886698888214976033056004148608870783801657981445534961772175420895794,9985786843211942401460306610504559890644549482837388550821870421722527522129,7131871091468632512858311810874313071133138864883788963707243539301333044473,6863753977467122978046292703800221264317404999280683794261458513920582107611,21254007028585610870255249088819596192746568962023826736493046170403367390748,19316740566828302369845437096994220205932229807972164794086423967490376053120,20911390901671963410235703071566058542087894960862283015326592608742412435513,10947283094344459246570251013404575174415295611564471102942451430110207789270,6629514866202977686466275098623310374411361176607669574816969946802287210730,4306637640746831336889157874035984930432037257905593217438853767758187627966,17842812026941818985973284751293083233650807309923063938909281923223690155081,20979787799837328650256681706033358558090809594843147876018416522952145532570,1084395234163143750754914936597532036526030294466367212427999310133490427432,16411000398229165199635990982959651490150157098065257264356189234661735382064,19529434083761568271396183578711196610141016284281861529889071952129275189455,16011589790708451889651677332030836112945970875991060135355201890489173794391,18538965510307116327958097310749618403759736800399477577603041239573656036369,575597941676167484590243546673541695594364334533047994047106268896055691965,10154888807896331879146339491538875786991737788606023861857914666322797287434,5751458975032524671409758081174846089867075271579936974413090425599016414105,20537352507069134091732836326103935751238399876923560688100837864640768370820,388393267636951339744357828936678047569934289925965154807382118853267759467,7988929055663996471299857775851374803891818939607048669296465149104280329338,15854279006908524023292733986043025770694447645646628114187722686173514956837,4521251106518907970739816189092928174098228189505033700492425014567434676545,8157530011801905607623371429913769514135441595931542848447134013030997901186,17210220909122096186649472888037140871466614174061205406900504999283153448361,8320732794514386532143557744115700882386234810376915665505736773284988176468,18545875500168811775790253714678031231209184655369087385271022571392488988409,1254781372250935292066700779746601577560528849791669968836092329802026798977,15937651643466826506099692353730922248216886908526960483039790489122416783291,19652922102341829730840072437940487297445121681514373922080785529489772301904,10503757973376634172224417598657275807288376059467419568957007645015644121173,21061128242218898797612547848348324784465891245956046422267179077655910293944,10184102990558905165359578703213338644155257878926023646496853865036973561949,8666994074867894594122739436332358585611317775525945925668413909058593367375,6295777974744736354234904948599345763309384248069989076851179466032501025536,20085880035576919555482594174603593248431976403050445801147514535176924689286,13336325268431575611445366940808804882241012554243123490613520755178670444338,2851570355537839451958385805591947257368741486463662868962800334058987150319,15338540229139367100976188303076834527818508966890772601613851240301217961568,10371461591548028790292642751110580057135152343433828303350260803216047518940,4721084162843564631441880187545375946421625038671651491284453281351611614059,3995968148066851603072141668595964652983129138292929197582737382184727007080,7098475965261931921667649758515107427024701354618287208328785191069896296466,4781012573672976409656547624587641549313089733225902702392506095387529662756,20670752440000061451737406274881546918677944716345491651236710839944182745380,12418063571138285842036790076814486174694060062447109012153384823149675212111,7811816758498775303698763826175925041786332617584902402713486064657610670887,12183449593956360154917192849776155473122126272381798975678273623416489913308,16618893942934404572687811463808390124523121286530811532642072424179325845074,19406638405969722482660214331214972298000686566522726077456272338753715959695,10114896891602590148908922343663289384078633766105057337614271468528428689648,12530180531394196901972330325311958484582015641092775027610123114239686805374,11041683014697540482690315932778449428117122302594146671576370088141482310955,1320027017053531867758788220662625751339386035447221928720928792758652779021,13527787960362675982060947767740337401799422304150087254060335221227857899395,13729174130954201937892395283664312766703232538508820386345658917013576288760,17930242209772558948222336463641867165312462566025913611385142785331060524930,271824668681816275326818116439977879809479607030794905583278884369947027319,21830554400118502077887728598392792929421142621825963621109394022313090676569,6549136256809735363529860847857612644334750418268339758975670928910634751983,7685854228210998769567354902455601859064733599194469796921674884534065104568,10199783250519025166562439623829544304874659364288345176426181874053651581987,5943875072296398061174787119165901172801385563744445220331957391085927545285,13636089974665970650510341064071559084615387545694695884611938887433039781695,15691183714733597776429523227229000727289026713809002490626629956876436864306,8559680887315082801378048339294171503207432568538176257628851229613536726966,18821447832687547445675145256777518497433117070692725937727249438327468662992,6902270693879104513901555672223877604634815519768564032457887408714154308149,12608804561676097764962511762420917859780577008987930524021637882085147011561,7174750477556160125005376833627217199860110410544187422988321767638233689286,8781965602133662570225157578692327961234407570869748187793896100695809894931,2495257954047729673944010345252038964921244093254482708244520480856454194795,12653575930477027537985334989917636556832984698125835912664116078189272484883,19470590483773048893847572401709923514063082100887826438398963400593333077944,11678017778870321267772215799288011478356485408686518093768970488464471570815,9301784115496434107640350077213193580405719087632828834385703690626291479546,16099421215741601628246289398699744194733547679841291314995675269636375173366,4867605962743281143953362108297759970476738545503236589613425112307423983682,4859206625232481008184446590986037965722621081800881620559019195768715084241,16443855645256733949926481287606183123363410685496841842812427755007713532892,9353805991413463049534222956121131872491808501219007024034024595326412518624,14757310122557726344690376086282772240920466622515316103858910465445116386412,16114284659120061956470765697027372797086020387576070056735297826889023849274,18127578981196629851526283391389653885301579188814495702848892722544020055239,19887508599212070022669423370158309019634146887428772891372609912344825709907,17077080577854056476313617926548386910187074435097123438936357029443634140037,13226301328255541197539849574625779242079524439809722670248005223174137129917,4960598616057280250789993806465640165902417481299684068727179165412382990160,1556369617946500605910052041338863524761596681612901076288655800401759143728,8895728155072279486251055328673751534060735340135019245331916382281698263288,2289316141803713796617375788451106287296998047295030310234564594074457471782,5743949466604344050156379807720583796608463915463812355649877415948657877907,4559156913695113135073666675680811432586708455776982064075705161369076248306,15885688417651643378493200422346595912547116850227590423936072108251702846077,21139883658951849592430718453383511736537035608453172046329191674046781461328,13189533415954149093943176775514655876533454488327933935436293535694805743518,17844001788757965004299951292259913492254300676101367510089343929865197748634,14359892033284780014175740986504899257072848573639227540808851637993574775227,6889876198036781721490463051636227217181360455045088258864933221139868422058,4553935378945711471651589030479778870996380701114996688086418055402491525866,21810472237273957206786186837441232294905360772841197216403531161190353859134,9053152935239668672905478856994179206897589996100634932367989982680043213185,7903591118665286176079138425128951407213501136276774569998580497121699548452,3172076359801796733031209099819054888498110723937314354878294115265190182330,20407097360746745587552307442773353270033615342704398250066232913190814364080,7972160291863108260254701271534596191348694866685225653124288422099219831356,2512979638327596184144169725891221385374685508088897591186666227523755823449,12288114406943148383409449156486826621388266177895423682705260002640229785204,2564780208026103504658010005943517057775957652807715289383367743075323562762,1819044074894043026843741029300477751989386054356309111356865205713103547767,15212165170979376853314159201892286112393022743512259361106527770911103031833,14546339564581115494538806968483958415473632518920533358183015375037245948160,16595063968058690402196826920205083730698910363019110917303832709685137640608,15141874678776355759677532828036793885858184118820760885539425739465598163481,18904695587436094037528024957965408339655627593105121455062940021234808627517,19691835186381553427610210595631576698057108693742599090126967830113381498354,8924094782966746617987215970302687574282302360164926405994916025579749820763,19703754039872652879247596753980834118500205932499483040527802680246732547089,1222369520366776525212393255592594259431640497623436777492426726914294313696,3172344047869282929514752164510333501174713324035401216632890990510873753170,20343327187307675920101255252384731549311614062918830229591450503470004905005,21822953127524319865522817898285572788301109254914611303940997016471607290917,4119200650145180459943542547991468255860361677520024595215679941381226516262,884147971363709313208000703986053560492302821976778288962675801741886201394,14179192339259619376051698338290832703239802203346051877647263334899616811424,6257894125748014033621520751032796530871364895580315426488126143829369988797,17601756798422918594467038792255913560794153830062518652267418453154739852356,2915639491551461190644833247357672612074490352906156209159755564104341441334,3231102949049971084860869512445280179160209744399934744399854930563348405672,13021414206859086129077179016730508855909534243359809624497206694614763740073,19605385510680022189244399663099114503798708854480688481468264949015383978657,17021346162472827600023529413773560471771827295900312703532075252918830714763,797420759229039341104668808766016498233266139304135256309887013677831743527,2664903618363391534009727112222679446988960947334573306133164042707563086517,3385549618192271440433411525547058485954511711526716925876581944420956285378,1363918352372003902477247159358100870270143261694504161661979865477181878601,17725129391688775312434400553484246750421349715293800612810825705415551685950,5565167518043825254697387383458520114240098359236753821784350172714709788630,12992626143189731743865280272360549263209967124441767673953882659571766635538,11778225061486552005541072536540594809710403539663018251279263069564781285228,14855802626429861561613008610208237167206379805668816510881008293269978954622,4625126357862179281586979391899300109486628847801168774082540966299465334987,6276441096446918387723860737716070503136385106381280295004924708881687527278,1795411699207968753627657631153296652726915050129212264930465577194539027180,3713335398598470745490569816543380122933539387356971485299483223125101783622,8168117481656071903083355331291793306622574934522412245021942135108094609781,2572110912790333345146174163319527254651486901580412685997510630243717870169,7025592394229454054105021012166569277499787182283497117950324822835039311263,4277841334216388876550672363276475272389275617444687843049115977026804420380,13307361877516070836117482544809649307840244674059174145753388549462990581425,3541353704173386321602971434547681828071166901335602064587889348895191485268,7930538155879758019336102161941128485659185437630747910453735785539584502699,16450196550849346986145420593545138121140944184099182530791513972233505276989,20317647049317277971067996601837330680914292615460278222929651175763284855258,12350794170306113031197271161768360871903372891508108500893141893703359009096,3619108225491731892480788907918892224372271737626523316019551923666189881560,7777524276793695474644184635794903798228263960698425657257115554422141857963,13186962355302544705310483262369096768297692231774754772442065918802639434148,3194922763633786447595049582526939577788731446948460263029416154575517633713,21764951733983707370163229447076318279945301269175491715317016754083795809766,16974123712053830964644120202072593533882217585039161631414357628477067270637,7898037946204257594215947941255236785530939710112474014338432350690918260891,13624131700578417700359325726622999876995826287578399131977467236788609909029,711696429159123395134741628515974061981015372797792603239801873522576934606,4454694656802154477610657384658122890655367951456133773797632953453271645583,11258512209244601689743240316900203988033840864814099786180897714348264963892,17104789493255338246571119977680210285205025930099647162805883642403493155704,2453935444829235217884190831569908545427042660161097975703593935054598308172,14865321440470518031331143407868649683664573698762400527582797926467679386433,2136979677653477082590579842429661891149048368379361009535231454875783700576,4168503404348819959713764969732410335826536398112246387116198899646877476352,14962916637001251079646555121263487095246900845890500033998976380566908488027,17784806976263484298477702017969482877962979780736193065620735094916915015057,5811232683701857296108715612406368550641241305997590112572736833619623657335,1137391750177492513773516911880446733365510948924761786959001414998578780190,10377533661461362184186134231677823404558478220398261395966741229154302153880,18289640374707184240721457180013244890344288557498104400868875166742835064845,9860550380532355283228261241815983394260110595913388936133793178666677861361,4874241362571018447675014656968369345960496639223360836208429603461250621707,16865415500549523957415217905648921092860879005547743663493860402980518775170,18108918097362824701832555936428153547583210042204293837516231255476913995307,5814882735302537469013996470647050035634690283351899637246825700230993102653,5547108529079575186420571231950116618134926722630598104799502651040507258925,15206849009490203249915056590647669409740170384956300636367240071539934234123,1640644832819090575801198338202018591671247888384450305015978486631872758131,7653538136953954504326423293731449069773903668694073045541918594328126765475,15742666466329712178554069131786945235650635594806638864788722339397338233904,11117991054142148551955400250530241420008368948211075786946321189997485480110,17233487593470788370048183367208371204821743424889641470669677410605695176177,1026146833779113517033720464553035587620506307190537032842523110750653300409,10367733177218458884804949015952210383318098385156812709591442491050289560766,19795952047370883108661392932328291359892331001341014799939338429402797554384,280679929395977649114582242142346138466205172264485418126097892277002431011,11242092785741474644852794535567939603118987148698147008638503870866024069513,5042585848515676287159684547630780418802525904631814404423696800729724702441,18076295265515176256373769387621576799326851284582393083567912446445089657195,7379637951216509909219158222610656534687563904425133806818053082443647546922,3558112975941340025714332950698945379582897448619066846171473836063116876320,9573479360636272045463430387538379484130343682411115582933078720270296582700,15319039730033276973173680817870390182683166144884901717164880903880948070156,12614337451840522588925552004159363860236857822744920028925848657320885223697,11264872143423037953370674414336573063122101340016831919048747444897009600345,63551039484071672399844495086043200468124594386399597718753671627443264469,16482682562437246084957175194240509231216838776265462897558195414149416246757,13173166853778783824789219649923900522843999506901247221151336885046420684780,1129677032059045391430942335190974518204360360119509444502890845544005628775,20501934327919041700769005911882447290880962332107224642437572131655999551570,8568499318929533224876840771639984749494220751421895884374508523238084517848,21259500369117112858046793730986192593905655365067722159200063822227414197523,18511737784245858621248028192284641888665848600116211193811323135518967443130,18603594203971848110309624617834986072777858306337940642153570206399896731227,10817810567854821052648176407774626914880746517118466269332776843576340211709,11799868341887426863553231699803195039814149532556595741528976577115279703638,3757945008672794110380903983621818494776340526769633536295923729698796873418,21147309772231799704776665377393022398575359474581992532654566514687692622381,10106161080097685505341186856462439849936096425798398803226308955853233801088,14262263816750661321610690116851316864336319623922717953366014185440110799541,15141933436196205178645622716666344645155868155385407285733185900575537844179,2528094772114073897461542081006497820213677180486542945691028610950494870091,5348148742466995347556247741747876445951253226718284728036059196493410775291,9450763449774399387985728640759709076413273047954552646207186077905960887466,4298191617478880606290362740003112985908172107645583722035275913358222519724,17030410720819419348097350980058866817562528502379090451415524440163140111041,20216724013881673832814480585345314476760112405406761404693215284600396014822,3030458477787500523997196317647453871345579139634715247165773460115609582330,4498462169050723804654682081938858063245557243640516301148855502903911071559,21824371776439248570562107317467644300343374167209593758174011062336014366712,203060629973198497909844961226448148781283822023116446785885526153889141133,13138719392503582101372758211337939905779727766832919837180755391232674501632,20854865022095468190800800251894006373048202378274232848293926367900444699099,18588694216199791340977948229034824338778108765317256872571104367383806683819,2107723674718153039822163382990954569558924075626979445723435572951885590282,17271751087973139804430243764301653129405836972234862722312699991367221547648,6601353498913454241063626951167220829716071681800808284181512008975791453478,12008446685921630692928691914657961114819560167122558958661337441533504934249,2546793791363939452366278657165405700949349144309147725354170056455546924821,7509639228703028871971491982924543490428017835786144030628769546327315651842,7823420836979374535855612407590511724416995784427817183396908887631615569374,14440328435891567217327191606342183091806515070572157964854472183381142306857,13108790694241576486381404587677845524627865147145072471473988738194261674445,19983383938241398968439231728950534655853676209193309061102635732967764422018,11284194381233971884183176274626185331731276627680969047259362251065411330490,1897088360814614813239622717000987185543144416227464749796311263447835372290,5857538086726776983838909617047765193294143035705320425608254315461849915283,4535962484854275896801499258204616949002112470323390523101255172552516276853,11469688959565470671946358524828946654780293319597759366277869041848383938506,20012499472065515722935879215306365340460493343044867272369823908813586319215,7237913775106599492643101364689422933623029044428357142837972864389129948204,4449045505867908852965142075471111990333999619831208332535528566178225482875,18979580728127588847832634342765381189070401746541099544183581604411319882119,19208895793797113211677254952138771238229741398313608749033216609457932026240,5693339887541566707818870620263679026120058867908674300592248504295030161683,5766336473322649734565794453161873006745293312886382597938223884039108263098,10170500372500319676592379791726967782477062446940064561124188934689788907641,10715178415744481025577257316838846623444784908902638764026977772991007652177,9619234464729169347469055561718306819745671419829947117176160764784203967441,1725396226859654685724455004555068750501182150139117204170589152838896682582,12812488682187532465982035305360477706619015575668642434536603051988822585780,11634913038840687277143479351580381035995147077852960651195662158592298943782,590921624537670966145684975359593307845422616174883518035926979611039297697,6994357700776589034911446516222866144704328090940819982199063011389928815878,3578735612848960352693685408184960756564585180098599373883079061082850989193,21635405933646037549623279995086014983969914199701848464885184930399308788578,12427020649229929152974948764411072254994310665316587507041988661972823471907,5659276116329803541059701770846868827421187991242679567541795719989019960482,14409569205409757172710837837486699395207656272569912916147975142886221411048,20174498258690846561506592709929532887311794985051466436061305284714705004116,16144749571419779339987554753326186342500618892721832987727063682036648217899,5806868382318732909919594488299463205875390466419224655308941273678069453955,10943981499006299439884803446608501609107021429051016441936415463311572940454,1924938839701254827227113595273674646757106690922839787536830436278569286096,13979276902289154914577571664895855335838520340557113744304695510562836235170,6432081587087260245919599999151100148827877257649626745290270317469081484560,5063153002404552050282559105432952932908381495673902142745313078991883601735,10740439837861405332126185761433228439796897508030224612484767505999462329793,12737167379130609027705740172196108812439282784347836729589408028420120550933,9849845512381592257963507051167559787679646439786540183276617129759373853388,16005888832870175950940829700448047001850581165998249926419521156267014986701,14353647838770412975928759605442634240665383526900174470441397150591603642336,9246400563934815769990941385821129793696094365581285133233487333862515377594,15148965960125250145435338272790355289745702742252704183388935133186551786499,16453015856957375440870560801879892220374643048047546023962049108638908959772,19594591292469468407344408128396176069613863801953800169935974455228391704047,4786494574332708919915792733222077450535137127349578261762663721149074161698,11960730258074073655703739602687794653921577208052039888289111813676118677358,9848013027466807250590439150605527564079804116846510943688041755058752584380,12899034273953092771018315472337883592076632199623658827592500124277160375343,7444799755957099892747756300128576168091670485463138298855357993349282405924,12078602067619785815908569606330383217651816461769668980367782310218465279082,13207091244585343533434026539671489949734093160191356902826819065281696899279,15052325250252549646358568907141836154046676521102037138442805194847473405285,2221581370746975227443137026410298234625504939466881398515488592571828181681,20243663867674839549278772384366563405687275170339456055149452630358919741102,9989690042997457961300135390803031791688603090074435089369924996763771804683,2394175383139107454721858241476296570939299158552117381451586030928104650195,14935488700038770608988697394320688627203362240444723637257364275046157727507,12264662514829291661352518974189445073203160920355111833291657311513159477694,3827639321249325764386581723986872585672536887010319153929792264348424272953,13487908627465024716967075008462681337662334712641104635432980395748705243220,2271300450003775887579228062020983806396606091928055215698274988642377017880,9536464905154879502929074042077088011040150301676217212058440880221802373843,11224187363394886568032176392622806663752975492652881881608898287407285044670,16348011463839183311989740909923102224397330137023072134870626410011917574109,658746784212845073728972419644775580738462236799285816112006815020578863053,10913847351958014923157235635013414182776322060119409210360083568773647202922,5174660898410477334415120015192903322111803813558785977142572971088703464181,13435625677277740540867428279095038525759637068783477185816475988654675258528,16042236961096516425577672868221946711334425239903980281947225696871186016946,5966732498522491800452631630164751678119619125003570554878083612603498334850,19244421524004466175382168721538493986709062021717633087544245374056859990844,8953835349510092921386508744116096000868233729683707705475555286120350297772,19400107730527891751069598685513048198266948717144299472180340676627124394816,1788315965311520067508595535605409766732846405132796308898593684888230118195,4155306741635339863500551353079678816173576578036039224848730508326156410064,314333752297483020587573946457568012126281776266668278461087690408622762890,5814056308990522321998868808930979798909264311720790843253044589964499450995,8139572664280730177398240130505806903517588262678422575082094265546418213115,5891945033023051894996849367995027817716659752927558196235762187145542665778,15816119508706283096011330636590931848201515685282376441014894443298875354927,19765585883129509218113831432898646175337020355613337867993568030797990428267,7571142440759701899321724284276618755088451471808734385481644938761653631281,21372154727662886563674173359368281518527052830463392775221052936073944196548,7081252182490962865977081179238366944226264513969472284114001831030270956045,5223967788855971504613125877205268444815856778995847146009869071113923642838,7616031404430100022715089975212311635761004286094499406826744277117238450802,2964922410519663416704982602737862878081135021433460716313695716253990013571,21452022130413843576926752262576843465698254258090353961686699256674273446998,5615506565720477707126907662373732333382367798591588442255590186949548315516,13758529852543878424689721858680184284389257236387722027067085472062441696813,12270911407050929770266474860904788952698196744336477194920983584641315683723,2263765921105974400584982144019036516750696376273595921030243162454245412438,3726743207790008961875115608784686494039367610419333613620227882409630379219,12237143845448219572451550465877077742264329541226110387544727976984528388742,2409964261853228751087973651622025781333933822306168735290950339250464395333,10085433407143766997440158468408095154887290417940533218330090781308733416929,21228510717137782368419571997756416328932321564657530623869061270948157027291,12056471592273332515153939599576024781202771932636795778229482480420755693571,18213366556788088673353762707270651486693693110301565439057413547158475404035,16502444929714671396753943873426599559613041594477504659253173973027014569781,15099656057998038622782214961934296168421711158711759920714280998215172598701,20662687648270300297638887955756931826210498273982273406811895752232434295545,11319823310823640550774639562916849455005127799420683680222546170719181512525,343967214752520057864245186069476394037815047607811439097329864410341714737,17503305564468603693734885462989691651193248463782636796950758256530838277067,12741605036457271400687978857670758064474033476970216981099556950125969853613,20739683061558313403494347679816765721522415874620086168947803143944678465016,7946584883804172227025447539224245968128890222556746649628342784345139347190,8360187202053456670989734732945943173170474770371603015342370151451116337951,20059356712109588518115933733238896878411826141623495434229710888297572857371,8908929255369499016159063161703140212756115979036668550222341666828086389886,17260316215848220480068274186000229981635360232751196604952216075987952224195,16051483806631795891066047812303438046492064609198644392699337542232076970683,13616797129917979734082711158569544985901822934952385632710806021914842733604,7121878885265063724099916056725320671644022545379534508159519935129387437912,5095784041111849236518098036393508072376638346067943869740820917637881991288,15064740101319510049989912367011238454044423307266600930402588789041306100213,12407265211081220177754043474825255990635653794940031741483370307852381609406,20223426484470923566833281385864037127075416246760538371032215131656571722149,3668052915108225265616930005001596789890471435407321351170819088999432868806,11366073886283256473381607209905269811061951337531274662130606966429881340996,12582247379355857288799702955077607346019480970920005735329811307693949234935,20186938619235157734865577521404397515633405422805778974853873925656656294650,16122019959033821849412382360062366364664833933984337294691025029563985515365,254648902211450148074737989547563835748091091484232032343713819397130138530,12172833228273710344765296926585753189586602769025493553315361303084014018635,19945409419975886341220734130071717017479702410716315294907303154809664173135,20712004789058289094102947689666173023011192678139675809444116843756511650735,21105077263104009643989508074340105423304108979860049556255519287288188396634,3538342015671194745411221642090452794460666099501316339752121561502241774127,16008085602703591565147288064897579335322875565262127586367715180903703479852,21422197449727241817827580893411034314307602976542729347805156844487333432241,18799547353759539084890273894754702756999055145524208124647385295339036997359,6376647829380850860365386439681035038162788714588766405462355210239582784337,15847703763893026451216792359491847622491103863033823028942752373064363683711,21753518314824757010443592444509359716445873322887601064788806456493419038035,8018616956493930393966420225569393035642655431019891986498475494315186954398,11747316959744110931059298678334515105505609504722662598929370282308351440074,17893257331206244838570586905501874457956496735362457086282197258342214145307,15961328802051806619901962582575367866289226289028087772591680471434203677570,3236169926687880505076444874746358996739587258202752103445199991661738621601,187795190351727293099714304116924667408668969503996281039583636956966649638,239392318624502435385014551926381415338676314268675338353695671324466753801,18674319341781941734600473869568608233805776945980535084119278717005726916471,2771345443147472606857365655976656180452504182686204076714773790025740827296,19450913042313320002652706987083488807755986380163327474873550819278969177372,17088122609555961904069874590098938791545854926952758736324719542173158272235,4614324608780439388145100049836115973615823562529414178724078049067318464093,480346578559945500918475024651677711916332481019644166207062710283884336501,3976896258432286534710425248577923525874780501683135711905396303214796569813,19747713021879142821191045416534012039092734284665942138998895512844748934520,18114341948852128544591474427791645861453096798290403362024577582905309063343,16389740922636415377645046847550552757683160597807953014971200028725848855677,14347956677754622309732029695580580261895229653511993172444407254733241454730,7001790022045736128714608604018732713668075078108360908557371520612055210303,19272993806385013542500911534969336370461053778032527920746797814743961064937,20666992739220376856615766377753030050985727426420972006419425641580077380709,18907720165776367637548948232402401955322000052328805042740522159109944714138,9414327783699575006459158047005978347088459439117502202158387157394567126641,1092342932834424845294743018087259301897007735031966382725140810717192908054,3953337326499755715834998572085254989073834902724154050737740470058759118498,11743581671122680453195477167432558941219274023697487318378655108983631999472,14292519320039108746758578387893135567048390166844266988895150640926606231575,3463895766707893138928153619402823425980920627031760477180165727285868840115,17329024693549080975670914737054013479227561926835421032215803061920086593805,17069029917639740020306921281456148921331852897276386771126788265397483239836,17757973687563632162101087414879272203562112761746273122681647748208587693311,4657037101807059847480820087972588696422739806756490960821623277361176723008,10031688077390763868641078069309072895683953752120759377432369407780311740458,13372959422785941027234359900894463458148714364727687916236363488102034358213,21074689968655856473305620806477766182958744184789493409758269023421704332636,19863757339575916461434905195916835719746715041076078424686010055572742030617,20973060471220514134365115793881078818914475917880454352814198678201263612788,20786322802664930407040804724442246307149058272537433665345242730163006184858,13503324543441706240017837835235888103455201530371938269103987765298019164241,21516545371414182695629550949358554432241582789246093981854557932438611855051,4189468076924692882857105215398697213714749255613940842113064700527656187139,6356916718613787191898160559615069566270314091650855868585425220261360364619,5420879043826588690498755027108627480358930425000012254678542105050717051191,20559290756493460657385989162478253178529811977588548661414171937311774738356,7472237964286313816282734103247675024752524054147218881654824853569171740182,5587656354563280475935968622322500135733558246449238814064790207486002634312,10477445403396666334274248654801801931117602962284736619479124362799824273546,6964581565574090633894249931196779138063582556737680018364077690424381812379,14818621060919997284977287223747030674994127751231587714382341838934955054844,1561884120897562502024552266455149126373072574485245753929487036177604271779,15924114719216774839217247278498830109576711552882853826759218581616445364187,4632899269214938328686734061038562662617634605056083586217293196683107383226,414275447940334199421265067114189311498845927325050140106659496782723706629,5919841635132642392689439793932385370460582843320887853171556097049171723480,18213825499960993231734509662843099396992046367870190109129172304011496568015,19071949566664135927732333412944575018103341781608323568493744120181505633727,8055738556659889630969832748361502052460816679489752687851823555653740856922,18552532582629910542384644188750599556440125083583835015670173118025699825513,2484657787081400262201491424080522833403834349414361745080712757081157295905,16983418852456608800545535696543676988540233741050842886180695807863040864765,4238493546779457743228884918170815223308340385056120983013226844661472349292,3630132677030524902934720712211822367613329466140887879132884750998038269473,21054939309368014542663397737839771438999660373085660928983975055849174262524,7764728564558131555197022370274162477498111431299751237388301945333560774986,3593305607441900907267751550709584072658973999555174092879673804077111387503,932359123290353753331737736031582956463161520044366983625790109891741693526,4731952008769040870131753442142911445224559732127188801247458162044777478911,1306090977867005427161468095288389390649620350907397989639122170049060845154,7759081335204598570892984361955322222987825766180300022358547686895179745422,6447993445251075592811527795404536687284747599271434406060192746881971850885,8266912047004162765439491557705745929139857757706428454484671294796825044391,1314461175505921794571050454800604608649221187723852105188152934159567388084,5074821468464653205102869421665358795805465509804176663850666382476895922210,587081217806702661903500809062925367993834792468594461022841500167739579474,5264606314717935678144297576598053656417231843504500779254542039497862460981,1236480134248818593225404950925034920588295884010411301784531216110810413323,13089489778236095768305861425107967360517148121020346060932975978601131790499,17291786821946523371971061686693758035121148041300868933078085040228288669056,18124176342257558638062889896829524322479803409217207498687844328613679520644,9905839015283285144616603221521153361618378103985458187286841556656656429741,11809535677454857598311615002421831170743476213662971184893106000202355262469,4105258996829645758179809917480600473288889890938687299484408634005613929027,7249994723657380623014328438319457303659016324967581867420756005957067258456,8317023308476962783876206275099298475926201657427120954368652120829272222159,2011843005377857984465704450777581623363347938947142463422784260490016214095,6478487501062645568595261797056495837204909062128557523543545066559983302854,11332891765024246297067848612322823673574497640669814572890785705324624377152,11310396674827683007586339726668223579107272179969446205517750064367092175748,11099104200525710724155767594487158698174345291601467682384866473391802992487,9363361473795780293736671173763300702046469200956940247194666073284271734887,15151887186592767507545683753579108698447339021705506097120199743211891524973,19881265730819081878858384565138117903272592569639633426872725304622695029688,3011117599368717267651471428189462533336275598139751114483084233022831296797,17520576180525374756578417994075832591962992432186234756248866458711765589626,6155276852486738773749976144225301808688416984253808800735523464178476071704,8631372484444450448190767419844298467817852912545286035361602469665228507964,12205507917633391792796810613135648610406161967483463808645931187075958213927,18222453239521787308656394705559544583576244681888667325435264246411012699229,9033412577366915161372037999993563962295812571996632039862860993305238914757,19454897503553988644403623432258520403053811767663131188695520064462224816016,19817199370883464197796219716426529872878349643708961034403389904486407134637,21290720498988312226623568214384902017696056682729297309424737295532449054922,5006872489582777310304924776769064242968147807589802114955067857036564413999,16420397542367588392786684585727906891797023280517827697299749514608736021404,1300345640934139074405647472243803688216465663235066735522675025627248393466,15474333493788166084607018352361187159147026284793436327548632778313351493399,5141280817333171025837036045163967613491344199994520722703718097693724060240,1674845241197502896336080529694883486542569529162942594482168089081833468174,20749587232360151357799983517636847191215950040853109011833662933435613635469,21065338667581575565163875505871743203827212418043845343534420193848874866739,7051564661861006096495144384640210161011647325580302475305699820188085915761,1121065721208670659965039607998179107433568481023836429952089959263844401629,2114003185799450303041425285829091463889299614202766352631616657722513595953,3334382524507526203206024024777692800878664806770692329489928846721311223692,5349561335050661854855918228516028812586933810356904077294751460675531266141,5703041280392778021418588942391165300974701557007394123618062308100870196445,13673663050707034371520553032876769213055293448602317144467901970892454938354,5483873888673148302254721546416819014852587382013956934541598037319090821435,19318734450985860065269203041456593881321456849029001758521815811241052123018,12851330354839827372437628165464795441114428848058858241484775351172304561256,10041542640844175943995712334828870579034783871076347036534323366252583734600,3589445341963638025665117050103495399260947312205835568650192524332423143081,6240962307810325966231999724200767949498419326824465195783823947519631917688], + [5891205978627836991071144083270417159015157070199928807771268303875194037650,19534191765629085451497649051014772157774065629075791332793195826681584551273,5154833515272483128294702820663628026710043323095920240638701304804298499578,7917593571945709638335150893778153193741477651398934233734658265336884279055,5133163238095742835090645087711007173805146496653007212988348307349716673728,19458003745533910239158707983408152209004063097952693956218574434126899070042,18880819400751577287416293176849355951596193714265500681157024197361640709188,11433257809059443065528679883569438998689217744131300496692049205047550090935,12190874701550908088290603272755607342096152398135156662834905887211629834704,3673886960353993252497154566539843726250940370616316569888448647738018022083,15676037835112699420746702265028664494892600184195941373794207326709270851677,5045635616511022726309482514512221209262777381751689684810362174166837266849,2127981970274354891783037834911068612842150500572698772082540184222710046966,20602209860969247631763456039704661822909928028055826436834118113792574371849,4493454930923344041221912772221535937546211498548091351164191172571413962846,9203273896007845628978022785284502260659411177801743914849998536940830966257,8789969715987458351416076625905723956294447007026950650495844175328857015476,11215930522605102963220331022508304708093835095809374254680583403572809751875,15586225257380986275249577321891268850474446160605827963612996219805386502932,10011841080310254678847831138830289501574615297642717372149423820287945856079,18753960408421275836614693391945489354883623026056573684871883182548779915774,19761678450406536764850099419131825403291221931719095841429266089353917202891,2072721799733232450097521331054430993573774079728747665078766019206508544636,10615297085623730419003352440151421233872764050371800287995783143303761635742,11342862179098306415193268089882628716478112844171129584590093902612740081938,19276661508999391381559540866976056457016683157876039262437370976462342153704,3487982371390545412669202630006964510064537478038100559383689697998101381695,18019611455528497754832260490613820837001396745087990928355304172772344827985,18731969803319425707048526160946688629598037600738751037795347491343115736279,18895516979789867152215547520753345684534505439453679476362827176682322481937,8262582236770254192527817333585360308520228688394271238254948357217070957179,20124670759706967221386035867404978156598790198778905768160002435038055915086,10113512603622787997151768792636528607526786828914243169997168136386113705095,915897670578586705347124681284501818659263249883815809455861196950322359631,4168315355477923626825760085789663510629998017921421169386695143739645254818,13671994112691093230470350971338683534216964112891455368255908216954091232088,16886224211742114996348237388698196253930997227482938831037908300450123060344,3345133367703042017339663005080189359441174937067366586009093723866269451347,21528583089657067992968569213666076092311468898762774519530397406988724032331,15876161034145690426475777675897218203065468785806228994483284137836054650127,11419482087592638487692501143058453465931464811952523437138882421550619359191,4688593371456663565609532492788107789533208004746508669973851893459273665535,1201806670097794327812047975382630669548999745861216990648173033237996826404,4317641195125807665177432835324854194367911827066332519796115671103402289320,7278153623621857829571838333149240184056003767208572498343141321166882833584,5645725384264681461759518050072125001915558414870126637288820197391715227313,7876944044995178879031614460771670730631140542631541219377182212657483769883,1817650660807237476840344988506407016951597837358142384730920692904089879519,5477456541807551375261337022497006230056471139241891672239301675658950367705,8048211508931499636316723219242009338536169470228918968914286373316199192147,11051780522682663717015921863167554166331060525740053284975151807269395431450,13621239165564266256293257623306520070257833884735472109300551735647149439281,2212937635665982737914958126511628913962157442295931340442990688391698941226,15995366165560744217392074544914614299200056620022955679432568011246760194348,8186603384193770310414376291688089375415922904100458138117461272757184852177,19591014640167727612037871145675698427320771791339346286884839214170680861630,6878084246380728147562027775456286883121281123291292075367753371891198993189,2177050211387664317673794964274713735596159455191994291603735988793477650579,19810792753868883549077084303872022596455081266982011682803771833184330522738,7185072414158632003497987061744951789947697798790757573674746012007540132625,12527008463897431318214816404214269326472255194708737027196205809865368523993,6934500447964393691613594947677420114877610140521721836488732706620555412923,9978011727059765171039296158502240318826874847845043732001483806732259491882,21367223873262404675887107131444254925505042466133465670356500592380419754092,12370989539828127569760369184182336850673006315469364895069603190681475159813,4771734208255151020750966033073146490824522462970752283771863328392876062708,13551343845317029011162863399460125746613189002552375164523344552618567494698,8714428409330855425634336943651573814895603648572558273360471650145732556280,1770920281347553432035718101936298919487500537138994976517066719980578590089,3110069281490803391353365800012007306367848815614936878141004366920256162421,587101336788172489216190547515347729725635829809300681040400739386253763168,2745547964008447408503376832407161412155228373377123760513770235899201269964,15688219884606649780982718944113231917978875761031663915052600865004707442286,18825709614401251798160680403375685428394659815656068061728877494732182115807,7344398268236623675422623600003139537460576229211381042555723883054380022043,14666515770263042245313469306170077834894759906373286169967918153150186862642,6262353441640473491135912890626291592970997790093308164286742582769628052614,16647307543328963728423591228360400112670150511841037950484862728187168155597,11187123547390829437191210933751439038277808812390863028310714957203862953416,13431586020033401007013925927716006954532655767977222332198563123215088393612,4290575536028694423523505804878297212249395907285796384174966179335089734293,9525030500997851642842588010076299538258273880797610368114449809143832950303,8240494019366037169932737683997756281590058122972608854062263901069681117554,20634410655079842888667296641045124414486057143740858179591482529433244800210,2021226937398532158458585055746155459624344885692396128118875161667614679890,13363628208058779432402710458326211021009444288989875416757721068391318188214,14662421589311461388753832631349921077594459767269924751258576584313288868105,18478701421001679788418312436274921897007545359172305786472370930338255515306,779644354087716689348274274240595541489283221242495213448957276905050464536,16071592196394048404777963063722475415819376772419538934537115615105548954438,5095096770582161819227893847981354649325178848130636101047350986634230116037,1243295118881144894548654933667320243992122811397983231810580344448403973343,11884934205846782297010667633102865650294795721122133935339824653150509106639,7458968983251027899406062962031140351528726088472453510482489928822496580100,19572605475586099575374380909719328911692508931262625802140140705257944509766,14705309817743162695613012501115465410697971407093611587529338557210155341093,21814585268359946040619047839768523980706543116273413618895661291550785045639,18720305501197276565912107809183977276090965285535057360911917408689742145019,2134301697439195186325742384937390317718398738774895777564128344393744278579,16999326242022117650983709520661797031983791094852258286603416430772587131676,17897483181215416614794986081059087805317610826416633427262022077916365348849,19707797946013555426424189263942163273279448488563211841018471715309464788783,14555678829341308540860562709255991938855501651550888461483653488337939676588,17257409408848021559108687223120061819076248102607600439065783833668882002860,3083159817330696927114122348973911210253613266522114299928693807761894470034,5736074496230638296274343498461296106748247754169694274901381380232637436330,8207744709591183622611260068351833593643143431375276434360211505091128037806,16073710603427960567922233549405442518423088068367439127980767364626490766482,16125801016656798988611163501719363451449395969542389751490084517803061425074,16681204974924630782971582682795720527615927905982945319130944791490607417696,4072675318306311800303326010748274698511258916524447342766005819081244518392,4639558473350853876171991553789446979158416238030006798108198266387155784407,21611752344375994669307116989730257280581712049771305171467376136735830835317,14260028812889714557229612460335412900866192266288236233734870104907234066106,10936007367915129326030460455513265303372033050181411601450223671258879981020,2935032369592212871409648743766195391225915910970902425024269583756879977136,6634946569637959135045435256486295750841113686207268069245788404426148269439,11165382706437522214793349607928919108508947068233467479625942161240196013032,11449774151698349588558943383567398137746718964787475388291636245211033594857,13380655477865684658511486065341626238240224687038830357479380314844874141318,1556090800260299290436338214947407050034615159120446561828975680392439133850,15775229412830292677008903643751483031582598935755329498528261914480871637362,8325948986690458545596228454116700887740572176003019243020371356605705227449,1530006957398320461897940887072398082651602436763497487522949690691142033613,12096799031117418724262752691656478204625211872574986459351576236141568686903,9795222686269696766812901618791046177266354705263547407732303299461050133927,6370027108686216641431817942352503637286925173249339052075608610090399016749,16881432515653361341795686702127944966732199129855247935726797972793170639701,15351738821101585856536273249878864428731819041333447251288973888111661451683,14781212701946742438784746658712056984412254191444809612525158953148214912100,8091550554023025707193058566806958042583606199181127012808071174695106343115,20490495862854672187041438553984493686275844004543178578410057111061213880755,17273768908086623408127314492263145283983205996943328025810362733169697859553,19294495315219029609698328900049261980545541811825479502505060031138576089112,21659964890056395567978937545379633715401240283937936880886676845913261767053,17982445074266408124204445317785538167802060185652418682509052997213396963809,5844393214733022541634389892381973171593154485646342141850588851005973351855,18594392739980641449638044568401634303115397702236811642652121212412266849233,8182160648431978634742268417253967926524505311200391645921674911687111696608,11615953679796573972512524871850400010935503185676276201708450621253942540441,21529769273680682324960067458105490598252059794192747768640910191459525561125,20132110404365493609540330952369583903023878161175287878881490874880122068662,3315629685104800403477925330007368560121731964009894641262206418774875779654,20760167657218552641600617661638902204729190730886821404831449731791027856388,1071944235595105837840075721866496337725631499557288435858051131598364359180,4555500238184379140256400675916267083899817767012366155141824954325999920862,12550383095401941417929336389002623533497339330808819244458405679309028814897,16242206659396631583090203067480642438705316999988728264056381863300603790054,9739751068073084582742270086389269366580429568378316378361121134559060472609,16116599372526867528428771037225046273420084760475362036998100512782645537424,1491702476187736766465155485454380021314952117101776564498935819251125640550,15487639992401023512588653485898591177260483949656489128772103961337143916568,271607781293753174262565976623664759968566553298322241892863651425822643900,19977950168772761551778240748644447848771422612925087742515420134526515662483,1983058998587842721058540590280805932874010898105761473162166721490888500174,16107724245058262116195892590046753877901405295502298275519986777803068771465,15598969808860428995774387003121151871293432204528482957206560135604646381090,10303850219152079194793643117738367623863138704730923818757626414538626924093,18042134015692222011976424010811982750427479608456170876100049843530175591980,11698490610713203406365860893495577403678312400711273827266244766764136895745,15094763799279956189651458728729592947034549021140257103479085265792492443257,430096731859098382312819496464652103427606481282347941948051379574546904741,13960717870097098006695192936395126361902142536383841733120824678277505383661,4016844697779547662080765040347308557842613782172342555085194018348439875647,21390612758814913695838461279472506230937295081984131634720827665924667792338,15210153052017283712229693210655704356560541803226219169450332030313730637768,1405020343631287949667260064722407285384539868534544303707265307694982887517,923081188208761071201163943024810005498690637139303388717205039798310044759,11733793144318360060340673323677375331041661345320756410073354731608712531433] + ) +} +// noir-fmt:ignore +pub fn x5_14_config() -> PoseidonConfig<1092, 196> { + config( + 14, + 8, + 70, + alpha(), + [21845584790817078371458083471368949437776490472877850604640045078191512294989,19653529167194186573342031346879012675435131167180408423801998487681049609228,2161640783454164110262374377277313793192503897274785966059544028153063342839,3054385704838408049711788708109646820127990212588286684954516786776077717445,16635301713639076283966918721405743045341739008997361549904617279107633739991,16225725689449395070421553385264743934675104858051374243666267106604469686859,13459300344588917210133884568970491767131781128923804903594902942358152425193,18076808066595657160589765822638228194586496301618971676220813553508533309824,15694780501519741286439086116053845024521602672078716577385749258673935540935,16872540725652861460604107748085417998883467929955001131816309200004825208678,18265717256656085201140362928095712147159090935193139243454994794524622317396,19947609676398163035598483882491861002323351300468831661031717096486749401185,7065348755377637300800426777670517297442798705186719592553630280930183590981,5932961695686545421777788171001317503890223201383043783424823453778021729657,2576876576710667081195577161905871971928185892200731156106299121736713352612,12555802030075275558510564984903031995058560722557285963258561359487710166944,6675427211912119210966904017515062933064977336124153512189140864737663166184,12222599141329943348111473622063042423140762381594560767061296463113725630598,10362975561623981137760844569177506781739504467939943515494131756563631401384,12107531632347826132438108083855485290921771214734424618157420540758495466114,3236413362865617508850894632024597913345632839215458268170009274560894755059,13269640842689962370480760671727240164372687082286848502921603339956981268889,8634391395282326489812410144806386699066840792624899435283359752045476380023,14222253145252965302168372301361324351891663598874510374220732501857922860417,8638897321585802770244834010345336579513350450350318876059595307827518698264,3865974821285567306249300995778666703191077355251395536574998983854299535502,7110975263857442529682465175399830853738223819847928136560110618272170902664,20747849667914457283564964533975989346418433637631755372433299771504842519646,8525337218586373689263383636693181730826089466845186214607593322372086164902,15284698092379128147447314807096025894174546974949762301780223877793581148749,7697267363768037767923915437621109821518467158489394234232803683407232938777,18552464418403713636184903318257896949762751716606049583572368219578636617127,8197992130246671682417102475937137101180310399693221498504232752936385287840,6267215711691005252092821645736755217101102985763928035625443919819600833817,17433952956528062441211440388577119958754746388457390005635829394680376947181,4412646415700345908595327060988016573431087490581498127967913815901104779675,15833191543444816612091389727640172975373200401937212078659643034429446372420,2496738022051529758808536908421531340554055955151436808600608028881270179985,18865821309368781007158439319264225124435320863391412688953283839208730853556,17356853444859379852104523062654303386446700475095103588258687890090805160214,13809314487709569674040696128771324530575306163394456992422515709961741509179,16441057642509466688507318755613056920894191930223829210993196564779122458374,13126203992288988176378067141418363395032818736472538500506274256104409609416,13787967697762688988712839398243982920760030565931489906532854488857802399817,19656786571615920765259702874045834039087950126970888730192726308970074475638,9496155930249199891836650339371004045437843955429376625371983436016490755144,6133650980214690439646563353939486183333374330790371938934927663849630407389,9878750392407472855744714788091164958447986838940220983459727015586370325700,17172636845539329981401043696407061375416986816086343858560846660524543673690,18266068074968659293646594793202575012585251834459743250538629833034512472364,88170009072279647351671114053985696295758726185186407584170034409102883821,7161623553009701438320582200845261728475099875569530553253147102879319777702,19053465421328592764143131116469165876378776722378567877265112443326967288533,15787821054928042708896412640384007326676625326396861263135967977164294783653,9615173323505112477217305395762776033870692647990635021315350642536385774258,10748585844981412663149047472971001536312431184916168605042111548221680655573,17193496554920138070905215774356694517155445370515924892481894322048517125340,20981027561373479728773182418686452188471940655764396684028110979140369006827,21262972686125563821794309741130556914165641373895499794098515843451753652777,17107658081493676403630365275304097003600155220274082934263833389505162130032,12511894931761241561787052333055670047472612011302194769826693935710455626001,17806912269440585736864672280987816575618315620498245554921738316327046304192,19545292022072695979212345737390709562681030627834519269858193519314537426533,7543800958185166098093959246645025070235714806654195385000743554473922936618,4625475082534149232161405731224600013881237737740742465433231001161153655617,12763413547514960206069967971684559703789391875445961922711624474020658766608,16881857439631059221437594346198587121133192812269921863116602807689099485795,3231850141984038920375478271531925025564375094627983241106994584163478821676,12025284448956248150398233143375971306100458475218939512492496426861431663478,4525425011555084029555870990647344303529266577387030581756537915893006804174,3795501990414375556011654275060518399449630146003978757203023617760680325709,4509128642188781738213513757207125341975604363824265606323571895455672910764,12203047758734592203615462366516348191118610129553686354997732038970187121007,13638687018405787761639420673973367506339916347486774445588648879776248875396,1480604348496719441038523415355764543336234934845679094037807499653490493865,10692361717579001228187212442602435054487474561573499974105521910665132275515,5007773285184019093586454921139763432640822738583548849737728483623941935472,14779176361271780821074929551122175132746249520990325894754727749064980218318,8810869743928256631039877155210471039332035226261305285283609913565228857800,18154173501970140404154140565370264376529820426626464552253141823874364956900,11656303509442573507998921894257944851336988233800378817636452696829680890350,17658875741559155615021995850723408238216088494443352771306394733637591342379,18902160612986281748775835015982844003483334222891067179969353562662106908838,21595310045201809412620701470963174488544609749637202383626402540041734306075,19479000691333638193560008307308022198954460138615126342769742031420251871629,2972632723219534905306782557604159867920608086253824361540409985645334537267,3847529854347283694984727631990010016411937091308711649053729266492176961919,2403423343103741792664345548178046472942690163193710191494177026621927723840,4715026270007766325068951713831542483223564562870257986931331836552507312912,10050946066792704139911540686518561899625455529845988837175998569612056291645,8462612443675205626907647847435181314299724037672159352834910195653278990554,21536131862603746518459731430650379927614037990254564979711500405913555717860,7888269140704212528047592848167567446827917489655456773861487833453406017069,1170377169572693438349285053961454675716678619265656860173330864613871015536,19621259602533287127007734174330694952187330430513568066156633937834027643682,17165866032840109673438683878903959007172818091757219456373859826178202458170,14933333727688891927411002006378277183547380244506194877231532901665762194033,9343867619319423527260818064767777717418825720619434299636538864535443951928,20583768764298760141290708372295636534035063275069820261065362331153347542719,2577125135040205550039517386386446603255535410845714513971957864613256569227,17000415305135911202592785659979381300200707282766529883690542305214226820231,12511346220893686853445962138128902612419766727072608028194026193211924059518,4149764657828794758957335209849218835702975200988138041342768571619211624011,12689460200478357229673533402655824055278729189265502524126586766684281271735,13400421547966647260602415862775725767930791927979420926402318903131836007467,2276424802663141757392692926366037451925020546827329479674513290273559843227,13207120510498253902527141512742067250437249796266587317279641215901655830896,11305234940211349140158920206630802129159533495623653407204084399910372957174,5497774303468738593952657049388763226915569613134333653497976925327612433620,11780989050042171707300156320134237383624870460000896361633114513125178671303,11197132624111031475729914540831613691695800675640925983729890209473799714664,16140443794881450163624886684327741887016098106725788249967592676372285999349,11051595327889397185166361039119529941213436445931880650633610124485963060123,4836646605031570157308209197698105249544981108702254887271797808619270080413,8209009069949005083422618473679185090070432230901987251869909206753231145136,16474909562767173375575972470108350369290532718799369728226238753027802729614,6086055204212098936385823679317209054285543683998660974885049732319143968166,15845663692001601094665565765687773803894441337616861842355695214969875896066,9098420601018427903226168857535773321796962623728010568581252061114961655465,14398020486027915166775907825392652502550084557499300430668649177321914768934,2529766650486869899750453189656713618464482405989854109458777379339220142554,10340604539765718682878802989600110179317791699890691229388614321680034249914,9878876288226000720310995235539201725902546228232202248134844052052896121876,15598631334601739991411156353640870142866768421111507060679644747315412727160,12476036027414150699365888926628033468852849122092016651897900659667567319806,20803031063635652861008057675598133287087428947752503544588637173888166669892,11219667600899420706469792543049361323110081262796605270588885844619718041942,9239500483618882938511561535687911499489200513580468310964041871852656042420,2295137860333409753273134561401486593645236761709753752653034489900637997862,513840239484316074257070195372896343613221099656421936676995152626965728304,1240423160571920455132480263739570027604064696559298170495781456216075158172,1000335770452092111597579881696386094005166181014081250146819592415429840281,17732477784640275643871498532120858657597895452427536145089468999578047484919,17170981021801009209909418054936322243367033572422755593175460758882664580508,10474002915893131225108722048498342055539813455822038310171605686332057287523,9603348396520941909404735719689357385027896452682306755794683717883589365434,13997990766251226080324180880591113480591220558468819674906322487254600879864,19165322589470665586312376362321121865643126447966933590462565164041476345514,15889877351963901365648141054999234691357421706029208812358207119735767519856,8668047067682657740038874191537478915165931784511538119786089297082841482372,17366185630903586492716760756481097015828466883331247688174482412238176387717,21876355395221655909209577718688727663428003322801196411166438189091863032706,8342495812890419318878301820827026193204690451839354912098079931173365213850,15887225707174335160711915570149252929623026695369026542224074924735308390993,6378295267974387238182583304654614405910401210077434367173120406371155400542,8599288341856208016511446109829802753279910611437057243892303163654271528710,14384569526991087242726852106274677884712683003324629101047489219988189168985,12554858483255821944447983588851327925753928086067377749529759729841684476442,1244202115364291386279329790002693224358694897412189477392486275482043163127,12995340746860271768506969399635216407185990298275348495956441603189500195767,183027008509741755078232756367286076025735908110463758323021771971495606238,3573731114015522988150416514182944755210001235963017910935079689853918043877,18230391763740278339288441222957881377176531304894832542129957275399074045651,5937391935832132177003018978899438941930145516233683431615177125757010459652,11430996404641585372503695535042106445550893936697962891622779166741655729488,9708207568505790825432073778606679121879367766370067169784170835562004694648,13398805456168802594406839007653458669253514721606724093311019328402863953525,9509172607193998955864433140854270981598209332315830561489225794322679022459,15502257451151630587420754221500874210427552449899109970701467342791400645333,11123898636843146818131986172543146864729611142704598768652657993190010179131,14756654073235850387277128827870550186598788932163678015197111219905127222330,2775596743802877046549055877116659535653734622828894792515801349479916697007,19393614735747455293764838818808226619563895886462373669050764399041257455003,1249320178045456927170274664240781660345447736835400684416240818258732622074,12796406917637014666646024992328239080230785967810042823382614274279812889313,8731150020101451449969760761271583792743252060005019647239509560664328018351,9933789898048906634037638211430912333233899173340437080629891912049447301727,7466451925704968193666093494894304477671721132981190905063657961063858961172,18149794038935586919422942907608353967008376245075544434132167909292547581560,2645338086907790474420268058095037943265764190369965623902938950146047558570,3805226260777608297922168382052882356808083423152211373837998107098065055539,4989302370880302660583716899846990066057960576662320219898456979014043515025,1070415851697739963236557454136444292508409566097266743684211383600964969141,12944245506579810779814853939016758644439439209107032516878032396119045414701,11769349237256342071683275569967616595926207710668472449278925821680308524365,7515880964846644263997052091312985911975830135506678004303761824155773875060,12464357909913670578721898201968110981078170975300784494985401212355213230335,12531063240134560397069746994123636136169642575111678588073390651101761449521,6147041690306761331612194490775813268707261569782473045839636103273693189609,20058953556654404269207947758850631052629168082562724690664696238258819343333,10671449076032051862717464872993019906670729457438083279869852502398951441572,9263778898906682528709315203073828182663073896201474787696895934306219116039,4280018790033654530253273135477384827165889895493311470077828964783579313988,830995672310831856642518343627405480722960393571135174568745694822266602592,12314576340884680561277987296413286687270775984122709242612931854296075085360,17095784374018350334250759671947431499861842886424783004809423482855754115377,1870276341686143971262732849057691846357227120913088159474346497974038463590,13105414947588023527779026549450388391878972150198998416931943855651155797800,18101033009026370452679604491367700242633788731529564744613454397646795133212,19518878118392884244142849835491751668891129028130325012169949275103156284312,10048097099868399020473369161831917580618232227587941412911792567651718843249,13720988503976110065971074438615366180970893755318530444813194189426744566454,10206920761042395073417518236713913313307032364045319534823111708069826397746,18034670825630502903409981952109964720282628088881306395156166316305807778803,17265902307488235822005808880948915593987424296023174321440226533612013329935,9429365481099850064016032865663594803605999180077296169535937496741805848481,13186685927810765291293578499657740344232117785406437983769041709812502541933,8033401834359804746763731113146503141828920003868357417085510169143014612168,14829873372988191912376824090708426813704721449621613864198115299064092181833,18455257181054398358097306328798734574318231150508108527392947186444436439740,8119199559569330746396633117116309013908934582593556748077373019932279318500,1284108314616459045915004998457007728060914233392140668856369685125999999332,21852625948025981910963631951406283302114607467722317806583142816175293668265,14294796340840469579766310516350659401625921390409030932793069064155351769891,1783113620816999591947201004404230259494066685648885624939940386561651976668,20631226309571056417714477834545747594141696200863258945898766619654143617824,6903938062054591003542771080232078653298889568458433305746325082721608484955,8256881116864939888001716449324731552833717991541507741291129726788047573071,13687405621147199886679388919812090637070670174751017085656416653029285459311,3996906960213710686419471713152378445913261990655942335471489495797584984773,18609485914058202995712970621084391939086418713703752883448366703199989106805,4737790485362149715518348725962346663474900881645708435962411601476490671749,2822552925802124863166593828171280409095683790486058849977885272116463701928,10894109234909999803847798036461479359595641981247612273970502633226141682614,7246294570777241116302579516225659482637719855779307083700855528941826872713,9013198024264523556163293154624511496427558116561774530941327330691750043628,15151960056770776873319338589377108700463507419234056013408936730718825997019,13896307757522598026854039348754398062744662686124720657491498342048635150631,936098917227958663269717535799277732372546413929626514061262842640907378836,5762347306349503820330412402395950955095460299470544346332901816556543923381,9011672463961728692091882997147124758454879881989902775354620290305441817434,8298508790377315029478690089877957774356278876814712068800423484382883105746,18441738918640842202469737660313781809854248733890462980130113721522272925935,11674356714078179732189659380227960024612632400322071192164520398757529418670,21741531861742185590228910897294372846694047325677774428196013372184305103642,10726909710822683151420187237143914110905744739798587383554354069582246136039,14605794533892313551961292244462849563801666394421863533658628423573613615452,18252321089326369077368015604893296999452816437445326292408407276685442204248,16489511737082127400599277690755867907347415222776413612685047279770378853014,12335271216576477339942530570019671580774683415225712107993157387028894905764,4626127015007086021549442631728304324061443778286284381465764558652325702889,20204422163930758830873934092037602825061261159909688022442254278786267559979,5908008139766198991903649413759936674892226062609391695798412118889649830013,18949218162516421406624855541340518738013110700902674485216824630035967277648,7857158354961323527996104954036841386964344142685428573605787682122921808752,18862506387045373228977985979058776771998946696427211846227485792071994347569,21130307920872379374988363214010414716464915978170248808030666261671221223543,4313228149429751211745340097430041420420928800665815874510443032063502322102,14718887479978402714517595897896626933964355973039392802299204272000024809808,6557683321264859885031038170253446373377122179252187766556430383002360480784,17122476831292693338874176268140351589680349774087615644242938775777697017452,1742427015172593656128486448061422456944242303531295475988475807736737942042,2027235762831193006217486738647428392424417413253628143597055373587736173882,18820467606179165158872620834655197843967670286762404094202648563691406576741,10125524296683464483537740904779830909043887085914486254166411012113004643542,449309305485238804235855079592488366640797157061432847068620096879828248038,18174298857888178621780055946769726501913338858930582293820343672195281946232,6524685458133323533884653748284163312203275737781993034758692071803006590911,5779446108310889204396522202292098396120321905868746440329327547028173740638,12117601207346032264472777912492513317230650895345305236204051403325746076935,17386891799362994472985052445984141822367941805998642899269245566076967495748,9179366996073356039318771265789433069240332535719540885945532359919512410546,17951430600208154118507690771734790328820535928178248368783575740656844500941,14192271756367781523935569988212364655718978403224403387301537958961554173399,8221174165933793163901377098818684602634389528051583218569555199418881843300,619524678975534727395248661178123212036053322038080027161284774894885656968,6811391538547034359716390364062047260775039349151599816482953672829058524341,10339322550348888691122766885623110168053574406341544663827975995639398303045,834547622517043358034390288436661677632262995429052976763390684889069201500,4521430246419400790694482286290497928487157243703675820424059696776489816307,2856429439451475378239016597030439586695051951861405539943990631405466607827,4111906549409128541352401705521383327041723912730932911918947847640475304547,21238392279368838153073998702772069142756942255081903718049634748881681359750,8024413919212120225608654701439440497293912481641002166919294547045993866155,19638917754035941400580825054915831416618623037514650566052024405861982044782,6363298127640737755043533904928034878703559551572444680730376201407773738099,5951378579926778764731263132308899303911912211097125509228135617058018449106,4299191983632622048727922852687899517860127872286225781380066638217198421795,13147530014153459600370443470203975351218206668086180214214011567772265521187,8932462500427500118784677946351185252169486521981702322459979960456999825085,12898236202423618599592389067167172325929052486002381527830813712396261626227,11097514049007489440587570256998525432340163981998515135891661207289091581098,16939217257331433664860194883658557949066598882598231827843396489027582239493,13558314929316884214321653422030897165706985165664325794343497050086242614930,19068785933927002693740188802713137005358154768592984493993019480794959714772,16219047234078325455733500620647043268680743772219676241027699492382953851822,11566125486619880337971321232314420701391596877779136632592874470668332390604,20247803830618639726625840441081484205981495541890152476410337155981008644211,10982561928418184138823352638412764796110898816926174525705905870653768875109,13865455597687551061085338688013943905732507438297014744008229213490729171094,4623686187146061526075222395870304599606839445854872221666055672567414423759,1297323969860517810025547983969849541225259454470688019030850877270479215579,14722215188887952104786572716523684038024407798912988920497316253897978502603,6270780574886929570568937279666637132374218041131318249843841984676427785096,19252799885324088942740034016032302070594496616562387546044018090542659494091,18789886326443791197255838067795128702043473536108855579944353350374719120963,4004428942869607083699086726311786949460607919907288923307322356602295441411,2877506877897472797549134443444956093653579146599656174810841010891875571228,17100820986561348145097462952844272816935030845535472396118435485954197036467,1347748684215721199150368750223253727950390142032926135229664962610534785585,4154005697105794859947043472401749393077233408100643568245878899626874345951,20933456016305992700551258430315019036248529816811141758791937748005878705139,13670472427221544431486503737474464655536253995920989690199387492221273597238,4887586768965099882782231950154450807371608927535862225573402423957578253712,20873520765554306935202238707923195971241799663989834594965009759362455236319,835408880898587261190035308896108471998627156220026699783039947254106997118,1168560772528590466033559747490971813513190425644816736321133758228053063362,11336620716299236865855310989061343228509583886619209006261263862998075759368,12980812954661261543443724949390081395650693161075132555819949729859873154552,10084252406967656001546402499122907140953995723236718543311202294822930374906,1644532730355076490850165587814950390528959259229216666472798276024619697665,9132885938811460827145905853169583367514769405887568204387077749084430489477,2725900975136309543580364211869546121021875237274249313229081305044972484552,16649132526365476017376435851279563056385888284228253635122650167497125722498,12731917506454877589272897239554773638029036473865906141458475592969608419975,13594653727945200481903485136384279897657772670755085103508581365171774040719,113624989360858461940510511528457240403880397732971520793552365714387680115,7789436153009366426158912863312519977840172895511546817589361831513864987768,16143950714560148477045714466178426422461079160482754992311521791041688103078,1313437798365489562563299651704767522651128839986029835665434483203980839176,11252213995691856633725287186457035931029344732702134439407400361778220541650,17736157138183214282785525992210357080431726331346127883418866302441793685861,7180555369115773227093283745784562042441101566557650242391581159039035173198,12210449409908576791549312007483796989239766997007433768188337654528776461829,21645736522624670721457131423612680680560891552619001261475935027688037968464,5181231859976513481992166491356437447372643837921293039933901630631480168455,1822647984377309820943781894578040991064004363022862403681677456868041924061,18871375493748399832446064841374255973869421566131394074253151764055941485971,17104418810613244184376069439022653413672092602368197196666088607272531673120,21352793177578730013875622823471064860889253282644816974785905687738185801553,9232438288408252188083609458343687653050330220889343945216702072572457878290,10304159048240945355136802455474936548590756836618851032143486546904634881690,20884395191144673183897559585241012685606665510456998263218110825947409467914,2819516448715556874313717913942313640504691377816634987702668983716292161632,7032608084905515886212514778954491987158299018684745883187663518324250619807,7559036428305013706113865872782652760220550823937161831466421604635377603666,6166475941379369323404906159647871547076193215494151224037609592313271326716,16084803679651600781285997577643662084204923480676236051120275962952234677286,6658815199061181195201720843092877884603511322340036305618980989430727251871,11532335040368550811455379206918215244397070466594500713220916970398105300183,223243445248411375033016341241378810903532891138952541245228108341484828711,3833279990355432746436294779672706393587026552206068860301259597964955244359,20021860409670140006280261770552932742716715786145482153861376747693162890815,3960940475385499730462877864983553000107482077213680397288242993303568324972,15345391775733994458108231909936015494312151716517317512597014646307002937890,18277195779471824870812914706668217603589292191686932445872231693455894425796,12683998657212817923655738438553698764065257310760896868569072930043411914592,2381616850898069714423289625050293940364468416728632275660762167225224591308,17069254001556064617313013226218540738464402615134272312196301018778835133248,18389457738365086195717208767239120166429330517506018082718782715649157736034,5051258247116083013584227503078370155132486498229823799712010421955209135014,7997986980169935581373258514853533781209293632678320920663489466999553296266,9084231611273069170288134842362168520424117219722297893241580415854843050029,9612017102514059830687104062100896777017998502712927457146148255553769995330,9213917869163068338076473790268314749980273391311658654819685979854193078147,3968414534544698110694188177667553264094402034823447016934487565301236025995,13588240166210590726886944410340082403890007139576685347416857458181479170063,8425770643762906660570072207190993414304346471106950840911695090319487814275,1652806391920335323990555627698612547647520442841733871570123598479115999627,18130776043151518739068856550215769502964647168112043888178493846726550417660,19135684176515473484108881204420762325009779099777199113513850601885029049659,18523926306415003163998391622948236629256503699057039444767412461271077678701,14918281748682691271882204320979112338671695483566718123583225923120856316295,8780852767944315665594165432479024772720494001116664689088446074574987494813,12668508386943347180515022360355291044387148272127255261058463414454846963242,4925095646155669413280350202274427260281996843455607837164490899877054944846,2595801235413574965831438899756848851934934001108314616806171013774086568322,16016207465062828688275342866097975914741628027802243675066228993942777558633,15024416797683381415563755573423733835281624847950439607885361353822729812986,13470695612540254635863734898909669181168896043111281127113964919743317383261,16896649112088097145823038767205812267673142507502911459577638240816340032813,5645009976160313260833270091943535119457478455011072475922688828021639421410,602871159134715892643983949134724748180211299390344137568222174867411670803,16865933848430240952665445021880291168087114172384742393439371745277930120747,10638616947682848797128584610899807071800790542581123346366834113610995491100,15823119882352004895965266205059246906297215947121418230976223923682971872516,6335662959372125109139397987508104273775067107064186843021683240893850916670,9015302195224176847832179354591500534302983921972567063156768309852422127379,2916208839246568972516202976435804092919863447720049244313355052730101892832,12462097677706957512887764105458513125712391543206668564860335255817545411462,12645432056886268747459912808478608940565989560801243474226148714998374680219,3180920336675161838114354449885404230480750260525222632193238650778186030194,2765038069658052652090069059291472962961753315554068900506936144102952443412,5456153930594691794518876425254629839890061712982880399455001410106283524009,475588857464770407073340860667255085025964024669275489020055454066130988320,11604422213771358649337761367286746573670774367844043829963235653833716835011,21672531595983328080827235954964353440581013778240609331813180834517858151965,4158282767336475980124978163165153479336138216933325437750412278000398054990,6032343652765967766200639763117076693275022773598878447445516751911914770612,1408994971542022766817088410277637989937031937486427645416181643240579694602,5675369397167644827707774427966283386689036453227097867563588663607826158481,16553836408556819911384314376537283029998074714786222283151724244687848945589,11305817545614916257748042736988000193121142053044277161651567885557438654074,830935697282120891923075627410843569046784310505888414612692179620161520408,7111327705324010951262975966073430392141084274376586856008212260205185475707,6041014280799995292240499899142298082182090482839684923821947404991902712715,6861532079489296739625909197765090537384733717891476126939216899495278356435,19512767336722762932902171703888917915267449700217444230295060094846152793374,11362087145491820831916999481856548088963000118526088967383804499026380829346,5345785713105818128869449775136443413167434948951799284901802489769456439786,17034353050546517551433657764343123751855407033689772581554238132654775360523,20948587704598096549680941899688868509854524167514075706787714294359604474171,4994911941995400553330254818898448719600721576253446166237206475949959408151,9688152172628114951713346942216519356583583295750612146456768853572234580639,1343745797764784294443121474436370243518251011725658365765145682550385976553,14125032499992691719199426991191077310874247595141214711018898761632184485555,7693434862282992683488101124262547552730705787109948156284399632991566403920,358969526543359888045815665915036908949414956460937733680920722686744813444,10388303602140838746049100800433273910870825475060431768126678575590491651119,12003019672927505670536349874007900046436859031431459357691867861903891807068,100475008966885612365204906854412018822648141035087921833385587863034960276,4380976634270985228665957813264807511324931231158992383372104805973515660993,6796890817241810905532067210297629305992402701618394901609217064231507595098,7688772779168713577464553940881893522916379475003769246647902913600123216803,3719641128095581959416223705616297841752773711170097329183166123897200928969,5811339040244843745049016703193592081836868671814750017107506365287109556605,10595470132919677811136446867941153163237789139416696690218064678877242827885,13030722908918648575860840375066614839148197698661025042088986261543919080554,14270313844057453712442736904892342369114041625795108985761645871570953543978,20755955200977796735614094726104970512145122846293966132203844248531587786651,9582579815411229200777590264696860160165980649555432144848137253789895405534,4350662320089661964064338788392477540031840065706369837322029959874552780000,11294656075067466938178599864610454390092206885966775647004601601555888026051,18946972646213006149468901853070557711933198234858050136328420076856760929327,6183788518442229735210652665497651321434896307527846329693517674734369795163,4357012315121006561105620778754114894493832281520086713987988030701496525309,4220425144490786998849301484441980495606132822919030749888073325247349169938,14847262709636261703845309954203315918152776098063861666522433996841734492983,2207604061881398535333278399637137320820424466179707349350037157354962490429,10374520449793714488752224568044645973292278262497536584844249765683309087900,10046752763001031505421631811000499551831682948464981948135908582555522139635,10191830759680421095919984376117799343794470779618993576052513294297834150862,15076222662591944075232357720469485509899269012588377631779056491168825321779,10030346249770809877262359992756272056670319300684833869196768465826414079904,4720507975531560789365265597577186025064384475474978173798769571327267599028,17191621856092434134985786932980111138837305571579695662259528942970338620884,20148399372131987633026319910847242205929076170415419364579318442517450329463,18536741510173922435024204045457609239829288683624474544615917164289358647693,13631750264342742049519923217689863850040711017202360015936348405918551837067,15610854494548438731317902472235239790464071411103741562289565846725908998069,18387668285066173974072893371855420071639764562065930624890442086525580978084,14766673420520500288514312076124802867192062521660406237863986898959550205282,3732185864446238105520935485353063605521423641525603230547743875428671598696,6726861976047081116380559824755952195618930495454092484512720173680677582718,14230102015194545129058653592673168907799074203765469344837164009883877641547,923698051441061755360657704655014798009775419003226945193621553062258046271,9689434574353223411824004165283477169808920117596652474458537007050145695959,6653548670473374668472111797166160911158340899061222339537692495508721251614,3795538039750942962828904073106200577850807348658267681985654384336620251059,16992880538370345570685975897913090022139738512471371596260168908478239467806,2201111019550353407862043052634082471477202486461462021878536956251970423986,10288260758300652435946350416864664136108249309736639494191503136475372654927,15709483617520776431567199768118570957603227217270596124343406544848127051229,15072326085023560939831375504206736581668538451241556883193631319058350825383,12561979699882391671048614617301093740097194439650447103774288376923816448076,11578577676104716528266269909528660737784973170422409028333858070522660907599,4774024940257712349371248845501840009544530180895035663519273410524858053238,6492684254039247711120616647406430763803059236762636509335603649550553435616,20771468823570726361366818215861608649059576818091620623157713556101748134372,11770234809483645852438195876591109251904813195909801267796013610714277347278,10322220982623441869990996687272667519839773221084466704263092761447901512117,3873750796549479014998049182061589742243147534079044128452565125163635863792,16822068107147748367260830510353037256008422122115738671496285709779217814945,9894626898191884524351933214321095257519558205219922050393534754827614996074,14601192892171927905999982540260020693712306290426245380657926166256138073598,9507456803001734658737641235710642159379435011566715643921196640676158132603,17204767985326745166438450937743889339302038750836189001173941240117259581627,11493735704785585407432943012768068237407868899310349385901453142043105992145,20264601365705944529765978188292560353562052194559042151183990689436087045415,6396166643103201291451232462310280514789516631380296812005611744416636341945,6058445133237719937803819124490281802427048168421128127070586670707895911082,17832742609350217271111001369998668554917153176201832135065834598001176606174,8301910681660121964370976371283430908357731729231997961142961954342095329645,21200700180783276860226125147359033530111487784446376587831447494082008760372,1364486141742658225769231963526281625713690163326935801558529383187840699159,20160669267302086336804098028492246933121636960809421351182280337233197662342,3635162620064198915033858334726014494627531534027138539712906873727339940152,20185829971410353373403938384712968683319708682735072330111840928607967762630,201523690073703194002962504757428126542763652704293724447838128821998746350,9709386469732131146744455888595822333747765095732359649526137736669486544832,6214797208590500165345122859363723824928963832472111818012074756679462353515,9545179136572857559578932159310632305901168870225039498707457861463081350889,7958214991370581593237224161079745627463630298171564909746677637838740804837,10143975143960280812282386246733660505472918014880729933237691446362785576312,19887571710409013601609612720342170573208042935750400481652798519320490462147,4385901431531790517574018221866017216283585679251714390188554453215701245125,1664624586830909279573419685895566313699996183243836877427547144869129575305,15793134038802395204513915871355486670799044444942914383804421551073411566881,20470704207635104884647349860077097804311221255557839038451274311052027499926,6142526726838860239230170135812194898945683787933736938595250804972260353985,13855192186192101570267811921410903075943095341965742420598451678343592386178,21061758735696246985536203700046768078820850320825204373370639318620908053680,5662817483820503797666808429029051672943117302178352551614788456216271483237,10333519634297417737172450445440333857302089078097476871967805971949123871529,8218569982501149814702324407474792474686368395700170296571212557818282461359,20233400137285640555195780437569385053497789288081872387339896466294226099158,10072372834150094335098617649200237176564672558260325152023334458902878530776,9266800412877476308026297272156162694485705323044163059710847355278349659379,5276337117659173276438760052296857124207008171563166875174912047683077401125,2006436301001583347899849869571017812498189722949517889639315185888688453745,21001242218121797019239763758294108685115914209711313091446808028690842184156,15200074016374430224281445993551091543367930754541238817021042732526880610544,19710826528876999823124699885521051879572010811534557471867248186884736123929,21404362987802009741223312847298906544768900296657310719715972255986007016585,7600530036229891939971232581797836974827849142680304648314541550980439417795,21632454463616985503979878539576013805183337895553881618120668190150301665261,6334758595723856085036854188165101506598081801208405745986881361560891199193,8057222251861033664666134852961391247267479839150238989503146436301385103200,3219721852432286392418844864881031568045047266727931843416507933961433025545,15429997317679838542619650717630685653076454689042566593207301547187192181410,329174031237742757022307048272693803097641581155976690924186132266202912753,21732746139483704151357074738923965870601454140619898689390165872304758524581,12807082000874685484816248695921308340943213652025179667821051958845707861874,16064026146032729000070008033632737632876654216683451632905581465015365908257,4212217153278443796283906098959531995688364954974810176542537190766858609818,21143229289970553639173591837823586981543332391397328546878889800049585920625,16608191574158019592113901126750079565651977188938492362618874182536574927398,3624421885419003645925287958934125046517213705659854889615838255824651468218,19316501828231774431815118527212477451661840620435061360743197812130426231605,7662891999266634580053960517366506438335835205004858023405036760628949585740,16083409929948531376998108923041427957606534473459279085237388567102877584234,13084239861882397209044914415955882241492175271640738785828432132564815850793,18210156525345343590423422394059177051429214768712959878778772626339164549874,12315464041324428320313158873511378501430493994363943547122434404767709664853,8954605304811330146055184939317681861245665333018873540562258152334326318605,17293224339343743174562117843833611404589728024045173960633854068798646969854,12077428955835955218060944701333382577662880272982277398053344529073555194830,7126046228531607392073289758329125358329379287853920330519927955077178144953,18588044234272060286987286081803360761513524944191766041826466047510554640918,20890448514466943340126201065304171306189507157689256667534257974304306634091,6801003349507087476371788107799511762780253146305342273491215439215969413940,3780619510354109448305575837112860323918556596060836509041441555683227828678,8767334354313558924867811651574408725653000725545478833889044301516199439630,21066572358677074507410523123848261256731407535120503516033231013762098795269,18362039042064137510549303809539961459419339855353944845069477034687076489851,8913523920256755688178316396983509800293437764919338700779034854771483564854,11723401432613346160205532396432709544892024270048469362382924649893252868073,13215697753311268652932970590975269015978051881025604765698398517094385751294,10096875802507022627888049762027565166660383010058121573194339315127497644823,20585340774134656767573027722172296226739825364200221949739798500696627689159,10445154974790139558211972190334915738383718443406895551366524953208899973439,21673116720904254079937605482525822519756033862602805679958950491098633276310,8625969092860470813380520419082444422545844964279894335272441710185243798934,4025288875907887520103326512414690750293134922246866469493778161136380894049,14323499257030290650454481578106573336673758956871892054979745929234879010775,4477626471847050821212591107628903165841822822191648560679737237549532746098,6035678895480961290473069135353807694173152744259585744720200702817852056059,13087537929005319145430419950489154179166101298384003566794942619862071759110,15034538492744821867836124336381708186593112293438604485661643830336837149153,8805139564894882006885168301537536158944953788019925854273090624783308357258,19958581387726270611337524069699729934757503443234146496516617463929755531372,18594586877352581063978277344172832910008313781358399221576815775414535759101,20126420557250610569978010728469817957691099256920991551072367148797364737827,12608220343122929299383466116607513455913710378844501818574872277345002049133,7472029840435729707246144983643315764441672074448478483499047549570431985698,9145534859649655987690711448922451001707059796425112511085875363972462746054,14833791973699407961392823324214593517418186311389016446279089810253909982772,5890565022258491346280610728283677536409667465411457717498759331136098626193,6036941096143250281821883413338948223454138251490770618188682101941802166158,21282043678033183106352077009071810571452663281954166213888935238324321673748,20333804372144772829649652869275200527604963503726633269029046116798625871599,588131164750999180590569033490334261814498911261696634224331209454245047082,6825251444721740074952317618082720927334521807162055931163012547596328197449,917697824543986394290655655205290161739195186499427989467675782006019774097,15041830455925245428849291972925354368991606611607025955853683450026323915411,18474239974098280549955893651580150846097530768719853315252027744284466692200,3611784158748153035104121136455977264222066374809674800505557964617331443457,20604659450393945231663570065906647078596881678092078709858521111095167311757,12029452301550033145724326108003255082656089254479215038003174967331098163936,15356676148621236051968257733981998213914051180019702757440018429006515803587,9423362269266211501814985604120446961293044110825100766698681717935266136618,15899728330782424719479421593102373102438201721567285551304437858855478298992,19106020154064303782722594063821106692950347246115176981502414167189733529368,18908465093637028691441981127932774442154173676388632144231302290143899401470,14007866203893293106212925571168282959988090650409909185874688109550330526342,5342742216767912627176491444663860490435717482395442556665323768598286007506,3597106827456013501397704575480537495681742041904755766922490829038770978602,19345954862705630389044258042054882168728404897041130532396992253851595567599,13651761202893618441816264801125692678934609890284167560926428043317180108703,16448172308101926626190311626973854215995348130429072972101942893358814042334,13856649049195496934480457183055513754814884703875171340785294070612325977764,2593658379576055879381789234288074898757591156526450196693707683508079496462,12697568363447920404231218962893478531573733618972364303216707079428387821529,10578645587798138343532931014102095372709438567484299904261443385326645475306,9492492460728662705158180596118275120458955222134204696298182307017420905508,18064023256112871749609279367679203109309609541901431681842430343172099602354,1989944422169611668560419735240024090899518972063746001231995750158992709746,19903230879435744155012664241474498197586597172440005182506995303093565641777,1728511243862152479724441453437511013527085523030423049007411340644871969509,1750200860549110325737825369011951368084185262869489413254703181129282667828,8859957468047988361338455823958226995655820770262073750796277641227321341998,19127783638542055071733839851815229696558338746338070032734486927449049698521,7078877955496438548183194474726026189811269821062629263278508622456589680639,3091324818623570240229136118759236075549426086908228304466341498471627762399,14195346783292343393569267444162421134560117165562018311694222203790784872224,7366930408724527902650425878366319531313526362168392830194685421619273052822,2217598702761121052299380093973147900304006951260118283287015270774119856107,16027808241528674736324615318588531063352235936452195394658431080548186455840,9737799828204615060867766665537725835381601825573025977613959705161843611093,8064501393540602388259218046920616332801811052858376733153856073004571475196,16842422805430821078995618361206787780503480464556310995070028960079907202166,11112062472802799468234830097050518793604563281810316763737206541428998286081,3996143098194824093843968965659132847407504849137530967999278126450907191255,6307499143062236655628471047117923013144505466650278288900215043429516667827,13925586587992763438435497293527949989397459231522640308463502932206077961500,13087452945182453051277972085750711303320428980713041081211383304385877763691,18093207370226721487749634577199906992299418255969574006908138736154443387826,14272048411789712231464337625432600879032064592923947963806042930999866142049,5112973508688401012277318169584325529641020499005098236869086381676918059371,15127813438826152618698293752642344087924814601034550461410899877754994198299,6969695649962440087033894050377257471647257275605050327543911409064993144574,6755033946723836072389613036793975461823169166252828563832361834388266522342,6630309846049050707531890910192358661458908514573775713066783149977348075866,19770918646745678079472470109308561511682083548143260940369403377403283034557,21433670531093667302664653834628387344084043216006808509497422477800438816334,20400712430451351419962326556923150417233487338363092310732550512855900177990,9914702749825526925254257687000920413318621895298404563035360292451257098124,18640006733688503648022700222053193091432820833842731658823766601630552120045,15001143407594668782401370718438100322710708950874705625981291998887962398836,6239670443845313966789296359213657096108058977356600364820415786936148776478,6433425223024186602967246363501689243341949458306873394092764835636608100956,4675918067976678709774913862522295500806856576135412363070396552169178386308,1601751749870408670839362316137379218159388455643443723425257645986433854434,13458041123361531838745263080315252882353509187267791623642428828275334206638,14471699013899259577738777309533960354293333303365529990782321200494073324178,20280430398960027135010448240285550337237252858424335652593355698129656795752,15301671314764260006262782923235826735016067425075232061024349010859210176138,8527420415370243636986575303113397012724035052720519440118106033441076019119,3475125085974928986675306749785419160190213748540322213576708845513558192234,9006980194944928107206620529900294492273459999862240882500316250867368209534,18341113199274904243447557429147408702772610985345439625451614852727142466679,641303854841744162878167226844505402377828908784963225549380412498130669293,12717068536550964634894133707393353175533641253913906785707227145457684209533,4743152264042462778433711542894756531279965736412696362852105777475691147133,12538011691198347241319721961633309700824171196141123297965193643240835576405,20609816220088637782952524444771775704801169004700347625707989982325840582078,5706720205331708334089980420369782946367580993809969730038974418250776704373,13670952207260779576827977242585356546757059123105172869720468020067882252702,14767430839071230390516499921530329576551075490453331584132978354378461913602,13855121278897572089789093806573448194721330823581341784260637700156610112500,9029464346382645337824607466955710618425900404147532427117006888589723750841,1522014999882036268928376276435422913665212355063956230967744832498304066925,8291362624704304963260873050727236420693946064959013721544766852407674345583,13589063181500587026605394799486087482543530017803239994475549538732438667645,13329949252386676079710645426263377053183751810973538969788279784055444085091,12386680681590613307772862225908657100001403625719832791304530216719729923003,7313059443635334631417408104276385788845981785748211548782869561833456731323,20041885136971069417608157269779303040508951822068411540615824115716811017904,6497376869042504752008054895287149835408180730990917088183191265348284326357,11125724561218240201117500197186012921479012541837342663628667709300377769139,19153359808996709649541642396803885814514927865816858283729145733607372609049,20152572433538554395328147373104228881714506304708579989936661727209606561409,20016439558639474267285355593250644884337484988031314831332037478976434317958,7527238505813249238885718653381005755459117986453125478349742303052560976989,18157976047185465548629298047288220777638494790360987385974875362640599836871,12215475598068312355286440209098941716275384959997573662132780937926913300161,19661498481048830903134453807971238540013636804700867840177613880955309016673,16552339415724980921932277403793066165528259484794112971750640492538556458696,18694143444126088750994041983752049518157493949000498621268553485531912882317,3713967579039675465490867111467075244841382142654006118952820645091137343179,18003791572957152311824638498878311682370695010264579557670846595111585019742,12786965212577099174577804313633357821910340940882518052929431837084369088642,19196303109560878004701565248872597636081713248916827960361832879728708100252,13503920737086542355495290621258674491187655992864087131383678759555676293479,11236070378728091455898747203990505205014449224981497050563648348504784872625,9626632821060958086537183012642203130268418644318548991569123722985663518084,13034637881184844942276438495251249937482750510182566475651230823087848537016,1332579251268852603948763724532278782861309157968811258504214239247723497919,4440487054089857105584789445239911365602192945489433191329897791642671641022,6061652828396333618822938589797622370923339089332057787863230635686741988906,20443625886285957158375952392918402164453450517610142032850159380049279019890,4971727988681610479349722318571442785499756930724120997617079739694258077982,18834174333023112536455562602096071615163100988222060601738058925300216483554,1418358707619290124642186511810240322979679442148132663647788839527968980321,9146563693745266063334532013679253366507504975079644933043489415067653903203,10198203189192787713857436708411760529883983417357336104059303759507359385362,13457105298809247477659188594503481428440666731107167805254859937557834208828,17541364687047908905500996158296679129819772711555398152345796866338919060112,20692063470613585148684100931411467587781915529223705941251811918651910411051,255059205539662129885859108675295842232143503986252525395037544865412535350,12717171726844166947240066436059787676718930218202178144871226850052045252628,11844159733516000729567466032644347431569093736490287481873540624836993897027,11002794037358979127166193862990494036532493412598623614028528989937231393875,74143635505641635571137692594773070124419429312664778822553090280375104361,7056329304173643667817989532223449288690091032171349984912618184745639839146,18641921263165235968711057500989010664480104039807002554029677125998810936539,19559632820551845243777081617723524038257569278710484296878486836843940297771,20335178684657665532201643783226288715290471620876336715869115375508863124376,1400810679146237783184309652518065868576549410755675655514372408922313217181,4901107318137271229016627403293875571324832946427895930672961592355892796524,5432919409806696890084817096600220639163358481346859637851564223110298016918,7553857716186244958951458648858814979749280269320630962042771757992327513590,10889701053782808013047326782283414392744894366555627960860238324337962809504,10225055313049541990073049693496605844127702734102449597528239569584063842673,3178201789995579607967020188792297279206559603024986232709441132816492873170,6847656471793158091195364320441056206778429470543211654532315995128613054310,12528583474708786099486823217911492959125739967840882229222854187982855300696,18467266119817551899238434875437425808022051394845724810256998883759435014686,17038264911128891077018547486438046001433165723713308233430847345626729200927,17955218916742955831569749120296633004126823963586826720707041154002710061824,7211241300282304354221867200910811631523632613327223837945134059614958044309,3903314564827641199204912578257298318982395101598969445634590319788688787892,5807166989004370646148664081075213577472290526426314941919217927313093625705,7286215868775919967580841436085988310805057373157718787975640918960675793864,1250176112708058341117534856693109443612022505613546634776485361294747168622,16240306074762036443870399577875028338427695244117010393369806321281281115890,15136410716022250493730454911117704953380153308032786787731835907574927894490,12835091061815802274496704101037812141879397401714459083078081237987781157602,9740091907879287748866588073726349058132835900960520906530105112062664428632,15914692134543071914048151066306389736053927516189539093172532429297748396169,981367411385768085119476192577825808403597700860420619441932576179905250934,8146729957224132449602418119478334118295844780357577983658167000941734233326,590349410629703152398401018217258970865749864711821880028353966569788201764,1825395473256187220041087977011184605194426952605089376835233620262931194993,7123515738169356759148725471278134181610254795201025187792320024480691382570,17726785796913877143757425784904469412799726913909454284181133920507167220504,11651205611193223879329620496932918885123654427491270580240367578782038527170,7363492115511936228845261039013774575631247230570693094937015313770023603570,12933273009260754826631125313953911983930122727552157672205237418903525642215,4587914992471995247205971137457571771256946895956563575187244174461900917940,10792746122808647351065474080470836119851772052088452562229191086431179404978,20854485826587742461285159604615271614646978291370447131740817759213177014870,7837325030066353684135714390699866228186086140255598480265046489057880448954,6126605304840233971990826423459339578353618021565536707601222973624714560789,9552503931384803960142614388346661043921110897228435044165354206374121160883,21548322368276531554717543098918449676251611754505041151177909568762524391378,18180071753020516412865055548290459200005267908156340472690024449103604081545,19794881883035632088168728687250887611858393833912902865301935760311201163703,12697056234954492550471667283339416001528754790033934829512770385731960713685,18997188462081688420104936253788181208943789361069483606382840563484861418437,13583525090048988441168973253797491422796978202781056749054729098883924623495,19314654753949754551488116156913608959581776089474885903850748881648064831000,15181859580303507964634708303997342165949140724201743603210372837522352052588,1716462370658876925282526879979978257325560447381441363811430134855582914078,8712634103130722740728459133380535370865755065924597276965974996780521350960,9765286726648838325814219419835139491993130621932376855733750920135287306908,19656947946994771960907781244127562602401277628142459052853670194718812445557,19486837510931007596539998551154014974137134735704825357816939421451262185625,21628438018144169767837932394788626973405404712219671990762156320628259145217,3756950750264795710121609861402232041406397600142239597456522141772347776528,17539873562638205978340064500452614593864489286304276949397837992418594034919,31501567535731664761828271772320938243617735864979347171792246363428922702,20352331732176385362929127748957145775981304217223745596870640808444167485233,11226695452056490225554147366326688917799653401898260586559601210633144658136,11279669284613566548129429232553360604072423151872075897074160621145515173607,18292000567925132069216498991188575797602397842406377969706321176845302551280,17394537715319668724138949078062966852069669620345676386188677668125466782838,1758531732991926253426465239898570102024009352558916489602014827893071642025,10665213752467842898072683993424618781459586563812993734884914172018996230127,8324794334508227576619756931916312729743681044831168054976090310260143855664,6775442988166121274859488523805155937302608291295720635827623408019663108145,18295585939863028658565671525942083548149809167848494003118620027469243247255,12098041580596728911973293152187391806099106269046962124832995425376587592750,4179756701368801644640767039230959196272720402682759516084041748778250510583,16793512481702225401381949294778305375341554886405623120613660547710034551886,4048682207452656355407948755890074205160404299490847582459375283758637453365,1909268909139397440485048370655601811806256012192941212480683118923705439669,3957160465110711873678443805553768764193925226448354732024034759529771356073,19248605214573594176390251265821595013690814611654024253657271349217548577373,13868854211319335141393401333112190211632180475309484073606978199113030773403,18603198177495186944736198329095228547417364118472010561530819889899131849965,14961608796326843943228062129500114917120869339277918579779470648489101516583,1868951368661473960034964936590962790214375788389753455318330338723533775732,10905586386180037341368454391941851073795645267274288454955833628477189437397,14954127679800529819463733123869358237687206843820983026443645382142721727317,100097327222806530673180018653982439008319453432490738486899052539918122124,12805546034879808469495394895280673159114129337420886322224562831326122327785,14806980879080756440413940765209361196073245400503251970584575890653655885707,11244087337738788153622356037614703414595488262581651455100475566242231927775,18570222240753995928776550172488765352849447095675359684346868515783858763055,8341186767195379582987673341587963265518616797937499770780867790468554256976,16417432689254526830515766295056137071443518160358174458760640472715479776587,16841713253514960386433216886097940412703740575768017997853214356595383383598,14194887769957144867963380965988802472719946120213216012427494993012946567028,11529543378722012166333054004374317420377342192547947476057235546295927556027,6228288822288755015903485852969606389475962987032899088796179982251184963398,7936701363023944576389877378554772776727492414245244625252565794409904100031,15001498940712434912521276724772034272928752268882108797824422534795904619598,8473716056033059546731002019964120133827043541589774095605930332153697155158,13622250811616358253729853546023741257702106070523773564774458974873057917325,365025468139420802765331768400644334625920629446545823780682161731304140845,15188301566744221387195339021364877229016833910188161414607699674936046087814,15485783106434451702559510093123052549288846753530302451778527951586674987922,16738591797575541545215307991580378005049794467812864864257667302719418546088,20925739023580534811148616300343740428924012857265956692833219002712597286911,14889383841375932440118953385212403650477118619024418302909728838111026909639,16907126208352189929083708812165010150781216847422378013750129578871272492354,14806337329187045580963626107721698864963698880842972656340333617747451702084,18421538430347165869364634373319132341572867349320823968976066555816366184444,2434665826886017086044423893890240566257398976888986717506547657107156268130,4107084864210868857776853415457685723648054900688044144581857773829680966286,9975696437638488842544898875508262421180359453753428380941136617917797565651,4271657746853939228219168189957401961257189278944783942462379137544482211389,6197095881644784733476508213210037292053663537272178396466755799876037787454,17213367299854554180584426411972899951945067477706586927352113350447914118348,459213126097844409580498104618008133837044548373643874721876534610892189686,11543212578280368772068695265607222577889093375221336525779600349460584250291,6403298899310300874478654413460079479003477532791552465502800475489780616607,9679879153779101961935393514698788441597495345714510688032433497970373876200,13406313792037016685976311954559553063553089970578743589839464948184425020319,18447061183141116334003130470774130153225311547501637266696790170481921881877,8380490825353548292894683756629385493171585978110314915970595197861650821468,17748778220767931278266669246252235981422317813726374848817938354712043425250,6989443852838917282085440504075239616539844445576232297589557657622451430824,7831657729066776489302369169030303662771324770284845700052063314128105065459,3925294941359174220766529276974428294409483857727579665373968233976340302182,11937917292063962829330707841648838486196775641195800632090436249316243167473,5653419633240940595644007985875227652581749358539968324306529520430709397246,4710671638294627998538116427765044043262338916893456876128991289569569324348,71394869385825610742630406624465024289788832054180269745498390791493509963,14738615985593994376179875742690333041302941042023229128451420345640432224466,19352351801479363044593690690009745314348194116715421753626607893015433391861,7828134540699329284695760683671979636145431779072416908240193138816504514982,21767328407325385326066972839469738803639297445302836419167176746643393964398,4363185783182535592354777041764733165968243966270266866378133278599205816107,12861900092547198665663242905083918119082751367916515401033164113207531942792,26199715195773805806030726371679979491296157888969354080702618784507347327,11422842882875515086151723214834881230789142279246505109137919711737652087050,19051762302341786952522177542948673906514656868374502102797859778503069987555,15304419135175746829806105353267450572438302765436283477928256874309497427510,15459263896362250252603436487314027681146892842462223021544635764438917687246,8022722450368098005612162808615173120915189731064159685566153653273958491689,9933514811147109956084664025371824141534792260321581906034445537159964992688,13658822996647839872436185744737341749492205026854185105317636224609004876375,14379624233209822191260559290771588358188218543089774948098229868966603288924,14958992313261503520770373701642009455846990471215730792533739030356906680013,3008264124109355458910031641850139041159853342729069847393839537381972950880,19920038730043462715603813734444323019432755215636179923851277692610637123174,17230906594400326225968287949357928337332875589057677202822764136401667097576,3295851897757873055813703602696670024935942454512523388333117755329662151138,18768678356443319065659286382395610390856779982946155969362775884999359596659,12460586127165955570640740026112067337902936125125513451212701690418329829958,11058259665604247832957658651506896706861484197660414347806317812760432481190,4480738127714472007170345890289828985073762836671874831610164101698497828459,20356672216023774813369271811683185179666462848912908217024611254147608738543,14909200607508800723484308159953932832836734953149954532962622450689109093081,9061041843468229886389838095513813426084716371809563990186852970500432288083,13877210447577198749973239837374936528445414390167357430100753821987322195433,2839635391670662085450211408709683689698694308308101424896263880864913513894,446790459594546823193048947973948688374393610819268956164912891701746906791,15513394297485200475424313247005293190116598898090270540649465364671255026149,6430544300458423909335482367339522552006494240640365398487065900428380674587,167620735842959596421416387102879695919480795342009064535989276983300514975,7851629689216713462310956055612887013872895546158054432042649792702892211944,6972603886636382162328373670318167574093559853635999968924151410796861460213,19413944499150555955013296242054320685906330193520693124525832782341915610104,12263527706889748735493918123122221596983902069097405802497958581677957096038,12724987466750360537318099905062339029588038359925927031456282032606443592484,9708897601683631082524518294366690107466919479336384437075715215088985624241,5574496517333770677326807465934080003942242224011251056548046091202080747952,4426233947499799157064891373345188337862104712594055992042177154581455374210,3323616387049914826284182817146044206680302487334156840960948301224727078983,13004254604656434940963009501076991894817629784556574456240824509876544606284,7301157702835275823143922645275544869236677259284614641634323459896004519527,18085948818621221598774302236513376768745135801526414290158313790799455691975,15187850571325688566534378765892972581891242830408971491252049503437712864152,1246313402425855943486273052355580345666640430821848725745627960892819218740,8647394846748193532697036206738902082890058434940110730560542269988727795912,10064655809228901737773717896104022245084200167358447082271876992404069509689,11849936299337845059630533008021049942767799074160683892846518986534992566533,17222503330227123082665055850287821041983218187459530901865330120583332963245,13182290359799776528759669559625168410983932493170206108456280901111876076502,16922308846046171347608544335458702314243928203269931669473214292617484140503,7558805163644194610710740916145749972491144028571940176012011742150030513578,19569775351485108268007779638227959360722563519500120339858146797114197471682,11059423706111256170971735544260170713544645580527143674901672982061741530101,14932750633257527497920398771292456029356930315768552640257901217840963910603,3437896142924792262479946438539259423504563537021031548773393821349707014872,14782805101152549038431586973278748014002447400847124060642259960939628565044,19682001999640336579725059393603666122104885151774112167088565361216155864092,4233558995266469322360257198354042357488781625226686110373130567271844168385,4047511689246902987779521780711143086427724115291088073014684434358317932158,13856430748589477860039479213633534029749590309123560510004500567115861827367,5679747763871928801801426015291106236767446876847749477902392536633742028903,2480123750122829773963967496725275864472046134363280592972001159541781284867,3193376214066985989527250356837102042223952356102254301113166141443841024511,8062756153672663466999843325461563174537500405375937887043564985230465866772,20934273497132536703003386629581299436206618333301538059074736379428757199398,3964142000339408965627671968349646710437601305543271274636785761452376263382,17659047756049778260030257809618419752271933594271518827815853540916989127582,3930343349615664221386794926953117177573248229077177174315534154624751347076,2895341264817391965072938270159088942930942041694844772295944189135688863196,20818043348799096204572140288297522915577162783223193328931006646915252532953,2323581855503968054101786162741712103392782241966098143187644164748998373979,21506950445835751487883729097676565482258136522526260378635240810473639421131,15652663761688777314836638604018575636259220826467294056546736904699739444415,7055942973426557227578535789272026034619140718369524980726263182702440802766,4949575918974841751734514119081067078445927926837555007268000255590820633720,1398399621038450203083960309132739969264364773648996881599178794373813964423,15732506799197618296258053128654220838812930643001991164136863850944185860296,7794835596508268056707656540537636605902268233816181487738953353424162592877,19334780957038992630028385332334147629399375592719839985802296503565556738324,21635034093671076768880953665214862813027411650977124864184274112296716574632,10688534301651495143056852052149424865722511689194196231759927113549978532269,976280778878149721615236526300424224199708100054560296745736876703945737879,1661236337347680899528966953581439111854379099437324147973193626090712244045,376684649999303144466214973033408609742031466036082108742020038605665915381,4455377013377822379614998251281676782235647079572422444530523356359416320717,19050227778954804843017265242388770579299436899390433258601701002663268793950,20176738847900667540339144241305449384029623393968373234965844794399275414945,6563336600400724498009526486444642892816244088883489205001024055715188696046,1774742053125969896553337470644410955775448576794083561882186570750312466523,4720344938456070076793371724100707050168913253766155392188169516296487837219,12386484928350266729292976320659720907387619673269670145583838638028478942370,16511156064543308562970376025636430728255148453048880933972883964686852788569,20161060548546289109867983393573712303980348945862267966490524939511877278515,15745678416495620522776570951840736496696200297848371457414809276602866061937,4371269787269411959190919691547618186773560770535442840395153562222650962400,9183286542027774648383851710226269089477011745654659545146528858483988667073,6831030131135399650979313302695351819580359371445002328037898607795789751628,13808316624446561665670975675845412570522644424965154154503596711464812129094,16573850887526809906244420164574513771138034770054149931125695105829690192839,6536774143914522904090235450413350153861560318210355846585220439397199352760,7433401028165144185448409996814186253264882020047922839648723974949988749262,12023679188187515805015064799648457297092902074185758947196154639017034370941,11526239531876823273618354625960431640864995247037473959040869772406787371745,9965606134640358953439667616539308986324141554480312185321082780157059913160,3745993460581557715489390110730324720335274000085036229679909083358071037494,9383224303353982312273937680493563948228572509816601479265308820357851069284,1487827268845002359294235769079867448539095616058866371843794273898817464325,12752425410737476015270360130920506733622111261208379938979967899453342006543,8485480321269023262044616550897625372838041041299338618725089063696829309383,12576415359894007789769349543504370901641305511107563487651205088993508989632,21051289172896982928450490300579871201387152257916628019163266526462496896736,15867382033370376377605746630898769390447074387330276410404020451043720395429,19175636645506837972748760370147539503389959528500852183571848133179892449157,18562815464677471696203191443459870050160752363485379734113024945295929018010,10670914301723557472895334516073215554660627986142935452136687134270343499283,15711527071984806338686904487656233279759984782956970430068615997429454331060,8708497335606838864375996732302168404094513852034309829472484268061328157580,4188819471869628756655847772489988754984005896205326092058226221066145721122,6512127543122355053584585699891817324589817660150620823656474181624359941201,485283184789889690494624068272585257719678055879291431306025716514618916201,12469998319178098719636931437231251055837496888416524814745527432538031712785,1296020106178851400649855820617531046666668928599018437234450345456859444266,10011446468770184926016968173857732818096269728811257796162165899021103326404,21669153150071610384945525175896288044525929994331131233225247540220566590451,20224127309865911841696813826362911446819981503618978937382553360215894705096,11995994988481623386912855165099904216709109375061333173068533008232786187218,9410915142880940758336239494539529470909530692135279575732428340046078892946,540343796196110456420764600417592095932817965626261174892651237721778500283,13684306082150121243464309606855998092353075421168995445316517423697818489078,20162825761581699251737493230139692067729837621407892263730870777826880180708,5352686262532923758786328475456237662420216644156835779261605606151509572690,14736042040902670309572407869335525984156459843045648740121852458089457172710,15139196852186360494919007897486360521240977399849539996614669434222882428974,15545525411887550591483485994597179301368938856348279539852576272926020931130,11742635236612776978185392287408975566560283293946133146948657681925156152641,15933911044011218543142885674144914931062698638612248403425430247045038884929,11224528638969252327238392070525091272297579382723799722332333037066879094771,10619901685741876140226157641208788563882472537632692937793306998778377039845,735284898318336599638540292516453331642892791568249331436388578312138627149,12167882615164420400306427908818494367178873976878804005748498778042330871045,963476496798286039732969224933550470500612316061831761002103352026702296408,10589214229258115348033093903975219788029199245856576715398082842145004049938,21557152519616203688970824263287584036198859167308821872261472006356046725775,573869759526051245236872936984426432239686428333700586079723439581218874054,9487380087795664760223154980070289042545005448274508346993861027000032902237,15336219129184315874932697305233742095099896250996970622669888209373427981768,18404646237880969912286263998117686518695361809473583072241508209656556652987,11799938531163685220849832019747758716514224719376128562353011229084757783628,16344281677414470708413218213072185241641469290932113189992078158350700334823,13411067297619308137174262243170594092291209705703155674514006442224279302094,347096376483719141995221552155578565668868956459941108952060114777596679497,21711034316629345478518202673372708169627878437940325626238942704003376069559,18882050099612599842940192045274010067786778900079004241849918566254608017530,5764257238170917062706360501552002326820365975520365982521494644422134554879,15701229555594307124251301047127236083745198814231032790649389796695363681317,19380342180431843316217793484208165905833096992510614135124089140124740832734,5309407894979098314097225178362235237148427064335413702368413584568729847810,19819307748431076945425543888401840319829139172119377623119035071741874422686,20514761050842041997240240118048816505140382250318444479066954659053422537618,1344402086478653057873064952452423683387555289301580402150577440089615404706,16697255135945674012509919105064086681485448643989533271078867487484115301326,4621832835239804428359762201398927678345509964776233571546153039277467113103,3806403786653298341904285490244574263470519864399252904304315511448068846106,19829858960657679259830225387994355131769725454664502533894857362311545270016,14331370957097049770140547885384829422939088321033246508644491038102571773100,17602213870111183187455849162801944225604239824059691632957781727843794239813,13431951289066965496411295925849182623784324208488725900281691974104907065599,16717461480909222952301202387848079129664321734166452456973177865963036285419,5335304795187086185403562863303763030150108130150704291401586263249269328606,12084224077193103457678419187386990486069302392148214780322095375978824542075,16562074867094659170642419054272949287052074902139533680078784684856883275478,5593185214695460463728593774938986800789091570195563391333689785627694694435,20794081973744988874029976307272029218401016626938878812907621515041534590160,15290613354786940528909115982493729676786892068577902693057827852601851859953,12549551509495378488198674258192692896591847320322918116198744545244343099813,16172760618549958023639071988927160267123900859890153325976796899698706870529,21355970775695686114097146789571025790146162225961276367865670606869296144640,6758388446832091660422761046124378827605916325205674642673860154638138778023,14106404069959859167123546389809591376301394503370836987998148793984105405167,9246221316655556670219438263600949328330249756179668376432941216174575243170,17439153852461693097676073072037755599321185173017314957734642307684740219597,8081777382362242695298005068719699951526876053236775057946263871745968444089,5955062815471620144467538738332476050500085920379711183343040972831100802372,7135549743533376618652729621156592228493633259664287822661943632128030927327,6448789306286809743113676641229641365524354356867853498363388856986312333060,3836133206442752775823759632522089911744536837043185745585363415112795166600,8306967267195429229901513132397768469414281874455321140328179401973148164445,14279081291461540920232629360665447603436685365844514491245275283801357455033,18801535274021869273717064373621101183756544015062966551566128881569524508060,1290309525505162730469471418279301124342110934722264762505649909318202025429,3684482296351796270499952631629720483486993312250657634474107248508746062899,13174517099719760880623841117042663715711430443825712743356469456554740491052,12367323038661460523248093127080567074978912019587769246568174104058982359108,5328098381011440170293483375144450438184897394389341853376147620924621832373,12027556664769952184858265393953265399418219730267455116938121684665358512140,5729732888348277625941886883620484887709258694699060380279441089816970092500,4021085134780294168590418396176917282024838594185209785357282466818023080991,17212964584402772629081731052343755101208077509065176631705574779383125014657,20917432005010641713392920477403385909781374146458276502002720501978360592707,15295563898035514774486916635776497660635050791955975586488426545424778559212,1359821178683766445655942489230783986383452848368510940932965034076334706033,8110406013405532283463947127567634123149268608919736912581466809002624991926,827196241038734359771319428856617658913932049877272548875698342240161957065,3791462512735380195191512407306530846222290938359064542531485381855595890578,11406017533405938491480863229977030648871769070115386849200353035840595881771,520670302347263967262738466276891414776779776742458165836379179429124641366,2448606803226047006259184225386977543879941109635656602752172963011710994490,7191227529515483786577983572625758056228282372415415309332838080598142611412,3307446417204024568218448979093609311776086880103323372856728466529459088211,3813554883592508538818724202670630447381185344079357801330890767369937578758,5250709431012867357277423372041580897716232143432581463056922412233378167706,1091692079685509315891403580607856616782786079784896146193867325719999481531,4469622327160639333299363654867070539113198566013450831894562184457403911597,17323310137022557438196735285237348172608407585356043526322906169573029382454,16687301461250715912904355201855034952586622338354151885963080312175524252322,4918535113766539148632870060160447192025270821762409737556656897638575667317,11072593994523457387389747805751581908149754361901108358077132406445033545004,3195233728052289389067022539306995714028010328554486938319749354377057516714,20817686894891259203267112342163112292566908705837357461445233267117792429649,17690940439879640319699865226478735545090209049084370958835445823603146902951,21690628807014351230241926358993998569388931315165663025074689739408667261702,20459556268654252373755265495950372631044421643418312123931432417755203158692,2615012003869030558909061586486157199297754407476408867239954327608829725401,10416424720480840919038397124331362407722217483977166150169359209212504823727,21194909967788113390574471899389319930586662664636393856442773352403088570772,21522774899908415003330605964114671001565200771087582504208866633533540017562,5506611081865651016465481008237511873335242056816344474949867549242155650988,9546865422597752417260521115459137295056544614907437375816616393702205361356,21830596616035544007289279751950703469521180388685936491933709578982542912017,749611610802485176586202226352686769865522163389912514564999424571463284657,6755555316754154503813947597597343604907450943684878399336695170747270471709,12170672505455181293754012516713072944675179516356563083524964881029055628483,6707337549725648754250613641063009246814657413626673293152655855698987287596,10796498904992920132771232449170737749742455370471689413932089087977711623836,8377594495858973573128154823903039902710916666748285670520960751078778241055,3984683583649079079845275538974168947709880082512288559917193166572776389589,3342097912826432514400613460588054784328673911636756618761620185294261653370,16454683529696451672086473280821594992928717172228276559555553609303793416523,18807899744562842658522302889072060930222870278511178161869216361165074271071,15733467702619867688911165419464811721151813607792971238595067966297846247623,18142314765654743253383559257284245535624730148238939832089390410939642651454,11195224772751371350570884976842181779831961285896963666553011681145523971069,439244367736881667144534860370666344402105076566699968755250684892603338082,10704735720989025726743300184412677969903347430627186939154207946469729017738,18578876165452990292495920166540986834727225658030437088905164910953626259691,8557967377050572410782106944750290348752651270453684627569664713996263383548,8761045577121588487744533431678957572685193486431511842082771483510204390408,21449005117895748002614414579158497856671036353929407470614229969798846654314,8742763699897193075490808534988551410985191733407596422193467672281063172120,21640560187468057824325948244870722744182743184907610616373323268039154063822,20504827051323136179653341596769205909304116951166709098994304340550034816775,16172525553351370894318080522373536864524825253487998830365706514360525527841,3591685457927038924948528662301423116917211093679974227116322357454330018554,6023337410706762262272160833625601604408129024083079173527188974815598816732,18314718271070348604361238020618683829686900661152269809595508349472847942062,7836153641990744469550400020392942083885339413553995305082889896550143678297,17661458352757891434962464787581216134089171454741034624471153568868635718017,4122036760441574620764812242429576792598439550172741100479310420694208068906,20862235339890611718235387895311549206105487705288574136561783190763219344570,2850551701806552645458448511649317843914427882049290827414738885733429831896,11247005361958789340696615426808536553465247486357927152826112838641725799209,595377141566787974548956333113514797724094819448399289547808025689225222483,11650535249856393960142913145219442364845834591244773725262296147168383099202,20317269079309969728497469029861008772266846936951222269809633626856816105008,18373353028723033673212698815557995243796350917201491012576826029280066160567,7414281571887634589036890397094381209738607746338326059409587963803891852201,18038763738650749116346354096722212724532913209902202281075842225944189538168,1770786615956839194004148114013826935077292967352199469327501774219607260953,7488031997643483244135856650059587771856081877857609929648968340004445042854,8828420155416920637244885570572746512651260806059857940333819295380848667606,10713758486859145329962611447140189455100648474003892294431344231535672892839,19425964738010714594065721309197326935753724219070408633462182732050226443166,2074939531697630696938698501714595125993887544292881866150005180791766942998,12047170609336587447894029543834769407220306562179617939497216596360229783300,1264730939976742978058162525644425945405879597356760675420608373469615068174,16770820387947475117163540876143499701759349964098540413422664664028819497801,16280068293625117002805552395286584356701604835446863786447466051605766622630,5829399622833188992426267462479081456743106260845929463922917463933701539334,10637584899633814574790036401685386209425675304700886428980902763634911791837,9291782595793252587833322197337655894886134207930378095811922971339860144588,5951026341599354622946777675133435736866407426534732764305509667517377130324,4403580174404926097288523091529640188805282235669930524399146786861723458014,5003639966922553172252470768563093188889050306376650665702227782913343083764,6558197410800499965347594156873334155413890035105551024236266846011615264982,2475377503098365612622742300317283313185534384082772531168342518799898155594,13480086440294256226712366993542304396509909765502683907895525126405850150623,6847184584651376043889746562956674365958636593745423518578010394007380039425,834503921046130599339994952233856873876410737494970024102211605603428829597,3623466614124962325494185109684730979089103423795285554788413052641061197022], + [6418344278839121997761558068555633277874924383297235060428040203550148460392,8184778893153361724502825398680471446632259194563037088246379746010351701224,16103007220917684483813510789286348056519805127857943417823167430289370248882,1664056765289606259902279533842090994664529145577166075019619213360544081038,8189267971733078428327714274800548471520787418839983750528172780925243373109,20200362011107872066803394413626937903139046091127740529060907959370256880701,20173744990845412211550008592188171997284132875646553363208340317991304601908,6100976759548353184263451545777211359935324012594548692714862113681123862281,18589557631793259794347972680714314322014920073994928130094285735070065431315,774191617468212021433032703138192471679212014828288788368078839883023639562,20846157077077136618808870082870348881758556999252332666235423866411633465885,179369838162302125553370844232732082673907343764950159722856079645852949296,11918621764929568738238867861947162353407822663185301208219638335882724852664,11892816132266551039449220442540498829071526084314780371963132054098089857199,8372083054789567618141127024727893763407629214826505908070525202510871464376,16053969929668995455194287538126250235271805322133461918670713060143921845064,2376335354846722834191665301267088635977856417140218787958824096999457654386,8473768787638105406889032631028566536048259675966039382891971280359035809717,21341339254986951084972542739281440827262568377712659704364142966685544694259,17589661461505870684154172724042456165609752814624225501433267429299923279866,15569410058783548405562051853887675489795673100717406458705097884992918832740,17136771849960699223133648686528512780844440317239376836819594891344485260741,6846911134505306255484642794298233221271816466086606204236441947984501580805,6155197242495613968880604860842601809115711093712877692064968695514089066009,19128637117872288039529749360298403408432890998345732113683578733270478526860,13897081066927368111242039741190751095002227555149381235627883407347099966197,15568696369607733677931070776042128239961624292553408918258251667007167792827,4872469898347155985390501972210222637651779849978701189099596399070936407527,15828528305683107589096901962734302130704783164486093165237194118210566499447,10871050448146531061933214597828428556087596885695624079458134367495768692641,12715634392841723603484337993449575047813504874083783048519693646075495401499,12461797447292058643518857326956961860724022201671935652194772338021756072767,7893478478385050482361413970069327892342442172936930424757486435631374257835,13837601157198138379089270567935062044589875195895421018230835162664685103799,2902437942374588332095798046833013227638771976745087670719351344275677524328,15243444720000907684100993103252257759861356192301299607302082943722781818072,13807772002950549127635782715429970069282430778664455286304012934232212216437,3330690659470353458591000516836956263198779643900957759109026769401030561064,9121369550752168091283493588432030055987339875340008013960004670271046125246,6735940425069065421825600687003545396352913420833444906054707032006918504438,10202597085447755780667010145999569476263425973948073114389503196598866401333,5502428069812047253902185475715178213199056100606031376530298129227524479345,16644412428296109976288812904703533310452124314681543539244699753829624611041,1464363769917768267070780357984170193149530071521363359029977430003041058712,6585015011013232733155666746473112211355795487658434466373981554623709413097,4801399347914387190330170488585953929447785020623558112311440395749307391856,4112082032915966312546686950757741516554419896344654985273514512341960565972,21751105223203500709422523072334627517145925318798961657655356624798705469220,5444707496026644829581718915396971639630623832272466243662913303978147462160,5176202236175268355216491019205403607765794084697970681965844070084688885903,9306814982626014542830328909308268815941037317672165275254890008767120833129,18534005003473959617581160840952814838772020918476059581821124675494141739706,6315286473605163880327953940950267064586093973100720152185112301408202766527,1300066066523772310953083996541204931152213396378337235691979863222476540925,5067928636570884230858740896001720688497565237268231912398775294420405805509,2247332707031505717534336329466562637772796336116582429349574314234357562544,20247738241445291688801934041857783193064556313940428743035963593744371184825,18242310613256758222060583109097399506427347785291803988073944852458874238653,5027570650503078047623512055050961603632044524914664539379503584245086748701,5171024028215683374631525538977404535998938725569475537905229563957776539718,14944506678316768982115249709678873125670683211913646815567280613875065136559,12712774808537003317921729077604843728755135888798177519726799585299850232729,9704917525949617705578174784620125192847872142914494686332094535178307346294,17607293541936391773356775760016259535976314844718033784671775110177131099056,2540563558441922228123722363766317044293335648393481767268774186670778379682,675334497725789143197575210295522345522852999942555409554666160997486976627,19406946394055111935833464724872576724279555593094398662505995447037826031689,8556081865419484437161415079267380957278647215963771014478927152338629734722,10894080579102201350420363592007910695129177124810422954037601558695648517625,11291505870061211613677608925985023369330908318817731122393740145823745286941,8111345701049008354923033690718534410144029586027127161268652239467844080405,274549942856353845785392053622966579448945647367587770109876363273061435394,4517253471300397604524436610993375842851058850598308811197142784491633632173,752091920065645178354359484693693144698238715470242001046768604290011335506,11638201273705718037686872429810169270152128290712392950719778292205581621583,347106139963113855692776969661437659762102942024424980057845079543094637582,1650860247124995235720423411540903470864782697117302631679816892337391491913,8807792864573824348524944774842835780541376663413796103538010142332713129239,10125706840777901469452374931444076850109537279493387272544675392762656076263,5796395502360267028606772833560634747652475684290748049574810918512176530377,14560087906294745333868694378307270211143393355422503000240374502300675908843,5122547319055760404581514483238475236540700695938727023605315976547513018758,18167310745991466802649320845690518166441060923615799361858509593334862918793,10537655786889979411145772153623144374332103428122704649668615330715372491734,11129217221221505592409814225825346415830118409870141057639470413354985898470,18539905463366886572265160849053355497514707079972544561033138019460289616722,2634262960559341073751666364573144239402802922297326052528609874036724778513,1017221748705774701515487698826243372900579204850532621904642815268966836932,17514607882958712820434977243901228312981191640605665595923587928949930664369,11518730158165740016295488007249832672982237183652963149460237152135828893220,5440554707898671641433725775650782970626686693839748603607869391440450924607,9147974268228093219515993293158817299424235911620662153289209094112083583914,2705991777416683673465834362340927783587369064825521543877658261521166181909,17763220243034576321349123132976335282008457858814906290437636386824597776861,8436811158855395670172615633911662578819734431001698203244903207934616540973,4138616319619099661442960332848564292509386403496259477312793995345740346110,9291305887217504987438822522544685995385674372729325355668719643387679293273,14247130176192495492949419984506575479387281081069847984799112525576996955413,12065917784915207956255864287163607339403293417584561373088222422519855200010,19602746430676351974790620090862300757670420200072717172839368523905726952498,5634613092261261536249683912838127927279222476821160426063089671641025921660,5043354945289735676261322233679902891599697472766188245131942353534121350357,10504830582720502950783794220870443419986496189960249704278002268186024527222,14773755085011014730752864609252484899166588993023999143755304644745097411069,15143011250372146369484566133567610168314155803929775363148643430052742055690,9296771043817098875687880718048618354875037373605143322099708291917193542563,6699308928121904151061270394393246387724926649022798867634982215175491150673,8773562200655600334022608356584787571874596251190350038742467377669146368640,14351113364159322541281738731216101468935785403577478179790191188832046493458,4850132968055386067280912095292570467587181719320385350609813213372507065742,4016458733475657342057293585429845015911706822034026494547861057484844319736,894041043510502707790816962794342134661931379046385946357294445947889380857,6102901509904208647404960172211548023168535043766794923435155807898706549347,10993930772305308408754972248679389846078570700140268311987303413959565163567,11304109937008720250639855591630423562437629896442798574433639679310105935745,2101572929952921976477335632619843501489349436900225186251308254022656908969,13379549674365217138865497711163371499213584223441782700932894243483907931587,14594340674649653462364863346385318403203482098904810919462071947226757935441,10647634642733631076053157841634424396589261258510712678605967658799137793311,16930068860033006574251855928288208559689461032565007963103701897524112820278,17170753006961827437085793102001841977757115057767702296590976802337127094191,1342928489123424058754093123906133488378103161461686346784407392402405815911,355084123756415397117817901422581736826549282147584490336790542339114994995,1823092998982212793902589678970070284970565355035702454684653415443223765731,8048898551230697881244098474076915607341905762324328681953519068200924158237,20856146965109368880184165603695312280799455722407374791306423939515039038196,3432336669019104452964292940253917813738689308738628946720655243686051453920,7245438991832359030357502486353272155562833935372540938834365796871211337300,3373527222057951116939099747150655397463396105930227294848620975346900604136,12572707687046208161448564696692430877391470466184921096766838283998472321208,12384937031493229201662431219560608524659573369707802134091983819133706078063,20462122407152292556380602425948480298757076111535435284512383591498863731385,6622785585380387259638611864923325325049433660844748518649420260935388464763,15605049021670133989806310757216368923392900885847286376362426319164543334301,14810486805240500676478878806350063220126440203863567013665308737654824897393,15365995118119349988306703047684161019037838200991362610041019844939301169864,6214064907470154787016516294417895267553707205697453843662274325114029144555,21692877109550228305351038417910800050989918141485758185602644390604582268196,7958034635501608074408556743462969750498597833797740641656952760348926890967,3158783210920420629823137370399691077131051120551658723733852791768119909942,18819671751132769006885776104610704012597692175792895108910904654781356258396,4790325452934584098003515312147561388538271922609950099121379835100064976005,20767398895337785696143628393192433940154143348446221959395714109953426025406,21100955173515864394919601160078443835098475047602620649008862351655083694950,8821416529246363042674973639302381036248538012124317741611227124444469290957,11914021995756592924439683950035443074155751236836696847913625157420325157778,12885168008148287764892654933214399102034605991806678959486007885552095995306,4425275709248360981167156075250953689813562430283330510520431316578062369047,18741351324856319300007832572892392651059227679283122747711533395263296376480,684786537545646459534722549414114801405982388707719975074226812265976115381,13474309605538568830758681457803561340228343878559353019653388997246494295147,3099805728977762711509412402176547022850118685798164610570416531465753528610,5600770441217208920894248156825173605916487562076226390167638135518086562704,20319458329312269677818220957673767032133429098791178878849925747919552800984,14900034607445803864669093098274289660238359682591825230729114910199159461945,8290880045417869099036293157381173265982569186829040493570954991061128070937,8462436298566072387124764625279911648753174589013128335782578822029407672023,21859976115370951722195695482147975930683297060804395404861331672395447064815,14955925753372802734448760267566451635799685206346879293698701403481312089613,4065981601972608953318716423564125873552717375448854762316325928896715511302,16523330234791629267329601436136683980570251446067965291433875700044665982992,4829516041540259457263557932051130738530942234255982016822863700315113125159,2798840870433591285859944008589519120500790120158397573735407833376475300691,13606709616318037902590277227595176470474803011913892797662975188860939656033,18594031070203820621139505381680984797252179318940256457018473319622484612714,301595919185954926511829797241004376609778538475902874115890821742528188064,13821866899865257052128875138353714301663063129600329885914206051645789155403,17834817495579398016717972195069792832976969906967797534885124084571666971093,4636638693344568063056245513561087534038777759740617868439601311740450428791,19461094558355290408553329139619939302588770167904059927666632659470708174566,21540578068459849172758651661944081878533817564350404794583097681041474789761,14656354515483866868842463518575118611017107704362419507056354562832024225447,343560765432454876700403976911389497782754407830340801930660700142029455668,11849359483183996767521484728570765305101196328390648813094255236259946055317,19924264286421201319107239943837407504286665549555105416180422159851955997381,17166797941774367858319514708612731492719223682833034509589752159955652705269,214236542688014950402766598120744795751883810511956979430464011049570919618,19396313302865541199110558245182888004201133198902041449761385765703954241755,12933296125492490585010683271492258153065303286717891025958189212827073719981,17844270568289843619005627429285364222068221173113885235581641198349558307966,10272636157097124940050637562161546985351212351240072791897429490752295849402,5635761628763643716582314870927054669889487541831762994265390120663404976213,1986614715532243876888195532508093896345436225715262830320266933005235142097,1081989267417492031457620947123272024310181199896785177670601875483149154563,4271010751492446271792663900865386872716262596127435260947966701647960153580,9432817034096362918055925335622289410018247097406473925807967486887418646785,8420506466048434939907866067225441403679080978454172178355845135440301602325,7476612931957868870953074766426582066042735713430654491467754928300129405389,7004218213610744415525118134908394594325377744218316765510260162880307132371,7571768879245095309014348656876595924444469219593531275918644914891061799835,4094897072683886403820666572344492999293005026807228977160362626188210714131,16648450944544843693538650431603587114533063135176857105384828552675810607958,12887042974366913908128212909540148628955501312789089034196573637089727885967,7707639242815954375609957852547086529799646052590213478924819089112009057667,8823950326593148986044014943552213420762296615584865468926316064433145020153,3784973153813546220636380916429273484146041804997715013288159720673291711004] + ) +} +// noir-fmt:ignore +pub fn x5_15_config() -> PoseidonConfig<1020, 225> { + config( + 15, + 8, + 60, + alpha(), + [9296474750911444465025945061626611450573261102544117494435956219223872045013,5146180402642819236271333772846779841277266622562021651959982317806096554632,20454733758478774733902661862471466785458678414673417084919753466149262477949,16939720779646471039361700224425387363963401457766730187304254365590145685643,16508379613071589632225608856524646606497744838305343752126125339777944056893,20867355466989514329400908378893992018169546886162092188544040547127653338003,9562028189723224670918372808954372258890790835333923497839294908971703629044,9227509288281899178360094205033853851646604997619773877005168383222677033411,8509781355418257783679010460137433931646066572707591432255985024195888527301,16352397893201944000231474199631274335610857147594743875684031732171609392779,7168331327842901194795012403324475179802342440545189729818235304752196473490,6805437858781519809721294519096505646809998863249026857458359222740400480093,23666102285914319661214067066621928648019777016465806627627356483470384578,4937167589168346771422573562192746031838523475116047879790134471501476035621,1346691375815699628539641638232212515770545677194558930872887124097351576509,40983635009581820916284370715993074471281691288657861297464948812277259151,9682480346612414028382424944197316598030638601235308149341398931369789543950,20156146228109066705562831124708208402478981918458654302206305397911512087980,20244794515708180670563002449620617650597057411850557162891558214158122324521,5973431503164625202944413714022034366590666955289560873103517106326649624937,19003031440781649161524015602474761488168160816940423515211864494962159501828,20712605099727052887180337155696823289955789009114447705180663042338119444677,15751263674652110912724722781530878809312788917232502379399572977178318108528,9759440007076373606849230657528653877996372541705166313887529308971932175875,15753864581145946158736383142711883662973744817981456049085179548487345401534,18516736976984654236711834595195133682620758902795528251669085852778367276210,12505762035583653640932505661921159087471940695093437071026827168265805916842,17973475260212324625956540069233265735155253700466680406635575121618318752819,16893238145591341977099515648275086133943062918579997543738633084157810726656,9669071880586595648023284909288486812190820353718106940661900367937844527179,9349088318894477564190440283477178116641834248883927901328258581942583077569,12186865849936919100247208155624431297953689379595363409626510899600302936538,14191429059221279746000430832297028082244506830783856999765158986408198377932,180235525898780969912044806879591313131227292826139844018949863600387171682,10889092107911649889040150092427122550710450427668385404292705974881857473203,20693842198933957663269842304864226322478103663024796211607837700737760050747,19741631810531886646761927581354810838182866370317964412790883870153217103250,20514964832794580053019916730141871673725635044918093569735954402314586611172,1563081830952767432323468775999289294801679977848773475307184358241727189864,6541733180459084604825913391805383670644609126706479690307729028795470985900,14338950551652503213249338133071776308134322059752479422120853035176120166434,9445962403225070324948180958168278025259517118659455884585920056598191781467,17673503748974627902616087621827013509215108587044719385816919777868083778907,6529067669277048252246949093210874205656745103861744893697681349157159395382,18670351688014831561846153455584274335550086431574922181801742319576494275746,16087198812208315804697003049026004024678636407919712012630915190666161641979,5409244980912243970485734262038475969739470891565229610070736907935180643717,68998709875023468479905615300134369445692715997447916337587330860748485243,20797106660136416987264043187693969873379408007710762405000375236313842719688,5277839105793767851333321356647781091931078040812937205152067116052352239761,19813316014421099365974197500618281012606383357022846408656988057396247542705,14651854807736789020692970167659260203349703129364255901280500438993569147591,1953950121645869390891017290629473806985703435547819703015178261443018199466,16966986407661837074189113052135209905137771226341312735335483526986039302676,12196911666087491240035929989808617508758866763772938948559650992149525851273,6748262588722620715981149705241221174138004527637005241186672382866432164292,12351853389756326378242661122644604232955500481743248231924728979085806709527,2565243335980149108987604508873860765952308183381198225102084152967125103373,20241307878322245036836862464964995816180104231642798486998859049422772672116,6173912854438429518808824631217531662651777757438489861961683800252069642271,20373949892834246498138105881327221987245360841655169052122063615887220321147,13269719501466581754706990055797732063851220874637620573076979035861249715318,1578162066274870756439515512829351279665654675138074205960935197210851459902,15699466465478499203883101572116714566818501168342041974225130392829754730992,11504917391580472762574218883359632564098492996052059988389474392975779673931,2471534962918953214626354556158558932844702538697900698209059019370494276871,4461270721380837522838335428169036184773145514356202591842435276161887233701,17625308215993897091838888595388246859096597033404108848402595233466786865507,18815388073919190191562579690732647812407368396854637581401819367329270645091,18268550843300936597164339843045347137811481798420250960800057984676328312298,7226998309855583456700105258532413039112576746166962016437941756495852856370,8072980663193342911861442510877605529321700341477138509973424538392015970628,15269265747158306563417251524571764365372430081923021726955952481038826679058,19910037920320033458941731683391812599895690039363377502140416867160565960964,15486045363368901308969563040163325835584354680260407824152890548047474173382,16416166568440710996186902352749667794644450153896415669656858302452107263361,16719876352169334284151333613847626557780385036803676145001883066946186048592,21250242709366561537300491285945444276614074599553674495821079421382627519383,18996863118748910427791883574992010505069161233259708625680518449974859990560,17413984989888387572882804568722637770904232773299911698227583956354366272051,21597529235679499224130811468867862981087206894945208547265972184954721846149,17271950603399986802591192304636434671723720851969778588610595038101316019146,6798909530322911571363098835602980477334813891267210720952461019098407212259,15221754151466299785203667902143040752208351220550667002070154445706666401776,9969565572595685753856723561942014758757583006296150732797865871416014191612,213937728610177048236193694412457038661914578783162813372436128728852762482,15615646173777239619093550417838782753019556951599702936217300723011405507797,7718045694050546136660011535056217361530495049313202420611728185159583583910,6681562236645975908164269312121030538373320810986198141132181047805166475529,15406190007218505433124772738477886033924738791369244099805663445061334497251,12748925302440648174656014197639220978675653093966691038521528280766659388490,18792405480956246176786158899722364426273579869771820318487342148987615503627,21034833205180901867479986245412384531166379419487221053266758595893395608147,14993530305792055254503672111497655292586320227932876629369830030730566504041,9717186869050569007497148725820161576480205291215534893842038294586234260310,8846581556095542298416062056868302371695747263219967935160771313384250848220,5719380810982615524673837631402222949910527678512468701059039624789965209167,5973398204091658428913223841081738015584068771535532858878785900515770169284,390665721029373984714826019392824960041229454845430836402699997231854884676,16884099579377843869279635395084651641533249525144181522512029929860550566335,16716976662979247989662403288430439465273241484103184167374388250697744962395,1289338592939287230201589454150014946433268062090374613616251000166621302313,9317927644121595578754625372882467923006787730797841509740916536436754202554,9792346806272266839932159619375452292987210695578600955864989901266954094960,9296083977157792888817756474494818556822681079104304334773148774182988756476,10323608200914404656342379674401080164220099943588034731349775904877409752904,5665882510779783554356611639475035143817214951779938939820232711292028607543,312967658452369621468725894369965307895839161467077935727514890821777198625,20664282841391311519597819314930060269576136022608505709992590417893434920589,5323350315725158992622594066490821193659726275127554898433661812401256218478,16039351301369040724720782620886565139379163954982512295794534252600896786349,13820693026747418768344065399393852077420709727979822490883114289330249839237,13797176144228246839971555725332102191019905588045129521304130064480669479604,20861818286081952786814445160300163171950644955642439845329412070095760317081,6607366884537402504576829976217056754321721309944806800456553075345742381854,16676075047056109258708765855713030298752565264610707737757882684833916800885,2596872657894796835537858907147863451585796495210087845405329734139833282637,1129905770296794876904745792895109768657958745069004656310552795892948378584,3524768344101236852745306230236516385903870540974561871381448404874187920054,990706121628678949689364737717640674078492689689565457695471004362978678643,12808278123975447545284898374625872643451056414444411676912801184092083815084,6358161990036632946294642058872786712712883111056083194592676110308231876108,2793873016535929696420652383221830923887713214117784093571041985641508474546,17305928010614439499134847438771424617226147912488714899621343734884653872709,16284502064199759145361743401051151176267685561605421586130298595070638086967,16669378724978577155412758169912049188272082311653969294949527064226374258950,11861408925173541719238679231659983919027526756130925399544116580983984008351,20319862771317637561778652893808792643716731292949307597222212602977661607952,9965217723779805596104842963458526859730058546126612755023280528059812781678,2231229143040861060383699098560329742848948229177358362095200642518040448582,13286704465412914480712873676020914803973411257385854321890647189069199504571,10047635595882320884409798135378777636448641999630707194378323292740008960417,17087336000400458291414525340830964856800142468906625956701637877370905283650,13535594575282729223473509709844990145664370669908108705760692736046179136608,18619202345418036145538258744454149503028380077256559127312056952610301046510,17607804586369163727645967551963527279187781470886431384954240254070602283137,2633042556450301220705608140363996319867584411611510879359782399294296770849,21731768638998447189300033743436435314153248129574741734083353285598244080117,17469131737454037935821691482173830563221091395109883834897114256467877636669,7750519651616125729362402583651846123740462681349952291880562002377909054050,9447081032000164239615272903502339392629921187510175841323135270498903409976,21517411732531464267453023393592251500842566572268409532461770072252092958721,7876501141846244962862794902521772277174190799788868978106856756141641727971,112943796512817751182977688559740204117088697116147815915631198815244286561,21045605911504121416853713285261007893735116973950420994950288232723845218749,1753558144636632850096274509984476357404441186238175375676398948118672743832,15932527070583999576056453444162361416070384829011926782656187054064561647022,10670345925352776542283780467580832901477001176626927666485810080031890388634,7579612604695836258451031149594628860115515363868399672164640908835805063913,16678286807861813265032290142015890821080993558199809221760573633471452514219,15414078726286200869397977002633905619706559151321201886825291326757189172060,3948850363929702397926233515670425547474212215810847662989169477642088807390,16676527723244281555583733536047809454744760551541688199219131455695588765207,14087355065973222250918209290719451048172913300838805685888196087459492418503,8104074033209440421654249234822181338065658024406724406758136674393332631833,5187207728881418438225188748028865692950088102865770071392557429006545519499,10194509841193628413711183989804813746356025348148221750035788743075560349210,10011332996303549537072329954668024063758462809797094286213034989313201039795,16531650268844669358279021502930777186663937554425443224519161588787088219270,4198803426144178314296362723890875454161257236407666607766866723687553739691,4796265297638646381399181426481493643799772847333437062194249373663993441511,5547609802231005143723955844984958632609857658378828698100141356246667308579,9238958429509576319892727665041354560043563806656332888234436819654598656915,12517630133819614217261779870726755029108748195491643235440705119352058557308,10368014234449326131235994433740216752312468149182650354075154587397704894585,487465315883418182347663117280302929984519597673016955398438666336416216955,11185034244837678424376295011043645561088905841730131726788873681031338174455,7421225151165727634904994585688522807152162423870550118585658136113463984936,364806019968570676099566454292016788351689833960119434834370974516536828706,19587762041779243275917908822520467733740516572707471226884058208850887204874,17699580368555821903526305272862177569486615328343491839828472034082952960813,15739138573269259325517597876326746482937619260543240058947651429318524320399,17749815771695585990262895269645295514834869871993754550237121995617786628911,6001281843453332722738415535953496883454214144943230146026585272790933236244,12226248842279453247400486197034488006724059955941344491855600110495696624034,6471818050024319863197241387509891745688912297463370650154695351698691437030,17643944916136214612858153024594861226464689685432825152621939791565281052364,21110507073644152221308742247603861828087429176260377204494317652281698346306,5767681379026755049166284789191192306599058359643996830685583640018326835809,20268516002780303771030074402103352053711651542638490897887552979541377898692,12422024375924323315232423143442023050941283872688585715847426230444960244284,20694378016149655833849108581703458975143197158248183642690852771732423212333,3589864715711417186674798636588069952164879749159939425060725590030374075726,12536189236026623553502052145542282538682809966098904986394409008189339523570,2807680329090948893979159370041090163078264208853025987363628558807228757758,11134364423913486029994525311335222090667061028008118303028273833566959977738,17354950677485256631166408496835881692979370134492552889236570818914175381226,9148772489395197941519683034415731069796332771510468178434252005940900987586,11051248410353114396778661421385387052304377861539041695630551535039137025728,18136540266852326106685174083549032333515525540247442551401150755180487725743,3985310545130175559232554478662499499843818415947765870117105273186277940709,4596525943567680471287409788454878169502290977680316722474714256040545023213,21372340401058762695712005390221995267277180470546612925471076506446695116009,14075257312640062020412482491643121652025454294874360644194100265009640244905,16944503245314408069496787236107780704688926045771652862339257733069860638621,6654085263135548167634225627185378533095825854533316762555824971264586187651,14273015308464032668640083373269579252065688901233915918278293118708191497972,11764478817260526126925152191588101018315006712336605965222952598280968869260,18155813367404719470487615677791656111973118264369674303621800593085173024524,10850039649283761393985741586943649861203783935137056310000609328911733104269,14974871370837446170027589325430324426484756076474120128444445200816418916077,11027268992558661543645635853060250199670617750348905948352231500166030736735,7737561462151958609897925089803246494900406501278116203687665387696545068888,8536397585289585667363111427598616854125268561779225310999422087929379230845,20520653588911738970276129298340919743898256960050723343166349159335019506767,15573689478722985997422248150576705853901581704550704092699815959211941071233,14024637413191434115623282477558112970843649259330326803453616105375507215588,21353180477994165001466351039795610246389619571796579650797005446278678838787,10956420585038523642301267761059211443146357574323727078003385100699325814188,17634836995596798350536418601573649005517540866687768902898663209263471034753,9073831830223507407321206741538426673038288500939999264368323867070102600399,8100061233881358546546217363648928017848251671613674228091904606518338839516,14292884686436880002999028765738013651173249817687065086024117836878136072418,17843666610704256421074257091600372846189412242040711501888312601205476877610,7418496999733433074316279404200997784331208365418356982886646484553701153757,21292338796777812243292835631771215001169911232666037289555901315952974221584,21287440813442297789932443224883752220885368198719782335487617798315717278443,12316285862536720021079405901921917335504024672055930573734336005894401174699,3187192338760815459509556016254324490807541427929108750144803145054500486833,6482850190067117044880439000213252508905126459059393355671593783930481002065,8071947666795842917503687890154152458243669781913953337362618950188906690910,21450848111897538423936810899713904909897296879883982984541189476327391575319,10587193221429670115264727936502940314613396351335733485096445152378181351510,3385684482890050363671196710999686076700864071377274740326856556910758812375,15982506074704654515559890904595916307715088473006256644287900474899011899187,11051707205631537861946095917392475702553421314274237258592689190929368154151,9251268179161501251470629870144065342881530535654006637177099334228872748754,15384401424299601275458808814042231311961518546060835375991090955541715971658,15147611899621647169760029554894128666862161642594655274320073446753024250644,10615109639224170479859701634647953864795396211020891058926612120687182210257,14404478161927699835476596901422616937403414811611272602635749875651680921447,8066178271733489868262162784101440625233465103401108911752234818690246453789,20248276648316419325977215090702991722051292305169422329958075780094418699373,2029002457916171156303194520244672392499138634810303216935386602108547985314,21075731183134253416827200425853801562619807215475840771703429923133977728069,14328824218343127380036695796575765857116907766196272954596277912518546721093,19160580257616407097132379087560824295215411994049928358528355359904099586504,8132787339090119872084216324271073977022107784441826475259174173324397592845,13163912407679060956610455137901723175820157380216990622789851897632818074059,8592347632837509846508131492057017267103172209796052768156176559923311880083,7893378189384253642782385691967744125589477790209699483381677762080196748261,12191210041395050728454216483522186705806341251170673836903099334267999015601,2618630263994051322846776438484808085311498796047898764787894432257296575984,13304976328362334711292646669717074062694791647749224129724116074506061700957,624484185190294110172011007497433523891084548746061325634035014633317325140,15930533828823189720011923265223664488732840218774700941123034073028585645207,8694885217655511794794497743599831016837108207363203834593510913033381737488,17331704109224667609742217259848258607875799984699711250101367091564505664522,1143531962761362035993655799963451435028684354850849659611727546724143302608,5414384052493950126841753058585655621007207302558963578017856767058437816718,8343436020075567035126766344602793013516161248129384290738181959425998466132,4832334637017830367140676637457267590768883455902783371477346052893423021577,15960489327340978673041589758216206637417346222123069896632550487782527402630,4557633726568362237945959401789921266559833502098724828463753976542737136513,21292745345591415194683498267204047392092318996401128975083535124377610645118,9328286636803072400168705383927986130049573701928015781654594560657277940196,4380226305886799411237881027947999265683595948968607979382183326525427173817,9767464780410766464122903880954110687963200055038905098288212464855640106788,2341077008076389666838372736815646466482189988625828995627083487505977087946,20374148380136094638123722089889049817432074134077941767483383760377289749825,15787533442296590591714142770598935669897792586470392297628568666971956576563,7633568663576517885027652011215374332444473983000466204175445586239040766264,9580455424171239687884724329420941872151195359863514187490663550878551019919,19911295277809179559313541842789165346180998073715101124443882860854846201169,4696263765841909122685466774945153879000521574484303419094957852664345027123,6118063668634440692631158765198200090955204724365488531804099825202234531440,19475295610121478762637598544231725416556110773059271107863119783250115177307,20179584065699439977644558242108004135948300904465438207718184556293527131765,2676625519221951651755843575492662910087680586300055636532952929295968711540,13080027857034076796318609243033548218531614593023186061246772929628249264284,14263363493033688982783626695159053510832721506041125050282934376406154340703,2706925569052822828207630841519123914917406668054471879280093987418440726365,4296262245978655924075197707705805754837595446469608588294115404804858164512,18695068331082119185822574502658840301072706119995753204333012565779354028154,3337114200744822151016415017664070914837554273478224716426789950128003958134,6975962532267211837956893753783559781855104297873769130878094791004904433267,12231027575978562434100945363599501995871801149646690231633189894762835916126,3888650643207658707541674459822797638642380807202524073478543941467788883170,7676102615198465271172138409531332193754467889637067928466752449336805364120,9811623913757464238022803188199125269665959963552692281954397128646993550529,156972936087215783948417984577273879197745728180593700417440323304914519034,16588845615557743733989563376260327418375621586848888397570715079613783522187,12011819284668339582414804793555969540908484357893010282713633444914261107919,9658635959610321892309182692375199095125363721825304507540533137281497868500,12870566947850007704602286722292111587887779596594529150836676091488336717955,17017505534531720639069672825866463960388881234646040969078396172375695830933,12828756987874340466657656310127299330830014385503837959876241551509225608029,18359630725137047619220866091928132852289131876343072040435717392635728807670,17863140285101027979634946030001422306163257009614315954049905801373677640874,3360582341611046517265570944669154454984314353967466888538655993528259823694,17502670755424560054495200659249586316206934247721147538443383457515937914644,13927649797430421409818392324255621487749881718200898095569535249421816857631,7898469048097586242538236499785851298058905177690518852139435937277393454608,5393613856505501947177492775058221051864341377769606207857027894289988034452,3985540196927201732264077382523049411262602519666474163140081018404802939018,9933548682032172763206440650514545057762401680471287764841975167579530669418,4792769546077532311825527426101752293398958175332337087633556291257147047450,5156370681902535309417699137971512021677704826447998658592162481410036210325,4763178997526214364264420973622397594953864683634906055109407846288865926145,16580450694184328601228411647550657642835283837702883837525078295714435399937,18999059441252116518985471589622428967202991051386298987587330050320210739909,10924663926297817693040648165612355343542542868891379772060513577838006191064,21154439824594463741340124378173590149781737214921140238108168355994559155084,19866718036982650474956880892863081255204850747846301678102177541466640536845,5726341152794890743559900317356587749078768834368131432915420083753465739652,9721930072810562138700262351588760483759343649062887160202262013979665248772,8692713109320385702126858931428174471319167530336355188864897071149715822466,17412352102001079694372298819013833514973940827985696439109156982412245617083,12672821032755011921233434696998986247906307111868736700673800862103166163534,10172970004738576173270726006846527765711642326938611469845242801391711907951,9780618262465502284058891490165578338456400832996467543839344602761711940182,18851700024286130309776897830342991020297865786362943013731692845791157935866,1702470413617318930175864989944938294024268866839160834076264568335720361305,4126610465068493007303692923323412316073023198781919888394734000856090363586,18923463588257096056764527998950010226471775437259486940005784970583303111186,21839276475997615446044485384539051285181302015654907519320251876081314334359,8307810470154672938299109640101353533274474986026012646848648110658880568963,21681710504784331775159894287594944141623698915845714535863219742158877134446,13673546849110664891321911520052734162092211680871085198884137808051757614727,2216218889963359247084339208809391515747106874740680794343547186367655541588,19115757323666287625233094721549891816100455942516447718127879700062782999180,9695759088071708435257280035083149593819491025470776577904130348886983773393,14990538824992915759805383740971251128446161760292769615173978580109946105509,13500547160059033639084125020765777005399100253116035721012986936873938870871,11690620517343570003741441631732985155983668292416671376092598551135607742688,14092995167301878045390831717670181419253620142006537525508736966592448309458,3134074644668983555014847848317126775181820544161601574897784886291988720093,21356667096328346522478877399307107750543924879742810010071567516379232573327,19328894389922014017090671733282649341431509867352021154566219841026028128702,16777200051435195914695940482277275703598221309253917444691069340963118078548,12283150914371601398948839801032083610952821665268602559004246563482653048467,8031025780211541530328680242940535108474848337234033825435617391087509668168,11393488534594129202264782038673712630583567081414606145740976603672179543089,9489545274708587303435157546929129885054870357881034831999260754593859728111,6440297901700932642712459656137166095980435930130325599953289987347675780242,6894515864899267480052927589331916028154612433273964297048946097044117290367,16589536620737203892631819952021004148548871602361830198268389856564419047101,4583341011172551024562134025995013510576215116397573125685762514159294995879,5241434939346739917434576806032039711895865193494390109560604956906855912755,17826720085025179303670747265498956093868413968174402515352860124554701720680,14064177224800231170886754123172947484113558685092392153296947056267698509591,20746239761736290080585462212523994318855974409743295600262800987044075760592,9275091732796562047971474774056076192970912855497078395575768670699769126364,19100348980922843718890560618583044384034028895423544873772560921345167893474,8069571373226602742410885815839523915870737256484068502291195820379222033494,1467293981248465102656318727619114500592839521238995988554329217082570049573,6381288201275521270245376318098534380164014423572839901345374016424121324717,15155207472765568640645705040738739058676005958167290460723767903432317983809,11827307205908787524136950608324322915050519697651400085361964512106546953617,21374803923432823385981703420361272374739614104998515368780896432531799636069,1620198401197709963530631727016287708030541032398661971728351531077981225770,4800625217713746765755573372019630732124860961049092382553729057755156854314,16885045113746325978276736698359862381890909478720549186885416774857519433844,18940059701033384450370562570502818829119108154708321114250461189220553261490,17028163572961360646345264113167539623561504425952365941615928454393252072957,1611295667261368131094571297996490796385397691978293531693197200319130547745,12046456112369511110295802643603369841325461255354393474919590204243253663937,7754599975225661234551263660451457408477000193002987626530262268904609507135,2313209556333942391083901663566216617901599085931440197682535151404828238681,11201045085233852526555327068198185072847585214550933934267941732063511616826,4467724481011544137869960218540384367398804813150942792543111067523429032279,20757297420378962887523157926616026028995120570567878138398997747263606554197,17461435854008784993561933203163122288937104371480871856334630516397129102735,11233240529972088933066139644647717712375997842172826165553170491212908480221,13986517480527430903609790838030615892444640383875866009325809535938190376249,4301929714047907689515030408708811722641058401192285565408232097014641811166,17696794946098216231804098416293622660221918490072683908415671549432039016947,7439888160491058128389941744272690247182736763968209695016076283096704865863,18423890552826544443227868172047086037747632248290044990903922658938527547680,2138999949837278709489832079964510183830385901897653052233908704951853637094,8615970277754580973564280361114435711269905378483503993334701750963152744511,1245284434872653312507712347938909167594598148561528981150147522912318212857,16245768201990863935411700653063134435976966358871420800168843470345424885412,12879861318323580145511978223564804504159396722688932396568245995032194740594,2552284675231253239834976615340003107373525651900622595931449498227491766869,980488019139379194961142515231528163966929536082343598209628148732322981564,7264750621517252424008399274736151499285393886075664598878039391991523050881,2234522067987218377738399151771319350093309605278907663987720519875860528325,3115352127411243786318531509959426596747177553864136971519102170874744602976,3667866402502198123848250630765454744061857715778956702490214141676773902196,3070805472938376665214561241692318374677535766486562510422267606125416243825,7823349275852374866499481666710330223055954666864547234510846404777769619933,15260540996982618345416395328474127890176746670866447824367770359510137832585,16879450644311650077796590833984905697151358442225768059780947025899660370589,15320151525992649849875202875042133283365355535963553893454329179458534031485,14632268633016875179098944659717422356155019599115523094512078700042675723400,2897293850461343844445387032809649396366859437152990471719742534237008502809,19666002760225463497556206571085469154515092232825812732816997876615778032614,20118956923652349866364311940594053676005949829436315819799225245413961818420,11744985056755246878773405286931074634975698324846162530423833591918403445926,2015290434884472026423323399096281629968890595973845384920383969402450506434,18249544278720359760062826368546772272198884406461513288445757927068468076813,10696154943059697598572810332978032400281533074175542497867727183214332201316,3971341798054170372777083512695270701169903687966221904151853325481552612966,9959663659512617071119055590004415036736845473755952682208877124936249722622,2181868782404294694165345801562667214869325590275262047722759281472694906368,16543662218198449396015118334228119894116585978443535797616874635898860943302,56444853332991525451220607324577660725674378827134771417770990653696578708,18053264525785010356112278932118420278769989354317119094784720416230380388033,963511433856494437037779480692599956325036862396765985497581773445785537789,1640548195682821030419870544261428767973895477020340173398587128599119014650,15577232677357883687312806010171709394572550002708034453277797023283497421495,11090954381098620504472251563901051846520004004959525348540953956152044818938,17126684395012300883745178409829259734795520186865031009709416122834152378303,8422844186088908124243365558762687987341862957152073183459572023886741121702,14662184649744589649763530324217861015549859438835398957469773613387857845572,21031377022606130696364565229626602575982595290181000993536506695259062820250,12689389963301532909415546365757541009330035137990488344057816579888146178666,5214588312023400585366048036841380932988375130807938893042700215898846591858,15041893128824524382738883860992957588596383766546394405410998279035324015705,782192460855406809992878758154419200401389375934686194113667662665836876265,5661239444927590688224044135973292706791664398184824354673135332710484834774,3817944105257087067488946967989598283409314186886285679195995872866829761906,9462770371773357009169408492776891016388486549772557694482752113820123322232,15769763308905916572724877727092407815390795595917044619305377061254245212113,13771914451667791497863967930538877162560051760275863288476375824988661915333,706561967078473376761233253052150494577539018705821668938338502999740910843,12390235197745683286169097117092390888206044377209705969844343148646378449506,11145596728577531179888406424537808841248238586984730649700720979694309693930,15681641822349110677199695953283484509740812777386467296516920337242539284544,17574569459993920657262688380744386356573422289886331853177778938058648912158,5624326259006122381461763176192388804186780246412847832931645688163746289220,16496277716358307095107833912170230220700599576045238114071305799889738129888,13435082168481898917836725813624706153275101528359222531631402061384065427333,14145359265331851785705850315135126451460028716020850520657056103361268407457,7994845231841309191598369070742738315856499258678582728014902950258896103570,15231733338108258465034981184038200743349384534550555337079556783807466295081,7713361220902077511242971379188205561979775701167781811837114504665826686675,11242747039712276301478013037107867308448907318991409117791290960665848463140,578482125379746689637837359294794469152617864738083364508568444154322295070,10411717957746838375775334848320973308009407649021455865417509560443692302903,20227006425680272844667600313609218155469920109215388465037566152370252232679,4086233333215814731082706125141659248745981704236593522409792368006446650781,6808584534953180557531972017829075410964510413317063595166364533912498333198,14933356623681974917513408843614143743808832277364712291262158931793965369957,8361829936147528340154802497787058714748584629340813748839621641190595526650,5538387899076347863195504194335672966840748823754653039217054113809390157835,6615705984888160955628612086123920128735091346352058978084487503753552928718,4247091362085081761865598677360777173802067597672781739780149117241511260340,4974625254311074298909209418614844254599548567616598303359921500987075775722,9907284404283923304330882823688663208972219438730081750092058981162203620514,14238658152145851054995618234965786835935641311230999365757330392464542182773,5602036166343678358319941150088594172266643715315669628685676756102877898852,10315461382975117983285315435824656113503983463182219407091635205239799886780,18907680493658247637744313142676664986314600274326418373879671192300682190898,8553303723584937031207437681614026720261370015480962759264727133956998736136,6891145490942460969785177369488530687011218911690606251233112277697487049464,19170245246106596353570021916624717497160367167030242670159454715827568730304,12963872577905157066479007532642021260793201956955966146918319119859824768103,19825143672793576100800645640010743262329532693712002233459160547290155991184,122363237387596939334930000068508772338726942066663977131612051418977350004,14083010722716557573128541885186700095072789367734739290283132018427397490175,3438988943822218606847460625826294857914025511956848084069535393649532189446,10824463893276561180588773956898041497815337719354064658470380006885795713398,16647020853733827256761129360155419271528077519934494581063879760642045999108,14779736608400098952280783906738683105991809429340153405681057429405486938750,13142746404873014842415191205878004285381311757484122253939053617110681448928,1386333773150414920705543260472370744952980454893569383627231135209073588228,9697679119976816079822213749536923969219789272727871054723095487806154942217,3460404774244857416356250946884568630025797822298777944076755223444927083223,1247968706400267099989617117009880060043946421405967563604685657862139452642,4507768933023927635709805634829365165299253230159842263645571663212665854586,3426290614024232855381062903753364259178390841306198547519682507770097215868,14446229460062832266543880366376059431654246279317515826580297094759435628761,8067953446832743759173288639514778564060677449303509306198517269476636669111,21177512050925009490126830107933732327927737774182499659239090599165030659885,17012508948587701524178526490941665696519922093511307343255635334215277408110,13790566627669249053646494281027520203709518820977624221038904711079372230598,16958540834863372886175563802155893167203339755555003665356919890498736433754,13423323660143533006628485455163236538714121124914329148003611317540843114521,18732130441148222818743122719599795831305992743627249485606912380686722650328,21744582565522883116221789698750442373155722956313850154199652336110648496029,7144354002506963954801968243991190427536676772300009377345054067229788469802,546773555852952995236535448961524872583912665647152978722419200006698017228,4115449488659159484679292884434524602598250771770554945188450323754895822199,8595752591492411960378746550184866534422481915151040676780917721787338199480,10165757572338172851680092102888140824090130405358311565741520039277283108819,13881202481966783370628597357006999877307398877082297393247431527668438855111,164079380527758195225075822377759030452558671627014461867366308987961032431,16597854725561663920154725753244355279782548142174519652163898109297275062756,18782804026635015341133877400860675283426234307512052057983648925359584161851,11803457827110915157916889714293161979623605698803927824089144848270204757888,3790889121366006080676961526219702764983373811240106724685417109395959845261,547387322589169298813085629174571402766705427171260176930124272482922852550,2250336107342267953278191463235028062291289397936525878162948482155007182474,18878522248575655887331882357174227152771300904536167927922454904180276940063,5479817494658339363150524278522534672218076031607309533533517453567105458144,14471434214677769494999424343272645790653559928767779107202935041996962964627,15118605967190623209837537416237887934162874725496448474965882020979641133025,3039022034764509339398468046956573675942916248030956764556346100611315129267,11040960503243486479242227243433964824049773842453715686240136222246114618507,14522024554516641986547166200505804498300840654246791399797761270595590503741,6835224295711983166071915743041027338226822865794125690776093851440377194137,13366807550844486078755421216059218883003148232530961590657899207604510596943,13252007130485429909186723432146549270562877209239528962258894291232641470721,2492164358128252077612941728095518049849413853275094452844245158937134153493,17908308295682961911088181370570531617402259473536245650574431533231050717409,19598815799287079436414455405296166262841941910574843546435474727483962158191,12296683988787359527811189035096536832943622321600079901820428531954001883453,3034216468239708296411368036093482845790159680213461245275097466511477145032,21365662921308444671672644376862924257055009191312934218262773003828812482536,21643121605272677508602911313799693744649969093302740901187983246336863173757,17106474623853535335864151625226941722837229436558906235895607080504648969673,5170493063367583327862860118856811567748934103888623432970286709351028834594,16157297782580756629356992582192341437261969693717401640006420404649789675283,12726902817862860900369295542623896245980247290073629666117912397630392192361,3081548921497703421223514856379500960238907095191066190890406228882786538855,13383733165408518558908753036431726341720113406574723548828112868926423953299,17114711170811861625673949085444809223764181246137324935055609379301828432643,490084821539048617783395755779188347718107877537460289908857747116706971191,4649874458515161549974867873095987666703831126237318082002364917533053056940,18309757296672459101064597681764458207032523283974093139605613289699615669226,7819183041486966141608141659813055168335432042159899601871834502038946555307,21341796073041881721040729550176895226179046215340279859887156449076052673189,8964280440056181910087237574225882257648057952084687707991537684955336080915,17214415387533445163014526685896715822410886705201252936359885537015585673030,1103535976918892886566275197010540828604931300309949743647411661976344710321,18989472017473838846112035962614068658032619400049135145786394166114140582702,3261305106935504628452223922938937365963307399148885220969836911471709180672,8250352610228962368545929233808273614693022774196635878184474970985288333646,21336821559645974200167373849850832540612240140661136750527391104897925746090,4804442184264650022914507746660662354579855239722797010340948536245079163068,2980351069317208287298989743520302917458165906618872700838358045014403829821,20789178264137518066753395738491570400211130020259232167860189045958431732223,7043197173168479199982037485481873468680373055205806152875339535752299138160,8803416368756444354155108122527515347994446936702934474369040166131196644971,2327814593413519022021694520242495352706688146726587158472403609475455845031,21198136442842149822575509914524766455809483419897291889042050133491478146813,5588816308782619790412052393435292678862962083038610001710149574381906419148,18457707371647662280814248200286355752809748069618488571669726734664943098742,1234389524319480772210519595012254096434562205385972935754568629194134383384,8590188161561261795686801611365857510200794054668578839168287669047410512276,14470989978325106127256991312163042779416463931400090968073878504946069484989,2305522070968512786738458204005001050714630746016184992510479809638463479749,7477355783744938536562522733347415235458953622739577251175967178186753572312,567290291622042941074701939710650764088062581452752653943609540087956251460,20440460641466928749670992266608077799893623138336747959135603955102479614007,3054829023148086310176268593952124817160009906490401089445995945337990758835,1115018683950178281685995685874075286310060333362422341896901389981346771770,7809307874649635295815564328714298840313171873184814252455880392757245438416,16435322760021026161995603943756578712245360106977256514516858926570158830261,15538054347747268689904146479533221617920707373984233068744782064536586402847,2145106610221843472170037420099674539983626911224263405264737836509031499186,10469489855508967606640238771767546316388755621910047798817316247787439887327,19269976274347330455450094587958438145203987980029244301223712026832424496030,9442647357194564700611387347788116150552532746010343621293769302924097756012,3958820742734683830021295040986048520026707752457985546687457778678735761219,11348329600459394107897118896385152488024741286593365288318995787678872184581,7994061748163511046803584801099079098965771882190345699910054751589174660915,17839452077827445141859404251925903822746019560954563061323642101356666431414,13232228834563301156710808377438125900543901439977087615805079133929315161755,21820445178921591403441486524597609508081666751352389500190809234730066099269,16335255581063466649418326314739202718270800342509998411094897137707475468574,7815038267931398026175910302031438514210779836695664391140597883647619726660,6108907775060665614604453427927916450888778767561273091208488690292223394553,18731401306874205485033288380603219954710608893214981010860304692443381676445,9207310842136026530277150017022352541117999932757777916196896007342718304978,4275597059348294910195928059046438407683127030809544814087898068951365707578,8551726143850685533914504884506052366269066663000473253249997846823470852089,17722307737167433007678801800007589919417323324870850217087785924251047414732,9659885913999670803985648240505723928144853579243576606650908903914665975845,4127785260298795455679482228123141201810011802311941172182140342819621401490,7995480315864311476694461046721076190059098585527103653430045699541205743090,2710887853573837837653751249029686223333938865050270571041154550753948687821,10929954836518904033304553904442567770321295457957205208591304372724905918438,14001950425766109615209637768509276336684867788731325954527529665290504740308,13093798171633818149701610236482430519636222108426384974269506295925166461929,341112534319506600537441322030652722098845095671561271148940215817004993097,6110906587902719841743444555887325466851146812889558891609843725163499179004,4611067237252812652698946201052371234192768537459773069641551009583406296376,8813661389433335471770742946393259278020908342551057181562786643750538648664,4082028201221928661179738646263379819458232996637786410627338568216272942842,4387150015663192481675842540873436578480016784260152864928968972841893485475,5798957359608013690581519427700262504660783802132038228115867574470007647157,19722104754281068600204006779633412991974614044671884281702255273995426048636,13237763289640918787304198678609438981723281080085860502804175876747302592942,10350397375768871942356366001436797697061286173475393119069375716517495164748,9716754658986776864790426519095473979615270133917036668138857377100462313944,12559455792963077442707649745319068600669837985026401838048238001273610719876,15691474792343664499590886820783843178573436351948842211318848415073250926238,2315152971409777702150694033027032394728963326020928261979764797562368859984,10145932773746660365948684949555749309408495540108698054181994778319619682499,21031755674184251231918386922772885560228556184297650283520145773416227622020,9656774539408247026483766906298154647226870877463506520381115258572281833777,3703366867036538119931629591865173960052419475390100010069369247148720449735,1155849517605989105668895794996696646805146181003961935923384046079365333956,9462523438649504157500459081869061592673258626587962773726459717365228540892,14558942402093706312345858485376818615887511613771478694966109228129293547963,2812048253376149161843484904554248272181353897695109556171864471465530141300,14581264237688674105789045795632866727938915214983870169917226308316644895751,11806517668379902968824386871470726201210807458248501270142903146174354419162,4072157532402496076820064418241903939352389786658517709744366379045220383162,21813972253527564887362886309776329116642260196272043100875592141144150622785,10464853353887659405357329005361733216328104382848677769669050984745487501147,14772015460668233451710325522019255336227111235340236488781640750731630746977,21527357780259989210243319716428302865642384867695769975035672624351025254966,10891794486798293092627071927690327494090905691269827842959180201330098409394,13485855904336418644657500553650073084861569474830727752625752553358760580285,11448242815253167183767068865945471000243774132210813929164325622036544013989,19410155802742110833632454245227392555968304439001009443806761608484053045554,12167659128474886745250741538637209499739823457162062821474270919941304684088,16680628007927224771777485144832808896272748488695838488671868152342742322186,21298757047923195531118553955836039383942072424271519371368119907422148509278,11697718923718927022148851233178802389523673168156063462791132046990360699116,14786267704709019791824267590492332247783919098705756794174245591027365669638,4029431706248165284072638415134780930697313346853706588481402470852714029894,6637339357364931518321345115064554926275905427738668939829923099637974821930,11721089735875799137502005413616822380279134029969641544449026524015093316862,11258510956066696357188198767462611223354755428568008829233602610737417570759,17382216798452684990847332797566093767764854060615116426813871855967998298795,4497813725838018324398390685637602656336499793658559967801659260213189483769,9309905740467289615895980718346712749846725019185323382202916800724200146653,4554312255934480823406477691403023661425250519363902231000470326223736059080,15877126774677139396238817617140527789790929268045936819000883506734809330678,102909811737053415440204213495606488273727867104784554516589930311835745189,18412616692627375517300170963764173086100899052204830988805458281556342306704,12497849254798953635808071778933029738229621492383212989583296055326390275927,13190130371739872388747884175792586030658495147350847435106581404654633998344,6569505978975360946878354767391913708682729333577071120385232557177773967150,5486573030999616702165020120135398562758060949059349810688840632469582165448,10402649247177704342444720212899468852439313211834653468379224661013914061054,14870393688688048179476829039887867662050219694351765548412705799226912185902,11112866336990864101289111553915677602536611363742637349719791431991672470238,786378775702052024749700197105312354581130448431768994347811552323325137023,12804314666740390639363966758718513558509859637020806917779321368800352250093,16383777838797313001717025761299072170493145903921192845224827276088079299324,18390795790658866542478563024059495583921996400061610405032233720404354578517,19071180375782447479569450482330188708754447860024817674265020413221587566028,7064459298524756483115092315588548572944660746058573142372140457074172044435,1201661337668100759364810191918525473246105501963149603200893010746984240574,14673821426225418930674597108599685172091690120026694257549676255194170791868,8007695637892306475030605880993450528464588921978475145792244443873714795074,11523933430814198704411556653252358930965476928606503642553530463689321317157,4720685254208822524727003349181010163122046826828742211508555904133729568685,2704641256375089357490975523544121554540568505171014265704664461404637160537,17873735287572402838142305036318020439254672746974064930437541429239252592118,15591377870113101853150486245422804312550411754131695747717894157544182932395,18680866424621452161410252746147706712971801673312117262770403991597018010533,351092121232997110902065296627489736041463573095030601146795248738327912247,21410776897919290439576321311168524383878404907590335964810760611175870803022,17236852113726644484641871544732171570702656662638441976539579805457648241354,5141902767347064892821277441749408218256386923351945667768202586451461154007,9061206488410388460545711706154817066096529615910172728152676288649487389209,21501744386281091461333207234319069661329384520296829009605344252699881602491,20523123786355828261901087089746676928050070859811577818342254696196216070331,16340183952833650334331728750144828293293213803155672739442287164371494962264,11997165266626958619141537683193751516111129514708339075256579474097934990898,11727998419969202419125826890516046584560800158309390774599325003825426052070,13931457202894182485995482691171342703522733597260457019434686547274942752168,8889288417892697124945054364222718721845070552969370183001562339292498026982,10607636906736209971474676586549274600168449611294688931553643349980364319662,13373379279879419696628639312899105244563309886546920506727138704477895635504,7516778707927565776230701116353902556324173125006482617300170811322359880287,284142816263687923446544408203711951081978657997111022490562722442340431026,1663629018772009800050577108421747444431944008366135531327269967377988698730,15976560170935104892839671978479711290979780560451333565745657902528940986567,2821894717706045749560970435026664943807315523436547166205412842765540126279,16411046577927712325274395387891881155718376469810123282180259561336053360599,14830500017171075678309056171812981524309710840633235720674153550980163992149,18516862946535092410308127384088576733043708186179828736204273213102857123131,2803122828384011132142130003641446021361083629354222582787564441368260233535,8655048519095208179618171351501333519098495288987579151859877773818991560313,17628029087309631764673769418575149062296127129914718449980855676793923700717,12213182221565572417730092495989703548687597794044608925789870740387528958423,1942254992896992114200957837548346988692238147738540593160350563013662461747,18572481120445885888145197091838633506611989952111678544191205873056195137330,18140911659901689098303870986888083953843757583911874535981587625576530534701,12576912117641358754786901787127955567685279522839676706223096592944048067439,9853587546273100154686512094544697531675085181100931274409412440600306885014,11051022304629047704897656757884328402546597879242426643246383517726104682373,21747178377575326127773834076417831630856635794535286757990250257220185876652,14802894612148412188667842094308733856318572638297904757997514236587913861527,20978447371728675031404263158195920974895558458780873769079890388209356430130,1037699465155917084450585874080268028561047537346921243992399961945112783290,4796870784617170576045350520159043022811420003073563826183620782718648038813,9853767424749529094226213721882427217388134769321854800041359789143412725618,16909978741728448404835572592895383783360498936047937910269991412415349672326,1843438491269241815751499591631260690521017848626075859779071605413804154431,14341379518602865584962107623594010671519157088756134035711400970326861508492,11148607079771922951721552848779822101435560243853139254657574581631328105418,7236118376476006500577604441648338380683405215283131664289729852364085763863,9771089868728917573774866709686459919517030662395798431632764214674312680212,9110797416046523350769719273137039416172041255824880845510758575776777500007,11171998782921300624880315291878283252073139909993544537205045086249176031551,6662646470172779612845827572259867913830316914285246080650610642251248472832,7840073244312824502623215399534211251667887906747521505446844849673459134791,15746172297311038934003440308705797271829102199583540526113736537482577060229,6886137335014489748489631206590121074634704468637741127875111216297167474235,420232306382434242751186173486850411467398307214919587427625546445400284482,6101917029417345450869344197624899835171925047771043819872045680173320199082,20902767593677591005062278004159629853556955206212143592781424915847484793984,5806682782059166443158221425741828463380368530625835045262822570023351074794,8937322067898730475133772449174500828509823386740428196387523130412301822446,10698423376034838319080023911266285836831986186258448454885030311257173631094,3804139705083664873950903601295520892698549383396840546300663481183626370753,11666167980086510761582909817125709232688171970969608229444060852628732414641,5195343484230074513500630640199601466733948553952258905990513870281939709899,14624340714306078897305540751958284706578556105002276099158477226484579202503,10083361130687068583126496521090418135813124339806220406205408201612392141304,18641596433875997766126569678124500204213295416321224520910179376654463020142,2202590858941069122312246576796422760143586439968023643572584733807707875591,5606778593839139538330184356292709713321311150529135965207704575468867770974,11958475164655758519149540613838246197985233378525766327961909142873639847913,9229670488942629146704143920529444712626724835075235979345002293458105678408,16754443145923358894066339463409997111280948017357151500387305969742481068301,2409255870410101963458063337813762581436752424874011147061097403491760442109,2214559337316973031881614971177447231501212859777889339656681156270831720504,11421110362488121690592793129931919017457696830596130693048382951666066696299,3820500999703948691966833683611482557851819710346178343790665741738753374219,8756218158739871072278901807217627680176358846778830959237385752221505342071,8032449730250468861487267430306584116120245106718506069817646852031479757007,10243677923364935391432160448413375676421376200851541463326287529268288890040,1128776597481264636069298358213640667665677523022374620075432951501260575292,5644093261057489381910165706940112111858706948653266534656144218172488885132,10992382177616530304259484530083164550434687278050566643026419033635199094809,14561508845841116001383562169823893923516132174944052932403904968433057227748,21863964650894297432572505174186286520067123468863642727441839125002713095277,20755119936203820147240015392257516486599536773168698212709082762309828651450,16959073226608628398387152299601201172109169744065562346871992262472923761717,1422360831209405989940170583665509252269399522601915800432845527860741426172,17389326678043835536716857792606285368419240597293609647618693076258681847452,12197527885708217940863852882450902665816552534167940448166754267717839462635,21611570070424770005490607477701523898795002037965850794497143400504853790221,11892102040110397810197867975938039639353004723546075702397206087388005784781,13516538003340091563836438322533954338394185445401173280530387106662595790317,12048467357966566407092445451263285920234083860460644072449020638723740218202,1735010081751908190348908571270511873519447755491670766716880879623393561967,1975466263323070433866371621575002630840361531361829342799564009137157551290,14332158763257273099367529977375112575029271371581919959093592722516585473205,18308662877208906527685104306067008785578317983243580533749074382175572194649,16147771244577038318738675557955640363954546932826136022515936117397152662906,12310104474053287506280911462776789511537301762185944649254713583392295220302,20727834941236374148190412755081722896905078541838912474132444343774737989102,4772017368444066833412562265277526529104319024388995968178984274657250179860,21049615822069603562632099674853063708639208121642147875791882100914627258965,17646394174446098039184464463379581654623553955171175600685924254263103033801,20405917523260600357692281918105892289710334792700216851356175227972968907413,1288067623955526969302061242482178260544140652671589048188723078863398511616,10835537730223027316050378066698794099751744792059501849218931290020119106372,20990157274288749983727934109087848093794137769592917583326461140632177148526,16941875865072358419938961334635058647868180482918222959682613586029647175353,9843778843793690986119532637057920745140536160016368781021998854678847780413,5125414792982533413337556654533863770640044560799521974799727390524971858377,10864462495296760172304401051361158670010031482061392973919136670275578530070,18638188379508145413237672170551928898223721010749214505292285199256581752296,128198311352192300389214509562427846527025583978725552204209143056794270869,8639617857907165397429617535993768106671328412853872156360019116822694247239,4844530255382539675437452182943895677920405337347260379412255490567182702620,1804675521808388615789572941859899805904819249465788091888167545049898256219,13789062391664555041422570123657413036572356127853659660401072142070681096201,2984776938673077398183780839702246034953572367406345432704517332443032892459,2992847031807357662780885550148860874749067596604232667894089534007015158636,8223481330716908812358677489080309112433589978061949842348101802357147464280,15829423985005178435297810317464595131483457001231013788201382741845473393508,7862158982782368203916129371016962734683904219117743973675651114828548094092,19398173801438973209233005992391884365223581634877055780725266290648936529417,19275863963890569296158744143112092383404704340976692571347641477470540348192,21372102182460094800056358406250397703306525384763761377034855645794765423371,9476173056510831081934271835896053957562178504127106649888600367232767217909,8945631126280639679924915282277004291625109402912694487894772245410534789081,7926253519938744933656970287399447078338275573508348380139787090085253922642,16018716520675458445608001155996902645263605619338294478505090713237417816972,14921856253793536148329746401088158240205455851010569917169181161371242017185,2079875574141510421000322245042248069972426430967618609676296915817312672160,15980599742048633141868186018745285129739756803812956666022183903444182047036,12114893033109318668956482804227784987572764113979211644064098174620745412136,2810098426330816525728669143855005497849959012191227510766066867001705905451,9142041039259596869436365631928849454803241725030479248178020744616036193428,16789255887716308252460957605463144609726855240455194269099382954389067176728,17736208027338616948877595063010911429975090558603409155923157365536120955065,21150410646727639080649942919157548722144769190804322567561458114897439673110,8728923715723554965990413741235509264041126517176940864777942728557354521757,18877975508697261368601618378333048287851497514619873601021983336084282573042,5857216433172498779920090709564798696432088771454963449283671260189720263346,3416739349758310085403544797458080484340996684307665591910516201053743952382,10014661157797313244292934148350131996657869525790562708237180274791925878615,5349492492153439871560702687440086188179846024931646961141799958661743380684,8090802326500729500530853058367718173141097881651767619458686010109346379147,3243876699925510348842975998823895571182658963945930929780026879935610333017,2417624030466093278001094443901143647464035143208058634414228940495675339286,14707208083442648370683763592077614356382972898797034092783713393639907619177,17545631002841426592730923010822053419499562660641460363423698482744533869073,4421380624161160840991891701912641613710893511150975452841445166075745805974,1077414817249103950943875081715965937853608110732127257676522759590623460183,3507723951294024188735232556852951953031271591466929388169161213367649583178,20744267413157655820488615250021371239675627876287191610069053435816486296093,10030806611757571510773710000844469375387967668887810533790132098599140714696,4098608919187988291739821341638774871917086915024686655297087774191912756808,13453755776490865531134267856063521315028666076529776333450382526888445047611,11760020934758140446049369723964305600159936563536726075225660675360331528465,6406037247037697473727755924858735296546535018055390677906442691851004797953,11557358458236767995494355298696159281191676229524038284238319440638237580594,6743825309135636487078170799646071187521226570701598888088674184356446519660,1363740300261508449387087660891142217813794297057216573859174333622397381039,17353086088993821287882776856791148032337098217763977250246938079060857079815,6718938715458951426350417166499489427024335443629489544367851434423278337209,18987489742261748676564017446964953975327326154943753293417429206546308211028,15965659332352377592570514074534026676650570619443318860049459797446297666148,20815651494112396184410166336624878644932077115689590904142342335838514032225,13289193671002988855733226768851953818541013880219936597636372756289364866355,1567979574094562858336626709833690822884595003609499722973068728155414218656,1406894286237293229723971624858421702390230552459261102967091748375073005174,127524353461789027170460839609791116742773867221485647945877046573898816494,14964917196913210912898635537202273294898388149888129789323384554911752584731,17573975090037837489354042024755208350546900760352759486497415097145199425437,2810800768573675011848063715305835214048305201677436448513685242208560656239,3182831596404920556846849906787256417421227529749874859977287400581732004348,9293221288281284622603029762317683176118521399756060307438914930508616154161,16673727443492180846335195490607282587311771952172084861120865668023189607968,14861970206393540357193848383493197595010751639867769363872113104941368881368,1947459730453714728047065931026988640356317164613412029204943819757651786269,19307336986855330171250472129691969885469727663168817962206758878226019668925,16272723820736869927531258455696258295545428585773733795358621236250129636598,14067203273048816019998838866277520003916774532401938198162316693809632760951,21551507147108044169777874975479534770240991315165807000112720115356653530622,17717640130827927258645965421731152649890280820567693269781156985346197796607,8341245955737785666220035421009659068228682392298228242003714027037157516189,12339617302318828762816142250616108419519769797732290739230041883942137188888,10123566056273217296763559440410478584111931737336670797432668142672222468278,100330409846079023411270961296323123363585075447874304748480232510662674144,1571586856190083814591643193451371280998279878174710717174319810741950319455,17626078717574459956178559042223066518589738318146553446930321898524763562145,12597474837573442277568310997313425097295312228965354157636545560783225415194,9282629691296360927786998265863490172450342562246145699272852196309154676715,11475383910279033220892799115018315595968658540404734297367799982184306742405,21207578382911046461925166339581302823631975619749313031737447832273859578217,9867737209512713742156966231095908977298144995685201344042106615506717185970,5419250263664842635521293741086549956576183663718321466133029062700646217820,10680301618473120824196964202055452643700003562180874183620820959381512387087,11734118782551011491731695279474438578347930162244424307495336916011158044578,15017496989515336959243556328206095618035482039354824183597442359483266217611,6511621188986288868363472995938291798169517601112511039955221592826262879815,1057116630043531259822644333647831844583791045276219751332477616072560117378,19059685203310882657000346272623187407133972415131525465827340360192915270217,658459778905143381055609790895794611242407110015004801647654573954369450993,7603036257465538034144194526422841628761243007297872008772468055256213693455,9990634061622229590998343828576831787715708492431159246049355339866257946620,8811452869339089802509557934124104823648284438116748217266488878838078556311,377338624779519383654026004940027827544698613282452894117899417005371283013,20372432760811032237009833207612531537192479064270437032142982696970398716892,15755624168218886509358985223476988622172061232118179707766784427029774962558,813530157019364022188179508608879306640863329215682533796638454834580544088,15366777101659035236493629475299055460750095122762878608882821037262385854171,9412569363133467481819948072214644683803929543842857451635373713673797937906,7663229432381596357590875498997196481050744300865119408024986926994876708428,2802277205489381760400127515311144092806348374683690687945106801827615715524,10398607437116928120233501860786387490329760704107357815670770315190035281298,7713454417232694103114115606745926964297583014900008700978733395172058088330,13765632281005573885638376819890884715413389187071206345092080625293363780493,8481595129822383153686510359174155430289248263706955785322350737378030164791,19662013748902527903033807785062252860528102610990787703983459073558867314734,9308675917577065974819002737905225232234719968566022906777214056034139366532,4460305046275724592205653945612957908431797179457871442468403547092050276501,15300682822970503133550740797435695997154332692415846288727432330759835456273,12237959719178772655779639362705631668446778143915144512652426042298606318280,9074337685905972785113091085216241647906400276520026931456332814507320753649,5631451392609103370493346239448329080866515797549576094657011047227839672541,2121343968626452536232091590081231792044261748288461026059952209827486505534,13428337287072393077290174792209446111049614088462784414150825648173933048712,7637923455564736402006004688931010233604652911202725935144306827988683195798,14145144407093909228652602933032447693975357132368479264731012546112843610158,12996083206893173697199261663271430611160188106624571072102983887472126762111,1731425456500536573020772566007405873501250425959888611809221924317821607399,7235256019731839713165664289644294928953374624035695945735560280325779220974,21068041929715170328271489788020516757451181357080748023363808822374772951544,2613269578304019608168678260820703130619030694547890166073793773931717299431,2895580764674798551230549071717806800560472156999393716124982187189744328131,18080627279556321451131957341924578248984242962783250736655220087867816491510,8541787229490752355605354050088489559660583814306921152210039891158051673167,4773003619955976464416147076099271361363813479523212833233541104584120420092,3902657294907605469046100206491238707374466860318674919042657295835038516976,3278680356861257827773728996810819308957995332730291009303523122858553038927,15799387696541061708257049935405397874115977721965461912710489016029411671536,772127417921361022785917422978769290675101599783616547948775836973315286693,21172675246800560416431972802840350117631380023487771635657330436402785697771,18058055216124783386618232874069776997923635894599900180049394490069349321671,6486774126469831729812548493701084245613732338682698890925717889323571075377,15523424894706974280109344562353257665535312014690869100282355992032362528753,1155165761749577539253357611425533199963683430668786603835581376097524220748,12293270303409235416382105881403663503297523019464344830582632347870203818941,3805029697086536368150132668072389131584837710357108954351676850002928826418,10383737378445903520223858424352769490012472500810730319338019642336472424460,19139905240360031959084644666653677709382597275601060683474709422388012451876,20662040367334915413974593999171397527205617639639561319218396170856657836909,20693045501044506792047932972050932132614012706885392044610670760209701329210,7646436833143149025181986338139180317049527836176583246163126009131421429218,18468267029773286403821867293367277456399346317458918979624725373649687804739,3368837325920673645463134045719391515049969019513957645401010913338888270435,11009184090818836540140614853735105475441340244881441725231380311734117124613,16438249098211375676141540117467319174575385934122099955146653152842543524308,1978426318655034633621003481179913733408584009919893346861360079137199026039,10835870076129494328875329193612835430557328436367520958854318265497818180707,9238585128656275231406470048000584932169168279280345637986485301554767537943,9860408784513424998732752702463731273076404557148376009384338221275998841902,6200534253629734756957567067039457925613934220422888818001227120423772581272,17839095320044387599555680620747734440255270476109368494374200849742690805825,15852210333828297391427169949742706715097259872699655846272917384634556986629,13333830495117301018203298033441593118871576320662915411592512406905971557482,20141868252044007123768212581882815770873248742867175012988635705853879924105,19536412434762756561256835516560484981006774488160067264157868466806483409550,13376474825075395326396381198361278687546895119831914117080307993251668968861,5426793384935877497416931155195289044246814775306615779818726668069304816143,7377826504693724659923090551901604172560455391003832805477022207542742841455,15304023433512090811722731808458537014494291201252876199903945357536893662723,21332460757344630529450409218029849205820804076582364819572498755186176235236,10123770219692666599208924625777509883271312561577690589112346574716432563379,19563297971101084260099820862783813929179580711197283960855071977068075400435,4447207254069026895839688542596519844298864167018271339727580848327164733569,10805247891957676953966507705079087855877568284903068495618773980630496028625,15247455859749071900237435930523136345408272002648820316650110622790580875976,1523513713815340967949299977561986680730112913862622151113511170812079722460,2250092345142769832690429177076582432571233932766644284160212961505086786198,5502205194489637815685308301009607192191278776537698439488907603617260091996,12376110094727246736838305034851207905481280418572145688559541407100489476563,10967543165217223191795950135818653456591208931427429972754586323384063916713,3007127915385490247377746617881910295130312971235615226220093403044166435816,15039810425747682043693978030807314591772830040893968588297240388685740832440,21282434502237090849892927101680045504469095017581606642683944529102929897154,17820554077495649709432871866725766383400924076526622095222498536082233385393,3238921346058569633798159055732162989904755716515207404910193961449538091755,6963065779232897395043653410311694992252845745677523471496668662716409139923,12741150889158293058202855298380167280366511627706735086836055155215291856874,8505231440570036863755136868680092759740858472921139738784962359970555463386,16263867309272856871859017360735124501630350380225439505739588230939592341511,11994652030543012675378700484156120788799454178056174639173766735729691200407,7531001745062176388176369578077819605743320864253593427909699809569190244306,11827863847264026226445842677102655786795007713756694062525124054010199531855,16129429107591815909860445595042156146087129962390514833959473605760944146527,7516787161495467824155321560594800913116855117833255279107222188682607365695,10052162714097814491117037623656731155747350728656529965818461926126557689689,15866126693591846474201863966897712396582450897559972801925967203045783070614,1769345590280238074854062499047542732649300047644326060581629862863392048630,6419881722518831944067972549598430355215508824227908646199374367237336336567,8427762909619307952658968866443552584787988597438819510120993141703552873807,7893311334904009120458996652611823451343891633360441850908461624396886564456,19760139770663625588230394835227131962944058142185140281511805786245566094372,3986819882418057034478817109485859706183862449050678809809350743539886112292,19462740190201175689471975116541495793256811137828607475310915853573746549315,4950984269438746319161544135494005780273536398471035822969257463380210776783,5114126436371649572151778297196722433397981560175541938915777654399517384867,6500502433233986724406965295441070598123907669991330544723786166137230830713,16317287950659298477752416750967064455139776512193467637272228586615836234506,14644311768591599882243015624322844079095287900058309581805861693953854143586,5280400910054229241086158902425292691428494311972092134978890627089874392610,15127218399002910266114392708998449241113801821878209170134753716497261629315,2711401246560501813405727886361637939228317090729002412066290100904319360960,1913027325164607464956755298437679573731669261937548387089448543475389709293,19048913840687946111515885036078245399510860136071611921573959765837451269059,21295287720552550910280526966903203926240851680963634134437049744624969307301,3797109693086078196558789257647252246485873371501397666934942661912968057995,17220092189283987679009565165189257352830222471797888201205665583060198133070,15728859045813610297052814756440978974533041326711446421367132340721185641530,7915246674314292718027357038683169057328569313936589479968179748005116348962,3168535062320575750000050980968432832479836571078965478747377498891053785750,13803986818738311305292789973880566948405947108749390476554600214529398575121,2887021549045614886550633658248390500136948561362661868354602793719521054017,9835777853770722919097370759265493857673816349027354889969484370501195735082,9162920843634529872148328448437467777954760966007230180656824492469148201817,1074954035830520777949184022573483523978030205622574039670230048399504082838,14573949395382273725648387764764104587706358354270169802238874779976052312087,392719645589691148855449884443988672799862378880367658864925364810308158541,3685551641667332817505970777889874263257498648047179005679069858878239338060,21636266924388678043670779518381645484139129597308274177295703055588816929542,7321567536895702720774368439707249290671186165402244403568878177007380798611,7172839196695686167303608986523055739039297465612557351529643226329584487820,4229778574282653726990227569322645489471840372440828936529243607112035640074,18782302953492985194605877986375464862209789031757664619583780308051670003641,11974809482173143458078984920442199204778548823433238304966088658895546634996,16243115558222486864600123441049281534776025041710213515085053285162975382052,20774412501254836125508172987964523733402936236671082985700605339729723682856,1483065919525318072073144044234229344901017930590205131905224416619628808251,13859608645215082985012618178187462696738961393768893322969190913266642570277,21405376459105682082984005097612235541120033931778677874212817450507078023807,11689238963312530686999514700594656275688886785400717773550428094425955677451,13770805346049970815658755939543097628223982878203541747699103196190562329538,13464128750778834946158208517080192694313764854534278881787962107045396572111,21407849640224904790247752730042846775377573219483807581870525715728151019912,17742435015936027530371893290930447550842976399042348699434701387859868436168,21607472280994630036571403820711131618277491312399185275464826427174795496015,7688464458545967396781600592854525549649369419708847302997939388491317131965,4387376978957625118504779199367262576455322502411234315349687321331690532595,18931911591990162605728772083755015441650830148575725789586998382906047952930,14640568984073443762298448827081280142493018130989596534711086636304928257387,13306842042380077440486698326492089142513016713060879132515526658677539077869,16831808713587057769987931635351931409992316524094756901264732606403438287007,11322415449116068033081427912158622347193126836157199640557951056169543153666,6851604032522439802523441319645962614365864202922586227207366934548805743971,7865033453112245503939716349145002950003125074081779764874079104952011815860,7859039670086457402270651853161690366745490673814388503748678622683637617076,12915205729177842184089675224634811499690953326168778547490092950902372657871,20937773388247481346344394224147944853257697507105144044681818248765914256516,13287060897761790924722969858390853273555324655965292728828260759103061260482,13306896346810583848301553492224587956204219709116827141735317644044595737290,18219814232296473414944129594782177430971511097498319923644038792152844524438,5428298390273304248312869576101694361963883992477060046151268450358678474516,15201216935560530575994837331432805679558316705524948725894686934721622162910,9185979018761703837993382762881735970994413889163208925197647077666234876915,19181785293325954761013200262201782189994371972312628530578184844339518606203,16637687071791710254394571978230957592057586799407792249481371375691006025241,7540695380854477789623159801158526233798259867148336812702557598270412992232,21033749924623312349444484016552328468392604073844480133610758629121621931608,9900738449713019488539657454744856913719757496206137183076543026413680378482,20521005306019974539700555774138941983710853964949502636832851583991666071090,9148625417956423696904186924742393962087070575705980963607554918018064302410,21162567363216498523188025354796572574708404245885103426215436531517848841283,516078530341213545969683556809078278712251743628535410360059529914040404316,16846240853341179628895683480146570801780199580812523539736983428470139888117,3725063466997152760713869763783030250548722164672702170123853642540240150907,15613553480222544404649584760559934580548305353382956847869893563076098726977,20351109682633578989341194704546173168875553988784930480177729322649037322556,11996883326331293630396983616262966081550223706386102455796773922602029237495,7467763103586466278784854382537524995001493410600869109792768087664508057830,2017508073008218056990628353468704346479637577205333604607959225275229259220,1314798328573144515884513072855778523099366140621231925682355151505185465849,8723657373526005784062072282873485835867170661363188128978957400998918352651,17008566456391889354408264184115222893038736754092176958021304795161250142258,1277201481182954066723110290486484624236238076832533331201564897838632505678,2883326282329572573598657327001707359250291449257261775578634065330832194673,4435817386812736743435792142021329255563452933485604716406076651024269234049,12698961373404268899870565736817085990987024732021219796534551825706597317720], + [1954546571818731885139861264947334230782822161673023234242993080695489129982,11606713580838194823093847718802359011098299538034455148401855555744041817997,21778217939341959600865514937973379081571132553754734185669152755967486158807,11867012199835162777599593543744285374463489953452947402200134749407575327780,20668200962959535110219664454556867828577715202494491079283962871771719016091,6796938349934826085352626361055311106987991567096993611616805270698773290279,15108030096316731537404525399718062561401239877230837132486990179727134215091,18618583058942935584876943765894457772128324732451762769633954204661267055617,7446958258820445329937058505234183740111199633995331064868799738609505041620,11019126795578266009911151080068316016022306110283709712693862589215772062237,17644961526468872013219663511656737898249108220341985100127433673616476030536,4959721361611533340499147366149623398780635086479466110353420780375692399477,18273613083607267201259595982191169247452947601227995394305633285537292365096,17816466502776842735116945485728134149282831962573761460376746436502757322332,7013781340485780306773324480395548266877763825891494701746512901494705653158,7793291197073594006386853421213450159077336220644997691715731402410704643042,3426005025972529257284910903433598760993095858232060658495826014698591260944,18530832095369567225742997294004908129637537286260217494648426754251364141983,16489909564793485793960504581924093693287639849995832883358263301067754354184,15126602449686250365534081130480301443166072957206187316416707568927051456663,13994979972845996867477162556668014834350043400046615820474382058282820089898,17892071176071030024436108339592708638442586845389229765280031864359446154887,7094246519433675669226318744483462997736245331529142696208838903133391196837,19739600791550679646703071148379836779124671330492407813260108679076122705926,16577895124793812992345966235533166228538388644746952252700985971901794098608,2190990407832635064016354900528055762572032133913345251583721394536626731922,10838969594099257399038118686024400001327577210604256394537002295046250661365,13742554186879139633322968994905507641568437399912823098239782636831322642395,10281113667801091149613944447670705624056560574926411753502305328318932013688,7661208680673970050246952651218127022141152720979640414729369551173790735959,14369836811580283035547554195559038793886958236571577920508487931208924192768,20603628573396476191496332378884772502350107937108583985752646932901407759112,19296916296835469264085474516279583782033370007674993417080564950885860980156,10983867448590555143664432588641225682254935452824608025544914671100236945380,5670198946055747149234813634846142209283829958947146164536023332201358566553,4904816432035963931263837796941455228547544800276020247096183162764093041386,928528370618860212551901809222389226336726628142306562102221490519648216649,8727385187994811157471310113729025912812882704232858255495018737569420129281,19909768217191699902186248006262494556099457367519802119733085801884256380544,10635786582281955931244778086998962127059196955758207056871772748744817883737,7140512340052162441606422433836236465795273624186668144911701254961330905493,16598081311443832517669265039250197623929992506944409626575335140315057620768,2339664320384903939910962081546057089170206846484766939921698239663651706239,425509623704802982425483674266195224640999670982140442030650575449074971057,7922384239142329258156226873732902413897900318612725000714450267548570680404,8178140403014386057685967488315772252114289881535707170540858306748328725322,12689293740944871195190670877158259851710828253354810002997981152414697198513,13670630626216376948528966598720909229691593992164633421606526176324419533442,20189490101967313329851160663874367593390331759675962821030507426149184002493,18209972608416650990264895614325602746017028678399567737887116829945804399280,20353660437114078502000672122042327871511027701339587880609263231648053792209,367135858451744056025051491593060073950844607000402056456474235270560576836,13355850760886700974133527239382497141869096511168824351814359808886023658462,7206193356029734986150290058613471641978817208643432940709861990432648635433,7885684183122679587266799938650213096329650494585142531776846669540995068168,19085115218990181267812208821832153255121894513890241319104580206329327134131,16305675470941528258170184941405206862153955794946952667798249341324791515500,15443626257895746936982356461453477742473783071787883800166168668037169561924,101832047855527584987088220264952346019960111874606050409415217845556024488,10576438072746903138917852030571732352003417543540340689583487864994727144138,5996861730264922256270512962050361669936822432104376503237345294243995854540,14877973900502178557219336745361213333854789301797456671201806787562463919326,14807962843542542498914061591358875654692300327506360640837865566998761281322,3133673265931719924452668737189159279894652423873815799856403146721022028744,2314426743898183021393131908284299082806555710249089245305873178073379019830,15353836455896084897563929713128028858175788390437902641700134508986437653318,5529981971838869469294842442312128910934708838384001405870007618574232226406,21863108219378799978996648633069571801923287451100447450849597846874069699478,6773528450923012634292634195479655092490402578779439394568805920957004744133,12150245180431051120309675366247495517352377611113958096501103925281912163211,11142442323884902255425165263749428309435092933107089893872191462936441527962,7030165611221942623542847326918501014233687676615371955108018311000952911338,14168907664945894221515023422776939138433274836712427741726190314020662482321,17973846874050037633502661848899122581090847479984048542694367819419188584711,6612448947387099268202244798863603173886774177350810153571814261011002084641,20765273984039816245168454930434370234220284726385931011063596091927027011108,12525833775624943075128880966259784896817535866921245846013552547690890352574,18082141488353658073882233625595393585704703572017716887747923068948432979709,12080205172928213829055364897249628749790838461826174687455161036760925324146,10426041417079669712788047630796875947997831039494087898318197116078426849054,18333367395418670733687742418586004501344157225223371831515062599898496336393,10666844346085567030848134043176991777319226647942683934134661343455999941894,20287202184725945519955164847740850432153598475156573942705745729215691030796,17942851314410450183054332374663618442963349517519641485232231950262698445043,17672277011389568686180232934337352157780343745417630591806280730146798908966,17416106918062278234521335281965623696779795380548750331807903068461573518054,15034390385078628923681181367678507353936042776187855843799428131823528700439,15016371809918204032764565101078018512566551812562861502095795302834732872947,8176229788878503959342848267153225222150151339952249831413185552792554528595,14202549166569309182319866775579092322766621157492056208423752359103429675445,6628758202046565882882491271332141326521031973243028104017889062740759748530,20267845326067450413789379016153439637066264448919236391605812427944953078755,2438946774028723892708023594952994993532105735189593503088246493623252811398,5327774123437518227973303235331602588839413198088244869937007412210139714640,16416517260868931624699960600760845305546648577328049221217547593071007584547,21691457642736313179352706050711464825492028639914839210493298427277168769684,17369736170805089474636304643282290719726533149056710536120639858255935606857,19460761623902421883797374762298555710671254062576987287084819867262496770119,19770570144034267396127078712986043464609355920552337517533085194608634179666,20904722049832148410244764905538463264520496768863784169293376826852051688706,6086931305514615639236334006857789100145606465861722355610937306339550862,5885641636117295888159072068000551173102681944020015073964039109891861226751,2197549059218467728366947205357858398035068309306368786367182781869500529089,18571065033075196607590252486530861399537536653506142751073877421696969841444,8754088881400442345643534933850221698544089985357770542959718766123813634810,13673463077059539437815915980077307152850526782227553623693374041649724049605,827897346385894242944663854685785871137033256170575635435612086616249561082,3256718342276213157296321691616951565542440296040693556287210483669841487973,18851058760089844863118102177423730353882359970674430675542303019981882750705,21009037983427297652279654800570889577926790955118786173230430780907667982896,19370673591737489444054265538393258291592098201577177240415593550679982651270,9712794467513451079466753095103777002587307366322848872714822737566534970868,2452976395290300719873209484043914405675637974162415011707015440506646332236,13967023770779438454858978860214792451127045212657472381516830319420403024355,18974770134907327058718913691556562240688992993972407935785848010954975834526,18005343276101020422248769804338953747590444642920980587346957205121649916277,5364199751574723768938730543610903684616886041855996090009230701935892264768,16915141432748433783158989990154900013143930156431056052460984382677436665679,9810457740455050658326943855759399108575402539560713791636000764640385927272,15711844859260073612371012979328688796642677336582424352155989490394966892994,2523486975208775388230636032695576725855997180931786065064150527465407276212,12939257203114853364537111886847673104871159136302860798643783368852456402126,18563343508729873190283517746040347988882591986176993103658794343898711153424,9139767925154848725661711816797304370425590863714334419686930754659416933343,15630326979358561783620795846763021145439701823262337294600523076394775855291,16709031855693747432049197217266634836607267701623669179857743766059308291076,11081746589259753124653594380015131650915622160245647873370327872758282529429,10263829532434991046602117509549967441368717347217075372460446855507340910410,923380097607272775621985864770232207712801803675470117823528453022294342573,7060362012752050086965449046391069479205357779670943566418766734533864254186,4238871118210220589598309748597547342336859622832314796736348778105851398663,17520061366255155846404852213753339526277619564174678951991892080505590972066,10513625869281904114245087023227471195681135249236672625281292889978751612829,8435396899666453466602702234562279601174578748121165208762270334814881381944,8088078454252433245088686773582075061475116946251984942060002979516553775360,2719987334353537600366656327639544587227927648913835976421439609622334518069,1024019320641379568207362641296952564452568447918936948059464814762366331275,13889412498086825909291896540147715217051215696137185869382874120375855480535,16901630530096437974516169843541514517956751790577876352535912471650304576719,10977539500432168331426791033212854950231005312634634920276038346698892818211,3226460659346175003896135924099734866664778523605375090881255390738403665617,9695421696482260394078309163365413177132015345359377667904366174083251929056,11269053203885423427900382169641426379373759430258387104391167619152696936070,5178750298399029508026924620615685679610392082191932524033828050686124044833,12845878982355860044505488053971997443594073436267126888909625977253125523142,7530981388399357124357431126610695946065175975095472306777796169245607001944,14058213441446348117716607452759269076404820355922112411973297063005877380478,825603012201903073682942337154197674883919500964784037574585377691889312422,10236993586198323123785803013039327931978354285685191819502917433935835639701,9438970111160688934509448828104684236155844660381402912193342504181825365420,11536612122721678319037657954738688943272460041908847457419482683492719528721,4048128893355211133472225346691072554088570917135573376272009214966234274059,17007960555125781716346334106074020327440615260084049810189285619997415816473,2935744638594795881476272405224480626548498961519135317809162650064622710267,6384493312721061401062408865799313573644091862395937725107886310975229942194,10507848115923740198082149097677194763453026968238422206438345199258995348681,18755782391252715265425541321566381935042481942506333926799033963914433188574,1622030934879728521636669415221999170954870898240640125007128754133416241951,19178897048453000979590659690957596324038669245300140765620928017217201486492,7668471074291870526245483897884601792626426080083647233981123797699500787980,17022938204221917796509718984925895198444138607270396412440297468084153383727,10938747411001421463106680010228586254730710894241856448408311145676137003709,1892143994611253681927160695719312882099525827316460372080933907151205825399,2626413664304179483436880400231214693597358131317388676910101259191110264005,10976814250018194880310517382191223839713741375476951941358522267556104616194,3267603976137604608815546917515683877598008503122930381370588099122094818035,18223585230504941070194267966378685287221743128395324427323638965512681791787,4055897021092860484143383650117982675609656498724344612791022670810747280835,18652001434191198724037217430343155151673545332667032591923572773249520166995,1179210983342192637294098069949454912191992256395734070923896011947222260627,4403412539347069757548448548289536146089860634393235869990028179479631393017,18208249577016536190404023195559477353692681610041814639755282640930299265764,5253459060178003600605009461295776576191151024266914967218417406063967602725,2110599375707753504956307604156004992055199034205281989577749327575131764193,16838175205667561737978735977781331049290662487428014461885404122880770700959,6473428079010461623647807107937762759737150259352991014918746820779470984847,8337370031139132243770630686523670334344396638842630818638144451253681713442,5852133535345551978469538570221409138541345120679970583582105205614182914641,7693908046708935218171096369565374697059710647347392990894755587360287791527,6754690467826351700887172852005234976131445583530162984365436173814346372178,4362899351088205531982963806583486557201252717995038448293398829823910923472,11518397041006514564038599401506526387562942749501723393674197214904315107893,20606341697536003623317613291213380804130123512962185582210369767659416485838,16897394754877405156789353426985842311670174197348619627467370676352261158652,11049995264887964858828368499123384474282091734658191426291499678845498016770,18903841016151023909305743424460730902070062204415137089939274033985227379247,14501632343069777665672565757138143573066425682965558756989443143462299059377,11936194426294671569251421865691095594275214629276606276242590758676139955663,8684782852463301178275527204056308121145836348455196441596832143888384190591,13840275015334112173632265864573045139112521216777064496416258170300441524371,8976112149735004651499648151657522459186187854485087924493254571044062238478,2557541446593153253492913007582627823644717754910327615163106890559828872362,17214289010670114093415697072867115184169717632618753776383803280726887828982,9277044732799923560347274951803854995664839245943597020159605756847120319168,8665104485244718969383349524127237156930430459852710098382428996861193438718,2966017993337369327831105148290320997881600321998609267125699685969931023637,20703140915572601301330743722461592884427012015286406537986295678495182028439,12415056396133226456247587270673507158810318408454307171336801889305959276558,14096884501745579659192341381525893498221351476730589189812251926483574089240,11380799045102603249740262962085086862746282867943901718244205293076495402152,11397463999860523006350413477163951990037313029979805067679629038011006323456,3989254560279764593104713297200294887781503399600736805260233256187721580128,12670526207690537332382598355517632246478654103765566238996179271593311461311,3183711571356392622250181639411196710255078687860623143026450897732409025180,5610846600257417510307213084599977483933519996901968341741797171439650039141,3280606490416179974005759319341626407586508917823138878220428529454629673364,1201982324417186063031536229293952219287079604094432487446300310977814955299,5320694228353869326806779260357179675523748849691821041819016623807887766991,1117900147109997141002482710095589298468009897854242933473562031850755107739,3423874914270570048663861326353594445564054387733265522218157141041404209456,15544724812507000325032356684034497915485954044805225704411638706645864153677,5773122431233952373926318394008190376724448498619094117536291976195311877322,6101823265492636176451963193766486622777300610881276372298697176417958756135,15795396300010870823125638802470599845845464744307444307899702370966825169519,1323789030194931509684647858838729962688902410898850967128356366290242773839,5751046064881673173633677922158261597917572500845688735304279201507132509829,1621252171583823353515150633750260236914561977816101468910968069661001399932,12193773521417435700759146251386454694422997324768376620870510312596267301181,6582582178277044206368630428791785430498389945338461249283089656681050213384,14215781677876725356925186332463972498447213260700771466349787162195918816425,5782842445406193701766362226063474843566378485612132749823957396025995938674,5452153017648783662501027666999013472879951066118424395570738985848450672673,54899108049022846277426184613878330780751769989719315816516065174629128493,8847320923102214377720246218239804718366581789144394009065472718259977212062,7818599458828105010909362503034203380908251186730393621503231459166558068065] + ) +} +// noir-fmt:ignore +pub fn x5_16_config() -> PoseidonConfig<1152, 256> { + config( + 16, + 8, + 64, + alpha(), + [8089493102530595468824649860529717181797071865148765611726566631095271469313,14191702863884040950201894968554909828474263688190658890761244249722339089253,7127251756910107506817428481560230656411897313679770455026102671367474097624,4637045655841785226199626823170615348821917492997807409130873179711115857270,20694397780982417522377524687614391225351058648522092200738043379276991211973,7370528537006777008458800981771544164650999525791518443407240929647301337224,8357863226135085648491488089966537213596680483394798064376015085804610201240,20367087512494301090653054692863377975501664994817680661442168333644299005261,1950307616347822794878104597377932622958317394806719432040871827549672571148,19534568412595886801081532478416580190048212177563706092280027206347120417736,3526428150493332211163778868665379218281231008068537115657136020226387337771,8661888879209475483716403816709663500534119170711151152467249807886559994385,2374871949454649266019269203973683966955509927334059254254180194157352943840,2602346264611026079459352146265308073912201263350931622963181149514761751618,16750875216633927741061710170647391823629779494283192027015930006045661350833,17325348607596842041611786882495470980592459865615213806942169413086586278610,19257833407854296241609506861086921463964253377452883026082737974007723285939,16875536222414380047765946704936299627494679557426090013440678117262080229388,2035577529925145134060996791483051399276402053645795728801937468290487364296,14222296831200170749164428995066771764920247405996747821740895709606052517407,19708208883712347371628256596476366883171584832295648266624355950215220127904,9765600454835189412776212142789582666145342479104764891694616693066517922502,13365055082376018935548592209736650793571432301565333849832704476237136996118,12420692692663472732723794387493491467146971343430969855362995088112286983728,17844493444787722109223680249951335211927705850925719012603471955916755628715,11924944537382281343613401541176014853361783437608625866798343540969055542140,11538333989403053525558050588509973706031711021450280471202165095037142068477,18764881783775503232423409005005138632447539466481045749407270569758537393398,883162740610443285913150132085694648635519837269866659825930623017971541006,10171610390436513861069093903522467940290613868370765425375996220687957422386,3782996878040749700177878799895260702330488343333700969514291046490113056911,2239298968343190621001798397134314102896115970272480212453695048745962826317,8391302051404015178833807081994898536482484463022532956140929200199667853077,18096164030411129129794470313655227930799185448547884977984818798794318221345,14613424916575212836238688482051323957035101724778773648452919665593660234946,21828842930708391060823304507355770719075227415675853536112390374449711667078,16155169369395425892836659730715232159396910561858841286007416017756724971516,6878543234699575736262375462702866780772252779651204219697567141737826275015,6515580357485419559928692633356133128461299871887195169242750902403019378404,3124270150531482035695013416051086970123461406854560487654035672981879561715,10574698281815682641771693421115734396172155905702803455639975437772362072107,16383053320907906491543185419013182425229207444535577699313377451249772804551,14128602818455692582904557734609240140547347183347545360942329621911511704432,5010441108136365108046592406551529565385874487432431586303802326844966531017,20105162467673383983751690623903949493335895059047083944279780871549558030082,4243524359837792598965046978953117623831146922720880550516255054678204683627,13992943040313469850370025986460260524555943628212884466234808367632688288666,1356223459509978352432345061666791804860823828908318470584528377749655994659,18723939192823222870283999271398340959482157197116460943968917507878394278385,20636603031793247786862933945150382157149390912061952007323929980504212222032,2128636310217902240014588202116301452804441854659460379597999718252532068242,8892458127594737495267008183431736534386964959413452688074230438040504386190,11063574691797903196312547816101464620325790434381460261930676459857164737407,6204567085759054728130072959301910137692879386674785283047171198023995380593,801138962072186678791979363551434811728526970692377261272697294596118718403,12941641588837981062781447688458784558606932072335320068724403816548547438675,1341967686547656677059175660053506857201298028878352128737987225407679621418,11183207447266717668611438117401741351804062326702937903525908319309155043524,18507917680426998547390822933408085624123062783706353845158832700169805897057,17600956758590554476691669608345000941959084040124470813766683278150335958657,483394656899715242498310209793599026850663551066988094136788591643990355221,10090827432001200203094010206359607863114405903353400294360808239534902160627,10039403020393871677252553778177538625214464462052976366251977746523421324197,1924712848258707645798108847678093621275398467857399987976700805356929290674,2167923809975069342404582706442301809782773089534518796665536897555762931998,17151337466618795643803903749019481111634005237742283518609358703199930418386,4693404918498880046514671012411195415185134287680728307646808116832211396470,4839381186041991439202094011010050618021148651243083039175474529769659591768,6368336559448535344096548979708211013055912139451892726345028976601375052582,1969826462127986113899121152613324197819709993940588880171966228829834184618,10949071784553227115382687140318153702912633728202525040498248461299029092720,14575837988956266060370685891330921140979730144767405243152428616625585430364,19025750374860322288379311751788635906611708349625974065695544669443137256255,8764838805814072278932908632105809429351124473407135322177352737762640822858,9508966145895699172941574119083482387827406291145211775810415653335356563307,1499853062814132179278896768948580432185360181707926223121987796423000161587,6748895423937754323870965728722563272366114856617067613970193226138372983547,9814536604142267489967579335173323116472525708739068285104384748406479290252,18898551978119284539473648820403307265793266184829523824179430658011490726286,13332891294455702171134399009213907075208764727059236543259960129130320074982,5806223588823614408610900761814632517803554600662169829453323047489266087405,8600992771060584427141790133616651912076186875693672268259185811464115092188,2345229032656719135417406942532115442859563039531904661440827899574284256939,3389225209359511603097670682835778418062727662626674404140526378611375444627,4001034682434006987902788179906586121095610380401857294704332109514659937637,13067063794999809131589470979742146742674772176859338210659998590141023560073,6021149641876662294720012642501582990883570287510418620500730995186581678990,19744062936660555217694711756418639275110313106982456779211457821487189038259,4280146833782122185864346406516267200729946534205141990397627632307276252746,461380210352497258096433274264553487092816458993207056498455795007735775326,9185904966475190600688426658264723956468287249470549941528026771035049026029,14362213733702712122544208087232387435453213772974406963783416068708716342186,3376133122839395926880247692021311631985267298172444834121553500975764354590,15430636928872496244042298024957854104479533547499980110816885404855993587926,10066678820787654667318707571747478964216410231002799394324814978870300697084,13679726663800139966289976616317518761749708307387522908283736372782010246091,14452498713182028708607687209189129972318024710956800636750706657647839477841,4665977443169087186016514814881141858109411469723890078365751966690257156734,20673947333628935106924449469424554002781432367358546714606202194020160454893,8371937803667063739943392730412639954872585103736021824547232324141910768530,4915642891224254203187535229956007243890165147322145197624420790022741880987,17737894427474715513464524059598818432164911920893615068415915800842574129123,21257751286440468433003251296883236318376753833102432675015194790356307947025,11831044910484530710733100158936923549935832556815349526083442021617595246222,6362553671302097483758288321671356788227750730995074141338726755028234269753,14935971406087488699083625022278942628959200513244202282294495763807242526556,15337281352851760799121170871115742187805714822038335053341937333897883894609,11913020597445264316110942608419581486071629740611054234626537590474050938474,1838104841451540707239841220222372684744879960533787766800248740162155353463,12200586110950172266226854658183951607066336178441918240404611233042731023944,19022187774400544497696484163376638844589760125070799280660843859892595613745,20574219232807646025576258258887918895888511977194786423008507430088227970769,16786939539299167614623107235117810634408742454195124075763115939760135086779,17293110551721019748567259052064171353712124247596873005371071440209356535788,3515336831584582569659665150343000056186787768627351931657274076732504326799,281425181255898711371985357453012506419817930424882315501470435479210893648,12703632225346671660598644961986122293501524448004046573092229475506828991982,5589259102510829346047060861494427710966525350274659545392525201677772096380,16136155264962057601674035851031539132207654054954939479993843931937787809008,6577810342827559587628942717478127045802616172145914985109615391025970118111,21163359977438641650165237544426961690819476598192610702649950529921750524674,20111680006656824813833529237249851680178501017371275377838319189183351852836,5575615948519348213741695691025005079345478514823636124237182535409145360452,5523844323060926872300411712160500242292621601876678751811292002367512597282,2341781247790586645587607723874752210647545627417738353111026163429313125329,6287726121450538785847268284295299220404766172163996260292255850387839422364,7510648235102286772333427364079209113816404370140168905255311267436378725194,5010598474035699846534727472507206499428871255705467310762876793528248455251,5700900579731011250748267725185425351062102227041063523439252105791254824347,260864497479086430816275699586473497971665832148788274905912958670548982986,789172560806161139006535038197594038879692565830598745604163919464033838458,8100205286609553283468855217617464988341806863414698413875768149192804914582,8832923720458983936387697888604823914542155000760959167380458346468815941677,16408716740290439442219096309603613006830415688534254451854294128560591562449,1113287770802944863484309232492725673552460311886837538428140710794437752025,6321319205351235108330320300049882062942831936257890309503365991814791003082,18560922321672258596191688202021423732168869299915307979899958586924038420673,5189180998718572459539043290302679421565915950138990634526371489122263353689,21059088895950142731136323564720383671175925416797251043903234558355128937274,1758538453070760465213341124871446098960577889968251388551632606564361922354,8880106936008308891697048583874212287093823544613405494775675377028797786924,478113991762053058066048308336221551443374933771727184756201865704929054005,5364027562586142278013801938849728210749918309705526248720112356632858758221,16060418035757996187280816105829974246762721308664137780198420107462005497738,5211176330971465153824216149376981285606706263050338982115099875409328929990,10368007546243825628853187421535635929255384415227635572356066208437184727920,11427684168459596442778160390157786957054817508127224050241732612892526145073,18949700777601180659579150208396846544227381511915556752893455904600581402034,7164876529024763696100437397763470424696261670104386888341279210050743231742,11672893202716354350665939605724566655297144836947407230492353459173601370992,3909710158111676258105703555994764863745260060728195069107924779522169147903,11345007057187618276350650167405783488453459256756441881422153715183450077456,16177820285119478894470005926103825065477859050875380004945625842748711696023,14605787997931757094644238801452595674783310674883843033832086542610678460710,8394271758834499906719701243007064560791869846306715272114566194508664069904,21873434283102736245937985212570921154785039540401524103800440576512828034687,5288693737755970825903341313388382553570352630888453317445067182115774973600,21527468641133089700262079461319550104586512157305923587305104390806741900810,20906707665998407830558869509347677772600060055286961495556134628147066213175,12592377229521260472205372896527756013482774884841906928184642093380092134349,12910817347876296654185371831758099341950752668436921762585644650086702363745,19707023277054651202681442144426045379962145417802880101371794305270012080065,5370501568233094600905283140114160955385907390235753857797923590879732764547,4893525410028747500809250162311718717246192757157339358355279414251440821369,16933412769230696712087772684638356779344465843185712014276708361284654443016,14752252971762751211424871408209457845535321896357466404820315342528474475265,4381439374316418237204510331759065345075613480172639747277311241150560517970,18983302468109324889867853797358234303151484569217755559414917991855202421044,1720853637877748574561923069656227402993841601703014320322493127808042278354,18055674086054269831422192610284879350534759472987936156359168085840018213729,10022985435599924530950214242280707656465340100733875531414649379326713485700,19489289237398317489155396973411927208825921597467958674111652983018260376467,2483969152386321683533021854216836603663579724438750369420802837936459253247,7096495647820661985493920714559517131838710818830485847136203068929085317377,11239734991193991562092142618442979132467959527040707676033760692044595660477,13964689425465688308583323493745924709191744803740806305195114536185949582431,16765583167493792488003846249322412563932361325466895848165782639635509252698,9258699025821383775657130802030622351199780460158138938453769223645462201380,7261743362549790776698831974802523106349906457536556119083744106556343806039,12174595715224479314914773177369125156875875973781826642881907250708051936707,5012109434360646519756574765661145101042498088812514145017131935992653466441,4700224901573028234520633038757562359543812027452948633531739331172070339917,5524276305760203869547781419982228286567487292869238897177777816144717638402,17095081617164642751160867282346616888601375485714887290060713493809720024377,13598351826191942256399407492736185075239065075291047608049023984461266141081,17308136644455825036504551600136601372687794695239587014243640872267542984788,21730115551932424945388178787861491256026727823117641122401508483473017057216,5949879858200957394974414439063213931632579243992797429658708423363937192395,12803563373135008849577150591968062878999687541475931973931310610530915756774,6197313147432278847012935526443261694774265540021863115632496255704682355001,7028974783929794816060380650452873559926928309476428464943277081506765913122,4456589108827474318002287720505015907920793224049488679883557016295128273089,6100631380538490803600079371988603006023173019183128962118450543769518343550,20177888580254527519697427670797609876974132471313961205784103868094735572841,12073238358529645427878918495905605836088922482621503239707831646933770345610,21856100081180867115422179532992210187999850914786148325024530634866939637660,12466984235357303385071417632152615871825808908890287534009467031177378240877,21079839629488810269856967110699842674750899640941851601070908540874579869846,17874776547285892135748821889881943162098691701279199858985484844123833691703,1051310306073108765618056817409777616413695911463346454738615844650030082984,13201928900083471438265807470373218252839081683324776881761206414378175945385,10190119257010511211543154766347424644241552289850760573785222226686792626364,4688333485355359912766058497543573340825697092661609637162867722200016624599,17123765906835174464437643379916457993692257252235548439872663365295598699138,17134395901615480964750415429455088485278477136528521479550104193427850309670,17940167838269540610857156370913968688439335297994033024607831012271846654207,17211561414938780959438190369003172382648707317417933395371238331823656001285,16098871745352156970746489901084198750790375003919623885201193800062775011577,8110023901773238127710250492301336333009382423651067999842110155158638763822,2422126936887420595943345532312996428472865746519279257114791700143799243285,10404075183720133448708607844137643895914849868988851944394714021532771347787,15058460651933569411128043696753704901683095219148372416995175617698935925786,12723555146577954839266714779606964953587444931552430067661560518513484316738,5711657581065990142612711893585463369566607394626940266394184697079173482347,536257458004844094090200378771107142207864145916201798362001449936167413480,16904097338561724274235483260490381087656469057354151613747001642006805270380,5885951988825802528717928331501311151617037953699202264796404860914064325522,1638374036867203230684496314040773233229976276864977417441853704948079389600,12231982678049991867660964493898657015614690001085229646831798098083877705620,15427058040900308626278462505422407030810836290013997730209614367042825008816,8287021582226423932765127558352821849475385690410389396789209560743363809623,1082920048469231434960727235146664410555571531264546962637788898495946680112,12010985569823806398477426440616395624594456642130882649075614403521532359981,1296330560506042268524168200578272313263311415565810607634491211599523487141,13952994457760775342452243315330031022436205430079469228726234965837656704462,16985743548885988875181345488907967382109958231690477723834234297604193256890,18108965571078287240054765173491615799731924163046353815744437352944165909003,767530387704511846542067425779936904920481384673999726390798572580115466105,13028307645272598127894992332463015335938472044187733546491605798735426870634,7618140648066747223455845067208730203353985191563779819124185938438241329003,9331096408013670718143367691921833484100954507332698681105640867440874379095,18801244145798024592964955007270988394935375648640247134868164095028295260248,3795459656522732094044639001176736675357207553263371458375866920248726997086,837603424793724140470838171288512417218344963365692836088493443407197621528,5831962429370013799978251611601242499647911352287066127245255213245836916243,15608629818832866779793800587027419050315344573115273720682841552596629193016,1032806196152635164955947370516112750756471391006183599859124038948506281039,15696208732714216759620197747787990886188845785832889089576996959760026394301,7234583861372635173862436546128104054595325252312930586077823639855585372879,9351673222157837029929340587547626334173727344379333167413124993232252858910,9944025695384518607461067522154717153892207999526158631473359210163311199905,2388456762928315498284690717786606118379553818175612967295585468860359388241,8762894023280585818322989976434413098781364467068028456427186735232945062041,3982990592887978322236356963193527056120817698005386105106663667178275102339,15305580827228104504176089928458181616132990558748682555478070517971443343847,19329984412710376451608868772829323267202139442902035837598118892290482040500,16858720166203416564086563387111926247316950607110418622245689767918477559853,18241191751089003023961171787624834962373436019307905123520202159673396473314,4235718345809909430818933555490446039661741163040234575769526351800272747420,19336790216312697816897624746946849815032853517670504993859895524588720552146,5833407345693372936993877824926303626341316298366978224289402960052763586750,1246029211601050773151495439169819001283925818386531745942667315981536442422,15220086581176169769190817430254624676596374261069714496878816359393753960898,2365861900029834138601812494207710261363070950725532631535675557556177296586,11098939996500166020441603457997996414027684936264124308565274744828953147961,10188381420146390141161084654671015083379584925005132911919536024814384766817,4842017639583023386245773507388835267437650777401251470903076835565728725044,2473142702350888708640145449504461869356502285425231033191892981515210840933,3420689338060147901034254227618353913575873772273264928595432321920193621195,17283074258384994096612354354366039962078336488852681769982384814157770475001,21006196209784588036771700052971738964442512933084691689593009338899209077510,18493924441589584713280363204662484496255740376612784432044649586411869984552,18050342602178255577111253065667811034294368946566845729063425104069824407598,3678841436690736561960339537207788725774745841190361109044779271967419319179,7229032436003943468306271354423246592397907094971085338195794532946516086746,6074543407778673702938004547803408348112315194664133731027958879041743082105,20066840392762178519205386382693042859978931394221116082945207576871299356172,7392805501563984757154630589230967797392843859128971344647830779113836888313,12821992933916071670969878929371658252743368422895791718047075564423909142719,17668945380988406358182777882021562738916627352451654449781528301527115094220,11046977583853814151360987998476416244370762366051844251247672138778958746421,14002539550635338734484852844372585460419306414704948112807545053902011590061,6606166606298514036368338857611676551502463523513184670555953533985389963443,5446061818493011809543734117506203755719984305445968514525154959975352640311,1111668700238284277732413088411620500087954609586256178652323895010927817926,14149444834268176201304046807022441432518948094788616136522350328948362984806,11145589672768136991149928307436511325152474561287303838823870178226307903252,10735913608001838681702607049464645919999926391398426712273901727922068271016,21604506935173200936527132172076877500255612688310066661071635553990139487164,15839861321575777225084554553361389979179161218821903561853968278717519007256,4119757287481158134674144154651639875410119871143992982693366998676854632059,21215853876753845584435912754954004476252409742434691973232278809063267703513,6474112081529376586123095858950370103982143188298415134572081362206457634840,9652012486829416433331453480518336590399776148133427672040049807230079809918,15197188648271522366095502604900923401004235531330211517976306351199244466155,20653133196783868133525869637730316323485671920172550159454294692576016995406,5372382735415117884334788700701478755716540017619541377211078296573383620529,13207488856826369213621681118482759531513035177166234417284384049787214456366,9796874023172008376751307392327706745295558991768659529793122654595100420492,9923897870015737084413253850361127061692788482930375413255676958440886663490,20345695890485642585927456012849850866425595188379347054737827588286474285546,5970363931303429796131779726714445177344307738485323531135738898520018230730,11099832493605970375935052305980301651220466371839450598182845139430995541342,3984084259485258180085200952180050171170098877962423607492480207306084313759,14795772399510400766677766636479617776597353783628606580152075755214440944984,12411649494499018184602448007465543838785542392797557004957418343044512599298,16626394877225947777126043865023393002546807148362691512796749460115071596438,19056586788697785123807358806982924302021705802715675015657752728604200366151,4434453689868848221439283056960830923558217744100875597646474729523600908085,1558497076513757145941997689136111603376893591128645477322800957597462648163,19855312204158524284458047353907697917092904349885231039917644721609392348549,14296610840588714282305996857377052531476403374009704740496611471123591762688,4255702919775232787836264045412364184259731261431115977947396605020618214051,11933778709913818332041068411271656949772987367132405709674023277986614336789,17039721891026771364303633162265090865698196106396237296534502784700270974342,17677496806049413057414389850646660368467945835594987026827101037177591654389,870853693457310346529819971157542197768087609061398183617507613118675541833,18050709179661944189572532609164386192084249162773126990656248077533050260547,12509892200475964347152748879404468874956023169504780638942472032501158691943,21290469710465436947459252705329759527038443945558987181251205171276803887919,11697948989002333965655987240828667368730889495575710652080571936823918605037,8736925166569662118997397920658489847012314542439353474077461070832299486573,15840706598368315931966990863663232282633707371020640698077565307266653295218,2336556619780315190172318504866216965057876522664932909981631800248874766723,3401386693708589750154291055903211427275255738949699968058464589080271508279,2985234144487193053560662812519604867522985647272968908108472491424983944847,4708870044417079288579972819522537183137753616055169595344370650267781985451,14922125937386550210569417108464732470846637538443952204254988396764974305556,21120247382250540544939703044577215089934389719849213503558017786742393072448,2316928219829771701890891437885406935408196453098584469128414556890718887397,6617231706636202699892427347447707304283374531129890683057423079735568483257,8090371166463272188656489380541987815472988984318384965972491395697937697839,15553944362864127106455863696894507934518908899701997904436263710171474812555,13969363969212770297664533823398202808376213044430873505018872984372178723135,12323663899898371993768411530695190245261583246438004058508426675150745422627,16566875439359417854141203050455423662432117146587478868034846190942245403701,2085197407488705803446596939115235993629808393250087488250514287409223581616,3353163139852271259915937989527822937141797275129253304946488349312180510876,12046433326685614994434242499247496702084910418498830651483913063626259071609,14532850787151304296314608701306827699237853461438425922459530673831764439726,1248026383149472348014634990743396120794718445584945878307644249641199424325,8057577408830637105543973735712037717868264099646638037329061041095961932706,483318248530006664922961695058460281946793595997210254862751288308569479187,7597115662868588435202039449596982590007976221501668730777779068799655592123,20576588045443131888269350588198092656950342341724106762422448997215666028156,1519447772833782137513870714676314005111021965782273965574223992106447841589,4564008647036378562957325007261730909909040333020122431007246472496053026801,20058604285923748821870861850977236730661592466138938301165874489677433369725,7444135345158592582936132362592519965410456021574373937334236087846829245911,2619748000882337075816263795535027848943303678661676628903586805250445194179,16416961968137667392446268131224700809614764673462182053193218154672694280838,11133666903754924307114887742321725054257211678992195923482419349863465176820,18185607668620497969429683073093259678523061297809671850245875139394070019601,21100277417778348195596070047101971906596351310455360764416675735903158404363,19242696527172349562445561603976204919773321047775511674132373901693664836452,17641599298698108341739444819055281386405281781490793437098263180756526877861,3867854105746657505538112984381791148258872175005817045777653312620913799165,13673929044343556285939637616797217757029992003977067790150536754605693560092,1413616068844936743999269099411394796998593026467324669628149625629672193659,17182247321635044788965517464433108044764735758956097220834338897775232927292,20369403412607032840251975012855741679474191692713337906759271231600952698270,3368021137971787382116663997287877185273428758197831072626886100000321343009,4058882993633327642712241699549337354407965426094339469485649412411970892252,16745738472558294852806571713586420783108275141805815749526145532281107769806,15581910313143599067008775890965264886765882549739040775187928885624726340064,18274240790635707268508029122006654280996256674828118427269328392146795445159,20233611060321484677112349983942832171860822463387331585688221516502467246411,9578794697709092641086862842633192064390680557390699768090648655701242260988,2852999879330450264744202807076238853213578558186322493583347517686662265691,10741465223456896033565854764716115079295016404042872162238148987621341827594,1287682441013790555075762279132093640356858755666376578858076731440259199594,2754348824392215081276565702993043505186786457070961060283939332925679390910,11228376276796390660691597656113154929593350154734497204665175991737933493193,3311568804745845654494413785473574358224291288129470978720234105131364795989,13909323234259677397453192122165186938471237491769110758142097116703508140857,16483726454860443352311561107200491233365512138292033674515348800113826861405,9812016698744294015002456058504358834959473085649393839832264042031387688048,15177982625372891489410897122382147270421146795964397363826406495667593673282,7519222254582187388553575935727848524972644886624855076224718541180666103816,8301393036521557606902463799168007719863879180990998631543603658427343679902,12294426767414989378173056202553334768408199886443392931845979330633289559578,6739869506728400044391551988623920236526787529007157619233939477743084008138,20069013437903411974438964103206724858007754851513756279456345172264534005155,2018834934981362435424318060070780595968114685660751661802811774334240763265,9403754976005906248280231838299490163038233707814936394634595857779528197369,10417979303761863711608825801177810340012849177958033395021985945544086842565,19604977682052360618680964990952175014659495782934855476845092758883928933035,2688418347826037364876739676610309530415711729219616027453603183128414252617,19429655781202385023906019671461539686080096105536288714975255299583443223945,21850552082723421744247018249567438591533518178485575560955887428084379635362,5617579950805240697000723938792084314286755653766678432489519653418680110671,9555670299297105865403034351288164766308791892391888668326102655956067266166,11495978801695516791606532228534536491719831441531647897999875880662918322774,13446240540987488159401062110915298027617715146895881354765875946092155869706,7830137135198409572038952404379496414181899227574329472045729197166487746395,9556039398803760338966955211123892534270670688829455928022562515996727400498,16536848921900120010270774925810022257466132951671306792158048247185847693295,14984883995702583492812943326719347992462648669814085270913355351041523830317,4449876409800178139287642958372279285293173800225271693328528758341654973266,7254404965814435397385340781449208987509307430022649779312503908065673947649,13482540945483896073831058930261724641277618328981766008722675404404347005009,8516464109813705017846673381161730340458008814885800650922822516855928737104,1123466447164703934328741246642448511199513706388932930170273400845584259512,3549658554379334242628536166107543119171319090515117171924404150785175614651,20050236656917680705173407104625075641049186986084540346810909246977321174260,4328179367990709150244102496965604541058014472966567986200766436334838205729,6523960484836646945629638483047198947455910731228954877131634689551005111678,840118507410487418552201986292140077062095264830249777356756239948365951505,9443485141542020716795178817254625558092596484849541439794346219916656780924,17517352113160950398700094980635300524550125065948318365273967900505416951637,3558475678500267728084169977682358432036940763329037251571517902892359350060,21782716253294940222641143651977099452381765047328512527623130468565364299843,5143600969269719315523014195013433247337519583796238248783742413790148311283,6937766932051718809641611511685721559694403467477888704545484121202675152929,10248511959409536383597760784458127936162061804351541810962726000050652155800,15584432188633520588792022977848834701354218910295071102828776215462904575092,16507813940325077551530806573175229924530686412372461197571308720671287449933,11975780799589036547299759597975704141323969091612997515060812893050562154894,2743143635303404960353780118079778350398309245035425997562746911685628540405,7772317651868959663361913464992926253491072635393117289337616002993612374782,2337519377771760840047685336751334655527732210909930380948789294151305059244,3616132500009609097754462360087761508553832847286785396472146776175233605533,16840763079152094997371697832566620838881567041180683145570810083272689914599,7660270111053834825889064071065415593147131275236956990950685283090480450184,20762611535627684584459315491847035257226740939101231132494468375819869523509,11042134071344142565200223013849882651956544247603198913312251335786248573941,1940414570916441943786503544322754456611678071701943345167834901237861815275,6726537219661359488596406444614225094882184675245355532878420949418407567309,13510096963519324808490741235975735288120771162631019837713476375721562862601,8622373819062603720895891234592129397052930901106318032071934400492518897707,17024729268332782126190150627072810510918979523772816301096433100167961982933,5587788522776741050743071285424100117576582212221222382824387609679897172811,12388474196602817840033287553175313493977358457560707192943603355479290048023,17628897462697931613283808657115398230150168968257584770836553363771557372104,14065018459890202233327759187460200256630019200670511082974394473420421694399,6104554150616525884927725557698817344144889522156367737688769378902924558634,10992664178398974993431947901729345793474931192615930318284939994040095999242,10969415364246753478074755753965479915045305330246521543663858633748866143603,1272956806332000540144317124032834499397723122931270496707464205344164793800,20231387145101186513751955054188659753720260135170026275339142463242692015712,13619345053559735757194629501334040876412094886252831860426351060385674007066,15232357465863047438256672278087920688704670526832495687820763524016520668185,398623536003273726220923501915643032345957170167431833298597360746684401150,7028250324917735970960317543369047790628992348836498053408852879988541935724,9906086796055827169135574765108677877733074061825927799032011921038506005373,12788056119136131846722253277450922603309904756259034915496788214657808474919,7651468821535297879836173382809170069017662802420683445433781610638854359553,783979512383179545035255083828374733462990002107251717097983319441159249905,8836457559777657917879541925866800908082149812458375523311279635635800064090,20144830911959238621340309337187081519944136818938895654338696747143855879203,6287181334311526693967500402732058645490470512478517679915786729496945390849,6578356433253304325301622313818326592018737710185433748824597250242226401957,7102838428799453179757741468552077315750505008228901893660362447987283707998,497820320926977947430162841325159818293818758853362781494155076005984229339,18160985608878840530944322708383120179552980243808985184923313895763861919637,13151612592624659285402557051397602661028781656351284997191435582230535568502,15780018535650817819214066689149640940245062275718550628416824107970066217991,20500218068755784102392504532520873969817687889455201735073738515957629646567,20888440956803193084788282136946318522770638138510716565517310266646640263708,15971618258529607882347998799169510722902529521092131094419433339204085498306,5293253007777884257810026986010586149314566166761521493811000336947093325852,11581497334099661755434309930999056492294889088823870215073663090290932016658,741799820113052677363038461398206547514107871854645629573511776865766479899,10132388802463968927185535273034278687094388163001210029432141519239006715163,9843127774781963908073388692741045845788815542021009420639678295559452765837,3807159091255176851037359514650776155078897682364934585802230436085278410633,6904224411392552889784909729922790171388456358295280077234569059475136886573,13434461271014860123956911179522881298853645897065359788401689426904150525428,12249944872255100022137726834287337969948262832177273992983186014370317983705,1080721436007830510323005297307130991703868335217850548555329006531295547187,20651452101643029862567543402727347872461377965899451538964773059299839803923,8902465483627533643127758766065785114055357770410218037441501029224645377694,17049203022284218301986830675304595858941437294636126244507847280421482250090,20389632733862984292955678575857173748595770609738193230360968914580393387194,2628553647311400613862969480533814764766703257834731382409245421165389763845,7113709286888238485244587172405174762331565517345483851543315956528264191390,21099219272139712501072896978936944264265953306877942445724732180674664269749,6196322429352603190460567397253889100476004214002852031233332452859780069595,8042719870001485176157425681827371545772290235839006373715151688719449512739,9109639854367609940132679558323551490721386060080938849664245212200893608513,20820097690315610819796383305043844702226083970185755192990081897048903995104,12474580713368057036057537615251118300654026141156267907684197425413737128906,4935701571378317615941939703137616736056472417588666676180454398865436202845,11284674041151323919882446027842742890041719161934493530658741778909469887490,10784274648620717180750449830334448050402020683452763192417352842268830091773,7221763500960709043106304906102942899855402476011030187016839441411503790134,21488573117797078819915291564603086854092528370673732237937703606783710747214,10368071846917543663295415889847910771342838450725996382692227125006143332582,7189971404170280285101021558651838178138415948558212834138150417852815291774,3622212247952623996680563730554546964978269732772060499110124228651174919309,4030261128316895271453652515658449745835613736325708089700420629607904984695,17917906020983172293093657775725231153822157764639429745264576611859524349990,7911943088433991265213669750138013059877768768674246542956611065207230165349,1237568201834766592374215633649772138875843120827112365624718270590862573855,3421335729151995408099494011827853754192179969298834320585486465552812589072,3983646153441614758977318714985842223356917025653336289250912061318144657309,11832501153279122995870584183546009144756312133876131903016034834496067810803,9642188977879773189558548598547584337663289943484049782260608599281971392829,17650631071515565052542834438104124084088724345481542312112093611903334892790,11727835841766435406263157822186528758001431234638936084294421464770985535272,4170985922866379778894675975982515174956777531610306941710536931798155932713,1904373901352853963433078121273558128713374926256562753718137883724136086536,20310106358538316988108567646970248789216107374650929380709349367764652307148,10755444294914746017826019531774644079659674520334374055753829758342372728308,21544150011748410796331015950886967191957797301800349750025078804307553228922,4791178272915634809747385261951447492552726497734131770971381971399880792451,21569911489317541997628510847711750299218484102264583013015022430206018097370,469129421958624587885163292532024178451414238938436764179429972880411747423,17178941568791193515971789991206572943108926053917999875254005411851993177716,10061493654971891913017572469769124056153763544567322059270144080123216592759,20809728888234709563099636671010468945654173909532666727272823672496239666493,13977154471274089663104412732631175732414148541501676926172952880637640768097,17159586220373273602393948660742324700378108883620196368910126875831365156676,4073500643742253412297370658761396932893392648826435730598979045413705716932,11493572320701213886088466735117685416116051720844612287863434228749232164029,20892362924238047571943713393658663337479326222564740924788211586758905169271,11301788649359616808987952401363629750830090004562424782094282760076674679757,5346827191385082048034578496490044229132766705726383391388695220005635473547,2201675309086116923924279562154152714268152257293936509978158351509848697027,17917826577478806664624583743441880347892085028222113450954395295616044284297,16998236939959525187887324821682683276592762127156629849525502305788028877451,4214391906402965555572230230924694640705243512659675242003943183722900957472,2247036556360539125313249919915213027481437766291950011195105972974928736865,9520057428546863347057860284023378728609842187323632161028631359500291204227,1828736612590741052604266070553266072363175828159047049110641125134408628099,18248580838532636162005188449054546706775958322552749296747411333541139803294,4834174634635006984667037697276171446677972706028785635301769650621697899268,489734793278913821067993383657373029590536750171301785048262915525334613888,20786356799510136039282916235428434827695977220581899018592633397684279594261,13145806261364716646031477788186247592609087183869974953048604633861380872823,3841420600164259772367211721293848988818647274121301867288590071853319905062,6882597113948243507685423253840830929482565588666222909972451758645869849656,18980943240416553858613600850285792319483905785062366023956546569017873987439,29028675420319059649770139934414847448931804950673695214332234580922091102,21775882073646833834016763184296217506960385126491507726769771477412306185790,21300410381086030882514625793664995316371660662503398686828472860934288345599,2472267536757789817746114566761390885333410401690592727164834695142144448445,9723880451630142367622302246353057781908243406397604481250639516011253801606,15313110769360181254868962440810453125247644871877064008660684649744823174300,20564192458187565149788272882595180521577855436987831222746293278781628416968,14590472970343049442795311527863765295112518097070620865372037933484660359574,17062841617700893799013325463153088719125540677385032193714935878731444635251,20200256413643364477818739581045874029732018697196252518589192345293202187361,4016942840923529049014357120480338974430876995693135820048221911362323816443,6537662900592412058939229458410964809681215707806173558553209350444735100542,18297886978176179234700005359672839811634650525194200352748308964228483504767,19662609243585750899960608765774063353658909677643282385185291970742157305960,10221731387204953046960523786878755517637874808703460048675288088446619398011,6359039963669314770815970957437041104980907769543152198211817790059980604175,12215821248736109157702052060566873526833550744650237478543432061962195037956,5935095671961849761918916493742868190941272209470285856382557274883130995501,4892952774759542491697203073862387895082272084344610213076129801679488176656,21229502683877666320987735203037721130704543292725579308736529207275811435612,17138707315635877064706472595294259087755028865414511496916808945331553578413,3064016632497858706665392042657089766401657752838410773325693629079632182414,10697546089228176531454125219656376659283555269092429548580998097316823780605,6383154332658396326745467904696030415502846256075951666613157084114882351628,15399057406934719483674477103950525850935787593222687850952111073065008222381,14222385230562109850723354194041721683341002968759594278414075630295191868997,4196055868873306164684774878036056827685013979028843775890547079994909550345,16495894724764636941708778916623546529990869478284583127943604032121307478877,16662872698072302151631604897467020278898785941962087730337008570271651661242,11474333637424192324648146148268767361869344542358721131204304533867910403346,12663733223747936066515430496850730759882234287115648507227477484368789774494,3278587449214209390499027872507714198695688159471276082957385919697290643338,19852281910336140665278848076045642033038867843956224684297984081107396007913,18119827693896204780441288678080897397841525584683046254519435612134656396725,3004914531848687259880590983112983929408762744461212501319599913078181196369,2744805266681634195002030539778050424843533661368265264531107280758966836574,12003425394929552979405575446174684244823087440054609540505332749485291543559,20899617298205776433505248799032591564097087832964850292073852661486959326400,18977355049070793830198782732221581680757588074059967640900502934882545605494,7774492678097446887356009465076901979542998304721485056654902284935411555748,6257979871454846095389581530427518297635929206624687597975380788548536091169,4200362970271656646831473686822497724241729322168501270846014047124987169639,9626555465339955137152373316361342798468143010897667050837558740100066479490,20599104767749131194316802432182162807569082153791773541255180345102031538229,263120164166236772856966508954885356163375871249262527569221312470198863328,14408635566922092915650756800314844499933046455992065014832556500390343919586,5183079049039149593555827045385122348972389627856098826226304101776790536649,9079663711634286747144802677527389482368428094888913737002695282424348199029,1730279784246934965982679327290069428428752739692892522465325889599043152257,19417355737429211343570897838176489391485942830255040228180844510907794134979,4688867852231614618639054238240140493597889866886829462162366294959927124611,9750344066229503722317800976404611879233170071789439067052923419204148303262,3998708829439769920633774213209304480109842139515896658207686741134489049438,21119879197425450902002580651023270363969638681856902851675391960298938692105,21081985423839377197813891376664505429739140831959287968556239547809632016084,2194830658993798006279037291585161216930179214066933009151541946587699367176,10072059773309529038163761158232080490764157196414798621723969165341603556957,12893922413945288356816723514764026149994443040839144958812668568890693761688,6289043885924508250801248626630354568142964747989700154772682955247795752635,7117847768519054206399668810694592559179837439189798231517777441723405148708,12250493458894268361669347775761796626700321541112455611623342396141245275173,7536889841233679602786965527644616779647633163370923759512908958092882343888,13743804807205248364239225685151790362682679734025326476864976250180416573459,15326756679387284645144696476114707028416084124671428061976908306742987298792,14138908940825881278249529554167499601250081601885817719517135886992016259170,18191604052705446018115707722428677617894390137039905732841218263472908863798,5747208788515494994202809520653945260017053266507158973974399964661798663161,16272405226087543462175411026937377018988783482980328154498443115982159189635,14959941590764331840350995267307957753388831891977493365286637018137237442649,17614662493206460042788564726025968337855721129414467376860164849857118120897,20540842142176422103053529661013282478418611089363263097515168740633056607687,3290501693077219671357645003459548779173001871326499393140572778475444534834,6447714071113870576284977914086213514251182728059734289291667058468678194763,10016099876948482641338204267737928588893338645093292975971465694121948536197,14390773887169232315205787249570222449199544947506512428178148864937891297988,14620241431433245619096116183667070956408821753296293274413828291589840475809,8494548643236049061832844399476487754775580533076308093638832054930352314493,13769276515160804060029880354652109198182914994347382081537158871751993099394,12260040442111865637116150785319893997124694704607680451569915655443058209529,18536763786390498498949547812325024712812297365266616445712766917775521176399,17646030323097974380890038898728697538005884509434748880882937861292172824089,20995211004588227271383296369921345208592928705280945008379701434887289620654,14012493030585128283500948776342859322003214361666347021120271800114480256613,13455652757462524273399933538052579123871086976307529744949349716824204294368,13176577891048443118691856747592745460758840755040242121263455031909886205386,10958007047406016650282891454669527247751542376915102729040783130554758505696,2403556896710211170900277969533691258363807287618829314859189083914528732150,21557822641920534343252006226462178185422073111762808253392360322675121740589,21301363144372514699996437466711759383396133417588035206347144265914876911832,21504297452761836117267872934293380498824936327520529664563583098264179167892,19008511347839951812168011659083529710470044770506456216838511009924048532294,20729557973386382250734811255901369475271445538588448251951105355722497057092,1596029835560146984478838415844959546370291207350745477127036146832708172428,18779043981021734310054761701946195503647990042042517453246401248591799960006,18389072889502391007861938373344479996746585336278814994866091596798460590651,11450018471721248431523978933304902015421867719856001119788032399031643640503,4695792303828705800181239521907223047109864872167868532243675764473118182293,7504424077032992561542388084424474665707766373549642837850671808747703476058,16201871852003230376980125294909568327837373609180822015372468013683148626476,9820880186139182810240320436271674897142093850866141441610372427566550592116,4474392152763162487463052318741100507628836016813487468299920576199966718180,6535313881166679884076402867701793095581869448631792643683900609540448349145,10375499075088306448884735241746141379659872937880333028048697275256343984198,3166175670215426596895103003450519990743126408554698027893417949729089445829,11825805020940873618060190367149910908253947573120883350031415196553790678909,15868728010683147011542066925511350470588043768845023267900379312401595633901,439641324715765398013368707995400811722128832670521930633684822154134655293,21389215620992100898484688007707226862245610434491939970737280409708735004882,13567457078921654178980424734811793190031829390199528822285370655562819201102,2491418221701715606532424215068729097730197896717397364135214058133617329024,2700199371443700220147927924846092239465972046042951758397024540313204379477,11101155530024798073181197117436499601132355735889219480985438157046671552075,7696323106369972761130328211405739772776004396041557644397285018363028133006,11874928928175576980576459276992229552831994515252269310033260164062026645644,240537705962136501448280118114493602675578232672944677099273394877211057455,2336277667844723086566433195865965121270861932965343039992167442067222380338,7139477698789264606031986148297940201890262913499702250627665080791275501502,5394022087396393768813205254315732819042275688988698297882925332496064046016,19793961339963600744392705441271116638543292070344579052218623579091649097618,15692138411890707768379631022903362931511371639119812810678572491600193150934,17870790093336984580535630746458834581867280473989239593391879854453602020534,8527221939827993709561548898140031570873635681631994323216682386420609693119,20583146985132338324328431878826670751588212915037908674977314222878838415115,18286401926708183610455794878977380145855167386311409319243563628128439897199,14883280595953108786791995875596640384464375470758397510182264364463199426941,15622372954112461900770387091989505548249197707826335911691325586886540655839,15015231518950399896087228957162542423583966819051318376374846686122344072726,4110275540712809298667287978052760900153083659165519222137609468305797552622,12194886690835058962976784720918154631659193272765999855977381550575603733993,15244557029932516875079143618219344257744782264536288508363832394149847400408,10234512862511661102613686672198745648772485307900923622631623670310818907316,11002446381083289255418443918954072583200871532274996806630154250111947858951,8253167315431388215871891033564848144784018068378784924459677347009078928353,12052362697319720881876615803891693831545089601220691511658506577522506606138,4222271910532283822428121153000170791277438320812055898378713943538215316712,5653799018158152396708984453701593562269544320974176828284977837083044089432,7882074107401771620456811688079120160013843021919844939348749959599330360070,16985024708206545567858733579435707605892308141313442111649869690900835499686,15657638292217617224447239244820122003415140104485558954475025681733455080516,5031435167133277726502623124488830505559857356049078624241295172338778604459,18251569826624635398451261785711619709466995337593606694180128347754947431611,13347210735949290753346060121453479592654490759925951960015474767685667320469,15097256163521186466089214691748103981791931847659339134237546471578704117651,18618539001972002803104792202843684224999903989910895364254642809781793542910,3535158924054577294148391849345768098132565619653646126038220164469413178376,5247111262643738028940705230194040190316748748116050300897903801701767549935,21069968641157288335927634486731267978865294883466175079455493856177243522705,15182016439888624540835624880056168611406902880254574867923247894452951108191,2598270152918575231168351721309733272482825217008498067779287914396446525010,5113774671804063464274403166444533180735260894306271253672198506848528131887,10007988864825946871589264454040608387449058007032979960058775715911078006740,6905160188004006948460048193173293195325586959399957154757620552653693466890,11995759573081381716106152146833656576924747390008060686555489446745383610128,3012863557306381401755965576258357584550751416148424411503270543269480674925,2913988303571063477501511529375194010078206270482236339308347176586704669764,5006524049092266462685266534385319119401827059140718482624293936686566174021,17563183357860154367150870160675168713982368687948283812578969167511639823963,17837755859790999437375156561325979429838685660428780384415700354505074279205,16080522246080742261793784524730583623229678427635608200910206239897175583035,2848708361765680705684254800195178864363439998055587286174501633177530616249,1557519954300916467422364113319270366979873515036760226798787393508368098341,11733665678441137100700293713589760125678167060800184611962879142675741739407,16521409005131685666434785453319000098069672876632224692360259274386316622759,18967967647390654785643258265157841586213408055603172849772769208320302959605,17571504476351312669488808692966809815779784230239825235217863108338926113527,1033277958139146991725614151292577955914352533347610456481561709576150765927,14781931979382308373625511201561097203707487976646566051328122813686985362864,4650875909473177450881505980066567106490273485086660264292847695230525365004,2914409799137239617504079923731151032417003482030433682771204258557926592318,1569377349856381614777306232175508373904011237210172681516586308749045834576,6819560317780627274403497421141083285449699366697573487561555149873327611188,16783037329427380826125478934695948949747971672927005004484739677562779828896,7015004192682971326660995855922915203604605225985220083215349611396572003775,4630816304408133216263172876471813378546980993666459834637527842126471866675,1048974869579541183196305195192354335945589066090693848404581740062134729282,18688715639285068183434963296396143793423259729912639999344372787920282768249,10934347243740746938446533383348729597078488045109074394137337392516949956248,6293725896350451546716316494602770048720703017891567394397586512386125658192,9703640866977553131835948007053717693480506246962404280815291341798629276781,7906707563931146558411066527524578790489630019846849753651156405406896838827,9702629288736663637774512920196886201521548938988112829178357919548773380071,11496918342981223624025423866080407628491859149911166113194854209867880853781,5310797284993667039758118840812749372556974855379167283523727209282978379416,4023078794142040206433592504682005395486039156676105856122688431286266944198,16871217006715623479558921653467262427043486550696934636603562460293483965032,11838323559167998464544738415089027103939009770214130070107400686110312526340,4980088349530490327691411848559646523716982917225546360214229685978505879808,9559603819596004088164413773616676054644268005451072511817132718244048934414,16706530320004737946238925506482163802145108867695620161891008305110107710231,17097818114876900788313405299390647115420321455669519337216918484593668351660,5849414403812965413267782406018277549067364089813096482998057955032613458546,15554882868930267918822925407791760045541474181510040631764755534058258253399,21580870201101672999738147681605702976639626554191473007622680366607482413326,6529597247071863795966038055163209598757897174702699285551712764342047434265,1034354038040835970585668649926410980243448725331655567931872752141342573332,6310767810288764607994771877877727315289627303796831154815613377794983946591,996939452759173758835198197713244238928300388619776170462989538225909183250,17830180799634516986244195887614846195714707335284590299432596686170229130983,19874559606908304758854510017033500134646556009065042866233430268619254302205,14009373839533951923879302153319163529100920268844053529575065501607218593395,14946211767155341356149843492542554767905660369447051530372801216288515919491,20201956319173972615406549564337979402376802300388863728690331165140287483581,10535506466358617363674252301599248223977286129433846317382254624662176433824,11029001794792043521930346330104687908171223556219538577009137251048931299365,8200934006947443074514571335915268415570710146769685554653690866413931711817,3756001813899409241012385101881052052933218317388650253688371184478299762463,18636887900618256435910622299263466888026971253061227337296887637280237818897,12062360063539460494176603336727957703003697981349882838776879968409682697224,11001722900962847730169711618381123657713397243841075174948041047383605406084,1100165499084337642558411348439001505815886538759724357694738775770474410180,17434145857282894864497601363005649089714522250566258141982190265575138829458,7528570688175530782083445771420581373161584322581902670613058236780353068011,19971690728399713343613282829324748110469462189895719072018362834001408037396,2720175852023799717892872520519566779572526301065275372226989199715421627391,14943825869290446747104357486851686014418770156528443888330443464181536442315,463946552619089332690398123288326517388219753658554785664250177816814153004,17828919314250532241077886046465359044175524922026640483099339343132288207680,17254663393643639301497528160788050107293708210389962463123967310041334977099,10548323428945380231342461328951126333180031707800802905121494905097297919778,15741600332199859123106892774234668638862408966232099592590755994226268019056,1447099980864195663747093395834509033779875532198378629216846242387465017398,5634271615965881595424665300014723762842669209816714518648909648355913896267,8004046094319510531556517659927356739393971820240935140962728964910152787977,20150098853172404856553856601505464455083744410516166414862502865711843962616,6051577504932496971373107947431966202921763803799244564057047344716078611429,11153752935200730615392163240542716924397740666674490478903681768299619893440,574571428841330767683871500343913695389489991910772848795148223306401258112,6644002840867033629815195671865575216742798076650013015371202918478434067981,10643887442409207306340562760946079189746204276290341516975302787467861819914,3310054989122793204488875713765468888781168322357480727671652094037000591815,14260109332138908810733885305730437910719800845345795697882239548319688811219,5210296637174697538908079595920299077484266890923778247313974722933789990659,12099525392201549319291916254076192583959301537918452056524775934199172994864,7553233508370030852973625898622143795815488816458055012305692281375143855601,338064484385145371035100049761904487152067475286477053744625247222287881704,21656711030424471443690125986754350631269722127039355499852011488517394872248,21372195548620232488593781254533859082570347959319967220919951808088029020212,6382011083971938503792804272844009960813722135917547320595901431805157825428,10487620314920598491955634712479265679552728563160570833716083687459951803271,12540875281457292616015016392478978686561298989814479837942710114246256185916,18617705893970874028060182711496372099359212095272496239846702650061090540602,18861927157583050522649066858336628481061253205783797036256319572504841854227,697040343546965749510304464460790931385381610135802696124987191773265224046,19957864832901242629222592391639674066674531543245225621817890196632976954948,18958366438463449522535881612753516577920408884030961917206372848340856779454,19038355323356709854907634385093529445778219247035572752290295596750121939785,1288546653652611126768551729241141142059005744057588910355805731786584613343,4046804685697550720337256987447438366138088525717758741922811410001913306096,1660762585827970516291367008365082875857712512262252287267067642443918638514,12490758580574114271593656499165833022285695011717771020275535753216014465968,16141486882419673588223773309048616384177430148674560859754337286781225436609,17480842754700647574286106752058337138867662945102069039800534716529718409113,15604353321749597155917847886619012355001132908396771273202434684314342259150,5617279871415371338336939332259796482400498338204339205308393954394249833452,15174696383871305992552314836076160250704499338484600692522408887766438439385,7427777880578061171924488290292477545896473049748950597878341286830693333925,14092813309756880555589883560674882809640120093304366339387019683168400944554,14371461943490927493590660203698012938705485668960202862586478499151043526062,15747628341829994869775701388730275581025993393892718204096081193836534027616,13069485962326240936812384345060376352182714448869348207061583108709995536141,12897613411832214271030930629934621444235734267985429117525716946550585934838,21009316561423875807053156778128985534726230082102006144117574738389765473006,1961079851137768143186691785724923358396590015729408078834852546188718166268,7449716401041984694438903080808992521397429308993548549788139074686598693961,541840132011603695915673487977337384196812668637554519620724199330714724824,8732237210312418481429872365007927003824155222103189850471564031658954501153,6523310024353124781137808005011914742907908537623530782692226224442022388987,21509127266455930277492767884139578463956043561699345583365079657386805307554,13989299184155011575724091657019750720502004610297338129834280607581254559697,13646882669283186383881254452527864262332184212165662411849024353857046450116,14437939637607347068422046603975325432039018873549816106341419990853530813605,12400256882351762977557053352624357859435580188305833994340851255855777961583,5318260629482404358266028277859623051836786599425915900288734688050650647740,1629695214770269012001751163254712973932233705878496747522731454404864982213,13712071936286520679632088394106925703538964875601961825262229735589116706613,16370398845138146853603171685418735096308178156853614168785529502102183447562,531316798023999736377588166858362632977098508125317800095882267717108741597,9318921203266238488822738977554047526587525733728386955697050423076330149397,270377449844572577022377874031006263208440602734811115345017690504339807539,9815014161182964374794581271513785279039355629218722105019385525592211310401,9645578731676628215511306357368922184828636697072609821617709363109131724528,8278125422456187544426337239756968442258418675393889722193805619331692372756,3793686014229600852890515574697744650225321239380634655110095131274614241795,11274706713173058310395599257524413726315092599580477329306442323879171602089,15700516289342200878818538157175110895267852686641088808116754074662814875793,14231470645515485158149500150154330504733538042275634884479799789708016096981,17009943350256143028237187628790018788978713833977098031809639804676372324573,11807744076512700514106955514318371416449053759940168158181473579522112561617,8941191247819458429052997300931331828693768320666304381154122720332624423159,20810756908118815132070882638097329621005628857845667418135716334205275433963,17633865705062992379853990460318358612898966723353031319355975229233791359833,20574714650596437874739546946725432737055645662464099228865520688481435554952,20753133214966494228304506683244546691191781338293295716113306511488052350935,20891917718961601440155839168193313007436009622881050810291426124657399756167,15254490709565398763344025189458873521593894682543200304507470388535826802423,1579686464441495454543935122179009252394402667945704420064352314351485765393,2776164910982632895181744444931014666522951510059312025217047160140701867676,18493452977704296940835401396385377366306134685072368153755232646737492155884,7466441893052199319529201615576158956429673118460829755667264030485444838721,4862779186474359727417788114204862127925883646628388801420770199523844825968,4332442906725686065471004321063349183397729160637280571390764069298441846158,6235595676847271156438843637266606946005787585155569320931268977334224113102,3283545972614629083851761609721595874215964445590540647737064482671122002155,20190238096841101806664255153033971438119127586536510897732203034569691981419,16218082928311959370464862694396129351602418127064911331498297863184968070057,18169106670538118432467974548733501686430842104311041161699612921427327878488,13082519725061669934177494520541983774227971959053999627907293338903728791646,17917738025521205167709067376626145668664963656058875474248539992479417821761,10201169720940960483107286532267011054369536208475708600788396458879352247717,10086018032281190838410153727159750412677882106214361975307419597102233105666,12682273581371325166244148831560984283003922721179649899812794401686084266959,21151848537444166847396763358911125604594195283585946282585966889014856464069,5870563280212708258714113395803290954804582727013499575940699343839714979459,15818574025355019546843656101475484151535156797083091329572001913076927497145,9172129818981348435701876676880219576808443896350696165457788920197063328446,10390962755465039363458687913467754632739357930439039623432597903165701965254,6161501669511652251380864592245214064026880951608726788784852344316145896868,5405539522259494292389572744962975583699928794990075330665720986459457361914,15953141686281883540154911071743713625324924225902448030996737734044456286469,21879157639189744211597108651045875700807085936267782759316146460177277605878,11434924404918060113007413962226874803102772070441693086168193464929290844877,20757082623598026102923542323531106955538082419998942072958829717667465557131,8919981096169474486495376362947226335482024821650926316923260800584787410595,4288509578096166644556335935101899777779885105511348520519380469688243082096,16046529059566280251436022453196743987059059184968007751447655603059461800273,11219038614950179129482943179862383597500934389713177845014944329948593838918,10043039951240572103842000677370211126438633625308559058041812947576435228523,13424594313385554045395046911081130962489696002268038176721598695954847052511,1211793291463193275930858215285948372240170625699602215748915241438580144093,13956919764638999174327326329058963982898576605238294264300483944344569472991,21763763972390992315030985535287866258485311664824948828240050483482084352503,10420983865433228040050251893025618324702726171912049836799135351770260802977,18753701818722627673883564699398410722354636353042388382508975546895568464372,3775364142286651074799331885877684616693199427012762917550076623916732710822,8292671711306889259828642403052383798091670542487370026886155070540857817510,12071789317828192902441324443833143078458416120447222512665882093850970086582,18221914904286916930821501101975619932383182494940702022220624561466550429056,1015894946220130503079847588005345557311861372219799708101258594371020452677,7497079366974677538814211796849030622236102734688468791057012961185250977217,10412524008150259624425778663311437889796006875864864836590446801100002463061,242804608586097049060214639927231617495599500538071474816862835383660136678,9327321863177171873474299501143270493456472132426279976071195256972553555122,20841963613720468677785103552893139903309688713322442693081971171914472255790,13630784939841089364059908940844732601072559390491244936534430865345773326547,20060990491599613171081634276027504616735657335613608029945430961773413795782,20369723769740268530808565104818084023349274297831884550854878783888535628782,15076862507709493588855118027827375721947856558107489434980647124128748591027,12996451838772518667606758612923003843581729895975567888341928977998771990237,4052235171895745508958823720790274122684550078188920081778152850440806616718,12335377703331511956642047444506386381049513479297082723690490432465187475758,19412573446052112260556809146936739541890274154067075795508039506436684757726,17815752693042999749244044082547565016456928313463444720511782669652296613554,15784264337580227630693723391508440881780776717973842946134335715743491257089,10667492170364941836778050228790234453197448653226319355770388144152747476935,211997855288770996034164566467801948520054169907247985981041869092209280055,4928982790134068590739975426823777812194464923471161503361037698280174981760,18608672135933853582317718913701178979379432491853388463545185599228146691207,2315480928424106999355320576364787114368100799067708928765166041722251581141,7132821772386644248930179957111951717051009389997169728630437453984113307524,11744909558588287567829975231377896922260739746243206347301263424478589809196,21821616737585515642213483301817094657757210129023396850436714925413476278715,11972412756334108055648790188313869962577071423570734765254546184728606861831,9898102092275580917130558353359107455579856499298488646821411779664420246304,9958879822047499292094876401302022972082946727826778952858218178060652972948,19871205375909775929744751330720905649873502681808501037344623586575605895174,16601345490108570384179778033128731955939874176242885190845545230306090545377,3600818319871189164836691793538369796689767756596935154198009735998848369707,20314694248383769870802453966233555256007670655653781360971318867730452026627,13418958906290175260633447769067612135267907574578622587604011162488451092514,14459952906281539694149485094281623760953141057796841403669604773900469687889,19448408956408494949564099234438127422205398424291589853947309097810118078185,7825443276535418239837092010081563810404777554695462770138005656816269166303,8463248112790565810949249352339633764856217758597371912588298951088604363676,9397106702637851943166369067733828452382029530464971824017078972309585633364,15452595095505449307828854722016355425252678164966267614739918073395150429984,10382687268437366227597120935808669117993505555024110738918156422833458968254,8525129123003317464420034009755418250374332671627293582800681623438541074422,2209915653341740331756848895690532824379055156318218590971248250386542567791,15183382625497370680223757887016738067273663916736248647060220264288252640054,5914882314939376011130904692287520473675802288813732481565058295269249787489,10737923811176739642308957871008944847331638141618843900584295941869359201136,1019349115878726003171044582547108836234898959299710235354611802499665438533,17364570285151724843778637821645803441762402239038594475632207111794332738860,1251558044831543718478805412133062543617572066062707552512150093969983011815,7568361578986094203490921683991770751640726490619033852251843934473195496119,15439738350303496845805351814211602783597897988159829928947802101119983398961,20009975853963282344191402380547695759759731502702993682892413834957351648692,2363424283223098643833999734510060612126929924822351279904900380971757668501,17136028473467909987260660923882066072229277631411461261810169503965426571985,21423452231832054119549543703585288464249234898851841557254723364015587266501,6300803647873111234660196693510491620063330061194984556803532776163457642510,2749674757601823156522337416483425720076662114029481936093706226193678544468,16123152544885237760040277581510833657110306240025009956733742940484347179299,1449335556475943566914615807167633374850907490355989852917815325720800540092,18225835808858885369557291110939124591374272404427656191824524491194015802997,10406157408365973197865488683230737937923502029339842530701446718978570586144,17998633938868470446795829948946241208954439598754402047898587965138352946507,17256506181869579387781206921456178119308959078547323103229058358574594315926,13094455817799190250176997937777121524540082751332502303810836528817463694222,773415265947842731444676861730775210907581945844672294668103420848288364110,19038336321288882240456993528476377501756672900320404015643432684581055112943,14760627809381104024315295117982862934682028410719221222838112174132134785643,2299176916578536045959722453832883315456156391111537255429863337814706171473,3669114713225196659381574151653298340387887549947282054635076450967251116153,18251972251689708305163349578105700140002711019536040700377516042131395885101,2208114007582253724814286240939815507122998650551224166265438176279104064289,5311319465851004438404228350963430011209528099234009157573275300632566893387,17704997085718018561575909495530243398580104458533121202802306468962737491818,1933762715500501610210207583856164878867609341004969983518458273086102828809,6386814998566871009542498039659511536698234159072885405476628256992102020495,18831772844239784973934592955595859276748324649808851586824036127112826604451,13462121128312374635146040270944207295588795209645130037644415451121036635451,19731805313375129918425060059406339849106971447864245585064948352741000760923,21643500371506858849424889544041572150599889621082729284012490052076449459481,138548710091390954908010216339657754049773930079521223071410504190290814535,6947102089761831011730597399319184690211329034898095828464106850135090631740,12831053427863630744244436108113801672008361468343188269856032816742671083134,4223577351003454708551493531516184634014386163092922955496011474432781253241,2714897164693927923639587351413494956248140707486375397510165870974510685388,20023038420823827383850598062203899779139064378489163672445486337197649825217,1767883277856872395041944981599210930967554162796692711247113543638244036456,11374943081906439317741616342767018365183355349301791743927619930324701508426,11803403776542021481872407152864894420411711895295228328072919482156044458427,10466014303238336135169608931533160584648879880459007777160264124745826740750,20569672017414729176046551969057922112780177375685900568749563089152585958033,17872595105302125548629012813042403567513885359499964690907253660570968601519,10903006438854654900289559455490687959429486945748385817337220540948365309048,18275515870643256842855966776500808668842291767076613550498342673701067299432,630933085628668840611776843471079145620019967645658920379584401715066362709,6825394902701793105668667323441283311921241346208501522910007054667207868452,6858750193485140252798450603380083764362623733369268015553477107387074944232,1478873465931112194691102753288035258894560238829532399713218315372158028033,20647986868364738274961741160207964168903320676158610371768611791255451415798,4340383424522509172928608655219336498337132315044301147894720301443278858359,15694054630954602584443160345828698433451692126398102396637062194669728150097,16587614091042345417694939817299154667821001841573634480871399767976428325370,6780948432583055051074963887359666213579607675322530873343441117551279310337,881888803549941181636901791599886290841557130000792317917044641982716656024,8375540908772391314073560695793592104950470672337969483097880419747173630602,10968989437172024632405943909737990264150382688586767944077705368389009715036,18851349698000339475263334762001556036662188445499369323276947028195614775701,17424154833179596191247217224032955577230090491464139783174467885567507995873,3084264395291045886600299855227253813661906050535885634611163481700929635296,9780424450121954867052166726264263906169948113675811543750657338499901472300,14927658638057710246989480138441311677749528914441518171301964877558977872737,9409069466927713011440733713350127030613235827582038407437204556786573082426,21532551006723685558182869738272976023905972040234419867623013049768952103538,5167833995989484123952079378988963389989994865716472465476503880641449880786,14740174761652743774118447006447618386992142680472177663315668117221175944698,10520805511348878943408706501985230943081177040800761729569633389778724896451,8700454790689589285537042584692084777365997167238651880195034227220137266589,2733945906594382609383183532639154621092632308934603150907320167864486314840,10291836929398020145429078280830166142519086643388813863997726059451399134380,1964652348248051415524467307507959105507630568171154193714989224874728277054,2594310934406347332341406086415178782930670052092905736460388995932291385927,14842121917468246033091527680370186171895171052114757236254597861059412933851,10375528532253513340592396399825408524430850232835146379883683152448199357827,12477762696438196028925893395417443678494787519078936487705085579706421333630,18021944163681185812898833787149788656465569272261580921039580457574363675422,14971348947199715425743490776577354350250241776207063239247262831298628671824,18527079575564336560853661036281436413609153640671180843997315618816477020062,10112969341623453459297605360048147871962444397321717541108011492952113746933,9306811905619197449152929816385830205919355838468334319731910917748600490999,3201856562784023690028197460260731000729676130502544364740684445045551547485,17677019524999624366971265277439539545709248668323859450511125252478150097491,13203760042423946863820551582066224159089369605713946028771025792976332967017,8225744798383097681411492868795146058284602972120901801159373206820642535790,1133207841388716114249120311196903646181388009397557241156806164775023041371,15623890151225925383841140893652872349082273871391477651993101123938000801867,21454879142557364834852736051259149378158105754952971451715419987896242909650,8531552648559366596105198828222595210930697829968414405502802286874489507133,9401758966490949657386555283103887925392012048184105735334446423864991206786,14182985100305261645378993603110572106752819147111838091043200594637885017186,3351125971378624693919014331249933776013465831551789721255791740304274394936,19684429419661111328145464896944065690801463972795522382446603218587092452167,10925858543362322055288327267322188904474484027644138316216578205314218206492,638388255012974167128675944413974318871770367985490338348509002020449680093,14959175299535994556786536841655834078592404933909341983568127492171858384391,4565657688930940961208733539150773567906556683309024875952853834684480507269,18262745015163208046754959923695809473174547423960055443621926543956602209348,20270410959376379064306739018970053272238947330997122046760265674383899359657,15290563044070434983378131412705775525253143318870138946525234035666015420725,584590168302279667271049654248756511695470228213252786062709717390671267095,4966088591187905712289854426727671159168968384675952400787560742388879645568,3319669368740731092651343449167365623382886973437878280133897523197651190312,9912174158284239213664392208740702249961859675813287499135373479592639861287,8516379350240514281945243250529128948244709428452350892659587420308554264613,2460558416671744640916958595519740745483455366236568201673238589517657340142,15249503582713331075672114681569135202331428122201669911203912573537116149514,5355701614078955989983290080356684040651137096346994307217952640790301753843,7986859541259474766804707773691600248831464381736783455743764933501866864285,20896597282789039779549640920767060676459830701472255011776479759676387046352,21156365340242937197411344791352838273101399835862399143303393482855843470763,8810320994466343375413166155559061722877903255339567630911647558329186883195,13305939854322882862383989397499916187143744662574072474260034250574401506438,14276510595076120373993498057833260625756300056428067994615344507361982835166,20071507901284477038407301846126798169150113895071357904039436046848822333309,8183811379732619835362931863732297053435925338898156873268534636771405892075,13219046823251102005239988390708288792968718105445890139009709283489860275155,9185773756453985715582986632685488321665392756676197265712130071752773976631,20421943269702844355893550089604182682047061852707721138511917444304707579860,12300280142885224975710767798713824153348765684179955650717019029210821361254,12007970010282235734724332615090869243055192449773846575955902036212263482679,6158352771477574748962005695592225162907260568470401385862937675095774244006,9907046449530603675289866399335586386847026415848055552734816021036571412645,20848733914096475328182569300389604774285326414256566622667108340302595094373,8365137332145458646854804122757179721555979085847877907343540983873210953635,5631007860876051233682685206319236038053360910127434722172168921859697775602,7724822014604490732390628840430579796440157358556500058829335597037618014759,369071834493409594945180455653375424679250473615867182702388739879310444614,16769246200562822457100153851476834038704115916651426939703296994708244449575,5761928395342052380070450997738075595651684639539927184355295101970822313162,5566206280191314323446398313438814776510866532854163164867370641136219947308,3342359366346342054674985507754083252076489241172458810297886110396010701777,20961070283557581225918432539907379409525514793918155863543775859703676727621,20556180232726542574747935614764094533414324377887922356987347326584809231233,15941149549798383978046697670090370142285790712496734802869937995562571324293,14600396724469636128403441949598983100001916970624980610808650856082650218424,8853454033412621833577484167285435511890615294361962242058729914818351640066,7796912448927288083851300561583091259511345752250157116939318925851741489961,3163019852372632897541834965385695185434873283151315355155397996458747882742,14952700133737822394693717249052150819987738575989807253015506109171868391432,18525964798774229541041472797217632579102334608286281048443267822115517194616,7102118124262431444884005767970969670970778150875473949502505015348122457394,14204638357887780388176917062053732214797428898508168337150295424689096270757,3277315675050465719399614805088484534242274431436504827247668714966713345731,8238377613232984055051747513217839877952472190522754887201501162730400770486,10224258402104106587652987351104010753816241645110952300303846844538654914570,15487805061491340966964538995368847025698196465175525562567846982560655044359,19219815971577427671261496058630992677146093954055100897228392314454716131964,20451783587558695494081025729566916635107391693056303514267562508131052495026,10604908883794901754591456082090038158328418399338332217230293938008589705164,12629655676673767414687101606277783347408094199429831144029123923860076780652,13709603387456116061265164612378749494975357559995793114409724336723134851988,12280342248736515373215500158719410978133041790040105888782814256839967443115,7016009627584978047738165231314996484413117067952510110423917440240605830479,1524894728322552104763656617099911162075578893415210522528939966083567287381,16110348090073067974052480411460325713852194746966461188536450049907379558864,15849314408692105099989833438461121938666945258532089314493985018340786241149,14526266680576776847324515988959661063035583100946967808594725417429124130409,12662059588246809623132277946460950856148161126345911747740066547195150214304,21784234245035153912497219470830935288918016717870099869682681847939205742526,9781991278293660355311618579950123622358901576863101735826839255817708999571,9734447579561113294373127302234593360683756540510409616709038385517649565283,15783703381085552443769424496547949342637297192593569766965137630433735196499,16818302710679242439066482280541233367708597536159643998239357880909455304,17208557330797764065799659085570688998141169399652780006230425322841317471944,68706297573456724111634550544331343558310761429949721000334906561427561646,5166796490382346553866700788131214421083284131608596259217301814881739273429,20336383765590527388425300334919391504612546166109544795528892908246473855987,3743358254907302851720282727384172290999978135762491123193685721554867920482,84015356866358900057683156333277329434974724445531256660202285630028495424,13076432415761967873214874574212608989827734997835707946240987502102677974919,674004304490160746369333425685153534516797008922146231179438460150958899661,18008401489523347421324064960257465802035658427821867761642737239891301877084,9230814159278735889507853746171683425354655931537527400639327580576056029011,2338224170787780983513724541155899891770286010849997183556172649088034621522,13774730216408957127941425099141817093498762972537953648152397183615811260761,2008226192472961561861571910859568903805945585734651871281309234451941696550,18191659524918356873059208424871952262892246019889299985115112751645849510652,9977051090514243658919274826700877766433577306278237326432737577914469740819,1382241145032463690710185532538145321402596788581319285825708537098818318411,19630880072807438067933226715597469053645950344003618599545076855182567392314,13804532717560570932337083609013921209558901545207945868049344755900793666387,19508550180350246129831873366824988420065599516069494466305637280501827380920,2848475116255698304240592397534148356674367429794174368229897070816851620326,12588734179864636951823212209185103123565413699799377322920024420368718083095,2232868200526350302935711180734463487873472319399673090914563494365441045552,21377055866142483679502571618984666212079397034684178104676086894866487789275,4635961124592421709613730717934803195170398911827834468836156717082833802089,4795610144270291375198683497266358163517248476702360287932565598454128564576,19878139464835077446055142241229890663517120197298970825225586650258704320634,9323502139000335770056400844753650839571196769328639117682123746249546059680,21112416038547244178847876677595343035216538411439215223028113590182490455841,12697374728966756322005607409702182672422756890620656219302331428706184232671,9995295835719608174333254715476035051015528223152237761898234348962139965339,19838681448410021391386343877373049070883481927354420971134124213644615857262,13348946731323604604321164467837298053616765723820806627202376009331748334141,14459243825598700354634855807582241585214330632597159841271530816381999251613,16398077966528830249699687699527475156225434078425955606570595942126461545256,7643106356234289086355359290357087474077139338168525601611444369470624871398,20959675452873599571224578970521717955557909237727928302612036851445583012450,4540025033646420810215611052662284909609074316113304153198697292213556037365,12027414908456226247222654846878068961735365399441671468269489072556154853636,1619579475293093356383780863588610629947769633032102520272612883476001600909,8181934427490631780501305508522146234029250148182651874753791841738732508561,15274797459753339681175428319112732573480605162611546476487133996977708752899,5881626303176748491435260832560365957494745248996859086310569735454431253109,3420994635070209394832291125346590627475632172750870826118213841463585026009,3253514739572615120245273590897551489662089732892213994698961442123844511104,20203053841592538933587679570153207252397020205630948336602455897993666135475,11921266577552501086897102705390311185747062744461377484820893183533643304437,13241907169609567850145071795854997578682645559619300976538988140768348089882,6151712987809690919701305472528460675037031217153195032569932714294427052374,12205705969228027397734509241211850240154931572324813086389133244191540704608,12945812038464520921512101569088203002779738300982254987224395885526111963420,11566504805689497712142963920462066842262053081516919575350242192944407040992,15723543550582708278977667347083710027075971342576647975064035406870923269719,7860258127934035634020846943939055662221372673596335233171159964609391837625,15528468237941422862373023290041270186925402725739650209357342065347651170444,11352800656251355849609307793804420136337526597168059373534052608892527331301,17897134085314321992998873273654112498897006369781950634488633467466113054350,17437455229098036757167276638155356442563492876806914963325540308515770959304,14997752382200324825750631040991638912810425809039371028733815341246302297900,14919207184372260640968465889336548904504385718633186760383678178843526009885,11844428225775333775773424762116332026943738109456526441415077427972318646084,15239467296659614730514306837963031027890655569818408146133916080687077630265,20117441496592956911595459290983302272515832294843762087476380541606326158806,11211331365407064571488620323378276965399956667340240900293979889578003659573,8791311092499361250396136430755948222248236194668427353488891370543849807047,1774021261549926243219732938834617869058292002083739109596586460663663531688,2787995130097988538722853640105055460288688373288517482894772682647739193296,14036419256752421574134832204020173449399727322774622383219518631065684283606,2503905040784637175494196915035325275253506707537902487189138102884611289404,21664450508754049721193573452150382260579289185348178882539067755355712577906,18957082022313129842427206117755534129197834418112547991189485282634468396440,16781909482475992329419834248503013105141202009836651280677498803323770600224,6643893904478082560922317503708920766922698054352006836803634579280954593309,20411224098851507032152776776680744497103387047587118749494718067214956146818,6932200046628136855984161612336282559188694975968887215970260451999517971798,13683745075914427134220228573435856137115339570721809234203113630305711234299,12049119081343437729871267418004147930387014906392381996118616615174663353079,2441975952742754201500338273078694079713769380080349023008653075072257968553,1011172201777323348203437837012280331103466286486119939185319004696667574496,4513858889726009970880526008944305706495472698013415303299122950266699858614,1829602352761774082971266699128478520319034089172917557099196106572588528973,20888913280392789424820640494940209099778028785108373950708163556643786717499,11546628016884748339883959858649314450404290142635813671623548341391668641333,21503514976315590685255962605196280426006590386762670744592186136529638021924], + [19647061463337916460942375553072101475191437675089764130648797272059706835097,2987900412319695329324667493933426290750629320482434345012869808788189293747,14313117549814523542459271158255968194819696107203500245376504355915249564569,635066671179149779961724809079155342626591882143599249747638714005480456001,14160366375280976850992425663667859199067402849136919009370279834492741756927,6973916440684075662378599037972982797550158082488606172483341283171694141353,407790128607292443078618781455551950270304278197678311107891073846005921099,1875793830194257638983834574124736838833728874912304344706772047211830871895,101555677977911034029979807139724697918613026657646487138174278033141465909,13298961474358064737775518932222238976786587146906206646633234612439936576772,6675018665213382228528485041578965344759847379196981998842754547093440230230,5085649234634970209690321129917296688853246686378177913913323311616242468355,10058141944442728296289308385948277117189357184119821310668675797744136293133,20711981720256091912789603700019290285604375596717389895155646132584571552203,20115432152302860531854002084546199214679745925822431241410388037137709465378,19426738311039094155622173280735935805207149231732138766959497422037163547769,7740589787985988848427674257205602851899971532434369842038308874897481875095,11072265639503386933704945672016505140436978537584329931993329650203494086219,6167282302581750408390138662907316184354012779517813053982109604767767995057,14593714320140781629003483490890381863557111469157054599498274206519671343499,17959188687624917851017921366866983692604241271917787434145985166811823698158,10852786592684215415216400376119268936907433212885674472022333115957039052793,15899441678259173360040901233792251513972059637300348276334545233380063193689,3640175378514868793712597306483649195648235320181954901691448087453970656158,19498930515578230344335483600141550927765501643188753803487668144320311818295,4153883544158745158953668931089517690854504894896391299015592025101035411270,19024468701496237603291237797335586206588375930028220273546773163298357041151,7469727364011292433851252680653746774195189525727608179319902706399363717756,2372143841469285674441303263292066347817168610069150223765733476276718069613,2516526351266496289030890575774410993157441063594813081137075222758309555822,20958751338961200084885567700868871946051162714262967700193597995642229058459,9198209373895042225521605474867845062450002141670817279014351290187429107128,543785608759854122795367682791595958842618445464321379849398930724000250504,10214529630060513503750965897811894289300014475522844219670830726679857175601,11576753654045835303746511804171201194442330501175712221979130082457712862265,6214928611453392028562534794962748192402530967301618657847917468183855957477,6248903930557664471829331572570457764958370320737816568669654972084840708363,3521559114442643806761280511561190556015853803605505266866910604261521098953,14207749404758918058098136067805881181486166837455095244160881284733449919110,9959485107346230833915817969343930335833003289106263613217998567268111531500,17002458248120505483758089120825692383088865286608827557586088545674133219848,9310286746554253001882911152696415122865977191166769045081952245779941262056,833245639626789987010046903814146615257437312131003591772116076699143834195,8257332153195419962290907487481324519003765405123021230564312430389478396079,15127724347963527967475442670935452967842333763417615675896327776913208692165,15791631600664089304301903868070551535052107017766205491164731100213785544191,3248589614829341629004884091016822219853816257771914825780122055933452087513,17215199223989028745431952733663229031216291778213241728328297124270973463797,3857684745108028860654397149812523817069881299315264066597992653650257401551,4707785116452305555993924679316564589154347100943642537399862884483438576343,19430682328356065477111453488344441289467658065205729792227680437122893422861,8005988640968242998051528980068908390083328633663970547195021707967989536508,1972474227742829959658839187518313253567182690341134307491795498427960575880,6504813065413498635983080741406156525863657160083764580567056987831449046042,5823311218891803691266204716746992257279538141703406410574718561307174926795,9892303067707797586148875186586047934481214044907972144908705198351662761557,20467423831764780786043971286447965746242601887189594828393353559483921550575,5337137105639218811346004301122986797373254603744281473362301032791465429184,2653918865001450389595199059314513619487087198676481143857196098234024054997,20026090683375374670866007502511215153733777854247692013299401340222837331064,16088029123818655662676092939046004587731443682967462740467056646463545748825,9880178757459464201483861677712096813007025248923714154921858424834034903165,1227858189983101698453184059397045112686910656353893224019532173573557918655,6965709790321124552058584230424761849742693958580766537537673695015364525547,5275724511243540616354496187333612866929959836267482390875038898914899476257,697708336385781014957549769788950342363636191998726381071876409126144042559,7274584324261857876506709208086520820725839679509101845928052585127373751594,1101072498472320542658663987709974387416478403320298285132888772486638626384,17063249509595154712877503960715103016753273139274556931196815282616091591377,20468232842910222775240425801279694589286852891430236774476461428028768660386,10839957331597622631657614186340514237771754591887181416690281526344756522470,1833441125433983427564061829081424752522350755265858559398836992598910515884,18955730579934733484387457001397648556717991843841809299503396866826874046919,8193171082824386660318148864436464606096456472585333569988889002087311061541,6800731829409783994258949782115883803874917294598056504156236185152975271613,4551221506539437319374784319536342657448457365716669137274070321896962382201,3888700085587860510427705376785182344099574784427861867496328978292244934753,8086322087822351497126170321910559010882234382816099821864406027930561491554,13275797274085199955841117698566970822958536692349164078040808025934114965830,11798506987450083560046523556681776539473600393190500985018551824337777992733,2379081429050928317988088394722736405728459402480510127050576787799908525809,2158947553437093664557813698796314628878318098916390925037304154608297340081,11904049624504424229914369023060185670359894203980447724969113153014864088654,21129595246904679929428089867320350013514202309069019924095527072919847726344,10893562472341509760161513998095439702562664638408764329166649578524495942254,14633782125268548143403043594739012390811363821154748677494041549086652426818,18155420130909256009162482779733306385315875131491307204196352931575522168643,12073522950076264054413053294532869251854443128423131910399999522064467473027,1433592116103756425832298952472313408701354429203600638317025112329710147915,2210939565463298865317782595691956567659826882335372151952428383797077275627,17035360868359161456401993589512915729326589319922635525934508061308509305732,21403800287219776827894322644981677663016408317172756418765747341745060868637,13463317002652268594305080031749651114168039804631789430404782211764311412845,19738499492349409431828527491123847227085394983018723982858408988105307624104,2012548380220619299131832783872761872147153098580334235039922730491934764706,3325274441705326523449614352431988173829782789776117744919906973769657338996,5261611144921901341966147913919865209616390993972727644394713260572315512744,18987697050242894331980397947115962487019662790026980590641254086717180862945,8658141027857622941054124779019043605220504649377920644749538450450805414621,11298428708044619749095290390778425959792777464903586113463716315584533582828,6730200291399992595132121834599191803078178940321882359439272645986988925939,16058286461189478903573915480209402516073069688039571574175048313793344696582,9740895146643188739739241045620497326490653096157416163918867637699590812365,17328668678982472669285290349933801381460489699965770954259262923597437466085,21089229510079204828717685354260991995629733636903215847138008238449607565274,20640971546156771190021485453412235742638585574517108137718546522103899393969,14758279983387100491873648446401986574422791750180622274744397880182747812100,1331898546985028774480334813742156878861378216830516346949642945416964272379,6432287430987511826080726363315893796139259314225964668680871966245781390173,16771287021606049252082476128446106722127174299597407353702759915141825150750,8558856604643032676967156921137773032066151674912302830855999926475047747086,3441849687388033123111488396776112259878496892302987380166582753348946609870,20817116194964519717309108464421257788806753886196720998666047916921548668924,19363239836951813038374327912605477961457473367759250309818663552575087804364,8719722538679135055399244869855972116946451760806505569767286592823561841553,18664054074328463099250618543796241821469021451703648566147509976488389212302,14668897608285076749626150823646322752663015099871458303607991619920343960884,8824985320268620533295858061606775496359110158594681923758227994736311199135,10765520116421824752776648993191019870707037690612646148788741126433863060128,20754227554163810768271776561488490692278680037121708279136293739447289576147,8507072847563043340105426835824153184629689984787563844408253684598778757305,6766982373679017786884251724806484438649942596522690604198707242527640673411,3038766798814116247860373387571799940341461487105503437312437210868806237693,16132175023628563044043762398003871532172614031006064729051923614189729264142,15583173149116838843387513514855791665649616393679968646432984027900294981739,19200443718712964237956082975258333421930476944060656325774330146577168149713,14490821043935432280588585568226041328772039440696419883978899443298638245193,1261830229525183456874822855513761625054204680497477037321364189175040481068,6528746667003363057717101918351735481714469206031070610241614606650021871543,16147698956945808666133328464174436996026072559773234518262594815923002983587,9020387669972688980419006674825908656426016085797207362353154226605692909040,6727316761823910734900206867002954254557029243225097482815337322560175181198,10066421681146255853671223544720366622786875122426340101570461526567311479729,18114193263469715956238812322551819970497722041025850638963351240642707536449,13327552382593937204593701292574430198134175441510741573417228229955049364251,2372604211171385703747757710474646305749482500024237878826421281702483230858,13257727745849193909326785093877285673934675536283265665870765530981203548766,6028193081122651452411463574343231811776375151328081689399842891316362242212,8508301356193721985012355411615100178521599009635936162890863637274261948848,19464559199695905284994131173285166577427724356611906328878634139911049316349,11574946347736941315258330071986157639717219704847732435648573723449097294965,14316018291870434740761571976364226850140038868497601980741769481529398163257,10918196690875147279977362872452345319770767457845834002916792583407449275430,8977373069224380198540140180493576791843577554452269707469880849832228035023,748498829648879147053737200607377785638767247375633990031472844537260809404,7873158704115081877804196477528352958470140833786962209738121862287852609943,8630532424574483719830065132415752445222218233997041715460638881404278125797,8690582614704926771670051368117061261335922283383440650770249469863376973533,11095347717221488007795836937657301037546485308926406743891578760518489637433,14135401679286508502504277387212121656373093920904597158275723422439876100612,14738090907871182095556666808390406734966899260337679732930591106508814238308,69949271807030541733792162811562320986072778465870031251424993196153906266,1261108319753649612663311207745706802298135850234573661502446278242936235395,16817683438765699400477322528948826720336276287491287100775393652707943792575,18841362612982270174762542916999427955157117780377439797570032391179795654286,21870116979686159000730008975387147484906370787640570497473602061164852395071,2765949947644452455039725847864010340741814376903283748968022076584286340602,17243705140322781483942034937718263695017457618400778609034996357553437986248,13677914966377093417490296499705767815775553283213762175449591670735007344873,13297897273167025228957171745153893110275891317806768533464851402665750442708,13343269561671098171091946421541340634645677702710756455899883309946421878045,14317554923995329326292532110843156058636017277221221405605647959782965284991,2449835610256525707119222686954432076774548565002604197859382557987062142872,17311927259294224200654531686487034697399582221230204382526629700762752029323,15886029754147081563564215095016637219622964863827251334461319377673888336370,12975391569205596000382467418571211360327385366404855968892273321920864753986,5192224731376769981697271181929966876988577937843948018413420047649317448463,10676192139479409715075805869252336543157972214291179434959380291895052573000,11177450837775344504988539319102121281143354970746599512770721409890402968920,4593200667847399069176143966880767249193687931869738276411303724780636851859,11038090380551563944847929106606106685586830480239388947878234434263502089528,3953526418885419728011595573117200571065709475826662733812952860173033412620,11423581837569206292763368836201420979900393158634684009052097987935130296343,20821758092880168608657749212670937227806187953778513378055795779476865339010,18497750301637542715216545677959957759969933594321504330433834545748130561538,12908315310864070359072899712184126229744818024807969170422172983759986468742,18124554128224712379655197019948407579501104121202515283344405665022477997811,20982975342803604005070898815103511622812678185245827078739170834137855132820,269825514811016046965635325890713556615518696022373524499024558861784638050,3147172016143608266119085281262979524079358702373693860744797997889998689295,14386832245166477008833710911810567249931220515383598373556096298357174022469,4556487278328022691163443795787718624849832853076824895328263286768388362379,12261472135716169178595791281788338424856082203277018628926152780653238868197,3899423277681311798156637809536718065846612626667684730473026778811334914007,19506309861341587023369919042973949592579256277585657370274971571040135953685,1364959409282923580897524375843789492029158451437094417717346158650761726050,16825446178437335546349323854223244861262257417842514939476542139147191650927,8507209116997169365742612629060440573797814488088100151461758543065101868641,15267004752470933248572062004321128218304784520473623806984809921883550707694,676031704648473427598859615894926588607941948575683685792835248653139785855,5619669402121492986528563034254744932241765329516105050276049374453441613893,14704798323824402102639327448519792804756861685698966598005087155126928897024,16320067378138810368504584396122999292945236808095532790918287639367557973453,8146733655224190459272793912328710535983522769849572460217349885461291275505,1038180418056776651442944028459510265058633383281360520702142043667403503844,19104250152149288692194160087229108962380481983770051876357439473931889382526,7003760916474780870091321276888809099928758016210575511830123521067523691017,10460150809039904156668983747345347198316841366879181914914418086579576664491,15677112907432790716289265075133862681087874169637399306212310599581157175963,15326287388823547786897864243344800490244989953594543352512215080754525987008,3009920542142872962638960374061083879344081833005888204328736035225746795718,1804978488347291728619316877980070589260679228487014904460247370976082660690,1328483773995482788116589592947585572244503408960547493086897090179230375909,5730439196427856076422854580234519707227885379777920110477133774925338997125,12981431367443547352573507131765244291012615436617972351790438163822109185806,4832711978673748239567077367987729540684018769513731999388791063624971084279,19167638139894327951096186708600927728591679782746822664161578344690189946483,9333793061773227893961520586484148770892826436173136355616167263506645189532,21458443518750111068075382716496819469049134888053123021475459386077573760694,10205061553685164402371459751106832224694007401400200656551443744478399832956,9830442925198991171494436686328858756494894392913894165312258843542937207416,13609869649628867442619044498926584416410429910199812031508542862339177409898,842857359216662427573900948838829890161571314532391785590044951074431433210,6704851129269714864143856350805682503777715960622547687053167421313207852468,20114446898395957281817578351485444375476540075666338352767091837280210668931,6130491715603374999851365684496448519606340852139128448851532580625582546602,15813600594451539718733724931622603275717510629305297903420212550967482486778,21327142130781371825633810115678136219928778056926678460292750153897861437357,4961568602907543961625596532526706517274095072299784820035412496941108876522,9960714813540172203971946479714057278358565379915043327324100653488017320531,19766028424299726292403979387148081559608033800073407130824876437622345769610,19128679427621049663909949398415698465159247423858348746959133844645715231748,5570166864868188450021144960131468276106515498742461735810689530781856406802,11574972995586621052272541749980259251569951388173301707052886832340902170154,20877646438494519923058752260065237612204466401313282232221152388173388627982,5249150519585813956946898091205522450918428396100844955321690157312140444303,2017741632554727420098342601911590665808744692822556685407780092354922864904,1195760854074467363227832424961613965990883686618742557387108941759791735821,11466582138640916980683611003811079018804741425452823176665968956853901549307,10985903304141344987201754580174851046824447026961915755527591886735857840658,2130569969210610976943124127703960718576010294778156297713757734434872381369,10738808247531379378397673739325665568136689079862172683794674460448121540040,20614646033198180892625991863201166456931543657809805208583071176938057085966,565997125213498936861304726982380864240733960104507001725677609359585569840,10632097546602816816944445466416073366486654512740953706603375905768461201631,12929362833112356946255271584627031609627907912912902502403907291451582319157,1034235212357952436868793031480652544314617407845212103021627643626485031876,19390762319422155950976700977771604452581304443563816543281343170335005291057,10630153844633439282958810722979033212891017579520387012386923832074337305798,14190876500956732147461925775340768352695586121304109940717530850819588911999,18722506055380266423054060346625995391170752586033471909467419883841861306716,3056819986793075694786756176651004538794778835114033048299678024064951583754,4672570536584218848208255703572454924953635491594309524306431682544106754221,17351556719883029551473146382008643929874047263147825865359162665615894766393,15361589507494181649833267508353254535596250253216356073840778948791727807159,13693471199005207103868448237123737586403755421081623632730820742927025187060,17755277847125531485682000612777686738631414648862078678723432159826928724703,5078737090654746516628738054730387217943533822956354885634428155918832329055,12147601749747781924069337935019031145159705806951967042421913575214356549816,14365231440612787726412058658929032228572314258997026523542183583106877612565,7278303658563994843919131396912585917500535615791945995381401546353032136647,16203755920169126984249498560164803107868240707492521482933949021054510520315,6791925607504018751125155518211487306271141824074365658905258365090537532910,13823494237593720607868138054959291887740146822262268248432322209124930846096,11009501160902109690977091445438703229756969339078969536565574715162502634351,14720462490975063947234490477382491041961626472580003583159938559677559185952] + ) +} +// noir-fmt:ignore +pub fn x5_17_config() -> PoseidonConfig<1292, 289> { + config( + 17, + 8, + 68, + alpha(), + [21579410516734741630578831791708254656585702717204712919233299001262271512412,8554993601136913148229849281645942416873068991157116548355045570766869071269,8349770263904395404819051886764727880530744217762197718931556224723090619132,3123463970516625956994178947134086868722089624251980030957656091366977385793,21442360932957798040744480141231788172382126494033577704060991460078536626315,10231325350034913697901001930461380417506010080725776869094346614943052057882,6920436402694617694727322082450000548200664649231576891284834027764418393590,12792717999817516574604019538349201413861750406724026925198874802923611904714,7319083527910098850218832163004092895955809799710817531274971443221833500573,13757426179233640966146754686419290630140910517321420779897314617147307309749,4049033549996591060740078431987567671358359797940903000648212935570542836589,18201423118137949240970920992151778204900119273029679711616513196892916845798,20625824460928171809204757749985517429359815439093046150315733891121610507133,10457729085307334834523167401466014435492132985358294006123747181337070073721,21561527744019186913993064335391813055903937050713577176254373319368609289121,5599728995155490107164072595052340911357670532131511292391179640158683770855,13966745298956307615009517188536529139238646569224392383446375189982202020807,17756603569040095098346793596909383204174838953876788800894937537311312048006,21742079076354402484587060728532755692106347543073105531119578054037775042874,11100784872920528132266123983509067070706469425630493971770997902694662926998,20400085312205960400585536190272432205634747302273829805331461533195763963464,20028967251238446138082148432746545470729859763361092299497853989733022321309,21646094126368547381762879012999402861347883442032865497835121981839683154574,277256790316883617863153728392861425598900309956876809085316502674092638050,829273940377701999291777589563653090200708284690056650568100074655963961702,4606908934947031763433560217361121304957410936748694859993455652227072492205,10769441872728289230396615620861141176949118733537017427393172917499470840245,19521824504454300285368889620047541794275889938757845035419559810899465345698,17161053048471962353174720811774420740284389196847515292313979813334039268748,7908822737820790247231631548479205241063360318010733129560952138908448461427,4877162162397125215823403409232508291458423909077159953565289381413423118030,8487393998302601588798118543133789294087935184558260165377494640490662085979,7454433584826937164880257351721993831542783218228578962943846432869272993591,12600486335574416961082984651671003440366178113351945406282261259087640562075,229943091042136639964977508364517877844589816262259724739584329059854831474,5964363464498190105797451630207382654570897906930358361814931706994649645813,15027885081212300130366181566116370954163923966760653842199145107431036749190,6389712846176883524184535452348872799769012323597964483555439005016828865357,13050625522428562689464418495099691361897297012535198348448952952830181214686,1457960163867278804802442802649716001232992897386781587117754753421449788143,19121642548533119996481133068671203033851078573250942970641264441950592334007,3319626593342830359906793887689227542493167081286725783452961782138075389498,10182025658554317340763807114890885589336807302908478511429803960136159439487,5258867553475471512860996445670851629850555214065072419972647507253648925387,17105844700483111456515253413030059462544811526461544189616915804056937372339,15389507448590279891790879860335127747331525679865083633840630125275096453854,8628144040598587326275852302297295030455205882673458629883629373821226515849,7225764039772127797033872800338173049227188735693607855118081892986058306767,20070937673840272071045130712690506696769042932336737261842298381743641619092,12139783026483217581244209544149124607538399031092603229603855979370010147969,17581810038009568123079980574064070648109195109589787948955203592875730952957,12141791671600953962785570868053442402210784762014326945761482080946083167280,10216251141439191088257104654134450392253712707713481968388586155680061818083,1414175852848441331935246181908753253333655328715371554777242869802352097003,12411223399258687363418284739063179467323133097416451119653175668156302546282,14163252864986479721057694562184281568622251449154036885135516034438034547025,18935280158362457804125825095786762216868621594409914695877661895590787449138,19612073572528301850608997760721508284827614275438129248352825723957284031526,19819295714156197944855748114967530774512172286810045467127912108030396642179,11371593776080642722788656520803479745110058361122399788254568568846349693622,4027805955664709942434150181718117928301673452282014923837288829996079949500,12539691854417510068939338882045915380674719248923282579976372900935687263702,21456335515466708235982252733061551106892811579323562996977622319059624115114,1466175641997386496752167837552521008018514071345728218669064866303097231258,16954396739281784813954958963214415095472216566673098897333193147120371509076,12708223137926559496125521072416503266378368566414170219615449248989766379947,8788739220646322755486256871812144068464402944468818647293944655221095435821,13058732292597055849703973806172477675203122319912563406670103404654094386664,8931344638882118593791237662384261193166536469680242356398517062367452395384,15456845400516927354313637168726345061971892967841823745636300923188629474327,5751588038559337581650296498368532807067353107651773867820816744681643949204,11549544825319477431118343561134281237789591414423676704396089395115754641434,19234147263577254818888926168924920479297919454657521855750553715796101778809,3648349134208466654728357812767145066715472797730454946149007751312314206222,7718151953117918461425809889893754434608769559584222279828239292761893621712,8845522739821256867897474373924647700071798803600128774472020272335057310062,12793577303328701474174653130332291657457728764837263636620978444987214166803,12567791764609503071525053111715537148465248715927771041171097136254310005533,14173284996087186652368776168561110401474338255050963923163796413857580470909,18034666979500281081740131331708674377786999775618310647791265825609322054725,21422354834639531449049641141105504766268284938752536446702823580190877745329,10861911722118463296713372205424749768917665229584553370962914232866310912045,1426840929949909140164228257293070123281693940796332643637029311310121856472,14301944441994042783232016477141675248310618781100688243801831318561916576546,8689261616262362847656173161257424730101884874532916838450695695508844076137,15123977840288488307479771803223205244132730982232338102604391529168092315901,14782587644869453236501780556963556761570896168324364501980524203741590116061,20171126664277707857959263654502050384578410237255325322075457593732181023858,5586442008782671473934242848395070351077466917106669778054075503048330770950,14893034316669944289540729978541666240683450933307479859464390524607307041597,16358386602267214062406516556279496593235072850353941542010428321612942609886,18848866854232312978702044457572917667782740587353338084332267136131275700603,1579215194993191651478809349088803658155969078580739214414910140585581589538,17033458213089087701892498495271710586197475793707993846597834001983636294290,12940326624292849673877504632305122955030021835426715254781235159065401203407,2093340797218797584680567638361507396244460243439847174481303012347581894177,5964973748129501579884254138099588668727348462189690734364404017042795728252,1674681106235348685135834192630054282175690835155947917214719741317698144031,6021317549494232079997036595203156655990507346855425821696978600367848015237,6518804338080390019586997346732962982860290823548982950371646893604360711024,15170463834922876947772409926040699970156014460508617331830728121385518919006,15398930479669448663557196733417026149527004779216987588229439497346738958046,2669700622596766237628533802450875322874330587389952384417956610466102910333,3127548363874797616403801375102757494200866522631068411037184158214286131549,6584403272373574724590091428656742867168271029343425772452216864199113551892,18683280795877134163038651063011198948877602385157504892093537654399764426518,12422086496748175124620724672115957665892586761203533990582978803368996339430,9745099390463439278844126903162955736019504616033755299630228960871294951628,6064302059807957253392579676216068692721552882853761726090911957467256977688,860534097291826421956520903118828583111860517568849548148819591113129410233,9809207437695386100460912579554305365027175459186390700555141956544839955242,6576375143489291749779792018893403099848704832143183847385791291045583986902,2551573667498115865454648920084921687986702958687913960418526064766186248697,13043550024569409591105305093191112805611412364703194793685224224072149855745,5369051621601119248797945023525768932797813569336410551989722329535217332717,10399989003670197520503648853627144005300436598931266893609225004624861627954,6159561484143246751423457452493034991227592994791307133044136210702400602726,19651431183851896182934111830326153107040303776630454129626690653306388341484,14970612719926241839940820046954288242553272322468930717244806728631485407526,20461999502486452961875044483247881758853878278954851693532423676388213697528,5016750536904085805050275769221233811927007383797241751325050175740220466319,17316427284462136919522043989265881044949832745678035885743571937214912552561,14932533665158850512241105212984927846164589888111067103835286341225240509742,16012484446855626574765806641361955141820105388650596409595164514899481874274,4863651915422513654068087402811690721104417928537042800794511645180712743925,9478941069339421252769300213729433894403874553023597073962166402867140590783,17529734771936454727002429801459948360484278991049231778922771896004721758963,12672015814840095133854330679674924244657276110030612294537194913437310163995,13442667219867515606432268873704321985951188504382080502019480975401891351960,9346556839116407181813364316149756946394621057020562307256030525707411763792,11720199480542613604905913885140886560194773593236018605042270421391171700142,17713550818981273796962302212731756472046580671829192490772244177376146261137,10658520565101402948486320613747540160084586467440232263820881394770094857487,19120553688581692745126354026518291549778059267410591682456431863134002720631,5837704130879353469974552270945063041776968090189866547252204737075618880582,10952573317837731274507039100853076769322123807364252392559268333440123751056,16175443191562457274813386127054957574917457114692631929042817125665307085782,15651399869272720599280980856510555798668301135962902383119739133368631494409,17982602271750585864051043003255537160144994845232276906099438195600610259340,15564417296959768207318803300620712620729991326343744282367518107640962243181,20488793123009381941807231432363887878967153580282107905075818200161452173728,20845615892337349138315927113904389806784179140299978993512007141180651572609,13259443846669565093311907999318849863250202720247601058242623542433998488480,19583450200980335366984605451914375573108173291577305129314361755545713207859,838397221216450052117952481963960818729311704107008458344946293696441980221,5011508169974056046810100610889953041631883487165044189687841384459345302746,11361142794005243853743618662384069287777450724025651283005645149554307240000,633456298666951303063125949977139107258301407861096110769739192555903857431,21529743295731761646584336858048296237991767869832124757149704140550994020630,658601336565148638150196750528474813469384561163113116358457661687263150766,7199686023207207605469992040453620774208316115852720699379826196410259893822,6694724393708237460096397340665472114749949954099504252044742926933353832323,16157341357004248687598290467887486980266976396840580002635620741183071441576,18735931046113570691341052792512856145472697573166865032702507242384749856515,6329726929169898271848965669873324332951781357803010027329026944351232247476,7061209522680426874403579559245042585450674594552752972115778072823155787614,8946282535333125111854282749852344921885511854306802144459174056051518348720,3988279129283542026399878866455129212655792613180690875708855315104446444211,19788373916759119069273555853960393438264058803290744373422102428664987314058,14781179276955000841116554151929609467906998220188278865550170013658249984549,14439714507608577761834821622197467839862763277392515730094487176490304118865,7462417821368326183154895363497223167855553631230374112323789393782682375855,14594890619141141626245598750050255728680683081531253962411791337998057959565,10297822643679438597162031819677962851770740929826506853838015287832878785074,4231562753232550403815225933022904310027433526532932589628179163940950572874,10646529230382575523755302352793337142051175018996981972379640368359926883275,12164083461947216214412634084378451605511487715584004827824972078192861740778,14686738730377226817976749475359230017849316512373192440082122302915229733394,1972065207953025646946682878392649299678417507238551179215236414492110157365,2596220810659736571653162812588827790612138851645327014072494893329877375848,19742890478753895876191378843357325113803569368242719397467948082842949716134,3057722811279760312017893583084211485332195649925192440822130571411021625062,5078380046721228959752000757775271056076152925648793679038634805597314364689,13994065550182407605627049394529818937411332791332501915425485445970019749196,8718903390300613451595895490522223543548941022555756021584328963874682051659,2830037047734434537263368457077478915382396457133799070168011318577509852518,6351328336589112831842317252922662854527642572646149728733839010100363641064,2326811025141337415486606567159001979990362270551911801543813258783748664928,20631048108966815289784074608382072458460940973738551134226168800345554951214,14721204648069833595280990040775556291988674304257774357769088964732410863991,4551815408348203166379129282299441425423743023821112768447969406023780214645,16626589364834731158131207695359287961392723773324953999720551575045565560017,2119119902895954746578148914775899257881351646176141505001582342610666449702,21198001320003994532825962721847645202213745138854311312804244693213734456020,16575653563112300802890760228610449333758690368857078853765813869752023855520,19662199829424784148957376290310955285339135428848477356788149061587904074636,14365866723679934269369638167309959664282416562097092385771370076826961535871,10462405794880410718710911820471224752218613463413073336296570316774568383223,2875852545895825315521599376020869827316570932962420930916494831426174036683,9365014190378730240070787324401488407601702337948470069729769089736757502613,10207664772554042762314615033378156185686480986853035052764356129216234339601,14593204638464636358074700677706356615788934459664487787695216859702024204802,16870253735699395936222032450057462746120274245691549241725232755997497777650,10403141045354931831897350467824057442824486714796947030202528195269765938299,13491630075210993306306680088269974619065901790274179689314972497025507972072,11737690900303251277784941365088697342741256105580987740031964012547987099246,6479411522140791199878732386964631711912096436445632282256505752750116503021,1083921069605939352705123162314489784481429719496507658938926140311574639372,17653617267480348306435879910355154811805166995916787026122631473598046826333,14432164328022071373295386637326904766549408251892516429892690428586807444784,7793671760657336901389781721891199068620856343884708391197481940646184551315,1959765449995198342923438542063212054673245344496347360855620191194506656856,13782621216902843666964879695291399503179812919290969771526164415604545126461,19078359557987218636232226316587656499460623053969287998311225512418446587303,15876205697805498189610174935234268016677320029636416200517433249256912037787,7722805406045443730324325528663888753917114626390901464015754094863680930900,19209717507699122245389693034814796437142853968464799877186934474171699195095,6585127313235216502111419023607202115168882276771320178943546160044534358599,20805733952846662054565520828206551321957145521190409450891077526078523041277,1584895259816785676773529464055176663163421450657396866598813628883854756221,20856003384184708896097189495372900159489733605505425206950257455550934589790,14069406225378546242129093232844103602751521581800986668621079503726397000027,1028001874294327945398022002342466649656159450229921471622913285892988310568,17966371882429795190944428324003030336630819228004846253694564940042988400820,12876427863944186509000750451848678588143362805691657085788824358176114653258,8715273966427022806434959651283926754916348745411538421378504642158804932403,4267431569502908019256597205760133122178817596876838981125845973819244098360,19262568227942313166139131845806786518421402326465887345846202580592913547380,4587852954486808043358798482712674466376898718708260090686361850306798447997,14015025676058610927837367157870446606501041323636097276737547710444897937611,1144137690247115846969300874102656726503285917182531654472086138598330367043,9454537148137071892124156670991734830383436460928166061331273469365959775909,13012777452486288707879402995033258068339583475193898659333632638157561913335,14224623168753818289919819482009713832024545924040193705962378465158371078837,9505762419233185123340587169990814384174703626434894051560218285882560747356,7019256137023476309554512440166531052657689673592456244254319500937647800006,17246363017424260106221670693985197925080671704985089438076796011281669775795,14408593968797438981684807585445491387554770474935530894938751288467685293766,11991202914737654500568163346559814604911312199759237827422720619371707311619,17485055588733729741263685618351826350652951158142561188142663313955733134315,12950471790443580303905847354051728755537901376411054363054627208333559704631,1323445558625272814455691764419102369727943978699511295257501714917998936833,8841255445674311239873770890653537908142822789956793926192649058263474173411,9401395313777449751102417028930156506880556083443899378760756340424905478877,21060472724780336112168263494706975132712741930000971588397970288258676527061,3812019230904757099892361572360806117962259446525402823615305574055615634484,3514498070156020200040973833201476402797883738073136493951314455793989266387,7030071313560321306345374157122385026218445152391153750375781343870025689321,5268144785716401601955218888231720448573921710587461252164696334890979118029,8300685363844078100354914067414753644670881295812529449763437785519065857313,18450162872081547013081002634376155990252513846297828484205311669445865332085,13292716648615315298838871484647252965100904015865352978197979561906010036270,21013686439245380148735850740480550290335132408628769676980938610161935118557,3221231898146718165495762474085749772444251029483710808533124131909521295435,21706362586702075336538820540433124172473413960581336734430968480142138077992,13486895089928308553329688303040674812803987395822848864346610815697956322679,17668589109420826004140047157134934003621500937594400640720194981334871115223,15183620307048155399117286900834263744557758459406645835780045985078670266986,3170561135789021599641212581208901692806457808161683895582450799937372092628,6919102281737620426489877909256066802544737782816026767549277126151765906518,4002850049662127756373199253004358198702226377235167238172929008366286605110,1107642403321371666617924914652619792767807515753221818405051786669061003368,11885648350895482809772026695774528865889321558031441531978106387676087338277,15378937381250173939485112486205353769964903768096281219667852296031194688940,16437477998115322080973717158007622249171727785394053923880768422172683727081,7621121366936849931681051136134866470312478335111295204625916349299382392728,21215912298727134138155623335764864420030241120133029649046764814328222738790,3170821186412794476815678730429053912378444748965057631248759273529827834502,16084650047636623354069916778426687798588694909600147172336375822549887134716,5100048383300431022278915674482647701788618482574130930551328380700470664477,6089313816847452477548960449234592795575689699536263376449482717087314881254,3168424144644268762342999941888553529072271091445061821545187264931478820334,10404448021076504176124328273829362151757942013323044839630548232003974036828,4252171300134965718003785947840070216898476595813167252439064205515819918152,6217524790069168495104329195931800727381161902791016429835385350530530741236,10144395323727769803680924125110392290775229805005263966394467735634758369184,16773588435110330580333921944382990185799235928388619755745278707444537536196,7377711139925591251943689121143870901330717424145420584097007639933333168762,21066973161927891686455166855433069549513160220938455527728499561969343776185,19501795117214672544349409001236794757366887214419994956397195381058548371627,2696597170314397939863800656320896858584168884088153464800095340021127302558,21168940252375267860138608985225319663694276566348965377356649424639627399939,8729578229953090469373121531954476034394661891580932672218135172268595941310,2843049930012752804094477290180353526348132895187059237802643422297864799516,11477013052507658297840246977078282722343354831202397750212752940967096033484,15309765532985207981165438737385487871403890172460978621511228072457639715462,5276795386880565031975868524294990841634011123906486763299115154863864095167,16891192769456289619320007723900774808412675144364121907391915236424354884923,16679134204463371830386366769161735700621394109825781706069839015605424451750,3726779668847121591477372195002524410424328772388206362047548845558525545594,309779746952337123192541883987405477861316061278735939472746602872146210577,6116943109304762420893019486121829026477809860415070409858407396285217706031,15461534026148460547793521829520247652146949380168641953893161519404620248399,17490188391720816485403388897026469756907238275881766262188942134609165349946,695497190921838164093269283587166536603898439348751059907333515445935240850,5740644431998005711645731796487090897088650307567273144862464339327188211037,2924287064221347495709747210800576855931727720487579410745268421394700507499,14573731858717233227103947986267826915706941233771169473071405909223613015343,7774646633424887132991406013236011457803238614262239840323638862678503960297,17118778781828713462818509847054627300883191299007086864997977171169360843500,1050282722198137586289457046966751947431030691327586256768002473254440863847,13445581272162801515105119436838273760359267729139949483205892441735924907588,18349340856764570254875357271690106769333653675997142444108297087440025433976,4652091796588614730462648254434910913694389428280196479944835477366269369125,131910217723821243570751713964244292677069024546597890404591990585681690631,21456499410534986907068306761035738313492308692998775099405282472250364294940,16716064024995806321979269360595144737028204641252901859053814928024784155019,20095956414904309942694457361888203543242910622115746869354406017074786974736,3757071258857910927294547413264306476593820051587638010209583502745249383710,10923680137512329262337058371790257353876483628009769758330988714085083694256,9956537089548622902535815248396999405593511084482117014020012399528161074693,20271486778333058297667394153786073312398256884133810048721290976749349792007,14016317906581503528126751971528140956503207448983448742275011042750601060387,8746591469817011275278863986926266284079779997046001490419468813462270883629,8984522535046539605932734670718817033319009310710809111062522425202730307709,2799492130108020790397631531338556641981343238572990117018166640120082230253,20327087348772938506861277218558621387616751140016505866350214286146319911488,16319897245400426733698423830406514849234661290508433522979200712395774573821,1519870284239742680329151132587900987246869312347047206488363104123425891937,16461017950418215698742181372949724919904570515241953684108936425007551365381,18543391801737989528567594217602323229839954429370908362237267818290566814608,8685602143546136106524472764079001485875727469672211204721272795643296788175,12069346074371335540240816613547917114412632205795651309433084773115960400274,11988670992502988905175891565316960155103243235237609851490650832292602385997,17403966780192169176887636449182981656483203656331951842717004987726351707328,11324032593816374026994927363702518223149146507370165210922763265919399924610,20234844998585751045105028410680389242420574978256032494303069254030260948453,6845765195018211653702320958640753289098798259762906597713727891164248375213,3889696987737574856084707743921432094490126858489993810406205011091688718490,18124922133262643422852054628088483763756251512543531233603218549062255836441,12631624196128994950514018157378748957581711189609992774676240830354853053921,16425963978111788432975031188568839119447517807863396285900192209489855884936,8953995026906183527591662774513923704717356851383827135468523305945599975444,19118152579552440466145418131293777218789512388294771840750929877489494176003,1815764556579131181044414049066036485535218062641438722387702702907845125991,879360492005214940756250098489982523077085264774860932709313739626061471725,6498879898701797309689806511256248775170834501358785166173840360873803298370,6056271365753495672454589488039784798700896703812263056079587620516360143438,4967400286944517048147291964513981345417368809842939145340090658371340301574,4566978800722351857193060210384689061165216230883853755194411631523409885319,1472717723310974984615849145251472221350601734805367368974791217038995119259,13776027174095858271746500087697263062688345981919975914318610607049564847265,8855093701782146194984545464090688949611436896016570549019701846352658653421,18811023873792469394695147052306776708450724591075344787347859872893669250403,7691358114878791244762289651247071530769998349760928484062499608910793916658,7225113154421014531794800873967433806904006446284346811024995482075131277430,4255179040498688460969978231175134372259939403539293652133247789357971307025,20794639690572618510879417372961642037150870482839234645523330418091682849183,8794944058569076073698664070073889624033307879863301731569984292406059326253,2823363224083068189197562122730561866372340074232470613435703914053034396662,2975786158778622849913792385919164957459418638496064741275725856836606581091,16980083616151411398660130004732794369729853408844917920819260677159874549034,10213122016673910048073131434217437693976054853300442236815045010440415530751,15622844733073950747464963822187537454489639825890383970141531456136711221220,18921846985235911245949818418983694297719932450371747402698247786766269226032,3046395690298904837024144793490039860680756832120703445515317729068809524596,2583060914190138727980083409436742233507882746342184052904895573386721270220,15629635543342892581496645526353345602210475132913669274084203765913418607483,12153931408209967834920681475366877980388294821029465748773772434628588757707,7196162362609954988171353261930756212243825869655325258155368337285953898704,10832344161051287447174100117756887153534049211780756324764320129746636797806,6499757948467889740913713634114407800462786362067580649690672122741467699071,7899568931631241171429470880810625833615306002278541085808972359443075433638,12736525266255297750005081634236953960899087644399368181751506194282329326346,3885354407428541945392073706505699854042913519198595640992547091062316682031,3816703467689192492336832188741146914005957253921702912680936907951936401119,20505128951308490293180094071215431973523299690572491020108425696662802268726,12432320732362421179661978984313902638822551634634152631489842715192622778201,5512525665270220248672390077644266875095263411830016769341860810913920051168,10270457412178462574290846807202840698511884913948623978547229481110915603115,17881266377985198177178319262577725460740518218103427901653715311091974197536,8510066829287194091329244743814121446186389458433991751573612039633575413794,9055280011331581456260576278219343217137015829507887846588161405525910242827,8463744395607465452751391868824103994906876103054045629692996934328842962296,13446532739903962714217041803396024505862416007402976354796893648172348836934,20461627446006946445871657481203161690018232261049944659088120713658680145761,13772437540389795965930455187657216773904696937414401755764626097076342530873,1466290965505206997895149562488255231958570328271915401528301574657737237351,458020438009477539046680120243558779131470015073376206673948106465783075724,1421211327829956939723172049232055433330521137466148179271043779757165996383,10974718981737058413203531348845889514701700275404265370241257111393906385203,16573626183656890049533788707333278060585059246627869841186891657544526527154,9919036431890005168544961022934926297421650894480789723772572215746478261369,16576030844958446931425212176715038836356393446209694437953952981269181564296,14994178560671337822305816896620048994236927709898591331458613992689693774863,14008584724223915404998855561309674162219693188120257826434623735246475372519,1069086166685137961564210887004146480746150199033946836704942515923278172866,4441018674700315637078726026786902627166868710369033622977939038672598925463,7640939046542807984747271754089880008702702616120100267707112408768750045699,8165588904763498143729494321532511422369875008004817175656306909794360343847,7474879615118088486232080639206966699381035482748779385536890548622822072536,9155173050525839883630603125759778497949178563635870467694197797566249638786,1792459779962272311746727109790955426562388793812453852666007819191763428793,20263099395174426853367767733535578420938395109027150658334981283108594115829,10303451485708370514931418998595531573075964003678715177508051557531947678705,20321308667229656744129683025590573929765537488045735596831342276888215355579,3624395650764060579161285692706624195562301326135878674105170566731046375182,13334418042222364794805341409419804498243524763983861307681793920401725352392,6303209034428307796195867505386756492498981454350686160404486917810670093803,13336041503866400337979868539402126587964669853045701517757148479437143265311,18767353303859794045974955054051240567712613481262860811042439117400294729243,17648775923900705033106796825075257671428721760143056038927896765118752472038,21205320334769131061393260976939399463360336322318482845795119858952799244444,9155233455417262996613263565710157090618649015115334735214563627053911364986,4147290460198895367036286052342502315935666580918696244195287512520682701639,20798839743961894523110712994056132446749297094165852697406325453288254761759,10967475255107274575063249329253351284200208982490877243231819333935797701403,11107733429142106765947338633972307528508245023783319424287268815241476152303,1684156923230048092780410733570635056170405885844154942542264956876312136441,6785232819930341498287206635949744381666087373588334711760162570781902812411,3481752771358613640419060374040695972756380958880755418404724590727014534662,6255654521236333133437711371709951475374611142503566953029069344699939884443,9785296768537417566104801168235697242332552358062255540417443962942437906303,932526381863697246577606288678833611354323840639105626154693740791708621269,9020085732775576234837702925603013416533345825301814972240093864457581450960,9671990085159642158315772309293609967281764349933520964615615069622307368396,19046031964146698646372035717767563096934497588033260517438574042056341692955,4697021545834663993102099542459528774847962616007459562129439303924850728783,834623291329335140949595387679815012162663877433757180177587164505466461752,20037517567993747767719709123741990248999315495577556924410214834773675677458,17745162106287481150568322325139792027305354960331855484108228857447789511536,15954503136290327680020013900783441236098225469294487261574644367048211928766,9447580075462399824000861225221012934395732074158377365412928734066137521046,17638109886139425399034325504572336884601102137123870982594354109676619973628,4210479489522190727435015049116453108500323090316045735249662201929219316543,774908475070259367041407977077109033779248383557848908386935310773126844186,18071521129238587956292632288468255723364769404447125651660575676226691230621,13782927851189257932376007280798546946814788900735661108027866834341111483921,9061904191092017185731693336948023564331336704118962360596629665269886564501,4646677737877430404232975108246717822854320420060743321121290725024507501530,248089340757097041959106969939801712104654938085655092524027449699183655736,1925061776519306799931873233357921480445138537754738082308417409427350959191,15090381222590604653751344079459745088601676165498775998808367167579158825796,1507946310710275058017347456880204243614713444138569740896198937197257762391,9047126832872244897061755443779135724439127934417426920025891305321906533199,13210467659674398263347498463769321394392811495810195742972914861526145024497,14930790949584540337435206846889685669928690545385782178172828133028677953780,16709614617820458913659268544942181680363927832511699782451755998512279824691,21741729565131743651162167923641181853909251404044798652854243082519505872026,485748276371306614511019734420369335387299906747036897161996666725324275885,113729363155019628451995418785166919308643202089193856958029953269497359518,17315235749721747007692514702872348378105966945192310104719562066051041365785,18164826565342651411070681557540176534582615273713551079309038721773735887418,619154088023795178917549465782795919604596935887112076630902791174323663727,6356343581175745844660675205642675571886993827862033572086056964311839166798,9925861911435596968816749828945917008180837850750226489783169376408872855250,20485137494818996958862809145264015810010636121731140334074571507470008401090,19656735537075233905125360479201796779994483024563540752004528779684256455735,15774243068028338132223253794279808721177740456197787086161475053638867039504,10497591647442850110427658608196767909160517521573199077258279280018098065029,210438711366620938094565498037172584426960275594120406278610962685482768128,14574298645311491089278146576548733364636851707576602363349001846285614576119,12543161131818467611229160618197160281328232851440846538778664249828945509460,5869885827840429160723685065960013290766384774919021040094074809404023704797,14800413279643792835835488664661954863340552091411990276270728475507101877386,8706244411264045072904148746698442560958145712983473320099851020229801141593,13670524729264788581176214636184652482954266319986131183163702474027069017797,6632699635952855355682293206130135801472538218093800086693644923578553649842,14292924690435752338909900819628889644248019746008463256978678218121438364347,17727807116656957204562694366530472131199058877798797418410969267673712196106,11223858699504492688371995874202967948461173433281557745471419331000190821973,15274518373659950909975149452889634174127158243424169830798483206460674313743,7047593141729299688704504157654237466438485917193869775780994636019451364555,3378912259124002728608820025874776626345774864595321854977438303831475863909,8837103908146248796259735965370584845236705198353666155001962958984824353698,11869977356793268256679742068396296621649101901864556682314737356997442919617,16469201342422734819465744813830056682872807194264521097865986969265941221776,12990791567002738838300315843749937126679083554067128201599773654099601117791,20519376488199491586810872596388233936561051835647732260479226405592285629272,13549175857035221960740890286176570298280920124622104651989532035707272553373,15234870385685844193215578943145814211167163612264546132211506983633757513134,18704889004070339618907065844757112006583041625995006884582590095948666509530,2234955996987396568560381823250866120960007674191266942270485492312904973151,5564977611394684319243720881013051542355462582947649518330549023416464959605,1112602741380454855327102347931753030221494100363029829630354546334828994329,9128209482091812367673670394219617423875730198454831896130112252113491505252,4376101007428143823621574836425643116618104664163736787280388345260726375856,17331301745157506574267466700454501468193891305005371065208065202603272248798,21846545094192300969525954249087973697025055955155275797969191218036594965229,4498927631211901890366201669629694821005085404418517058539528045609417501903,21785888954457119007377380145673667061898185873161711282742721281162112687992,10412875728643419025694818649503070798945684772972009054835016566542500457165,10759299704717838172704330861378107927462309935609553476471308013349659622009,20590357061487044454315237834494568787816431390448334652405889873515373283815,15673836157910318771949663697819073723405442238797105611030274826598578081102,21475838557209838850221160141181337897147127057878049055974104365046170025610,12207716311215040854533276425309298962214124105108870363296256769166507046674,11559647355273809434894669847822031984160367996613651160672893927347403624957,591243049503910187533030984285442752553334033673422383798814281778102029479,16149820605774446835537612705920133098873928503868848274855310057025837143826,17994206225397988293963936097869072606400130753097128779836685484696065715846,14255641384045583862403050464134422000560975124837558223693835399889249787677,17504545541397972120376845150557483982076571058727369435414053758625774050033,20262964605263856854671661755299361371513888427580858149435552591882491905348,12438123120680430355474353651690582027160630756728481836282192739044572633306,10986893609190710977332579571229244255566870443973548516403950419251545530801,16087745879258651861681909407049342984746351306967389910641236570806978994348,3161560484131968841565856280480697486595651138902139808256180482675228360792,13935262764632300233548760451251751405084774897832419843437366109926436448024,3163708356211087269300587340868486145250960085863061247671736451529273060199,2135858951319828747123196912541413689531634489616050528404576322173340406195,19499372732572987294622585729244698705235805453794292187854255591946466724248,17894089552733756400990786239277662075181623012822588150546768816557117698135,10627476289794518149581909173158184680927686574280550541626159986648732476852,5936760260909841348473330607703047527686233710292277373302498592584078811475,1671632573007285452120449241726645612097503185776127730816609206067570503177,3240964061357526102193296883771275932317464053465161060634703562592821382373,1379991033533041123683674223861213511881534224092884787544607760074673933288,16612309984678362724113323611405699676953754495433780645121123868554119586714,8990362216544353251183644843626621823440172244041771554179888258848070990408,7792126163077137553546721412284336099138469839853005420022151183726709890605,3411642164274869168109174406711447272755835383047387248320765695217678712087,20744964603175609148844959505361532818311810796853446841217756183414690636777,15406348836110379416850862929702053477202461331674247559909297027963274533036,6655070454278595774182716706613320667767771244472415371150701320921454970910,5387596765852619562692588945067153848362301378074547750716364254552830548618,11374645815567953400996409579523063654937913407852397185357281079289695498202,4637259464430266322534397972465849540585061569384580106712860758129812888983,11664424120893756026105365780051433965998344366144921839621845056675798876861,12683173829762047157652990138425355617601406763777942452461639149511855161467,13231456998217432692837253637279353598668867747754119281167569613817285339906,18515103011277984777089818507163076049947207220694092563937098383351447664230,12292599779221056615130747040145001893088895814628302035476053980079114062115,6616224505832681391261988520162269850555430131210843369761179293711760268991,9345928984249349577886491000914566117062182722884874880308419980252230631490,18529045286534814640266328796625676801335117782021569247528965805503339014374,9213994428894984896264727606602499546795637673535140817494171390234365346197,16046191804660661030536723745809610250792224521907784347921533311133924729200,20387305341543872348027149959300247251122586296441271309757521233850527145501,20660888328716295053746457587105952359847177180169600462778173036912653930309,20868619915262427287234582212448052350184310305114553346457821129256743588185,17663781345821195819131504897468846255222386958594579879767055754372925042002,18948627844717262137578097615546021495287533410031083974644721619152121684198,13155646636245265066188794529431453696019006721019099462642586385520674193264,11607002707400435612558884657345015071868104333677950253781252883531031962578,7814494031495579790510272464332992505237344345380518199394208941034262720849,1133679025909186037940532130396250706184367022550359228793807250960294591300,17684405674061959945309711765066024811535672808158415749778270434181980067051,12226477960064982944626820350420332900927073584585614331096659786290796181633,19811925349932047710573270972607617621205677733103349721011497772488325290731,8648978019377605720004678083600719374811142735403518791266825142192290428262,13576053523641184415871793911230224707049224969614290468646557972152185575110,19246597006093201923867388663361027928531131674594730473459152193253618076466,658606426123772934076319360192555383963003130831902899767201848799898493860,17290137813713243852250776166370982880777712118107986170022122607636402519519,5468484217427333109722188824068218191654858622412608074953511216209386470685,21574260030527757195923820887880669668169386788465310192452085714817280961577,16977301410295947721817774534383483730974509825154556215531376468755351549427,15733754299741726976786941703016488589821960074385924955118036049474131193882,673051665852885808394122319132734442090810198084101653348055105938368910407,13398071607416834058601862099131647257306816396251547336997555114713122083633,12550653745423625869263455159672489463891823157792786197798074997479171696837,9401077435832768325771683033269047231487705804464911158715103022642914069963,12470382814922435426465904555965877134678525017061716145587676176477156930917,4934832010550666003820836613445526232712748207490447572633148755378222021432,10147431980198881931337046775655000300780675339813128987464503437796530727819,568707585724749374908018432889236271799675619271430223486579915440515081761,7940313483819289305875198195901580599194224791864182697672727755313391315497,18743990138882019355059105644701125600589318429506940478381096888059645669064,21390103921503672356366200239425679587351838964225860732507169466542370471389,1162301008434626626179696713526875746106593765970497860274277780972785074172,20866648005214775989252883040721823770262915606193206494879341544251201195074,7345491533727875108206436501195735628498565230546589655556895625258093485858,7625514906338569732343456767807169396379912415318224530910677456500209942160,7862757427463847382674463970373593668082249748547169027835585420099101631793,10678296207725321824311910857643347417220081751912275071080081222106552722672,16952109495603736214033791235849594583684019147749856522239399814261672810874,7275820797336428291178396248364001448190236523398157638561627689896470220284,9969981466756203881447261853491208039919719371961809442805550510895150629471,2820683912350770819480104529177445624170795283688064543451455124015297123761,1768227783012842108298280205661549942041342510905211540896799241998425991810,12106377471628405436369258554037168031059303858931832122655790690193581259368,11133684149892568979034305171877692043755100938665306193308979862319584720202,17034299967559262110637856726685484180103963204901371145115468175393665761738,7846191388095544813700988786315012990125413238605101219369138067522789941990,18501907765236851484806470528611625980973567313044760445349490286993727971054,1249778578878632628279160684089277562912849600486367726058714364522238473984,12800296338215947544269523539435530627816725976238738793426232070819346748361,21158276531398412025848449677754681262986399643402199704435277598413275051402,3445704611858969368326297112584817848554583085326694642313172161045347990986,1096936495127696656709715702297708886712481387809916555366077657639639717937,2595620917275871104056107465860277106075411236679259253450463497473275008081,17133880510415980077665570077127522127719512648188691671645676431813033706096,5074434632642876807560017812171878490042102579785821263047865225182212462287,12326838696626858713891707574688276984801973627108664533453869827609207218879,12304708188533179803341734069046800825101691162690698708386871234713091258421,17039317314373515840113235553933676165005713953680758739139458602566292834442,17138392904367957911746841143250516587142345504139102606501472531272348644184,1667176916358419631869035157338470222219117704099667397276080580945958414759,15905657308104601519308683078473840880633544254678278144766436492794698882065,5818790161586099604498469370871887484543304527772047827828829241332373438952,12442306790659206506330372960358262675060765197848150572966156688729178055833,8830924073341698588202301965823165752475570241349344118304602842583809330430,1875325218295968167735653385555759668710537053646457950513379995102733934773,17881009017973237557824378556848686261064176014957336169110006388300690909574,6685909350747636031504999384308339032316756393531361646826148497177153343308,4784523754559868056092042886072700730690109555243230003862073871950864412709,3579228774281988929604104014107948733265891035249209872698544379599035221295,4279085918474431382642565261103862932684902464862097608738233691705350921017,1137759862158982763491809087349360013612105180026300214422560224275715429456,19720837769260646491270657488868445833170057293472427873975392955686128702328,1718964391395646738355239526986888311027176887298320241700031309916500343965,19881985451679395586972172156300827725375888727627109004411614649624414408826,12172287315747539949563617756773178635584674160408496477097950831147264075213,17818348202724817301996509561425729131915819248800408750587580377834731903089,9526094675919376961704973755217702642807170426879590367299173409422751261551,3828510101756167773639196204933352052436416699730184799283196091112205339599,15234684891802383017182920097366274346299756278272648689423306851279308385365,5259340948631483055118623587523845455777103002480150827336361752510452569472,7522204711834833179288206454714805063533565847207420606996829544233502085239,4461024416231372224773966846126492961855795819183621636555920813846035684924,5024379057555899833767820321243484415757741022843259764504133153673503667684,1944348388731771850836911827979470257687115271361319233348322098245989069259,15065306781743278475238637320889039722240861069687500843669623160807616263519,10185565710140214717926900268233420932083773824278146477403635012592608678058,633282989982188437228855410820528038963373266773393154835968536206352769131,15070609296388507673139787908428420573100959040320412658731328587817279331759,21412207865606943642342520185052032190311633739645180935143927525277916223829,7878150466166009547688919693656375135045159152200952621922018706527536944814,21647238538593110963647188691796027858369673773306895927659346354059471769993,499258196791436830394876102694379667868532135110557694409916330175138906869,12884932140229984175244344672594504633237231438569204938753218905028898420879,13897088195397438949124517043146998392030835253375096249186075371152838123957,17292635307267344947001814307009165392877577631472640481991264040854674668918,3402459730835246576414179745580422332982133349475000364518392993042878622965,16196872248846772839551997397431726113069640679308998300903092440097004592538,18016286200009868237596690430345509415593965676022902141045234608328285884800,7857847074246536045428962801424396151797565515320554961976852417962849298458,3893665144753462156875073379241733664547431241880239458489799597153819411492,13248007323269384117634056450668957554780628822533632623855150478480951625390,18276875079677833610517929467816562761552054119550676368999897123627796943528,5189710327122023109841696471286837143455102090557692433286249568240177726287,7945689534444199447942235389147404638251522098536584100372965245456120158597,5423767002711680999240727030908088708424949959926318146878189397264151455693,5995072902526586585223000514086044396450113354893476089124870631086600489121,15275396095782853076485751600594247065910139735226081476243182046971110416839,7337085477458019807945256166142271568824298087615645600806448794391563720590,672727225441339286039441508031715798485173015033624765579287288711179551652,18686118639158601820164163991883068337953517102808111440802394108699280438488,14028695600256037576881239065837481650658243799767033132853744776667874365505,58443191205451688703601063117164997697541381759347793811443271650169777861,21065693836733911343227308560913091721048742432913504195640605496691788221566,330731975523362608415899785414131718097488715216703281999950906065685546389,16761217887229483694018038191674783405871691887163059178481478503168342732832,3038029821773816605245101973977979223409779873144308602734440877027458504742,15321291577034359343843366677170820527712726038561116015047816977743924220386,13707411308735348097061010267850476217721836580681738128758120478182032058809,17436870236156178819421588659602200365388268058796067042132167176029472760360,6398050943215095842335686342334715469621392080870897191300696782676608765887,3437851705781701539278760214561262405409371984542409183492392158766597659391,7124479506211457523573057217353911508610466081033238660465711588737967142974,17234798882124088040334413616145917195326697085511927239835381731514314303940,7189678840883577982600011373449005624085144056595391210996212544957416984457,11759897219791977703855743039753523539327151517291958119140418872939095386327,20863399992661754827674386311991156323060622036945800022666816987897813665853,19303856056826570957071409328135004293560711503205766767776395391371667771674,20145537319102686898024411390314804436660254524742986363357188082440068405993,10703774427752668974576334932100051927133058205544953271144849898179475571339,18572949224433194996605971200517412011627412770605201537755920772491000856992,17216568647787248412779004183002114283399247525457054305327730013550616639101,1149230406252660804924057240581611320485721839789360487426995484240018883527,16555038770640675528229594153638806495397639088923421322231578669556920716448,4570242682115771574920314226681534421057130734296724983202350760375592356599,17057311432878064305365984063315754288324488570316135529616408791432610322138,10528094520692277398437810246572829940408932590689365643375030258637643836256,18372709972473962897678516007961361205643396632377488479769034609756086158014,21838679058944462510227588871439974934573578287277780576996692447397949481484,1580935194501439869947304184720525369376830253681649968786933642354687903995,20467445367185359735288490209436765649401864859115524728703996670394981839178,1991219687938782033642326751499030593324853839359574632972633310438247709458,1439755133435743273361732699887115117694558270034210455263872898360142260289,16300147327505011303454000556020917254890545519131742846543658162285928042977,20520490665047234670156871323008670381517271529350180242819417364083994994438,6542862810250661443960454367170533117465189617181697143331232138215407738369,1321343667823388542880641322895423041177577518845790583045290901719235409147,2442599361719607622459103501177302579953568947914600055748918886479950617614,5868547468478431065596263697373807107429411676393246849408309043501871198941,12236312006031079186182743334640941452854376343312535021115608217162266564748,10096437059927455034494932369876021874913717336999122002472353603141122745838,16855287129299048285700210681474924546365514190517193678115189183373112094664,11157210691115027557284750949314979990011151769293562411757900634452166569473,12647512288244490046752876853167515938997386483355090398954955982145642073003,14545106158760908532417185649648478400561191409850112377631214176889261943702,13380884028176250201501329354617948687842379239413597035170382200236519084210,1405533288610146305353614064658402594063683037599662723217460924638972391780,12520645345847038927033831419634817247041895425958103228961545058464030447700,5466316270148149873459535347452815877745317540692907701390798166221830387727,5692512917835452114275964699861010134159019192212203758647174343214228494998,20406430429993275527714460195190469680616300984772360022156779114506307005915,2464398587529067351284637471629204475741470377175139272463319164375422871700,14514168707742420576792107362849792246555009352726620152895701096554575857830,13270866810108509432782712956020266539382253503195894711776480924657007904548,9134846497886036320932877977667565061646780167819704730891157458029677347762,6968315929580902986583144026090679082271496835598861747834541738159673277903,7271494204378938515839411341192945686765403888626619615653078042877068436796,18286507248612017881101512297381359645934672218434256889911439358758424747545,11110097749119198784554144689049124335810208369471373426127558546444086832925,8247301320031025187145317669710241636727060646792731418249820159438470005156,14294937643948997192288252800043984341826315689719836039426003941357321500134,7348709417616598268612977306891011618520420209855159927526151677200518293152,8241665213979757536094384437357490949853796937135356315008833005380426051194,14613486093064180194908604682667542845871833534699460114586605109597063839130,9113009852475701814533040575255279924173382591876828814441237692300104301457,13165038554179369948431676356672208670169443113631826535771459184335356285593,16086269628133108266869931705626389777530735876369884384351431845165268738278,6087260580031589238539099192443153008156470383537608551794229727048294996340,20512862830064709642749702619534843169107182362836772285105007708471619038567,19533181397104762456673826441378799870077181112746023293729567449839481548356,14705683451830296925170674619865205995188883759493716060771015969186134607704,12605792817445608495860292975716815181045267213200470818664710066347176280047,3592996587655107072245474938139935892949344064921754274126873928977701118749,15294232235999070733030126460937359944041996136808334336982336855120910512334,1582309023481075306597300823293668340335902140969083485284345214470852671798,1088465469116422019323930771299807477223547422484605269302564104323452973509,8883047416031049757538663266985855517015256170002963846635310997205392683864,3176854208559033403336658900147847127925792493324423188639056424099958393072,13232382305984866276823393930594443402152224642505744090163285056748376747918,2245408257366834949733190872330311995971080118654860159924241594642495281059,2379830947280597194685159865267943843813010731722978284837340564719341924509,17826177593330561305441136255554046830158210141415356927118963102466292013052,8247294876117518524724460400399686295737179004092227538368916244669417581296,9784484010004736296495309204028701732510703011300894445280176432324640320289,5252332428538395620048044694806285484695976570037776918613895482295008833982,14121980677685920870338206469007772221567007585360563336746921691628879549127,6873280017888024918917070095341125311616790755139638467124027157089622101088,11318363160576645628856748485098328456894971803038601852118504122294284627221,4121152361595345093207401693369225144531013563993157593094962034269624651820,20683333802753484511610127216996129924370396812165897253170891149253939360760,18647670031404843711327708343249425853609227031502475411522973225042672187860,2086657429367670063332013344180770222302417569271803215009583482264097874504,19709435480590614483363007409253356879041585154641286906159427713982563792526,4258866914660942354120395242129829740747833749509017072799985182732656616800,9040566395371463976833369354842616182669127821598268274888838547664814843928,4116084355554837400529216189356527577376881089426150781634827262283154963048,21605169971906188704396331617487188526616554159276096155817564565239435978416,17937211187232154582564924643486965895957558838414375726168318393094228123633,1992558685702604567028071709121593075020313087150274357559040691997376317338,3218330818271934662263059558699096796852863135305095433439395639068666897513,9251019796910681440348368762961435892628247766190360978557679196269677702320,15836693249656382763970061319175857247542072239256868703809948219144542014793,15037961154776922819548802422798270596812938540093547487192133997609110330498,2832985667948889103643595801116542064299718867280064733138075131374461684249,17231308893316371049725716015653771498326104062757761825930828499226120649063,18440767123713815329857061224743112764715289422724359826699690594664366648275,19107308066370859685275861140608997220650596581264375407813390731366162034891,5404929079073337935336499214267301362161341750373615311934457105389796446473,20619481508117738469430272904911772560595466539395055218439600469328451867796,13952701312362872281963137538185820474584748980975982879243876933687953690941,249746714007340023576169446261897246896602417046451816160506088486861113993,2031064645897563637919423800257706696891919492795925079196751344512608989440,11565396752616415432819810596660051755078386394477458037668058318114060397110,986400357247356567494096182209394879745469890962659581282966363140769490357,4537710479751915891784323654735525989928281714716787626598475607721311119956,6473679789570545843051971615499250002895246840329033388322918048865214899581,9663160517547239942952324390296932496372339501369452594336052141919689254511,5816463053578002459222339447164819661176549623835281810359748779077848682107,15884891878740533639319804312855499125304552172182333174674400304788572220390,3033403576169643300191876532878569681892028128211422158671974606431741064057,10358010399523377550281291332476224381854765291561168350961812145251103430188,5609119676745360689177377631509255444635743595725402489628064332010648311979,9629834817212476647292649072966526100818069994746003213667948679343174132340,9902671572518009781416980720459757101464549561371827438607346753254097417791,7861900468190840021147507239605680877304969442537895993247780719118539599806,17965713539282108900380748546130491121922627970953515439952089259237956451418,11875127160859896409551848475414052588524539216162668112975117611722753563101,12036060586969767703747823124372554748937989587973573397651022172958180951726,9687479700009208904244134411901361698716242095445472067017865326177763818896,9417881715546662771138833677126201059337478279387740105578558474324645551658,1453393784429512178361095160478955627301424316545464923297558140633602643591,3605661850144345838926820161654200172773665263094741288943401786929181563752,9633343945573595088617177094944240138296472849064303543706399640795820973418,12473139325003262775761026452954333162901791070446569863302424457084077761149,12050383798910643577317544771125034193641466979797280393384224161250051391008,10819280347517551331483926007074671789351833709996171469616831904311265033949,13165812145639084020184122275986846677464323294523670942848342958951658208097,4349080070868874275277456883424617452669491031060808106496345174056753179120,10004465749978899491390807601888552616948704671794075232666191099858337042324,5250553500845345497570122559573167112673420661316457421274200097450990672373,12898588403041862218453963458103462644872308284833558427909835998108927951654,18081519381738296094081786403175972446703155704846706982096034153576188388497,17428269008435424731165207394539747495252057789950545989706433801022598432683,21363561515458498091299721959548254375350819182606817501876503845082368630248,7730068437198222255038306872157350083702057866362961468917603557490811496832,804393402354592729694369925125379986785009558185994901175413585942989446396,5734375191529745066389276413443500729878560514347145222515433157787509440061,12298550311942812907291709877922367696701304981384797706564000787234950045527,11599955784759432052811066625229516027776562566066732630526030964712154732575,19052852164576098666742966317699449063762547007283635113650074658720294958279,10025188726400272980943623464270412609902684461295237328964275116870569460545,6716809200457040320003933672999684025455855713745782618771058247491604111902,13265049252191301811995103374452481986951626617983097109447548540667223415855,3243273032455921996687884516398249181181318053856384035604616213401999420878,17596345835810824358133183122550505795231799288513594802190425260560699653345,14128892069525759858946235743223382009747348980906404699362919849705747120829,13560912558482649403704338887070267536467549681310240991684055262800855969142,5146650134021051734120451478394931677954544403196703024645198760974236051136,3656624380537215154312224820978463973302627823287220718508509926228536255064,17192240779422792861455260231600955507004716950247796731699861536149977973585,14505892053752720060006987522044578502315422621292564446333307406645448977523,897766293354199284998764120885006378362273185992111179631631299334090746025,9385522526111341509707107108914634969549440746118599228963287393277576591675,16755551931355332730912571473383446100229118084434859591641172409884703288623,7998487350537565460407312493288045720319128967533762889043801066609578748620,7253071994474199371350196978282275858691584350754099653147319975858840509065,1574915908528094850594155669399292110958198100218448518346743116412237429711,4964033462714392747475438670479181630637512997723146160177292638427948047795,448448106178274062085484969210407935775566171618153143848162702130236340948,10632678501409460480908899293916037077432376165397750836428181066894132950422,6560185425582299240893314836102079088239101938875583740502225690151903320396,1579188680045650467520863974543764324416915154559115370865175124462148613819,7512915739904886375944428372792517861202973027020854741625268080946313568103,11437215569201917203849322845056384272839597879584906569042314064918170663914,12242031850346916661228168797937142001106743366886274501414812437377823138597,20754147834828558255955521879849243373047193258439455093561468286224927742847,8071694345199003059727834592733443749021397716021823212294503054151589204390,20008195907609188950845942022048531038227320303695709133926612651814670959266,3407176450804539102225412244906714437508697739163709736953739213204054495282,7164733851792769372626784323196646242013517015794517414070184073240948375536,9905209321913745841790507726277960404981926942651589731149669818541827874214,6005284264922151317117707687482989323446281090296110762814732182741632133904,3429846891758468105169655789950721158959212737421209807144772069541192906919,8594924739933231799186811828034272621585362372014000894229076451226180774305,11871888849049325223331295756953912508046243621607006393548707001434995954238,5685905463286653736673250214945816154927032180553041236977187605699044205816,213743477607202689216486321834878291503247072102535716407202454507834205331,12562677380228777117621213265298559705423375836884092254836487933903100167894,8185089847800873546122723865396073717154949803733075710451409261160174437901,6833793650798095878312843740119765700866687688998823144083128641706792979819,4953313804596399497426456604424338320630850621290040554640752190475708172557,2236942430605502498740725704270029328474562664606378240692747298661887827319,1513449164658866312019182303051862147479160906256039744485216368678117608853,20317977663255757433651259494490740600408545133225161089258307793180016743554,2805473554735433677734689688066817081805362311169954998301659824970436339447,15815182380045621180846286591593553907538664337286124104922652024183257765519,8995040978147557956715534525198883385024370476405764975921649687446895470970,8204191497925877512228406532110351579276808609895204619986274589454615200331,9804350573365946552974871840565664742492437387015600083520724662514547605734,2670072936416198613788578252423721270352613415834375050844481006480844299140,18981033918047008332984286244333212532097768099085053122971946780791175897494,12954085820551020895974547504930170442441222377530978192526624489157895091072,9097838829535778653934125096834099047122481765699682650259018742771271485024,7412500154264631610614836174268215158855286123479543445207793653417339063427,4570719057023209933442917712353770885061956176422382707340131424665352082829,3764270938841013974016907794451240962927342721628880682930414663597308799660,3003259409352957401069823305356475477293574843963128589242837442372343327078,4364045643562272249326662669199826714126432097046293502341074915354885207241,7862497546139280137858115009924456872495405978857024048016201451567691552233,2320345330709275050815413684718297588549014329479521210951823856644277128291,3472052133118830373581093491758594658278444460214482406644025496494813391646,18719780395522132269892764976785744172160001291971824246311191396996341879998,2052034405003094013719516407189467871257070713148889132320853589752948812286,12668293034393175159240347623878811740389002104040561234210863028172486003814,3030226117016103704707119677479690730613220303512226016348578882444095217375,10328007796868265401669271360208572151985515933147061282836598786351719442924,2936234154384973501504058165728446155253408008794108135203900159696674018692,488196422923618399001126311361138933209773385094782255292621218871598725659,9986243106324062707533627601692123931503570667062976466271294044444369357821,16946417777163299571223971859384083494444080413698624920773661721819621003999,6290655646787769345150128237305014645896272983703662862175950979175390099996,21576354856650767064171440939276202866931509433119578951322323205119147402280,12396222895516500136715256668686614381644469516081823538030375243855459590807,18323538829312240204982678233417444895412920429922269434090001873145951634449,5312977696789603985280968610327711512128871567270265803635161870118441769141,1256303934933114233929368123369287749699533819478400217199836088113619997588,1766722289253438664291189751442574085464717822269757100835532731400395828058,20358149792139162776765514570327167438522971057031059964363017830738523560815,18792275959974477341072288096653531684536236050557537981692565367846354045353,11262334644528432796511003492639130680887823443747110676752140224527884546026,20501847923202184923710061886495102946632889060597711856226126913397710337656,2407267120907499137598716355969720653158717479075795831021615986085480804669,17307860167097742136268530831561503531461792239855909861554172148017416960805,2162289869674344221546800054490037354766673860343307342595970088710829183154,7028199420603561050998184473139307688291589649001033510888359073812068249126,20994672525924208572413211399438489393060949253402639946739540459305617910138,20173431861606460093483867873896693022082731481398426039971589468498814864556,9008871249428555602906292660739315591043104408371562099899839775533895523948,10700805877647067083283505504782153003756758200729717834117016178491024406477,21112465741764258732843126921665151348166174697732269978267747373163853108430,11434984188666323224207642407059759324684918143122828248101482207244887988138,19774670032646206729857931401475084640123741797887602999266543966674579660422,674655537444683637096570248236990032160746930820910298495859277351312061534,12399952541366504233794506479162333424641228812125959815028858786807335765308,10787188444435222346993386033929793480957373636649543232735691292731739491178,8444484958726309128422673453859105535823575309761203789528942642797742183861,6178443234860827296437957284319327879259579261423150811121652495400576061977,9312686778448920745396192252021125483491892057300805307510293202738266404216,21035346041382930907137468070148126300607151584874513632902588011146411628958,21595380874048139145422335028184290720358814546434544789176692636485866078352,18101046998013962303174610041325057852573934184601619434223015638490343790989,19667939085949665955991312921627801957163412888505151951175612729243786613781,6926779782333484660471017512018931263032231687078574887001518725808608895509,21080823663408874605869582733040113428551737099016002655485931862299065393278,3655825253274650356501864672127621389343134570773587805971056417535174536245,3388541056162402337902270805874665052329588330241925030058121260891155159271,21883983703980930327495083710303031860831358299523823198355219501906879066592,6926045735792789706902681099796161456533517354066439495586980016226331896111,4122959111197116982155867189740721062669675590322734927703841118527609239459,13219980757163558837707442934888299444190968070207889541780648207183773341011,13812897721847878024718349018307386755424010495939938584588468146497630813114,12798580293550179822728288481477643428051047081525754174406779865733869649777,19217125674525037886170888487423869066614323854468572412518413433041373346147,375553361556668826677041847695421482571990138873344010326810282960129792132,10834658340690112017927173678735250754641576226700757836412274044036729618775,4000963705080416713341998395751411942820883040862140582570351568343523301185,11715758996898666999645486245570559500678491132871745818362150491793495427655,4263507095725155156517595569654198316584673531155392198157637482244808941446,328008196666170836733724513867841384647787752809351062335576481522598738696,16052279110256413457891846976681654137774297241350913171330588402386482933504,8560435921497695081829647680343824474942212198090196568605135998993570233835,18716362840678189592322462186141719951790452060116008532478803871048621361376,6373296854260461347237798330630093524006414867838125038061282895929391886849,18914705717475623119982002205679946947799155688028604423250694242332863378659,3615848956195277523544974986464432491666056752600413462508649484050878259586,14319383609652049721947038362087013158818175249064317958973877909037224815373,16735322269478335929131611670089342135588205793924787907856943392431725411629,20487989084414161462431324456040544956671737924589348832484117290264531005303,991404779256099913569561460005735823176831315250109345694197087497778707447,12403152875035099961283368388852584749460932263482397452647736730447907363221,4086427505181709923565832636992346270489207870131792488930389136658523450334,6143243951533181757415269381412864770996360748004903845141664179532399602512,866706669878257575355607694505677029531447447184317717274975559227499614511,5892914572161311963309388543417806910338156401784367910536431408323821746054,17195629524346618476376551682847818577110341498528926796026110967915240955181,11821298882555096497181913149211502245650586243756443688232286290083613236253,9353931901221302781036617146700068445151424017933715326811471823048576997254,287161824097962028466164990607592105232453331778514498980389789122436840050,10649681231914156546306210447083574697745999931000675911245824305402757632471,234428462053245029707379734508145490630528735544251100489484083890623632434,18386986463595680658295944092336172488193344109864388929828691162200829447922,12209205038092046905635371865560616384451716418834791040178049545643031921053,14186020280018069417447809370772570171911004194015095921511996859327548729773,18113938321789369780471778880758786581581161378582151974602552514969078582931,4811662992940356526245596671631791612493389462608103550402208802794345444140,20758900083194181903559645045132621401748979651195063688583538188953422299252,9153554145073302417837255133650907646404668180089275208960151746312542076673,9140083548410620433186361969381763393513996980985547052071730395844456832878,1995008884754637182207447536267941537231422109677541855619755654197330974956,20815985241080261061330547616924867409496454481048128927799047536950736307626,3230373257763661238115338374579765087994728137593244037768237534083906441753,15848607284344292541615961379571084541204910796797596203678379270219514113553,10428395164296448020881569101995272889447042680020183589472054992027224827786,13680122146242354024351667942887798315658431983426300974494489056276061013513,4339724378247845795006138666633339576672603219988412146454211158778911139049,16957453138566211779676251195537106997166365265767483860476580167187603818641,6903442910536492004022094150099887848831560470459811862902118892324229883825,13517533794136732881120013247194703467846939834067648417739110803619549581956,8573259981507024845652388913624603863752296398651459450944134507080250987145,7184725885552680253794089893559736740786331382981862187745268057810849566021,7444911651670419666243138241908768267984541319117854062859415506699726860996,11938251205745649282918409002562222384447298563524098642560439931062370036028,18732676061737136378462265890132297759828778436681433094170064283098167411411,8846532794008556689131513011423108042165045871690949838768507118557843169852,18388218263536244281946085549244925864711296342518046885707040924859244937400,17560203902531872086160045342305935339585392467343746359739902020514592872929,13543101793457457855715055504451796018964110256417682942067062541530681224758,12729201216656193290459172785293440324005383463664790973551946761644249872265,20749632282565878390585307142178974866932241415051524225408429188255209021839,2939350463247023543160206627078350892997171197177918468376868549940855641486,479410521971742071578523736929989300479738063431591906751176641695551615616,1215960229051771956876212387168875875104433482328478370485649365955599472636,7395834689442865088318136274271999810879214824816761763663704696957588580019,3437039086902274758103248708959011309309143141844585728091733160570479897488,17467540498235313026126845934481902834360708027699640261573503748997917041831,8422995023428881457749354920047230520807267797593122026229940569066728153312,11738236614524316047928272298201726059224571806912522830504677268234776263625,12990187369429149609670218646295887927962536468837638994349699374218402630706,21623781561819578622543358003640431769369503776252057790027825149203611468091,5669501143149367774701636329186878874504568114693026656335516415399035236206,4575509333922357841125659935390034260822150782714631158836599383911958256934,6033679984514005206127292322842556662338038222728990090780027736088500900555,20960588060390074988596726655693601209728221976889320157850211914560680389602,13413928900186225435324599444732846219399870995843202836070995363431243049194,9234295907731818534748337816708817747432963728163044189490249482655118848141,8555123146188721627588124037374319613226378704908045460846666824116325453744,15273216586585654487893582395632825165015207795457148545076967758704213266502,11125068324382272646583837096728304098536045737064996999867399544054690011336,14959670405320615939216519873622952189488168539376564485090492806106125094875,2609137341445825321095931245531863029306734693698914386115461720635228617677,18022833118482437226280994646426462585862398739142688151319660825030833751162,10525185277608968809171389414591123336341871721390818817629448578893073864965,6744998464824276672348708743166802119889279164929133576466782672127996471038,9344118411856392638882345685982595534877291739896163576786468663773481537247,5834845743289993456669132331911158234826336724070643002101495844260807919180,640787484559876348086629339096900566749702582335998287167888457763777550412,3289778183958313592191132419001427890244410850048418852950969831934946260405,21884067909485911557708530514125998779898644250629017666973972309955096019929,12413233158576537989326032313779399359311922621054801366572548255508592334846,19326971287642001797155516864971431422568657490079056599164481456075851978783,9713216558784550226779073929454993288918740379425900055346553812422457613427,18939709206067618242082635502394826733708666259540151764313557087718564592235,16287201832008230557120811959387085081039691924582377369304872636500446900292,5278016450516276499641394140854299047658079220708153291463991663971826612725,8340962164398516487176161966485950102648589482540787401234013926762930809122,2189360335587469104898894044890322510567148239646828290042687811234738731248,3449789621053765306024986494635371148296184209757783340117745997173900013891,9143283285825049929933624722851126967075894848265558258882809634241528781890,1762589836333836268173539283261821177424666871790048223025892425442664744623,14999716003380172870846520006929664713498492291151583767005426828389694408867,6657396937759865997077915983426704746176142403322137472681086594905173286297,15931240944401174032343453067874387364523175128749141502399457399279513999466,1093656103569127166341414994548826968375416499363412936873802336598768367672,15311996490740753142335607256171022029850671542830487572556180935394970969084,2114569000427676164059607854200438792707180857430926937778356703166016436297,20765151929972334364703309580474623940346949760797265180189525857343032900699,15086899750477019230037863517768898777026828694611906648102458179274814888575,11989598054307650119711820896035556261218721126425285775266572489599541225098,9091334194223602201291135947382348087276953920280768131063598550602333641673,662205156672119277592919023943339579805630811299947870362049797370818219037,1644010308269285824046398201622466330980474102922491226041283891094107089659,10802230809760799055453358968022894649048726749105153336410430294944584338077,10002812375469387387638524822236342839480428168589080127597945114460807065506,19156323136144190554785957482371465262949638224644638616894263767724257422262,17733486484176040486420248003268701811107138651833773383126692059485133299226,11591816707957137858747879818244290349664729458236317322129399152472444934827,13438697403526660565724658068461816155647612966569784134628157461074851140504,13266011411738324637226437761946084145971285033245245813436082422574964132769,19496324867803620550902836425197207665281935127556215366411961309085032313784,17828723725738030742535695874826508863700363541225603578112437608777873288872,1354878734330830246945810749621035198088901780682128075198035721915088394677,14191386869116296861827703975696048379271311137936832987484810982707013486938,19738102036337682966068176606232821315534061860926048846327720022609950683611,10125898950023999329674512710082674945903794489998271114320266993547905724563,9735132529803303628278600229677357854336331158152745512812889827254017680646,11236813353178034372164750145200156935906967316633703292491531523808184114591,2838710343346183231321901296981007702601287106254090132583144723338172491341,2260966150439461282635555159610786965904582998424984888756770014321125334804,16205138689269860259863339330838066928731455712034665818609854024821608206800,14474351689504859217283250911440109599364797953678136799363008066531050767071,6800897037717406782446195419208951974623496109363697062923841346454038837657,12439223794583479313810611548866683769924970108158641553689074442900057207206,13368632268650760591616092601174213792332738038582508245973036690611922918115,13045024155077800673372198196114071407850396125448182263497388710529843778012,15909614634449771616261546064207953846549526793661176217246033322484959782377,6286523689254946058242241932237494136885909209872547435875613686442878101066,1349982286621373054175291479185807897612755726394394337821103602455947583575,1790249021131563196559147247422502568900570496057134946620667686190353467913,6402193114585552816271289059052503078472437339555969654050634927290142355144,16657876151292774412640987426284773353540623435906797018927318161786869839630,9323926757990898215781025566456682055829536111985821344881754566754550287464,333557759600743416321063171376142987411973146341256173569676328325670137868,2979415176549537735678518951412460315394554685744871595392830851604961695296,11399925948142490745007741431204138659570087052831458877959853228053991616097,17621136800256980786736718847997675507300992679800923101555538476888606832414,19796186386112600298425768110232392434623500274218805673491160537841238382774,6150633696896276954724869550196553826388538976047912638783098883173888551921,8007744165470722314410652720217502653722691054745133622163922368886561184511,9311054107030040402449841855464250035701299963653145080544526434268446648883,17483374709267556993216232945834980676370211318754373298278341962960548363667,10342541634151745634549333576310088998125069092773405335947539258498170319639,2491113909032842407846736301373377587232014330531326042787834409966784029431,2868273648562988738033854616949524236294200717479306399357880720258598168313,10742331131465347969746591645056052543770202432577403033214021867405353469410,11262784136416067912059431910504651513874071545823747299137490135956765416093,1202953198131460912225596542947265149450470358249744433218140619832526467659,1357188592392022798249752911997083133072840552839921198518049365021930318735,6860322969159072475760401518666168198209741930191210869338776131213742985903,17512830541972446751364043570597924188477065675882039340228337890464360413831,11068769874220100931580712510878176008480346856568608049014134908792656846759,174592415638141512586004221919684850728269107225502531102930877822615095893,4529660791853304207880649392489892958123653811385478713812028357153062637877,7261086657925858393339848092042570053113017792782297779091045392687309229931,15947797860109427499686809495296483548232719158897790339724183452147879327839,20792174987130011436800220305375988411204569143955960269071283382992617027310,16004359657196683674112642475201997234099915262640166308760622340887283269558,3052232100533123772344258509339894427157169209304015026294337193048877370052,6932731371388662052904698619255543785138918159081404052613363170137706724722,18786344120940971245053939784556033915582618306965577644860589607674568931598,5543910602266336221969634219610367731229996706190750207556121552771043245699,21500331075127237626915881392062922706776178350223005349901601754581763355631,1647168321391235121087005294677186408057439085818209785557656918589059596681,18530920602212288118571329897791681729275409540471839847360270409798512800049,4854705606288041012191490612688235100018679131692705525031856778474580243436,14030500314224264714821884320124695887543721243139555484376859209010937666224,2929002685096227153223014766825090983318157894872369622190343561822695490151,19571082362460435625048830465870659122288859631947561605202388130763965600724,16262018111979731901324396497332329657354718141076944178560644525915310954979,16511368307044025445048172352133100276074403358941934299584092446434550554652,753252068911531248849891296487019536968643055711963719939888051839316478907,4925743538740679971454033971243400511986874154138434310761553437631037517931,6674573928014195188134308196945556256425786164998594495377003561132663149662,12252972387729677079741673273643386252988421977551152663330085764982570989423,8132942533382570630447992711549276375854208836400139615573300103975003948893,1767955113430187982507552626731364143386403228830412651051530991601802225661,15911785581735751807295094148896874484829666426702209837871379520505512480322,8457495441274725464495320737396221038491121993793647195771335087939175598066,4450592062983808718489321963811761580153883581981811699755824744572598554379,17594374172823696288546149573800906143533062920680825959471396256808502015697,5396987646216038506498234734744679865090292329649749592797349235509038812800,21252439428941443609961710022512211297072223091751149596182317370399721579385,18205060096578922655953660066798909616473486532390705801648322522122587090830,18335844957174152986460129513698965339432209604680688295392195893700811299508,2642745947776207344581721189041440984169021288344823913353017838424039626428,12274412791221963394261975707650556785293993588861677826296117405653175236519,9027620387743934195363518529726678172699541005293960006772332651314467807053,447942484646789701542537528994314353531710489288574350580201677777950035282,8057692910194936390243001022339132476522458573171096947792809940102911406995,12466422220613642034159029765007116066052620609909566451840020754182208020143,1171876794208841082635913903308771131102729703148972430947313152931064171577,2996001803829960955342682545650059577915377668754838044698518610136674338212,12306305078198172670943701974214620978597606399214937108559926306737496310941,1710451046983264379967941386456520655992388623198157754427123889803480356000,17294040628260706127805165314917539522165501484257724022309899345383198007240,14850723644587717617416204055806811021029607124589054329504158261611106696194,8626653016235921835569469801636971931942277275560421125462026339476626883966,16134665167778000757091607171765139146858141948472867080489695707419285323252,11129502792062576191937938132554397380912998297589916298721102071015359559556,15130530042530114554524440015929780266039077867502338045121803478767735700077,5922013411157909464044985892976718792018167710191222879749916950629215559119,15641877241146443425426298971354708474362723075989298367558100488623078084763,19807467678520679976886734556492012503982987205100734773481397135264223200444,7230620319188569738319728589376800438996515892335609872222230868954870926930,18168775389925542038768548563310374943094173375522704828602237046711660513509,15879478673208122828337915995586151196586860000621630078538789187695874266640,6026559623764003366786032824563693874782053604114144074018595121889075259493,6581629708588609217727738860658907189729022916858514019350636298557029783381,4392179832866307866014828901921327571555384668846640428849164693147430204259,4039689077078382209094762982217352133778072152116592303105622250221872775182,9439756845261909878224812875899975078023923372686432160229876632562036997401,6300039613750170323909974701574854925454386098696929245502563775636617169329,10245787402060152709811414110506095522941754087902005711632016024561712242938,10770509446150307821311775909967816156602102352374955635502734154581919715219,4445806424060983011786548514585153091691541530320683355086806781784085761841,10891448460108394317032887254041302638257759566726100966329794645560947944086,9055121436695773704587898653339600198373789357537888127317084878411452883579,8149630563292186659644235715307853879418282762593116603286751824944805128957,10164520096412584664920364217937374178249615925628067827666302990156368241543,18787580258401627795053641123916277779446570183960070225650619813208411270515,5840281460603743032409236132633000232507414411373674275076564056089047616513,1156412247030909285380152844453068577291565904060426536020772600017567322066,13125262001118293895463954353229315406286474760130294037415093324929424537303,19341994820951858136925352932235917695982462478372266716377719180643995594202,14230192493251599368583155353256194379698225636722091587422432258409725791125,18604655597949661495485553681980778009433340166469812699886221824297364988905,9484517765495232191823212744512718095318306206191891691619884709082351623103,20661548256453489016691122417433244991048818711049327729621550642733467464794,17946084952153038878596350204495193827996043096722462577062358769356218083033,9008616567490400741620365097652579204686050477332773331876377443733844010527,11222501299614818564801113661500553859475257082250633539503337648966645140931,17547881514301195137575407746474668605213387222566272868597007270413523256918,5795058045621081034219295632641782062332989904715400020698296776847639194943,10503000549984486673912349445691696940798628902104169170719393589667267164117,20627605141977035823281920467011832985049476688278934213570130229801586759490,1617802179061215386952772461423280627948056362689193604176834379576303877113,6791812933391289387114968397366223795809410677008110102514189342693442788856,21469327667867855439208525645169470185070216384607993883382520539336879692857,6209704596259199225388050030516880246912805490686902979517644524792187929012,15048235302521180373501889249113906037936587642496276368753413449431797081949,18778185090591194140890220889049934755279881763207537060835789721322305845157,4164373610491096709440557803327678927854304626112734913682240155408254130319,6352957909818668217728163741226734988658723962520906766539822539894434836600,2081726858060934846688892186400729209835095311388667168398290314717411097500,18997085104017244551079822479039381301947270057658366559839643454880390097993,15381301300391534710642382148869618456973733474322247178000572705046719371489,4198258606721523455517040976251319538290332464337310822593109666080121166366,7557782631251063800473816565466881793101085796415715068491278248627266080710,18931480224318877255548108668163955495398356426693160573742850933557366286581,14006438920977933743471268674953904657230294434994593269165676508225740552815,10552613214353127913757671512246056403297131067811718291694487016254806821431,6942360360107439367031353171424554084301681329082198856946152988574077265518,4821893567676204037011511732637248253220700045205121424698817536976139720741,8570797921121743873772790445200803600261480452613730673514117912909339929304,10210191620579364785116101817818502747961980686320008627354511305745123505207,2219514545666614569412405614553938185242666345781569909039944438048257115280,9472494948236350938478699115530847822498160599193967472596054792264811505177,1966000492511706985369338139654568276174679894528461227404736596640963023833,20046698515808110863133254224236843582890061845803004799852246848232152965906,844879645041461183539563036099295737132271525297913466134251805988318847548,4731835924119595590183070349774829521463227171971888362743688018910258502055,6665591397442095781758927683212527568272080607916992672135848576259567872049,12479020936095094085154050050726399793348028251321297846621658033596298393726,13547094394131143768607425506026982562580191167096570425566382504500825930959,14726791597032654225590630927699963688874228760066722543952181168729825328904,16458751398904781219324882164741165137205147400663608606201428995139003250837,1382702744652547575130131869708589984736039127219433507919721371542416805658,14166947289061517490924648855242003709961143010494793848406604325534604905674,17345393385322406098467895186375277399629828208438881931258894959842597584446,12612093274589904544460621781003810044552285394822234432357810635329000095532,2278721075910399058699498270814807833560549835812826924195171790394865401759,1421362911034706266530649492401610048326109063529762443419685870164992649589,20384150845787594899080953437004222732830782572958598551146508153682280572403,3495056095843097816017033529053032886550694720911641681721955773137850234745,14487246717687560703169821216097612442592434246076605506691782211475316706576,13114661974362015466065924612631881453272278776220284208159815065535423486323,9628837478322926908639029641093928246719582225562091179037197080152788423316,16456984127855989467975376775709400558526389914848937751741445859284106536098,19656266549615253685970702218272816322599871270060998775752454696892588799707,16028536897482325114555541492282064621526855756620164892739323385311597784598,11146275353887579825261271116625263398084632057838305651534583557054398181584,1266798071261939757558459653520435752781168817699931045808536221140555755937,11242956579746912399423902926753108012060763899073974272480062541403588053076,14588608018127887593991920960165305144719061971763947578582110087376128309227,5393054051309402705329828859286427425185515439646193479342950065083063200985,18307950351265411595229078848795494559405008993794506472277342386767679169011,743926999062879465491123202608691059211244131659206478586545917792531513741,11450449580887323007201214040662031298427088361641716342102428346626191862079,8918057399138776974775397421552812822591030597414174436378830421562569121660,14007657148016840281780221954150751472316590653604019267269105557294795817454,8897431240575139049076571283304115052162507033543918057893215164198174868677,17409416377040437657574990618884772475255396933561856228823381810258648281132,16403607054571283311114350132750182990388190855449188101005849970173367695642,1508877263063909922036861471040526805004287450733006660015588614987220564178,2405929790914208591765690668430163058227989428739435027301989746453297508008,18415257845847977290620817418058909465150962144437291827522053905306094819516,20783625745588167215135121578855692267545194811392233146323762172638833678083,12583735518159929222168953087285648797218797099708802919538903595273472024870,15030113532753402263141105846533650021837620483920708638977418255212037916690,2044646201923266135898414814098969242685760821863709223961924291978394037140,9562505824238493762747890608580676752653265912034931437600706699047478680911,8576622443481230638247834729157921300954369512398151853927361194153863723577,13502467573105057302451195240442043465889307076796874707692282952243564124313,8659508751425384756294968991737225118186991099981336883558347987313410663071,992836427155144083079734949008912409782777055146977880211513548288277680936,14478698156814197173486553402886358323315401752422792440407576984439553283243,20204662700070586254342470347097589341087597032672938910846995633724257876133,1812172830570486768023198219726218583158255123460220955281515074543933097836,17992769749806193849727573532001735714323064233429371707200828907106131204931,11275304845104653478990825724663443324387792098049434796341439810037846570595,11105199526118828533245892738176913532701964584183761946009726630431598631704,11393903979182757061241357325556769026145343989318381225525091986823175945546,14383047179623652129287498422471395756755287245693820194038638652931729043624,20453515719997662355844823439261666280107449255435062001366805179715649416520,16342434030539357589118587629035849207895930777526269265833103191510088418049,18401618409669783606190734020469430253158741609682792710560527808266513994586,16076963378432439787360187815002671229026877629938245603309362816936414414606,11529521787481754741418171353792184686967806427253956770441456297160607170941,12602344479327416239042579290059415968931395895265775848606068378636646131638,7874996576706323538862472352643073872193797790899948188898578232811415974069,4845431324532575010258701269749667428252187973009639700566740844013627970107,14802018959157569593654049670448062053140035551074745737518084801052997376690,1438261891736096301511736944301645044858355530036359764344568183983865122024,9702483734495711444970258278431697259819553205295174290488141405714571120392,745629299152271704331537263378566091569916279264951187804590327433939503876,13647050656573274198980106604763314305257288237932552445752822394869548724758,16745795700152546519998532820179128558740146524138261377398336069302091938316,6511309643923082597828923519243281993300211181014429981003702021394673484309,3158509665257424804238893020268668038794684527943417360064521274731483365497,10106711021741632147292275661510721445094446856823798214773373487329113893162,19539597394622940270506324036474158048415508212083560312665281444636039358507,9075752841443178653052367723489194637305474480630925657941805297419704103107,10984322959292625191378844945459317193701661510910417025411449026843907121641,17927313671844804578171839390174936993766288170716470877087434657482712787254,18872143162724264635018175304456023676931184143071101308504884978404622981510,20515902079806118899516548385287144085761546545950360604606371922174253859996,909520465300399063286844098900959690198495601569624327409635184475032912958,20206446745684213293565932220432184473350758436589542174203682990821527627997,18202239467972118142408259480727588505962487821013411792329301914239859726481,7983919062477498484336722979137049758716865253938030483468589967847498836327,8325614337212122905531318376855865321332189692321777599447159536409656516919,8597163804726192574292212854626326634508890118939606311848139014738137868745,18500944130179290196885189330659070775829081695220678669482033354888226989090,7688562031300833340110739922365866810835026837265955101002957176624104705373,19947182975808967149585827952170169153114833389807259043148589247054925861923,21517453591126354047928769118216728006629501856431780724965733122370735013602,19724728051616532722905708549906983762154956430000563385110162693578183573835,12901041676897371025108379309395257314967524835524863357724200518477312324601,3552976975075178791886580855175573474759766023206417049453393296909032090255,19723727023156957738383690313848921568395238875690539785344406327140649751346,8448482122526118108012095036728031952881057181233719818597059954973230302598,19506723656402269183886569439436103718740054288352928129647596321989076586438,14170198227468034198358292107569967739463050831964193487443803219358410981401,2398884471809169728404698398912564280110318964918284340553363751754870608551,20316276154960569208855163430299959763482642890911503054443013025286320052982,16819346170274370820168489515108636849055213099894018965040750518138293949687,14032485862625099598391073907784424901699264655891124043486362510876557553033,3741512032866709198636578814340035900693212341083373891378285003365821212725,12320998007117681710156579111620440763582440787871319835484669927670822914066,18497785580008161471127317447391820533755559610828409772165480020067085485597,4405750113669275276872999085838121306688869906871946649397890860602053182664,9830919490764773329556696442544208406733862221424439787824742578837854955405,11656214840454358128291973754562337687978444406755233034850997851692380129929,16862314752433119612255838474361565358197526603416756657147704910780503202458,13994730783691699927566696508271362101008053907735972055086535421903219406757,1854398114607336170485701571991055833572643201188015258021784624866312103211,20069390379729391520654648717585246938403361904664791681209786618785720069963,19778444821535136400266636630030874919578160245360989612631440824622767847607,21076683052368294199461719450518198858527944040936974409849054794891242446768,20411961758852468040955165630870750226459296665790953169982230333559560296737,7502887992944485334895259919103098713153732704425367381733235650810817022601,8197671201190749689041918593081864258260291777801687985230863071067546597951,570474345973383626887611250305231463005632817815912456645561438458026430574,16187881277000098252637261715701961539204559080071010626416256497925074197451,11845760454453819227975628605163841650771493308562299599588237256809780809041,12496905116588812906791602937225630677262600876144492834414412499317258049345,4202178453449927253051431595142836159883278283876420191896732301089503127871,15280239602029688372093391224297422856227971384132785248484775299588777602819,7675624637796659741242134119256859966414372807758392029058215748145801821134,1558712828795805480069595730092542425736929845400776453853052297930907571419,8635050664405255712941235442916789795311088451605341529181390886210645594786,20012080883240845774134523050094772793782396855825781678689671532280266223297,5332665745663855702669515489737590813722712486482340264533181716182162216492,4485713577378561256572703202440374134284884194291407499970429041545518915674,11594166683437400908552833183389222213106302657616725421515671119008232951402,12334131761060442183744872783660449330900007808735685674075245978195977188916,6469473140282499287719023824549928080797880736382216700350093546124693991876,9636916035199580181413428196442500662713954920605937945590797926723030993514,16259404193045476674338459391599179316200568243819582010383092764410171324132,20780929014533211529148194875929589500835169316324843103846798105106103748435,19665958036420604957261288306620614439114405875604211377014353932489316681936,15722491897648578237100473323139351762887860215830601049261437931157637153597,20474814639824406443111360000192533367769367587690127965461453022108167666929,15306300298273142257702357120212730128497075786589008381550108606914393296015,19116371381269652319147699604019975103087973589614811479290794650138683901396], + [11497693837059016825308731789443585196852778517742143582474723527597064448312,9160854578263429171202421862962594026987177464192712717562131193605088890171,16140003334191084124451468943070902129052879491017160345910048022420147165440,13954253824852759534031493316905992731351625718124698909948022659536770029356,21692459647877833789326815072729212414846887919903018341690717828718320112005,9941936267230985844518782624440910125063679135232844826673261884947459743883,13764916706054812213341909699290503443927147550756936312875016380348026052252,19102599208524798070012402067365820884265931087114568811319734727534891174260,2317229314815846955024814528087757341110607641360330608288042339421595574836,18416483069534816725178879766589878658686265350707575814092642317380006218736,1008780931278741447191637805167409477999443010661365677836100477728938308997,2545090804346934163783014162536858416885322260022963915511642447380970940906,20063061892576784746234714844937263854658165123147516223299128773175198821424,10515454963476061878165006305843100325941655508909556343534889232612007413255,14666046876279128708964624720946075308028756066224010008571298456055047416803,1019066804447509488848959767263827580870207313924599851872882869076383737080,12069305948801710705684828347680772060569105557945593846885134778987150642368,8621808318996908879998215444507382011199442894883948814246574848625262495021,2880093917191730817222149621749122107421670637456732204857760380124742164752,6542220672426887509675431131054437027921301676718161645952700116082427886835,5244163576308284656156828799646671881031097312780189786429450879353224489935,6473177356818363685990488940547034234726012773074061935352613261396549623686,21820960109882302233412313690073759484098924860992104203363318963429862834269,776485012941102583811996326817291151707768276005464663608504425462324969189,16008040671461692654565857317129301282959438973184407738728929267807682783872,11432621469217532329151110587073289606303873577842245393046608426744660231625,16529428848681190297024382986484471912959470051547049854507168832330777582917,21022141832384945339899318910964518260971220396886777286264903115370862218195,14654032557013894559632377088090851151746560959506805696507500157500224672350,21354688910115519251326230418165921377662159943573060390104844506964336391116,7752619774088278019865202458496784783724532278543560344508935599686049023521,9970654674664205783578937362441466301698784253920856829108173973533602978434,8766781005151378907464491478911534398597711022218593484510275842885145890118,427418044823104424459481289119034112585817787122063948281766019090147258009,20178400825368362428846659280983736786989246199446877730902913555280765010239,20090950791842994139452610863206653079874108855048809192426038290381481405709,20312256534186716461922298801781816516042265527822903054862895650988285562148,4909922693172591670749898596465752034935631291352031623980892388245203503556,14711873682305388680005649678171045910409841883308457847530167875811246495050,15958770417311022337941451962731041577578914593218560089308342731268531712920,14344571866504726216497643454572836820480317972842515429281824926793932325980,1769397319845168475613819781273574132774109508454697099778007579313922258588,258587389395146525547707547116022862705614858555176588203787762094788370646,7022463667655232121918607020344762877802128330181623732816227821885112788637,19845060031908398041047500648731073426448577406797522741285587091948148114644,8929070527835967284189505459276001504282186650781989399671939877306459603924,3547034362934554702033015610070536051926221082690581599667998618549114761320,4305372853651357563855521637099663044320680997112932657745973067738472275743,12214176886158725776791687535468106829515395407992835497927312162638766770078,11706938131011539306398383828922578377803816015869195385220014980091795489607,11651169608106469169652973769680487604343355235752770879131657116772958352610,13534129170664288430416028489502009030456779206590118389136628926201783734674,17992046595622622161177230469344714863802535922717313714552838880957499215981,10357743233228120740298650287569640748031608153491097653220067758242532130547,14517928487614900276301089165901434951535050275402697067248151083596639118376,8209182069608252268840455827520737704804441580266130568152978886513947166844,7640073974915695432060688995568585354936052110685953897202450273254409304465,6665784939677502535233010310165049782941185917893655988878440622136707103599,5556533518127592657586282330044128807869230494205809390140992474026365014562,408852126690043032125614061393097734033642541042497038832349288207856020928,12457107183372565990532088400464843754189254530767241274690121422398153743230,13376606774696045471509234199808902800235186345177397461276986609303176540711,5984750790245793264714000637029537436625478804219132653560918517073545131213,17088785934598552415567637681327922806463774512289686863420148678865116179843,20571346584413672249720180719864302959756306192295084730012069713189235458689,10563908856437897624492808163035753573292724651291788140893440219493498317425,8196914932493081300314276778567572383087801740102758457948867897900124032622,15351358433647454670571026954149706648025357095082471550411625465102412004635,4691549575923073479244290910433477874429633596189924034857922132851997509067,3824402350445187488499181297883462500055483166807595223590583390670577007868,3079709149206454455742256725666572935951085219797765997598190006202700553625,2933435916857570611285367519434342227981452027299670163614250683347221879812,11563256620627039928684054332499213986056102448749960304814905960272568400553,823982800920919472728462051408065816783743200056445901787723684868401502814,1426387027752743868839120378047531362360888408160839303820390910661721602405,5731997056751920185589748689260608921390513807500493745181552863591316000292,7720993839832885597994588400736035173902383878486875722645777844101744411689,9002464001048295091481045293483875664362475441902824699977741340020558338559,14092406920820325227424145554147519809410886190773484884502907926085878880530,17941121573263204671416572834368313711647830547916231506552438869447449377380,14129082317750218835304685520412323779932243077309313102580200435673568399019,12243264707350346605364305720479795822428336866265087370053925276897423448873,7359586883838006703688461248312304702229090925413466255532354254039350309505,3965462104895971860844762333128974051506845133345812196538391893357098668635,20413404046776512481224629835753522701244606906272947012890416028042446470875,14776939713848231582251698583594764736648030077584017202377553055729297756934,11733430377692682072369036122380634083002891720790435745639760545087660184574,11292503903510690808481905838273174776860675950299588217800551517281190922743,11420684871520848382159461165975179232780830769432469479502922603701278643559,508745459215920279034800716428719752357838311731203417677851933253804443780,13406614833603475717176189537057020401687589054028958458013676908546295198427,139498778461763532268768837474164379463641791532876816780917343085192436149,21267978943610728192699568453293742013765519272282009809779840168468272374983,13427075011225899058346282386775414644140701782157119231274761492276104178003,19408556542747941554117161987423225644412569826994655839704848575188694207985,4344748623903456736892311801593408666061687792073497811421388122550378864729,5249164170024197498338412206444867159273343488553715674803882832943638673489,2429321160057297680775462145791389342017255648014188548442207641044604477112,17633034583356484958669009250049760097861376611937917426871239574846566954163,8589358080626653532622087734866363152181033731195407703922685134228472217961,169706674245923892154983046053808641575955705892301306744269839968148939837,6930563539197568226045059034503291611681517204525149696500944995384070682620,7715180204730071272045176332163669182843407084675929323110162515552729145466,18820951479360410886797033460215573843065563410033088307349452904607006418510,13004571734426490172877737218587476803131320809388224624418159739666018276230,4221983194911935567520445796137770165826124860682996668925096525627918503987,4179458328609322852016864400883248432169808675570811233121213062838243996150,1974895668668582620251979849937803690939422905200315076249511583941627363923,6163089641798041487723906004413611225955533949531028903999813030048150618255,20798314848405704563578428763355242237484138146926032039199072579614133708498,7390763848541838674951447729994978703104555741288179669331719960925737939679,17595709281213749734228944927123024058411855966868873405155429088809356857614,2441295378821425129112278178696474169691086102217838124236465522719015824771,17849999656709233176331949642982487670074039937621948427273232063967495006615,5474039350730649299741439140946492457291098791158740216537321189511814004320,18047496680368319496003204418900793303422432417949101604087210129655489944730,13429638037186326961998474643589136448656547552567706898682870898125573018456,4946359485751570678621380009145072972898871622865400112232372288432448523287,3957822358540559545601980592836183988567881320017369675759228588453032530432,2400564715392273231728553914090327718988368277691346375047322875638060719294,11894303179337833272080120828007835602120013500741388580434416759507002392538,855198138664096487124576201178969627556714572486300747020353650684651888948,16178438790960495615141009256088177242852822581784859562011828222911238142141,10137977256085689928230181030370096331013301569857962720687404778057694535741,20515298296047282701750471139118794292164841708209011112551973440387123890479,7578927989884657210580284649728673292510875058413984297956940891614841867974,15739538064110791981043195085211350004676897766248503311173839899207608217532,8509314140684268376822128791119356380924264099968476717867240237437611156406,17940958334079989608306082569922896755033794405963583994940471979845228834401,6805144082112931458671099527607595264417843202533041916539891329055761729898,17799985834198911964923035884156388240555414131807336706586014102549806733421,1321093977038377443723007121319910985126631474786194145179087170534580192225,7212420993868874204016591911998823569295893131341249414736874789036080080431,16508732240056273863067547854850721821696261984346034975271352570374366672941,19365952558655609049762470933563228578883041309045062714419724629518231309330,7130642306151081144305696424018041594798737863203511582301667374235931034428,15515575256858646879456258778282520667217724217234033369846512585375869363745,9059306962111196078284859952597377729932287486280210246946890053176853282710,4280792737479805409403664514498090636723785279466801897971750554236293020515,597858655089478477234738420519139785711327216887739704481840585427214898574,12083197860096972935386715826619665719725493525449003092099143765304129114681,12386885105651539176174534724546204378869340659228252756723599802198672140462,16104345036536728728283892631581380860380214418375736872156768647788333934514,1354879242449295308208627398119082438254972230604954870747255418847391619159,4337243085646703769896498772355566596731636687256987520433742534413482763248,21848361732679483806572599977716282165817086425830260890883893707113846583427,19219603360817893268138318807528436572901663409914252265449565639651815377666,8493170221045553556330983879086435859112709446579471993956965243640551891229,14527043796091130553415865581526659472541220106744153300268446542314624889828,7937111786465239058321924657743649234315319708955946415168847089269341907969,6983241618969891267833664988834562719925952220932975709556427480787427509845,18465592203176453842524453315376851907098534348906659566313290009668304127477,12577134888425026368283611608059363450080978991251364658919457233283032077618,6518118228984271075704215109336988269949556606855830580887066004852197959585,10874313757780612756454383662805810655295466490423990025119534270332368723291,20050459982999023948350579488832955163413000705527333267976511300912322921717,21437528840108163281775491180120464654045652656938712316426352947376535924261,15993399358508475124653838111269121783855992741631266590611036066175654211556,10666318855988978766724392469406816805194254878125837815249460550109965279109,3728246313656508848829733684629154197051824118611903835393981369401120614690,15672779156766891637063280303644284349935441934769848438404666835306555334745,20385059098581842810391414884461531594818480948222590493458925664185735049630,17350905999329080753256083745369335770368978719306867594625495391694963226620,6853271030225637900654747228083647747830481256853322607732231926920221636638,16945013335725553221697952514726788415224349981949301561114619373330552300437,13958698773337419850196158271441769489630950623502500296722238460406723080346,10720560039907520317176701532328409797933913846226344831945799921818292744504,21881661898012375513399335499754096939362343783241122010305516740752509759219,8000150875389840177411621828177856485533123076967778453164076865957788973133,12006864256015504014085835403867962462497397391751885107034795661085483190829,11134943591559521791276826061536197135026619606969540608969613264694780202214,10460719249321273180939167776515335033037028258913526408809327052344611741158,15622824325483665989612723680117847052463187830077568039968213833454442303285,15410746446975895232352042328675463711076427815985485297730903996168105249910,2891625203408623652388062275887825901052275992286085168525244670232353662516,13945346776936592111645435552497641082181197055210791224507452108313960355724,9948029837520576958543862437428843878940881432043095435233721163595331057646,19462884070334019417166507501239463855294968830363882698967905077860898932836,5520136928844106525731832126160315598282989291025512087174203871698688956372,2261360495098633227748653797124151186175710067614537829940284371045336769476,18416255543912854662465760974639117371049579168655995592136361451572699752296,11463536517819692876416279640167390882172379596277754722588804736317693209031,14766312573746115666714530391277822821010415216258152152785909105008723593246,15974413313983607427146441647805917978765835122483385258268287590594890695726,7395768998784322986017026062700445312131764953109410144512127957624588026520,4984362060666297962621166548113407854009922708767986933509108968930963325593,7856069925664789206382562869453172139307214363990979700110954142509543954720,13392340056392075670742743235567931160245313927053798436913893965097578743589,14474853581934896987119860016624045909083123926480713073931600741515836999440,10281094117655562522718238098582121237113987849950975777935895552307296780258,15651874975250045926713763993802349605521485743295256479167713866101959393837,18837584337473843738351569365992574544592556787094567312567026738414350732486,5422285873429437751528536004788420694267218180077508101272917323525729776286,14483434861134394018133707852914799521209887335043004813883706597879855694501,20781651897373919207655051244184479648667009194959049646213659882342077548670,13257874746816536319517386553976680827294792028033921278407244416529098958298,11687595443717328453023567060513955787814475781716013805208754435947875015986,18166734702075655056906373297658555632769934998914813942424547912757194661408,21844245024899402789239043296889438934444349492098488274411135961103932824086,11576523423366505825808301659798885009429028155669986846400153307591026628871,1148929907457849288972409801053032039492913919668345502756020163532587226569,9833563661199700341560575887921549871699630430379479441644037429312353663854,3530072023449326955819177530541286351102246058096342120743109127661619847487,9578572618820421025088920868463234434017082077820664789170518853528041438058,7903274455513569732248555355877155817202990193424390098928646605922794954894,15657165496965632442135478212817895834512397576120080820666617370995124184076,20874620177603797416855214546759257732117862468392283423272496519554421621175,15225141515575386127960844403303707527145779098407107474807381929305493685913,18969726739742369826201131743053235807095357084892793088520738053078283905792,2273322388759602026766688787958421446004694547879317377854849512027808056744,5432511453110863684214390264939773007164867954188379597097897639266721931777,16573736113133010502307046980851924227669732687124639246608245168226674694938,14442377229880210285366376088368281053151209045775399428755468734230536622166,11507669956883827819118311484641373285663729813488745641363568933392081679659,17839532429606263422276008800408286253970022114288361307186094837217135904945,4014265539378515041529068347957642340321904838486974789543291691351911347680,13003411109936526663340169024379119873659186776343250211166084846025445488231,15306462549196010658398578543921194922332897913051564489815921371400376655492,15374920278441335059913374044144421033417626851032526544458034333565246831914,2323707387573936061377018731706151895551673463355017998838984100857163359959,8763825614293136074070194100490720958859071057754803255698169463529260604989,6460078619951263360498950096593765796985616066844041272594234887640757495947,7787749571541900537576366919010287855513576825542236245962970793208463720908,14155132064389382746286911268123763500605059883946776474093143918456417640061,5273412399684398435707041325417233001212071630727434066521150499193222197699,21782771343726562685905794523874393783448988772056027768682759741108535654588,2051311409953010480673263657665054154914165583084681916263406447692393737285,11875661765858469891704167021983258181748059479218144774825851054326067416765,21068403881106541076710977164706790160208140346094887767675202443752560686192,15758340092420689120259589661569467106735378390624556577895360824207644286190,6348044865909997285104441438862139025250301814988835887095459638724790173542,17932524652786058307278475190078972097828770914834668973535335630530452917847,3228816608788245618072625224844244257443056161113290604232896419878090903926,9551656383427589703749567396517141384933708835078892692797520811547619069163,9020946637763713728445703977273148745690000656147983844173946393849341364502,2943971707938849936044214925657955353752398302351355306608002652427585494465,13685248050363412502458409958081650237171619758299111626717716567774759779438,2868302441860272746035818268943730589208611466934920188905195434962368539498,12942754961762450702258615422302669970585456811961698112554744196254280397924,7774153016753223166594232439290374237307352882928845881491063153885238423849,6049199094489456460150873785624904803705527267070980629871787636829670320696,20845774618508072345571200270048422316984213457783733272821856328966613453129,893781271752145245996199566953390937322128434854461459523685354415462146991,18253521160421279022112163574719081086152283091051794425756555232523003389714,5830356839546054218884630677325272050228211705054095093735137780865196640272,465724850238100756077164119125411924005501292693566847128509233889037994810,16128424014911176575708362980592727342883849823936273728991741993116151256846,16294469866182032082852110477156803007474009685855833013024070339538767961172,16065302076211391028679793764673039756452069543133653373534107626161947643947,16884841668405833752583472630774457863811531316950980947099417366816649918715,6491186733352076588617073683591626846805330965399318749556699217006305107353,2905363039904017404089840194168764066155916074074586587258377722869451022895,12278525316798802696433043227895855967349302508482435733539545800309845622462,17314019937917464307399357201462393625411723762603710024519926241513301595993,17575148837153403621130441476206668397295797814863081080474688530411862819003,15471095648400918007606825575051718247465842587885842548618709676930106301461,12384318072593682092503177281279533170809948746241154089695346932340260672911,485123300957579906724434519828279717066415303115967428444773045074341666269,20783388705359037084238123327815399486599342641041862648140815340928809400500,782158089782171747510228803754257660300288627956397010472288943774913698434,3478639244366860518133129066736643188173227661380443503605881541719237123785,8117881660412001220282982503758841397343065193097821242261528946890929063115,35058721234476129650326366428341402515138917944396335645144933468879076532,16397938679668108498255642177027044558510343548921376375827648132906803583443,2433453154751221667718635947799318194191827076977739122814782387249355591958,10029257080729083671923349509739320383181145104464214096029001591053185820564,10656149073844062963681322014553075060763965763326275398946747079560564035850,16593959744982924702318121631183966060100893770061806448540495161947421822987,2068414540408163070577553011598011878961687148891918803076043034635892035594,7626934390068570344424013149524663454707020514194937543157326823804903603467,4554638618925430597188146675680715151198309496396245054063619103455584547039,13496396626587678250552586498039471308586222626132206600246125554024514007655,9386575758165199373292193827891788760863572720909068403298778509513288095168,7915179166050735066974287284338956896350001911949145779842510041370266325973,8167168351770465939827858686491835211463722244546741051891842055610292036496,2984855641991264563125921669666111398496570671860076360618117725463255935294,13345515131307851631101763161069239153529744919878592460694942948582652858318,1683899377816547722982571372970082226593844001913781056647398610840773630210,18082738493041031740109434905429676829872619916356658605260447196047710914008,3093627219579176143734483600677215286836843343902256951787659223143740127833,13711569243726999863512778161983125470458400981069655361767578939766971032706,2942999073656444791256166118886574877976523928599259988730412230442182398832,13741805436257583212406513632778404280140012772934699700695904335718144229392,2966496260001027437433299921197242880503083867421600405476235949236365134313,12214449406116917832159291589682410934022154504967698746834536840379875421993,14724028677081535225097028894192068729072210977241429998194582705094787450320,18532472576071611894578331306492326674151870705350144561012248059523768664658,12590949238667856614747230064159254583777806754508472794550424398198576585120,13228220894074693515947418568115512670466893414535562052872530653586084906533] + ) +} diff --git a/noir/noir_stdlib/src/hash/poseidon/bn254/perm.nr b/noir/noir_stdlib/src/hash/poseidon/bn254/perm.nr new file mode 100644 index 00000000000..890f54fdb3f --- /dev/null +++ b/noir/noir_stdlib/src/hash/poseidon/bn254/perm.nr @@ -0,0 +1,148 @@ +// Instantiations of Poseidon permutation for the prime field of the same order as BN254 +use crate::hash::poseidon::bn254::consts; +use crate::hash::poseidon::bn254::permute; +use crate::hash::poseidon::PoseidonConfig; + +#[field(bn254)] +pub fn x5_2(mut state: [Field; 2]) -> [Field; 2] { + state = permute( + consts::x5_2_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_3(mut state: [Field; 3]) -> [Field; 3] { + state = permute( + consts::x5_3_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_4(mut state: [Field; 4]) -> [Field; 4] { + state = permute( + consts::x5_4_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_5(mut state: [Field; 5]) -> [Field; 5] { + state = permute( + consts::x5_5_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_6(mut state: [Field; 6]) -> [Field; 6] { + state = permute( + consts::x5_6_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_7(mut state: [Field; 7]) -> [Field; 7] { + state = permute( + consts::x5_7_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_8(mut state: [Field; 8]) -> [Field; 8] { + state = permute( + consts::x5_8_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_9(mut state: [Field; 9]) -> [Field; 9] { + state = permute( + consts::x5_9_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_10(mut state: [Field; 10]) -> [Field; 10] { + state = permute( + consts::x5_10_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_11(mut state: [Field; 11]) -> [Field; 11] { + state = permute( + consts::x5_11_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_12(mut state: [Field; 12]) -> [Field; 12] { + state = permute( + consts::x5_12_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_13(mut state: [Field; 13]) -> [Field; 13] { + state = permute( + consts::x5_13_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_14(mut state: [Field; 14]) -> [Field; 14] { + state = permute( + consts::x5_14_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_15(mut state: [Field; 15]) -> [Field; 15] { + state = permute( + consts::x5_15_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_16(mut state: [Field; 16]) -> [Field; 16] { + state = permute( + consts::x5_16_config(), + state); + + state +} + +#[field(bn254)] +pub fn x5_17(mut state: [Field; 17]) -> [Field; 17] { + state = permute( + consts::x5_17_config(), + state); + + state +} diff --git a/noir/noir_stdlib/src/lib.nr b/noir/noir_stdlib/src/lib.nr new file mode 100644 index 00000000000..916e71cb490 --- /dev/null +++ b/noir/noir_stdlib/src/lib.nr @@ -0,0 +1,67 @@ +mod hash; +mod array; +mod slice; +mod merkle; +mod schnorr; +mod ecdsa_secp256k1; +mod ecdsa_secp256r1; +mod eddsa; +mod grumpkin_scalar; +mod grumpkin_scalar_mul; +mod scalar_mul; +mod sha256; +mod sha512; +mod field; +mod ec; +mod unsafe; +mod collections; +mod compat; +mod option; +mod string; +mod test; +// Oracle calls are required to be wrapped in an unconstrained function +// Thus, the only argument to the `println` oracle is expected to always be an ident +#[oracle(println)] +unconstrained fn println_oracle(_input: T) {} + +unconstrained pub fn println(input: T) { + println_oracle(input); +} + +#[foreign(recursive_aggregation)] +pub fn verify_proof( + _verification_key: [Field], + _proof: [Field], + _public_inputs: [Field], + _key_hash: Field, + _input_aggregation_object: [Field; N] +) -> [Field; N] {} +// Asserts that the given value is known at compile-time. +// Useful for debugging for-loop bounds. +#[builtin(assert_constant)] +pub fn assert_constant(_x: T) {} +// from_field and as_field are private since they are not valid for every type. +// `as` should be the default for users to cast between primitive types, and in the future +// traits can be used to work with generic types. +#[builtin(from_field)] +fn from_field(_x: Field) -> T {} + +#[builtin(as_field)] +fn as_field(_x: T) -> Field {} + +pub fn wrapping_add(x: T, y: T) -> T { + crate::from_field(crate::as_field(x) + crate::as_field(y)) +} + +pub fn wrapping_sub(x: T, y: T) -> T { + //340282366920938463463374607431768211456 is 2^128, it is used to avoid underflow + crate::from_field(crate::as_field(x) + 340282366920938463463374607431768211456 - crate::as_field(y)) +} + +pub fn wrapping_mul(x: T, y: T) -> T { + crate::from_field(crate::as_field(x) * crate::as_field(y)) +} +/// Shift-left x by y bits +/// If the result overflow the bitsize; it does not fail and returns 0 instead +#[builtin(wrapping_shift_left)] +pub fn wrapping_shift_left(_x: T, _y: T) -> T {} diff --git a/noir/noir_stdlib/src/merkle.nr b/noir/noir_stdlib/src/merkle.nr new file mode 100644 index 00000000000..9b15fe7313d --- /dev/null +++ b/noir/noir_stdlib/src/merkle.nr @@ -0,0 +1,19 @@ +// Regular merkle tree means a append-only merkle tree (Explain why this is the only way to have privacy and alternatives if you don't want it) +// Currently we assume that it is a binary tree, so depth k implies a width of 2^k +// XXX: In the future we can add an arity parameter +// Returns the merkle root of the tree from the provided leaf, its hashpath, using a pedersen hash function. +pub fn compute_merkle_root(leaf: Field, index: Field, hash_path: [Field; N]) -> Field { + let n = hash_path.len(); + let index_bits = index.to_le_bits(n as u32); + let mut current = leaf; + for i in 0..n { + let path_bit = index_bits[i] as bool; + let (hash_left, hash_right) = if path_bit { + (hash_path[i], current) + } else { + (current, hash_path[i]) + }; + current = crate::hash::pedersen_hash([hash_left, hash_right]); + } + current +} diff --git a/noir/noir_stdlib/src/option.nr b/noir/noir_stdlib/src/option.nr new file mode 100644 index 00000000000..137d57f33db --- /dev/null +++ b/noir/noir_stdlib/src/option.nr @@ -0,0 +1,164 @@ +struct Option { + _is_some: bool, + _value: T, +} + +impl Option { + /// Constructs a None value + pub fn none() -> Self { + Self { _is_some: false, _value: crate::unsafe::zeroed() } + } + + /// Constructs a Some wrapper around the given value + pub fn some(_value: T) -> Self { + Self { _is_some: true, _value } + } + + /// True if this Option is None + pub fn is_none(self) -> bool { + !self._is_some + } + + /// True if this Option is Some + pub fn is_some(self) -> bool { + self._is_some + } + + /// Asserts `self.is_some()` and returns the wrapped value. + pub fn unwrap(self) -> T { + assert(self._is_some); + self._value + } + + /// Returns the inner value without asserting `self.is_some()` + /// Note that if `self` is `None`, there is no guarantee what value will be returned, + /// only that it will be of type `T`. + pub fn unwrap_unchecked(self) -> T { + self._value + } + + /// Returns the wrapped value if `self.is_some()`. Otherwise, returns the given default value. + pub fn unwrap_or(self, default: T) -> T { + if self._is_some { + self._value + } else { + default + } + } + + /// Returns the wrapped value if `self.is_some()`. Otherwise, calls the given function to return + /// a default value. + pub fn unwrap_or_else(self, default: fn[Env]() -> T) -> T { + if self._is_some { + self._value + } else { + default() + } + } + + /// If self is `Some(x)`, this returns `Some(f(x))`. Otherwise, this returns `None`. + pub fn map(self, f: fn[Env](T) -> U) -> Option { + if self._is_some { + Option::some(f(self._value)) + } else { + Option::none() + } + } + + /// If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns the given default value. + pub fn map_or(self, default: U, f: fn[Env](T) -> U) -> U { + if self._is_some { + f(self._value) + } else { + default + } + } + + /// If self is `Some(x)`, this returns `f(x)`. Otherwise, this returns `default()`. + pub fn map_or_else(self, default: fn[Env1]() -> U, f: fn[Env2](T) -> U) -> U { + if self._is_some { + f(self._value) + } else { + default() + } + } + + /// Returns None if self is None. Otherwise, this returns `other`. + pub fn and(self, other: Self) -> Self { + if self.is_none() { + Option::none() + } else { + other + } + } + + /// If self is None, this returns None. Otherwise, this calls the given function + /// with the Some value contained within self, and returns the result of that call. + /// + /// In some languages this function is called `flat_map` or `bind`. + pub fn and_then(self, f: fn[Env](T) -> Option) -> Option { + if self._is_some { + f(self._value) + } else { + Option::none() + } + } + + /// If self is Some, return self. Otherwise, return `other`. + pub fn or(self, other: Self) -> Self { + if self._is_some { + self + } else { + other + } + } + + /// If self is Some, return self. Otherwise, return `default()`. + pub fn or_else(self, default: fn[Env]() -> Self) -> Self { + if self._is_some { + self + } else { + default() + } + } + + // If only one of the two Options is Some, return that option. + // Otherwise, if both options are Some or both are None, None is returned. + pub fn xor(self, other: Self) -> Self { + if self._is_some { + if other._is_some { + Option::none() + } else { + self + } + } else if other._is_some { + other + } else { + Option::none() + } + } + + /// Returns `Some(x)` if self is `Some(x)` and `predicate(x)` is true. + /// Otherwise, this returns `None` + pub fn filter(self, predicate: fn[Env](T) -> bool) -> Self { + if self._is_some { + if predicate(self._value) { + self + } else { + Option::none() + } + } else { + Option::none() + } + } + + /// Flattens an Option> into a Option. + /// This returns None if the outer Option is None. Otherwise, this returns the inner Option. + pub fn flatten(option: Option>) -> Option { + if option._is_some { + option._value + } else { + Option::none() + } + } +} diff --git a/noir/noir_stdlib/src/scalar_mul.nr b/noir/noir_stdlib/src/scalar_mul.nr new file mode 100644 index 00000000000..37cd935cdb9 --- /dev/null +++ b/noir/noir_stdlib/src/scalar_mul.nr @@ -0,0 +1,8 @@ +// Computes a fixed base scalar multiplication over the embedded curve. +// For bn254, We have Grumpkin and Baby JubJub. +// For bls12-381, we have JubJub and Bandersnatch. +// +// The embedded curve being used is decided by the +// underlying proof system. +#[foreign(fixed_base_scalar_mul)] +pub fn fixed_base_embedded_curve(_low: Field, _high: Field) -> [Field; 2] {} diff --git a/noir/noir_stdlib/src/schnorr.nr b/noir/noir_stdlib/src/schnorr.nr new file mode 100644 index 00000000000..c78eae37243 --- /dev/null +++ b/noir/noir_stdlib/src/schnorr.nr @@ -0,0 +1,2 @@ +#[foreign(schnorr_verify)] +pub fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8; N]) -> bool {} diff --git a/noir/noir_stdlib/src/sha256.nr b/noir/noir_stdlib/src/sha256.nr new file mode 100644 index 00000000000..4adb93f3848 --- /dev/null +++ b/noir/noir_stdlib/src/sha256.nr @@ -0,0 +1,172 @@ +// Implementation of SHA-256 mapping a byte array of variable length to +// 32 bytes. +// Internal functions act on 32-bit unsigned integers for simplicity. +// Auxiliary mappings; names as in FIPS PUB 180-4 +fn rotr32(a: u32, b: u32) -> u32 // 32-bit right rotation +{ + // None of the bits overlap between `(a >> b)` and `(a << (32 - b))` + // Addition is then equivalent to OR, with fewer constraints. + (a >> b) + (crate::wrapping_shift_left(a, 32 - b)) +} + +fn ch(x: u32, y: u32, z: u32) -> u32 { + (x & y) ^ ((!x) & z) +} + +fn maj(x: u32, y: u32, z: u32) -> u32 { + (x & y) ^ (x & z) ^ (y & z) +} + +fn bigma0(x: u32) -> u32 { + rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22) +} + +fn bigma1(x: u32) -> u32 { + rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25) +} + +fn sigma0(x: u32) -> u32 { + rotr32(x, 7) ^ rotr32(x, 18) ^ (x >> 3) +} + +fn sigma1(x: u32) -> u32 { + rotr32(x, 17) ^ rotr32(x, 19) ^ (x >> 10) +} + +fn sha_w(msg: [u32; 16]) -> [u32; 64] // Expanded message blocks +{ + let mut w: [u32;64] = [0; 64]; + + for j in 0..16 { + w[j] = msg[j]; + } + + for j in 16..64 { + w[j] = crate::wrapping_add( + crate::wrapping_add(sigma1(w[j-2]), w[j-7]), + crate::wrapping_add(sigma0(w[j-15]), w[j-16]), + ); + } + + w +} +// SHA-256 compression function +fn sha_c(msg: [u32; 16], hash: [u32; 8]) -> [u32; 8] { + let K: [u32; 64] = [ + 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, + 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, + 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, + 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, + 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, + 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, + 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, + 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, + 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 + ]; // first 32 bits of fractional parts of cube roots of first 64 primes + let mut out_h: [u32; 8] = hash; + let w = sha_w(msg); + for j in 0..64 { + let t1 = crate::wrapping_add(crate::wrapping_add(crate::wrapping_add(out_h[7], bigma1(out_h[4])), + ch(out_h[4], out_h[5], out_h[6])), + crate::wrapping_add(K[j], w[j])); + let t2 = crate::wrapping_add(bigma0(out_h[0]), maj(out_h[0], out_h[1], out_h[2])); + out_h[7] = out_h[6]; + out_h[6] = out_h[5]; + out_h[5] = out_h[4]; + out_h[4] = crate::wrapping_add(out_h[3], t1); + out_h[3] = out_h[2]; + out_h[2] = out_h[1]; + out_h[1] = out_h[0]; + out_h[0] = crate::wrapping_add(t1, t2); + } + + out_h +} +// Convert 64-byte array to array of 16 u32s +fn msg_u8_to_u32(msg: [u8; 64]) -> [u32; 16] { + let mut msg32: [u32; 16] = [0; 16]; + + for i in 0..16 { + for j in 0..4 { + msg32[15 - i] = (msg32[15 - i] << 8) + msg[64 - 4*(i + 1) + j] as u32; + } + } + + msg32 +} +// SHA-256 hash function +pub fn digest(msg: [u8; N]) -> [u8; 32] { + let mut msg_block: [u8; 64] = [0; 64]; + let mut h: [u32; 8] = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]; // Intermediate hash, starting with the canonical initial value + let mut c: [u32; 8] = [0; 8]; // Compression of current message block as sequence of u32 + let mut out_h: [u8; 32] = [0; 32]; // Digest as sequence of bytes + let mut i: u64 = 0; // Message byte pointer + for k in 0..msg.len() { + // Populate msg_block + msg_block[i as Field] = msg[k]; + i = i + 1; + if i == 64 { + // Enough to hash block + c = sha_c(msg_u8_to_u32(msg_block), h); + for j in 0..8 { + h[j] = crate::wrapping_add(c[j], h[j]); + } + + i = 0; + } + } + // Pad the rest such that we have a [u32; 2] block at the end representing the length + // of the message, and a block of 1 0 ... 0 following the message (i.e. [1 << 7, 0, ..., 0]). + msg_block[i as Field] = 1 << 7; + i = i + 1; + // If i >= 57, there aren't enough bits in the current message block to accomplish this, so + // the 1 and 0s fill up the current block, which we then compress accordingly. + if i >= 57 { + // Not enough bits (64) to store length. Fill up with zeros. + if i < 64 { + for _i in 57..64 { + if i <= 63 { + msg_block[i as Field] = 0; + i += 1; + } + } + } + c = h; + c = sha_c(msg_u8_to_u32(msg_block), c); + for j in 0..8 { + h[j] = crate::wrapping_add(h[j], c[j]); + } + + i = 0; + } + + for _i in 0..64 { + // In any case, fill blocks up with zeros until the last 64 (i.e. until i = 56). + if i < 56 { + msg_block[i as Field] = 0; + i = i + 1; + } else if i < 64 { + let mut len = 8 * msg.len() as u64; + for j in 0..8 { + msg_block[63 - j] = len as u8; + len >>= 8; + } + i += 8; + } + } + // Hash final padded block + c = h; + c = sha_c(msg_u8_to_u32(msg_block), c); + for j in 0..8 { + h[j] = crate::wrapping_add(h[j], c[j]); + } + // Return final hash as byte array + for j in 0..8 { + for k in 0..4 { + out_h[31 - 4*j - k] = h[7 - j] as u8; + h[7-j] >>= 8; + } + } + + out_h +} diff --git a/noir/noir_stdlib/src/sha512.nr b/noir/noir_stdlib/src/sha512.nr new file mode 100644 index 00000000000..ad2926aea81 --- /dev/null +++ b/noir/noir_stdlib/src/sha512.nr @@ -0,0 +1,161 @@ +// Implementation of SHA-512 mapping a byte array of variable length to +// 64 bytes. +// Internal functions act on 64-bit unsigned integers for simplicity. +// Auxiliary mappings; names as in FIPS PUB 180-4 +fn rotr64(a: u64, b: u64) -> u64 // 64-bit right rotation +{ + // None of the bits overlap between `(a >> b)` and `(a << (64 - b))` + // Addition is then equivalent to OR, with fewer constraints. + (a >> b) + (crate::wrapping_shift_left(a, 64 - b)) +} + +fn sha_ch(x: u64, y: u64, z: u64) -> u64 { + (x & y) ^ (!x & z) +} + +fn sha_maj(x: u64, y: u64, z: u64) -> u64 { + (x & y) ^ (x & z) ^ (y & z) +} + +fn sha_bigma0(x: u64) -> u64 { + rotr64(x, 28) ^ rotr64(x, 34) ^ rotr64(x, 39) +} + +fn sha_bigma1(x: u64) -> u64 { + rotr64(x, 14) ^ rotr64(x, 18) ^ rotr64(x, 41) +} + +fn sha_sigma0(x: u64) -> u64 { + rotr64(x, 1) ^ rotr64(x, 8) ^ (x >> 7) +} + +fn sha_sigma1(x: u64) -> u64 { + rotr64(x, 19) ^ rotr64(x, 61) ^ (x >> 6) +} + +fn sha_w(msg: [u64; 16]) -> [u64; 80] // Expanded message blocks +{ + let mut w: [u64;80] = [0; 80]; + + for j in 0..16 { + w[j] = msg[j]; + } + + for j in 16..80 { + w[j] = crate::wrapping_add( + crate::wrapping_add(sha_sigma1(w[j-2]), w[j-7]), + crate::wrapping_add(sha_sigma0(w[j-15]), w[j-16]), + ); + } + w +} +// SHA-512 compression function +fn sha_c(msg: [u64; 16], hash: [u64; 8]) -> [u64; 8] { + // noir-fmt:ignore + let K: [u64; 80] = [4794697086780616226, 8158064640168781261, 13096744586834688815, 16840607885511220156, 4131703408338449720, 6480981068601479193, 10538285296894168987, 12329834152419229976, 15566598209576043074, 1334009975649890238, 2608012711638119052, 6128411473006802146, 8268148722764581231, 9286055187155687089, 11230858885718282805, 13951009754708518548, 16472876342353939154, 17275323862435702243, 1135362057144423861, 2597628984639134821, 3308224258029322869, 5365058923640841347, 6679025012923562964, 8573033837759648693, 10970295158949994411, 12119686244451234320, 12683024718118986047, 13788192230050041572, 14330467153632333762, 15395433587784984357, 489312712824947311, 1452737877330783856, 2861767655752347644, 3322285676063803686, 5560940570517711597, 5996557281743188959, 7280758554555802590, 8532644243296465576, 9350256976987008742, 10552545826968843579, 11727347734174303076, 12113106623233404929, 14000437183269869457, 14369950271660146224, 15101387698204529176, 15463397548674623760, 17586052441742319658, 1182934255886127544, 1847814050463011016, 2177327727835720531, 2830643537854262169, 3796741975233480872, 4115178125766777443, 5681478168544905931, 6601373596472566643, 7507060721942968483, 8399075790359081724, 8693463985226723168, 9568029438360202098, 10144078919501101548, 10430055236837252648, 11840083180663258601, 13761210420658862357, 14299343276471374635, 14566680578165727644, 15097957966210449927, 16922976911328602910, 17689382322260857208, 500013540394364858, 748580250866718886, 1242879168328830382, 1977374033974150939, 2944078676154940804, 3659926193048069267, 4368137639120453308, 4836135668995329356, 5532061633213252278, 6448918945643986474, 6902733635092675308, 7801388544844847127]; // first 64 bits of fractional parts of cube roots of first 80 primes + let mut out_h: [u64; 8] = hash; + let w = sha_w(msg); + for j in 0..80 { + let out1 = crate::wrapping_add(out_h[7], sha_bigma1(out_h[4])); + let out2 = crate::wrapping_add(out1, sha_ch(out_h[4], out_h[5], out_h[6])); + let t1 = crate::wrapping_add(crate::wrapping_add(out2, K[j]), w[j]); + let t2 = crate::wrapping_add(sha_bigma0(out_h[0]), sha_maj(out_h[0], out_h[1], out_h[2])); + out_h[7] = out_h[6]; + out_h[6] = out_h[5]; + out_h[5] = out_h[4]; + out_h[4] = crate::wrapping_add(out_h[3] , t1); + out_h[3] = out_h[2]; + out_h[2] = out_h[1]; + out_h[1] = out_h[0]; + out_h[0] = crate::wrapping_add(t1, t2); + } + + out_h +} +// Convert 128-byte array to array of 16 u64s +fn msg_u8_to_u64(msg: [u8; 128]) -> [u64; 16] { + let mut msg64: [u64; 16] = [0; 16]; + + for i in 0..16 { + for j in 0..8 { + msg64[15 - i] = (msg64[15 - i] << 8) + msg[128 - 8*(i + 1) + j] as u64; + } + } + + msg64 +} +// SHA-512 hash function +pub fn digest(msg: [u8; N]) -> [u8; 64] { + let mut msg_block: [u8; 128] = [0; 128]; + // noir-fmt:ignore + let mut h: [u64; 8] = [7640891576956012808, 13503953896175478587, 4354685564936845355, 11912009170470909681, 5840696475078001361, 11170449401992604703, 2270897969802886507, 6620516959819538809]; // Intermediate hash, starting with the canonical initial value + let mut c: [u64; 8] = [0; 8]; // Compression of current message block as sequence of u64 + let mut out_h: [u8; 64] = [0; 64]; // Digest as sequence of bytes + let mut i: u64 = 0; // Message byte pointer + for k in 0..msg.len() { + // Populate msg_block + msg_block[i as Field] = msg[k]; + i = i + 1; + if i == 128 { + // Enough to hash block + c = sha_c(msg_u8_to_u64(msg_block), h); + for j in 0..8 { + h[j] = crate::wrapping_add(h[j], c[j]); + } + + i = 0; + } + } + // Pad the rest such that we have a [u64; 2] block at the end representing the length + // of the message, and a block of 1 0 ... 0 following the message (i.e. [1 << 7, 0, ..., 0]). + msg_block[i as Field] = 1 << 7; + i += 1; + // If i >= 113, there aren't enough bits in the current message block to accomplish this, so + // the 1 and 0s fill up the current block, which we then compress accordingly. + if i >= 113 { + // Not enough bits (128) to store length. Fill up with zeros. + if i < 128 { + for _i in 113..128 { + if i <= 127 { + msg_block[i as Field] = 0; + i += 1; + } + } + } + c = sha_c(msg_u8_to_u64(msg_block), h); + for j in 0..8 { + h[j] = crate::wrapping_add(h[j], c[j]); + } + + i = 0; + } + + for _i in 0..128 { + // In any case, fill blocks up with zeros until the last 128 (i.e. until i = 112). + if i < 112 { + msg_block[i as Field] = 0; + i += 1; + } else if i < 128 { + let mut len = 8 * msg.len() as u64; // u128 unsupported + for j in 0..16 { + msg_block[127 - j] = len as u8; + len >>= 8; + } + i += 16; // Done. + } + } + // Hash final padded block + c = sha_c(msg_u8_to_u64(msg_block), h); + for j in 0..8 { + h[j] = crate::wrapping_add(h[j], c[j]); + } + // Return final hash as byte array + for j in 0..8 { + for k in 0..8 { + out_h[63 - 8*j - k] = h[7 - j] as u8; + h[7-j] >>= 8; + } + } + + out_h +} diff --git a/noir/noir_stdlib/src/slice.nr b/noir/noir_stdlib/src/slice.nr new file mode 100644 index 00000000000..ca06e2aae44 --- /dev/null +++ b/noir/noir_stdlib/src/slice.nr @@ -0,0 +1,55 @@ +impl [T] { + /// Push a new element to the end of the slice, returning a + /// new slice with a length one greater than the + /// original unmodified slice. + #[builtin(slice_push_back)] + pub fn push_back(_self: Self, _elem: T) -> Self { } + + /// Push a new element to the front of the slice, returning a + /// new slice with a length one greater than the + /// original unmodified slice. + #[builtin(slice_push_front)] + pub fn push_front(_self: Self, _elem: T) -> Self { } + + /// Remove the last element of the slice, returning the + /// popped slice and the element in a tuple + #[builtin(slice_pop_back)] + pub fn pop_back(_self: Self) -> (Self, T) { } + + /// Remove the first element of the slice, returning the + /// element and the popped slice in a tuple + #[builtin(slice_pop_front)] + pub fn pop_front(_self: Self) -> (T, Self) { } + + pub fn insert(self, _index: Field, _elem: T) -> Self { + // TODO(#2462): Slice insert with a dynamic index + crate::assert_constant(_index); + self.__slice_insert(_index, _elem) + } + + /// Insert an element at a specified index, shifting all elements + /// after it to the right + #[builtin(slice_insert)] + fn __slice_insert(_self: Self, _index: Field, _elem: T) -> Self { } + + pub fn remove(self, _index: Field) -> (Self, T) { + // TODO(#2462): Slice remove with a dynamic index + crate::assert_constant(_index); + self.__slice_remove(_index) + } + + /// Remove an element at a specified index, shifting all elements + /// after it to the left, returning the altered slice and + /// the removed element + #[builtin(slice_remove)] + fn __slice_remove(_self: Self, _index: Field) -> (Self, T) { } + + // Append each element of the `other` slice to the end of `self`. + // This returns a new slice and leaves both input slices unchanged. + pub fn append(mut self, other: Self) -> Self { + for elem in other { + self = self.push_back(elem); + } + self + } +} diff --git a/noir/noir_stdlib/src/string.nr b/noir/noir_stdlib/src/string.nr new file mode 100644 index 00000000000..e402abf9ab6 --- /dev/null +++ b/noir/noir_stdlib/src/string.nr @@ -0,0 +1,11 @@ +use crate::collections::vec::Vec; +impl str { + /// Converts the given string into a byte array + #[builtin(str_as_bytes)] + pub fn as_bytes(_self: Self) -> [u8; N] { } + + /// return a byte vector of the str content + pub fn as_bytes_vec(self: Self) -> Vec { + Vec::from_slice(self.as_bytes().as_slice()) + } +} diff --git a/noir/noir_stdlib/src/test.nr b/noir/noir_stdlib/src/test.nr new file mode 100644 index 00000000000..47b31f4acea --- /dev/null +++ b/noir/noir_stdlib/src/test.nr @@ -0,0 +1,45 @@ +#[oracle(create_mock)] +unconstrained fn create_mock_oracle(_name: str) -> Field {} + +#[oracle(set_mock_params)] +unconstrained fn set_mock_params_oracle

(_id: Field, _params: P) {} + +#[oracle(set_mock_returns)] +unconstrained fn set_mock_returns_oracle(_id: Field, _returns: R) {} + +#[oracle(set_mock_times)] +unconstrained fn set_mock_times_oracle(_id: Field, _times: u64) {} + +#[oracle(clear_mock)] +unconstrained fn clear_mock_oracle(_id: Field) {} + +struct OracleMock { + id: Field, +} + +impl OracleMock { + unconstrained pub fn mock(name: str) -> Self { + Self { + id: create_mock_oracle(name), + } + } + + unconstrained pub fn with_params

(self, params: P) -> Self { + set_mock_params_oracle(self.id, params); + self + } + + unconstrained pub fn returns(self, returns: R) -> Self { + set_mock_returns_oracle(self.id, returns); + self + } + + unconstrained pub fn times(self, times: u64) -> Self { + set_mock_times_oracle(self.id, times); + self + } + + unconstrained pub fn clear(self) { + clear_mock_oracle(self.id); + } +} diff --git a/noir/noir_stdlib/src/unsafe.nr b/noir/noir_stdlib/src/unsafe.nr new file mode 100644 index 00000000000..542bd31fa84 --- /dev/null +++ b/noir/noir_stdlib/src/unsafe.nr @@ -0,0 +1,5 @@ +/// For any type, return an instance of that type by initializing +/// all of its fields to 0. This is considered to be unsafe since there +/// is no guarantee that all zeroes is a valid bit pattern for every type. +#[builtin(zeroed)] +pub fn zeroed() -> T {} diff --git a/noir/package.json b/noir/package.json new file mode 100644 index 00000000000..0e86b100b7c --- /dev/null +++ b/noir/package.json @@ -0,0 +1,50 @@ +{ + "name": "@noir-lang/root", + "private": true, + "workspaces": [ + "compiler/wasm", + "compiler/source-resolver", + "compiler/integration-tests", + "tooling/noir_js_types", + "tooling/noirc_abi_wasm", + "tooling/noir_js", + "tooling/noir_codegen", + "tooling/noir_js_backend_barretenberg", + "acvm-repo/acvm_js", + "release-tests", + "docs" + ], + "scripts": { + "build": "yarn workspaces foreach --parallel --topological-dev --verbose run build", + "test": "yarn workspaces foreach run test", + "test:integration": "yarn workspace integration-tests test", + "clean:workspaces": "yarn workspaces foreach --exclude @noir-lang/root run clean", + "clean:root": "rm -rf ./result ./target", + "clean": "yarn clean:workspaces && yarn clean:root", + "lint": "yarn workspaces foreach --verbose run lint", + "install:acvm_js": "yarn workspace @noir-lang/acvm_js run install:from:nix", + "install:noir_wasm": "yarn workspace @noir-lang/noir_wasm run install:from:nix", + "install:noirc_abi_wasm": "yarn workspace @noir-lang/noirc_abi run install:from:nix", + "install:from:nix": "yarn install:acvm_js && yarn install:noir_wasm && yarn install:noirc_abi_wasm", + "build:types": "yarn workspace @noir-lang/types run build", + "build:source-resolver": "yarn workspace @noir-lang/source-resolver run build", + "build:backend_barretenberg": "yarn workspace @noir-lang/backend_barretenberg run build", + "build:noir_js": "yarn workspace @noir-lang/noir_js run build", + "build:js:only": "yarn build:types && yarn build:source-resolver && yarn build:backend_barretenberg && yarn build:noir_js", + "prepare:publish": "yarn clean && yarn install:from:nix && yarn build:js:only", + "nightly:version": "yarn workspaces foreach run nightly:version", + "publish:all": "yarn install && yarn workspaces foreach run publish" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", + "chai": "^4.3.7", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "mocha": "^10.2.0", + "prettier": "3.0.3", + "ts-node": "^10.9.1", + "typescript": "^5.0.4" + }, + "packageManager": "yarn@3.6.4" +} diff --git a/noir/release-please-config.json b/noir/release-please-config.json new file mode 100644 index 00000000000..afc0bfd420d --- /dev/null +++ b/noir/release-please-config.json @@ -0,0 +1,81 @@ +{ + "release-type": "simple", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "prerelease": true, + "pull-request-title-pattern": "chore: Release Noir(${version})", + "group-pull-request-title-pattern": "chore: Release Noir(${version})", + "packages": { + ".": { + "release-type": "simple", + "component": "noir", + "package-name": "noir", + "include-component-in-tag": false, + "extra-files": [ + "Cargo.toml", + "flake.nix", + { + "type": "json", + "path": "compiler/source-resolver/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "compiler/wasm/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "tooling/noir_codegen/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "tooling/noir_js/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "tooling/noir_js_backend_barretenberg/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "tooling/noir_js_types/package.json", + "jsonpath": "$.version" + }, + { + "type": "json", + "path": "tooling/noirc_abi_wasm/package.json", + "jsonpath": "$.version" + } + ] + }, + "acvm-repo": { + "release-type": "simple", + "package-name": "acvm", + "component": "acvm", + "include-component-in-tag": false, + "extra-files": [ + "acir/Cargo.toml", + "acir_field/Cargo.toml", + "acvm/Cargo.toml", + "acvm_js/Cargo.toml", + "barretenberg_blackbox_solver/Cargo.toml", + "blackbox_solver/Cargo.toml", + "brillig/Cargo.toml", + "brillig_vm/Cargo.toml", + "stdlib/Cargo.toml", + "flake.nix", + { + "type": "json", + "path": "acvm_js/package.json", + "jsonpath": "$.version" + } + ] + } + }, + "plugins": [ + "sentence-case" + ] +} diff --git a/noir/release-tests/package.json b/noir/release-tests/package.json new file mode 100644 index 00000000000..3b73ad18574 --- /dev/null +++ b/noir/release-tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "release-tests", + "main": "index.js", + "license": "(MIT OR Apache-2.0)", + "private": true, + "type": "module", + "scripts": { + "test": "uvu test" + }, + "devDependencies": { + "uvu": "0.5.6", + "zx": "7.1.1" + } +} diff --git a/noir/release-tests/test/6_array.test.js b/noir/release-tests/test/6_array.test.js new file mode 100644 index 00000000000..530b7f85bf4 --- /dev/null +++ b/noir/release-tests/test/6_array.test.js @@ -0,0 +1,49 @@ +import { suite } from "uvu"; +import { cd } from "zx"; +import { NARGO_BIN } from "./utils/nargo.js"; +import "./utils/zx.js"; + +const test = suite("nargo"); + +// Helps detect unresolved ProcessPromise. +let promiseResolved = false; +process.on("exit", () => { + if (!promiseResolved) { + console.error("Error: ProcessPromise never resolved."); + process.exitCode = 1; + } +}); + +test("promise resolved", async () => { + await $`echo PromiseHelper`; + promiseResolved = true; +}); + +test("nargo builds ../tooling/nargo_cli/tests/execution_success/6_array sucessfully", async () => { + await within(async () => { + cd("../tooling/nargo_cli/tests/execution_success/6_array"); + const command = `${NARGO_BIN} check`; + + await $`${command}`.nothrow(); + }); +}); + +test("nargo creates proof ../tooling/nargo_cli/tests/execution_success/6_array sucessfully", async () => { + await within(async () => { + cd("../tooling/nargo_cli/tests/execution_success/6_array"); + const command = `${NARGO_BIN} prove 6_array`; + + await $`${command}`.nothrow(); + }); +}); + +test("nargo verifies proof ../tooling/nargo_cli/tests/execution_success/6_array sucessfully", async () => { + await within(async () => { + cd("../tooling/nargo_cli/tests/execution_success/6_array"); + const command = `${NARGO_BIN} verify 6_array`; + + await $`${command}`.nothrow(); + }); +}); + +test.run(); diff --git a/noir/release-tests/test/utils/nargo.js b/noir/release-tests/test/utils/nargo.js new file mode 100644 index 00000000000..537cdfc8be5 --- /dev/null +++ b/noir/release-tests/test/utils/nargo.js @@ -0,0 +1,3 @@ +import { default as path } from "node:path"; + +export const NARGO_BIN = process.env.NARGO_BIN ? path.resolve(process.env.NARGO_BIN) : "nargo"; diff --git a/noir/release-tests/test/utils/zx.js b/noir/release-tests/test/utils/zx.js new file mode 100644 index 00000000000..a8ab500aec0 --- /dev/null +++ b/noir/release-tests/test/utils/zx.js @@ -0,0 +1,11 @@ +import "zx/globals"; + +// We perform any common setup for zx here to avoid repetition across test files. + +if (process.platform == "win32") { + $.shell = "powershell"; +} + +$.quote = (arg) => arg; + +$.verbose = true; diff --git a/noir/release-tests/test/version.test.js b/noir/release-tests/test/version.test.js new file mode 100644 index 00000000000..7a70639d83e --- /dev/null +++ b/noir/release-tests/test/version.test.js @@ -0,0 +1,35 @@ +import { suite } from "uvu"; +import * as assert from "uvu/assert"; +import { NARGO_BIN } from "./utils/nargo.js"; +import "./utils/zx.js"; + +const test = suite("nargo"); + +// Helps detect unresolved ProcessPromise. +let promiseResolved = false; +process.on("exit", () => { + if (!promiseResolved) { + console.error("Error: ProcessPromise never resolved."); + process.exitCode = 1; + } +}); + +test("promise resolved", async () => { + await $`echo PromiseHelper`; + promiseResolved = true; +}); + +test("prints version", async () => { + const processOutput = (await $`${NARGO_BIN} --version`).toString(); + + // Regex to match the "nargo version" part of the output + assert.match(processOutput, /nargo version = \d{1,2}\.\d{1,2}\.\d{1,2}/); +}); + + +test("reports a clean commit", async () => { + const processOutput = (await $`${NARGO_BIN} --version`).toString(); + assert.not.match(processOutput, /is dirty: true/) +}); + +test.run(); diff --git a/noir/rust-toolchain.toml b/noir/rust-toolchain.toml new file mode 100644 index 00000000000..b6f7edc4bde --- /dev/null +++ b/noir/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "1.71.1" +components = [ "rust-src" ] +targets = [ "wasm32-unknown-unknown", "wasm32-wasi", "aarch64-apple-darwin" ] +profile = "default" diff --git a/noir/shell.nix b/noir/shell.nix new file mode 100644 index 00000000000..b72d4a4697b --- /dev/null +++ b/noir/shell.nix @@ -0,0 +1,13 @@ +let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + flakeCompatRev = lock.nodes.flake-compat.locked.rev; + flakeCompatHash = lock.nodes.flake-compat.locked.narHash; + flakeCompat = fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${flakeCompatRev}.tar.gz"; + sha256 = flakeCompatHash; + }; + compat = import flakeCompat { + src = ./.; + }; +in +compat.shellNix diff --git a/noir/tooling/backend_interface/CHANGELOG.md b/noir/tooling/backend_interface/CHANGELOG.md new file mode 100644 index 00000000000..4387d8ccb5f --- /dev/null +++ b/noir/tooling/backend_interface/CHANGELOG.md @@ -0,0 +1,233 @@ +# Changelog + +## [0.11.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.10.1...v0.11.0) (2023-08-18) + + +### ⚠ BREAKING CHANGES + +* Update `acvm` to 0.22.0 ([#240](https://github.com/noir-lang/acvm-backend-barretenberg/issues/240)) + +### Features + +* Update `acvm` to 0.22.0 ([#240](https://github.com/noir-lang/acvm-backend-barretenberg/issues/240)) ([d8342fd](https://github.com/noir-lang/acvm-backend-barretenberg/commit/d8342fd6da605ac3bbd889edf89cd122bc4689ce)) + +## [0.10.1](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.10.0...v0.10.1) (2023-08-18) + + +### Features + +* Migrate to `wasmer` 3.3.0 ([#236](https://github.com/noir-lang/acvm-backend-barretenberg/issues/236)) ([e115e38](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e115e38856887c6b1eeead3534534ac7e6327ea9)) + +## [0.10.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.9.1...v0.10.0) (2023-07-26) + + +### ⚠ BREAKING CHANGES + +* Migrate to ACVM 0.21.0 ([#234](https://github.com/noir-lang/acvm-backend-barretenberg/issues/234)) + +### Features + +* Migrate to ACVM 0.21.0 ([#234](https://github.com/noir-lang/acvm-backend-barretenberg/issues/234)) ([15c8676](https://github.com/noir-lang/acvm-backend-barretenberg/commit/15c86768685d2946a767c350f6ef5972c86677eb)) + +## [0.9.1](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.9.0...v0.9.1) (2023-07-21) + + +### Features + +* add support for atomic memory opcodes ([#232](https://github.com/noir-lang/acvm-backend-barretenberg/issues/232)) ([a7aa6e9](https://github.com/noir-lang/acvm-backend-barretenberg/commit/a7aa6e9505bb402c1b3db0a990845ed26928e7aa)) + +## [0.9.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.8.0...v0.9.0) (2023-07-17) + + +### ⚠ BREAKING CHANGES + +* update to ACVM 0.19.0 ([#230](https://github.com/noir-lang/acvm-backend-barretenberg/issues/230)) + +### Miscellaneous Chores + +* update to ACVM 0.19.0 ([#230](https://github.com/noir-lang/acvm-backend-barretenberg/issues/230)) ([3f1d967](https://github.com/noir-lang/acvm-backend-barretenberg/commit/3f1d9674b904acb02c2a3e52481be8a6104c3a9d)) + +## [0.8.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.7.0...v0.8.0) (2023-07-12) + + +### ⚠ BREAKING CHANGES + +* Update to acvm 0.18.1 ([#228](https://github.com/noir-lang/acvm-backend-barretenberg/issues/228)) + +### Features + +* Update to acvm 0.18.1 ([#228](https://github.com/noir-lang/acvm-backend-barretenberg/issues/228)) ([397098b](https://github.com/noir-lang/acvm-backend-barretenberg/commit/397098b239efbe16785b1c9af108ca9fc4e24497)) + +## [0.7.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.6.1...v0.7.0) (2023-07-08) + + +### ⚠ BREAKING CHANGES + +* **bberg:** add secp256r1 builtin to barretenberg ([#223](https://github.com/noir-lang/acvm-backend-barretenberg/issues/223)) + +### Features + +* **bberg:** add secp256r1 builtin to barretenberg ([#223](https://github.com/noir-lang/acvm-backend-barretenberg/issues/223)) ([ceb4770](https://github.com/noir-lang/acvm-backend-barretenberg/commit/ceb47705a492fcdcea1f3c098aaab42ea8edbf2e)) + +## [0.6.1](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.6.0...v0.6.1) (2023-07-06) + + +### Features + +* switch RecursiveAggregation support to true ([#225](https://github.com/noir-lang/acvm-backend-barretenberg/issues/225)) ([e9462ae](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e9462ae015ec0dfb0a23ccbb89562071f87940f5)) + +## [0.6.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.5.1...v0.6.0) (2023-07-06) + + +### ⚠ BREAKING CHANGES + +* Update to ACVM 0.16.0 ([#221](https://github.com/noir-lang/acvm-backend-barretenberg/issues/221)) + +### Features + +* Update to ACVM 0.16.0 ([#221](https://github.com/noir-lang/acvm-backend-barretenberg/issues/221)) ([062d5ed](https://github.com/noir-lang/acvm-backend-barretenberg/commit/062d5ed9b476fab8ac8d3ca13371699fb2aac332)) + +## [0.5.1](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.5.0...v0.5.1) (2023-06-20) + + +### Bug Fixes + +* Remove wasm32 target ([#219](https://github.com/noir-lang/acvm-backend-barretenberg/issues/219)) ([e4cbb6d](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e4cbb6d476e8746de33c38506e2fcb970f1c866a)) + +## [0.5.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.4.0...v0.5.0) (2023-06-15) + + +### ⚠ BREAKING CHANGES + +* Update to target ACVM 0.15.0 ([#217](https://github.com/noir-lang/acvm-backend-barretenberg/issues/217)) + +### Features + +* Update to target ACVM 0.15.0 ([#217](https://github.com/noir-lang/acvm-backend-barretenberg/issues/217)) ([9331898](https://github.com/noir-lang/acvm-backend-barretenberg/commit/9331898f161321c8b6a82d5ea850f197952b2ed2)) + +## [0.4.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.3.0...v0.4.0) (2023-06-07) + + +### ⚠ BREAKING CHANGES + +* Recursion ([#207](https://github.com/noir-lang/acvm-backend-barretenberg/issues/207)) + +### Features + +* Recursion ([#207](https://github.com/noir-lang/acvm-backend-barretenberg/issues/207)) ([6fc479b](https://github.com/noir-lang/acvm-backend-barretenberg/commit/6fc479b9ae99d59bbfeb1b895d63cdbea469dcaa)) + +## [0.3.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.2.0...v0.3.0) (2023-06-01) + + +### ⚠ BREAKING CHANGES + +* Update to ACVM 0.13.0 ([#205](https://github.com/noir-lang/acvm-backend-barretenberg/issues/205)) +* added keccakvar constraints ([#213](https://github.com/noir-lang/acvm-backend-barretenberg/issues/213)) +* update pedersen hashes for new implementation ([#212](https://github.com/noir-lang/acvm-backend-barretenberg/issues/212)) + +### Features + +* added keccakvar constraints ([91ea65f](https://github.com/noir-lang/acvm-backend-barretenberg/commit/91ea65f6af7039095c7a3af7bc1e4ce302a68a8d)) +* added keccakvar constraints ([#213](https://github.com/noir-lang/acvm-backend-barretenberg/issues/213)) ([91ea65f](https://github.com/noir-lang/acvm-backend-barretenberg/commit/91ea65f6af7039095c7a3af7bc1e4ce302a68a8d)) +* Update to ACVM 0.13.0 ([#205](https://github.com/noir-lang/acvm-backend-barretenberg/issues/205)) ([298446e](https://github.com/noir-lang/acvm-backend-barretenberg/commit/298446ef8b69f528b6e2fd2abb2298d7b0a8118e)) + + +### Bug Fixes + +* Add or cleanup implementations for JS target ([#199](https://github.com/noir-lang/acvm-backend-barretenberg/issues/199)) ([f6134b7](https://github.com/noir-lang/acvm-backend-barretenberg/commit/f6134b7b502cb74882300b0046ab91ab000daf3c)) +* update pedersen hashes for new impl ([9a233ce](https://github.com/noir-lang/acvm-backend-barretenberg/commit/9a233ce8db9984b29b9cce0603f758d5281c89c9)) +* update pedersen hashes for new implementation ([#212](https://github.com/noir-lang/acvm-backend-barretenberg/issues/212)) ([9a233ce](https://github.com/noir-lang/acvm-backend-barretenberg/commit/9a233ce8db9984b29b9cce0603f758d5281c89c9)) + +## [0.2.0](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.1.2...v0.2.0) (2023-05-22) + + +### ⚠ BREAKING CHANGES + +* Update to acvm 0.12.0 ([#165](https://github.com/noir-lang/acvm-backend-barretenberg/issues/165)) +* Add serialization logic for RAM and ROM opcodes ([#153](https://github.com/noir-lang/acvm-backend-barretenberg/issues/153)) + +### Features + +* Add serde to `ConstraintSystem` types ([#196](https://github.com/noir-lang/acvm-backend-barretenberg/issues/196)) ([4c04a79](https://github.com/noir-lang/acvm-backend-barretenberg/commit/4c04a79e6d2b0115f3b4526c60f9f7dae8b464ae)) +* Add serialization logic for RAM and ROM opcodes ([#153](https://github.com/noir-lang/acvm-backend-barretenberg/issues/153)) ([3d3847d](https://github.com/noir-lang/acvm-backend-barretenberg/commit/3d3847de70e74a8f65c64e165ad15ae3d31f5350)) +* Update to acvm 0.12.0 ([#165](https://github.com/noir-lang/acvm-backend-barretenberg/issues/165)) ([d613c79](https://github.com/noir-lang/acvm-backend-barretenberg/commit/d613c79584a599f4adbd11d2ce3b61403c185b73)) + +## [0.1.2](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.1.1...v0.1.2) (2023-05-11) + + +### Bug Fixes + +* Remove star dependencies to allow publishing ([#182](https://github.com/noir-lang/acvm-backend-barretenberg/issues/182)) ([1727a79](https://github.com/noir-lang/acvm-backend-barretenberg/commit/1727a79ce7e66d95528f70c445cb4ec1b1ece636)) + +## [0.1.1](https://github.com/noir-lang/acvm-backend-barretenberg/compare/v0.1.0...v0.1.1) (2023-05-11) + + +### Bug Fixes + +* Add description so crate can be published ([#180](https://github.com/noir-lang/acvm-backend-barretenberg/issues/180)) ([caabf94](https://github.com/noir-lang/acvm-backend-barretenberg/commit/caabf9434031c6023a5e3a436c87fba0a1072539)) + +## 0.1.0 (2023-05-10) + + +### ⚠ BREAKING CHANGES + +* Update to ACVM v0.11.0 ([#151](https://github.com/noir-lang/acvm-backend-barretenberg/issues/151)) +* Add Keccak constraints ([#150](https://github.com/noir-lang/acvm-backend-barretenberg/issues/150)) +* migrate to ACVM 0.10.3 ([#148](https://github.com/noir-lang/acvm-backend-barretenberg/issues/148)) +* remove all crates other than `acvm-backend-barretenberg` and remove workspace ([#147](https://github.com/noir-lang/acvm-backend-barretenberg/issues/147)) +* merge `barretenberg_static_lib` and `barretenberg_wasm` ([#117](https://github.com/noir-lang/acvm-backend-barretenberg/issues/117)) +* remove dead blake2 code ([#137](https://github.com/noir-lang/acvm-backend-barretenberg/issues/137)) +* Implement pseudo-builder pattern for ConstraintSystem & hide struct fields ([#120](https://github.com/noir-lang/acvm-backend-barretenberg/issues/120)) +* return boolean rather than `FieldElement` from `verify_signature` ([#123](https://github.com/noir-lang/acvm-backend-barretenberg/issues/123)) +* avoid exposing internals of Assignments type ([#119](https://github.com/noir-lang/acvm-backend-barretenberg/issues/119)) +* update to acvm 0.9.0 ([#106](https://github.com/noir-lang/acvm-backend-barretenberg/issues/106)) +* Depend upon upstream barretenberg & switch to UltraPlonk ([#84](https://github.com/noir-lang/acvm-backend-barretenberg/issues/84)) +* update to ACVM 0.7.0 ([#90](https://github.com/noir-lang/acvm-backend-barretenberg/issues/90)) +* Remove create_proof and verify functions ([#82](https://github.com/noir-lang/acvm-backend-barretenberg/issues/82)) +* update to acvm v0.5.0 ([#60](https://github.com/noir-lang/acvm-backend-barretenberg/issues/60)) + +### Features + +* **acvm_interop:** Updates to reflect new acvm methods using pk/vk ([#50](https://github.com/noir-lang/acvm-backend-barretenberg/issues/50)) ([cff757d](https://github.com/noir-lang/acvm-backend-barretenberg/commit/cff757dca7971161e4bd25e7a744d910c37c22be)) +* Add Keccak constraints ([#150](https://github.com/noir-lang/acvm-backend-barretenberg/issues/150)) ([ce2b9ed](https://github.com/noir-lang/acvm-backend-barretenberg/commit/ce2b9ed456bd8d2ad8357c15736d62c2a5812add)) +* allow overriding transcript location with BARRETENBERG_TRANSCRIPT env var ([#86](https://github.com/noir-lang/acvm-backend-barretenberg/issues/86)) ([af92b99](https://github.com/noir-lang/acvm-backend-barretenberg/commit/af92b99c7b5f37e9659931af378a851b3658a80b)) +* **ci:** add concurrency group for rust workflow ([#63](https://github.com/noir-lang/acvm-backend-barretenberg/issues/63)) ([5c936bc](https://github.com/noir-lang/acvm-backend-barretenberg/commit/5c936bc63cc3adcf9d43c9c4ce69053566089ad9)) +* Depend upon upstream barretenberg & switch to UltraPlonk ([#84](https://github.com/noir-lang/acvm-backend-barretenberg/issues/84)) ([8437bf7](https://github.com/noir-lang/acvm-backend-barretenberg/commit/8437bf7e08acadf43b55b307545336596a9fe766)) +* Implement pseudo-builder pattern for ConstraintSystem & hide struct fields ([#120](https://github.com/noir-lang/acvm-backend-barretenberg/issues/120)) ([8ed67d6](https://github.com/noir-lang/acvm-backend-barretenberg/commit/8ed67d68c71d655e1a6a5c38fa9ea1c3566f771d)) +* Leverage rustls when using downloader crate ([#46](https://github.com/noir-lang/acvm-backend-barretenberg/issues/46)) ([9de36b6](https://github.com/noir-lang/acvm-backend-barretenberg/commit/9de36b642d125d1fb4facd1bf60db67946be70ae)) +* merge `barretenberg_static_lib` and `barretenberg_wasm` ([#117](https://github.com/noir-lang/acvm-backend-barretenberg/issues/117)) ([ba1d0d6](https://github.com/noir-lang/acvm-backend-barretenberg/commit/ba1d0d61b94de91b15044d97608907c21bfb5299)) +* migrate to ACVM 0.10.3 ([#148](https://github.com/noir-lang/acvm-backend-barretenberg/issues/148)) ([c9fb9e8](https://github.com/noir-lang/acvm-backend-barretenberg/commit/c9fb9e806f1400a2ff7594a0669bec56025220bb)) +* remove all crates other than `acvm-backend-barretenberg` and remove workspace ([#147](https://github.com/noir-lang/acvm-backend-barretenberg/issues/147)) ([8fe7111](https://github.com/noir-lang/acvm-backend-barretenberg/commit/8fe7111ebdcb043764a83436744662e8c3ca5abc)) +* remove dead blake2 code ([#137](https://github.com/noir-lang/acvm-backend-barretenberg/issues/137)) ([14d8a5b](https://github.com/noir-lang/acvm-backend-barretenberg/commit/14d8a5b893eb1cb91d5bde908643b487b41809d6)) +* replace `downloader` dependency with `reqwest` ([#114](https://github.com/noir-lang/acvm-backend-barretenberg/issues/114)) ([dd62231](https://github.com/noir-lang/acvm-backend-barretenberg/commit/dd62231b8bfcee32e1029d31a07895b16159339c)) +* return boolean from `verify_signature` ([e560602](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e560602ebbd547386ca4cab35735ffa92e98ac4b)) +* return boolean rather than `FieldElement` from `check_membership` ([#124](https://github.com/noir-lang/acvm-backend-barretenberg/issues/124)) ([a0a338e](https://github.com/noir-lang/acvm-backend-barretenberg/commit/a0a338e2295635a07f6b9e497c029160a5f323bc)) +* return boolean rather than `FieldElement` from `verify_signature` ([#123](https://github.com/noir-lang/acvm-backend-barretenberg/issues/123)) ([e560602](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e560602ebbd547386ca4cab35735ffa92e98ac4b)) +* store transcript in `.nargo/backends` directory ([#91](https://github.com/noir-lang/acvm-backend-barretenberg/issues/91)) ([c6b5023](https://github.com/noir-lang/acvm-backend-barretenberg/commit/c6b50231da065e7550bfe8bddf8e46f4cd8002d7)) +* update `aztec_backend_wasm` to use new serialization ([#94](https://github.com/noir-lang/acvm-backend-barretenberg/issues/94)) ([28014d8](https://github.com/noir-lang/acvm-backend-barretenberg/commit/28014d803d052a7f459e03dbd7b5b9210449b1d0)) +* update to acvm 0.9.0 ([#106](https://github.com/noir-lang/acvm-backend-barretenberg/issues/106)) ([ff350fb](https://github.com/noir-lang/acvm-backend-barretenberg/commit/ff350fb111043964b8a14fc0df62508c87506423)) +* Update to ACVM v0.11.0 ([#151](https://github.com/noir-lang/acvm-backend-barretenberg/issues/151)) ([9202415](https://github.com/noir-lang/acvm-backend-barretenberg/commit/92024155532e15f25acb2f3ed8d5ca78da0fddd9)) +* update to acvm v0.5.0 ([#60](https://github.com/noir-lang/acvm-backend-barretenberg/issues/60)) ([74b4d8d](https://github.com/noir-lang/acvm-backend-barretenberg/commit/74b4d8d8b118e4477880c04149e5e9d93d388384)) + + +### Bug Fixes + +* Avoid exposing internals of Assignments type ([614c81b](https://github.com/noir-lang/acvm-backend-barretenberg/commit/614c81b0ea5e110bbf5a61a526bb0173f4fe377a)) +* avoid exposing internals of Assignments type ([#119](https://github.com/noir-lang/acvm-backend-barretenberg/issues/119)) ([614c81b](https://github.com/noir-lang/acvm-backend-barretenberg/commit/614c81b0ea5e110bbf5a61a526bb0173f4fe377a)) +* fix serialisation of arithmetic expressions ([#145](https://github.com/noir-lang/acvm-backend-barretenberg/issues/145)) ([7f42535](https://github.com/noir-lang/acvm-backend-barretenberg/commit/7f4253570257d9dedcfa8c8fb96b9d097ef06419)) +* Implement random_get for wasm backend ([#102](https://github.com/noir-lang/acvm-backend-barretenberg/issues/102)) ([9c0f06e](https://github.com/noir-lang/acvm-backend-barretenberg/commit/9c0f06ef56f23e2b5794e810f433e36ff2c5d6b5)) +* rename gates to opcodes ([#59](https://github.com/noir-lang/acvm-backend-barretenberg/issues/59)) ([6e05307](https://github.com/noir-lang/acvm-backend-barretenberg/commit/6e053072d8b9c5d93c296f10782251ccb597f902)) +* reorganize and ensure contracts can be compiled in Remix ([#112](https://github.com/noir-lang/acvm-backend-barretenberg/issues/112)) ([7ec5693](https://github.com/noir-lang/acvm-backend-barretenberg/commit/7ec5693f194a79c379ae2952bc17a31ee63a42b9)) +* replace `serialize_circuit` function with `from<&Circuit>` ([#118](https://github.com/noir-lang/acvm-backend-barretenberg/issues/118)) ([94f83a7](https://github.com/noir-lang/acvm-backend-barretenberg/commit/94f83a78e32d91dfb7ae9824923695d9b4c425b0)) +* Replace serialize_circuit function with `from<&Circuit>` ([94f83a7](https://github.com/noir-lang/acvm-backend-barretenberg/commit/94f83a78e32d91dfb7ae9824923695d9b4c425b0)) +* Update bb-sys to resolve bugs in some environments ([#129](https://github.com/noir-lang/acvm-backend-barretenberg/issues/129)) ([e3d4504](https://github.com/noir-lang/acvm-backend-barretenberg/commit/e3d4504f15e1295e637c4da80b1d08c87c267c45)) +* Update dependency containing pk write fix for large general circuits ([#78](https://github.com/noir-lang/acvm-backend-barretenberg/issues/78)) ([2cb523d](https://github.com/noir-lang/acvm-backend-barretenberg/commit/2cb523d2ab95249157b22e198d9dcd6841c3eed8)) +* Update to bb-sys 0.1.1 and update bb in lockfile ([00bb157](https://github.com/noir-lang/acvm-backend-barretenberg/commit/00bb15779dfb64539eeb3f3bb4c4deeba106f2fe)) +* update to bb-sys 0.1.1 and update bb in lockfile ([#111](https://github.com/noir-lang/acvm-backend-barretenberg/issues/111)) ([00bb157](https://github.com/noir-lang/acvm-backend-barretenberg/commit/00bb15779dfb64539eeb3f3bb4c4deeba106f2fe)) +* use `Barretenberg.call` to query circuit size from wasm ([#121](https://github.com/noir-lang/acvm-backend-barretenberg/issues/121)) ([a775af1](https://github.com/noir-lang/acvm-backend-barretenberg/commit/a775af14137cc7bc2e9d8a063fa718a5a9abe6cb)) + + +### Miscellaneous Chores + +* Remove create_proof and verify functions ([#82](https://github.com/noir-lang/acvm-backend-barretenberg/issues/82)) ([ad0c422](https://github.com/noir-lang/acvm-backend-barretenberg/commit/ad0c4228488457bd155ff381186ecf583f18bfac)) +* update to ACVM 0.7.0 ([#90](https://github.com/noir-lang/acvm-backend-barretenberg/issues/90)) ([6c03687](https://github.com/noir-lang/acvm-backend-barretenberg/commit/6c036870a6a8e26612ab8b4f90a162f7540b42e2)) diff --git a/noir/tooling/backend_interface/Cargo.toml b/noir/tooling/backend_interface/Cargo.toml new file mode 100644 index 00000000000..14b1609dd4a --- /dev/null +++ b/noir/tooling/backend_interface/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "backend-interface" +description = "The definition of the backend CLI interface which Nargo uses for proving/verifying ACIR circuits." +version = "0.11.0" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +acvm.workspace = true +dirs.workspace = true +thiserror.workspace = true +serde.workspace = true +serde_json.workspace = true +bb_abstraction_leaks.workspace = true + +tempfile = "3.6.0" + +## bb binary downloading +tar = "~0.4.15" +flate2 = "~1.0.1" +reqwest = { version = "0.11.20", default-features = false, features = [ + "rustls-tls", + "blocking", +] } + +[dev-dependencies] +test-binary = "3.0.1" + +[build-dependencies] +build-target = "0.4.0" +const_format.workspace = true diff --git a/noir/tooling/backend_interface/src/cli/contract.rs b/noir/tooling/backend_interface/src/cli/contract.rs new file mode 100644 index 00000000000..e83fc1909b6 --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/contract.rs @@ -0,0 +1,71 @@ +use std::path::{Path, PathBuf}; + +use crate::BackendError; + +use super::string_from_stderr; + +/// VerifyCommand will call the barretenberg binary +/// to return a solidity library with the verification key +/// that can be used to verify proofs on-chain. +/// +/// This does not return a Solidity file that is able +/// to verify a proof. See acvm_interop/contract.sol for the +/// remaining logic that is missing. +pub(crate) struct ContractCommand { + pub(crate) crs_path: PathBuf, + pub(crate) vk_path: PathBuf, +} + +impl ContractCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result { + let mut command = std::process::Command::new(binary_path); + + command + .arg("contract") + .arg("-c") + .arg(self.crs_path) + .arg("-k") + .arg(self.vk_path) + .arg("-o") + .arg("-"); + + let output = command.output()?; + + if output.status.success() { + String::from_utf8(output.stdout) + .map_err(|error| BackendError::InvalidUTF8Vector(error.into_bytes())) + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} + +#[test] +fn contract_command() -> Result<(), BackendError> { + use tempfile::tempdir; + + let backend = crate::get_mock_backend()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path(); + let bytecode_path = temp_directory_path.join("acir.gz"); + let vk_path = temp_directory_path.join("vk"); + + let crs_path = backend.backend_directory(); + + std::fs::File::create(&bytecode_path).expect("file should be created"); + + let write_vk_command = super::WriteVkCommand { + bytecode_path, + vk_path_output: vk_path.clone(), + crs_path: crs_path.clone(), + }; + write_vk_command.run(backend.binary_path())?; + + let contract_command = ContractCommand { vk_path, crs_path }; + contract_command.run(backend.binary_path())?; + + drop(temp_directory); + + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/cli/gates.rs b/noir/tooling/backend_interface/src/cli/gates.rs new file mode 100644 index 00000000000..aca05f0232a --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/gates.rs @@ -0,0 +1,64 @@ +use std::path::{Path, PathBuf}; + +use crate::BackendError; + +use super::string_from_stderr; + +/// GatesCommand will call the barretenberg binary +/// to return the number of gates needed to create a proof +/// for the given bytecode. +pub(crate) struct GatesCommand { + pub(crate) crs_path: PathBuf, + pub(crate) bytecode_path: PathBuf, +} + +impl GatesCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result { + let output = std::process::Command::new(binary_path) + .arg("gates") + .arg("-c") + .arg(self.crs_path) + .arg("-b") + .arg(self.bytecode_path) + .output()?; + + if !output.status.success() { + return Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))); + } + // Note: barretenberg includes the newline, so that subsequent prints to stdout + // are not on the same line as the gates output. + + const EXPECTED_BYTES: usize = 8; + let gates_bytes: [u8; EXPECTED_BYTES] = + output.stdout.as_slice().try_into().map_err(|_| { + BackendError::UnexpectedNumberOfBytes(EXPECTED_BYTES, output.stdout.clone()) + })?; + + // Convert bytes to u64 in little-endian format + let value = u64::from_le_bytes(gates_bytes); + + Ok(value as u32) + } +} + +#[test] +fn gate_command() -> Result<(), BackendError> { + use tempfile::tempdir; + + let backend = crate::get_mock_backend()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path(); + let bytecode_path = temp_directory_path.join("acir.gz"); + let crs_path = backend.backend_directory(); + + std::fs::File::create(&bytecode_path).expect("file should be created"); + + let gate_command = GatesCommand { crs_path, bytecode_path }; + + let output = gate_command.run(backend.binary_path())?; + // Mock backend always returns zero gates. + assert_eq!(output, 0); + + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/cli/info.rs b/noir/tooling/backend_interface/src/cli/info.rs new file mode 100644 index 00000000000..d3fd89bd2bc --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/info.rs @@ -0,0 +1,81 @@ +use acvm::Language; +use serde::Deserialize; +use std::collections::HashSet; +use std::path::{Path, PathBuf}; + +use crate::{BackendError, BackendOpcodeSupport}; + +use super::string_from_stderr; + +pub(crate) struct InfoCommand { + pub(crate) crs_path: PathBuf, +} + +#[derive(Deserialize)] +struct InfoResponse { + language: LanguageResponse, + opcodes_supported: Vec, + black_box_functions_supported: Vec, +} + +#[derive(Deserialize)] +struct LanguageResponse { + name: String, + width: Option, +} + +impl BackendOpcodeSupport { + fn new(info: InfoResponse) -> Self { + let opcodes: HashSet = info.opcodes_supported.into_iter().collect(); + let black_box_functions: HashSet = + info.black_box_functions_supported.into_iter().collect(); + Self { opcodes, black_box_functions } + } +} + +impl InfoCommand { + pub(crate) fn run( + self, + binary_path: &Path, + ) -> Result<(Language, BackendOpcodeSupport), BackendError> { + let mut command = std::process::Command::new(binary_path); + + command.arg("info").arg("-c").arg(self.crs_path).arg("-o").arg("-"); + + let output = command.output()?; + + if !output.status.success() { + return Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))); + } + + let backend_info: InfoResponse = + serde_json::from_slice(&output.stdout).expect("Backend should return valid json"); + let language: Language = match backend_info.language.name.as_str() { + "PLONK-CSAT" => { + let width = backend_info.language.width.unwrap(); + Language::PLONKCSat { width } + } + "R1CS" => Language::R1CS, + _ => panic!("Unknown langauge"), + }; + + Ok((language, BackendOpcodeSupport::new(backend_info))) + } +} + +#[test] +fn info_command() -> Result<(), BackendError> { + use acvm::acir::circuit::opcodes::Opcode; + + use acvm::acir::native_types::Expression; + + let backend = crate::get_mock_backend()?; + let crs_path = backend.backend_directory(); + + let (language, opcode_support) = InfoCommand { crs_path }.run(backend.binary_path())?; + + assert!(matches!(language, Language::PLONKCSat { width: 3 })); + assert!(opcode_support.is_opcode_supported(&Opcode::Arithmetic(Expression::default()))); + + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/cli/mod.rs b/noir/tooling/backend_interface/src/cli/mod.rs new file mode 100644 index 00000000000..3ea65f28103 --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/mod.rs @@ -0,0 +1,41 @@ +// Reference: https://github.com/AztecProtocol/aztec-packages/blob/master/circuits/cpp/barretenberg/cpp/src/barretenberg/bb/main.cpp + +mod contract; +mod gates; +mod info; +mod proof_as_fields; +mod prove; +mod verify; +mod version; +mod vk_as_fields; +mod write_vk; + +pub(crate) use contract::ContractCommand; +pub(crate) use gates::GatesCommand; +pub(crate) use info::InfoCommand; +pub(crate) use proof_as_fields::ProofAsFieldsCommand; +pub(crate) use prove::ProveCommand; +pub(crate) use verify::VerifyCommand; +pub(crate) use version::VersionCommand; +pub(crate) use vk_as_fields::VkAsFieldsCommand; +pub(crate) use write_vk::WriteVkCommand; + +#[test] +fn no_command_provided_works() -> Result<(), crate::BackendError> { + // This is a simple test to check that the binaries work + + let backend = crate::get_mock_backend()?; + + let output = std::process::Command::new(backend.binary_path()).output()?; + + let stderr = string_from_stderr(&output.stderr); + // Assert help message is printed due to no command being provided. + assert!(stderr.contains("Usage: mock_backend ")); + + Ok(()) +} + +// Converts a stderr byte array to a string (including invalid characters) +fn string_from_stderr(stderr: &[u8]) -> String { + String::from_utf8_lossy(stderr).to_string() +} diff --git a/noir/tooling/backend_interface/src/cli/proof_as_fields.rs b/noir/tooling/backend_interface/src/cli/proof_as_fields.rs new file mode 100644 index 00000000000..7eb1c1ef35c --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/proof_as_fields.rs @@ -0,0 +1,38 @@ +use std::path::{Path, PathBuf}; + +use acvm::FieldElement; + +use crate::BackendError; + +use super::string_from_stderr; + +/// `ProofAsFieldsCommand` will call the barretenberg binary +/// to split a proof into a representation as [`FieldElement`]s. +pub(crate) struct ProofAsFieldsCommand { + pub(crate) proof_path: PathBuf, + pub(crate) vk_path: PathBuf, +} + +impl ProofAsFieldsCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result, BackendError> { + let mut command = std::process::Command::new(binary_path); + + command + .arg("proof_as_fields") + .arg("-p") + .arg(self.proof_path) + .arg("-k") + .arg(self.vk_path) + .arg("-o") + .arg("-"); + + let output = command.output()?; + if output.status.success() { + let string_output = String::from_utf8(output.stdout).unwrap(); + serde_json::from_str(&string_output) + .map_err(|err| BackendError::CommandFailed(err.to_string())) + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} diff --git a/noir/tooling/backend_interface/src/cli/prove.rs b/noir/tooling/backend_interface/src/cli/prove.rs new file mode 100644 index 00000000000..c12e516db57 --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/prove.rs @@ -0,0 +1,71 @@ +use std::path::{Path, PathBuf}; + +use crate::BackendError; + +use super::string_from_stderr; + +/// ProveCommand will call the barretenberg binary +/// to create a proof, given the witness and the bytecode. +/// +/// Note:Internally barretenberg will create and discard the +/// proving key, so this is not returned. +/// +/// The proof will be written to the specified output file. +pub(crate) struct ProveCommand { + pub(crate) crs_path: PathBuf, + pub(crate) is_recursive: bool, + pub(crate) bytecode_path: PathBuf, + pub(crate) witness_path: PathBuf, +} + +impl ProveCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result, BackendError> { + let mut command = std::process::Command::new(binary_path); + + command + .arg("prove") + .arg("-c") + .arg(self.crs_path) + .arg("-b") + .arg(self.bytecode_path) + .arg("-w") + .arg(self.witness_path) + .arg("-o") + .arg("-"); + + if self.is_recursive { + command.arg("-r"); + } + + let output = command.output()?; + if output.status.success() { + Ok(output.stdout) + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} + +#[test] +fn prove_command() -> Result<(), BackendError> { + use tempfile::tempdir; + + let backend = crate::get_mock_backend()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path(); + let bytecode_path = temp_directory_path.join("acir.gz"); + let witness_path = temp_directory_path.join("witness.tr"); + + std::fs::File::create(&bytecode_path).expect("file should be created"); + std::fs::File::create(&witness_path).expect("file should be created"); + + let crs_path = backend.backend_directory(); + let prove_command = ProveCommand { crs_path, bytecode_path, witness_path, is_recursive: false }; + + let proof = prove_command.run(backend.binary_path())?; + assert_eq!(proof, "proof".as_bytes()); + drop(temp_directory); + + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/cli/verify.rs b/noir/tooling/backend_interface/src/cli/verify.rs new file mode 100644 index 00000000000..a31f476d84c --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/verify.rs @@ -0,0 +1,85 @@ +use std::path::{Path, PathBuf}; + +use crate::BackendError; + +/// VerifyCommand will call the barretenberg binary +/// to verify a proof +pub(crate) struct VerifyCommand { + pub(crate) crs_path: PathBuf, + pub(crate) is_recursive: bool, + pub(crate) proof_path: PathBuf, + pub(crate) vk_path: PathBuf, +} + +impl VerifyCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result { + let mut command = std::process::Command::new(binary_path); + + command + .arg("verify") + .arg("-c") + .arg(self.crs_path) + .arg("-p") + .arg(self.proof_path) + .arg("-k") + .arg(self.vk_path); + + if self.is_recursive { + command.arg("-r"); + } + + let output = command.output()?; + + // We currently do not distinguish between an invalid proof and an error inside the backend. + Ok(output.status.success()) + } +} + +#[test] +fn verify_command() -> Result<(), BackendError> { + use tempfile::tempdir; + + use super::{ProveCommand, WriteVkCommand}; + use crate::proof_system::write_to_file; + + let backend = crate::get_mock_backend()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path(); + let bytecode_path = temp_directory_path.join("acir.gz"); + let witness_path = temp_directory_path.join("witness.tr"); + let proof_path = temp_directory_path.join("1_mul.proof"); + let vk_path_output = temp_directory_path.join("vk"); + + let crs_path = backend.backend_directory(); + + std::fs::File::create(&bytecode_path).expect("file should be created"); + std::fs::File::create(&witness_path).expect("file should be created"); + + let write_vk_command = WriteVkCommand { + bytecode_path: bytecode_path.clone(), + crs_path: crs_path.clone(), + vk_path_output: vk_path_output.clone(), + }; + + write_vk_command.run(backend.binary_path())?; + + let prove_command = ProveCommand { + crs_path: crs_path.clone(), + is_recursive: false, + bytecode_path, + witness_path, + }; + let proof = prove_command.run(backend.binary_path())?; + + write_to_file(&proof, &proof_path); + + let verify_command = + VerifyCommand { crs_path, is_recursive: false, proof_path, vk_path: vk_path_output }; + + let verified = verify_command.run(backend.binary_path())?; + assert!(verified); + + drop(temp_directory); + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/cli/version.rs b/noir/tooling/backend_interface/src/cli/version.rs new file mode 100644 index 00000000000..83ab72a870e --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/version.rs @@ -0,0 +1,29 @@ +use std::path::Path; + +use crate::BackendError; + +use super::string_from_stderr; + +/// VersionCommand will call the backend binary +/// to query installed version. +pub(crate) struct VersionCommand; + +impl VersionCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result { + let mut command = std::process::Command::new(binary_path); + + command.arg("--version"); + + let output = command.output()?; + if output.status.success() { + match String::from_utf8(output.stdout) { + Ok(result) => Ok(result), + Err(_) => Err(BackendError::CommandFailed( + "Unexpected output from --version check.".to_owned(), + )), + } + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} diff --git a/noir/tooling/backend_interface/src/cli/vk_as_fields.rs b/noir/tooling/backend_interface/src/cli/vk_as_fields.rs new file mode 100644 index 00000000000..1b0212241c4 --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/vk_as_fields.rs @@ -0,0 +1,39 @@ +use std::path::{Path, PathBuf}; + +use acvm::FieldElement; + +use crate::BackendError; + +use super::string_from_stderr; + +/// VkAsFieldsCommand will call the barretenberg binary +/// to split a verification key into a representation as [`FieldElement`]s. +/// +/// The hash of the verification key will also be returned. +pub(crate) struct VkAsFieldsCommand { + pub(crate) vk_path: PathBuf, +} + +impl VkAsFieldsCommand { + pub(crate) fn run( + self, + binary_path: &Path, + ) -> Result<(FieldElement, Vec), BackendError> { + let mut command = std::process::Command::new(binary_path); + + command.arg("vk_as_fields").arg("-k").arg(self.vk_path).arg("-o").arg("-"); + + let output = command.output()?; + if output.status.success() { + let string_output = String::from_utf8(output.stdout).unwrap(); + let mut fields: Vec = serde_json::from_str(&string_output) + .map_err(|err| BackendError::CommandFailed(err.to_string()))?; + + // The first element of this vector is the hash of the verification key, we want to split that off. + let hash = fields.remove(0); + Ok((hash, fields)) + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} diff --git a/noir/tooling/backend_interface/src/cli/write_vk.rs b/noir/tooling/backend_interface/src/cli/write_vk.rs new file mode 100644 index 00000000000..8d4aa9cc7e3 --- /dev/null +++ b/noir/tooling/backend_interface/src/cli/write_vk.rs @@ -0,0 +1,57 @@ +use std::path::{Path, PathBuf}; + +use super::string_from_stderr; +use crate::BackendError; + +/// WriteCommand will call the barretenberg binary +/// to write a verification key to a file +pub(crate) struct WriteVkCommand { + pub(crate) crs_path: PathBuf, + pub(crate) bytecode_path: PathBuf, + pub(crate) vk_path_output: PathBuf, +} + +impl WriteVkCommand { + pub(crate) fn run(self, binary_path: &Path) -> Result<(), BackendError> { + let mut command = std::process::Command::new(binary_path); + + command + .arg("write_vk") + .arg("-c") + .arg(self.crs_path) + .arg("-b") + .arg(self.bytecode_path) + .arg("-o") + .arg(self.vk_path_output); + + let output = command.output()?; + if output.status.success() { + Ok(()) + } else { + Err(BackendError::CommandFailed(string_from_stderr(&output.stderr))) + } + } +} + +#[test] +fn write_vk_command() -> Result<(), BackendError> { + use tempfile::tempdir; + + let backend = crate::get_mock_backend()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path(); + let bytecode_path = temp_directory_path.join("acir.gz"); + let vk_path_output = temp_directory.path().join("vk"); + + let crs_path = backend.backend_directory(); + + std::fs::File::create(&bytecode_path).expect("file should be created"); + + let write_vk_command = WriteVkCommand { bytecode_path, crs_path, vk_path_output }; + + write_vk_command.run(backend.binary_path())?; + drop(temp_directory); + + Ok(()) +} diff --git a/noir/tooling/backend_interface/src/download.rs b/noir/tooling/backend_interface/src/download.rs new file mode 100644 index 00000000000..27aab7ef351 --- /dev/null +++ b/noir/tooling/backend_interface/src/download.rs @@ -0,0 +1,54 @@ +use std::{ + io::{Cursor, ErrorKind}, + path::Path, +}; + +/// Downloads a zipped archive and unpacks the backend binary to `destination_path`. +/// +/// # Backend Requirements +/// +/// In order for a backend to be compatible with this function: +/// - `backend_url` must serve a gzipped tarball. +/// - The tarball must only contain the backend's binary. +/// - The binary file must be located at the archive root. +pub fn download_backend(backend_url: &str, destination_path: &Path) -> std::io::Result<()> { + use flate2::read::GzDecoder; + use tar::Archive; + use tempfile::tempdir; + + // Download sources + let compressed_file: Cursor> = download_binary_from_url(backend_url) + .map_err(|_| std::io::Error::from(ErrorKind::Other))?; + + // Unpack the tarball + let gz_decoder = GzDecoder::new(compressed_file); + let mut archive = Archive::new(gz_decoder); + + let temp_directory = tempdir()?; + archive.unpack(&temp_directory)?; + + // Assume that the archive contains a single file which is the backend binary. + let mut archive_files = std::fs::read_dir(&temp_directory)?; + let temp_binary_path = archive_files.next().unwrap()?.path(); + + // Create directory to place binary in. + std::fs::create_dir_all(destination_path.parent().unwrap())?; + + // Rename the binary to the desired name + std::fs::copy(temp_binary_path, destination_path)?; + + drop(temp_directory); + + Ok(()) +} + +/// Try to download the specified URL into a buffer which is returned. +fn download_binary_from_url(url: &str) -> Result>, reqwest::Error> { + let response = reqwest::blocking::get(url)?; + + let bytes = response.bytes()?; + + // TODO: Check SHA of downloaded binary + + Ok(Cursor::new(bytes.to_vec())) +} diff --git a/noir/tooling/backend_interface/src/lib.rs b/noir/tooling/backend_interface/src/lib.rs new file mode 100644 index 00000000000..6c91c181a92 --- /dev/null +++ b/noir/tooling/backend_interface/src/lib.rs @@ -0,0 +1,170 @@ +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] + +use std::{collections::HashSet, path::PathBuf}; + +mod cli; +mod download; +mod proof_system; +mod smart_contract; + +use acvm::acir::circuit::Opcode; +use bb_abstraction_leaks::ACVM_BACKEND_BARRETENBERG; +use bb_abstraction_leaks::BB_VERSION; +use cli::VersionCommand; +pub use download::download_backend; + +const BACKENDS_DIR: &str = ".nargo/backends"; + +pub fn backends_directory() -> PathBuf { + let home_directory = dirs::home_dir().unwrap(); + home_directory.join(BACKENDS_DIR) +} + +#[cfg(test)] +test_binary::build_test_binary_once!(mock_backend, "test-binaries"); + +#[cfg(test)] +fn get_mock_backend() -> Result { + std::env::set_var("NARGO_BACKEND_PATH", path_to_mock_backend()); + + let mock_backend = Backend::new("mock_backend".to_string()); + mock_backend.assert_binary_exists()?; + + Ok(mock_backend) +} + +#[derive(Debug, thiserror::Error)] +pub enum BackendError { + #[error(transparent)] + IoError(#[from] std::io::Error), + + #[error("Backend binary does not exist")] + MissingBinary, + + #[error("The backend responded with a malformed UTF8 byte vector: {0:?}")] + InvalidUTF8Vector(Vec), + + #[error( + "The backend responded with a unexpected number of bytes. Expected: {0} but got {} ({1:?})", .1.len() + )] + UnexpectedNumberOfBytes(usize, Vec), + + #[error("The backend encountered an error: {0:?}")] + CommandFailed(String), +} + +#[derive(Debug)] +pub struct Backend { + name: String, + binary_path: PathBuf, +} + +impl Backend { + pub fn new(name: String) -> Backend { + let binary_path = if let Some(binary_path) = std::env::var_os("NARGO_BACKEND_PATH") { + PathBuf::from(binary_path) + } else { + const BINARY_NAME: &str = "backend_binary"; + + backends_directory().join(&name).join(BINARY_NAME) + }; + Backend { name, binary_path } + } + + pub fn name(&self) -> &str { + &self.name + } + + fn binary_path(&self) -> &PathBuf { + &self.binary_path + } + + fn assert_binary_exists(&self) -> Result<&PathBuf, BackendError> { + let binary_path = self.binary_path(); + if binary_path.is_file() { + Ok(binary_path) + } else { + if self.name == ACVM_BACKEND_BARRETENBERG { + // If we're trying to use barretenberg, automatically go and install it. + let bb_url = std::env::var("BB_BINARY_URL") + .unwrap_or_else(|_| bb_abstraction_leaks::BB_DOWNLOAD_URL.to_owned()); + download_backend(&bb_url, binary_path)?; + return Ok(binary_path); + } + Err(BackendError::MissingBinary) + } + } + + fn backend_directory(&self) -> PathBuf { + self.binary_path() + .parent() + .expect("backend binary should have a parent directory") + .to_path_buf() + } + + fn crs_directory(&self) -> PathBuf { + self.backend_directory().join("crs") + } + + fn assert_correct_version(&self) -> Result<&PathBuf, BackendError> { + let binary_path = self.binary_path(); + if binary_path.to_string_lossy().contains(ACVM_BACKEND_BARRETENBERG) { + match VersionCommand.run(binary_path) { + // If version matches then do nothing. + Ok(version_string) if version_string == BB_VERSION => (), + + // If version doesn't match then download the correct version. + Ok(version_string) => { + println!("`{ACVM_BACKEND_BARRETENBERG}` version `{version_string}` is different from expected `{BB_VERSION}`. Downloading expected version..."); + let bb_url = std::env::var("BB_BINARY_URL") + .unwrap_or_else(|_| bb_abstraction_leaks::BB_DOWNLOAD_URL.to_owned()); + download_backend(&bb_url, binary_path)?; + } + + // If `bb` fails to report its version, then attempt to fix it by re-downloading the binary. + Err(_) => { + println!("Could not determine version of `{ACVM_BACKEND_BARRETENBERG}`. Downloading expected version..."); + let bb_url = std::env::var("BB_BINARY_URL") + .unwrap_or_else(|_| bb_abstraction_leaks::BB_DOWNLOAD_URL.to_owned()); + download_backend(&bb_url, binary_path)?; + } + } + } + Ok(binary_path) + } +} + +pub struct BackendOpcodeSupport { + opcodes: HashSet, + black_box_functions: HashSet, +} + +impl BackendOpcodeSupport { + pub fn is_opcode_supported(&self, opcode: &Opcode) -> bool { + match opcode { + Opcode::Arithmetic(_) => self.opcodes.contains("arithmetic"), + Opcode::Directive(_) => self.opcodes.contains("directive"), + Opcode::Brillig(_) => self.opcodes.contains("brillig"), + Opcode::MemoryInit { .. } => self.opcodes.contains("memory_init"), + Opcode::MemoryOp { .. } => self.opcodes.contains("memory_op"), + Opcode::BlackBoxFuncCall(func) => { + self.black_box_functions.contains(func.get_black_box_func().name()) + } + } + } +} + +#[cfg(test)] +mod backend { + use crate::{Backend, BackendError}; + + #[test] + fn raises_error_on_missing_binary() { + let bad_backend = Backend::new("i_dont_exist".to_string()); + + let binary_path = bad_backend.assert_binary_exists(); + + assert!(matches!(binary_path, Err(BackendError::MissingBinary))); + } +} diff --git a/noir/tooling/backend_interface/src/proof_system.rs b/noir/tooling/backend_interface/src/proof_system.rs new file mode 100644 index 00000000000..95da1462d4e --- /dev/null +++ b/noir/tooling/backend_interface/src/proof_system.rs @@ -0,0 +1,176 @@ +use std::fs::File; +use std::io::Write; +use std::path::Path; + +use acvm::acir::{circuit::Circuit, native_types::WitnessMap}; +use acvm::FieldElement; +use acvm::Language; +use tempfile::tempdir; + +use crate::cli::{ + GatesCommand, InfoCommand, ProofAsFieldsCommand, ProveCommand, VerifyCommand, + VkAsFieldsCommand, WriteVkCommand, +}; +use crate::{Backend, BackendError, BackendOpcodeSupport}; + +impl Backend { + pub fn get_exact_circuit_size(&self, circuit: &Circuit) -> Result { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory = temp_directory.path().to_path_buf(); + + // Create a temporary file for the circuit + let circuit_path = temp_directory.join("circuit").with_extension("bytecode"); + let serialized_circuit = Circuit::serialize_circuit(circuit); + write_to_file(&serialized_circuit, &circuit_path); + + GatesCommand { crs_path: self.crs_directory(), bytecode_path: circuit_path } + .run(binary_path) + } + + pub fn get_backend_info(&self) -> Result<(Language, BackendOpcodeSupport), BackendError> { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + InfoCommand { crs_path: self.crs_directory() }.run(binary_path) + } + + pub fn prove( + &self, + circuit: &Circuit, + witness_values: WitnessMap, + is_recursive: bool, + ) -> Result, BackendError> { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory = temp_directory.path().to_path_buf(); + + // Create a temporary file for the witness + let serialized_witnesses: Vec = + witness_values.try_into().expect("could not serialize witness map"); + let witness_path = temp_directory.join("witness").with_extension("tr"); + write_to_file(&serialized_witnesses, &witness_path); + + // Create a temporary file for the circuit + // + let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); + let serialized_circuit = Circuit::serialize_circuit(circuit); + write_to_file(&serialized_circuit, &bytecode_path); + + // Create proof and store it in the specified path + let proof_with_public_inputs = ProveCommand { + crs_path: self.crs_directory(), + is_recursive, + bytecode_path, + witness_path, + } + .run(binary_path)?; + + let proof = bb_abstraction_leaks::remove_public_inputs( + circuit.public_inputs().0.len(), + &proof_with_public_inputs, + ); + Ok(proof) + } + + pub fn verify( + &self, + proof: &[u8], + public_inputs: WitnessMap, + circuit: &Circuit, + is_recursive: bool, + ) -> Result { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory = temp_directory.path().to_path_buf(); + + // Create a temporary file for the proof + let proof_with_public_inputs = + bb_abstraction_leaks::prepend_public_inputs(proof.to_vec(), public_inputs); + let proof_path = temp_directory.join("proof").with_extension("proof"); + write_to_file(&proof_with_public_inputs, &proof_path); + + // Create a temporary file for the circuit + let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); + let serialized_circuit = Circuit::serialize_circuit(circuit); + write_to_file(&serialized_circuit, &bytecode_path); + + // Create the verification key and write it to the specified path + let vk_path = temp_directory.join("vk"); + + WriteVkCommand { + crs_path: self.crs_directory(), + bytecode_path, + vk_path_output: vk_path.clone(), + } + .run(binary_path)?; + + // Verify the proof + VerifyCommand { crs_path: self.crs_directory(), is_recursive, proof_path, vk_path } + .run(binary_path) + } + + pub fn get_intermediate_proof_artifacts( + &self, + circuit: &Circuit, + proof: &[u8], + public_inputs: WitnessMap, + ) -> Result<(Vec, FieldElement, Vec), BackendError> { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory = temp_directory.path().to_path_buf(); + + // Create a temporary file for the circuit + // + let bytecode_path = temp_directory.join("circuit").with_extension("bytecode"); + let serialized_circuit = Circuit::serialize_circuit(circuit); + write_to_file(&serialized_circuit, &bytecode_path); + + // Create the verification key and write it to the specified path + let vk_path = temp_directory.join("vk"); + + WriteVkCommand { + crs_path: self.crs_directory(), + bytecode_path, + vk_path_output: vk_path.clone(), + } + .run(binary_path)?; + + // Create a temporary file for the proof + + let proof_with_public_inputs = + bb_abstraction_leaks::prepend_public_inputs(proof.to_vec(), public_inputs); + let proof_path = temp_directory.join("proof").with_extension("proof"); + write_to_file(&proof_with_public_inputs, &proof_path); + + // Now ready to generate intermediate artifacts. + + let proof_as_fields = + ProofAsFieldsCommand { proof_path, vk_path: vk_path.clone() }.run(binary_path)?; + + let (vk_hash, vk_as_fields) = VkAsFieldsCommand { vk_path }.run(binary_path)?; + + Ok((proof_as_fields, vk_hash, vk_as_fields)) + } +} + +pub(super) fn write_to_file(bytes: &[u8], path: &Path) -> String { + let display = path.display(); + + let mut file = match File::create(path) { + Err(why) => panic!("couldn't create {display}: {why}"), + Ok(file) => file, + }; + + match file.write_all(bytes) { + Err(why) => panic!("couldn't write to {display}: {why}"), + Ok(_) => display.to_string(), + } +} diff --git a/noir/tooling/backend_interface/src/smart_contract.rs b/noir/tooling/backend_interface/src/smart_contract.rs new file mode 100644 index 00000000000..5dac57c4072 --- /dev/null +++ b/noir/tooling/backend_interface/src/smart_contract.rs @@ -0,0 +1,67 @@ +use super::proof_system::write_to_file; +use crate::{ + cli::{ContractCommand, WriteVkCommand}, + Backend, BackendError, +}; +use acvm::acir::circuit::Circuit; +use tempfile::tempdir; + +impl Backend { + pub fn eth_contract(&self, circuit: &Circuit) -> Result { + let binary_path = self.assert_binary_exists()?; + self.assert_correct_version()?; + + let temp_directory = tempdir().expect("could not create a temporary directory"); + let temp_directory_path = temp_directory.path().to_path_buf(); + + // Create a temporary file for the circuit + let bytecode_path = temp_directory_path.join("circuit").with_extension("bytecode"); + let serialized_circuit = Circuit::serialize_circuit(circuit); + write_to_file(&serialized_circuit, &bytecode_path); + + // Create the verification key and write it to the specified path + let vk_path = temp_directory_path.join("vk"); + + WriteVkCommand { + crs_path: self.crs_directory(), + bytecode_path, + vk_path_output: vk_path.clone(), + } + .run(binary_path)?; + + ContractCommand { crs_path: self.crs_directory(), vk_path }.run(binary_path) + } +} + +#[cfg(test)] +mod tests { + use std::collections::BTreeSet; + + use acvm::acir::{ + circuit::{Circuit, Opcode, PublicInputs}, + native_types::{Expression, Witness}, + }; + + use crate::{get_mock_backend, BackendError}; + + #[test] + fn test_smart_contract() -> Result<(), BackendError> { + let expression = &(Witness(1) + Witness(2)) - &Expression::from(Witness(3)); + let constraint = Opcode::Arithmetic(expression); + + let circuit = Circuit { + current_witness_index: 4, + opcodes: vec![constraint], + private_parameters: BTreeSet::from([Witness(1), Witness(2)]), + public_parameters: PublicInputs::default(), + return_values: PublicInputs::default(), + assert_messages: Default::default(), + }; + + let contract = get_mock_backend()?.eth_contract(&circuit)?; + + assert!(contract.contains("contract VerifierContract")); + + Ok(()) + } +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.lock b/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.lock new file mode 100644 index 00000000000..c43d1b84915 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.lock @@ -0,0 +1,306 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "clap" +version = "4.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + +[[package]] +name = "mock_backend" +version = "0.1.0" +dependencies = [ + "clap", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "2.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.toml b/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.toml new file mode 100644 index 00000000000..f527b03a7b9 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] + +[package] +name = "mock_backend" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = { version = "4.3.19", features = ["derive"] } diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/contract_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/contract_cmd.rs new file mode 100644 index 00000000000..7ee41121d61 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/contract_cmd.rs @@ -0,0 +1,21 @@ +use clap::Args; +use std::io::Write; +use std::path::PathBuf; + +#[derive(Debug, Clone, Args)] +pub(crate) struct ContractCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'k')] + pub(crate) vk_path: PathBuf, + + #[clap(short = 'o')] + pub(crate) contract_path: PathBuf, +} + +pub(crate) fn run(args: ContractCommand) { + assert!(args.vk_path.is_file(), "Could not find vk file at provided path"); + + std::io::stdout().write_all(b"contract VerifierContract {}").unwrap(); +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/gates_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/gates_cmd.rs new file mode 100644 index 00000000000..3cc397d3292 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/gates_cmd.rs @@ -0,0 +1,18 @@ +use clap::Args; +use std::io::Write; +use std::path::PathBuf; + +#[derive(Debug, Clone, Args)] +pub(crate) struct GatesCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'b')] + pub(crate) bytecode_path: PathBuf, +} + +pub(crate) fn run(args: GatesCommand) { + assert!(args.bytecode_path.is_file(), "Could not find bytecode file at provided path"); + + std::io::stdout().write_all(&0u64.to_le_bytes()).unwrap(); +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/info_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/info_cmd.rs new file mode 100644 index 00000000000..e9a7842ba24 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/info_cmd.rs @@ -0,0 +1,40 @@ +use clap::Args; +use std::io::Write; +use std::path::PathBuf; + +const INFO_RESPONSE: &str = r#"{ + "language": { + "name": "PLONK-CSAT", + "width": 3 + }, + "opcodes_supported": ["arithmetic", "directive", "brillig", "memory_init", "memory_op"], + "black_box_functions_supported": [ + "and", + "xor", + "range", + "sha256", + "blake2s", + "keccak256", + "schnorr_verify", + "pedersen", + "pedersen_hash", + "hash_to_field_128_security", + "ecdsa_secp256k1", + "ecdsa_secp256r1", + "fixed_base_scalar_mul", + "recursive_aggregation" + ] +}"#; + +#[derive(Debug, Clone, Args)] +pub(crate) struct InfoCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'o')] + pub(crate) info_path: Option, +} + +pub(crate) fn run(_args: InfoCommand) { + std::io::stdout().write_all(INFO_RESPONSE.as_bytes()).unwrap(); +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/main.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/main.rs new file mode 100644 index 00000000000..ef8819af94b --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/main.rs @@ -0,0 +1,44 @@ +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] + +use clap::{Parser, Subcommand}; + +mod contract_cmd; +mod gates_cmd; +mod info_cmd; +mod prove_cmd; +mod verify_cmd; +mod write_vk_cmd; + +#[derive(Parser, Debug)] +#[command(name = "mock_backend")] +struct BackendCli { + #[command(subcommand)] + command: BackendCommand, +} + +#[derive(Subcommand, Clone, Debug)] +enum BackendCommand { + Info(info_cmd::InfoCommand), + Contract(contract_cmd::ContractCommand), + Gates(gates_cmd::GatesCommand), + Prove(prove_cmd::ProveCommand), + Verify(verify_cmd::VerifyCommand), + #[command(name = "write_vk")] + WriteVk(write_vk_cmd::WriteVkCommand), +} + +fn main() { + let BackendCli { command } = BackendCli::parse(); + + match command { + BackendCommand::Info(args) => info_cmd::run(args), + BackendCommand::Contract(args) => contract_cmd::run(args), + BackendCommand::Gates(args) => gates_cmd::run(args), + BackendCommand::Prove(args) => prove_cmd::run(args), + BackendCommand::Verify(args) => verify_cmd::run(args), + BackendCommand::WriteVk(args) => write_vk_cmd::run(args), + }; +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/prove_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/prove_cmd.rs new file mode 100644 index 00000000000..3967778d4e8 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/prove_cmd.rs @@ -0,0 +1,25 @@ +use clap::Args; +use std::io::Write; +use std::path::PathBuf; + +#[derive(Debug, Clone, Args)] +pub(crate) struct ProveCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'b')] + pub(crate) bytecode_path: PathBuf, + + #[clap(short = 'w')] + pub(crate) witness_path: PathBuf, + + #[clap(short = 'o')] + pub(crate) proof_path: PathBuf, +} + +pub(crate) fn run(args: ProveCommand) { + assert!(args.bytecode_path.is_file(), "Could not find bytecode file at provided path"); + assert!(args.witness_path.is_file(), "Could not find witness file at provided path"); + + std::io::stdout().write_all(b"proof").unwrap(); +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/verify_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/verify_cmd.rs new file mode 100644 index 00000000000..1a715eea880 --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/verify_cmd.rs @@ -0,0 +1,24 @@ +use clap::Args; +use std::path::PathBuf; + +#[derive(Debug, Clone, Args)] +pub(crate) struct VerifyCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'p')] + pub(crate) proof_path: PathBuf, + + #[clap(short = 'k')] + pub(crate) vk_path: PathBuf, + + #[clap(short = 'r')] + pub(crate) is_recursive: bool, +} + +pub(crate) fn run(args: VerifyCommand) { + assert!(args.vk_path.is_file(), "Could not find verification key file at provided path"); + assert!(args.proof_path.is_file(), "Could not find proof file at provided path"); + + std::fs::write(args.proof_path, "proof").unwrap(); +} diff --git a/noir/tooling/backend_interface/test-binaries/mock_backend/src/write_vk_cmd.rs b/noir/tooling/backend_interface/test-binaries/mock_backend/src/write_vk_cmd.rs new file mode 100644 index 00000000000..fcee224e85b --- /dev/null +++ b/noir/tooling/backend_interface/test-binaries/mock_backend/src/write_vk_cmd.rs @@ -0,0 +1,20 @@ +use clap::Args; +use std::path::PathBuf; + +#[derive(Debug, Clone, Args)] +pub(crate) struct WriteVkCommand { + #[clap(short = 'c')] + pub(crate) crs_path: Option, + + #[clap(short = 'b')] + pub(crate) bytecode_path: PathBuf, + + #[clap(short = 'o')] + pub(crate) vk_path: PathBuf, +} + +pub(crate) fn run(args: WriteVkCommand) { + assert!(args.bytecode_path.is_file(), "Could not find bytecode file at provided path"); + + std::fs::write(args.vk_path, "vk").unwrap(); +} diff --git a/noir/tooling/bb_abstraction_leaks/Cargo.toml b/noir/tooling/bb_abstraction_leaks/Cargo.toml new file mode 100644 index 00000000000..972c78831a7 --- /dev/null +++ b/noir/tooling/bb_abstraction_leaks/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "bb_abstraction_leaks" +description = "A crate which encapsulates knowledge about Barretenberg which is currently leaking into Nargo" +version = "0.11.0" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +acvm.workspace = true + +[build-dependencies] +build-target = "0.4.0" +const_format.workspace = true diff --git a/noir/tooling/bb_abstraction_leaks/build.rs b/noir/tooling/bb_abstraction_leaks/build.rs new file mode 100644 index 00000000000..fe6861a80b8 --- /dev/null +++ b/noir/tooling/bb_abstraction_leaks/build.rs @@ -0,0 +1,55 @@ +use build_target::{Arch, Os}; +use const_format::formatcp; + +// Useful for printing debugging messages during the build +// macro_rules! p { +// ($($tokens: tt)*) => { +// println!("cargo:warning={}", format!($($tokens)*)) +// } +// } + +const USERNAME: &str = "AztecProtocol"; +const REPO: &str = "aztec-packages"; +const VERSION: &str = "0.12.0"; +const TAG: &str = formatcp!("aztec-packages-v{}", VERSION); + +const API_URL: &str = + formatcp!("https://github.com/{}/{}/releases/download/{}", USERNAME, REPO, TAG); + +fn main() -> Result<(), String> { + // We need to inject which OS we're building for so that we can download the correct barretenberg binary. + let os = match build_target::target_os().unwrap() { + os @ (Os::Linux | Os::MacOs) => os, + Os::Windows => todo!("Windows is not currently supported"), + os_name => panic!("Unsupported OS {os_name}"), + }; + + let arch = match build_target::target_arch().unwrap() { + arch @ (Arch::X86_64 | Arch::AARCH64) => arch, + arch_name => panic!("Unsupported Architecture {arch_name}"), + }; + + // Arm builds of linux are not supported + if let (Os::Linux, Arch::AARCH64) = (&os, &arch) { + panic!("ARM64 builds of linux are not supported") + }; + + println!("cargo:rustc-env=BB_BINARY_URL={}", get_bb_download_url(arch, os)); + println!("cargo:rustc-env=BB_VERSION={}", VERSION); + + Ok(()) +} + +fn get_bb_download_url(target_arch: Arch, target_os: Os) -> String { + let archive_name = match target_os { + Os::Linux => "barretenberg-x86_64-linux-gnu.tar.gz", + Os::MacOs => match target_arch { + Arch::AARCH64 => "barretenberg-aarch64-apple-darwin.tar.gz", + Arch::X86_64 => "barretenberg-x86_64-apple-darwin.tar.gz", + arch => panic!("unsupported arch {arch}"), + }, + os => panic!("Unsupported OS {os}"), + }; + + format!("{API_URL}/{archive_name}") +} diff --git a/noir/tooling/bb_abstraction_leaks/src/contract.sol b/noir/tooling/bb_abstraction_leaks/src/contract.sol new file mode 100644 index 00000000000..814c81d235e --- /dev/null +++ b/noir/tooling/bb_abstraction_leaks/src/contract.sol @@ -0,0 +1,2575 @@ +/** + * @title Ultra Plonk proof verification contract + * @dev Top level Plonk proof verification contract, which allows Plonk proof to be verified + */ +abstract contract BaseUltraVerifier { + // VERIFICATION KEY MEMORY LOCATIONS + uint256 internal constant N_LOC = 0x380; + uint256 internal constant NUM_INPUTS_LOC = 0x3a0; + uint256 internal constant OMEGA_LOC = 0x3c0; + uint256 internal constant DOMAIN_INVERSE_LOC = 0x3e0; + uint256 internal constant Q1_X_LOC = 0x400; + uint256 internal constant Q1_Y_LOC = 0x420; + uint256 internal constant Q2_X_LOC = 0x440; + uint256 internal constant Q2_Y_LOC = 0x460; + uint256 internal constant Q3_X_LOC = 0x480; + uint256 internal constant Q3_Y_LOC = 0x4a0; + uint256 internal constant Q4_X_LOC = 0x4c0; + uint256 internal constant Q4_Y_LOC = 0x4e0; + uint256 internal constant QM_X_LOC = 0x500; + uint256 internal constant QM_Y_LOC = 0x520; + uint256 internal constant QC_X_LOC = 0x540; + uint256 internal constant QC_Y_LOC = 0x560; + uint256 internal constant QARITH_X_LOC = 0x580; + uint256 internal constant QARITH_Y_LOC = 0x5a0; + uint256 internal constant QSORT_X_LOC = 0x5c0; + uint256 internal constant QSORT_Y_LOC = 0x5e0; + uint256 internal constant QELLIPTIC_X_LOC = 0x600; + uint256 internal constant QELLIPTIC_Y_LOC = 0x620; + uint256 internal constant QAUX_X_LOC = 0x640; + uint256 internal constant QAUX_Y_LOC = 0x660; + uint256 internal constant SIGMA1_X_LOC = 0x680; + uint256 internal constant SIGMA1_Y_LOC = 0x6a0; + uint256 internal constant SIGMA2_X_LOC = 0x6c0; + uint256 internal constant SIGMA2_Y_LOC = 0x6e0; + uint256 internal constant SIGMA3_X_LOC = 0x700; + uint256 internal constant SIGMA3_Y_LOC = 0x720; + uint256 internal constant SIGMA4_X_LOC = 0x740; + uint256 internal constant SIGMA4_Y_LOC = 0x760; + uint256 internal constant TABLE1_X_LOC = 0x780; + uint256 internal constant TABLE1_Y_LOC = 0x7a0; + uint256 internal constant TABLE2_X_LOC = 0x7c0; + uint256 internal constant TABLE2_Y_LOC = 0x7e0; + uint256 internal constant TABLE3_X_LOC = 0x800; + uint256 internal constant TABLE3_Y_LOC = 0x820; + uint256 internal constant TABLE4_X_LOC = 0x840; + uint256 internal constant TABLE4_Y_LOC = 0x860; + uint256 internal constant TABLE_TYPE_X_LOC = 0x880; + uint256 internal constant TABLE_TYPE_Y_LOC = 0x8a0; + uint256 internal constant ID1_X_LOC = 0x8c0; + uint256 internal constant ID1_Y_LOC = 0x8e0; + uint256 internal constant ID2_X_LOC = 0x900; + uint256 internal constant ID2_Y_LOC = 0x920; + uint256 internal constant ID3_X_LOC = 0x940; + uint256 internal constant ID3_Y_LOC = 0x960; + uint256 internal constant ID4_X_LOC = 0x980; + uint256 internal constant ID4_Y_LOC = 0x9a0; + uint256 internal constant CONTAINS_RECURSIVE_PROOF_LOC = 0x9c0; + uint256 internal constant RECURSIVE_PROOF_PUBLIC_INPUT_INDICES_LOC = 0x9e0; + uint256 internal constant G2X_X0_LOC = 0xa00; + uint256 internal constant G2X_X1_LOC = 0xa20; + uint256 internal constant G2X_Y0_LOC = 0xa40; + uint256 internal constant G2X_Y1_LOC = 0xa60; + + // ### PROOF DATA MEMORY LOCATIONS + uint256 internal constant W1_X_LOC = 0x1200; + uint256 internal constant W1_Y_LOC = 0x1220; + uint256 internal constant W2_X_LOC = 0x1240; + uint256 internal constant W2_Y_LOC = 0x1260; + uint256 internal constant W3_X_LOC = 0x1280; + uint256 internal constant W3_Y_LOC = 0x12a0; + uint256 internal constant W4_X_LOC = 0x12c0; + uint256 internal constant W4_Y_LOC = 0x12e0; + uint256 internal constant S_X_LOC = 0x1300; + uint256 internal constant S_Y_LOC = 0x1320; + uint256 internal constant Z_X_LOC = 0x1340; + uint256 internal constant Z_Y_LOC = 0x1360; + uint256 internal constant Z_LOOKUP_X_LOC = 0x1380; + uint256 internal constant Z_LOOKUP_Y_LOC = 0x13a0; + uint256 internal constant T1_X_LOC = 0x13c0; + uint256 internal constant T1_Y_LOC = 0x13e0; + uint256 internal constant T2_X_LOC = 0x1400; + uint256 internal constant T2_Y_LOC = 0x1420; + uint256 internal constant T3_X_LOC = 0x1440; + uint256 internal constant T3_Y_LOC = 0x1460; + uint256 internal constant T4_X_LOC = 0x1480; + uint256 internal constant T4_Y_LOC = 0x14a0; + + uint256 internal constant W1_EVAL_LOC = 0x1600; + uint256 internal constant W2_EVAL_LOC = 0x1620; + uint256 internal constant W3_EVAL_LOC = 0x1640; + uint256 internal constant W4_EVAL_LOC = 0x1660; + uint256 internal constant S_EVAL_LOC = 0x1680; + uint256 internal constant Z_EVAL_LOC = 0x16a0; + uint256 internal constant Z_LOOKUP_EVAL_LOC = 0x16c0; + uint256 internal constant Q1_EVAL_LOC = 0x16e0; + uint256 internal constant Q2_EVAL_LOC = 0x1700; + uint256 internal constant Q3_EVAL_LOC = 0x1720; + uint256 internal constant Q4_EVAL_LOC = 0x1740; + uint256 internal constant QM_EVAL_LOC = 0x1760; + uint256 internal constant QC_EVAL_LOC = 0x1780; + uint256 internal constant QARITH_EVAL_LOC = 0x17a0; + uint256 internal constant QSORT_EVAL_LOC = 0x17c0; + uint256 internal constant QELLIPTIC_EVAL_LOC = 0x17e0; + uint256 internal constant QAUX_EVAL_LOC = 0x1800; + uint256 internal constant TABLE1_EVAL_LOC = 0x1840; + uint256 internal constant TABLE2_EVAL_LOC = 0x1860; + uint256 internal constant TABLE3_EVAL_LOC = 0x1880; + uint256 internal constant TABLE4_EVAL_LOC = 0x18a0; + uint256 internal constant TABLE_TYPE_EVAL_LOC = 0x18c0; + uint256 internal constant ID1_EVAL_LOC = 0x18e0; + uint256 internal constant ID2_EVAL_LOC = 0x1900; + uint256 internal constant ID3_EVAL_LOC = 0x1920; + uint256 internal constant ID4_EVAL_LOC = 0x1940; + uint256 internal constant SIGMA1_EVAL_LOC = 0x1960; + uint256 internal constant SIGMA2_EVAL_LOC = 0x1980; + uint256 internal constant SIGMA3_EVAL_LOC = 0x19a0; + uint256 internal constant SIGMA4_EVAL_LOC = 0x19c0; + uint256 internal constant W1_OMEGA_EVAL_LOC = 0x19e0; + uint256 internal constant W2_OMEGA_EVAL_LOC = 0x2000; + uint256 internal constant W3_OMEGA_EVAL_LOC = 0x2020; + uint256 internal constant W4_OMEGA_EVAL_LOC = 0x2040; + uint256 internal constant S_OMEGA_EVAL_LOC = 0x2060; + uint256 internal constant Z_OMEGA_EVAL_LOC = 0x2080; + uint256 internal constant Z_LOOKUP_OMEGA_EVAL_LOC = 0x20a0; + uint256 internal constant TABLE1_OMEGA_EVAL_LOC = 0x20c0; + uint256 internal constant TABLE2_OMEGA_EVAL_LOC = 0x20e0; + uint256 internal constant TABLE3_OMEGA_EVAL_LOC = 0x2100; + uint256 internal constant TABLE4_OMEGA_EVAL_LOC = 0x2120; + + uint256 internal constant PI_Z_X_LOC = 0x2300; + uint256 internal constant PI_Z_Y_LOC = 0x2320; + uint256 internal constant PI_Z_OMEGA_X_LOC = 0x2340; + uint256 internal constant PI_Z_OMEGA_Y_LOC = 0x2360; + + // Used for elliptic widget. These are alias names for wire + shifted wire evaluations + uint256 internal constant X1_EVAL_LOC = W2_EVAL_LOC; + uint256 internal constant X2_EVAL_LOC = W1_OMEGA_EVAL_LOC; + uint256 internal constant X3_EVAL_LOC = W2_OMEGA_EVAL_LOC; + uint256 internal constant Y1_EVAL_LOC = W3_EVAL_LOC; + uint256 internal constant Y2_EVAL_LOC = W4_OMEGA_EVAL_LOC; + uint256 internal constant Y3_EVAL_LOC = W3_OMEGA_EVAL_LOC; + uint256 internal constant QBETA_LOC = Q3_EVAL_LOC; + uint256 internal constant QBETA_SQR_LOC = Q4_EVAL_LOC; + uint256 internal constant QSIGN_LOC = Q1_EVAL_LOC; + + // ### CHALLENGES MEMORY OFFSETS + + uint256 internal constant C_BETA_LOC = 0x2600; + uint256 internal constant C_GAMMA_LOC = 0x2620; + uint256 internal constant C_ALPHA_LOC = 0x2640; + uint256 internal constant C_ETA_LOC = 0x2660; + uint256 internal constant C_ETA_SQR_LOC = 0x2680; + uint256 internal constant C_ETA_CUBE_LOC = 0x26a0; + + uint256 internal constant C_ZETA_LOC = 0x26c0; + uint256 internal constant C_CURRENT_LOC = 0x26e0; + uint256 internal constant C_V0_LOC = 0x2700; + uint256 internal constant C_V1_LOC = 0x2720; + uint256 internal constant C_V2_LOC = 0x2740; + uint256 internal constant C_V3_LOC = 0x2760; + uint256 internal constant C_V4_LOC = 0x2780; + uint256 internal constant C_V5_LOC = 0x27a0; + uint256 internal constant C_V6_LOC = 0x27c0; + uint256 internal constant C_V7_LOC = 0x27e0; + uint256 internal constant C_V8_LOC = 0x2800; + uint256 internal constant C_V9_LOC = 0x2820; + uint256 internal constant C_V10_LOC = 0x2840; + uint256 internal constant C_V11_LOC = 0x2860; + uint256 internal constant C_V12_LOC = 0x2880; + uint256 internal constant C_V13_LOC = 0x28a0; + uint256 internal constant C_V14_LOC = 0x28c0; + uint256 internal constant C_V15_LOC = 0x28e0; + uint256 internal constant C_V16_LOC = 0x2900; + uint256 internal constant C_V17_LOC = 0x2920; + uint256 internal constant C_V18_LOC = 0x2940; + uint256 internal constant C_V19_LOC = 0x2960; + uint256 internal constant C_V20_LOC = 0x2980; + uint256 internal constant C_V21_LOC = 0x29a0; + uint256 internal constant C_V22_LOC = 0x29c0; + uint256 internal constant C_V23_LOC = 0x29e0; + uint256 internal constant C_V24_LOC = 0x2a00; + uint256 internal constant C_V25_LOC = 0x2a20; + uint256 internal constant C_V26_LOC = 0x2a40; + uint256 internal constant C_V27_LOC = 0x2a60; + uint256 internal constant C_V28_LOC = 0x2a80; + uint256 internal constant C_V29_LOC = 0x2aa0; + uint256 internal constant C_V30_LOC = 0x2ac0; + + uint256 internal constant C_U_LOC = 0x2b00; + + // ### LOCAL VARIABLES MEMORY OFFSETS + uint256 internal constant DELTA_NUMERATOR_LOC = 0x3000; + uint256 internal constant DELTA_DENOMINATOR_LOC = 0x3020; + uint256 internal constant ZETA_POW_N_LOC = 0x3040; + uint256 internal constant PUBLIC_INPUT_DELTA_LOC = 0x3060; + uint256 internal constant ZERO_POLY_LOC = 0x3080; + uint256 internal constant L_START_LOC = 0x30a0; + uint256 internal constant L_END_LOC = 0x30c0; + uint256 internal constant R_ZERO_EVAL_LOC = 0x30e0; + + uint256 internal constant PLOOKUP_DELTA_NUMERATOR_LOC = 0x3100; + uint256 internal constant PLOOKUP_DELTA_DENOMINATOR_LOC = 0x3120; + uint256 internal constant PLOOKUP_DELTA_LOC = 0x3140; + + uint256 internal constant ACCUMULATOR_X_LOC = 0x3160; + uint256 internal constant ACCUMULATOR_Y_LOC = 0x3180; + uint256 internal constant ACCUMULATOR2_X_LOC = 0x31a0; + uint256 internal constant ACCUMULATOR2_Y_LOC = 0x31c0; + uint256 internal constant PAIRING_LHS_X_LOC = 0x31e0; + uint256 internal constant PAIRING_LHS_Y_LOC = 0x3200; + uint256 internal constant PAIRING_RHS_X_LOC = 0x3220; + uint256 internal constant PAIRING_RHS_Y_LOC = 0x3240; + + // ### SUCCESS FLAG MEMORY LOCATIONS + uint256 internal constant GRAND_PRODUCT_SUCCESS_FLAG = 0x3300; + uint256 internal constant ARITHMETIC_TERM_SUCCESS_FLAG = 0x3020; + uint256 internal constant BATCH_OPENING_SUCCESS_FLAG = 0x3340; + uint256 internal constant OPENING_COMMITMENT_SUCCESS_FLAG = 0x3360; + uint256 internal constant PAIRING_PREAMBLE_SUCCESS_FLAG = 0x3380; + uint256 internal constant PAIRING_SUCCESS_FLAG = 0x33a0; + uint256 internal constant RESULT_FLAG = 0x33c0; + + // misc stuff + uint256 internal constant OMEGA_INVERSE_LOC = 0x3400; + uint256 internal constant C_ALPHA_SQR_LOC = 0x3420; + uint256 internal constant C_ALPHA_CUBE_LOC = 0x3440; + uint256 internal constant C_ALPHA_QUAD_LOC = 0x3460; + uint256 internal constant C_ALPHA_BASE_LOC = 0x3480; + + // ### RECURSION VARIABLE MEMORY LOCATIONS + uint256 internal constant RECURSIVE_P1_X_LOC = 0x3500; + uint256 internal constant RECURSIVE_P1_Y_LOC = 0x3520; + uint256 internal constant RECURSIVE_P2_X_LOC = 0x3540; + uint256 internal constant RECURSIVE_P2_Y_LOC = 0x3560; + + uint256 internal constant PUBLIC_INPUTS_HASH_LOCATION = 0x3580; + + // sub-identity storage + uint256 internal constant PERMUTATION_IDENTITY = 0x3600; + uint256 internal constant PLOOKUP_IDENTITY = 0x3620; + uint256 internal constant ARITHMETIC_IDENTITY = 0x3640; + uint256 internal constant SORT_IDENTITY = 0x3660; + uint256 internal constant ELLIPTIC_IDENTITY = 0x3680; + uint256 internal constant AUX_IDENTITY = 0x36a0; + uint256 internal constant AUX_NON_NATIVE_FIELD_EVALUATION = 0x36c0; + uint256 internal constant AUX_LIMB_ACCUMULATOR_EVALUATION = 0x36e0; + uint256 internal constant AUX_RAM_CONSISTENCY_EVALUATION = 0x3700; + uint256 internal constant AUX_ROM_CONSISTENCY_EVALUATION = 0x3720; + uint256 internal constant AUX_MEMORY_EVALUATION = 0x3740; + + uint256 internal constant QUOTIENT_EVAL_LOC = 0x3760; + uint256 internal constant ZERO_POLY_INVERSE_LOC = 0x3780; + + // when hashing public inputs we use memory at NU_CHALLENGE_INPUT_LOC_A, as the hash input size is unknown at compile time + uint256 internal constant NU_CHALLENGE_INPUT_LOC_A = 0x37a0; + uint256 internal constant NU_CHALLENGE_INPUT_LOC_B = 0x37c0; + uint256 internal constant NU_CHALLENGE_INPUT_LOC_C = 0x37e0; + + bytes4 internal constant PUBLIC_INPUT_INVALID_BN128_G1_POINT_SELECTOR = 0xeba9f4a6; + bytes4 internal constant PUBLIC_INPUT_GE_P_SELECTOR = 0x374a972f; + bytes4 internal constant MOD_EXP_FAILURE_SELECTOR = 0xf894a7bc; + bytes4 internal constant EC_SCALAR_MUL_FAILURE_SELECTOR = 0xf755f369; + bytes4 internal constant PROOF_FAILURE_SELECTOR = 0x0711fcec; + + uint256 internal constant ETA_INPUT_LENGTH = 0xc0; // W1, W2, W3 = 6 * 0x20 bytes + + // We need to hash 41 field elements when generating the NU challenge + // w1, w2, w3, w4, s, z, z_lookup, q1, q2, q3, q4, qm, qc, qarith (14) + // qsort, qelliptic, qaux, sigma1, sigma2, sigma, sigma4, (7) + // table1, table2, table3, table4, tabletype, id1, id2, id3, id4, (9) + // w1_omega, w2_omega, w3_omega, w4_omega, s_omega, z_omega, z_lookup_omega, (7) + // table1_omega, table2_omega, table3_omega, table4_omega (4) + uint256 internal constant NU_INPUT_LENGTH = 0x520; // 0x520 = 41 * 0x20 + + // There are ELEVEN G1 group elements added into the transcript in the `beta` round, that we need to skip over + // W1, W2, W3, W4, S, Z, Z_LOOKUP, T1, T2, T3, T4 + uint256 internal constant NU_CALLDATA_SKIP_LENGTH = 0x2c0; // 11 * 0x40 = 0x2c0 + + uint256 internal constant NEGATIVE_INVERSE_OF_2_MODULO_P = + 0x183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000; + uint256 internal constant LIMB_SIZE = 0x100000000000000000; // 2<<68 + uint256 internal constant SUBLIMB_SHIFT = 0x4000; // 2<<14 + + // y^2 = x^3 + ax + b + // for Grumpkin, a = 0 and b = -17. We use b in a custom gate relation that evaluates elliptic curve arithmetic + uint256 internal constant GRUMPKIN_CURVE_B_PARAMETER_NEGATED = 17; + error PUBLIC_INPUT_COUNT_INVALID(uint256 expected, uint256 actual); + error PUBLIC_INPUT_INVALID_BN128_G1_POINT(); + error PUBLIC_INPUT_GE_P(); + error MOD_EXP_FAILURE(); + error EC_SCALAR_MUL_FAILURE(); + error PROOF_FAILURE(); + + function getVerificationKeyHash() public pure virtual returns (bytes32); + + function loadVerificationKey(uint256 _vk, uint256 _omegaInverseLoc) internal pure virtual; + + /** + * @notice Verify a Ultra Plonk proof + * @param _proof - The serialized proof + * @param _publicInputs - An array of the public inputs + * @return True if proof is valid, reverts otherwise + */ + function verify(bytes calldata _proof, bytes32[] calldata _publicInputs) external view returns (bool) { + loadVerificationKey(N_LOC, OMEGA_INVERSE_LOC); + + uint256 requiredPublicInputCount; + assembly { + requiredPublicInputCount := mload(NUM_INPUTS_LOC) + } + if (requiredPublicInputCount != _publicInputs.length) { + revert PUBLIC_INPUT_COUNT_INVALID(requiredPublicInputCount, _publicInputs.length); + } + + assembly { + let q := 21888242871839275222246405745257275088696311157297823662689037894645226208583 // EC group order + let p := 21888242871839275222246405745257275088548364400416034343698204186575808495617 // Prime field order + + /** + * LOAD PROOF FROM CALLDATA + */ + { + let data_ptr := add(calldataload(0x04), 0x24) + + mstore(W1_Y_LOC, mod(calldataload(data_ptr), q)) + mstore(W1_X_LOC, mod(calldataload(add(data_ptr, 0x20)), q)) + + mstore(W2_Y_LOC, mod(calldataload(add(data_ptr, 0x40)), q)) + mstore(W2_X_LOC, mod(calldataload(add(data_ptr, 0x60)), q)) + + mstore(W3_Y_LOC, mod(calldataload(add(data_ptr, 0x80)), q)) + mstore(W3_X_LOC, mod(calldataload(add(data_ptr, 0xa0)), q)) + + mstore(W4_Y_LOC, mod(calldataload(add(data_ptr, 0xc0)), q)) + mstore(W4_X_LOC, mod(calldataload(add(data_ptr, 0xe0)), q)) + + mstore(S_Y_LOC, mod(calldataload(add(data_ptr, 0x100)), q)) + mstore(S_X_LOC, mod(calldataload(add(data_ptr, 0x120)), q)) + mstore(Z_Y_LOC, mod(calldataload(add(data_ptr, 0x140)), q)) + mstore(Z_X_LOC, mod(calldataload(add(data_ptr, 0x160)), q)) + mstore(Z_LOOKUP_Y_LOC, mod(calldataload(add(data_ptr, 0x180)), q)) + mstore(Z_LOOKUP_X_LOC, mod(calldataload(add(data_ptr, 0x1a0)), q)) + mstore(T1_Y_LOC, mod(calldataload(add(data_ptr, 0x1c0)), q)) + mstore(T1_X_LOC, mod(calldataload(add(data_ptr, 0x1e0)), q)) + + mstore(T2_Y_LOC, mod(calldataload(add(data_ptr, 0x200)), q)) + mstore(T2_X_LOC, mod(calldataload(add(data_ptr, 0x220)), q)) + + mstore(T3_Y_LOC, mod(calldataload(add(data_ptr, 0x240)), q)) + mstore(T3_X_LOC, mod(calldataload(add(data_ptr, 0x260)), q)) + + mstore(T4_Y_LOC, mod(calldataload(add(data_ptr, 0x280)), q)) + mstore(T4_X_LOC, mod(calldataload(add(data_ptr, 0x2a0)), q)) + + mstore(W1_EVAL_LOC, mod(calldataload(add(data_ptr, 0x2c0)), p)) + mstore(W2_EVAL_LOC, mod(calldataload(add(data_ptr, 0x2e0)), p)) + mstore(W3_EVAL_LOC, mod(calldataload(add(data_ptr, 0x300)), p)) + mstore(W4_EVAL_LOC, mod(calldataload(add(data_ptr, 0x320)), p)) + mstore(S_EVAL_LOC, mod(calldataload(add(data_ptr, 0x340)), p)) + mstore(Z_EVAL_LOC, mod(calldataload(add(data_ptr, 0x360)), p)) + mstore(Z_LOOKUP_EVAL_LOC, mod(calldataload(add(data_ptr, 0x380)), p)) + mstore(Q1_EVAL_LOC, mod(calldataload(add(data_ptr, 0x3a0)), p)) + mstore(Q2_EVAL_LOC, mod(calldataload(add(data_ptr, 0x3c0)), p)) + mstore(Q3_EVAL_LOC, mod(calldataload(add(data_ptr, 0x3e0)), p)) + mstore(Q4_EVAL_LOC, mod(calldataload(add(data_ptr, 0x400)), p)) + mstore(QM_EVAL_LOC, mod(calldataload(add(data_ptr, 0x420)), p)) + mstore(QC_EVAL_LOC, mod(calldataload(add(data_ptr, 0x440)), p)) + mstore(QARITH_EVAL_LOC, mod(calldataload(add(data_ptr, 0x460)), p)) + mstore(QSORT_EVAL_LOC, mod(calldataload(add(data_ptr, 0x480)), p)) + mstore(QELLIPTIC_EVAL_LOC, mod(calldataload(add(data_ptr, 0x4a0)), p)) + mstore(QAUX_EVAL_LOC, mod(calldataload(add(data_ptr, 0x4c0)), p)) + + mstore(SIGMA1_EVAL_LOC, mod(calldataload(add(data_ptr, 0x4e0)), p)) + mstore(SIGMA2_EVAL_LOC, mod(calldataload(add(data_ptr, 0x500)), p)) + + mstore(SIGMA3_EVAL_LOC, mod(calldataload(add(data_ptr, 0x520)), p)) + mstore(SIGMA4_EVAL_LOC, mod(calldataload(add(data_ptr, 0x540)), p)) + + mstore(TABLE1_EVAL_LOC, mod(calldataload(add(data_ptr, 0x560)), p)) + mstore(TABLE2_EVAL_LOC, mod(calldataload(add(data_ptr, 0x580)), p)) + mstore(TABLE3_EVAL_LOC, mod(calldataload(add(data_ptr, 0x5a0)), p)) + mstore(TABLE4_EVAL_LOC, mod(calldataload(add(data_ptr, 0x5c0)), p)) + mstore(TABLE_TYPE_EVAL_LOC, mod(calldataload(add(data_ptr, 0x5e0)), p)) + + mstore(ID1_EVAL_LOC, mod(calldataload(add(data_ptr, 0x600)), p)) + mstore(ID2_EVAL_LOC, mod(calldataload(add(data_ptr, 0x620)), p)) + mstore(ID3_EVAL_LOC, mod(calldataload(add(data_ptr, 0x640)), p)) + mstore(ID4_EVAL_LOC, mod(calldataload(add(data_ptr, 0x660)), p)) + + mstore(W1_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x680)), p)) + mstore(W2_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x6a0)), p)) + mstore(W3_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x6c0)), p)) + mstore(W4_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x6e0)), p)) + mstore(S_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x700)), p)) + + mstore(Z_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x720)), p)) + + mstore(Z_LOOKUP_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x740)), p)) + mstore(TABLE1_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x760)), p)) + mstore(TABLE2_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x780)), p)) + mstore(TABLE3_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x7a0)), p)) + mstore(TABLE4_OMEGA_EVAL_LOC, mod(calldataload(add(data_ptr, 0x7c0)), p)) + + mstore(PI_Z_Y_LOC, mod(calldataload(add(data_ptr, 0x7e0)), q)) + mstore(PI_Z_X_LOC, mod(calldataload(add(data_ptr, 0x800)), q)) + + mstore(PI_Z_OMEGA_Y_LOC, mod(calldataload(add(data_ptr, 0x820)), q)) + mstore(PI_Z_OMEGA_X_LOC, mod(calldataload(add(data_ptr, 0x840)), q)) + } + + /** + * LOAD RECURSIVE PROOF INTO MEMORY + */ + { + if mload(CONTAINS_RECURSIVE_PROOF_LOC) { + let public_inputs_ptr := add(calldataload(0x24), 0x24) + let index_counter := add(shl(5, mload(RECURSIVE_PROOF_PUBLIC_INPUT_INDICES_LOC)), public_inputs_ptr) + + let x0 := calldataload(index_counter) + x0 := add(x0, shl(68, calldataload(add(index_counter, 0x20)))) + x0 := add(x0, shl(136, calldataload(add(index_counter, 0x40)))) + x0 := add(x0, shl(204, calldataload(add(index_counter, 0x60)))) + let y0 := calldataload(add(index_counter, 0x80)) + y0 := add(y0, shl(68, calldataload(add(index_counter, 0xa0)))) + y0 := add(y0, shl(136, calldataload(add(index_counter, 0xc0)))) + y0 := add(y0, shl(204, calldataload(add(index_counter, 0xe0)))) + let x1 := calldataload(add(index_counter, 0x100)) + x1 := add(x1, shl(68, calldataload(add(index_counter, 0x120)))) + x1 := add(x1, shl(136, calldataload(add(index_counter, 0x140)))) + x1 := add(x1, shl(204, calldataload(add(index_counter, 0x160)))) + let y1 := calldataload(add(index_counter, 0x180)) + y1 := add(y1, shl(68, calldataload(add(index_counter, 0x1a0)))) + y1 := add(y1, shl(136, calldataload(add(index_counter, 0x1c0)))) + y1 := add(y1, shl(204, calldataload(add(index_counter, 0x1e0)))) + mstore(RECURSIVE_P1_X_LOC, x0) + mstore(RECURSIVE_P1_Y_LOC, y0) + mstore(RECURSIVE_P2_X_LOC, x1) + mstore(RECURSIVE_P2_Y_LOC, y1) + + // validate these are valid bn128 G1 points + if iszero(and(and(lt(x0, q), lt(x1, q)), and(lt(y0, q), lt(y1, q)))) { + mstore(0x00, PUBLIC_INPUT_INVALID_BN128_G1_POINT_SELECTOR) + revert(0x00, 0x04) + } + } + } + + { + /** + * Generate initial challenge + */ + mstore(0x00, shl(224, mload(N_LOC))) + mstore(0x04, shl(224, mload(NUM_INPUTS_LOC))) + let challenge := keccak256(0x00, 0x08) + + /** + * Generate eta challenge + */ + mstore(PUBLIC_INPUTS_HASH_LOCATION, challenge) + // The public input location is stored at 0x24, we then add 0x24 to skip selector and the length of public inputs + let public_inputs_start := add(calldataload(0x24), 0x24) + // copy the public inputs over + let public_input_size := mul(mload(NUM_INPUTS_LOC), 0x20) + calldatacopy(add(PUBLIC_INPUTS_HASH_LOCATION, 0x20), public_inputs_start, public_input_size) + + // copy W1, W2, W3 into challenge. Each point is 0x40 bytes, so load 0xc0 = 3 * 0x40 bytes (ETA input length) + let w_start := add(calldataload(0x04), 0x24) + calldatacopy(add(add(PUBLIC_INPUTS_HASH_LOCATION, 0x20), public_input_size), w_start, ETA_INPUT_LENGTH) + + // Challenge is the old challenge + public inputs + W1, W2, W3 (0x20 + public_input_size + 0xc0) + let challenge_bytes_size := add(0x20, add(public_input_size, ETA_INPUT_LENGTH)) + + challenge := keccak256(PUBLIC_INPUTS_HASH_LOCATION, challenge_bytes_size) + { + let eta := mod(challenge, p) + mstore(C_ETA_LOC, eta) + mstore(C_ETA_SQR_LOC, mulmod(eta, eta, p)) + mstore(C_ETA_CUBE_LOC, mulmod(mload(C_ETA_SQR_LOC), eta, p)) + } + + /** + * Generate beta challenge + */ + mstore(0x00, challenge) + mstore(0x20, mload(W4_Y_LOC)) + mstore(0x40, mload(W4_X_LOC)) + mstore(0x60, mload(S_Y_LOC)) + mstore(0x80, mload(S_X_LOC)) + challenge := keccak256(0x00, 0xa0) + mstore(C_BETA_LOC, mod(challenge, p)) + + /** + * Generate gamma challenge + */ + mstore(0x00, challenge) + mstore8(0x20, 0x01) + challenge := keccak256(0x00, 0x21) + mstore(C_GAMMA_LOC, mod(challenge, p)) + + /** + * Generate alpha challenge + */ + mstore(0x00, challenge) + mstore(0x20, mload(Z_Y_LOC)) + mstore(0x40, mload(Z_X_LOC)) + mstore(0x60, mload(Z_LOOKUP_Y_LOC)) + mstore(0x80, mload(Z_LOOKUP_X_LOC)) + challenge := keccak256(0x00, 0xa0) + mstore(C_ALPHA_LOC, mod(challenge, p)) + + /** + * Compute and store some powers of alpha for future computations + */ + let alpha := mload(C_ALPHA_LOC) + mstore(C_ALPHA_SQR_LOC, mulmod(alpha, alpha, p)) + mstore(C_ALPHA_CUBE_LOC, mulmod(mload(C_ALPHA_SQR_LOC), alpha, p)) + mstore(C_ALPHA_QUAD_LOC, mulmod(mload(C_ALPHA_CUBE_LOC), alpha, p)) + mstore(C_ALPHA_BASE_LOC, alpha) + + /** + * Generate zeta challenge + */ + mstore(0x00, challenge) + mstore(0x20, mload(T1_Y_LOC)) + mstore(0x40, mload(T1_X_LOC)) + mstore(0x60, mload(T2_Y_LOC)) + mstore(0x80, mload(T2_X_LOC)) + mstore(0xa0, mload(T3_Y_LOC)) + mstore(0xc0, mload(T3_X_LOC)) + mstore(0xe0, mload(T4_Y_LOC)) + mstore(0x100, mload(T4_X_LOC)) + + challenge := keccak256(0x00, 0x120) + + mstore(C_ZETA_LOC, mod(challenge, p)) + mstore(C_CURRENT_LOC, challenge) + } + + /** + * EVALUATE FIELD OPERATIONS + */ + + /** + * COMPUTE PUBLIC INPUT DELTA + * ΔPI = ∏ᵢ∈ℓ(wᵢ + β σ(i) + γ) / ∏ᵢ∈ℓ(wᵢ + β σ'(i) + γ) + */ + { + let beta := mload(C_BETA_LOC) // β + let gamma := mload(C_GAMMA_LOC) // γ + let work_root := mload(OMEGA_LOC) // ω + let numerator_value := 1 + let denominator_value := 1 + + let p_clone := p // move p to the front of the stack + let valid_inputs := true + + // Load the starting point of the public inputs (jump over the selector and the length of public inputs [0x24]) + let public_inputs_ptr := add(calldataload(0x24), 0x24) + + // endpoint_ptr = public_inputs_ptr + num_inputs * 0x20. // every public input is 0x20 bytes + let endpoint_ptr := add(public_inputs_ptr, mul(mload(NUM_INPUTS_LOC), 0x20)) + + // root_1 = β * 0x05 + let root_1 := mulmod(beta, 0x05, p_clone) // k1.β + // root_2 = β * 0x0c + let root_2 := mulmod(beta, 0x0c, p_clone) + // @note 0x05 + 0x07 == 0x0c == external coset generator + + for {} lt(public_inputs_ptr, endpoint_ptr) { public_inputs_ptr := add(public_inputs_ptr, 0x20) } { + /** + * input = public_input[i] + * valid_inputs &= input < p + * temp = input + gamma + * numerator_value *= (β.σ(i) + wᵢ + γ) // σ(i) = 0x05.ωⁱ + * denominator_value *= (β.σ'(i) + wᵢ + γ) // σ'(i) = 0x0c.ωⁱ + * root_1 *= ω + * root_2 *= ω + */ + + let input := calldataload(public_inputs_ptr) + valid_inputs := and(valid_inputs, lt(input, p_clone)) + let temp := addmod(input, gamma, p_clone) + + numerator_value := mulmod(numerator_value, add(root_1, temp), p_clone) + denominator_value := mulmod(denominator_value, add(root_2, temp), p_clone) + + root_1 := mulmod(root_1, work_root, p_clone) + root_2 := mulmod(root_2, work_root, p_clone) + } + + // Revert if not all public inputs are field elements (i.e. < p) + if iszero(valid_inputs) { + mstore(0x00, PUBLIC_INPUT_GE_P_SELECTOR) + revert(0x00, 0x04) + } + + mstore(DELTA_NUMERATOR_LOC, numerator_value) + mstore(DELTA_DENOMINATOR_LOC, denominator_value) + } + + /** + * Compute Plookup delta factor [γ(1 + β)]^{n-k} + * k = num roots cut out of Z_H = 4 + */ + { + let delta_base := mulmod(mload(C_GAMMA_LOC), addmod(mload(C_BETA_LOC), 1, p), p) + let delta_numerator := delta_base + { + let exponent := mload(N_LOC) + let count := 1 + for {} lt(count, exponent) { count := add(count, count) } { + delta_numerator := mulmod(delta_numerator, delta_numerator, p) + } + } + mstore(PLOOKUP_DELTA_NUMERATOR_LOC, delta_numerator) + + let delta_denominator := mulmod(delta_base, delta_base, p) + delta_denominator := mulmod(delta_denominator, delta_denominator, p) + mstore(PLOOKUP_DELTA_DENOMINATOR_LOC, delta_denominator) + } + /** + * Compute lagrange poly and vanishing poly fractions + */ + { + /** + * vanishing_numerator = zeta + * ZETA_POW_N = zeta^n + * vanishing_numerator -= 1 + * accumulating_root = omega_inverse + * work_root = p - accumulating_root + * domain_inverse = domain_inverse + * vanishing_denominator = zeta + work_root + * work_root *= accumulating_root + * vanishing_denominator *= (zeta + work_root) + * work_root *= accumulating_root + * vanishing_denominator *= (zeta + work_root) + * vanishing_denominator *= (zeta + (zeta + accumulating_root)) + * work_root = omega + * lagrange_numerator = vanishing_numerator * domain_inverse + * l_start_denominator = zeta - 1 + * accumulating_root = work_root^2 + * l_end_denominator = accumulating_root^2 * work_root * zeta - 1 + * Note: l_end_denominator term contains a term \omega^5 to cut out 5 roots of unity from vanishing poly + */ + + let zeta := mload(C_ZETA_LOC) + + // compute zeta^n, where n is a power of 2 + let vanishing_numerator := zeta + { + // pow_small + let exponent := mload(N_LOC) + let count := 1 + for {} lt(count, exponent) { count := add(count, count) } { + vanishing_numerator := mulmod(vanishing_numerator, vanishing_numerator, p) + } + } + mstore(ZETA_POW_N_LOC, vanishing_numerator) + vanishing_numerator := addmod(vanishing_numerator, sub(p, 1), p) + + let accumulating_root := mload(OMEGA_INVERSE_LOC) + let work_root := sub(p, accumulating_root) + let domain_inverse := mload(DOMAIN_INVERSE_LOC) + + let vanishing_denominator := addmod(zeta, work_root, p) + work_root := mulmod(work_root, accumulating_root, p) + vanishing_denominator := mulmod(vanishing_denominator, addmod(zeta, work_root, p), p) + work_root := mulmod(work_root, accumulating_root, p) + vanishing_denominator := mulmod(vanishing_denominator, addmod(zeta, work_root, p), p) + vanishing_denominator := + mulmod(vanishing_denominator, addmod(zeta, mulmod(work_root, accumulating_root, p), p), p) + + work_root := mload(OMEGA_LOC) + + let lagrange_numerator := mulmod(vanishing_numerator, domain_inverse, p) + let l_start_denominator := addmod(zeta, sub(p, 1), p) + + accumulating_root := mulmod(work_root, work_root, p) + + let l_end_denominator := + addmod( + mulmod(mulmod(mulmod(accumulating_root, accumulating_root, p), work_root, p), zeta, p), sub(p, 1), p + ) + + /** + * Compute inversions using Montgomery's batch inversion trick + */ + let accumulator := mload(DELTA_DENOMINATOR_LOC) + let t0 := accumulator + accumulator := mulmod(accumulator, vanishing_denominator, p) + let t1 := accumulator + accumulator := mulmod(accumulator, vanishing_numerator, p) + let t2 := accumulator + accumulator := mulmod(accumulator, l_start_denominator, p) + let t3 := accumulator + accumulator := mulmod(accumulator, mload(PLOOKUP_DELTA_DENOMINATOR_LOC), p) + let t4 := accumulator + { + mstore(0, 0x20) + mstore(0x20, 0x20) + mstore(0x40, 0x20) + mstore(0x60, mulmod(accumulator, l_end_denominator, p)) + mstore(0x80, sub(p, 2)) + mstore(0xa0, p) + if iszero(staticcall(gas(), 0x05, 0x00, 0xc0, 0x00, 0x20)) { + mstore(0x0, MOD_EXP_FAILURE_SELECTOR) + revert(0x00, 0x04) + } + accumulator := mload(0x00) + } + + t4 := mulmod(accumulator, t4, p) + accumulator := mulmod(accumulator, l_end_denominator, p) + + t3 := mulmod(accumulator, t3, p) + accumulator := mulmod(accumulator, mload(PLOOKUP_DELTA_DENOMINATOR_LOC), p) + + t2 := mulmod(accumulator, t2, p) + accumulator := mulmod(accumulator, l_start_denominator, p) + + t1 := mulmod(accumulator, t1, p) + accumulator := mulmod(accumulator, vanishing_numerator, p) + + t0 := mulmod(accumulator, t0, p) + accumulator := mulmod(accumulator, vanishing_denominator, p) + + accumulator := mulmod(mulmod(accumulator, accumulator, p), mload(DELTA_DENOMINATOR_LOC), p) + + mstore(PUBLIC_INPUT_DELTA_LOC, mulmod(mload(DELTA_NUMERATOR_LOC), accumulator, p)) + mstore(ZERO_POLY_LOC, mulmod(vanishing_numerator, t0, p)) + mstore(ZERO_POLY_INVERSE_LOC, mulmod(vanishing_denominator, t1, p)) + mstore(L_START_LOC, mulmod(lagrange_numerator, t2, p)) + mstore(PLOOKUP_DELTA_LOC, mulmod(mload(PLOOKUP_DELTA_NUMERATOR_LOC), t3, p)) + mstore(L_END_LOC, mulmod(lagrange_numerator, t4, p)) + } + + /** + * UltraPlonk Widget Ordering: + * + * 1. Permutation widget + * 2. Plookup widget + * 3. Arithmetic widget + * 4. Fixed base widget (?) + * 5. GenPermSort widget + * 6. Elliptic widget + * 7. Auxiliary widget + */ + + /** + * COMPUTE PERMUTATION WIDGET EVALUATION + */ + { + let alpha := mload(C_ALPHA_LOC) + let beta := mload(C_BETA_LOC) + let gamma := mload(C_GAMMA_LOC) + + /** + * t1 = (W1 + gamma + beta * ID1) * (W2 + gamma + beta * ID2) + * t2 = (W3 + gamma + beta * ID3) * (W4 + gamma + beta * ID4) + * result = alpha_base * z_eval * t1 * t2 + * t1 = (W1 + gamma + beta * sigma_1_eval) * (W2 + gamma + beta * sigma_2_eval) + * t2 = (W2 + gamma + beta * sigma_3_eval) * (W3 + gamma + beta * sigma_4_eval) + * result -= (alpha_base * z_omega_eval * t1 * t2) + */ + let t1 := + mulmod( + add(add(mload(W1_EVAL_LOC), gamma), mulmod(beta, mload(ID1_EVAL_LOC), p)), + add(add(mload(W2_EVAL_LOC), gamma), mulmod(beta, mload(ID2_EVAL_LOC), p)), + p + ) + let t2 := + mulmod( + add(add(mload(W3_EVAL_LOC), gamma), mulmod(beta, mload(ID3_EVAL_LOC), p)), + add(add(mload(W4_EVAL_LOC), gamma), mulmod(beta, mload(ID4_EVAL_LOC), p)), + p + ) + let result := mulmod(mload(C_ALPHA_BASE_LOC), mulmod(mload(Z_EVAL_LOC), mulmod(t1, t2, p), p), p) + t1 := + mulmod( + add(add(mload(W1_EVAL_LOC), gamma), mulmod(beta, mload(SIGMA1_EVAL_LOC), p)), + add(add(mload(W2_EVAL_LOC), gamma), mulmod(beta, mload(SIGMA2_EVAL_LOC), p)), + p + ) + t2 := + mulmod( + add(add(mload(W3_EVAL_LOC), gamma), mulmod(beta, mload(SIGMA3_EVAL_LOC), p)), + add(add(mload(W4_EVAL_LOC), gamma), mulmod(beta, mload(SIGMA4_EVAL_LOC), p)), + p + ) + result := + addmod( + result, + sub(p, mulmod(mload(C_ALPHA_BASE_LOC), mulmod(mload(Z_OMEGA_EVAL_LOC), mulmod(t1, t2, p), p), p)), + p + ) + + /** + * alpha_base *= alpha + * result += alpha_base . (L_{n-k}(ʓ) . (z(ʓ.ω) - ∆_{PI})) + * alpha_base *= alpha + * result += alpha_base . (L_1(ʓ)(Z(ʓ) - 1)) + * alpha_Base *= alpha + */ + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p)) + result := + addmod( + result, + mulmod( + mload(C_ALPHA_BASE_LOC), + mulmod( + mload(L_END_LOC), + addmod(mload(Z_OMEGA_EVAL_LOC), sub(p, mload(PUBLIC_INPUT_DELTA_LOC)), p), + p + ), + p + ), + p + ) + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p)) + mstore( + PERMUTATION_IDENTITY, + addmod( + result, + mulmod( + mload(C_ALPHA_BASE_LOC), + mulmod(mload(L_START_LOC), addmod(mload(Z_EVAL_LOC), sub(p, 1), p), p), + p + ), + p + ) + ) + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p)) + } + + /** + * COMPUTE PLOOKUP WIDGET EVALUATION + */ + { + /** + * Goal: f = (w1(z) + q2.w1(zω)) + η(w2(z) + qm.w2(zω)) + η²(w3(z) + qc.w_3(zω)) + q3(z).η³ + * f = η.q3(z) + * f += (w3(z) + qc.w_3(zω)) + * f *= η + * f += (w2(z) + qm.w2(zω)) + * f *= η + * f += (w1(z) + q2.w1(zω)) + */ + let f := mulmod(mload(C_ETA_LOC), mload(Q3_EVAL_LOC), p) + f := + addmod(f, addmod(mload(W3_EVAL_LOC), mulmod(mload(QC_EVAL_LOC), mload(W3_OMEGA_EVAL_LOC), p), p), p) + f := mulmod(f, mload(C_ETA_LOC), p) + f := + addmod(f, addmod(mload(W2_EVAL_LOC), mulmod(mload(QM_EVAL_LOC), mload(W2_OMEGA_EVAL_LOC), p), p), p) + f := mulmod(f, mload(C_ETA_LOC), p) + f := + addmod(f, addmod(mload(W1_EVAL_LOC), mulmod(mload(Q2_EVAL_LOC), mload(W1_OMEGA_EVAL_LOC), p), p), p) + + // t(z) = table4(z).η³ + table3(z).η² + table2(z).η + table1(z) + let t := + addmod( + addmod( + addmod( + mulmod(mload(TABLE4_EVAL_LOC), mload(C_ETA_CUBE_LOC), p), + mulmod(mload(TABLE3_EVAL_LOC), mload(C_ETA_SQR_LOC), p), + p + ), + mulmod(mload(TABLE2_EVAL_LOC), mload(C_ETA_LOC), p), + p + ), + mload(TABLE1_EVAL_LOC), + p + ) + + // t(zw) = table4(zw).η³ + table3(zw).η² + table2(zw).η + table1(zw) + let t_omega := + addmod( + addmod( + addmod( + mulmod(mload(TABLE4_OMEGA_EVAL_LOC), mload(C_ETA_CUBE_LOC), p), + mulmod(mload(TABLE3_OMEGA_EVAL_LOC), mload(C_ETA_SQR_LOC), p), + p + ), + mulmod(mload(TABLE2_OMEGA_EVAL_LOC), mload(C_ETA_LOC), p), + p + ), + mload(TABLE1_OMEGA_EVAL_LOC), + p + ) + + /** + * Goal: numerator = (TABLE_TYPE_EVAL * f(z) + γ) * (t(z) + βt(zω) + γ(β + 1)) * (β + 1) + * gamma_beta_constant = γ(β + 1) + * numerator = f * TABLE_TYPE_EVAL + gamma + * temp0 = t(z) + t(zω) * β + gamma_beta_constant + * numerator *= temp0 + * numerator *= (β + 1) + * temp0 = alpha * l_1 + * numerator += temp0 + * numerator *= z_lookup(z) + * numerator -= temp0 + */ + let gamma_beta_constant := mulmod(mload(C_GAMMA_LOC), addmod(mload(C_BETA_LOC), 1, p), p) + let numerator := addmod(mulmod(f, mload(TABLE_TYPE_EVAL_LOC), p), mload(C_GAMMA_LOC), p) + let temp0 := addmod(addmod(t, mulmod(t_omega, mload(C_BETA_LOC), p), p), gamma_beta_constant, p) + numerator := mulmod(numerator, temp0, p) + numerator := mulmod(numerator, addmod(mload(C_BETA_LOC), 1, p), p) + temp0 := mulmod(mload(C_ALPHA_LOC), mload(L_START_LOC), p) + numerator := addmod(numerator, temp0, p) + numerator := mulmod(numerator, mload(Z_LOOKUP_EVAL_LOC), p) + numerator := addmod(numerator, sub(p, temp0), p) + + /** + * Goal: denominator = z_lookup(zω)*[s(z) + βs(zω) + γ(1 + β)] - [z_lookup(zω) - [γ(1 + β)]^{n-k}]*α²L_end(z) + * note: delta_factor = [γ(1 + β)]^{n-k} + * denominator = s(z) + βs(zω) + γ(β + 1) + * temp1 = α²L_end(z) + * denominator -= temp1 + * denominator *= z_lookup(zω) + * denominator += temp1 * delta_factor + * PLOOKUP_IDENTITY = (numerator - denominator).alpha_base + * alpha_base *= alpha^3 + */ + let denominator := + addmod( + addmod(mload(S_EVAL_LOC), mulmod(mload(S_OMEGA_EVAL_LOC), mload(C_BETA_LOC), p), p), + gamma_beta_constant, + p + ) + let temp1 := mulmod(mload(C_ALPHA_SQR_LOC), mload(L_END_LOC), p) + denominator := addmod(denominator, sub(p, temp1), p) + denominator := mulmod(denominator, mload(Z_LOOKUP_OMEGA_EVAL_LOC), p) + denominator := addmod(denominator, mulmod(temp1, mload(PLOOKUP_DELTA_LOC), p), p) + + mstore(PLOOKUP_IDENTITY, mulmod(addmod(numerator, sub(p, denominator), p), mload(C_ALPHA_BASE_LOC), p)) + + // update alpha + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_CUBE_LOC), p)) + } + + /** + * COMPUTE ARITHMETIC WIDGET EVALUATION + */ + { + /** + * The basic arithmetic gate identity in standard plonk is as follows. + * (w_1 . w_2 . q_m) + (w_1 . q_1) + (w_2 . q_2) + (w_3 . q_3) + (w_4 . q_4) + q_c = 0 + * However, for Ultraplonk, we extend this to support "passing" wires between rows (shown without alpha scaling below): + * q_arith * ( ( (-1/2) * (q_arith - 3) * q_m * w_1 * w_2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c ) + + * (q_arith - 1)*( α * (q_arith - 2) * (w_1 + w_4 - w_1_omega + q_m) + w_4_omega) ) = 0 + * + * This formula results in several cases depending on q_arith: + * 1. q_arith == 0: Arithmetic gate is completely disabled + * + * 2. q_arith == 1: Everything in the minigate on the right is disabled. The equation is just a standard plonk equation + * with extra wires: q_m * w_1 * w_2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c = 0 + * + * 3. q_arith == 2: The (w_1 + w_4 - ...) term is disabled. THe equation is: + * (1/2) * q_m * w_1 * w_2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c + w_4_omega = 0 + * It allows defining w_4 at next index (w_4_omega) in terms of current wire values + * + * 4. q_arith == 3: The product of w_1 and w_2 is disabled, but a mini addition gate is enabled. α allows us to split + * the equation into two: + * + * q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c + 2 * w_4_omega = 0 + * and + * w_1 + w_4 - w_1_omega + q_m = 0 (we are reusing q_m here) + * + * 5. q_arith > 3: The product of w_1 and w_2 is scaled by (q_arith - 3), while the w_4_omega term is scaled by (q_arith - 1). + * The equation can be split into two: + * + * (q_arith - 3)* q_m * w_1 * w_ 2 + q_1 * w_1 + q_2 * w_2 + q_3 * w_3 + q_4 * w_4 + q_c + (q_arith - 1) * w_4_omega = 0 + * and + * w_1 + w_4 - w_1_omega + q_m = 0 + * + * The problem that q_m is used both in both equations can be dealt with by appropriately changing selector values at + * the next gate. Then we can treat (q_arith - 1) as a simulated q_6 selector and scale q_m to handle (q_arith - 3) at + * product. + */ + + let w1q1 := mulmod(mload(W1_EVAL_LOC), mload(Q1_EVAL_LOC), p) + let w2q2 := mulmod(mload(W2_EVAL_LOC), mload(Q2_EVAL_LOC), p) + let w3q3 := mulmod(mload(W3_EVAL_LOC), mload(Q3_EVAL_LOC), p) + let w4q3 := mulmod(mload(W4_EVAL_LOC), mload(Q4_EVAL_LOC), p) + + // @todo - Add a explicit test that hits QARITH == 3 + // w1w2qm := (w_1 . w_2 . q_m . (QARITH_EVAL_LOC - 3)) / 2 + let w1w2qm := + mulmod( + mulmod( + mulmod(mulmod(mload(W1_EVAL_LOC), mload(W2_EVAL_LOC), p), mload(QM_EVAL_LOC), p), + addmod(mload(QARITH_EVAL_LOC), sub(p, 3), p), + p + ), + NEGATIVE_INVERSE_OF_2_MODULO_P, + p + ) + + // (w_1 . w_2 . q_m . (q_arith - 3)) / -2) + (w_1 . q_1) + (w_2 . q_2) + (w_3 . q_3) + (w_4 . q_4) + q_c + let identity := + addmod( + mload(QC_EVAL_LOC), addmod(w4q3, addmod(w3q3, addmod(w2q2, addmod(w1q1, w1w2qm, p), p), p), p), p + ) + + // if q_arith == 3 we evaluate an additional mini addition gate (on top of the regular one), where: + // w_1 + w_4 - w_1_omega + q_m = 0 + // we use this gate to save an addition gate when adding or subtracting non-native field elements + // α * (q_arith - 2) * (w_1 + w_4 - w_1_omega + q_m) + let extra_small_addition_gate_identity := + mulmod( + mload(C_ALPHA_LOC), + mulmod( + addmod(mload(QARITH_EVAL_LOC), sub(p, 2), p), + addmod( + mload(QM_EVAL_LOC), + addmod( + sub(p, mload(W1_OMEGA_EVAL_LOC)), addmod(mload(W1_EVAL_LOC), mload(W4_EVAL_LOC), p), p + ), + p + ), + p + ), + p + ) + + // if q_arith == 2 OR q_arith == 3 we add the 4th wire of the NEXT gate into the arithmetic identity + // N.B. if q_arith > 2, this wire value will be scaled by (q_arith - 1) relative to the other gate wires! + // alpha_base * q_arith * (identity + (q_arith - 1) * (w_4_omega + extra_small_addition_gate_identity)) + mstore( + ARITHMETIC_IDENTITY, + mulmod( + mload(C_ALPHA_BASE_LOC), + mulmod( + mload(QARITH_EVAL_LOC), + addmod( + identity, + mulmod( + addmod(mload(QARITH_EVAL_LOC), sub(p, 1), p), + addmod(mload(W4_OMEGA_EVAL_LOC), extra_small_addition_gate_identity, p), + p + ), + p + ), + p + ), + p + ) + ) + + // update alpha + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_SQR_LOC), p)) + } + + /** + * COMPUTE GENPERMSORT WIDGET EVALUATION + */ + { + /** + * D1 = (w2 - w1) + * D2 = (w3 - w2) + * D3 = (w4 - w3) + * D4 = (w1_omega - w4) + * + * α_a = alpha_base + * α_b = alpha_base * α + * α_c = alpha_base * α^2 + * α_d = alpha_base * α^3 + * + * range_accumulator = ( + * D1(D1 - 1)(D1 - 2)(D1 - 3).α_a + + * D2(D2 - 1)(D2 - 2)(D2 - 3).α_b + + * D3(D3 - 1)(D3 - 2)(D3 - 3).α_c + + * D4(D4 - 1)(D4 - 2)(D4 - 3).α_d + + * ) . q_sort + */ + let minus_two := sub(p, 2) + let minus_three := sub(p, 3) + let d1 := addmod(mload(W2_EVAL_LOC), sub(p, mload(W1_EVAL_LOC)), p) + let d2 := addmod(mload(W3_EVAL_LOC), sub(p, mload(W2_EVAL_LOC)), p) + let d3 := addmod(mload(W4_EVAL_LOC), sub(p, mload(W3_EVAL_LOC)), p) + let d4 := addmod(mload(W1_OMEGA_EVAL_LOC), sub(p, mload(W4_EVAL_LOC)), p) + + let range_accumulator := + mulmod( + mulmod( + mulmod(addmod(mulmod(d1, d1, p), sub(p, d1), p), addmod(d1, minus_two, p), p), + addmod(d1, minus_three, p), + p + ), + mload(C_ALPHA_BASE_LOC), + p + ) + range_accumulator := + addmod( + range_accumulator, + mulmod( + mulmod( + mulmod(addmod(mulmod(d2, d2, p), sub(p, d2), p), addmod(d2, minus_two, p), p), + addmod(d2, minus_three, p), + p + ), + mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p), + p + ), + p + ) + range_accumulator := + addmod( + range_accumulator, + mulmod( + mulmod( + mulmod(addmod(mulmod(d3, d3, p), sub(p, d3), p), addmod(d3, minus_two, p), p), + addmod(d3, minus_three, p), + p + ), + mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_SQR_LOC), p), + p + ), + p + ) + range_accumulator := + addmod( + range_accumulator, + mulmod( + mulmod( + mulmod(addmod(mulmod(d4, d4, p), sub(p, d4), p), addmod(d4, minus_two, p), p), + addmod(d4, minus_three, p), + p + ), + mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_CUBE_LOC), p), + p + ), + p + ) + range_accumulator := mulmod(range_accumulator, mload(QSORT_EVAL_LOC), p) + + mstore(SORT_IDENTITY, range_accumulator) + + // update alpha + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_QUAD_LOC), p)) + } + + /** + * COMPUTE ELLIPTIC WIDGET EVALUATION + */ + { + /** + * endo_term = (-x_2) * x_1 * (x_3 * 2 + x_1) * q_beta + * endo_sqr_term = x_2^2 + * endo_sqr_term *= (x_3 - x_1) + * endo_sqr_term *= q_beta^2 + * leftovers = x_2^2 + * leftovers *= x_2 + * leftovers += x_1^2 * (x_3 + x_1) @follow-up Invalid comment in BB widget + * leftovers -= (y_2^2 + y_1^2) + * sign_term = y_2 * y_1 + * sign_term += sign_term + * sign_term *= q_sign + */ + // q_elliptic * (x3 + x2 + x1)(x2 - x1)(x2 - x1) - y2^2 - y1^2 + 2(y2y1)*q_sign = 0 + let x_diff := addmod(mload(X2_EVAL_LOC), sub(p, mload(X1_EVAL_LOC)), p) + let y2_sqr := mulmod(mload(Y2_EVAL_LOC), mload(Y2_EVAL_LOC), p) + let y1_sqr := mulmod(mload(Y1_EVAL_LOC), mload(Y1_EVAL_LOC), p) + let y1y2 := mulmod(mulmod(mload(Y1_EVAL_LOC), mload(Y2_EVAL_LOC), p), mload(QSIGN_LOC), p) + + let x_add_identity := + addmod( + mulmod( + addmod(mload(X3_EVAL_LOC), addmod(mload(X2_EVAL_LOC), mload(X1_EVAL_LOC), p), p), + mulmod(x_diff, x_diff, p), + p + ), + addmod( + sub( + p, + addmod(y2_sqr, y1_sqr, p) + ), + addmod(y1y2, y1y2, p), + p + ), + p + ) + x_add_identity := + mulmod( + mulmod( + x_add_identity, + addmod( + 1, + sub(p, mload(QM_EVAL_LOC)), + p + ), + p + ), + mload(C_ALPHA_BASE_LOC), + p + ) + + // q_elliptic * (x3 + x2 + x1)(x2 - x1)(x2 - x1) - y2^2 - y1^2 + 2(y2y1)*q_sign = 0 + let y1_plus_y3 := addmod( + mload(Y1_EVAL_LOC), + mload(Y3_EVAL_LOC), + p + ) + let y_diff := addmod(mulmod(mload(Y2_EVAL_LOC), mload(QSIGN_LOC), p), sub(p, mload(Y1_EVAL_LOC)), p) + let y_add_identity := + addmod( + mulmod(y1_plus_y3, x_diff, p), + mulmod(addmod(mload(X3_EVAL_LOC), sub(p, mload(X1_EVAL_LOC)), p), y_diff, p), + p + ) + y_add_identity := + mulmod( + mulmod(y_add_identity, addmod(1, sub(p, mload(QM_EVAL_LOC)), p), p), + mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p), + p + ) + + // ELLIPTIC_IDENTITY = (x_identity + y_identity) * Q_ELLIPTIC_EVAL + mstore( + ELLIPTIC_IDENTITY, mulmod(addmod(x_add_identity, y_add_identity, p), mload(QELLIPTIC_EVAL_LOC), p) + ) + } + { + /** + * x_pow_4 = (y_1_sqr - curve_b) * x_1; + * y_1_sqr_mul_4 = y_1_sqr + y_1_sqr; + * y_1_sqr_mul_4 += y_1_sqr_mul_4; + * x_1_pow_4_mul_9 = x_pow_4; + * x_1_pow_4_mul_9 += x_1_pow_4_mul_9; + * x_1_pow_4_mul_9 += x_1_pow_4_mul_9; + * x_1_pow_4_mul_9 += x_1_pow_4_mul_9; + * x_1_pow_4_mul_9 += x_pow_4; + * x_1_sqr_mul_3 = x_1_sqr + x_1_sqr + x_1_sqr; + * x_double_identity = (x_3 + x_1 + x_1) * y_1_sqr_mul_4 - x_1_pow_4_mul_9; + * y_double_identity = x_1_sqr_mul_3 * (x_1 - x_3) - (y_1 + y_1) * (y_1 + y_3); + */ + // (x3 + x1 + x1) (4y1*y1) - 9 * x1 * x1 * x1 * x1 = 0 + let x1_sqr := mulmod(mload(X1_EVAL_LOC), mload(X1_EVAL_LOC), p) + let y1_sqr := mulmod(mload(Y1_EVAL_LOC), mload(Y1_EVAL_LOC), p) + let x_pow_4 := mulmod(addmod(y1_sqr, GRUMPKIN_CURVE_B_PARAMETER_NEGATED, p), mload(X1_EVAL_LOC), p) + let y1_sqr_mul_4 := mulmod(y1_sqr, 4, p) + let x1_pow_4_mul_9 := mulmod(x_pow_4, 9, p) + let x1_sqr_mul_3 := mulmod(x1_sqr, 3, p) + let x_double_identity := + addmod( + mulmod( + addmod(mload(X3_EVAL_LOC), addmod(mload(X1_EVAL_LOC), mload(X1_EVAL_LOC), p), p), + y1_sqr_mul_4, + p + ), + sub(p, x1_pow_4_mul_9), + p + ) + // (y1 + y1) (2y1) - (3 * x1 * x1)(x1 - x3) = 0 + let y_double_identity := + addmod( + mulmod(x1_sqr_mul_3, addmod(mload(X1_EVAL_LOC), sub(p, mload(X3_EVAL_LOC)), p), p), + sub( + p, + mulmod( + addmod(mload(Y1_EVAL_LOC), mload(Y1_EVAL_LOC), p), + addmod(mload(Y1_EVAL_LOC), mload(Y3_EVAL_LOC), p), + p + ) + ), + p + ) + x_double_identity := mulmod(x_double_identity, mload(C_ALPHA_BASE_LOC), p) + y_double_identity := + mulmod(y_double_identity, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_LOC), p), p) + x_double_identity := mulmod(x_double_identity, mload(QM_EVAL_LOC), p) + y_double_identity := mulmod(y_double_identity, mload(QM_EVAL_LOC), p) + // ELLIPTIC_IDENTITY += (x_double_identity + y_double_identity) * Q_DOUBLE_EVAL + mstore( + ELLIPTIC_IDENTITY, + addmod( + mload(ELLIPTIC_IDENTITY), + mulmod(addmod(x_double_identity, y_double_identity, p), mload(QELLIPTIC_EVAL_LOC), p), + p + ) + ) + + // update alpha + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_QUAD_LOC), p)) + } + + /** + * COMPUTE AUXILIARY WIDGET EVALUATION + */ + { + { + /** + * Non native field arithmetic gate 2 + * _ _ + * / _ _ _ 14 \ + * q_2 . q_4 | (w_1 . w_2) + (w_1 . w_2) + (w_1 . w_4 + w_2 . w_3 - w_3) . 2 - w_3 - w_4 | + * \_ _/ + * + * limb_subproduct = w_1 . w_2_omega + w_1_omega . w_2 + * non_native_field_gate_2 = w_1 * w_4 + w_4 * w_3 - w_3_omega + * non_native_field_gate_2 = non_native_field_gate_2 * limb_size + * non_native_field_gate_2 -= w_4_omega + * non_native_field_gate_2 += limb_subproduct + * non_native_field_gate_2 *= q_4 + * limb_subproduct *= limb_size + * limb_subproduct += w_1_omega * w_2_omega + * non_native_field_gate_1 = (limb_subproduct + w_3 + w_4) * q_3 + * non_native_field_gate_3 = (limb_subproduct + w_4 - (w_3_omega + w_4_omega)) * q_m + * non_native_field_identity = (non_native_field_gate_1 + non_native_field_gate_2 + non_native_field_gate_3) * q_2 + */ + + let limb_subproduct := + addmod( + mulmod(mload(W1_EVAL_LOC), mload(W2_OMEGA_EVAL_LOC), p), + mulmod(mload(W1_OMEGA_EVAL_LOC), mload(W2_EVAL_LOC), p), + p + ) + + let non_native_field_gate_2 := + addmod( + addmod( + mulmod(mload(W1_EVAL_LOC), mload(W4_EVAL_LOC), p), + mulmod(mload(W2_EVAL_LOC), mload(W3_EVAL_LOC), p), + p + ), + sub(p, mload(W3_OMEGA_EVAL_LOC)), + p + ) + non_native_field_gate_2 := mulmod(non_native_field_gate_2, LIMB_SIZE, p) + non_native_field_gate_2 := addmod(non_native_field_gate_2, sub(p, mload(W4_OMEGA_EVAL_LOC)), p) + non_native_field_gate_2 := addmod(non_native_field_gate_2, limb_subproduct, p) + non_native_field_gate_2 := mulmod(non_native_field_gate_2, mload(Q4_EVAL_LOC), p) + limb_subproduct := mulmod(limb_subproduct, LIMB_SIZE, p) + limb_subproduct := + addmod(limb_subproduct, mulmod(mload(W1_OMEGA_EVAL_LOC), mload(W2_OMEGA_EVAL_LOC), p), p) + let non_native_field_gate_1 := + mulmod( + addmod(limb_subproduct, sub(p, addmod(mload(W3_EVAL_LOC), mload(W4_EVAL_LOC), p)), p), + mload(Q3_EVAL_LOC), + p + ) + let non_native_field_gate_3 := + mulmod( + addmod( + addmod(limb_subproduct, mload(W4_EVAL_LOC), p), + sub(p, addmod(mload(W3_OMEGA_EVAL_LOC), mload(W4_OMEGA_EVAL_LOC), p)), + p + ), + mload(QM_EVAL_LOC), + p + ) + let non_native_field_identity := + mulmod( + addmod(addmod(non_native_field_gate_1, non_native_field_gate_2, p), non_native_field_gate_3, p), + mload(Q2_EVAL_LOC), + p + ) + + mstore(AUX_NON_NATIVE_FIELD_EVALUATION, non_native_field_identity) + } + + { + /** + * limb_accumulator_1 = w_2_omega; + * limb_accumulator_1 *= SUBLIMB_SHIFT; + * limb_accumulator_1 += w_1_omega; + * limb_accumulator_1 *= SUBLIMB_SHIFT; + * limb_accumulator_1 += w_3; + * limb_accumulator_1 *= SUBLIMB_SHIFT; + * limb_accumulator_1 += w_2; + * limb_accumulator_1 *= SUBLIMB_SHIFT; + * limb_accumulator_1 += w_1; + * limb_accumulator_1 -= w_4; + * limb_accumulator_1 *= q_4; + */ + let limb_accumulator_1 := mulmod(mload(W2_OMEGA_EVAL_LOC), SUBLIMB_SHIFT, p) + limb_accumulator_1 := addmod(limb_accumulator_1, mload(W1_OMEGA_EVAL_LOC), p) + limb_accumulator_1 := mulmod(limb_accumulator_1, SUBLIMB_SHIFT, p) + limb_accumulator_1 := addmod(limb_accumulator_1, mload(W3_EVAL_LOC), p) + limb_accumulator_1 := mulmod(limb_accumulator_1, SUBLIMB_SHIFT, p) + limb_accumulator_1 := addmod(limb_accumulator_1, mload(W2_EVAL_LOC), p) + limb_accumulator_1 := mulmod(limb_accumulator_1, SUBLIMB_SHIFT, p) + limb_accumulator_1 := addmod(limb_accumulator_1, mload(W1_EVAL_LOC), p) + limb_accumulator_1 := addmod(limb_accumulator_1, sub(p, mload(W4_EVAL_LOC)), p) + limb_accumulator_1 := mulmod(limb_accumulator_1, mload(Q4_EVAL_LOC), p) + + /** + * limb_accumulator_2 = w_3_omega; + * limb_accumulator_2 *= SUBLIMB_SHIFT; + * limb_accumulator_2 += w_2_omega; + * limb_accumulator_2 *= SUBLIMB_SHIFT; + * limb_accumulator_2 += w_1_omega; + * limb_accumulator_2 *= SUBLIMB_SHIFT; + * limb_accumulator_2 += w_4; + * limb_accumulator_2 *= SUBLIMB_SHIFT; + * limb_accumulator_2 += w_3; + * limb_accumulator_2 -= w_4_omega; + * limb_accumulator_2 *= q_m; + */ + let limb_accumulator_2 := mulmod(mload(W3_OMEGA_EVAL_LOC), SUBLIMB_SHIFT, p) + limb_accumulator_2 := addmod(limb_accumulator_2, mload(W2_OMEGA_EVAL_LOC), p) + limb_accumulator_2 := mulmod(limb_accumulator_2, SUBLIMB_SHIFT, p) + limb_accumulator_2 := addmod(limb_accumulator_2, mload(W1_OMEGA_EVAL_LOC), p) + limb_accumulator_2 := mulmod(limb_accumulator_2, SUBLIMB_SHIFT, p) + limb_accumulator_2 := addmod(limb_accumulator_2, mload(W4_EVAL_LOC), p) + limb_accumulator_2 := mulmod(limb_accumulator_2, SUBLIMB_SHIFT, p) + limb_accumulator_2 := addmod(limb_accumulator_2, mload(W3_EVAL_LOC), p) + limb_accumulator_2 := addmod(limb_accumulator_2, sub(p, mload(W4_OMEGA_EVAL_LOC)), p) + limb_accumulator_2 := mulmod(limb_accumulator_2, mload(QM_EVAL_LOC), p) + + mstore( + AUX_LIMB_ACCUMULATOR_EVALUATION, + mulmod(addmod(limb_accumulator_1, limb_accumulator_2, p), mload(Q3_EVAL_LOC), p) + ) + } + + { + /** + * memory_record_check = w_3; + * memory_record_check *= eta; + * memory_record_check += w_2; + * memory_record_check *= eta; + * memory_record_check += w_1; + * memory_record_check *= eta; + * memory_record_check += q_c; + * + * partial_record_check = memory_record_check; + * + * memory_record_check -= w_4; + */ + + let memory_record_check := mulmod(mload(W3_EVAL_LOC), mload(C_ETA_LOC), p) + memory_record_check := addmod(memory_record_check, mload(W2_EVAL_LOC), p) + memory_record_check := mulmod(memory_record_check, mload(C_ETA_LOC), p) + memory_record_check := addmod(memory_record_check, mload(W1_EVAL_LOC), p) + memory_record_check := mulmod(memory_record_check, mload(C_ETA_LOC), p) + memory_record_check := addmod(memory_record_check, mload(QC_EVAL_LOC), p) + + let partial_record_check := memory_record_check + memory_record_check := addmod(memory_record_check, sub(p, mload(W4_EVAL_LOC)), p) + + mstore(AUX_MEMORY_EVALUATION, memory_record_check) + + // index_delta = w_1_omega - w_1 + let index_delta := addmod(mload(W1_OMEGA_EVAL_LOC), sub(p, mload(W1_EVAL_LOC)), p) + // record_delta = w_4_omega - w_4 + let record_delta := addmod(mload(W4_OMEGA_EVAL_LOC), sub(p, mload(W4_EVAL_LOC)), p) + // index_is_monotonically_increasing = index_delta * (index_delta - 1) + let index_is_monotonically_increasing := mulmod(index_delta, addmod(index_delta, sub(p, 1), p), p) + + // adjacent_values_match_if_adjacent_indices_match = record_delta * (1 - index_delta) + let adjacent_values_match_if_adjacent_indices_match := + mulmod(record_delta, addmod(1, sub(p, index_delta), p), p) + + // AUX_ROM_CONSISTENCY_EVALUATION = ((adjacent_values_match_if_adjacent_indices_match * alpha) + index_is_monotonically_increasing) * alpha + partial_record_check + mstore( + AUX_ROM_CONSISTENCY_EVALUATION, + addmod( + mulmod( + addmod( + mulmod(adjacent_values_match_if_adjacent_indices_match, mload(C_ALPHA_LOC), p), + index_is_monotonically_increasing, + p + ), + mload(C_ALPHA_LOC), + p + ), + memory_record_check, + p + ) + ) + + { + /** + * next_gate_access_type = w_3_omega; + * next_gate_access_type *= eta; + * next_gate_access_type += w_2_omega; + * next_gate_access_type *= eta; + * next_gate_access_type += w_1_omega; + * next_gate_access_type *= eta; + * next_gate_access_type = w_4_omega - next_gate_access_type; + */ + let next_gate_access_type := mulmod(mload(W3_OMEGA_EVAL_LOC), mload(C_ETA_LOC), p) + next_gate_access_type := addmod(next_gate_access_type, mload(W2_OMEGA_EVAL_LOC), p) + next_gate_access_type := mulmod(next_gate_access_type, mload(C_ETA_LOC), p) + next_gate_access_type := addmod(next_gate_access_type, mload(W1_OMEGA_EVAL_LOC), p) + next_gate_access_type := mulmod(next_gate_access_type, mload(C_ETA_LOC), p) + next_gate_access_type := addmod(mload(W4_OMEGA_EVAL_LOC), sub(p, next_gate_access_type), p) + + // value_delta = w_3_omega - w_3 + let value_delta := addmod(mload(W3_OMEGA_EVAL_LOC), sub(p, mload(W3_EVAL_LOC)), p) + // adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation = (1 - index_delta) * value_delta * (1 - next_gate_access_type); + + let adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation := + mulmod( + addmod(1, sub(p, index_delta), p), + mulmod(value_delta, addmod(1, sub(p, next_gate_access_type), p), p), + p + ) + + // AUX_RAM_CONSISTENCY_EVALUATION + + /** + * access_type = w_4 - partial_record_check + * access_check = access_type^2 - access_type + * next_gate_access_type_is_boolean = next_gate_access_type^2 - next_gate_access_type + * RAM_consistency_check_identity = adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation; + * RAM_consistency_check_identity *= alpha; + * RAM_consistency_check_identity += index_is_monotonically_increasing; + * RAM_consistency_check_identity *= alpha; + * RAM_consistency_check_identity += next_gate_access_type_is_boolean; + * RAM_consistency_check_identity *= alpha; + * RAM_consistency_check_identity += access_check; + */ + + let access_type := addmod(mload(W4_EVAL_LOC), sub(p, partial_record_check), p) + let access_check := mulmod(access_type, addmod(access_type, sub(p, 1), p), p) + let next_gate_access_type_is_boolean := + mulmod(next_gate_access_type, addmod(next_gate_access_type, sub(p, 1), p), p) + let RAM_cci := + mulmod( + adjacent_values_match_if_adjacent_indices_match_and_next_access_is_a_read_operation, + mload(C_ALPHA_LOC), + p + ) + RAM_cci := addmod(RAM_cci, index_is_monotonically_increasing, p) + RAM_cci := mulmod(RAM_cci, mload(C_ALPHA_LOC), p) + RAM_cci := addmod(RAM_cci, next_gate_access_type_is_boolean, p) + RAM_cci := mulmod(RAM_cci, mload(C_ALPHA_LOC), p) + RAM_cci := addmod(RAM_cci, access_check, p) + + mstore(AUX_RAM_CONSISTENCY_EVALUATION, RAM_cci) + } + + { + // timestamp_delta = w_2_omega - w_2 + let timestamp_delta := addmod(mload(W2_OMEGA_EVAL_LOC), sub(p, mload(W2_EVAL_LOC)), p) + + // RAM_timestamp_check_identity = (1 - index_delta) * timestamp_delta - w_3 + let RAM_timestamp_check_identity := + addmod( + mulmod(timestamp_delta, addmod(1, sub(p, index_delta), p), p), sub(p, mload(W3_EVAL_LOC)), p + ) + + /** + * memory_identity = ROM_consistency_check_identity * q_2; + * memory_identity += RAM_timestamp_check_identity * q_4; + * memory_identity += memory_record_check * q_m; + * memory_identity *= q_1; + * memory_identity += (RAM_consistency_check_identity * q_arith); + * + * auxiliary_identity = memory_identity + non_native_field_identity + limb_accumulator_identity; + * auxiliary_identity *= q_aux; + * auxiliary_identity *= alpha_base; + */ + let memory_identity := mulmod(mload(AUX_ROM_CONSISTENCY_EVALUATION), mload(Q2_EVAL_LOC), p) + memory_identity := + addmod(memory_identity, mulmod(RAM_timestamp_check_identity, mload(Q4_EVAL_LOC), p), p) + memory_identity := + addmod(memory_identity, mulmod(mload(AUX_MEMORY_EVALUATION), mload(QM_EVAL_LOC), p), p) + memory_identity := mulmod(memory_identity, mload(Q1_EVAL_LOC), p) + memory_identity := + addmod( + memory_identity, mulmod(mload(AUX_RAM_CONSISTENCY_EVALUATION), mload(QARITH_EVAL_LOC), p), p + ) + + let auxiliary_identity := addmod(memory_identity, mload(AUX_NON_NATIVE_FIELD_EVALUATION), p) + auxiliary_identity := addmod(auxiliary_identity, mload(AUX_LIMB_ACCUMULATOR_EVALUATION), p) + auxiliary_identity := mulmod(auxiliary_identity, mload(QAUX_EVAL_LOC), p) + auxiliary_identity := mulmod(auxiliary_identity, mload(C_ALPHA_BASE_LOC), p) + + mstore(AUX_IDENTITY, auxiliary_identity) + + // update alpha + mstore(C_ALPHA_BASE_LOC, mulmod(mload(C_ALPHA_BASE_LOC), mload(C_ALPHA_CUBE_LOC), p)) + } + } + } + + { + /** + * quotient = ARITHMETIC_IDENTITY + * quotient += PERMUTATION_IDENTITY + * quotient += PLOOKUP_IDENTITY + * quotient += SORT_IDENTITY + * quotient += ELLIPTIC_IDENTITY + * quotient += AUX_IDENTITY + * quotient *= ZERO_POLY_INVERSE + */ + mstore( + QUOTIENT_EVAL_LOC, + mulmod( + addmod( + addmod( + addmod( + addmod( + addmod(mload(PERMUTATION_IDENTITY), mload(PLOOKUP_IDENTITY), p), + mload(ARITHMETIC_IDENTITY), + p + ), + mload(SORT_IDENTITY), + p + ), + mload(ELLIPTIC_IDENTITY), + p + ), + mload(AUX_IDENTITY), + p + ), + mload(ZERO_POLY_INVERSE_LOC), + p + ) + ) + } + + /** + * GENERATE NU AND SEPARATOR CHALLENGES + */ + { + let current_challenge := mload(C_CURRENT_LOC) + // get a calldata pointer that points to the start of the data we want to copy + let calldata_ptr := add(calldataload(0x04), 0x24) + + calldata_ptr := add(calldata_ptr, NU_CALLDATA_SKIP_LENGTH) + + mstore(NU_CHALLENGE_INPUT_LOC_A, current_challenge) + mstore(NU_CHALLENGE_INPUT_LOC_B, mload(QUOTIENT_EVAL_LOC)) + calldatacopy(NU_CHALLENGE_INPUT_LOC_C, calldata_ptr, NU_INPUT_LENGTH) + + // hash length = (0x20 + num field elements), we include the previous challenge in the hash + let challenge := keccak256(NU_CHALLENGE_INPUT_LOC_A, add(NU_INPUT_LENGTH, 0x40)) + + mstore(C_V0_LOC, mod(challenge, p)) + // We need THIRTY-ONE independent nu challenges! + mstore(0x00, challenge) + mstore8(0x20, 0x01) + mstore(C_V1_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x02) + mstore(C_V2_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x03) + mstore(C_V3_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x04) + mstore(C_V4_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x05) + mstore(C_V5_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x06) + mstore(C_V6_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x07) + mstore(C_V7_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x08) + mstore(C_V8_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x09) + mstore(C_V9_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0a) + mstore(C_V10_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0b) + mstore(C_V11_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0c) + mstore(C_V12_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0d) + mstore(C_V13_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0e) + mstore(C_V14_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x0f) + mstore(C_V15_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x10) + mstore(C_V16_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x11) + mstore(C_V17_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x12) + mstore(C_V18_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x13) + mstore(C_V19_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x14) + mstore(C_V20_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x15) + mstore(C_V21_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x16) + mstore(C_V22_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x17) + mstore(C_V23_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x18) + mstore(C_V24_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x19) + mstore(C_V25_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x1a) + mstore(C_V26_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x1b) + mstore(C_V27_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x1c) + mstore(C_V28_LOC, mod(keccak256(0x00, 0x21), p)) + mstore8(0x20, 0x1d) + mstore(C_V29_LOC, mod(keccak256(0x00, 0x21), p)) + + // @follow-up - Why are both v29 and v30 using appending 0x1d to the prior challenge and hashing, should it not change? + mstore8(0x20, 0x1d) + challenge := keccak256(0x00, 0x21) + mstore(C_V30_LOC, mod(challenge, p)) + + // separator + mstore(0x00, challenge) + mstore(0x20, mload(PI_Z_Y_LOC)) + mstore(0x40, mload(PI_Z_X_LOC)) + mstore(0x60, mload(PI_Z_OMEGA_Y_LOC)) + mstore(0x80, mload(PI_Z_OMEGA_X_LOC)) + + mstore(C_U_LOC, mod(keccak256(0x00, 0xa0), p)) + } + + let success := 0 + // VALIDATE T1 + { + let x := mload(T1_X_LOC) + let y := mload(T1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q)) + mstore(ACCUMULATOR_X_LOC, x) + mstore(add(ACCUMULATOR_X_LOC, 0x20), y) + } + // VALIDATE T2 + { + let x := mload(T2_X_LOC) // 0x1400 + let y := mload(T2_Y_LOC) // 0x1420 + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(ZETA_POW_N_LOC)) + // accumulator_2 = [T2].zeta^n + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = [T1] + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE T3 + { + let x := mload(T3_X_LOC) + let y := mload(T3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(mload(ZETA_POW_N_LOC), mload(ZETA_POW_N_LOC), p)) + // accumulator_2 = [T3].zeta^{2n} + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE T4 + { + let x := mload(T4_X_LOC) + let y := mload(T4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(mulmod(mload(ZETA_POW_N_LOC), mload(ZETA_POW_N_LOC), p), mload(ZETA_POW_N_LOC), p)) + // accumulator_2 = [T4].zeta^{3n} + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE W1 + { + let x := mload(W1_X_LOC) + let y := mload(W1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V0_LOC), p)) + // accumulator_2 = v0.(u + 1).[W1] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE W2 + { + let x := mload(W2_X_LOC) + let y := mload(W2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V1_LOC), p)) + // accumulator_2 = v1.(u + 1).[W2] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE W3 + { + let x := mload(W3_X_LOC) + let y := mload(W3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V2_LOC), p)) + // accumulator_2 = v2.(u + 1).[W3] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE W4 + { + let x := mload(W4_X_LOC) + let y := mload(W4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V3_LOC), p)) + // accumulator_2 = v3.(u + 1).[W4] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE S + { + let x := mload(S_X_LOC) + let y := mload(S_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V4_LOC), p)) + // accumulator_2 = v4.(u + 1).[S] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Z + { + let x := mload(Z_X_LOC) + let y := mload(Z_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V5_LOC), p)) + // accumulator_2 = v5.(u + 1).[Z] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Z_LOOKUP + { + let x := mload(Z_LOOKUP_X_LOC) + let y := mload(Z_LOOKUP_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V6_LOC), p)) + // accumulator_2 = v6.(u + 1).[Z_LOOKUP] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Q1 + { + let x := mload(Q1_X_LOC) + let y := mload(Q1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V7_LOC)) + // accumulator_2 = v7.[Q1] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Q2 + { + let x := mload(Q2_X_LOC) + let y := mload(Q2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V8_LOC)) + // accumulator_2 = v8.[Q2] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Q3 + { + let x := mload(Q3_X_LOC) + let y := mload(Q3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V9_LOC)) + // accumulator_2 = v9.[Q3] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE Q4 + { + let x := mload(Q4_X_LOC) + let y := mload(Q4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V10_LOC)) + // accumulator_2 = v10.[Q4] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QM + { + let x := mload(QM_X_LOC) + let y := mload(QM_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V11_LOC)) + // accumulator_2 = v11.[Q;] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QC + { + let x := mload(QC_X_LOC) + let y := mload(QC_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V12_LOC)) + // accumulator_2 = v12.[QC] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QARITH + { + let x := mload(QARITH_X_LOC) + let y := mload(QARITH_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V13_LOC)) + // accumulator_2 = v13.[QARITH] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QSORT + { + let x := mload(QSORT_X_LOC) + let y := mload(QSORT_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V14_LOC)) + // accumulator_2 = v14.[QSORT] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QELLIPTIC + { + let x := mload(QELLIPTIC_X_LOC) + let y := mload(QELLIPTIC_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V15_LOC)) + // accumulator_2 = v15.[QELLIPTIC] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE QAUX + { + let x := mload(QAUX_X_LOC) + let y := mload(QAUX_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V16_LOC)) + // accumulator_2 = v15.[Q_AUX] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE SIGMA1 + { + let x := mload(SIGMA1_X_LOC) + let y := mload(SIGMA1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V17_LOC)) + // accumulator_2 = v17.[sigma1] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE SIGMA2 + { + let x := mload(SIGMA2_X_LOC) + let y := mload(SIGMA2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V18_LOC)) + // accumulator_2 = v18.[sigma2] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE SIGMA3 + { + let x := mload(SIGMA3_X_LOC) + let y := mload(SIGMA3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V19_LOC)) + // accumulator_2 = v19.[sigma3] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE SIGMA4 + { + let x := mload(SIGMA4_X_LOC) + let y := mload(SIGMA4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V20_LOC)) + // accumulator_2 = v20.[sigma4] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE TABLE1 + { + let x := mload(TABLE1_X_LOC) + let y := mload(TABLE1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V21_LOC), p)) + // accumulator_2 = u.[table1] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE TABLE2 + { + let x := mload(TABLE2_X_LOC) + let y := mload(TABLE2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V22_LOC), p)) + // accumulator_2 = u.[table2] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE TABLE3 + { + let x := mload(TABLE3_X_LOC) + let y := mload(TABLE3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V23_LOC), p)) + // accumulator_2 = u.[table3] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE TABLE4 + { + let x := mload(TABLE4_X_LOC) + let y := mload(TABLE4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(addmod(mload(C_U_LOC), 0x1, p), mload(C_V24_LOC), p)) + // accumulator_2 = u.[table4] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE TABLE_TYPE + { + let x := mload(TABLE_TYPE_X_LOC) + let y := mload(TABLE_TYPE_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V25_LOC)) + // accumulator_2 = v25.[TableType] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE ID1 + { + let x := mload(ID1_X_LOC) + let y := mload(ID1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V26_LOC)) + // accumulator_2 = v26.[ID1] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE ID2 + { + let x := mload(ID2_X_LOC) + let y := mload(ID2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V27_LOC)) + // accumulator_2 = v27.[ID2] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE ID3 + { + let x := mload(ID3_X_LOC) + let y := mload(ID3_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V28_LOC)) + // accumulator_2 = v28.[ID3] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE ID4 + { + let x := mload(ID4_X_LOC) + let y := mload(ID4_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mload(C_V29_LOC)) + // accumulator_2 = v29.[ID4] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + /** + * COMPUTE BATCH EVALUATION SCALAR MULTIPLIER + */ + { + /** + * batch_evaluation = v0 * (w_1_omega * u + w_1_eval) + * batch_evaluation += v1 * (w_2_omega * u + w_2_eval) + * batch_evaluation += v2 * (w_3_omega * u + w_3_eval) + * batch_evaluation += v3 * (w_4_omega * u + w_4_eval) + * batch_evaluation += v4 * (s_omega_eval * u + s_eval) + * batch_evaluation += v5 * (z_omega_eval * u + z_eval) + * batch_evaluation += v6 * (z_lookup_omega_eval * u + z_lookup_eval) + */ + let batch_evaluation := + mulmod( + mload(C_V0_LOC), + addmod(mulmod(mload(W1_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(W1_EVAL_LOC), p), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V1_LOC), + addmod(mulmod(mload(W2_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(W2_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V2_LOC), + addmod(mulmod(mload(W3_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(W3_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V3_LOC), + addmod(mulmod(mload(W4_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(W4_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V4_LOC), + addmod(mulmod(mload(S_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(S_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V5_LOC), + addmod(mulmod(mload(Z_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(Z_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V6_LOC), + addmod(mulmod(mload(Z_LOOKUP_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(Z_LOOKUP_EVAL_LOC), p), + p + ), + p + ) + + /** + * batch_evaluation += v7 * Q1_EVAL + * batch_evaluation += v8 * Q2_EVAL + * batch_evaluation += v9 * Q3_EVAL + * batch_evaluation += v10 * Q4_EVAL + * batch_evaluation += v11 * QM_EVAL + * batch_evaluation += v12 * QC_EVAL + * batch_evaluation += v13 * QARITH_EVAL + * batch_evaluation += v14 * QSORT_EVAL_LOC + * batch_evaluation += v15 * QELLIPTIC_EVAL_LOC + * batch_evaluation += v16 * QAUX_EVAL_LOC + * batch_evaluation += v17 * SIGMA1_EVAL_LOC + * batch_evaluation += v18 * SIGMA2_EVAL_LOC + * batch_evaluation += v19 * SIGMA3_EVAL_LOC + * batch_evaluation += v20 * SIGMA4_EVAL_LOC + */ + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V7_LOC), mload(Q1_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V8_LOC), mload(Q2_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V9_LOC), mload(Q3_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V10_LOC), mload(Q4_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V11_LOC), mload(QM_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V12_LOC), mload(QC_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V13_LOC), mload(QARITH_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V14_LOC), mload(QSORT_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V15_LOC), mload(QELLIPTIC_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V16_LOC), mload(QAUX_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V17_LOC), mload(SIGMA1_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V18_LOC), mload(SIGMA2_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V19_LOC), mload(SIGMA3_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V20_LOC), mload(SIGMA4_EVAL_LOC), p), p) + + /** + * batch_evaluation += v21 * (table1(zw) * u + table1(z)) + * batch_evaluation += v22 * (table2(zw) * u + table2(z)) + * batch_evaluation += v23 * (table3(zw) * u + table3(z)) + * batch_evaluation += v24 * (table4(zw) * u + table4(z)) + * batch_evaluation += v25 * table_type_eval + * batch_evaluation += v26 * id1_eval + * batch_evaluation += v27 * id2_eval + * batch_evaluation += v28 * id3_eval + * batch_evaluation += v29 * id4_eval + * batch_evaluation += quotient_eval + */ + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V21_LOC), + addmod(mulmod(mload(TABLE1_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(TABLE1_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V22_LOC), + addmod(mulmod(mload(TABLE2_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(TABLE2_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V23_LOC), + addmod(mulmod(mload(TABLE3_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(TABLE3_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := + addmod( + batch_evaluation, + mulmod( + mload(C_V24_LOC), + addmod(mulmod(mload(TABLE4_OMEGA_EVAL_LOC), mload(C_U_LOC), p), mload(TABLE4_EVAL_LOC), p), + p + ), + p + ) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V25_LOC), mload(TABLE_TYPE_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V26_LOC), mload(ID1_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V27_LOC), mload(ID2_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V28_LOC), mload(ID3_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mulmod(mload(C_V29_LOC), mload(ID4_EVAL_LOC), p), p) + batch_evaluation := addmod(batch_evaluation, mload(QUOTIENT_EVAL_LOC), p) + + mstore(0x00, 0x01) // [1].x + mstore(0x20, 0x02) // [1].y + mstore(0x40, sub(p, batch_evaluation)) + // accumulator_2 = -[1].(batch_evaluation) + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + mstore(OPENING_COMMITMENT_SUCCESS_FLAG, success) + } + + /** + * PERFORM PAIRING PREAMBLE + */ + { + let u := mload(C_U_LOC) + let zeta := mload(C_ZETA_LOC) + // VALIDATE PI_Z + { + let x := mload(PI_Z_X_LOC) + let y := mload(PI_Z_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q)) + mstore(0x00, x) + mstore(0x20, y) + } + // compute zeta.[PI_Z] and add into accumulator + mstore(0x40, zeta) + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // accumulator = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, ACCUMULATOR_X_LOC, 0x40)) + + // VALIDATE PI_Z_OMEGA + { + let x := mload(PI_Z_OMEGA_X_LOC) + let y := mload(PI_Z_OMEGA_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + mstore(0x40, mulmod(mulmod(u, zeta, p), mload(OMEGA_LOC), p)) + // accumulator_2 = u.zeta.omega.[PI_Z_OMEGA] + success := and(success, staticcall(gas(), 7, 0x00, 0x60, ACCUMULATOR2_X_LOC, 0x40)) + // PAIRING_RHS = accumulator + accumulator_2 + success := and(success, staticcall(gas(), 6, ACCUMULATOR_X_LOC, 0x80, PAIRING_RHS_X_LOC, 0x40)) + + mstore(0x00, mload(PI_Z_X_LOC)) + mstore(0x20, mload(PI_Z_Y_LOC)) + mstore(0x40, mload(PI_Z_OMEGA_X_LOC)) + mstore(0x60, mload(PI_Z_OMEGA_Y_LOC)) + mstore(0x80, u) + success := and(success, staticcall(gas(), 7, 0x40, 0x60, 0x40, 0x40)) + // PAIRING_LHS = [PI_Z] + [PI_Z_OMEGA] * u + success := and(success, staticcall(gas(), 6, 0x00, 0x80, PAIRING_LHS_X_LOC, 0x40)) + // negate lhs y-coordinate + mstore(PAIRING_LHS_Y_LOC, sub(q, mload(PAIRING_LHS_Y_LOC))) + + if mload(CONTAINS_RECURSIVE_PROOF_LOC) { + // VALIDATE RECURSIVE P1 + { + let x := mload(RECURSIVE_P1_X_LOC) + let y := mload(RECURSIVE_P1_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + + // compute u.u.[recursive_p1] and write into 0x60 + mstore(0x40, mulmod(u, u, p)) + success := and(success, staticcall(gas(), 7, 0x00, 0x60, 0x60, 0x40)) + // VALIDATE RECURSIVE P2 + { + let x := mload(RECURSIVE_P2_X_LOC) + let y := mload(RECURSIVE_P2_Y_LOC) + let xx := mulmod(x, x, q) + // validate on curve + success := and(success, eq(mulmod(y, y, q), addmod(mulmod(x, xx, q), 3, q))) + mstore(0x00, x) + mstore(0x20, y) + } + // compute u.u.[recursive_p2] and write into 0x00 + // 0x40 still contains u*u + success := and(success, staticcall(gas(), 7, 0x00, 0x60, 0x00, 0x40)) + + // compute u.u.[recursiveP1] + rhs and write into rhs + mstore(0xa0, mload(PAIRING_RHS_X_LOC)) + mstore(0xc0, mload(PAIRING_RHS_Y_LOC)) + success := and(success, staticcall(gas(), 6, 0x60, 0x80, PAIRING_RHS_X_LOC, 0x40)) + + // compute u.u.[recursiveP2] + lhs and write into lhs + mstore(0x40, mload(PAIRING_LHS_X_LOC)) + mstore(0x60, mload(PAIRING_LHS_Y_LOC)) + success := and(success, staticcall(gas(), 6, 0x00, 0x80, PAIRING_LHS_X_LOC, 0x40)) + } + + if iszero(success) { + mstore(0x0, EC_SCALAR_MUL_FAILURE_SELECTOR) + revert(0x00, 0x04) + } + mstore(PAIRING_PREAMBLE_SUCCESS_FLAG, success) + } + + /** + * PERFORM PAIRING + */ + { + // rhs paired with [1]_2 + // lhs paired with [x]_2 + + mstore(0x00, mload(PAIRING_RHS_X_LOC)) + mstore(0x20, mload(PAIRING_RHS_Y_LOC)) + mstore(0x40, 0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2) // this is [1]_2 + mstore(0x60, 0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed) + mstore(0x80, 0x090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b) + mstore(0xa0, 0x12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa) + + mstore(0xc0, mload(PAIRING_LHS_X_LOC)) + mstore(0xe0, mload(PAIRING_LHS_Y_LOC)) + mstore(0x100, mload(G2X_X0_LOC)) + mstore(0x120, mload(G2X_X1_LOC)) + mstore(0x140, mload(G2X_Y0_LOC)) + mstore(0x160, mload(G2X_Y1_LOC)) + + success := staticcall(gas(), 8, 0x00, 0x180, 0x00, 0x20) + mstore(PAIRING_SUCCESS_FLAG, success) + mstore(RESULT_FLAG, mload(0x00)) + } + if iszero( + and( + and(and(mload(PAIRING_SUCCESS_FLAG), mload(RESULT_FLAG)), mload(PAIRING_PREAMBLE_SUCCESS_FLAG)), + mload(OPENING_COMMITMENT_SUCCESS_FLAG) + ) + ) { + mstore(0x0, PROOF_FAILURE_SELECTOR) + revert(0x00, 0x04) + } + { + mstore(0x00, 0x01) + return(0x00, 0x20) // Proof succeeded! + } + } + } +} + +contract UltraVerifier is BaseUltraVerifier { + function getVerificationKeyHash() public pure override(BaseUltraVerifier) returns (bytes32) { + return UltraVerificationKey.verificationKeyHash(); + } + + function loadVerificationKey(uint256 vk, uint256 _omegaInverseLoc) internal pure virtual override(BaseUltraVerifier) { + UltraVerificationKey.loadVerificationKey(vk, _omegaInverseLoc); + } +} diff --git a/noir/tooling/bb_abstraction_leaks/src/lib.rs b/noir/tooling/bb_abstraction_leaks/src/lib.rs new file mode 100644 index 00000000000..fec53809ad4 --- /dev/null +++ b/noir/tooling/bb_abstraction_leaks/src/lib.rs @@ -0,0 +1,33 @@ +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] + +use acvm::{acir::native_types::WitnessMap, FieldElement}; + +pub const ACVM_BACKEND_BARRETENBERG: &str = "acvm-backend-barretenberg"; +pub const BB_DOWNLOAD_URL: &str = env!("BB_BINARY_URL"); +pub const BB_VERSION: &str = env!("BB_VERSION"); + +/// Embed the Solidity verifier file +const ULTRA_VERIFIER_CONTRACT: &str = include_str!("contract.sol"); + +pub fn complete_barretenberg_verifier_contract(contract: String) -> String { + format!("{contract}{ULTRA_VERIFIER_CONTRACT}") +} + +/// Removes the public inputs which are prepended to a proof by Barretenberg. +pub fn remove_public_inputs(num_pub_inputs: usize, proof: &[u8]) -> Vec { + // Barretenberg prepends the public inputs onto the proof so we need to remove + // the first `num_pub_inputs` field elements. + let num_bytes_to_remove = num_pub_inputs * (FieldElement::max_num_bytes() as usize); + proof[num_bytes_to_remove..].to_vec() +} + +/// Prepends a set of public inputs to a proof. +pub fn prepend_public_inputs(proof: Vec, public_inputs: WitnessMap) -> Vec { + // We omit any unassigned witnesses. + // Witness values should be ordered by their index but we skip over any indices without an assignment. + let public_inputs_bytes = + public_inputs.into_iter().flat_map(|(_, assignment)| assignment.to_be_bytes()); + + public_inputs_bytes.chain(proof).collect() +} diff --git a/noir/tooling/debugger/Cargo.toml b/noir/tooling/debugger/Cargo.toml new file mode 100644 index 00000000000..53c71754da4 --- /dev/null +++ b/noir/tooling/debugger/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "noir_debugger" +description = "Debugger for Noir" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +acvm.workspace = true +nargo.workspace = true +noirc_printable_type.workspace = true +noirc_errors.workspace = true +thiserror.workspace = true +codespan-reporting.workspace = true +easy-repl = "0.2.1" +owo-colors = "3" diff --git a/noir/tooling/debugger/src/context.rs b/noir/tooling/debugger/src/context.rs new file mode 100644 index 00000000000..33862ed641f --- /dev/null +++ b/noir/tooling/debugger/src/context.rs @@ -0,0 +1,278 @@ +use acvm::acir::circuit::{Circuit, Opcode, OpcodeLocation}; +use acvm::acir::native_types::{Witness, WitnessMap}; +use acvm::brillig_vm::{brillig::Value, Registers}; +use acvm::pwg::{ + ACVMStatus, BrilligSolver, BrilligSolverStatus, ForeignCallWaitInfo, StepResult, ACVM, +}; +use acvm::{BlackBoxFunctionSolver, FieldElement}; + +use nargo::artifacts::debug::DebugArtifact; +use nargo::errors::{ExecutionError, Location}; +use nargo::ops::{DefaultForeignCallExecutor, ForeignCallExecutor}; +use nargo::NargoError; + +use std::collections::{hash_set::Iter, HashSet}; + +#[derive(Debug)] +pub(super) enum DebugCommandResult { + Done, + Ok, + BreakpointReached(OpcodeLocation), + Error(NargoError), +} + +pub(super) struct DebugContext<'a, B: BlackBoxFunctionSolver> { + acvm: ACVM<'a, B>, + brillig_solver: Option>, + foreign_call_executor: DefaultForeignCallExecutor, + debug_artifact: &'a DebugArtifact, + breakpoints: HashSet, +} + +impl<'a, B: BlackBoxFunctionSolver> DebugContext<'a, B> { + pub(super) fn new( + blackbox_solver: &'a B, + circuit: &'a Circuit, + debug_artifact: &'a DebugArtifact, + initial_witness: WitnessMap, + ) -> Self { + Self { + acvm: ACVM::new(blackbox_solver, &circuit.opcodes, initial_witness), + brillig_solver: None, + foreign_call_executor: DefaultForeignCallExecutor::new(true), + debug_artifact, + breakpoints: HashSet::new(), + } + } + + pub(super) fn get_opcodes(&self) -> &[Opcode] { + self.acvm.opcodes() + } + + pub(super) fn get_witness_map(&self) -> &WitnessMap { + self.acvm.witness_map() + } + + pub(super) fn overwrite_witness( + &mut self, + witness: Witness, + value: FieldElement, + ) -> Option { + self.acvm.overwrite_witness(witness, value) + } + + pub(super) fn get_current_opcode_location(&self) -> Option { + let ip = self.acvm.instruction_pointer(); + if ip >= self.get_opcodes().len() { + None + } else if let Some(ref solver) = self.brillig_solver { + Some(OpcodeLocation::Brillig { + acir_index: ip, + brillig_index: solver.program_counter(), + }) + } else { + Some(OpcodeLocation::Acir(ip)) + } + } + + /// Returns the callstack in source code locations for the currently + /// executing opcode. This can be `None` if the execution finished (and + /// `get_current_opcode_location()` returns `None`) or if the opcode is not + /// mapped to a specific source location in the debug artifact (which can + /// happen for certain opcodes inserted synthetically by the compiler) + pub(super) fn get_current_source_location(&self) -> Option> { + self.get_current_opcode_location() + .as_ref() + .and_then(|location| self.debug_artifact.debug_symbols[0].opcode_location(location)) + } + + fn step_brillig_opcode(&mut self) -> DebugCommandResult { + let Some(mut solver) = self.brillig_solver.take() else { + unreachable!("Missing Brillig solver"); + }; + match solver.step() { + Ok(BrilligSolverStatus::InProgress) => { + self.brillig_solver = Some(solver); + if self.breakpoint_reached() { + DebugCommandResult::BreakpointReached( + self.get_current_opcode_location() + .expect("Breakpoint reached but we have no location"), + ) + } else { + DebugCommandResult::Ok + } + } + Ok(BrilligSolverStatus::Finished) => { + let status = self.acvm.finish_brillig_with_solver(solver); + self.handle_acvm_status(status) + } + Ok(BrilligSolverStatus::ForeignCallWait(foreign_call)) => { + self.brillig_solver = Some(solver); + self.handle_foreign_call(foreign_call) + } + Err(err) => DebugCommandResult::Error(NargoError::ExecutionError( + ExecutionError::SolvingError(err), + )), + } + } + + fn handle_foreign_call(&mut self, foreign_call: ForeignCallWaitInfo) -> DebugCommandResult { + let foreign_call_result = self.foreign_call_executor.execute(&foreign_call); + match foreign_call_result { + Ok(foreign_call_result) => { + self.acvm.resolve_pending_foreign_call(foreign_call_result); + // TODO: should we retry executing the opcode somehow in this case? + DebugCommandResult::Ok + } + Err(error) => DebugCommandResult::Error(error.into()), + } + } + + fn handle_acvm_status(&mut self, status: ACVMStatus) -> DebugCommandResult { + if let ACVMStatus::RequiresForeignCall(foreign_call) = status { + return self.handle_foreign_call(foreign_call); + } + + match status { + ACVMStatus::Solved => DebugCommandResult::Done, + ACVMStatus::InProgress => { + if self.breakpoint_reached() { + DebugCommandResult::BreakpointReached( + self.get_current_opcode_location() + .expect("Breakpoint reached but we have no location"), + ) + } else { + DebugCommandResult::Ok + } + } + ACVMStatus::Failure(error) => DebugCommandResult::Error(NargoError::ExecutionError( + ExecutionError::SolvingError(error), + )), + ACVMStatus::RequiresForeignCall(_) => { + unreachable!("Unexpected pending foreign call resolution"); + } + } + } + + pub(super) fn step_into_opcode(&mut self) -> DebugCommandResult { + if self.brillig_solver.is_some() { + return self.step_brillig_opcode(); + } + + match self.acvm.step_into_brillig_opcode() { + StepResult::IntoBrillig(solver) => { + self.brillig_solver = Some(solver); + self.step_brillig_opcode() + } + StepResult::Status(status) => self.handle_acvm_status(status), + } + } + + pub(super) fn step_acir_opcode(&mut self) -> DebugCommandResult { + let status = if let Some(solver) = self.brillig_solver.take() { + self.acvm.finish_brillig_with_solver(solver) + } else { + self.acvm.solve_opcode() + }; + self.handle_acvm_status(status) + } + + pub(super) fn next(&mut self) -> DebugCommandResult { + let start_location = self.get_current_source_location(); + loop { + let result = self.step_into_opcode(); + if !matches!(result, DebugCommandResult::Ok) { + return result; + } + let new_location = self.get_current_source_location(); + if new_location.is_some() && new_location != start_location { + return DebugCommandResult::Ok; + } + } + } + + pub(super) fn cont(&mut self) -> DebugCommandResult { + loop { + let result = self.step_into_opcode(); + if !matches!(result, DebugCommandResult::Ok) { + return result; + } + } + } + + pub(super) fn is_executing_brillig(&self) -> bool { + let opcodes = self.get_opcodes(); + let acir_index = self.acvm.instruction_pointer(); + acir_index < opcodes.len() && matches!(opcodes[acir_index], Opcode::Brillig(..)) + } + + pub(super) fn get_brillig_registers(&self) -> Option<&Registers> { + self.brillig_solver.as_ref().map(|solver| solver.get_registers()) + } + + pub(super) fn set_brillig_register(&mut self, register_index: usize, value: FieldElement) { + if let Some(solver) = self.brillig_solver.as_mut() { + solver.set_register(register_index, value.into()); + } + } + + pub(super) fn get_brillig_memory(&self) -> Option<&[Value]> { + self.brillig_solver.as_ref().map(|solver| solver.get_memory()) + } + + pub(super) fn write_brillig_memory(&mut self, ptr: usize, value: FieldElement) { + if let Some(solver) = self.brillig_solver.as_mut() { + solver.write_memory_at(ptr, value.into()); + } + } + + fn breakpoint_reached(&self) -> bool { + if let Some(location) = self.get_current_opcode_location() { + self.breakpoints.contains(&location) + } else { + false + } + } + + pub(super) fn is_valid_opcode_location(&self, location: &OpcodeLocation) -> bool { + let opcodes = self.get_opcodes(); + match *location { + OpcodeLocation::Acir(acir_index) => acir_index < opcodes.len(), + OpcodeLocation::Brillig { acir_index, brillig_index } => { + acir_index < opcodes.len() + && matches!(opcodes[acir_index], Opcode::Brillig(..)) + && { + if let Opcode::Brillig(ref brillig) = opcodes[acir_index] { + brillig_index < brillig.bytecode.len() + } else { + false + } + } + } + } + } + + pub(super) fn is_breakpoint_set(&self, location: &OpcodeLocation) -> bool { + self.breakpoints.contains(location) + } + + pub(super) fn add_breakpoint(&mut self, location: OpcodeLocation) -> bool { + self.breakpoints.insert(location) + } + + pub(super) fn delete_breakpoint(&mut self, location: &OpcodeLocation) -> bool { + self.breakpoints.remove(location) + } + + pub(super) fn iterate_breakpoints(&self) -> Iter<'_, OpcodeLocation> { + self.breakpoints.iter() + } + + pub(super) fn is_solved(&self) -> bool { + matches!(self.acvm.get_status(), ACVMStatus::Solved) + } + + pub fn finalize(self) -> WitnessMap { + self.acvm.finalize() + } +} diff --git a/noir/tooling/debugger/src/lib.rs b/noir/tooling/debugger/src/lib.rs new file mode 100644 index 00000000000..7c6a9e9f618 --- /dev/null +++ b/noir/tooling/debugger/src/lib.rs @@ -0,0 +1,18 @@ +mod context; +mod repl; + +use acvm::BlackBoxFunctionSolver; +use acvm::{acir::circuit::Circuit, acir::native_types::WitnessMap}; + +use nargo::artifacts::debug::DebugArtifact; + +use nargo::NargoError; + +pub fn debug_circuit( + blackbox_solver: &B, + circuit: &Circuit, + debug_artifact: DebugArtifact, + initial_witness: WitnessMap, +) -> Result, NargoError> { + repl::run(blackbox_solver, circuit, &debug_artifact, initial_witness) +} diff --git a/noir/tooling/debugger/src/repl.rs b/noir/tooling/debugger/src/repl.rs new file mode 100644 index 00000000000..23abe83c38d --- /dev/null +++ b/noir/tooling/debugger/src/repl.rs @@ -0,0 +1,568 @@ +use crate::context::{DebugCommandResult, DebugContext}; + +use acvm::acir::circuit::{Circuit, Opcode, OpcodeLocation}; +use acvm::acir::native_types::{Witness, WitnessMap}; +use acvm::{BlackBoxFunctionSolver, FieldElement}; + +use nargo::artifacts::debug::DebugArtifact; +use nargo::NargoError; + +use easy_repl::{command, CommandStatus, Repl}; +use std::cell::RefCell; + +use codespan_reporting::files::Files; +use noirc_errors::Location; + +use owo_colors::OwoColorize; + +use std::ops::Range; + +pub struct ReplDebugger<'a, B: BlackBoxFunctionSolver> { + context: DebugContext<'a, B>, + blackbox_solver: &'a B, + circuit: &'a Circuit, + debug_artifact: &'a DebugArtifact, + initial_witness: WitnessMap, + last_result: DebugCommandResult, +} + +impl<'a, B: BlackBoxFunctionSolver> ReplDebugger<'a, B> { + pub fn new( + blackbox_solver: &'a B, + circuit: &'a Circuit, + debug_artifact: &'a DebugArtifact, + initial_witness: WitnessMap, + ) -> Self { + let context = + DebugContext::new(blackbox_solver, circuit, debug_artifact, initial_witness.clone()); + Self { + context, + blackbox_solver, + circuit, + debug_artifact, + initial_witness, + last_result: DebugCommandResult::Ok, + } + } + + pub fn show_current_vm_status(&self) { + let location = self.context.get_current_opcode_location(); + let opcodes = self.context.get_opcodes(); + + match location { + None => println!("Finished execution"), + Some(location) => { + match location { + OpcodeLocation::Acir(ip) => { + println!("At opcode {}: {}", ip, opcodes[ip]) + } + OpcodeLocation::Brillig { acir_index, brillig_index } => { + let Opcode::Brillig(ref brillig) = opcodes[acir_index] else { + unreachable!("Brillig location does not contain a Brillig block"); + }; + println!( + "At opcode {}.{}: {:?}", + acir_index, brillig_index, brillig.bytecode[brillig_index] + ); + } + } + self.show_source_code_location(&location); + } + } + } + + fn print_location_path(&self, loc: Location) { + let line_number = self.debug_artifact.location_line_number(loc).unwrap(); + let column_number = self.debug_artifact.location_column_number(loc).unwrap(); + + println!( + "At {}:{line_number}:{column_number}", + self.debug_artifact.name(loc.file).unwrap() + ); + } + + fn show_source_code_location(&self, location: &OpcodeLocation) { + let locations = self.debug_artifact.debug_symbols[0].opcode_location(location); + let Some(locations) = locations else { return }; + for loc in locations { + self.print_location_path(loc); + + let loc_line_index = self.debug_artifact.location_line_index(loc).unwrap(); + + // How many lines before or after the location's line we + // print + let context_lines = 5; + + let first_line_to_print = + if loc_line_index < context_lines { 0 } else { loc_line_index - context_lines }; + + let last_line_index = self.debug_artifact.last_line_index(loc).unwrap(); + let last_line_to_print = std::cmp::min(loc_line_index + context_lines, last_line_index); + + let source = self.debug_artifact.location_source_code(loc).unwrap(); + for (current_line_index, line) in source.lines().enumerate() { + let current_line_number = current_line_index + 1; + + if current_line_index < first_line_to_print { + // Ignore lines before range starts + continue; + } else if current_line_index == first_line_to_print && current_line_index > 0 { + // Denote that there's more lines before but we're not showing them + print_line_of_ellipsis(current_line_index); + } + + if current_line_index > last_line_to_print { + // Denote that there's more lines after but we're not showing them, + // and stop printing + print_line_of_ellipsis(current_line_number); + break; + } + + if current_line_index == loc_line_index { + // Highlight current location + let Range { start: loc_start, end: loc_end } = + self.debug_artifact.location_in_line(loc).unwrap(); + println!( + "{:>3} {:2} {}{}{}", + current_line_number, + "->", + &line[0..loc_start].to_string().dimmed(), + &line[loc_start..loc_end], + &line[loc_end..].to_string().dimmed() + ); + } else { + print_dimmed_line(current_line_number, line); + } + } + } + } + + fn display_opcodes(&self) { + let opcodes = self.context.get_opcodes(); + let current_opcode_location = self.context.get_current_opcode_location(); + let current_acir_index = match current_opcode_location { + Some(OpcodeLocation::Acir(ip)) => Some(ip), + Some(OpcodeLocation::Brillig { acir_index, .. }) => Some(acir_index), + None => None, + }; + let current_brillig_index = match current_opcode_location { + Some(OpcodeLocation::Brillig { brillig_index, .. }) => brillig_index, + _ => 0, + }; + let outer_marker = |acir_index| { + if current_acir_index == Some(acir_index) { + "->" + } else if self.context.is_breakpoint_set(&OpcodeLocation::Acir(acir_index)) { + " *" + } else { + "" + } + }; + let brillig_marker = |acir_index, brillig_index| { + if current_acir_index == Some(acir_index) && brillig_index == current_brillig_index { + "->" + } else if self + .context + .is_breakpoint_set(&OpcodeLocation::Brillig { acir_index, brillig_index }) + { + " *" + } else { + "" + } + }; + for (acir_index, opcode) in opcodes.iter().enumerate() { + let marker = outer_marker(acir_index); + if let Opcode::Brillig(brillig) = opcode { + println!("{:>3} {:2} BRILLIG inputs={:?}", acir_index, marker, brillig.inputs); + println!(" | outputs={:?}", brillig.outputs); + for (brillig_index, brillig_opcode) in brillig.bytecode.iter().enumerate() { + println!( + "{:>3}.{:<2} |{:2} {:?}", + acir_index, + brillig_index, + brillig_marker(acir_index, brillig_index), + brillig_opcode + ); + } + } else { + println!("{:>3} {:2} {:?}", acir_index, marker, opcode); + } + } + } + + fn add_breakpoint_at(&mut self, location: OpcodeLocation) { + if !self.context.is_valid_opcode_location(&location) { + println!("Invalid opcode location {location}"); + } else if self.context.add_breakpoint(location) { + println!("Added breakpoint at opcode {location}"); + } else { + println!("Breakpoint at opcode {location} already set"); + } + } + + fn delete_breakpoint_at(&mut self, location: OpcodeLocation) { + if self.context.delete_breakpoint(&location) { + println!("Breakpoint at opcode {location} deleted"); + } else { + println!("Breakpoint at opcode {location} not set"); + } + } + + fn validate_in_progress(&self) -> bool { + match self.last_result { + DebugCommandResult::Ok | DebugCommandResult::BreakpointReached(..) => true, + DebugCommandResult::Done => { + println!("Execution finished"); + false + } + DebugCommandResult::Error(ref error) => { + println!("ERROR: {}", error); + self.show_current_vm_status(); + false + } + } + } + + fn handle_debug_command_result(&mut self, result: DebugCommandResult) { + match &result { + DebugCommandResult::BreakpointReached(location) => { + println!("Stopped at breakpoint in opcode {}", location); + } + DebugCommandResult::Error(error) => { + println!("ERROR: {}", error); + } + _ => (), + } + self.last_result = result; + self.show_current_vm_status(); + } + + fn step_acir_opcode(&mut self) { + if self.validate_in_progress() { + let result = self.context.step_acir_opcode(); + self.handle_debug_command_result(result); + } + } + + fn step_into_opcode(&mut self) { + if self.validate_in_progress() { + let result = self.context.step_into_opcode(); + self.handle_debug_command_result(result); + } + } + + fn next(&mut self) { + if self.validate_in_progress() { + let result = self.context.next(); + self.handle_debug_command_result(result); + } + } + + fn cont(&mut self) { + if self.validate_in_progress() { + println!("(Continuing execution...)"); + let result = self.context.cont(); + self.handle_debug_command_result(result); + } + } + + fn restart_session(&mut self) { + let breakpoints: Vec = + self.context.iterate_breakpoints().copied().collect(); + self.context = DebugContext::new( + self.blackbox_solver, + self.circuit, + self.debug_artifact, + self.initial_witness.clone(), + ); + for opcode_location in breakpoints { + self.context.add_breakpoint(opcode_location); + } + self.last_result = DebugCommandResult::Ok; + println!("Restarted debugging session."); + self.show_current_vm_status(); + } + + pub fn show_witness_map(&self) { + let witness_map = self.context.get_witness_map(); + // NOTE: we need to clone() here to get the iterator + for (witness, value) in witness_map.clone().into_iter() { + println!("_{} = {value}", witness.witness_index()); + } + } + + pub fn show_witness(&self, index: u32) { + if let Some(value) = self.context.get_witness_map().get_index(index) { + println!("_{} = {value}", index); + } + } + + pub fn update_witness(&mut self, index: u32, value: String) { + let Some(field_value) = FieldElement::try_from_str(&value) else { + println!("Invalid witness value: {value}"); + return; + }; + + let witness = Witness::from(index); + _ = self.context.overwrite_witness(witness, field_value); + println!("_{} = {value}", index); + } + + pub fn show_brillig_registers(&self) { + if !self.context.is_executing_brillig() { + println!("Not executing a Brillig block"); + return; + } + + let Some(registers) = self.context.get_brillig_registers() else { + // this can happen when just entering the Brillig block since ACVM + // would have not initialized the Brillig VM yet; in fact, the + // Brillig code may be skipped altogether + println!("Brillig VM registers not available"); + return; + }; + + for (index, value) in registers.inner.iter().enumerate() { + println!("{index} = {}", value.to_field()); + } + } + + pub fn set_brillig_register(&mut self, index: usize, value: String) { + let Some(field_value) = FieldElement::try_from_str(&value) else { + println!("Invalid value: {value}"); + return; + }; + if !self.context.is_executing_brillig() { + println!("Not executing a Brillig block"); + return; + } + self.context.set_brillig_register(index, field_value); + } + + pub fn show_brillig_memory(&self) { + if !self.context.is_executing_brillig() { + println!("Not executing a Brillig block"); + return; + } + + let Some(memory) = self.context.get_brillig_memory() else { + // this can happen when just entering the Brillig block since ACVM + // would have not initialized the Brillig VM yet; in fact, the + // Brillig code may be skipped altogether + println!("Brillig VM memory not available"); + return; + }; + + for (index, value) in memory.iter().enumerate() { + println!("{index} = {}", value.to_field()); + } + } + + pub fn write_brillig_memory(&mut self, index: usize, value: String) { + let Some(field_value) = FieldElement::try_from_str(&value) else { + println!("Invalid value: {value}"); + return; + }; + if !self.context.is_executing_brillig() { + println!("Not executing a Brillig block"); + return; + } + self.context.write_brillig_memory(index, field_value); + } + + fn is_solved(&self) -> bool { + self.context.is_solved() + } + + fn finalize(self) -> WitnessMap { + self.context.finalize() + } +} + +fn print_line_of_ellipsis(line_number: usize) { + println!("{}", format!("{:>3} {}", line_number, "...").dimmed()); +} + +fn print_dimmed_line(line_number: usize, line: &str) { + println!("{}", format!("{:>3} {:2} {}", line_number, "", line).dimmed()); +} + +pub fn run( + blackbox_solver: &B, + circuit: &Circuit, + debug_artifact: &DebugArtifact, + initial_witness: WitnessMap, +) -> Result, NargoError> { + let context = + RefCell::new(ReplDebugger::new(blackbox_solver, circuit, debug_artifact, initial_witness)); + let ref_context = &context; + + ref_context.borrow().show_current_vm_status(); + + let mut repl = Repl::builder() + .add( + "step", + command! { + "step to the next ACIR opcode", + () => || { + ref_context.borrow_mut().step_acir_opcode(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "into", + command! { + "step into to the next opcode", + () => || { + ref_context.borrow_mut().step_into_opcode(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "next", + command! { + "step until a new source location is reached", + () => || { + ref_context.borrow_mut().next(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "continue", + command! { + "continue execution until the end of the program", + () => || { + ref_context.borrow_mut().cont(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "restart", + command! { + "restart the debugging session", + () => || { + ref_context.borrow_mut().restart_session(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "opcodes", + command! { + "display ACIR opcodes", + () => || { + ref_context.borrow().display_opcodes(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "break", + command! { + "add a breakpoint at an opcode location", + (LOCATION:OpcodeLocation) => |location| { + ref_context.borrow_mut().add_breakpoint_at(location); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "delete", + command! { + "delete breakpoint at an opcode location", + (LOCATION:OpcodeLocation) => |location| { + ref_context.borrow_mut().delete_breakpoint_at(location); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "witness", + command! { + "show witness map", + () => || { + ref_context.borrow().show_witness_map(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "witness", + command! { + "display a single witness from the witness map", + (index: u32) => |index| { + ref_context.borrow().show_witness(index); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "witness", + command! { + "update a witness with the given value", + (index: u32, value: String) => |index, value| { + ref_context.borrow_mut().update_witness(index, value); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "registers", + command! { + "show Brillig registers (valid when executing a Brillig block)", + () => || { + ref_context.borrow().show_brillig_registers(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "regset", + command! { + "update a Brillig register with the given value", + (index: usize, value: String) => |index, value| { + ref_context.borrow_mut().set_brillig_register(index, value); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "memory", + command! { + "show Brillig memory (valid when executing a Brillig block)", + () => || { + ref_context.borrow().show_brillig_memory(); + Ok(CommandStatus::Done) + } + }, + ) + .add( + "memset", + command! { + "update a Brillig memory cell with the given value", + (index: usize, value: String) => |index, value| { + ref_context.borrow_mut().write_brillig_memory(index, value); + Ok(CommandStatus::Done) + } + }, + ) + .build() + .expect("Failed to initialize debugger repl"); + + repl.run().expect("Debugger error"); + + // REPL execution has finished. + // Drop it so that we can move fields out from `context` again. + drop(repl); + + if context.borrow().is_solved() { + let solved_witness = context.into_inner().finalize(); + Ok(Some(solved_witness)) + } else { + Ok(None) + } +} diff --git a/noir/tooling/lsp/Cargo.toml b/noir/tooling/lsp/Cargo.toml new file mode 100644 index 00000000000..9e642d5fe9c --- /dev/null +++ b/noir/tooling/lsp/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "noir_lsp" +description = "Language server for Noir" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +acvm.workspace = true +codespan-lsp.workspace = true +codespan-reporting.workspace = true +lsp-types.workspace = true +nargo.workspace = true +nargo_toml.workspace = true +noirc_driver.workspace = true +noirc_errors.workspace = true +noirc_frontend.workspace = true +serde.workspace = true +serde_json.workspace = true +tower.workspace = true +cfg-if.workspace = true +async-lsp = { workspace = true, features = ["omni-trait"] } +serde_with = "3.2.0" +fm.workspace = true + +[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] +wasm-bindgen.workspace = true + +[dev-dependencies] +tokio = { version = "1.0", features = ["macros", "rt"] } diff --git a/noir/tooling/lsp/src/lib.rs b/noir/tooling/lsp/src/lib.rs new file mode 100644 index 00000000000..79fc544692a --- /dev/null +++ b/noir/tooling/lsp/src/lib.rs @@ -0,0 +1,195 @@ +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] + +use std::{ + future::Future, + ops::{self, ControlFlow}, + path::{Path, PathBuf}, + pin::Pin, + task::{self, Poll}, +}; + +use acvm::BlackBoxFunctionSolver; +use async_lsp::{ + router::Router, AnyEvent, AnyNotification, AnyRequest, ClientSocket, Error, LspService, + ResponseError, +}; +use codespan_reporting::files; +use noirc_frontend::{ + graph::{CrateId, CrateName}, + hir::{Context, FunctionNameMatch}, +}; +use notifications::{ + on_did_change_configuration, on_did_change_text_document, on_did_close_text_document, + on_did_open_text_document, on_did_save_text_document, on_exit, on_initialized, +}; +use requests::{ + on_code_lens_request, on_initialize, on_profile_run_request, on_shutdown, on_test_run_request, + on_tests_request, +}; +use serde_json::Value as JsonValue; +use tower::Service; + +mod notifications; +mod requests; +mod solver; +mod types; + +use solver::WrapperSolver; +use types::{notification, request, NargoTest, NargoTestId, Position, Range, Url}; + +// State for the LSP gets implemented on this struct and is internal to the implementation +pub struct LspState { + root_path: Option, + client: ClientSocket, + solver: WrapperSolver, +} + +impl LspState { + fn new(client: &ClientSocket, solver: impl BlackBoxFunctionSolver + 'static) -> Self { + Self { client: client.clone(), root_path: None, solver: WrapperSolver(Box::new(solver)) } + } +} + +pub struct NargoLspService { + router: Router, +} + +impl NargoLspService { + pub fn new(client: &ClientSocket, solver: impl BlackBoxFunctionSolver + 'static) -> Self { + let state = LspState::new(client, solver); + let mut router = Router::new(state); + router + .request::(on_initialize) + .request::(on_shutdown) + .request::(on_code_lens_request) + .request::(on_tests_request) + .request::(on_test_run_request) + .request::(on_profile_run_request) + .notification::(on_initialized) + .notification::(on_did_change_configuration) + .notification::(on_did_open_text_document) + .notification::(on_did_change_text_document) + .notification::(on_did_close_text_document) + .notification::(on_did_save_text_document) + .notification::(on_exit); + Self { router } + } +} + +// This trait implemented as a passthrough to the router, which makes +// our `NargoLspService` a normal Service as far as Tower is concerned. +impl Service for NargoLspService { + type Response = JsonValue; + type Error = ResponseError; + type Future = Pin> + Send>>; + + fn poll_ready(&mut self, cx: &mut task::Context<'_>) -> Poll> { + self.router.poll_ready(cx) + } + + fn call(&mut self, req: AnyRequest) -> Self::Future { + self.router.call(req) + } +} + +// This trait implemented as a passthrough to the router, which makes +// our `NargoLspService` able to accept the `async-lsp` middleware. +impl LspService for NargoLspService { + fn notify(&mut self, notification: AnyNotification) -> ControlFlow> { + self.router.notify(notification) + } + + fn emit(&mut self, event: AnyEvent) -> ControlFlow> { + self.router.emit(event) + } +} + +fn get_package_tests_in_crate( + context: &Context, + crate_id: &CrateId, + crate_name: &CrateName, +) -> Option> { + let fm = &context.file_manager; + let files = fm.as_file_map(); + let tests = + context.get_all_test_functions_in_crate_matching(crate_id, FunctionNameMatch::Anything); + + let package_tests: Vec<_> = tests + .into_iter() + .map(|(func_name, test_function)| { + let location = context.function_meta(&test_function.get_id()).name.location; + let file_id = location.file; + + let range = + byte_span_to_range(files, file_id, location.span.into()).unwrap_or_default(); + let file_uri = Url::from_file_path(fm.path(file_id)) + .expect("Expected a valid file path that can be converted into a URI"); + + NargoTest { + id: NargoTestId::new(crate_name.clone(), func_name.clone()), + label: func_name, + uri: file_uri, + range, + } + }) + .collect(); + + if package_tests.is_empty() { + None + } else { + Some(package_tests) + } +} + +fn byte_span_to_range<'a, F: files::Files<'a> + ?Sized>( + files: &'a F, + file_id: F::FileId, + span: ops::Range, +) -> Option { + if let Ok(codespan_range) = codespan_lsp::byte_span_to_range(files, file_id, span) { + // We have to manually construct a Range because the codespan_lsp restricts lsp-types to the wrong version range + // TODO: codespan is unmaintained and we should probably subsume it. Ref https://github.com/brendanzab/codespan/issues/345 + let range = Range { + start: Position { + line: codespan_range.start.line, + character: codespan_range.start.character, + }, + end: Position { + line: codespan_range.end.line, + character: codespan_range.end.character, + }, + }; + Some(range) + } else { + None + } +} + +cfg_if::cfg_if! { + if #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] { + use wasm_bindgen::{prelude::*, JsValue}; + + #[wasm_bindgen(module = "@noir-lang/source-resolver")] + extern "C" { + + #[wasm_bindgen(catch)] + fn read_file(path: &str) -> Result; + + } + + fn get_non_stdlib_asset(path_to_file: &Path) -> std::io::Result { + let path_str = path_to_file.to_str().unwrap(); + match read_file(path_str) { + Ok(buffer) => Ok(buffer), + Err(_) => Err(Error::new(ErrorKind::Other, "could not read file using wasm")), + } + } + } else { + fn get_non_stdlib_asset(path_to_file: &Path) -> std::io::Result { + std::fs::read_to_string(path_to_file) + } + } +} diff --git a/noir/tooling/lsp/src/notifications/mod.rs b/noir/tooling/lsp/src/notifications/mod.rs new file mode 100644 index 00000000000..93fa8baf6ac --- /dev/null +++ b/noir/tooling/lsp/src/notifications/mod.rs @@ -0,0 +1,177 @@ +use std::ops::ControlFlow; + +use async_lsp::{ErrorCode, LanguageClient, ResponseError}; +use nargo::prepare_package; +use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_errors::{DiagnosticKind, FileDiagnostic}; + +use crate::types::{ + notification, Diagnostic, DiagnosticSeverity, DidChangeConfigurationParams, + DidChangeTextDocumentParams, DidCloseTextDocumentParams, DidOpenTextDocumentParams, + DidSaveTextDocumentParams, InitializedParams, LogMessageParams, MessageType, NargoPackageTests, + PublishDiagnosticsParams, +}; + +use crate::{byte_span_to_range, get_non_stdlib_asset, get_package_tests_in_crate, LspState}; + +pub(super) fn on_initialized( + _state: &mut LspState, + _params: InitializedParams, +) -> ControlFlow> { + ControlFlow::Continue(()) +} + +pub(super) fn on_did_change_configuration( + _state: &mut LspState, + _params: DidChangeConfigurationParams, +) -> ControlFlow> { + ControlFlow::Continue(()) +} + +pub(super) fn on_did_open_text_document( + _state: &mut LspState, + _params: DidOpenTextDocumentParams, +) -> ControlFlow> { + ControlFlow::Continue(()) +} + +pub(super) fn on_did_change_text_document( + _state: &mut LspState, + _params: DidChangeTextDocumentParams, +) -> ControlFlow> { + ControlFlow::Continue(()) +} + +pub(super) fn on_did_close_text_document( + _state: &mut LspState, + _params: DidCloseTextDocumentParams, +) -> ControlFlow> { + ControlFlow::Continue(()) +} + +pub(super) fn on_did_save_text_document( + state: &mut LspState, + params: DidSaveTextDocumentParams, +) -> ControlFlow> { + let file_path = match params.text_document.uri.to_file_path() { + Ok(file_path) => file_path, + Err(()) => { + return ControlFlow::Break(Err(ResponseError::new( + ErrorCode::REQUEST_FAILED, + "URI is not a valid file path", + ) + .into())) + } + }; + + let root_path = match &state.root_path { + Some(root) => root, + None => { + return ControlFlow::Break(Err(ResponseError::new( + ErrorCode::REQUEST_FAILED, + "Could not find project root", + ) + .into())); + } + }; + + let toml_path = match find_package_manifest(root_path, &file_path) { + Ok(toml_path) => toml_path, + Err(err) => { + // If we cannot find a manifest, we log a warning but return no diagnostics + // We can reconsider this when we can build a file without the need for a Nargo.toml file to resolve deps + let _ = state.client.log_message(LogMessageParams { + typ: MessageType::WARNING, + message: format!("{err}"), + }); + return ControlFlow::Continue(()); + } + }; + let workspace = match resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) { + Ok(workspace) => workspace, + Err(err) => { + // If we found a manifest, but the workspace is invalid, we raise an error about it + return ControlFlow::Break(Err(ResponseError::new( + ErrorCode::REQUEST_FAILED, + format!("{err}"), + ) + .into())); + } + }; + + let diagnostics: Vec<_> = workspace + .into_iter() + .flat_map(|package| -> Vec { + let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset)); + + let file_diagnostics = match check_crate(&mut context, crate_id, false) { + Ok(((), warnings)) => warnings, + Err(errors_and_warnings) => errors_and_warnings, + }; + + // We don't add test headings for a package if it contains no `#[test]` functions + if let Some(tests) = get_package_tests_in_crate(&context, &crate_id, &package.name) { + let _ = state.client.notify::(NargoPackageTests { + package: package.name.to_string(), + tests, + }); + } + + let fm = &context.file_manager; + let files = fm.as_file_map(); + + file_diagnostics + .into_iter() + .filter_map(|FileDiagnostic { file_id, diagnostic, call_stack: _ }| { + // Ignore diagnostics for any file that wasn't the file we saved + // TODO: In the future, we could create "related" diagnostics for these files + if fm.path(file_id) != file_path { + return None; + } + + // TODO: Should this be the first item in secondaries? Should we bail when we find a range? + let range = diagnostic + .secondaries + .into_iter() + .filter_map(|sec| byte_span_to_range(files, file_id, sec.span.into())) + .last() + .unwrap_or_default(); + + let severity = match diagnostic.kind { + DiagnosticKind::Error => DiagnosticSeverity::ERROR, + DiagnosticKind::Warning => DiagnosticSeverity::WARNING, + }; + Some(Diagnostic { + range, + severity: Some(severity), + message: diagnostic.message, + ..Default::default() + }) + }) + .collect() + }) + .collect(); + + // We need to refresh lenses when we compile since that's the only time they can be accurately reflected + std::mem::drop(state.client.code_lens_refresh(())); + + let _ = state.client.publish_diagnostics(PublishDiagnosticsParams { + uri: params.text_document.uri, + version: None, + diagnostics, + }); + + ControlFlow::Continue(()) +} + +pub(super) fn on_exit( + _state: &mut LspState, + _params: (), +) -> ControlFlow> { + ControlFlow::Continue(()) +} diff --git a/noir/tooling/lsp/src/requests/code_lens_request.rs b/noir/tooling/lsp/src/requests/code_lens_request.rs new file mode 100644 index 00000000000..602ed268981 --- /dev/null +++ b/noir/tooling/lsp/src/requests/code_lens_request.rs @@ -0,0 +1,235 @@ +use std::future::{self, Future}; + +use async_lsp::{ErrorCode, LanguageClient, ResponseError}; + +use nargo::{package::Package, prepare_package, workspace::Workspace}; +use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::hir::FunctionNameMatch; + +use crate::{ + byte_span_to_range, get_non_stdlib_asset, + types::{CodeLens, CodeLensParams, CodeLensResult, Command, LogMessageParams, MessageType}, + LspState, +}; + +const ARROW: &str = "▶\u{fe0e}"; +const TEST_COMMAND: &str = "nargo.test"; +const TEST_CODELENS_TITLE: &str = "Run Test"; +const COMPILE_COMMAND: &str = "nargo.compile"; +const COMPILE_CODELENS_TITLE: &str = "Compile"; +const INFO_COMMAND: &str = "nargo.info"; +const INFO_CODELENS_TITLE: &str = "Info"; +const EXECUTE_COMMAND: &str = "nargo.execute"; +const EXECUTE_CODELENS_TITLE: &str = "Execute"; + +const PROFILE_COMMAND: &str = "nargo.profile"; +const PROFILE_CODELENS_TITLE: &str = "Profile"; + +fn with_arrow(title: &str) -> String { + format!("{ARROW} {title}") +} + +fn package_selection_args(workspace: &Workspace, package: &Package) -> Vec { + vec![ + "--program-dir".into(), + workspace.root_dir.display().to_string().into(), + "--package".into(), + package.name.to_string().into(), + ] +} + +pub(crate) fn on_code_lens_request( + state: &mut LspState, + params: CodeLensParams, +) -> impl Future> { + future::ready(on_code_lens_request_inner(state, params)) +} + +fn on_code_lens_request_inner( + state: &mut LspState, + params: CodeLensParams, +) -> Result { + let file_path = params.text_document.uri.to_file_path().map_err(|_| { + ResponseError::new(ErrorCode::REQUEST_FAILED, "URI is not a valid file path") + })?; + + let root_path = state.root_path.as_deref().ok_or_else(|| { + ResponseError::new(ErrorCode::REQUEST_FAILED, "Could not find project root") + })?; + + let toml_path = match find_package_manifest(root_path, &file_path) { + Ok(toml_path) => toml_path, + Err(err) => { + // If we cannot find a manifest, we log a warning but return no code lenses + // We can reconsider this when we can build a file without the need for a Nargo.toml file to resolve deps + let _ = state.client.log_message(LogMessageParams { + typ: MessageType::WARNING, + message: err.to_string(), + }); + return Ok(None); + } + }; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + let mut lenses: Vec = vec![]; + + for package in &workspace { + let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset)); + // We ignore the warnings and errors produced by compilation for producing code lenses + // because we can still get the test functions even if compilation fails + let _ = check_crate(&mut context, crate_id, false); + + let fm = &context.file_manager; + let files = fm.as_file_map(); + let tests = context + .get_all_test_functions_in_crate_matching(&crate_id, FunctionNameMatch::Anything); + + for (func_name, test_function) in tests { + let location = context.function_meta(&test_function.get_id()).name.location; + let file_id = location.file; + + // Ignore diagnostics for any file that wasn't the file we saved + // TODO: In the future, we could create "related" diagnostics for these files + if fm.path(file_id) != file_path { + continue; + } + + let range = + byte_span_to_range(files, file_id, location.span.into()).unwrap_or_default(); + + let test_command = Command { + title: with_arrow(TEST_CODELENS_TITLE), + command: TEST_COMMAND.into(), + arguments: Some( + [ + package_selection_args(&workspace, package), + vec!["--exact".into(), func_name.into()], + ] + .concat(), + ), + }; + + let test_lens = CodeLens { range, command: Some(test_command), data: None }; + + lenses.push(test_lens); + } + + if package.is_binary() { + if let Some(main_func_id) = context.get_main_function(&crate_id) { + let location = context.function_meta(&main_func_id).name.location; + let file_id = location.file; + + // Ignore diagnostics for any file that wasn't the file we saved + // TODO: In the future, we could create "related" diagnostics for these files + if fm.path(file_id) != file_path { + continue; + } + + let range = + byte_span_to_range(files, file_id, location.span.into()).unwrap_or_default(); + + let compile_command = Command { + title: with_arrow(COMPILE_CODELENS_TITLE), + command: COMPILE_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let compile_lens = CodeLens { range, command: Some(compile_command), data: None }; + + lenses.push(compile_lens); + + let info_command = Command { + title: INFO_CODELENS_TITLE.to_string(), + command: INFO_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let info_lens = CodeLens { range, command: Some(info_command), data: None }; + + lenses.push(info_lens); + + let execute_command = Command { + title: EXECUTE_CODELENS_TITLE.to_string(), + command: EXECUTE_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let execute_lens = CodeLens { range, command: Some(execute_command), data: None }; + + lenses.push(execute_lens); + + let profile_command = Command { + title: PROFILE_CODELENS_TITLE.to_string(), + command: PROFILE_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let profile_lens = CodeLens { range, command: Some(profile_command), data: None }; + + lenses.push(profile_lens); + } + } + + if package.is_contract() { + // Currently not looking to deduplicate this since we don't have a clear decision on if the Contract stuff is staying + for contract in context.get_all_contracts(&crate_id) { + let location = contract.location; + let file_id = location.file; + + // Ignore diagnostics for any file that wasn't the file we saved + // TODO: In the future, we could create "related" diagnostics for these files + if fm.path(file_id) != file_path { + continue; + } + + let range = + byte_span_to_range(files, file_id, location.span.into()).unwrap_or_default(); + + let compile_command = Command { + title: with_arrow(COMPILE_CODELENS_TITLE), + command: COMPILE_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let compile_lens = CodeLens { range, command: Some(compile_command), data: None }; + + lenses.push(compile_lens); + + let info_command = Command { + title: INFO_CODELENS_TITLE.to_string(), + command: INFO_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let info_lens = CodeLens { range, command: Some(info_command), data: None }; + + lenses.push(info_lens); + + let profile_command = Command { + title: PROFILE_CODELENS_TITLE.to_string(), + command: PROFILE_COMMAND.into(), + arguments: Some(package_selection_args(&workspace, package)), + }; + + let profile_lens = CodeLens { range, command: Some(profile_command), data: None }; + + lenses.push(profile_lens); + } + } + } + + if lenses.is_empty() { + Ok(None) + } else { + Ok(Some(lenses)) + } +} diff --git a/noir/tooling/lsp/src/requests/mod.rs b/noir/tooling/lsp/src/requests/mod.rs new file mode 100644 index 00000000000..b2be24e1187 --- /dev/null +++ b/noir/tooling/lsp/src/requests/mod.rs @@ -0,0 +1,100 @@ +use std::future::Future; + +use crate::types::{CodeLensOptions, InitializeParams, TextDocumentSyncOptions}; +use async_lsp::ResponseError; + +use crate::{ + types::{InitializeResult, NargoCapability, NargoTestsOptions, ServerCapabilities}, + LspState, +}; + +// Handlers +// The handlers for `request` are not `async` because it compiles down to lifetimes that can't be added to +// the router. To return a future that fits the trait, it is easiest wrap your implementations in an `async {}` +// block but you can also use `std::future::ready`. +// +// Additionally, the handlers for `notification` aren't async at all. +// +// They are not attached to the `NargoLspService` struct so they can be unit tested with only `LspState` +// and params passed in. + +mod code_lens_request; +mod profile_run; +mod test_run; +mod tests; + +pub(crate) use { + code_lens_request::on_code_lens_request, profile_run::on_profile_run_request, + test_run::on_test_run_request, tests::on_tests_request, +}; + +pub(crate) fn on_initialize( + state: &mut LspState, + params: InitializeParams, +) -> impl Future> { + state.root_path = params.root_uri.and_then(|root_uri| root_uri.to_file_path().ok()); + + async { + let text_document_sync = + TextDocumentSyncOptions { save: Some(true.into()), ..Default::default() }; + + let code_lens = CodeLensOptions { resolve_provider: Some(false) }; + + let nargo = NargoCapability { + tests: Some(NargoTestsOptions { + fetch: Some(true), + run: Some(true), + update: Some(true), + }), + }; + + Ok(InitializeResult { + capabilities: ServerCapabilities { + text_document_sync: Some(text_document_sync.into()), + code_lens_provider: Some(code_lens), + nargo: Some(nargo), + }, + server_info: None, + }) + } +} + +pub(crate) fn on_shutdown( + _state: &mut LspState, + _params: (), +) -> impl Future> { + async { Ok(()) } +} + +#[cfg(test)] +mod initialization { + use async_lsp::ClientSocket; + use lsp_types::{ + CodeLensOptions, InitializeParams, TextDocumentSyncCapability, TextDocumentSyncOptions, + }; + use tokio::test; + + use crate::{ + requests::on_initialize, solver::MockBackend, types::ServerCapabilities, LspState, + }; + + #[test] + async fn test_on_initialize() { + let client = ClientSocket::new_closed(); + let solver = MockBackend; + let mut state = LspState::new(&client, solver); + let params = InitializeParams::default(); + let response = on_initialize(&mut state, params).await.unwrap(); + assert!(matches!( + response.capabilities, + ServerCapabilities { + text_document_sync: Some(TextDocumentSyncCapability::Options( + TextDocumentSyncOptions { save: Some(_), .. } + )), + code_lens_provider: Some(CodeLensOptions { resolve_provider: Some(false) }), + .. + } + )); + assert!(response.server_info.is_none()); + } +} diff --git a/noir/tooling/lsp/src/requests/profile_run.rs b/noir/tooling/lsp/src/requests/profile_run.rs new file mode 100644 index 00000000000..84888d30ba5 --- /dev/null +++ b/noir/tooling/lsp/src/requests/profile_run.rs @@ -0,0 +1,102 @@ +use std::{ + collections::{BTreeMap, HashMap}, + future::{self, Future}, +}; + +use acvm::{acir::circuit::Opcode, Language}; +use async_lsp::{ErrorCode, ResponseError}; +use nargo::artifacts::debug::DebugArtifact; +use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{CompileOptions, DebugFile, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_errors::{debug_info::OpCodesCount, Location}; + +use crate::{ + types::{NargoProfileRunParams, NargoProfileRunResult}, + LspState, +}; +use fm::FileId; + +pub(crate) fn on_profile_run_request( + state: &mut LspState, + params: NargoProfileRunParams, +) -> impl Future> { + future::ready(on_profile_run_request_inner(state, params)) +} + +fn on_profile_run_request_inner( + state: &LspState, + params: NargoProfileRunParams, +) -> Result { + let root_path = state.root_path.as_deref().ok_or_else(|| { + ResponseError::new(ErrorCode::REQUEST_FAILED, "Could not find project root") + })?; + + let toml_path = find_package_manifest(root_path, root_path).map_err(|err| { + // If we cannot find a manifest, we can't run the test + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + let crate_name = params.package; + + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::DefaultOrAll, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + // Since we filtered on crate name, this should be the only item in the iterator + match workspace.into_iter().next() { + Some(_package) => { + let (binary_packages, contract_packages): (Vec<_>, Vec<_>) = workspace + .into_iter() + .filter(|package| !package.is_library()) + .cloned() + .partition(|package| package.is_binary()); + + // # TODO(#3504): Consider how to incorporate Backend relevant information in wider context. + let is_opcode_supported = |_opcode: &Opcode| true; + let np_language = Language::PLONKCSat { width: 3 }; + + let (compiled_programs, compiled_contracts) = nargo::ops::compile_workspace( + &workspace, + &binary_packages, + &contract_packages, + np_language, + is_opcode_supported, + &CompileOptions::default(), + ) + .map_err(|err| ResponseError::new(ErrorCode::REQUEST_FAILED, err))?; + + let mut opcodes_counts: HashMap = HashMap::new(); + let mut file_map: BTreeMap = BTreeMap::new(); + for compiled_program in &compiled_programs { + let span_opcodes = compiled_program.debug.count_span_opcodes(); + let debug_artifact: DebugArtifact = compiled_program.clone().into(); + opcodes_counts.extend(span_opcodes); + file_map.extend(debug_artifact.file_map); + } + + for compiled_contract in &compiled_contracts { + let functions = &compiled_contract.functions; + let debug_artifact: DebugArtifact = compiled_contract.clone().into(); + file_map.extend(debug_artifact.file_map); + for contract_function in functions { + let span_opcodes = contract_function.debug.count_span_opcodes(); + opcodes_counts.extend(span_opcodes); + } + } + + let result = NargoProfileRunResult { file_map, opcodes_counts }; + + Ok(result) + } + None => Err(ResponseError::new( + ErrorCode::REQUEST_FAILED, + format!("Could not locate package named: {crate_name}"), + )), + } +} diff --git a/noir/tooling/lsp/src/requests/test_run.rs b/noir/tooling/lsp/src/requests/test_run.rs new file mode 100644 index 00000000000..962fe99a49b --- /dev/null +++ b/noir/tooling/lsp/src/requests/test_run.rs @@ -0,0 +1,102 @@ +use std::future::{self, Future}; + +use async_lsp::{ErrorCode, ResponseError}; +use nargo::{ + ops::{run_test, TestStatus}, + prepare_package, +}; +use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{check_crate, CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::hir::FunctionNameMatch; + +use crate::{ + get_non_stdlib_asset, + types::{NargoTestRunParams, NargoTestRunResult}, + LspState, +}; + +pub(crate) fn on_test_run_request( + state: &mut LspState, + params: NargoTestRunParams, +) -> impl Future> { + future::ready(on_test_run_request_inner(state, params)) +} + +fn on_test_run_request_inner( + state: &LspState, + params: NargoTestRunParams, +) -> Result { + let root_path = state.root_path.as_deref().ok_or_else(|| { + ResponseError::new(ErrorCode::REQUEST_FAILED, "Could not find project root") + })?; + + let toml_path = find_package_manifest(root_path, root_path).map_err(|err| { + // If we cannot find a manifest, we can't run the test + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + let crate_name = params.id.crate_name(); + let function_name = params.id.function_name(); + + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::Selected(crate_name.clone()), + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + // Since we filtered on crate name, this should be the only item in the iterator + match workspace.into_iter().next() { + Some(package) => { + let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset)); + if check_crate(&mut context, crate_id, false).is_err() { + let result = NargoTestRunResult { + id: params.id.clone(), + result: "error".to_string(), + message: Some("The project failed to compile".into()), + }; + return Ok(result); + }; + + let test_functions = context.get_all_test_functions_in_crate_matching( + &crate_id, + FunctionNameMatch::Exact(function_name), + ); + + let (_, test_function) = test_functions.into_iter().next().ok_or_else(|| { + ResponseError::new( + ErrorCode::REQUEST_FAILED, + format!("Could not locate test named: {function_name} in {crate_name}"), + ) + })?; + + let test_result = + run_test(&state.solver, &context, test_function, false, &CompileOptions::default()); + let result = match test_result { + TestStatus::Pass => NargoTestRunResult { + id: params.id.clone(), + result: "pass".to_string(), + message: None, + }, + TestStatus::Fail { message, .. } => NargoTestRunResult { + id: params.id.clone(), + result: "fail".to_string(), + message: Some(message), + }, + TestStatus::CompileError(diag) => NargoTestRunResult { + id: params.id.clone(), + result: "error".to_string(), + message: Some(diag.diagnostic.message), + }, + }; + Ok(result) + } + None => Err(ResponseError::new( + ErrorCode::REQUEST_FAILED, + format!("Could not locate package named: {crate_name}"), + )), + } +} diff --git a/noir/tooling/lsp/src/requests/tests.rs b/noir/tooling/lsp/src/requests/tests.rs new file mode 100644 index 00000000000..6b94b921a06 --- /dev/null +++ b/noir/tooling/lsp/src/requests/tests.rs @@ -0,0 +1,72 @@ +use std::future::{self, Future}; + +use async_lsp::{ErrorCode, LanguageClient, ResponseError}; +use lsp_types::{LogMessageParams, MessageType}; +use nargo::prepare_package; +use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{check_crate, NOIR_ARTIFACT_VERSION_STRING}; + +use crate::{ + get_non_stdlib_asset, get_package_tests_in_crate, + types::{NargoPackageTests, NargoTestsParams, NargoTestsResult}, + LspState, +}; + +pub(crate) fn on_tests_request( + state: &mut LspState, + params: NargoTestsParams, +) -> impl Future> { + future::ready(on_tests_request_inner(state, params)) +} + +fn on_tests_request_inner( + state: &mut LspState, + _params: NargoTestsParams, +) -> Result { + let root_path = state.root_path.as_deref().ok_or_else(|| { + ResponseError::new(ErrorCode::REQUEST_FAILED, "Could not find project root") + })?; + + let toml_path = match find_package_manifest(root_path, root_path) { + Ok(toml_path) => toml_path, + Err(err) => { + // If we cannot find a manifest, we log a warning but return no code lenses + // We can reconsider this when we can build a file without the need for a Nargo.toml file to resolve deps + let _ = state.client.log_message(LogMessageParams { + typ: MessageType::WARNING, + message: err.to_string(), + }); + return Ok(None); + } + }; + + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + ) + .map_err(|err| { + // If we found a manifest, but the workspace is invalid, we raise an error about it + ResponseError::new(ErrorCode::REQUEST_FAILED, err) + })?; + + let package_tests: Vec<_> = workspace + .into_iter() + .filter_map(|package| { + let (mut context, crate_id) = prepare_package(package, Box::new(get_non_stdlib_asset)); + // We ignore the warnings and errors produced by compilation for producing tests + // because we can still get the test functions even if compilation fails + let _ = check_crate(&mut context, crate_id, false); + + // We don't add test headings for a package if it contains no `#[test]` functions + get_package_tests_in_crate(&context, &crate_id, &package.name) + .map(|tests| NargoPackageTests { package: package.name.to_string(), tests }) + }) + .collect(); + + if package_tests.is_empty() { + Ok(None) + } else { + Ok(Some(package_tests)) + } +} diff --git a/noir/tooling/lsp/src/solver.rs b/noir/tooling/lsp/src/solver.rs new file mode 100644 index 00000000000..090f71d63b4 --- /dev/null +++ b/noir/tooling/lsp/src/solver.rs @@ -0,0 +1,84 @@ +use acvm::BlackBoxFunctionSolver; + +// This is a struct that wraps a dynamically dispatched `BlackBoxFunctionSolver` +// where we proxy the unimplemented stuff to the wrapped backend, but it +// allows us to avoid changing function signatures to include the `Box` +pub(super) struct WrapperSolver(pub(super) Box); + +impl BlackBoxFunctionSolver for WrapperSolver { + fn schnorr_verify( + &self, + public_key_x: &acvm::FieldElement, + public_key_y: &acvm::FieldElement, + signature: &[u8], + message: &[u8], + ) -> Result { + self.0.schnorr_verify(public_key_x, public_key_y, signature, message) + } + + fn pedersen_commitment( + &self, + inputs: &[acvm::FieldElement], + domain_separator: u32, + ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { + self.0.pedersen_commitment(inputs, domain_separator) + } + + fn fixed_base_scalar_mul( + &self, + low: &acvm::FieldElement, + high: &acvm::FieldElement, + ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { + self.0.fixed_base_scalar_mul(low, high) + } + + fn pedersen_hash( + &self, + inputs: &[acvm::FieldElement], + domain_separator: u32, + ) -> Result { + self.0.pedersen_hash(inputs, domain_separator) + } +} + +// We also have a mocked implementation of the `BlackBoxFunctionSolver` trait for use in tests + +#[cfg(test)] +pub(crate) struct MockBackend; + +#[cfg(test)] +impl BlackBoxFunctionSolver for MockBackend { + fn schnorr_verify( + &self, + _public_key_x: &acvm::FieldElement, + _public_key_y: &acvm::FieldElement, + _signature: &[u8], + _message: &[u8], + ) -> Result { + unimplemented!() + } + + fn pedersen_commitment( + &self, + _inputs: &[acvm::FieldElement], + _domain_separator: u32, + ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { + unimplemented!() + } + + fn fixed_base_scalar_mul( + &self, + _low: &acvm::FieldElement, + _high: &acvm::FieldElement, + ) -> Result<(acvm::FieldElement, acvm::FieldElement), acvm::BlackBoxResolutionError> { + unimplemented!() + } + + fn pedersen_hash( + &self, + _inputs: &[acvm::FieldElement], + _domain_separator: u32, + ) -> Result { + unimplemented!() + } +} diff --git a/noir/tooling/lsp/src/types.rs b/noir/tooling/lsp/src/types.rs new file mode 100644 index 00000000000..7a50c538051 --- /dev/null +++ b/noir/tooling/lsp/src/types.rs @@ -0,0 +1,214 @@ +use fm::FileId; +use noirc_driver::DebugFile; +use noirc_errors::{debug_info::OpCodesCount, Location}; +use noirc_frontend::graph::CrateName; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; +use std::collections::{BTreeMap, HashMap}; + +// Re-providing lsp_types that we don't need to override +pub(crate) use lsp_types::{ + CodeLens, CodeLensOptions, CodeLensParams, Command, Diagnostic, DiagnosticSeverity, + DidChangeConfigurationParams, DidChangeTextDocumentParams, DidCloseTextDocumentParams, + DidOpenTextDocumentParams, DidSaveTextDocumentParams, InitializeParams, InitializedParams, + LogMessageParams, MessageType, Position, PublishDiagnosticsParams, Range, ServerInfo, + TextDocumentSyncCapability, TextDocumentSyncOptions, Url, +}; + +pub(crate) mod request { + use lsp_types::{request::Request, InitializeParams}; + + use super::{ + InitializeResult, NargoProfileRunParams, NargoProfileRunResult, NargoTestRunParams, + NargoTestRunResult, NargoTestsParams, NargoTestsResult, + }; + + // Re-providing lsp_types that we don't need to override + pub(crate) use lsp_types::request::{CodeLensRequest as CodeLens, Shutdown}; + + #[derive(Debug)] + pub(crate) struct Initialize; + impl Request for Initialize { + type Params = InitializeParams; + type Result = InitializeResult; + const METHOD: &'static str = "initialize"; + } + + #[derive(Debug)] + pub(crate) struct NargoTestRun; + impl Request for NargoTestRun { + type Params = NargoTestRunParams; + type Result = NargoTestRunResult; + const METHOD: &'static str = "nargo/tests/run"; + } + + #[derive(Debug)] + pub(crate) struct NargoTests; + impl Request for NargoTests { + type Params = NargoTestsParams; + type Result = NargoTestsResult; + const METHOD: &'static str = "nargo/tests"; + } + + #[derive(Debug)] + pub(crate) struct NargoProfileRun; + impl Request for NargoProfileRun { + type Params = NargoProfileRunParams; + type Result = NargoProfileRunResult; + const METHOD: &'static str = "nargo/profile/run"; + } +} + +pub(crate) mod notification { + use lsp_types::notification::Notification; + + use super::NargoPackageTests; + + // Re-providing lsp_types that we don't need to override + pub(crate) use lsp_types::notification::{ + DidChangeConfiguration, DidChangeTextDocument, DidCloseTextDocument, DidOpenTextDocument, + DidSaveTextDocument, Exit, Initialized, + }; + + pub(crate) struct NargoUpdateTests; + impl Notification for NargoUpdateTests { + type Params = NargoPackageTests; + const METHOD: &'static str = "nargo/tests/update"; + } +} + +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct NargoTestsOptions { + /// Tests can be requested from the server. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) fetch: Option, + + /// Tests runs can be requested from the server. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) run: Option, + + /// The server will send notifications to update tests. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) update: Option, +} + +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct NargoCapability { + /// The server will provide various features related to testing within Nargo. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) tests: Option, +} + +#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct ServerCapabilities { + /// Defines how text documents are synced. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) text_document_sync: Option, + + /// The server provides code lens. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) code_lens_provider: Option, + + /// The server handles and provides custom nargo messages. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) nargo: Option, +} + +#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct InitializeResult { + /// The capabilities the language server provides. + pub(crate) capabilities: ServerCapabilities, + + /// Information about the server. + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) server_info: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(try_from = "String", into = "String")] +pub(crate) struct NargoTestId { + package: CrateName, + fully_qualified_path: String, +} + +impl TryFrom for NargoTestId { + type Error = String; + + fn try_from(value: String) -> Result { + if let Some((crate_name, function_name)) = value.split_once('/') { + let crate_name = crate_name.parse()?; + Ok(Self { package: crate_name, fully_qualified_path: function_name.to_string() }) + } else { + Err("NargoTestId should be serialized as package_name/fully_qualified_path".to_string()) + } + } +} + +impl From for String { + fn from(value: NargoTestId) -> Self { + format!("{}/{}", value.package, value.fully_qualified_path) + } +} + +impl NargoTestId { + pub(crate) fn new(crate_name: CrateName, function_name: String) -> Self { + Self { package: crate_name, fully_qualified_path: function_name } + } + + pub(crate) fn crate_name(&self) -> &CrateName { + &self.package + } + + pub(crate) fn function_name(&self) -> &String { + &self.fully_qualified_path + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoTest { + pub(crate) id: NargoTestId, + /// Fully-qualified path to the test within the crate + pub(crate) label: String, + pub(crate) range: Range, + pub(crate) uri: Url, +} + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoPackageTests { + pub(crate) package: String, + pub(crate) tests: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoTestsParams {} + +pub(crate) type NargoTestsResult = Option>; + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoTestRunParams { + pub(crate) id: NargoTestId, +} + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoTestRunResult { + pub(crate) id: NargoTestId, + pub(crate) result: String, + pub(crate) message: Option, +} +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoProfileRunParams { + pub(crate) package: CrateName, +} +#[serde_as] +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct NargoProfileRunResult { + pub(crate) file_map: BTreeMap, + #[serde_as(as = "Vec<(_, _)>")] + pub(crate) opcodes_counts: HashMap, +} + +pub(crate) type CodeLensResult = Option>; diff --git a/noir/tooling/nargo/Cargo.toml b/noir/tooling/nargo/Cargo.toml new file mode 100644 index 00000000000..f8269459968 --- /dev/null +++ b/noir/tooling/nargo/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "nargo" +description = "Noir's package manager" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[build-dependencies] +rustc_version = "0.4.0" + +[dependencies] +acvm.workspace = true +fm.workspace = true +noirc_abi.workspace = true +noirc_driver.workspace = true +noirc_errors.workspace = true +noirc_evaluator.workspace = true +noirc_frontend.workspace = true +noirc_printable_type.workspace = true +iter-extended.workspace = true +serde.workspace = true +thiserror.workspace = true +codespan-reporting.workspace = true +rayon = "1.8.0" \ No newline at end of file diff --git a/noir/tooling/nargo/build.rs b/noir/tooling/nargo/build.rs new file mode 100644 index 00000000000..4fa7f58892a --- /dev/null +++ b/noir/tooling/nargo/build.rs @@ -0,0 +1,12 @@ +use rustc_version::{version, Version}; + +fn check_rustc_version() { + assert!( + version().unwrap() >= Version::parse("1.71.1").unwrap(), + "The minimal supported rustc version is 1.71.1." + ); +} + +fn main() { + check_rustc_version(); +} diff --git a/noir/tooling/nargo/src/artifacts/contract.rs b/noir/tooling/nargo/src/artifacts/contract.rs new file mode 100644 index 00000000000..f9e8d45b02e --- /dev/null +++ b/noir/tooling/nargo/src/artifacts/contract.rs @@ -0,0 +1,44 @@ +use acvm::acir::circuit::Circuit; +use noirc_abi::{Abi, ContractEvent}; +use noirc_driver::ContractFunctionType; +use serde::{Deserialize, Serialize}; + +/// `PreprocessedContract` represents a Noir contract which has been preprocessed by a particular backend proving system. +/// +/// This differs from a generic Noir contract artifact in that: +/// - The ACIR bytecode has had an optimization pass applied to tailor it for the backend. +/// - Proving and verification keys have been pregenerated based on this ACIR. +#[derive(Serialize, Deserialize)] +pub struct PreprocessedContract { + /// Version of noir used to compile this contract + pub noir_version: String, + /// The name of the contract. + pub name: String, + /// The identifier of the proving backend which this contract has been compiled for. + pub backend: String, + /// Each of the contract's functions are compiled into a separate program stored in this `Vec`. + pub functions: Vec, + /// All the events defined inside the contract scope. + pub events: Vec, +} + +/// Each function in the contract will be compiled as a separate noir program. +/// +/// A contract function unlike a regular Noir program however can have additional properties. +/// One of these being a function type. +#[derive(Debug, Serialize, Deserialize)] +pub struct PreprocessedContractFunction { + pub name: String, + + pub function_type: ContractFunctionType, + + pub is_internal: bool, + + pub abi: Abi, + + #[serde( + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" + )] + pub bytecode: Circuit, +} diff --git a/noir/tooling/nargo/src/artifacts/debug.rs b/noir/tooling/nargo/src/artifacts/debug.rs new file mode 100644 index 00000000000..40acc7db8f8 --- /dev/null +++ b/noir/tooling/nargo/src/artifacts/debug.rs @@ -0,0 +1,151 @@ +use codespan_reporting::files::{Error, Files, SimpleFile}; +use noirc_driver::{CompiledContract, CompiledProgram, DebugFile}; +use noirc_errors::{debug_info::DebugInfo, Location}; +use noirc_evaluator::errors::SsaReport; +use serde::{Deserialize, Serialize}; +use std::{ + collections::{BTreeMap, BTreeSet}, + ops::Range, +}; + +use fm::{FileId, FileManager, PathString}; + +/// A Debug Artifact stores, for a given program, the debug info for every function +/// along with a map of file Id to the source code so locations in debug info can be mapped to source code they point to. +#[derive(Debug, Serialize, Deserialize)] +pub struct DebugArtifact { + pub debug_symbols: Vec, + pub file_map: BTreeMap, + pub warnings: Vec, +} + +impl DebugArtifact { + pub fn new(debug_symbols: Vec, file_manager: &FileManager) -> Self { + let mut file_map = BTreeMap::new(); + + let files_with_debug_symbols: BTreeSet = debug_symbols + .iter() + .flat_map(|function_symbols| { + function_symbols + .locations + .values() + .flat_map(|call_stack| call_stack.iter().map(|location| location.file)) + }) + .collect(); + + for file_id in files_with_debug_symbols { + let file_source = file_manager.fetch_file(file_id).source(); + + file_map.insert( + file_id, + DebugFile { + source: file_source.to_string(), + path: file_manager.path(file_id).to_path_buf(), + }, + ); + } + + Self { debug_symbols, file_map, warnings: Vec::new() } + } + + /// Given a location, returns its file's source code + pub fn location_source_code(&self, location: Location) -> Result<&str, Error> { + self.source(location.file) + } + + /// Given a location, returns the index of the line it starts at + pub fn location_line_index(&self, location: Location) -> Result { + let location_start = location.span.start() as usize; + self.line_index(location.file, location_start) + } + + /// Given a location, returns the line number it starts at + pub fn location_line_number(&self, location: Location) -> Result { + let location_start = location.span.start() as usize; + let line_index = self.line_index(location.file, location_start)?; + self.line_number(location.file, line_index) + } + + /// Given a location, returns the column number it starts at + pub fn location_column_number(&self, location: Location) -> Result { + let location_start = location.span.start() as usize; + let line_index = self.line_index(location.file, location_start)?; + self.column_number(location.file, line_index, location_start) + } + + /// Given a location, returns a Span relative to its line's + /// position in the file. This is useful when processing a file's + /// contents on a per-line-basis. + pub fn location_in_line(&self, location: Location) -> Result, Error> { + let location_start = location.span.start() as usize; + let location_end = location.span.end() as usize; + let line_index = self.line_index(location.file, location_start)?; + let line_span = self.line_range(location.file, line_index)?; + + let start_in_line = location_start - line_span.start; + let end_in_line = location_end - line_span.start; + + Ok(Range { start: start_in_line, end: end_in_line }) + } + + /// Given a location, returns the last line index + /// of its file + pub fn last_line_index(&self, location: Location) -> Result { + let source = self.source(location.file)?; + self.line_index(location.file, source.len()) + } +} + +impl From for DebugArtifact { + fn from(compiled_program: CompiledProgram) -> Self { + DebugArtifact { + debug_symbols: vec![compiled_program.debug], + file_map: compiled_program.file_map, + warnings: compiled_program.warnings, + } + } +} + +impl From<&CompiledContract> for DebugArtifact { + fn from(compiled_artifact: &CompiledContract) -> Self { + let all_functions_debug: Vec = compiled_artifact + .functions + .iter() + .map(|contract_function| contract_function.debug.clone()) + .collect(); + + DebugArtifact { + debug_symbols: all_functions_debug, + file_map: compiled_artifact.file_map.clone(), + warnings: compiled_artifact.warnings.clone(), + } + } +} + +impl<'a> Files<'a> for DebugArtifact { + type FileId = FileId; + type Name = PathString; + type Source = &'a str; + + fn name(&self, file_id: Self::FileId) -> Result { + self.file_map.get(&file_id).ok_or(Error::FileMissing).map(|file| file.path.clone().into()) + } + + fn source(&'a self, file_id: Self::FileId) -> Result { + self.file_map.get(&file_id).ok_or(Error::FileMissing).map(|file| file.source.as_ref()) + } + + fn line_index(&self, file_id: Self::FileId, byte_index: usize) -> Result { + self.file_map.get(&file_id).ok_or(Error::FileMissing).and_then(|file| { + SimpleFile::new(PathString::from(file.path.clone()), file.source.clone()) + .line_index((), byte_index) + }) + } + + fn line_range(&self, file_id: Self::FileId, line_index: usize) -> Result, Error> { + self.file_map.get(&file_id).ok_or(Error::FileMissing).and_then(|file| { + SimpleFile::new(PathString::from(file.path.clone()), file.source.clone()) + .line_range((), line_index) + }) + } +} diff --git a/noir/tooling/nargo/src/artifacts/mod.rs b/noir/tooling/nargo/src/artifacts/mod.rs new file mode 100644 index 00000000000..180a900fd81 --- /dev/null +++ b/noir/tooling/nargo/src/artifacts/mod.rs @@ -0,0 +1,8 @@ +//! This module defines the structure of Nargo's different compilation artifacts. +//! +//! These artifacts are intended to remain independent of any applications being built on top of Noir. +//! Should any projects require/desire a different artifact format, it's expected that they will write a transformer +//! to generate them using these artifacts as a starting point. +pub mod contract; +pub mod debug; +pub mod program; diff --git a/noir/tooling/nargo/src/artifacts/program.rs b/noir/tooling/nargo/src/artifacts/program.rs new file mode 100644 index 00000000000..890b6c55f7d --- /dev/null +++ b/noir/tooling/nargo/src/artifacts/program.rs @@ -0,0 +1,28 @@ +use acvm::acir::circuit::Circuit; +use noirc_abi::Abi; +use serde::{Deserialize, Serialize}; + +/// `PreprocessedProgram` represents a Noir program which has been preprocessed by a particular backend proving system. +/// +/// This differs from a generic Noir program artifact in that: +/// - The ACIR bytecode has had an optimization pass applied to tailor it for the backend. +/// - Proving and verification keys have been pregenerated based on this ACIR. +#[derive(Serialize, Deserialize, Debug)] +pub struct PreprocessedProgram { + pub noir_version: String, + + /// Hash of the [`Program`][noirc_frontend::monomorphization::ast::Program] from which this [`PreprocessedProgram`] + /// was compiled. + /// + /// Used to short-circuit compilation in the case of the source code not changing since the last compilation. + pub hash: u64, + + pub backend: String, + pub abi: Abi, + + #[serde( + serialize_with = "Circuit::serialize_circuit_base64", + deserialize_with = "Circuit::deserialize_circuit_base64" + )] + pub bytecode: Circuit, +} diff --git a/noir/tooling/nargo/src/constants.rs b/noir/tooling/nargo/src/constants.rs new file mode 100644 index 00000000000..5e448277694 --- /dev/null +++ b/noir/tooling/nargo/src/constants.rs @@ -0,0 +1,23 @@ +// Directories +/// The directory for the `nargo contract` command output +pub const CONTRACT_DIR: &str = "contract"; +/// The directory to store serialized circuit proofs. +pub const PROOFS_DIR: &str = "proofs"; +/// The directory to store Noir source files +pub const SRC_DIR: &str = "src"; +/// The directory to store circuits' serialized ACIR representations. +pub const TARGET_DIR: &str = "target"; + +// Files +/// The file from which Nargo pulls prover inputs +pub const PROVER_INPUT_FILE: &str = "Prover"; +/// The file from which Nargo pulls verifier inputs +pub const VERIFIER_INPUT_FILE: &str = "Verifier"; +/// The package definition file for a Noir project. +pub const PKG_FILE: &str = "Nargo.toml"; + +// Extensions +/// The extension for files containing circuit proofs. +pub const PROOF_EXT: &str = "proof"; +/// The extension for files containing proof witnesses. +pub const WITNESS_EXT: &str = "tr"; diff --git a/noir/tooling/nargo/src/errors.rs b/noir/tooling/nargo/src/errors.rs new file mode 100644 index 00000000000..bca8ca24767 --- /dev/null +++ b/noir/tooling/nargo/src/errors.rs @@ -0,0 +1,165 @@ +use acvm::{ + acir::circuit::OpcodeLocation, + pwg::{ErrorLocation, OpcodeResolutionError}, +}; +use noirc_errors::{ + debug_info::DebugInfo, reporter::ReportedErrors, CustomDiagnostic, FileDiagnostic, +}; + +pub use noirc_errors::Location; + +use noirc_frontend::graph::CrateName; +use noirc_printable_type::ForeignCallError; +use thiserror::Error; + +/// Errors covering situations where a package cannot be compiled. +#[derive(Debug, Error)] +pub enum CompileError { + #[error("Package `{0}` has type `lib` but only `bin` types can be compiled")] + LibraryCrate(CrateName), + + #[error("Package `{0}` is expected to have a `main` function but it does not")] + MissingMainFunction(CrateName), + + /// Errors encountered while compiling the Noir program. + /// These errors are already written to stderr. + #[error("Aborting due to {} previous error{}", .0.error_count, if .0.error_count == 1 { "" } else { "s" })] + ReportedErrors(ReportedErrors), +} +impl From for CompileError { + fn from(errors: ReportedErrors) -> Self { + Self::ReportedErrors(errors) + } +} + +#[derive(Debug, Error)] +pub enum NargoError { + /// Error while compiling Noir into ACIR. + #[error("Failed to compile circuit")] + CompilationError, + + /// ACIR circuit execution error + #[error(transparent)] + ExecutionError(#[from] ExecutionError), + + /// Oracle handling error + #[error(transparent)] + ForeignCallError(#[from] ForeignCallError), +} + +impl From for NargoError { + fn from(_: acvm::compiler::CompileError) -> Self { + NargoError::CompilationError + } +} + +impl NargoError { + /// Extracts the user defined failure message from the ExecutionError + /// If one exists. + /// + /// We want to extract the user defined error so that we can compare it + /// in tests to expected failure messages + pub fn user_defined_failure_message(&self) -> Option<&str> { + let execution_error = match self { + NargoError::ExecutionError(error) => error, + _ => return None, + }; + + match execution_error { + ExecutionError::AssertionFailed(message, _) => Some(message), + ExecutionError::SolvingError(error) => match error { + OpcodeResolutionError::IndexOutOfBounds { .. } + | OpcodeResolutionError::UnsupportedBlackBoxFunc(_) + | OpcodeResolutionError::OpcodeNotSolvable(_) + | OpcodeResolutionError::UnsatisfiedConstrain { .. } => None, + OpcodeResolutionError::BrilligFunctionFailed { message, .. } => Some(message), + OpcodeResolutionError::BlackBoxFunctionFailed(_, reason) => Some(reason), + }, + } + } +} + +#[derive(Debug, Error)] +pub enum ExecutionError { + #[error("Failed assertion: '{}'", .0)] + AssertionFailed(String, Vec), + + #[error(transparent)] + SolvingError(#[from] OpcodeResolutionError), +} + +/// Extracts the opcode locations from a nargo error. +fn extract_locations_from_error( + error: &ExecutionError, + debug: &DebugInfo, +) -> Option> { + let mut opcode_locations = match error { + ExecutionError::SolvingError(OpcodeResolutionError::BrilligFunctionFailed { + call_stack, + .. + }) + | ExecutionError::AssertionFailed(_, call_stack) => Some(call_stack.clone()), + ExecutionError::SolvingError(OpcodeResolutionError::IndexOutOfBounds { + opcode_location: error_location, + .. + }) + | ExecutionError::SolvingError(OpcodeResolutionError::UnsatisfiedConstrain { + opcode_location: error_location, + }) => match error_location { + ErrorLocation::Unresolved => { + unreachable!("Cannot resolve index for unsatisfied constraint") + } + ErrorLocation::Resolved(opcode_location) => Some(vec![*opcode_location]), + }, + _ => None, + }?; + + if let Some(OpcodeLocation::Brillig { acir_index, .. }) = opcode_locations.first() { + opcode_locations.insert(0, OpcodeLocation::Acir(*acir_index)); + } + + Some( + opcode_locations + .iter() + .flat_map(|opcode_location| debug.opcode_location(opcode_location).unwrap_or_default()) + .collect(), + ) +} + +/// Tries to generate a runtime diagnostic from a nargo error. It will successfully do so if it's a runtime error with a call stack. +pub fn try_to_diagnose_runtime_error( + nargo_err: &NargoError, + debug: &DebugInfo, +) -> Option { + let execution_error = match nargo_err { + NargoError::ExecutionError(execution_error) => execution_error, + _ => return None, + }; + + let source_locations = extract_locations_from_error(execution_error, debug)?; + + // The location of the error itself will be the location at the top + // of the call stack (the last item in the Vec). + let location = source_locations.last()?; + + let message = match nargo_err { + NargoError::ExecutionError(ExecutionError::AssertionFailed(message, _)) => { + format!("Assertion failed: '{message}'") + } + NargoError::ExecutionError(ExecutionError::SolvingError( + OpcodeResolutionError::IndexOutOfBounds { index, array_size, .. }, + )) => { + format!("Index out of bounds, array has size {array_size:?}, but index was {index:?}") + } + NargoError::ExecutionError(ExecutionError::SolvingError( + OpcodeResolutionError::UnsatisfiedConstrain { .. }, + )) => "Failed constraint".into(), + _ => nargo_err.to_string(), + }; + + Some( + CustomDiagnostic::simple_error(message, String::new(), location.span) + .in_file(location.file) + .with_call_stack(source_locations), + ) +} diff --git a/noir/tooling/nargo/src/lib.rs b/noir/tooling/nargo/src/lib.rs new file mode 100644 index 00000000000..ef014fb436b --- /dev/null +++ b/noir/tooling/nargo/src/lib.rs @@ -0,0 +1,56 @@ +#![forbid(unsafe_code)] +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] + +//! Nargo is the package manager for Noir +//! This name was used because it sounds like `cargo` and +//! Noir Package Manager abbreviated is npm, which is already taken. + +pub mod artifacts; +pub mod constants; +pub mod errors; +pub mod ops; +pub mod package; +pub mod workspace; + +use std::collections::BTreeMap; + +use fm::{FileManager, FileReader}; +use noirc_driver::{add_dep, prepare_crate, prepare_dependency}; +use noirc_frontend::{ + graph::{CrateGraph, CrateId, CrateName}, + hir::Context, +}; +use package::{Dependency, Package}; + +pub use self::errors::NargoError; + +pub fn prepare_dependencies( + context: &mut Context, + parent_crate: CrateId, + dependencies: &BTreeMap, +) { + for (dep_name, dep) in dependencies.iter() { + match dep { + Dependency::Remote { package } | Dependency::Local { package } => { + let crate_id = prepare_dependency(context, &package.entry_path); + add_dep(context, parent_crate, crate_id, dep_name.clone()); + prepare_dependencies(context, crate_id, &package.dependencies); + } + } + } +} + +pub fn prepare_package(package: &Package, file_reader: Box) -> (Context, CrateId) { + // TODO: FileManager continues to leak into various crates + let fm = FileManager::new(&package.root_dir, file_reader); + let graph = CrateGraph::default(); + let mut context = Context::new(fm, graph); + + let crate_id = prepare_crate(&mut context, &package.entry_path); + + prepare_dependencies(&mut context, crate_id, &package.dependencies); + + (context, crate_id) +} diff --git a/noir/tooling/nargo/src/ops/compile.rs b/noir/tooling/nargo/src/ops/compile.rs new file mode 100644 index 00000000000..d4164eaa865 --- /dev/null +++ b/noir/tooling/nargo/src/ops/compile.rs @@ -0,0 +1,154 @@ +use acvm::{acir::circuit::Opcode, Language}; +use fm::FileManager; +use noirc_driver::{CompilationResult, CompileOptions, CompiledContract, CompiledProgram}; + +use crate::errors::CompileError; +use crate::prepare_package; +use crate::{package::Package, workspace::Workspace}; + +use rayon::prelude::*; + +/// Compiles workspace. +/// +/// # Errors +/// +/// This function will return an error if there are any compilations errors reported. +pub fn compile_workspace( + workspace: &Workspace, + binary_packages: &[Package], + contract_packages: &[Package], + np_language: Language, + is_opcode_supported: impl Fn(&Opcode) -> bool + std::marker::Sync, + compile_options: &CompileOptions, +) -> Result<(Vec, Vec), CompileError> { + // Compile all of the packages in parallel. + let program_results: Vec<(FileManager, CompilationResult)> = binary_packages + .par_iter() + .map(|package| { + compile_program(workspace, package, compile_options, np_language, &is_opcode_supported) + }) + .collect(); + let contract_results: Vec<(FileManager, CompilationResult)> = + contract_packages + .par_iter() + .map(|package| { + compile_contract(package, compile_options, np_language, &is_opcode_supported) + }) + .collect(); + + // Report any warnings/errors which were encountered during compilation. + let compiled_programs: Vec = program_results + .into_iter() + .map(|(file_manager, compilation_result)| { + report_errors( + compilation_result, + &file_manager, + compile_options.deny_warnings, + compile_options.silence_warnings, + ) + }) + .collect::>()?; + let compiled_contracts: Vec = contract_results + .into_iter() + .map(|(file_manager, compilation_result)| { + report_errors( + compilation_result, + &file_manager, + compile_options.deny_warnings, + compile_options.silence_warnings, + ) + }) + .collect::>()?; + + Ok((compiled_programs, compiled_contracts)) +} + +pub fn compile_program( + workspace: &Workspace, + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> (FileManager, CompilationResult) { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + + let program_artifact_path = workspace.package_build_path(package); + let mut debug_artifact_path = program_artifact_path.clone(); + debug_artifact_path.set_file_name(format!("debug_{}.json", package.name)); + + let (program, warnings) = + match noirc_driver::compile_main(&mut context, crate_id, compile_options, None, true) { + Ok(program_and_warnings) => program_and_warnings, + Err(errors) => { + return (context.file_manager, Err(errors)); + } + }; + + // TODO: we say that pedersen hashing is supported by all backends for now + let is_opcode_supported_pedersen_hash = |opcode: &Opcode| -> bool { + if let Opcode::BlackBoxFuncCall( + acvm::acir::circuit::opcodes::BlackBoxFuncCall::PedersenHash { .. }, + ) = opcode + { + true + } else { + is_opcode_supported(opcode) + } + }; + + // Apply backend specific optimizations. + let optimized_program = + crate::ops::optimize_program(program, np_language, &is_opcode_supported_pedersen_hash) + .expect("Backend does not support an opcode that is in the IR"); + + (context.file_manager, Ok((optimized_program, warnings))) +} + +fn compile_contract( + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> (FileManager, CompilationResult) { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + let (contract, warnings) = + match noirc_driver::compile_contract(&mut context, crate_id, compile_options) { + Ok(contracts_and_warnings) => contracts_and_warnings, + Err(errors) => { + return (context.file_manager, Err(errors)); + } + }; + + let optimized_contract = + crate::ops::optimize_contract(contract, np_language, &is_opcode_supported) + .expect("Backend does not support an opcode that is in the IR"); + + (context.file_manager, Ok((optimized_contract, warnings))) +} + +pub(crate) fn report_errors( + result: CompilationResult, + file_manager: &FileManager, + deny_warnings: bool, + silence_warnings: bool, +) -> Result { + let (t, warnings) = result.map_err(|errors| { + noirc_errors::reporter::report_all( + file_manager.as_file_map(), + &errors, + deny_warnings, + silence_warnings, + ) + })?; + + noirc_errors::reporter::report_all( + file_manager.as_file_map(), + &warnings, + deny_warnings, + silence_warnings, + ); + + Ok(t) +} diff --git a/noir/tooling/nargo/src/ops/execute.rs b/noir/tooling/nargo/src/ops/execute.rs new file mode 100644 index 00000000000..d7cb44188c4 --- /dev/null +++ b/noir/tooling/nargo/src/ops/execute.rs @@ -0,0 +1,59 @@ +use acvm::pwg::{ACVMStatus, ErrorLocation, OpcodeResolutionError, ACVM}; +use acvm::BlackBoxFunctionSolver; +use acvm::{acir::circuit::Circuit, acir::native_types::WitnessMap}; + +use crate::errors::ExecutionError; +use crate::NargoError; + +use super::foreign_calls::ForeignCallExecutor; + +pub fn execute_circuit( + circuit: &Circuit, + initial_witness: WitnessMap, + blackbox_solver: &B, + foreign_call_executor: &mut F, +) -> Result { + let mut acvm = ACVM::new(blackbox_solver, &circuit.opcodes, initial_witness); + + loop { + let solver_status = acvm.solve(); + + match solver_status { + ACVMStatus::Solved => break, + ACVMStatus::InProgress => { + unreachable!("Execution should not stop while in `InProgress` state.") + } + ACVMStatus::Failure(error) => { + let call_stack = match &error { + OpcodeResolutionError::UnsatisfiedConstrain { + opcode_location: ErrorLocation::Resolved(opcode_location), + } => Some(vec![*opcode_location]), + OpcodeResolutionError::BrilligFunctionFailed { call_stack, .. } => { + Some(call_stack.clone()) + } + _ => None, + }; + + return Err(NargoError::ExecutionError(match call_stack { + Some(call_stack) => { + if let Some(assert_message) = circuit.get_assert_message( + *call_stack.last().expect("Call stacks should not be empty"), + ) { + ExecutionError::AssertionFailed(assert_message.to_owned(), call_stack) + } else { + ExecutionError::SolvingError(error) + } + } + None => ExecutionError::SolvingError(error), + })); + } + ACVMStatus::RequiresForeignCall(foreign_call) => { + let foreign_call_result = foreign_call_executor.execute(&foreign_call)?; + acvm.resolve_pending_foreign_call(foreign_call_result); + } + } + } + + let solved_witness = acvm.finalize(); + Ok(solved_witness) +} diff --git a/noir/tooling/nargo/src/ops/foreign_calls.rs b/noir/tooling/nargo/src/ops/foreign_calls.rs new file mode 100644 index 00000000000..6cc78febab3 --- /dev/null +++ b/noir/tooling/nargo/src/ops/foreign_calls.rs @@ -0,0 +1,242 @@ +use acvm::{ + acir::brillig::{ForeignCallParam, ForeignCallResult, Value}, + pwg::ForeignCallWaitInfo, +}; +use iter_extended::vecmap; +use noirc_printable_type::{decode_string_value, ForeignCallError, PrintableValueDisplay}; + +pub trait ForeignCallExecutor { + fn execute( + &mut self, + foreign_call: &ForeignCallWaitInfo, + ) -> Result; +} + +/// This enumeration represents the Brillig foreign calls that are natively supported by nargo. +/// After resolution of a foreign call, nargo will restart execution of the ACVM +pub(crate) enum ForeignCall { + Println, + Sequence, + ReverseSequence, + CreateMock, + SetMockParams, + SetMockReturns, + SetMockTimes, + ClearMock, +} + +impl std::fmt::Display for ForeignCall { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.name()) + } +} + +impl ForeignCall { + pub(crate) fn name(&self) -> &'static str { + match self { + ForeignCall::Println => "println", + ForeignCall::Sequence => "get_number_sequence", + ForeignCall::ReverseSequence => "get_reverse_number_sequence", + ForeignCall::CreateMock => "create_mock", + ForeignCall::SetMockParams => "set_mock_params", + ForeignCall::SetMockReturns => "set_mock_returns", + ForeignCall::SetMockTimes => "set_mock_times", + ForeignCall::ClearMock => "clear_mock", + } + } + + pub(crate) fn lookup(op_name: &str) -> Option { + match op_name { + "println" => Some(ForeignCall::Println), + "get_number_sequence" => Some(ForeignCall::Sequence), + "get_reverse_number_sequence" => Some(ForeignCall::ReverseSequence), + "create_mock" => Some(ForeignCall::CreateMock), + "set_mock_params" => Some(ForeignCall::SetMockParams), + "set_mock_returns" => Some(ForeignCall::SetMockReturns), + "set_mock_times" => Some(ForeignCall::SetMockTimes), + "clear_mock" => Some(ForeignCall::ClearMock), + _ => None, + } + } +} + +/// This struct represents an oracle mock. It can be used for testing programs that use oracles. +#[derive(Debug, PartialEq, Eq, Clone)] +struct MockedCall { + /// The id of the mock, used to update or remove it + id: usize, + /// The oracle it's mocking + name: String, + /// Optionally match the parameters + params: Option>, + /// The result to return when this mock is called + result: ForeignCallResult, + /// How many times should this mock be called before it is removed + times_left: Option, +} + +impl MockedCall { + fn new(id: usize, name: String) -> Self { + Self { + id, + name, + params: None, + result: ForeignCallResult { values: vec![] }, + times_left: None, + } + } +} + +impl MockedCall { + fn matches(&self, name: &str, params: &Vec) -> bool { + self.name == name && (self.params.is_none() || self.params.as_ref() == Some(params)) + } +} + +#[derive(Debug, Default)] +pub struct DefaultForeignCallExecutor { + /// Mocks have unique ids used to identify them in Noir, allowing to update or remove them. + last_mock_id: usize, + /// The registered mocks + mocked_responses: Vec, + /// Whether to print [`ForeignCall::Println`] output. + show_output: bool, +} + +impl DefaultForeignCallExecutor { + pub fn new(show_output: bool) -> Self { + DefaultForeignCallExecutor { show_output, ..DefaultForeignCallExecutor::default() } + } +} + +impl DefaultForeignCallExecutor { + fn extract_mock_id( + foreign_call_inputs: &[ForeignCallParam], + ) -> Result<(usize, &[ForeignCallParam]), ForeignCallError> { + let (id, params) = + foreign_call_inputs.split_first().ok_or(ForeignCallError::MissingForeignCallInputs)?; + Ok((id.unwrap_value().to_usize(), params)) + } + + fn find_mock_by_id(&mut self, id: usize) -> Option<&mut MockedCall> { + self.mocked_responses.iter_mut().find(|response| response.id == id) + } + + fn parse_string(param: &ForeignCallParam) -> String { + let fields: Vec<_> = param.values().into_iter().map(|value| value.to_field()).collect(); + decode_string_value(&fields) + } + + fn execute_println(foreign_call_inputs: &[ForeignCallParam]) -> Result<(), ForeignCallError> { + let display_values: PrintableValueDisplay = foreign_call_inputs.try_into()?; + println!("{display_values}"); + Ok(()) + } +} + +impl ForeignCallExecutor for DefaultForeignCallExecutor { + fn execute( + &mut self, + foreign_call: &ForeignCallWaitInfo, + ) -> Result { + let foreign_call_name = foreign_call.function.as_str(); + match ForeignCall::lookup(foreign_call_name) { + Some(ForeignCall::Println) => { + if self.show_output { + Self::execute_println(&foreign_call.inputs)?; + } + Ok(ForeignCallResult { values: vec![] }) + } + Some(ForeignCall::Sequence) => { + let sequence_length: u128 = + foreign_call.inputs[0].unwrap_value().to_field().to_u128(); + let sequence = vecmap(0..sequence_length, Value::from); + + Ok(ForeignCallResult { + values: vec![ + ForeignCallParam::Single(sequence_length.into()), + ForeignCallParam::Array(sequence), + ], + }) + } + Some(ForeignCall::ReverseSequence) => { + let sequence_length: u128 = + foreign_call.inputs[0].unwrap_value().to_field().to_u128(); + let sequence = vecmap((0..sequence_length).rev(), Value::from); + + Ok(ForeignCallResult { + values: vec![ + ForeignCallParam::Single(sequence_length.into()), + ForeignCallParam::Array(sequence), + ], + }) + } + Some(ForeignCall::CreateMock) => { + let mock_oracle_name = Self::parse_string(&foreign_call.inputs[0]); + assert!(ForeignCall::lookup(&mock_oracle_name).is_none()); + let id = self.last_mock_id; + self.mocked_responses.push(MockedCall::new(id, mock_oracle_name)); + self.last_mock_id += 1; + + Ok(ForeignCallResult { values: vec![Value::from(id).into()] }) + } + Some(ForeignCall::SetMockParams) => { + let (id, params) = Self::extract_mock_id(&foreign_call.inputs)?; + self.find_mock_by_id(id) + .unwrap_or_else(|| panic!("Unknown mock id {}", id)) + .params = Some(params.to_vec()); + + Ok(ForeignCallResult { values: vec![] }) + } + Some(ForeignCall::SetMockReturns) => { + let (id, params) = Self::extract_mock_id(&foreign_call.inputs)?; + self.find_mock_by_id(id) + .unwrap_or_else(|| panic!("Unknown mock id {}", id)) + .result = ForeignCallResult { values: params.to_vec() }; + + Ok(ForeignCallResult { values: vec![] }) + } + Some(ForeignCall::SetMockTimes) => { + let (id, params) = Self::extract_mock_id(&foreign_call.inputs)?; + let times = params[0] + .unwrap_value() + .to_field() + .try_to_u64() + .expect("Invalid bit size of times"); + + self.find_mock_by_id(id) + .unwrap_or_else(|| panic!("Unknown mock id {}", id)) + .times_left = Some(times); + + Ok(ForeignCallResult { values: vec![] }) + } + Some(ForeignCall::ClearMock) => { + let (id, _) = Self::extract_mock_id(&foreign_call.inputs)?; + self.mocked_responses.retain(|response| response.id != id); + Ok(ForeignCallResult { values: vec![] }) + } + None => { + let response_position = self + .mocked_responses + .iter() + .position(|response| response.matches(foreign_call_name, &foreign_call.inputs)) + .unwrap_or_else(|| panic!("Unknown foreign call {}", foreign_call_name)); + + let mock = self + .mocked_responses + .get_mut(response_position) + .expect("Invalid position of mocked response"); + let result = mock.result.values.clone(); + + if let Some(times_left) = &mut mock.times_left { + *times_left -= 1; + if *times_left == 0 { + self.mocked_responses.remove(response_position); + } + } + + Ok(ForeignCallResult { values: result }) + } + } + } +} diff --git a/noir/tooling/nargo/src/ops/mod.rs b/noir/tooling/nargo/src/ops/mod.rs new file mode 100644 index 00000000000..34487ed9770 --- /dev/null +++ b/noir/tooling/nargo/src/ops/mod.rs @@ -0,0 +1,11 @@ +pub use self::compile::{compile_program, compile_workspace}; +pub use self::execute::execute_circuit; +pub use self::foreign_calls::{DefaultForeignCallExecutor, ForeignCallExecutor}; +pub use self::optimize::{optimize_contract, optimize_program}; +pub use self::test::{run_test, TestStatus}; + +mod compile; +mod execute; +mod foreign_calls; +mod optimize; +mod test; diff --git a/noir/tooling/nargo/src/ops/optimize.rs b/noir/tooling/nargo/src/ops/optimize.rs new file mode 100644 index 00000000000..54e2432aa40 --- /dev/null +++ b/noir/tooling/nargo/src/ops/optimize.rs @@ -0,0 +1,34 @@ +use acvm::{acir::circuit::Opcode, Language}; +use iter_extended::try_vecmap; +use noirc_driver::{CompiledContract, CompiledProgram}; + +use crate::NargoError; + +pub fn optimize_program( + mut program: CompiledProgram, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> Result { + let (optimized_circuit, location_map) = + acvm::compiler::compile(program.circuit, np_language, is_opcode_supported)?; + + program.circuit = optimized_circuit; + program.debug.update_acir(location_map); + Ok(program) +} + +pub fn optimize_contract( + contract: CompiledContract, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> Result { + let functions = try_vecmap(contract.functions, |mut func| { + let (optimized_bytecode, location_map) = + acvm::compiler::compile(func.bytecode, np_language, is_opcode_supported)?; + func.bytecode = optimized_bytecode; + func.debug.update_acir(location_map); + Ok::<_, NargoError>(func) + })?; + + Ok(CompiledContract { functions, ..contract }) +} diff --git a/noir/tooling/nargo/src/ops/test.rs b/noir/tooling/nargo/src/ops/test.rs new file mode 100644 index 00000000000..5bfdd6d15d0 --- /dev/null +++ b/noir/tooling/nargo/src/ops/test.rs @@ -0,0 +1,136 @@ +use acvm::{acir::native_types::WitnessMap, BlackBoxFunctionSolver}; +use noirc_driver::{compile_no_check, CompileOptions}; +use noirc_errors::{debug_info::DebugInfo, FileDiagnostic}; +use noirc_evaluator::errors::RuntimeError; +use noirc_frontend::hir::{def_map::TestFunction, Context}; + +use crate::{errors::try_to_diagnose_runtime_error, NargoError}; + +use super::{execute_circuit, DefaultForeignCallExecutor}; + +pub enum TestStatus { + Pass, + Fail { message: String, error_diagnostic: Option }, + CompileError(FileDiagnostic), +} + +pub fn run_test( + blackbox_solver: &B, + context: &Context, + test_function: TestFunction, + show_output: bool, + config: &CompileOptions, +) -> TestStatus { + let program = compile_no_check(context, config, test_function.get_id(), None, false); + match program { + Ok(program) => { + // Run the backend to ensure the PWG evaluates functions like std::hash::pedersen, + // otherwise constraints involving these expressions will not error. + let circuit_execution = execute_circuit( + &program.circuit, + WitnessMap::new(), + blackbox_solver, + &mut DefaultForeignCallExecutor::new(show_output), + ); + test_status_program_compile_pass(test_function, program.debug, circuit_execution) + } + Err(err) => test_status_program_compile_fail(err, test_function), + } +} + +/// Test function failed to compile +/// +/// Note: This could be because the compiler was able to deduce +/// that a constraint was never satisfiable. +/// An example of this is the program `assert(false)` +/// In that case, we check if the test function should fail, and if so, we return `TestStatus::Pass`. +fn test_status_program_compile_fail(err: RuntimeError, test_function: TestFunction) -> TestStatus { + // The test has failed compilation, but it should never fail. Report error. + if !test_function.should_fail() { + return TestStatus::CompileError(err.into()); + } + + // The test has failed compilation, extract the assertion message if present and check if it's expected. + let assert_message = if let RuntimeError::FailedConstraint { assert_message, .. } = &err { + assert_message.clone() + } else { + None + }; + + check_expected_failure_message(test_function, assert_message, Some(err.into())) +} + +/// The test function compiled successfully. +/// +/// We now check whether execution passed/failed and whether it should have +/// passed/failed to determine the test status. +fn test_status_program_compile_pass( + test_function: TestFunction, + debug: DebugInfo, + circuit_execution: Result, +) -> TestStatus { + let circuit_execution_err = match circuit_execution { + // Circuit execution was successful; ie no errors or unsatisfied constraints + // were encountered. + Ok(_) => { + if test_function.should_fail() { + return TestStatus::Fail { + message: "error: Test passed when it should have failed".to_string(), + error_diagnostic: None, + }; + } + return TestStatus::Pass; + } + Err(err) => err, + }; + + // If we reach here, then the circuit execution failed. + // + // Check if the function should have passed + let diagnostic = try_to_diagnose_runtime_error(&circuit_execution_err, &debug); + let test_should_have_passed = !test_function.should_fail(); + if test_should_have_passed { + return TestStatus::Fail { + message: circuit_execution_err.to_string(), + error_diagnostic: diagnostic, + }; + } + + check_expected_failure_message( + test_function, + circuit_execution_err.user_defined_failure_message().map(|s| s.to_string()), + diagnostic, + ) +} + +fn check_expected_failure_message( + test_function: TestFunction, + failed_assertion: Option, + error_diagnostic: Option, +) -> TestStatus { + // Extract the expected failure message, if there was one + // + // #[test(should_fail)] will not produce any message + // #[test(should_fail_with = "reason")] will produce a message + // + let expected_failure_message = match test_function.failure_reason() { + Some(reason) => reason, + None => return TestStatus::Pass, + }; + + let expected_failure_message_matches = + matches!(&failed_assertion, Some(message) if message == expected_failure_message); + if expected_failure_message_matches { + return TestStatus::Pass; + } + + // The expected failure message does not match the actual failure message + TestStatus::Fail { + message: format!( + "\nerror: Test failed with the wrong message. \nExpected: {} \nGot: {}", + test_function.failure_reason().unwrap_or_default(), + failed_assertion.unwrap_or_default().trim_matches('\'') + ), + error_diagnostic, + } +} diff --git a/noir/tooling/nargo/src/package.rs b/noir/tooling/nargo/src/package.rs new file mode 100644 index 00000000000..94c7c5b9c98 --- /dev/null +++ b/noir/tooling/nargo/src/package.rs @@ -0,0 +1,78 @@ +use std::{collections::BTreeMap, fmt::Display, path::PathBuf}; + +use noirc_frontend::graph::CrateName; + +use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE}; + +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum PackageType { + Library, + Binary, + Contract, +} + +impl Display for PackageType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Library => write!(f, "lib"), + Self::Binary => write!(f, "bin"), + Self::Contract => write!(f, "contract"), + } + } +} + +#[derive(Clone)] +pub enum Dependency { + Local { package: Package }, + Remote { package: Package }, +} + +impl Dependency { + pub fn is_binary(&self) -> bool { + match self { + Self::Local { package } | Self::Remote { package } => package.is_binary(), + } + } + + pub fn package_name(&self) -> &CrateName { + match self { + Self::Local { package } | Self::Remote { package } => &package.name, + } + } +} + +#[derive(Clone)] +pub struct Package { + // A semver string which specifies the compiler version required to compile this package + pub compiler_required_version: Option, + pub root_dir: PathBuf, + pub package_type: PackageType, + pub entry_path: PathBuf, + pub name: CrateName, + pub dependencies: BTreeMap, +} + +impl Package { + pub fn prover_input_path(&self) -> PathBuf { + // TODO: This should be configurable, such as if we are looking for .json or .toml or custom paths + // For now it is hard-coded to be toml. + self.root_dir.join(format!("{PROVER_INPUT_FILE}.toml")) + } + pub fn verifier_input_path(&self) -> PathBuf { + // TODO: This should be configurable, such as if we are looking for .json or .toml or custom paths + // For now it is hard-coded to be toml. + self.root_dir.join(format!("{VERIFIER_INPUT_FILE}.toml")) + } + + pub fn is_binary(&self) -> bool { + self.package_type == PackageType::Binary + } + + pub fn is_contract(&self) -> bool { + self.package_type == PackageType::Contract + } + + pub fn is_library(&self) -> bool { + self.package_type == PackageType::Library + } +} diff --git a/noir/tooling/nargo/src/workspace.rs b/noir/tooling/nargo/src/workspace.rs new file mode 100644 index 00000000000..65f9ab7e0d9 --- /dev/null +++ b/noir/tooling/nargo/src/workspace.rs @@ -0,0 +1,78 @@ +// We will say that a cargo unit must contain either a binary or a library +// Then we use workspace to allow more than one. In the future, do not allow there to be +// both a binary and a library. +// - library will be default + +use std::{ + iter::{once, Once}, + path::PathBuf, + slice, +}; + +use crate::{ + constants::{CONTRACT_DIR, PROOFS_DIR, TARGET_DIR}, + package::Package, +}; + +#[derive(Clone)] +pub struct Workspace { + pub root_dir: PathBuf, + pub members: Vec, + // If `Some()`, the `selected_package_index` is used to select the only `Package` when iterating a Workspace + pub selected_package_index: Option, +} + +impl Workspace { + pub fn package_build_path(&self, package: &Package) -> PathBuf { + let name: String = package.name.clone().into(); + self.target_directory_path().join(name).with_extension("json") + } + + pub fn contracts_directory_path(&self, package: &Package) -> PathBuf { + let name: String = package.name.clone().into(); + self.root_dir.join(CONTRACT_DIR).join(name) + } + + pub fn proofs_directory_path(&self) -> PathBuf { + self.root_dir.join(PROOFS_DIR) + } + + pub fn target_directory_path(&self) -> PathBuf { + self.root_dir.join(TARGET_DIR) + } +} + +pub enum IntoIter<'a, T> { + Only(Once<&'a T>), + All(slice::Iter<'a, T>), +} + +impl<'a> IntoIterator for &'a Workspace { + type Item = &'a Package; + type IntoIter = IntoIter<'a, Package>; + + fn into_iter(self) -> Self::IntoIter { + if let Some(index) = self.selected_package_index { + // Precondition: The selected_package_index was verified to be in-bounds before constructing workspace + let member = self + .members + .get(index) + .expect("Workspace constructed with invalid selected_package_index"); + + IntoIter::Only(once(member)) + } else { + IntoIter::All(self.members.iter()) + } + } +} + +impl<'a> Iterator for IntoIter<'a, Package> { + type Item = &'a Package; + + fn next(&mut self) -> Option { + match self { + Self::Only(iter) => iter.next(), + Self::All(iter) => iter.next(), + } + } +} diff --git a/noir/tooling/nargo_cli/Cargo.toml b/noir/tooling/nargo_cli/Cargo.toml new file mode 100644 index 00000000000..1a08514dc5f --- /dev/null +++ b/noir/tooling/nargo_cli/Cargo.toml @@ -0,0 +1,80 @@ +[package] +name = "nargo_cli" +description = "Noir's package manager" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +# Rename binary from `nargo_cli` to `nargo` +[[bin]] +name = "nargo" +path = "src/main.rs" + +[build-dependencies] +rustc_version = "0.4.0" +build-data.workspace = true +toml.workspace = true + +[dependencies] +clap.workspace = true +fm.workspace = true +iter-extended.workspace = true +nargo.workspace = true +nargo_fmt.workspace = true +nargo_toml.workspace = true +noir_lsp.workspace = true +noir_debugger.workspace = true +noirc_driver.workspace = true +noirc_frontend.workspace = true +noirc_abi.workspace = true +noirc_errors.workspace = true +acvm.workspace = true +barretenberg_blackbox_solver.workspace = true +toml.workspace = true +serde.workspace = true +serde_json.workspace = true +prettytable-rs = "0.10" +rayon = "1.8.0" +thiserror.workspace = true +tower.workspace = true +async-lsp = { workspace = true, features = ["client-monitor", "stdio", "tracing", "tokio"] } +const_format.workspace = true +hex.workspace = true +termcolor = "1.1.2" +color-eyre = "0.6.2" +tokio = { version = "1.0", features = ["io-std"] } + +# Backends +backend-interface = { path = "../backend_interface" } +bb_abstraction_leaks.workspace = true + +[target.'cfg(not(unix))'.dependencies] +tokio-util = { version = "0.7.8", features = ["compat"] } + +[dev-dependencies] +tempfile = "3.6.0" +dirs.workspace = true +assert_cmd = "2.0.8" +assert_fs = "1.0.10" +predicates = "2.1.5" +fm.workspace = true +criterion = "0.5.0" +paste = "1.0.14" +pprof = { version = "0.12", features = [ + "flamegraph", + "frame-pointer", + "criterion", +] } +iai = "0.1.1" +test-binary = "3.0.1" + +[[bench]] +name = "criterion" +harness = false + +[[bench]] +name = "iai" +harness = false diff --git a/noir/tooling/nargo_cli/benches/criterion.rs b/noir/tooling/nargo_cli/benches/criterion.rs new file mode 100644 index 00000000000..a7b094fd7aa --- /dev/null +++ b/noir/tooling/nargo_cli/benches/criterion.rs @@ -0,0 +1,33 @@ +//! Select representative tests to bench with criterion +use assert_cmd::prelude::{CommandCargoExt, OutputAssertExt}; +use criterion::{criterion_group, criterion_main, Criterion}; +use paste::paste; +use pprof::criterion::{Output, PProfProfiler}; +use std::process::Command; +include!("./utils.rs"); + +macro_rules! criterion_command { + ($command_name:tt, $command_string:expr) => { + paste! { + fn [](c: &mut Criterion) { + let test_program_dirs = get_selected_tests(); + for test_program_dir in test_program_dirs { + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("--program-dir").arg(&test_program_dir); + cmd.arg($command_string); + + c.bench_function(&format!("{}_{}", test_program_dir.file_name().unwrap().to_str().unwrap(), $command_string), |b| { + b.iter(|| cmd.assert()) + }); + } + } + } + }; +} +criterion_command!(execution, "execute"); +criterion_group! { + name = benches; + config = Criterion::default().sample_size(20).with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); + targets = criterion_selected_tests_execution +} +criterion_main!(benches); diff --git a/noir/tooling/nargo_cli/benches/iai.rs b/noir/tooling/nargo_cli/benches/iai.rs new file mode 100644 index 00000000000..bcd60111ccf --- /dev/null +++ b/noir/tooling/nargo_cli/benches/iai.rs @@ -0,0 +1,25 @@ +//! Select representative tests to bench with iai +use assert_cmd::prelude::{CommandCargoExt, OutputAssertExt}; +use iai::black_box; +use paste::paste; +use std::process::Command; +include!("./utils.rs"); + +macro_rules! iai_command { + ($command_name:tt, $command_string:expr) => { + paste! { + fn []() { + let test_program_dirs = get_selected_tests(); + for test_program_dir in test_program_dirs { + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("--program-dir").arg(&test_program_dir); + cmd.arg($command_string); + + black_box(cmd.assert()); + } + } + } + }; +} +iai_command!(execution, "execute"); +iai::main!(iai_selected_tests_execution); diff --git a/noir/tooling/nargo_cli/benches/utils.rs b/noir/tooling/nargo_cli/benches/utils.rs new file mode 100644 index 00000000000..52a6b718c44 --- /dev/null +++ b/noir/tooling/nargo_cli/benches/utils.rs @@ -0,0 +1,14 @@ +use std::path::PathBuf; + +#[allow(unused)] +fn get_selected_tests() -> Vec { + let manifest_dir = match std::env::var("CARGO_MANIFEST_DIR") { + Ok(dir) => PathBuf::from(dir), + Err(_) => std::env::current_dir().unwrap().join("crates").join("nargo_cli"), + }; + let test_dir = manifest_dir.join("tests").join("execution_success"); + + let selected_tests = + vec!["8_integration", "sha256_blocks", "struct", "eddsa", "regression", "regression_2099"]; + selected_tests.into_iter().map(|t| test_dir.join(t)).collect() +} diff --git a/noir/tooling/nargo_cli/build.rs b/noir/tooling/nargo_cli/build.rs new file mode 100644 index 00000000000..0d1acca6ee9 --- /dev/null +++ b/noir/tooling/nargo_cli/build.rs @@ -0,0 +1,289 @@ +use rustc_version::{version, Version}; +use std::fs::File; +use std::io::Write; +use std::path::{Path, PathBuf}; +use std::{env, fs}; + +fn check_rustc_version() { + assert!( + version().unwrap() >= Version::parse("1.71.1").unwrap(), + "The minimal supported rustc version is 1.71.1." + ); +} + +const GIT_COMMIT: &&str = &"GIT_COMMIT"; + +fn main() { + // Rebuild if the tests have changed + println!("cargo:rerun-if-changed=tests"); + + check_rustc_version(); + + // Only use build_data if the environment variable isn't set + // The environment variable is always set when working via Nix + if std::env::var(GIT_COMMIT).is_err() { + build_data::set_GIT_COMMIT(); + build_data::set_GIT_DIRTY(); + build_data::no_debug_rebuilds(); + } + + let out_dir = env::var("OUT_DIR").unwrap(); + let destination = Path::new(&out_dir).join("execute.rs"); + let mut test_file = File::create(destination).unwrap(); + + // Try to find the directory that Cargo sets when it is running; otherwise fallback to assuming the CWD + // is the root of the repository and append the crate path + let manifest_dir = match std::env::var("CARGO_MANIFEST_DIR") { + Ok(dir) => PathBuf::from(dir), + Err(_) => std::env::current_dir().unwrap().join("crates").join("nargo_cli"), + }; + let test_dir = manifest_dir.join("tests"); + + generate_execution_success_tests(&mut test_file, &test_dir); + generate_noir_test_success_tests(&mut test_file, &test_dir); + generate_noir_test_failure_tests(&mut test_file, &test_dir); + generate_compile_success_empty_tests(&mut test_file, &test_dir); + generate_compile_success_contract_tests(&mut test_file, &test_dir); + generate_compile_failure_tests(&mut test_file, &test_dir); +} + +fn generate_execution_success_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "execution_success"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn execution_success_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("execute"); + + cmd.assert().success(); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + +fn generate_noir_test_success_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "noir_test_success"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn noir_test_success_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("test"); + + cmd.assert().success(); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + +fn generate_noir_test_failure_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "noir_test_failure"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn noir_test_failure_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("test"); + + cmd.assert().failure(); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + +fn generate_compile_success_empty_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "compile_success_empty"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn compile_success_empty_{test_name}() {{ + + // We use a mocked backend for this test as we do not rely on the returned circuit size + // but we must call a backend as part of querying the number of opcodes in the circuit. + + let test_program_dir = PathBuf::from("{test_dir}"); + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("info"); + cmd.arg("--json"); + + let output = cmd.output().expect("Failed to execute command"); + + if !output.status.success() {{ + panic!("`nargo info` failed with: {{}}", String::from_utf8(output.stderr).unwrap()); + }} + + // `compile_success_empty` tests should be able to compile down to an empty circuit. + let json: serde_json::Value = serde_json::from_slice(&output.stdout).expect("JSON was not well-formatted"); + let num_opcodes = &json["programs"][0]["acir_opcodes"]; + assert_eq!(num_opcodes.as_u64().unwrap(), 0); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + +fn generate_compile_success_contract_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "compile_success_contract"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn compile_success_contract_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("compile"); + + cmd.assert().success(); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} + +fn generate_compile_failure_tests(test_file: &mut File, test_data_dir: &Path) { + let test_sub_dir = "compile_failure"; + let test_data_dir = test_data_dir.join(test_sub_dir); + + let test_case_dirs = + fs::read_dir(test_data_dir).unwrap().flatten().filter(|c| c.path().is_dir()); + + for test_dir in test_case_dirs { + let test_name = + test_dir.file_name().into_string().expect("Directory can't be converted to string"); + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + let test_dir = &test_dir.path(); + + write!( + test_file, + r#" +#[test] +fn compile_failure_{test_name}() {{ + let test_program_dir = PathBuf::from("{test_dir}"); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend()); + cmd.arg("--program-dir").arg(test_program_dir); + cmd.arg("execute"); + + cmd.assert().failure().stderr(predicate::str::contains("The application panicked (crashed).").not()); +}} + "#, + test_dir = test_dir.display(), + ) + .expect("Could not write templated test file."); + } +} diff --git a/noir/tooling/nargo_cli/src/backends.rs b/noir/tooling/nargo_cli/src/backends.rs new file mode 100644 index 00000000000..8b1da2cd118 --- /dev/null +++ b/noir/tooling/nargo_cli/src/backends.rs @@ -0,0 +1,39 @@ +use std::path::PathBuf; + +use backend_interface::backends_directory; +pub(crate) use backend_interface::Backend; + +fn active_backend_file_path() -> PathBuf { + backends_directory().join(".selected_backend") +} + +pub(crate) const ACVM_BACKEND_BARRETENBERG: &str = "acvm-backend-barretenberg"; + +pub(crate) fn clear_active_backend() { + let active_backend_file = active_backend_file_path(); + if active_backend_file.is_file() { + std::fs::remove_file(active_backend_file_path()) + .expect("should delete active backend file"); + } +} + +pub(crate) fn set_active_backend(backend_name: &str) { + let active_backend_file = active_backend_file_path(); + let backends_directory = + active_backend_file.parent().expect("active backend file should have parent"); + + std::fs::create_dir_all(backends_directory).expect("Could not create backends directory"); + std::fs::write(active_backend_file, backend_name.as_bytes()) + .expect("Could not write to active backend file"); +} + +pub(crate) fn get_active_backend() -> String { + let active_backend_file = active_backend_file_path(); + + if !active_backend_file.is_file() { + set_active_backend(ACVM_BACKEND_BARRETENBERG); + return ACVM_BACKEND_BARRETENBERG.to_string(); + } + + std::fs::read_to_string(active_backend_file).expect("Could not read active backend file") +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/current_cmd.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/current_cmd.rs new file mode 100644 index 00000000000..5aba00764d3 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/current_cmd.rs @@ -0,0 +1,13 @@ +use clap::Args; + +use crate::{backends::get_active_backend, errors::CliError}; + +/// Prints the name of the currently active backend +#[derive(Debug, Clone, Args)] +pub(crate) struct CurrentCommand; + +pub(crate) fn run(_args: CurrentCommand) -> Result<(), CliError> { + println!("{}", get_active_backend()); + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/install_cmd.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/install_cmd.rs new file mode 100644 index 00000000000..974db9ff7f5 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/install_cmd.rs @@ -0,0 +1,30 @@ +use clap::Args; + +use backend_interface::{backends_directory, download_backend}; + +use crate::errors::{BackendError, CliError}; + +use super::ls_cmd::get_available_backends; + +/// Install a new backend from a URL. +#[derive(Debug, Clone, Args)] +pub(crate) struct InstallCommand { + /// The name of the backend to install. + backend: String, + + /// The URL from which to download the backend. + url: String, +} + +pub(crate) fn run(args: InstallCommand) -> Result<(), CliError> { + let installed_backends = get_available_backends(); + + if installed_backends.contains(&args.backend) { + return Err(BackendError::AlreadyInstalled(args.backend).into()); + } + + download_backend(&args.url, &backends_directory().join(args.backend).join("backend_binary")) + .map_err(BackendError::from)?; + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/ls_cmd.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/ls_cmd.rs new file mode 100644 index 00000000000..da37b104d65 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/ls_cmd.rs @@ -0,0 +1,34 @@ +use backend_interface::backends_directory; +use clap::Args; + +use crate::errors::CliError; + +/// Prints the list of currently installed backends +#[derive(Debug, Clone, Args)] +pub(crate) struct LsCommand; + +pub(crate) fn run(_args: LsCommand) -> Result<(), CliError> { + for backend in get_available_backends() { + println!("{backend}"); + } + + Ok(()) +} + +pub(super) fn get_available_backends() -> Vec { + let backend_directory_contents = std::fs::read_dir(backends_directory()) + .expect("Could not read backends directory contents"); + + // TODO: Highlight the currently active backend. + backend_directory_contents + .into_iter() + .filter_map(|entry| { + let path = entry.ok()?.path(); + if path.is_dir() { + path.file_name().map(|name| name.to_string_lossy().to_string()) + } else { + None + } + }) + .collect() +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/mod.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/mod.rs new file mode 100644 index 00000000000..985dbbdb934 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/mod.rs @@ -0,0 +1,41 @@ +use clap::{Args, Subcommand}; + +use crate::errors::CliError; + +mod current_cmd; +mod install_cmd; +mod ls_cmd; +mod uninstall_cmd; +mod use_cmd; + +#[non_exhaustive] +#[derive(Args, Clone, Debug)] +/// Install and select custom backends used to generate and verify proofs. +pub(crate) struct BackendCommand { + #[command(subcommand)] + command: BackendCommands, +} + +#[non_exhaustive] +#[derive(Subcommand, Clone, Debug)] +pub(crate) enum BackendCommands { + Current(current_cmd::CurrentCommand), + Ls(ls_cmd::LsCommand), + Use(use_cmd::UseCommand), + Install(install_cmd::InstallCommand), + Uninstall(uninstall_cmd::UninstallCommand), +} + +pub(crate) fn run(cmd: BackendCommand) -> Result<(), CliError> { + let BackendCommand { command } = cmd; + + match command { + BackendCommands::Current(args) => current_cmd::run(args), + BackendCommands::Ls(args) => ls_cmd::run(args), + BackendCommands::Use(args) => use_cmd::run(args), + BackendCommands::Install(args) => install_cmd::run(args), + BackendCommands::Uninstall(args) => uninstall_cmd::run(args), + }?; + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/uninstall_cmd.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/uninstall_cmd.rs new file mode 100644 index 00000000000..7497f1bc2f6 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/uninstall_cmd.rs @@ -0,0 +1,59 @@ +use clap::Args; + +use backend_interface::backends_directory; + +use crate::{ + backends::{ + clear_active_backend, get_active_backend, set_active_backend, ACVM_BACKEND_BARRETENBERG, + }, + errors::{BackendError, CliError}, +}; + +use super::ls_cmd::get_available_backends; + +/// Uninstalls a backend +#[derive(Debug, Clone, Args)] +pub(crate) struct UninstallCommand { + /// The name of the backend to uninstall. + backend: String, +} + +pub(crate) fn run(args: UninstallCommand) -> Result<(), CliError> { + let installed_backends = get_available_backends(); + + if !installed_backends.contains(&args.backend) { + return Err(BackendError::UnknownBackend(args.backend).into()); + } + + let active_backend = get_active_backend(); + + // Handle the case where we're uninstalling the currently active backend. + if active_backend == args.backend { + let barretenberg_is_installed = + installed_backends.iter().any(|backend_name| backend_name == ACVM_BACKEND_BARRETENBERG); + + let new_active_backend = + if args.backend != ACVM_BACKEND_BARRETENBERG && barretenberg_is_installed { + // Prefer switching to barretenberg if possible. + Some(ACVM_BACKEND_BARRETENBERG) + } else { + // Otherwise pick the first backend which isn't being uninstalled. + installed_backends + .iter() + .find(|&backend_name| backend_name != &args.backend) + .map(|name| name.as_str()) + }; + + if let Some(backend) = new_active_backend { + set_active_backend(backend); + } else { + // We've deleted the last backend. Clear the active backend file to be recreated once we install a new one. + clear_active_backend(); + } + } + + std::fs::remove_dir_all(backends_directory().join(args.backend)) + .expect("backend directory should be deleted"); + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/backend_cmd/use_cmd.rs b/noir/tooling/nargo_cli/src/cli/backend_cmd/use_cmd.rs new file mode 100644 index 00000000000..66a129c2148 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/backend_cmd/use_cmd.rs @@ -0,0 +1,26 @@ +use clap::Args; + +use crate::{ + backends::set_active_backend, + errors::{BackendError, CliError}, +}; + +use super::ls_cmd::get_available_backends; + +/// Select the backend to use +#[derive(Debug, Clone, Args)] +pub(crate) struct UseCommand { + backend: String, +} + +pub(crate) fn run(args: UseCommand) -> Result<(), CliError> { + let backends = get_available_backends(); + + if !backends.contains(&args.backend) { + return Err(BackendError::UnknownBackend(args.backend).into()); + } + + set_active_backend(&args.backend); + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/check_cmd.rs b/noir/tooling/nargo_cli/src/cli/check_cmd.rs new file mode 100644 index 00000000000..57b36b8932b --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/check_cmd.rs @@ -0,0 +1,194 @@ +use crate::backends::Backend; +use crate::errors::CliError; + +use clap::Args; +use iter_extended::btree_map; +use nargo::{errors::CompileError, package::Package, prepare_package}; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_abi::{AbiParameter, AbiType, MAIN_RETURN_NAME}; +use noirc_driver::{ + check_crate, compute_function_abi, CompileOptions, NOIR_ARTIFACT_VERSION_STRING, +}; +use noirc_frontend::{ + graph::{CrateId, CrateName}, + hir::Context, +}; + +use super::fs::write_to_file; +use super::NargoConfig; + +/// Checks the constraint system for errors +#[derive(Debug, Clone, Args)] +pub(crate) struct CheckCommand { + /// The name of the package to check + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Check all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + _backend: &Backend, + args: CheckCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + for package in &workspace { + check_package(package, &args.compile_options)?; + println!("[{}] Constraint system successfully built!", package.name); + } + Ok(()) +} + +fn check_package(package: &Package, compile_options: &CompileOptions) -> Result<(), CompileError> { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + check_crate_and_report_errors( + &mut context, + crate_id, + compile_options.deny_warnings, + compile_options.silence_warnings, + )?; + + if package.is_library() || package.is_contract() { + // Libraries do not have ABIs while contracts have many, so we cannot generate a `Prover.toml` file. + Ok(()) + } else { + // XXX: We can have a --overwrite flag to determine if you want to overwrite the Prover/Verifier.toml files + if let Some((parameters, return_type)) = compute_function_abi(&context, &crate_id) { + let path_to_prover_input = package.prover_input_path(); + let path_to_verifier_input = package.verifier_input_path(); + + // If they are not available, then create them and populate them based on the ABI + if !path_to_prover_input.exists() { + let prover_toml = create_input_toml_template(parameters.clone(), None); + write_to_file(prover_toml.as_bytes(), &path_to_prover_input); + } + if !path_to_verifier_input.exists() { + let public_inputs = + parameters.into_iter().filter(|param| param.is_public()).collect(); + + let verifier_toml = create_input_toml_template(public_inputs, return_type); + write_to_file(verifier_toml.as_bytes(), &path_to_verifier_input); + } + + Ok(()) + } else { + Err(CompileError::MissingMainFunction(package.name.clone())) + } + } +} + +/// Generates the contents of a toml file with fields for each of the passed parameters. +fn create_input_toml_template( + parameters: Vec, + return_type: Option, +) -> String { + /// Returns a default placeholder `toml::Value` for `typ` which + /// complies with the structure of the specified `AbiType`. + fn default_value(typ: AbiType) -> toml::Value { + match typ { + AbiType::Array { length, typ } => { + let default_value_vec = std::iter::repeat(default_value(*typ)) + .take(length.try_into().unwrap()) + .collect(); + toml::Value::Array(default_value_vec) + } + AbiType::Struct { fields, .. } => { + let default_value_map = toml::map::Map::from_iter( + fields.into_iter().map(|(name, typ)| (name, default_value(typ))), + ); + toml::Value::Table(default_value_map) + } + _ => toml::Value::String("".to_owned()), + } + } + + let mut map = + btree_map(parameters, |AbiParameter { name, typ, .. }| (name, default_value(typ))); + + if let Some(typ) = return_type { + map.insert(MAIN_RETURN_NAME.to_owned(), default_value(typ)); + } + + toml::to_string(&map).unwrap() +} + +#[cfg(test)] +mod tests { + use noirc_abi::{AbiParameter, AbiType, AbiVisibility, Sign}; + + use super::create_input_toml_template; + + #[test] + fn valid_toml_template() { + let typed_param = |name: &str, typ: AbiType| AbiParameter { + name: name.to_string(), + typ, + visibility: AbiVisibility::Public, + }; + let parameters = vec![ + typed_param("a", AbiType::Field), + typed_param("b", AbiType::Integer { sign: Sign::Unsigned, width: 32 }), + typed_param("c", AbiType::Array { length: 2, typ: Box::new(AbiType::Field) }), + typed_param( + "d", + AbiType::Struct { + path: String::from("MyStruct"), + fields: vec![ + (String::from("d1"), AbiType::Field), + ( + String::from("d2"), + AbiType::Array { length: 3, typ: Box::new(AbiType::Field) }, + ), + ], + }, + ), + typed_param("e", AbiType::Boolean), + ]; + + let toml_str = create_input_toml_template(parameters, None); + + let expected_toml_str = r#"a = "" +b = "" +c = ["", ""] +e = "" + +[d] +d1 = "" +d2 = ["", "", ""] +"#; + assert_eq!(toml_str, expected_toml_str); + } +} + +/// Run the lexing, parsing, name resolution, and type checking passes and report any warnings +/// and errors found. +pub(crate) fn check_crate_and_report_errors( + context: &mut Context, + crate_id: CrateId, + deny_warnings: bool, + silence_warnings: bool, +) -> Result<(), CompileError> { + let result = check_crate(context, crate_id, deny_warnings); + super::compile_cmd::report_errors( + result, + &context.file_manager, + deny_warnings, + silence_warnings, + ) +} diff --git a/noir/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs b/noir/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs new file mode 100644 index 00000000000..59143526b24 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/codegen_verifier_cmd.rs @@ -0,0 +1,95 @@ +use super::NargoConfig; +use super::{ + compile_cmd::compile_bin_package, + fs::{create_named_dir, write_to_file}, +}; +use crate::backends::Backend; +use crate::errors::CliError; + +use acvm::acir::circuit::Opcode; +use acvm::Language; +use bb_abstraction_leaks::ACVM_BACKEND_BARRETENBERG; +use clap::Args; +use nargo::package::Package; +use nargo::workspace::Workspace; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::graph::CrateName; + +/// Generates a Solidity verifier smart contract for the program +#[derive(Debug, Clone, Args)] +pub(crate) struct CodegenVerifierCommand { + /// The name of the package to codegen + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Codegen all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: CodegenVerifierCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let (np_language, opcode_support) = backend.get_backend_info()?; + for package in &workspace { + let smart_contract_string = smart_contract_for_package( + &workspace, + backend, + package, + &args.compile_options, + np_language, + &|opcode| opcode_support.is_opcode_supported(opcode), + )?; + + let contract_dir = workspace.contracts_directory_path(package); + create_named_dir(&contract_dir, "contract"); + let contract_path = contract_dir.join("plonk_vk").with_extension("sol"); + + let path = write_to_file(smart_contract_string.as_bytes(), &contract_path); + println!("[{}] Contract successfully created and located at {path}", package.name); + } + + Ok(()) +} + +fn smart_contract_for_package( + workspace: &Workspace, + backend: &Backend, + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> Result { + let program = compile_bin_package( + workspace, + package, + compile_options, + np_language, + &is_opcode_supported, + )?; + + let mut smart_contract_string = backend.eth_contract(&program.circuit)?; + + if backend.name() == ACVM_BACKEND_BARRETENBERG { + smart_contract_string = + bb_abstraction_leaks::complete_barretenberg_verifier_contract(smart_contract_string); + } + + Ok(smart_contract_string) +} diff --git a/noir/tooling/nargo_cli/src/cli/compile_cmd.rs b/noir/tooling/nargo_cli/src/cli/compile_cmd.rs new file mode 100644 index 00000000000..9ffbc26828e --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/compile_cmd.rs @@ -0,0 +1,345 @@ +use std::path::Path; + +use acvm::acir::circuit::opcodes::BlackBoxFuncCall; +use acvm::acir::circuit::Opcode; +use acvm::Language; +use backend_interface::BackendOpcodeSupport; +use fm::FileManager; +use iter_extended::vecmap; +use nargo::artifacts::contract::PreprocessedContract; +use nargo::artifacts::contract::PreprocessedContractFunction; +use nargo::artifacts::debug::DebugArtifact; +use nargo::artifacts::program::PreprocessedProgram; +use nargo::errors::CompileError; +use nargo::package::Package; +use nargo::prepare_package; +use nargo::workspace::Workspace; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::NOIR_ARTIFACT_VERSION_STRING; +use noirc_driver::{CompilationResult, CompileOptions, CompiledContract, CompiledProgram}; +use noirc_frontend::graph::CrateName; + +use clap::Args; + +use crate::backends::Backend; +use crate::errors::CliError; + +use super::fs::program::{ + read_debug_artifact_from_file, read_program_from_file, save_contract_to_file, + save_debug_artifact_to_file, save_program_to_file, +}; +use super::NargoConfig; +use rayon::prelude::*; + +// TODO(#1388): pull this from backend. +const BACKEND_IDENTIFIER: &str = "acvm-backend-barretenberg"; + +/// Compile the program and its secret execution trace into ACIR format +#[derive(Debug, Clone, Args)] +pub(crate) struct CompileCommand { + /// Include Proving and Verification keys in the build artifacts. + #[arg(long)] + include_keys: bool, + + /// The name of the package to compile + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Compile all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: CompileCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_owned()), + )?; + let circuit_dir = workspace.target_directory_path(); + + let (binary_packages, contract_packages): (Vec<_>, Vec<_>) = workspace + .into_iter() + .filter(|package| !package.is_library()) + .cloned() + .partition(|package| package.is_binary()); + + let (np_language, opcode_support) = backend.get_backend_info()?; + let (_, compiled_contracts) = compile_workspace( + &workspace, + &binary_packages, + &contract_packages, + np_language, + &opcode_support, + &args.compile_options, + )?; + + // Save build artifacts to disk. + for (package, contract) in contract_packages.into_iter().zip(compiled_contracts) { + save_contract(contract, &package, &circuit_dir); + } + + Ok(()) +} + +pub(super) fn compile_workspace( + workspace: &Workspace, + binary_packages: &[Package], + contract_packages: &[Package], + np_language: Language, + opcode_support: &BackendOpcodeSupport, + compile_options: &CompileOptions, +) -> Result<(Vec, Vec), CliError> { + let is_opcode_supported = |opcode: &_| opcode_support.is_opcode_supported(opcode); + + // Compile all of the packages in parallel. + let program_results: Vec<(FileManager, CompilationResult)> = binary_packages + .par_iter() + .map(|package| { + compile_program(workspace, package, compile_options, np_language, &is_opcode_supported) + }) + .collect(); + let contract_results: Vec<(FileManager, CompilationResult)> = + contract_packages + .par_iter() + .map(|package| { + compile_contract(package, compile_options, np_language, &is_opcode_supported) + }) + .collect(); + + // Report any warnings/errors which were encountered during compilation. + let compiled_programs: Vec = program_results + .into_iter() + .map(|(file_manager, compilation_result)| { + report_errors( + compilation_result, + &file_manager, + compile_options.deny_warnings, + compile_options.silence_warnings, + ) + }) + .collect::>()?; + let compiled_contracts: Vec = contract_results + .into_iter() + .map(|(file_manager, compilation_result)| { + report_errors( + compilation_result, + &file_manager, + compile_options.deny_warnings, + compile_options.silence_warnings, + ) + }) + .collect::>()?; + + Ok((compiled_programs, compiled_contracts)) +} + +pub(crate) fn compile_bin_package( + workspace: &Workspace, + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> Result { + if package.is_library() { + return Err(CompileError::LibraryCrate(package.name.clone()).into()); + } + + let (file_manager, compilation_result) = + compile_program(workspace, package, compile_options, np_language, &is_opcode_supported); + + let program = report_errors( + compilation_result, + &file_manager, + compile_options.deny_warnings, + compile_options.silence_warnings, + )?; + + Ok(program) +} + +fn compile_program( + workspace: &Workspace, + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> (FileManager, CompilationResult) { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + + let program_artifact_path = workspace.package_build_path(package); + let mut debug_artifact_path = program_artifact_path.clone(); + debug_artifact_path.set_file_name(format!("debug_{}.json", package.name)); + let cached_program = if let (Ok(preprocessed_program), Ok(mut debug_artifact)) = ( + read_program_from_file(program_artifact_path), + read_debug_artifact_from_file(debug_artifact_path), + ) { + Some(CompiledProgram { + hash: preprocessed_program.hash, + circuit: preprocessed_program.bytecode, + abi: preprocessed_program.abi, + noir_version: preprocessed_program.noir_version, + debug: debug_artifact.debug_symbols.remove(0), + file_map: debug_artifact.file_map, + warnings: debug_artifact.warnings, + }) + } else { + None + }; + + let force_recompile = + cached_program.as_ref().map_or(false, |p| p.noir_version != NOIR_ARTIFACT_VERSION_STRING); + let (program, warnings) = match noirc_driver::compile_main( + &mut context, + crate_id, + compile_options, + cached_program, + force_recompile, + ) { + Ok(program_and_warnings) => program_and_warnings, + Err(errors) => { + return (context.file_manager, Err(errors)); + } + }; + + // TODO: we say that pedersen hashing is supported by all backends for now + let is_opcode_supported_pedersen_hash = |opcode: &Opcode| -> bool { + if let Opcode::BlackBoxFuncCall(BlackBoxFuncCall::PedersenHash { .. }) = opcode { + true + } else { + is_opcode_supported(opcode) + } + }; + + // Apply backend specific optimizations. + let optimized_program = + nargo::ops::optimize_program(program, np_language, &is_opcode_supported_pedersen_hash) + .expect("Backend does not support an opcode that is in the IR"); + + save_program(optimized_program.clone(), package, &workspace.target_directory_path()); + + (context.file_manager, Ok((optimized_program, warnings))) +} + +fn compile_contract( + package: &Package, + compile_options: &CompileOptions, + np_language: Language, + is_opcode_supported: &impl Fn(&Opcode) -> bool, +) -> (FileManager, CompilationResult) { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + let (contract, warnings) = + match noirc_driver::compile_contract(&mut context, crate_id, compile_options) { + Ok(contracts_and_warnings) => contracts_and_warnings, + Err(errors) => { + return (context.file_manager, Err(errors)); + } + }; + + let optimized_contract = + nargo::ops::optimize_contract(contract, np_language, &is_opcode_supported) + .expect("Backend does not support an opcode that is in the IR"); + + (context.file_manager, Ok((optimized_contract, warnings))) +} + +fn save_program(program: CompiledProgram, package: &Package, circuit_dir: &Path) { + let preprocessed_program = PreprocessedProgram { + hash: program.hash, + backend: String::from(BACKEND_IDENTIFIER), + abi: program.abi, + noir_version: program.noir_version, + bytecode: program.circuit, + }; + + save_program_to_file(&preprocessed_program, &package.name, circuit_dir); + + let debug_artifact = DebugArtifact { + debug_symbols: vec![program.debug], + file_map: program.file_map, + warnings: program.warnings, + }; + let circuit_name: String = (&package.name).into(); + save_debug_artifact_to_file(&debug_artifact, &circuit_name, circuit_dir); +} + +fn save_contract(contract: CompiledContract, package: &Package, circuit_dir: &Path) { + // TODO(#1389): I wonder if it is incorrect for nargo-core to know anything about contracts. + // As can be seen here, It seems like a leaky abstraction where ContractFunctions (essentially CompiledPrograms) + // are compiled via nargo-core and then the PreprocessedContract is constructed here. + // This is due to EACH function needing it's own CRS, PKey, and VKey from the backend. + let debug_artifact = DebugArtifact { + debug_symbols: contract.functions.iter().map(|function| function.debug.clone()).collect(), + file_map: contract.file_map, + warnings: contract.warnings, + }; + + let preprocessed_functions = vecmap(contract.functions, |func| PreprocessedContractFunction { + name: func.name, + function_type: func.function_type, + is_internal: func.is_internal, + abi: func.abi, + bytecode: func.bytecode, + }); + + let preprocessed_contract = PreprocessedContract { + noir_version: contract.noir_version, + name: contract.name, + backend: String::from(BACKEND_IDENTIFIER), + functions: preprocessed_functions, + events: contract.events, + }; + + save_contract_to_file( + &preprocessed_contract, + &format!("{}-{}", package.name, preprocessed_contract.name), + circuit_dir, + ); + + save_debug_artifact_to_file( + &debug_artifact, + &format!("{}-{}", package.name, preprocessed_contract.name), + circuit_dir, + ); +} + +/// Helper function for reporting any errors in a `CompilationResult` +/// structure that is commonly used as a return result in this file. +pub(crate) fn report_errors( + result: CompilationResult, + file_manager: &FileManager, + deny_warnings: bool, + silence_warnings: bool, +) -> Result { + let (t, warnings) = result.map_err(|errors| { + noirc_errors::reporter::report_all( + file_manager.as_file_map(), + &errors, + deny_warnings, + silence_warnings, + ) + })?; + + noirc_errors::reporter::report_all( + file_manager.as_file_map(), + &warnings, + deny_warnings, + silence_warnings, + ); + + Ok(t) +} diff --git a/noir/tooling/nargo_cli/src/cli/debug_cmd.rs b/noir/tooling/nargo_cli/src/cli/debug_cmd.rs new file mode 100644 index 00000000000..1d344058312 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/debug_cmd.rs @@ -0,0 +1,129 @@ +use acvm::acir::native_types::WitnessMap; +use clap::Args; + +use nargo::artifacts::debug::DebugArtifact; +use nargo::constants::PROVER_INPUT_FILE; +use nargo::package::Package; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_abi::input_parser::{Format, InputValue}; +use noirc_abi::InputMap; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::graph::CrateName; + +use super::compile_cmd::compile_bin_package; +use super::fs::{inputs::read_inputs_from_file, witness::save_witness_to_dir}; +use super::NargoConfig; +use crate::backends::Backend; +use crate::errors::CliError; + +/// Executes a circuit in debug mode +#[derive(Debug, Clone, Args)] +pub(crate) struct DebugCommand { + /// Write the execution witness to named file + witness_name: Option, + + /// The name of the toml file which contains the inputs for the prover + #[clap(long, short, default_value = PROVER_INPUT_FILE)] + prover_name: String, + + /// The name of the package to execute + #[clap(long)] + package: Option, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: DebugCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let selection = args.package.map_or(PackageSelection::DefaultOrAll, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + let target_dir = &workspace.target_directory_path(); + let (np_language, opcode_support) = backend.get_backend_info()?; + + let Some(package) = workspace.into_iter().find(|p| p.is_binary()) else { + println!( + "No matching binary packages found in workspace. Only binary packages can be debugged." + ); + return Ok(()); + }; + + let compiled_program = + compile_bin_package(&workspace, package, &args.compile_options, np_language, &|opcode| { + opcode_support.is_opcode_supported(opcode) + })?; + + println!("[{}] Starting debugger", package.name); + let (return_value, solved_witness) = + debug_program_and_decode(compiled_program, package, &args.prover_name)?; + + if let Some(solved_witness) = solved_witness { + println!("[{}] Circuit witness successfully solved", package.name); + + if let Some(return_value) = return_value { + println!("[{}] Circuit output: {return_value:?}", package.name); + } + + if let Some(witness_name) = &args.witness_name { + let witness_path = save_witness_to_dir(solved_witness, witness_name, target_dir)?; + + println!("[{}] Witness saved to {}", package.name, witness_path.display()); + } + } else { + println!("Debugger execution halted."); + } + + Ok(()) +} + +fn debug_program_and_decode( + program: CompiledProgram, + package: &Package, + prover_name: &str, +) -> Result<(Option, Option), CliError> { + // Parse the initial witness values from Prover.toml + let (inputs_map, _) = + read_inputs_from_file(&package.root_dir, prover_name, Format::Toml, &program.abi)?; + let solved_witness = debug_program(&program, &inputs_map)?; + let public_abi = program.abi.public_abi(); + + match solved_witness { + Some(witness) => { + let (_, return_value) = public_abi.decode(&witness)?; + Ok((return_value, Some(witness))) + } + None => Ok((None, None)), + } +} + +pub(crate) fn debug_program( + compiled_program: &CompiledProgram, + inputs_map: &InputMap, +) -> Result, CliError> { + #[allow(deprecated)] + let blackbox_solver = barretenberg_blackbox_solver::BarretenbergSolver::new(); + + let initial_witness = compiled_program.abi.encode(inputs_map, None)?; + + let debug_artifact = DebugArtifact { + debug_symbols: vec![compiled_program.debug.clone()], + file_map: compiled_program.file_map.clone(), + warnings: compiled_program.warnings.clone(), + }; + + noir_debugger::debug_circuit( + &blackbox_solver, + &compiled_program.circuit, + debug_artifact, + initial_witness, + ) + .map_err(CliError::from) +} diff --git a/noir/tooling/nargo_cli/src/cli/execute_cmd.rs b/noir/tooling/nargo_cli/src/cli/execute_cmd.rs new file mode 100644 index 00000000000..91e4b800453 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/execute_cmd.rs @@ -0,0 +1,131 @@ +use acvm::acir::native_types::WitnessMap; +use clap::Args; + +use nargo::artifacts::debug::DebugArtifact; +use nargo::constants::PROVER_INPUT_FILE; +use nargo::errors::try_to_diagnose_runtime_error; +use nargo::ops::DefaultForeignCallExecutor; +use nargo::package::Package; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_abi::input_parser::{Format, InputValue}; +use noirc_abi::InputMap; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::graph::CrateName; + +use super::compile_cmd::compile_bin_package; +use super::fs::{inputs::read_inputs_from_file, witness::save_witness_to_dir}; +use super::NargoConfig; +use crate::backends::Backend; +use crate::errors::CliError; + +/// Executes a circuit to calculate its return value +#[derive(Debug, Clone, Args)] +pub(crate) struct ExecuteCommand { + /// Write the execution witness to named file + witness_name: Option, + + /// The name of the toml file which contains the inputs for the prover + #[clap(long, short, default_value = PROVER_INPUT_FILE)] + prover_name: String, + + /// The name of the package to execute + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Execute all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: ExecuteCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + let target_dir = &workspace.target_directory_path(); + + let (np_language, opcode_support) = backend.get_backend_info()?; + for package in &workspace { + let compiled_program = compile_bin_package( + &workspace, + package, + &args.compile_options, + np_language, + &|opcode| opcode_support.is_opcode_supported(opcode), + )?; + + let (return_value, solved_witness) = + execute_program_and_decode(compiled_program, package, &args.prover_name)?; + + println!("[{}] Circuit witness successfully solved", package.name); + if let Some(return_value) = return_value { + println!("[{}] Circuit output: {return_value:?}", package.name); + } + if let Some(witness_name) = &args.witness_name { + let witness_path = save_witness_to_dir(solved_witness, witness_name, target_dir)?; + + println!("[{}] Witness saved to {}", package.name, witness_path.display()); + } + } + Ok(()) +} + +fn execute_program_and_decode( + program: CompiledProgram, + package: &Package, + prover_name: &str, +) -> Result<(Option, WitnessMap), CliError> { + // Parse the initial witness values from Prover.toml + let (inputs_map, _) = + read_inputs_from_file(&package.root_dir, prover_name, Format::Toml, &program.abi)?; + let solved_witness = execute_program(&program, &inputs_map)?; + let public_abi = program.abi.public_abi(); + let (_, return_value) = public_abi.decode(&solved_witness)?; + + Ok((return_value, solved_witness)) +} + +pub(crate) fn execute_program( + compiled_program: &CompiledProgram, + inputs_map: &InputMap, +) -> Result { + #[allow(deprecated)] + let blackbox_solver = barretenberg_blackbox_solver::BarretenbergSolver::new(); + + let initial_witness = compiled_program.abi.encode(inputs_map, None)?; + + let solved_witness_err = nargo::ops::execute_circuit( + &compiled_program.circuit, + initial_witness, + &blackbox_solver, + &mut DefaultForeignCallExecutor::new(true), + ); + match solved_witness_err { + Ok(solved_witness) => Ok(solved_witness), + Err(err) => { + let debug_artifact = DebugArtifact { + debug_symbols: vec![compiled_program.debug.clone()], + file_map: compiled_program.file_map.clone(), + warnings: compiled_program.warnings.clone(), + }; + + if let Some(diagnostic) = try_to_diagnose_runtime_error(&err, &compiled_program.debug) { + diagnostic.report(&debug_artifact, false); + } + + Err(crate::errors::CliError::NargoError(err)) + } + } +} diff --git a/noir/tooling/nargo_cli/src/cli/fmt_cmd.rs b/noir/tooling/nargo_cli/src/cli/fmt_cmd.rs new file mode 100644 index 00000000000..eaa66fff02b --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fmt_cmd.rs @@ -0,0 +1,84 @@ +use std::{fs::DirEntry, path::Path}; + +use clap::Args; +use fm::FileManager; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::NOIR_ARTIFACT_VERSION_STRING; +use noirc_errors::CustomDiagnostic; +use noirc_frontend::{hir::def_map::parse_file, parser::ParserError}; + +use crate::errors::CliError; + +use super::NargoConfig; + +#[derive(Debug, Clone, Args)] +pub(crate) struct FormatCommand {} + +pub(crate) fn run(_args: FormatCommand, config: NargoConfig) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let workspace = resolve_workspace_from_toml( + &toml_path, + PackageSelection::All, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let config = nargo_fmt::Config::read(&config.program_dir) + .map_err(|err| CliError::Generic(err.to_string()))?; + + for package in &workspace { + let mut file_manager = + FileManager::new(&package.root_dir, Box::new(|path| std::fs::read_to_string(path))); + + visit_noir_files(&package.root_dir.join("src"), &mut |entry| { + let file_id = file_manager.add_file(&entry.path()).expect("file exists"); + let (parsed_module, errors) = parse_file(&file_manager, file_id); + + let is_all_warnings = errors.iter().all(ParserError::is_warning); + if !is_all_warnings { + let errors = errors + .into_iter() + .map(|error| { + let error: CustomDiagnostic = error.into(); + error.in_file(file_id) + }) + .collect(); + + let _ = super::compile_cmd::report_errors::<()>( + Err(errors), + &file_manager, + false, + false, + ); + return Ok(()); + } + + let source = nargo_fmt::format( + file_manager.fetch_file(file_id).source(), + parsed_module, + &config, + ); + + std::fs::write(entry.path(), source) + }) + .map_err(|error| CliError::Generic(error.to_string()))?; + } + Ok(()) +} + +fn visit_noir_files( + dir: &Path, + cb: &mut dyn FnMut(&DirEntry) -> std::io::Result<()>, +) -> std::io::Result<()> { + if dir.is_dir() { + for entry in std::fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + if path.is_dir() { + visit_noir_files(&path, cb)?; + } else if entry.path().extension().map_or(false, |extension| extension == "nr") { + cb(&entry)?; + } + } + } + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/fs/inputs.rs b/noir/tooling/nargo_cli/src/cli/fs/inputs.rs new file mode 100644 index 00000000000..f3f0baf10f4 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fs/inputs.rs @@ -0,0 +1,130 @@ +use noirc_abi::{ + input_parser::{Format, InputValue}, + Abi, InputMap, MAIN_RETURN_NAME, +}; +use std::{collections::BTreeMap, path::Path}; + +use crate::errors::FilesystemError; + +use super::write_to_file; + +/// Returns the circuit's parameters and its return value, if one exists. +/// # Examples +/// +/// ```ignore +/// let (input_map, return_value): (InputMap, Option) = +/// read_inputs_from_file(path, "Verifier", Format::Toml, &abi)?; +/// ``` +pub(crate) fn read_inputs_from_file>( + path: P, + file_name: &str, + format: Format, + abi: &Abi, +) -> Result<(InputMap, Option), FilesystemError> { + if abi.is_empty() { + return Ok((BTreeMap::new(), None)); + } + + let file_path = path.as_ref().join(file_name).with_extension(format.ext()); + if !file_path.exists() { + return Err(FilesystemError::MissingTomlFile(file_name.to_owned(), file_path)); + } + + let input_string = std::fs::read_to_string(file_path).unwrap(); + let mut input_map = format.parse(&input_string, abi)?; + let return_value = input_map.remove(MAIN_RETURN_NAME); + + Ok((input_map, return_value)) +} + +pub(crate) fn write_inputs_to_file>( + input_map: &InputMap, + return_value: &Option, + abi: &Abi, + path: P, + file_name: &str, + format: Format, +) -> Result<(), FilesystemError> { + let file_path = path.as_ref().join(file_name).with_extension(format.ext()); + + // We must insert the return value into the `InputMap` in order for it to be written to file. + let serialized_output = match return_value { + // Parameters and return values are kept separate except for when they're being written to file. + // As a result, we don't want to modify the original map and must clone it before insertion. + Some(return_value) => { + let mut input_map = input_map.clone(); + input_map.insert(MAIN_RETURN_NAME.to_owned(), return_value.clone()); + format.serialize(&input_map, abi)? + } + // If no return value exists, then we can serialize the original map directly. + None => format.serialize(input_map, abi)?, + }; + + write_to_file(serialized_output.as_bytes(), &file_path); + + Ok(()) +} + +#[cfg(test)] +mod tests { + use std::{collections::BTreeMap, vec}; + + use acvm::FieldElement; + use nargo::constants::VERIFIER_INPUT_FILE; + use noirc_abi::{ + input_parser::{Format, InputValue}, + Abi, AbiParameter, AbiType, AbiVisibility, + }; + use tempfile::TempDir; + + use super::{read_inputs_from_file, write_inputs_to_file}; + + #[test] + fn write_and_read_recovers_inputs_and_return_value() { + let input_dir = TempDir::new().unwrap().into_path(); + + // We purposefully test a simple ABI here as we're focussing on `fs`. + // Tests for serializing complex types should exist in `noirc_abi`. + let abi = Abi { + parameters: vec![ + AbiParameter { + name: "foo".into(), + typ: AbiType::Field, + visibility: AbiVisibility::Public, + }, + AbiParameter { + name: "bar".into(), + typ: AbiType::String { length: 11 }, + visibility: AbiVisibility::Private, + }, + ], + return_type: Some(AbiType::Field), + + // Input serialization is only dependent on types, not position in witness map. + // Neither of these should be relevant so we leave them empty. + param_witnesses: BTreeMap::new(), + return_witnesses: Vec::new(), + }; + let input_map = BTreeMap::from([ + ("foo".to_owned(), InputValue::Field(42u128.into())), + ("bar".to_owned(), InputValue::String("hello world".to_owned())), + ]); + let return_value = Some(InputValue::Field(FieldElement::zero())); + + write_inputs_to_file( + &input_map, + &return_value, + &abi, + &input_dir, + VERIFIER_INPUT_FILE, + Format::Toml, + ) + .unwrap(); + + let (loaded_inputs, loaded_return_value) = + read_inputs_from_file(input_dir, VERIFIER_INPUT_FILE, Format::Toml, &abi).unwrap(); + + assert_eq!(loaded_inputs, input_map); + assert_eq!(loaded_return_value, return_value); + } +} diff --git a/noir/tooling/nargo_cli/src/cli/fs/mod.rs b/noir/tooling/nargo_cli/src/cli/fs/mod.rs new file mode 100644 index 00000000000..4ebce3b3325 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fs/mod.rs @@ -0,0 +1,42 @@ +use std::{ + fs::File, + io::Write, + path::{Path, PathBuf}, +}; + +use crate::errors::FilesystemError; + +pub(super) mod inputs; +pub(super) mod program; +pub(super) mod proof; +pub(super) mod witness; + +pub(super) fn create_named_dir(named_dir: &Path, name: &str) -> PathBuf { + std::fs::create_dir_all(named_dir) + .unwrap_or_else(|_| panic!("could not create the `{name}` directory")); + + PathBuf::from(named_dir) +} + +pub(super) fn write_to_file(bytes: &[u8], path: &Path) -> String { + let display = path.display(); + + let mut file = match File::create(path) { + Err(why) => panic!("couldn't create {display}: {why}"), + Ok(file) => file, + }; + + match file.write_all(bytes) { + Err(why) => panic!("couldn't write to {display}: {why}"), + Ok(_) => display.to_string(), + } +} + +pub(super) fn load_hex_data>(path: P) -> Result, FilesystemError> { + let hex_data: Vec<_> = std::fs::read(&path) + .map_err(|_| FilesystemError::PathNotValid(path.as_ref().to_path_buf()))?; + + let raw_bytes = hex::decode(hex_data).map_err(FilesystemError::HexArtifactNotValid)?; + + Ok(raw_bytes) +} diff --git a/noir/tooling/nargo_cli/src/cli/fs/program.rs b/noir/tooling/nargo_cli/src/cli/fs/program.rs new file mode 100644 index 00000000000..e82f2d55264 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fs/program.rs @@ -0,0 +1,73 @@ +use std::path::{Path, PathBuf}; + +use nargo::artifacts::{ + contract::PreprocessedContract, debug::DebugArtifact, program::PreprocessedProgram, +}; +use noirc_frontend::graph::CrateName; + +use crate::errors::FilesystemError; + +use super::{create_named_dir, write_to_file}; + +pub(crate) fn save_program_to_file>( + compiled_program: &PreprocessedProgram, + crate_name: &CrateName, + circuit_dir: P, +) -> PathBuf { + let circuit_name: String = crate_name.into(); + save_build_artifact_to_file(compiled_program, &circuit_name, circuit_dir) +} + +pub(crate) fn save_contract_to_file>( + compiled_contract: &PreprocessedContract, + circuit_name: &str, + circuit_dir: P, +) -> PathBuf { + save_build_artifact_to_file(compiled_contract, circuit_name, circuit_dir) +} + +pub(crate) fn save_debug_artifact_to_file>( + debug_artifact: &DebugArtifact, + circuit_name: &str, + circuit_dir: P, +) -> PathBuf { + let artifact_name = format!("debug_{circuit_name}"); + save_build_artifact_to_file(debug_artifact, &artifact_name, circuit_dir) +} + +fn save_build_artifact_to_file, T: ?Sized + serde::Serialize>( + build_artifact: &T, + artifact_name: &str, + circuit_dir: P, +) -> PathBuf { + create_named_dir(circuit_dir.as_ref(), "target"); + let circuit_path = circuit_dir.as_ref().join(artifact_name).with_extension("json"); + + write_to_file(&serde_json::to_vec(build_artifact).unwrap(), &circuit_path); + + circuit_path +} + +pub(crate) fn read_program_from_file>( + circuit_path: P, +) -> Result { + let file_path = circuit_path.as_ref().with_extension("json"); + + let input_string = + std::fs::read(&file_path).map_err(|_| FilesystemError::PathNotValid(file_path))?; + let program = serde_json::from_slice(&input_string) + .map_err(|err| FilesystemError::ProgramSerializationError(err.to_string()))?; + + Ok(program) +} + +pub(crate) fn read_debug_artifact_from_file>( + debug_artifact_path: P, +) -> Result { + let input_string = std::fs::read(&debug_artifact_path) + .map_err(|_| FilesystemError::PathNotValid(debug_artifact_path.as_ref().into()))?; + let program = serde_json::from_slice(&input_string) + .map_err(|err| FilesystemError::ProgramSerializationError(err.to_string()))?; + + Ok(program) +} diff --git a/noir/tooling/nargo_cli/src/cli/fs/proof.rs b/noir/tooling/nargo_cli/src/cli/fs/proof.rs new file mode 100644 index 00000000000..d2b3050708b --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fs/proof.rs @@ -0,0 +1,20 @@ +use std::path::{Path, PathBuf}; + +use nargo::constants::PROOF_EXT; + +use crate::errors::FilesystemError; + +use super::{create_named_dir, write_to_file}; + +pub(crate) fn save_proof_to_dir>( + proof: &[u8], + proof_name: &str, + proof_dir: P, +) -> Result { + create_named_dir(proof_dir.as_ref(), "proof"); + let proof_path = proof_dir.as_ref().join(proof_name).with_extension(PROOF_EXT); + + write_to_file(hex::encode(proof).as_bytes(), &proof_path); + + Ok(proof_path) +} diff --git a/noir/tooling/nargo_cli/src/cli/fs/witness.rs b/noir/tooling/nargo_cli/src/cli/fs/witness.rs new file mode 100644 index 00000000000..1a2cf88f4a1 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/fs/witness.rs @@ -0,0 +1,22 @@ +use std::path::{Path, PathBuf}; + +use acvm::acir::native_types::WitnessMap; +use nargo::constants::WITNESS_EXT; + +use super::{create_named_dir, write_to_file}; +use crate::errors::FilesystemError; + +pub(crate) fn save_witness_to_dir>( + witnesses: WitnessMap, + witness_name: &str, + witness_dir: P, +) -> Result { + create_named_dir(witness_dir.as_ref(), "witness"); + let witness_path = witness_dir.as_ref().join(witness_name).with_extension(WITNESS_EXT); + + let buf: Vec = witnesses.try_into()?; + + write_to_file(buf.as_slice(), &witness_path); + + Ok(witness_path) +} diff --git a/noir/tooling/nargo_cli/src/cli/info_cmd.rs b/noir/tooling/nargo_cli/src/cli/info_cmd.rs new file mode 100644 index 00000000000..b1cd5f0b64f --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/info_cmd.rs @@ -0,0 +1,283 @@ +use std::collections::HashMap; + +use acvm::Language; +use backend_interface::BackendError; +use clap::Args; +use iter_extended::vecmap; +use nargo::{artifacts::debug::DebugArtifact, package::Package}; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{ + CompileOptions, CompiledContract, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING, +}; +use noirc_errors::{debug_info::OpCodesCount, Location}; +use noirc_frontend::graph::CrateName; +use prettytable::{row, table, Row}; +use rayon::prelude::*; +use serde::Serialize; + +use crate::backends::Backend; +use crate::errors::CliError; + +use super::{compile_cmd::compile_workspace, NargoConfig}; + +/// Provides detailed information on a circuit +/// +/// Current information provided: +/// 1. The number of ACIR opcodes +/// 2. Counts the final number gates in the circuit used by a backend +#[derive(Debug, Clone, Args)] +pub(crate) struct InfoCommand { + /// The name of the package to detail + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Detail all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + /// Output a JSON formatted report. Changes to this format are not currently considered breaking. + #[clap(long, hide = true)] + json: bool, + + #[clap(long, hide = true)] + profile_info: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: InfoCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let (binary_packages, contract_packages): (Vec<_>, Vec<_>) = workspace + .into_iter() + .filter(|package| !package.is_library()) + .cloned() + .partition(|package| package.is_binary()); + + let (np_language, opcode_support) = backend.get_backend_info()?; + let (compiled_programs, compiled_contracts) = compile_workspace( + &workspace, + &binary_packages, + &contract_packages, + np_language, + &opcode_support, + &args.compile_options, + )?; + + if args.profile_info { + for compiled_program in &compiled_programs { + let span_opcodes = compiled_program.debug.count_span_opcodes(); + let debug_artifact: DebugArtifact = compiled_program.clone().into(); + print_span_opcodes(span_opcodes, &debug_artifact); + } + + for compiled_contract in &compiled_contracts { + let debug_artifact: DebugArtifact = compiled_contract.clone().into(); + let functions = &compiled_contract.functions; + for contract_function in functions { + let span_opcodes = contract_function.debug.count_span_opcodes(); + print_span_opcodes(span_opcodes, &debug_artifact); + } + } + } + + let program_info = binary_packages + .into_par_iter() + .zip(compiled_programs) + .map(|(package, program)| { + count_opcodes_and_gates_in_program(backend, program, &package, np_language) + }) + .collect::>()?; + + let contract_info = compiled_contracts + .into_par_iter() + .map(|contract| count_opcodes_and_gates_in_contract(backend, contract, np_language)) + .collect::>()?; + + let info_report = InfoReport { programs: program_info, contracts: contract_info }; + + if args.json { + // Expose machine-readable JSON data. + println!("{}", serde_json::to_string(&info_report).unwrap()); + } else { + // Otherwise print human-readable table. + if !info_report.programs.is_empty() { + let mut program_table = table!([Fm->"Package", Fm->"Language", Fm->"ACIR Opcodes", Fm->"Backend Circuit Size"]); + + for program in info_report.programs { + program_table.add_row(program.into()); + } + program_table.printstd(); + } + if !info_report.contracts.is_empty() { + let mut contract_table = table!([ + Fm->"Contract", + Fm->"Function", + Fm->"Language", + Fm->"ACIR Opcodes", + Fm->"Backend Circuit Size" + ]); + for contract_info in info_report.contracts { + let contract_rows: Vec = contract_info.into(); + for row in contract_rows { + contract_table.add_row(row); + } + } + + contract_table.printstd(); + } + } + + Ok(()) +} + +/// Provides profiling information on +/// +/// Number of OpCodes in relation to Noir source file +/// and line number information +fn print_span_opcodes( + span_opcodes_map: HashMap, + debug_artifact: &DebugArtifact, +) { + let mut pairs: Vec<(&Location, &OpCodesCount)> = span_opcodes_map.iter().collect(); + + pairs.sort_by(|a, b| { + a.1.acir_size.cmp(&b.1.acir_size).then_with(|| a.1.brillig_size.cmp(&b.1.brillig_size)) + }); + + for (location, opcodes_count) in pairs { + let debug_file = debug_artifact.file_map.get(&location.file).unwrap(); + + let start_byte = byte_index(&debug_file.source, location.span.start() + 1); + let end_byte = byte_index(&debug_file.source, location.span.end() + 1); + let range = start_byte..end_byte; + let span_content = &debug_file.source[range]; + let line = debug_artifact.location_line_index(*location).unwrap() + 1; + println!( + "Ln. {}: {} (ACIR:{}, Brillig:{} opcode|s) in file: {}", + line, + span_content, + opcodes_count.acir_size, + opcodes_count.brillig_size, + debug_file.path.to_str().unwrap() + ); + } +} +fn byte_index(string: &str, index: u32) -> usize { + let mut byte_index = 0; + let mut char_index = 0; + + #[allow(clippy::explicit_counter_loop)] + for (byte_offset, _) in string.char_indices() { + if char_index == index { + return byte_index; + } + + byte_index = byte_offset; + char_index += 1; + } + + byte_index +} + +#[derive(Debug, Default, Serialize)] +struct InfoReport { + programs: Vec, + contracts: Vec, +} + +#[derive(Debug, Serialize)] +struct ProgramInfo { + name: String, + #[serde(skip)] + language: Language, + acir_opcodes: usize, + circuit_size: u32, +} + +impl From for Row { + fn from(program_info: ProgramInfo) -> Self { + row![ + Fm->format!("{}", program_info.name), + format!("{:?}", program_info.language), + Fc->format!("{}", program_info.acir_opcodes), + Fc->format!("{}", program_info.circuit_size), + ] + } +} + +#[derive(Debug, Serialize)] +struct ContractInfo { + name: String, + #[serde(skip)] + language: Language, + functions: Vec, +} + +#[derive(Debug, Serialize)] +struct FunctionInfo { + name: String, + acir_opcodes: usize, + circuit_size: u32, +} + +impl From for Vec { + fn from(contract_info: ContractInfo) -> Self { + vecmap(contract_info.functions, |function| { + row![ + Fm->format!("{}", contract_info.name), + Fc->format!("{}", function.name), + format!("{:?}", contract_info.language), + Fc->format!("{}", function.acir_opcodes), + Fc->format!("{}", function.circuit_size), + ] + }) + } +} + +fn count_opcodes_and_gates_in_program( + backend: &Backend, + compiled_program: CompiledProgram, + package: &Package, + language: Language, +) -> Result { + Ok(ProgramInfo { + name: package.name.to_string(), + language, + acir_opcodes: compiled_program.circuit.opcodes.len(), + circuit_size: backend.get_exact_circuit_size(&compiled_program.circuit)?, + }) +} + +fn count_opcodes_and_gates_in_contract( + backend: &Backend, + contract: CompiledContract, + language: Language, +) -> Result { + let functions = contract + .functions + .into_par_iter() + .map(|function| -> Result<_, BackendError> { + Ok(FunctionInfo { + name: function.name, + acir_opcodes: function.bytecode.opcodes.len(), + circuit_size: backend.get_exact_circuit_size(&function.bytecode)?, + }) + }) + .collect::>()?; + + Ok(ContractInfo { name: contract.name, language, functions }) +} diff --git a/noir/tooling/nargo_cli/src/cli/init_cmd.rs b/noir/tooling/nargo_cli/src/cli/init_cmd.rs new file mode 100644 index 00000000000..e53c2e4cdc9 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/init_cmd.rs @@ -0,0 +1,91 @@ +use crate::backends::Backend; +use crate::errors::CliError; + +use super::fs::{create_named_dir, write_to_file}; +use super::NargoConfig; +use clap::Args; +use nargo::constants::{PKG_FILE, SRC_DIR}; +use nargo::package::PackageType; +use noirc_driver::NOIRC_VERSION; +use noirc_frontend::graph::CrateName; +use std::path::PathBuf; + +/// Create a Noir project in the current directory. +#[derive(Debug, Clone, Args)] +pub(crate) struct InitCommand { + /// Name of the package [default: current directory name] + #[clap(long)] + name: Option, + + /// Use a library template + #[arg(long, conflicts_with = "bin", conflicts_with = "contract")] + pub(crate) lib: bool, + + /// Use a binary template [default] + #[arg(long, conflicts_with = "lib", conflicts_with = "contract")] + pub(crate) bin: bool, + + /// Use a contract template + #[arg(long, conflicts_with = "lib", conflicts_with = "bin")] + pub(crate) contract: bool, +} + +const BIN_EXAMPLE: &str = include_str!("./noir_template_files/binary.nr"); +const CONTRACT_EXAMPLE: &str = include_str!("./noir_template_files/contract.nr"); +const LIB_EXAMPLE: &str = include_str!("./noir_template_files/library.nr"); + +pub(crate) fn run( + // Backend is currently unused, but we might want to use it to inform the "new" template in the future + _backend: &Backend, + args: InitCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let package_name = match args.name { + Some(name) => name, + None => { + let name = config.program_dir.file_name().unwrap().to_str().unwrap(); + name.parse().map_err(|_| CliError::InvalidPackageName(name.into()))? + } + }; + + let package_type = if args.lib { + PackageType::Library + } else if args.contract { + PackageType::Contract + } else { + PackageType::Binary + }; + initialize_project(config.program_dir, package_name, package_type); + Ok(()) +} + +/// Initializes a new Noir project in `package_dir`. +pub(crate) fn initialize_project( + package_dir: PathBuf, + package_name: CrateName, + package_type: PackageType, +) { + let src_dir = package_dir.join(SRC_DIR); + create_named_dir(&src_dir, "src"); + + let toml_contents = format!( + r#"[package] +name = "{package_name}" +type = "{package_type}" +authors = [""] +compiler_version = ">={NOIRC_VERSION}" + +[dependencies]"# + ); + + write_to_file(toml_contents.as_bytes(), &package_dir.join(PKG_FILE)); + // This uses the `match` syntax instead of `if` so we get a compile error when we add new package types (which likely need new template files) + match package_type { + PackageType::Binary => write_to_file(BIN_EXAMPLE.as_bytes(), &src_dir.join("main.nr")), + PackageType::Contract => { + write_to_file(CONTRACT_EXAMPLE.as_bytes(), &src_dir.join("main.nr")) + } + PackageType::Library => write_to_file(LIB_EXAMPLE.as_bytes(), &src_dir.join("lib.nr")), + }; + println!("Project successfully created! It is located at {}", package_dir.display()); +} diff --git a/noir/tooling/nargo_cli/src/cli/lsp_cmd.rs b/noir/tooling/nargo_cli/src/cli/lsp_cmd.rs new file mode 100644 index 00000000000..a41bb877991 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/lsp_cmd.rs @@ -0,0 +1,61 @@ +use async_lsp::{ + client_monitor::ClientProcessMonitorLayer, concurrency::ConcurrencyLayer, + panic::CatchUnwindLayer, server::LifecycleLayer, tracing::TracingLayer, +}; +use clap::Args; +use noir_lsp::NargoLspService; +use tower::ServiceBuilder; + +use super::NargoConfig; +use crate::backends::Backend; +use crate::errors::CliError; + +/// Starts the Noir LSP server +/// +/// Starts an LSP server which allows IDEs such as VS Code to display diagnostics in Noir source. +/// +/// VS Code Noir Language Support: https://marketplace.visualstudio.com/items?itemName=noir-lang.vscode-noir +#[derive(Debug, Clone, Args)] +pub(crate) struct LspCommand; + +pub(crate) fn run( + // Backend is currently unused, but we might want to use it to inform the lsp in the future + _backend: &Backend, + _args: LspCommand, + _config: NargoConfig, +) -> Result<(), CliError> { + use tokio::runtime::Builder; + + let runtime = Builder::new_current_thread().enable_all().build().unwrap(); + + runtime.block_on(async { + let (server, _) = async_lsp::MainLoop::new_server(|client| { + #[allow(deprecated)] + let blackbox_solver = barretenberg_blackbox_solver::BarretenbergSolver::new(); + let router = NargoLspService::new(&client, blackbox_solver); + + ServiceBuilder::new() + .layer(TracingLayer::default()) + .layer(LifecycleLayer::default()) + .layer(CatchUnwindLayer::default()) + .layer(ConcurrencyLayer::default()) + .layer(ClientProcessMonitorLayer::new(client)) + .service(router) + }); + + // Prefer truly asynchronous piped stdin/stdout without blocking tasks. + #[cfg(unix)] + let (stdin, stdout) = ( + async_lsp::stdio::PipeStdin::lock_tokio().unwrap(), + async_lsp::stdio::PipeStdout::lock_tokio().unwrap(), + ); + // Fallback to spawn blocking read/write otherwise. + #[cfg(not(unix))] + let (stdin, stdout) = ( + tokio_util::compat::TokioAsyncReadCompatExt::compat(tokio::io::stdin()), + tokio_util::compat::TokioAsyncWriteCompatExt::compat_write(tokio::io::stdout()), + ); + + server.run_buffered(stdin, stdout).await.map_err(CliError::LspError) + }) +} diff --git a/noir/tooling/nargo_cli/src/cli/mod.rs b/noir/tooling/nargo_cli/src/cli/mod.rs new file mode 100644 index 00000000000..8d22fb1b204 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/mod.rs @@ -0,0 +1,120 @@ +use clap::{Args, Parser, Subcommand}; +use const_format::formatcp; +use nargo_toml::find_package_root; +use noirc_driver::NOIR_ARTIFACT_VERSION_STRING; +use std::path::PathBuf; + +use color_eyre::eyre; + +use crate::backends::get_active_backend; + +mod fs; + +mod backend_cmd; +mod check_cmd; +mod codegen_verifier_cmd; +mod compile_cmd; +mod debug_cmd; +mod execute_cmd; +mod fmt_cmd; +mod info_cmd; +mod init_cmd; +mod lsp_cmd; +mod new_cmd; +mod prove_cmd; +mod test_cmd; +mod verify_cmd; + +const GIT_HASH: &str = env!("GIT_COMMIT"); +const IS_DIRTY: &str = env!("GIT_DIRTY"); +const NARGO_VERSION: &str = env!("CARGO_PKG_VERSION"); + +static VERSION_STRING: &str = formatcp!( + "version = {}\nnoirc version = {}\n(git version hash: {}, is dirty: {})", + NARGO_VERSION, + NOIR_ARTIFACT_VERSION_STRING, + GIT_HASH, + IS_DIRTY +); + +#[derive(Parser, Debug)] +#[command(name="nargo", author, version=VERSION_STRING, about, long_about = None)] +struct NargoCli { + #[command(subcommand)] + command: NargoCommand, + + #[clap(flatten)] + config: NargoConfig, +} + +#[non_exhaustive] +#[derive(Args, Clone, Debug)] +pub(crate) struct NargoConfig { + // REMINDER: Also change this flag in the LSP test lens if renamed + #[arg(long, hide = true, global = true, default_value = "./")] + program_dir: PathBuf, +} + +#[non_exhaustive] +#[derive(Subcommand, Clone, Debug)] +enum NargoCommand { + Backend(backend_cmd::BackendCommand), + Check(check_cmd::CheckCommand), + #[command(hide = true)] // Hidden while the feature has not been extensively tested + Fmt(fmt_cmd::FormatCommand), + CodegenVerifier(codegen_verifier_cmd::CodegenVerifierCommand), + #[command(alias = "build")] + Compile(compile_cmd::CompileCommand), + New(new_cmd::NewCommand), + Init(init_cmd::InitCommand), + Execute(execute_cmd::ExecuteCommand), + #[command(hide = true)] // Hidden while the feature is being built out + Debug(debug_cmd::DebugCommand), + Prove(prove_cmd::ProveCommand), + Verify(verify_cmd::VerifyCommand), + Test(test_cmd::TestCommand), + Info(info_cmd::InfoCommand), + Lsp(lsp_cmd::LspCommand), +} + +pub(crate) fn start_cli() -> eyre::Result<()> { + let NargoCli { command, mut config } = NargoCli::parse(); + + // If the provided `program_dir` is relative, make it absolute by joining it to the current directory. + if !config.program_dir.is_absolute() { + config.program_dir = std::env::current_dir().unwrap().join(config.program_dir); + } + + // Search through parent directories to find package root if necessary. + if !matches!( + command, + NargoCommand::New(_) + | NargoCommand::Init(_) + | NargoCommand::Lsp(_) + | NargoCommand::Backend(_) + ) { + config.program_dir = find_package_root(&config.program_dir)?; + } + + let active_backend = get_active_backend(); + let backend = crate::backends::Backend::new(active_backend); + + match command { + NargoCommand::New(args) => new_cmd::run(&backend, args, config), + NargoCommand::Init(args) => init_cmd::run(&backend, args, config), + NargoCommand::Check(args) => check_cmd::run(&backend, args, config), + NargoCommand::Compile(args) => compile_cmd::run(&backend, args, config), + NargoCommand::Debug(args) => debug_cmd::run(&backend, args, config), + NargoCommand::Execute(args) => execute_cmd::run(&backend, args, config), + NargoCommand::Prove(args) => prove_cmd::run(&backend, args, config), + NargoCommand::Verify(args) => verify_cmd::run(&backend, args, config), + NargoCommand::Test(args) => test_cmd::run(&backend, args, config), + NargoCommand::Info(args) => info_cmd::run(&backend, args, config), + NargoCommand::CodegenVerifier(args) => codegen_verifier_cmd::run(&backend, args, config), + NargoCommand::Backend(args) => backend_cmd::run(args), + NargoCommand::Lsp(args) => lsp_cmd::run(&backend, args, config), + NargoCommand::Fmt(args) => fmt_cmd::run(args, config), + }?; + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/new_cmd.rs b/noir/tooling/nargo_cli/src/cli/new_cmd.rs new file mode 100644 index 00000000000..b4c823d0c1e --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/new_cmd.rs @@ -0,0 +1,61 @@ +use crate::backends::Backend; +use crate::errors::CliError; + +use super::{init_cmd::initialize_project, NargoConfig}; +use clap::Args; +use nargo::package::PackageType; +use noirc_frontend::graph::CrateName; +use std::path::PathBuf; + +/// Create a Noir project in a new directory. +#[derive(Debug, Clone, Args)] +pub(crate) struct NewCommand { + /// The path to save the new project + path: PathBuf, + + /// Name of the package [default: package directory name] + #[clap(long)] + name: Option, + + /// Use a library template + #[arg(long, conflicts_with = "bin", conflicts_with = "contract")] + pub(crate) lib: bool, + + /// Use a binary template [default] + #[arg(long, conflicts_with = "lib", conflicts_with = "contract")] + pub(crate) bin: bool, + + /// Use a contract template + #[arg(long, conflicts_with = "lib", conflicts_with = "bin")] + pub(crate) contract: bool, +} + +pub(crate) fn run( + // Backend is currently unused, but we might want to use it to inform the "new" template in the future + _backend: &Backend, + args: NewCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let package_dir = config.program_dir.join(&args.path); + + if package_dir.exists() { + return Err(CliError::DestinationAlreadyExists(package_dir)); + } + + let package_name = match args.name { + Some(name) => name, + None => { + let name = args.path.file_name().unwrap().to_str().unwrap(); + name.parse().map_err(|_| CliError::InvalidPackageName(name.into()))? + } + }; + let package_type = if args.lib { + PackageType::Library + } else if args.contract { + PackageType::Contract + } else { + PackageType::Binary + }; + initialize_project(package_dir, package_name, package_type); + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/noir_template_files/binary.nr b/noir/tooling/nargo_cli/src/cli/noir_template_files/binary.nr new file mode 100644 index 00000000000..3c30bf08424 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/noir_template_files/binary.nr @@ -0,0 +1,11 @@ +fn main(x: Field, y: pub Field) { + assert(x != y); +} + +#[test] +fn test_main() { + main(1, 2); + + // Uncomment to make test fail + // main(1, 1); +} diff --git a/noir/tooling/nargo_cli/src/cli/noir_template_files/contract.nr b/noir/tooling/nargo_cli/src/cli/noir_template_files/contract.nr new file mode 100644 index 00000000000..e126726393d --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/noir_template_files/contract.nr @@ -0,0 +1,5 @@ +contract Main { + internal fn double(x: Field) -> pub Field { x * 2 } + fn triple(x: Field) -> pub Field { x * 3 } + fn quadruple(x: Field) -> pub Field { double(double(x)) } +} diff --git a/noir/tooling/nargo_cli/src/cli/noir_template_files/library.nr b/noir/tooling/nargo_cli/src/cli/noir_template_files/library.nr new file mode 100644 index 00000000000..b874c958a9b --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/noir_template_files/library.nr @@ -0,0 +1,11 @@ +fn not_equal(x: Field, y: Field) -> bool { + x != y +} + +#[test] +fn test_not_equal() { + assert(not_equal(1, 2)); + + // Uncomment to make test fail + // assert(not_equal(1, 1)); +} diff --git a/noir/tooling/nargo_cli/src/cli/prove_cmd.rs b/noir/tooling/nargo_cli/src/cli/prove_cmd.rs new file mode 100644 index 00000000000..3586e73ff2e --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/prove_cmd.rs @@ -0,0 +1,127 @@ +use clap::Args; +use nargo::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE}; +use nargo::package::Package; +use nargo::workspace::Workspace; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_abi::input_parser::Format; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::graph::CrateName; + +use super::compile_cmd::compile_bin_package; +use super::fs::{ + inputs::{read_inputs_from_file, write_inputs_to_file}, + proof::save_proof_to_dir, +}; +use super::NargoConfig; +use crate::{backends::Backend, cli::execute_cmd::execute_program, errors::CliError}; + +/// Create proof for this program. The proof is returned as a hex encoded string. +#[derive(Debug, Clone, Args)] +pub(crate) struct ProveCommand { + /// The name of the toml file which contains the inputs for the prover + #[clap(long, short, default_value = PROVER_INPUT_FILE)] + prover_name: String, + + /// The name of the toml file which contains the inputs for the verifier + #[clap(long, short, default_value = VERIFIER_INPUT_FILE)] + verifier_name: String, + + /// Verify proof after proving + #[arg(long)] + verify: bool, + + /// The name of the package to prove + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Prove all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: ProveCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let (np_language, opcode_support) = backend.get_backend_info()?; + for package in &workspace { + let program = compile_bin_package( + &workspace, + package, + &args.compile_options, + np_language, + &|opcode| opcode_support.is_opcode_supported(opcode), + )?; + + prove_package( + backend, + &workspace, + package, + program, + &args.prover_name, + &args.verifier_name, + args.verify, + )?; + } + + Ok(()) +} + +pub(crate) fn prove_package( + backend: &Backend, + workspace: &Workspace, + package: &Package, + compiled_program: CompiledProgram, + prover_name: &str, + verifier_name: &str, + check_proof: bool, +) -> Result<(), CliError> { + // Parse the initial witness values from Prover.toml + let (inputs_map, _) = + read_inputs_from_file(&package.root_dir, prover_name, Format::Toml, &compiled_program.abi)?; + + let solved_witness = execute_program(&compiled_program, &inputs_map)?; + + // Write public inputs into Verifier.toml + let public_abi = compiled_program.abi.public_abi(); + let (public_inputs, return_value) = public_abi.decode(&solved_witness)?; + + write_inputs_to_file( + &public_inputs, + &return_value, + &public_abi, + &package.root_dir, + verifier_name, + Format::Toml, + )?; + + let proof = backend.prove(&compiled_program.circuit, solved_witness, false)?; + + if check_proof { + let public_inputs = public_abi.encode(&public_inputs, return_value)?; + let valid_proof = + backend.verify(&proof, public_inputs, &compiled_program.circuit, false)?; + + if !valid_proof { + return Err(CliError::InvalidProof("".into())); + } + } + + save_proof_to_dir(&proof, &String::from(&package.name), workspace.proofs_directory_path())?; + + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/test_cmd.rs b/noir/tooling/nargo_cli/src/cli/test_cmd.rs new file mode 100644 index 00000000000..e117d8555a5 --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/test_cmd.rs @@ -0,0 +1,160 @@ +use std::io::Write; + +use acvm::BlackBoxFunctionSolver; +use clap::Args; +use nargo::{ + ops::{run_test, TestStatus}, + package::Package, + prepare_package, +}; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_driver::{CompileOptions, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::{graph::CrateName, hir::FunctionNameMatch}; +use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; + +use crate::{backends::Backend, cli::check_cmd::check_crate_and_report_errors, errors::CliError}; + +use super::NargoConfig; + +/// Run the tests for this program +#[derive(Debug, Clone, Args)] +pub(crate) struct TestCommand { + /// If given, only tests with names containing this string will be run + test_name: Option, + + /// Display output of `println` statements + #[arg(long)] + show_output: bool, + + /// Only run tests that match exactly + #[clap(long)] + exact: bool, + + /// The name of the package to test + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Test all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + _backend: &Backend, + args: TestCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let pattern = match &args.test_name { + Some(name) => { + if args.exact { + FunctionNameMatch::Exact(name) + } else { + FunctionNameMatch::Contains(name) + } + } + None => FunctionNameMatch::Anything, + }; + + #[allow(deprecated)] + let blackbox_solver = barretenberg_blackbox_solver::BarretenbergSolver::new(); + for package in &workspace { + // By unwrapping here with `?`, we stop the test runner upon a package failing + // TODO: We should run the whole suite even if there are failures in a package + run_tests(&blackbox_solver, package, pattern, args.show_output, &args.compile_options)?; + } + + Ok(()) +} + +fn run_tests( + blackbox_solver: &S, + package: &Package, + test_name: FunctionNameMatch, + show_output: bool, + compile_options: &CompileOptions, +) -> Result<(), CliError> { + let (mut context, crate_id) = + prepare_package(package, Box::new(|path| std::fs::read_to_string(path))); + check_crate_and_report_errors( + &mut context, + crate_id, + compile_options.deny_warnings, + compile_options.silence_warnings, + )?; + + let test_functions = context.get_all_test_functions_in_crate_matching(&crate_id, test_name); + + println!("[{}] Running {} test functions", package.name, test_functions.len()); + let mut failing = 0; + + let writer = StandardStream::stderr(ColorChoice::Always); + let mut writer = writer.lock(); + + for (test_name, test_function) in test_functions { + write!(writer, "[{}] Testing {test_name}... ", package.name) + .expect("Failed to write to stdout"); + writer.flush().expect("Failed to flush writer"); + + match run_test(blackbox_solver, &context, test_function, show_output, compile_options) { + TestStatus::Pass { .. } => { + writer + .set_color(ColorSpec::new().set_fg(Some(Color::Green))) + .expect("Failed to set color"); + writeln!(writer, "ok").expect("Failed to write to stdout"); + } + TestStatus::Fail { message, error_diagnostic } => { + let writer = StandardStream::stderr(ColorChoice::Always); + let mut writer = writer.lock(); + writer + .set_color(ColorSpec::new().set_fg(Some(Color::Red))) + .expect("Failed to set color"); + writeln!(writer, "{message}").expect("Failed to write to stdout"); + writer.reset().expect("Failed to reset writer"); + if let Some(diag) = error_diagnostic { + noirc_errors::reporter::report_all( + context.file_manager.as_file_map(), + &[diag], + compile_options.deny_warnings, + compile_options.silence_warnings, + ); + } + failing += 1; + } + TestStatus::CompileError(err) => { + noirc_errors::reporter::report_all( + context.file_manager.as_file_map(), + &[err], + compile_options.deny_warnings, + compile_options.silence_warnings, + ); + failing += 1; + } + } + writer.reset().expect("Failed to reset writer"); + } + + if failing == 0 { + write!(writer, "[{}] ", package.name).expect("Failed to write to stdout"); + writer.set_color(ColorSpec::new().set_fg(Some(Color::Green))).expect("Failed to set color"); + writeln!(writer, "All tests passed").expect("Failed to write to stdout"); + } else { + let plural = if failing == 1 { "" } else { "s" }; + return Err(CliError::Generic(format!("[{}] {failing} test{plural} failed", package.name))); + } + + writer.reset().expect("Failed to reset writer"); + Ok(()) +} diff --git a/noir/tooling/nargo_cli/src/cli/verify_cmd.rs b/noir/tooling/nargo_cli/src/cli/verify_cmd.rs new file mode 100644 index 00000000000..8c6d92b3d2f --- /dev/null +++ b/noir/tooling/nargo_cli/src/cli/verify_cmd.rs @@ -0,0 +1,93 @@ +use super::NargoConfig; +use super::{ + compile_cmd::compile_bin_package, + fs::{inputs::read_inputs_from_file, load_hex_data}, +}; +use crate::{backends::Backend, errors::CliError}; + +use clap::Args; +use nargo::constants::{PROOF_EXT, VERIFIER_INPUT_FILE}; +use nargo::package::Package; +use nargo::workspace::Workspace; +use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection}; +use noirc_abi::input_parser::Format; +use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING}; +use noirc_frontend::graph::CrateName; + +/// Given a proof and a program, verify whether the proof is valid +#[derive(Debug, Clone, Args)] +pub(crate) struct VerifyCommand { + /// The name of the toml file which contains the inputs for the verifier + #[clap(long, short, default_value = VERIFIER_INPUT_FILE)] + verifier_name: String, + + /// The name of the package verify + #[clap(long, conflicts_with = "workspace")] + package: Option, + + /// Verify all packages in the workspace + #[clap(long, conflicts_with = "package")] + workspace: bool, + + #[clap(flatten)] + compile_options: CompileOptions, +} + +pub(crate) fn run( + backend: &Backend, + args: VerifyCommand, + config: NargoConfig, +) -> Result<(), CliError> { + let toml_path = get_package_manifest(&config.program_dir)?; + let default_selection = + if args.workspace { PackageSelection::All } else { PackageSelection::DefaultOrAll }; + let selection = args.package.map_or(default_selection, PackageSelection::Selected); + let workspace = resolve_workspace_from_toml( + &toml_path, + selection, + Some(NOIR_ARTIFACT_VERSION_STRING.to_string()), + )?; + + let (np_language, opcode_support) = backend.get_backend_info()?; + for package in &workspace { + let program = compile_bin_package( + &workspace, + package, + &args.compile_options, + np_language, + &|opcode| opcode_support.is_opcode_supported(opcode), + )?; + + verify_package(backend, &workspace, package, program, &args.verifier_name)?; + } + + Ok(()) +} + +fn verify_package( + backend: &Backend, + workspace: &Workspace, + package: &Package, + compiled_program: CompiledProgram, + verifier_name: &str, +) -> Result<(), CliError> { + // Load public inputs (if any) from `verifier_name`. + let public_abi = compiled_program.abi.public_abi(); + let (public_inputs_map, return_value) = + read_inputs_from_file(&package.root_dir, verifier_name, Format::Toml, &public_abi)?; + + let public_inputs = public_abi.encode(&public_inputs_map, return_value)?; + + let proof_path = + workspace.proofs_directory_path().join(package.name.to_string()).with_extension(PROOF_EXT); + + let proof = load_hex_data(&proof_path)?; + + let valid_proof = backend.verify(&proof, public_inputs, &compiled_program.circuit, false)?; + + if valid_proof { + Ok(()) + } else { + Err(CliError::InvalidProof(proof_path)) + } +} diff --git a/noir/tooling/nargo_cli/src/errors.rs b/noir/tooling/nargo_cli/src/errors.rs new file mode 100644 index 00000000000..92da74c71d4 --- /dev/null +++ b/noir/tooling/nargo_cli/src/errors.rs @@ -0,0 +1,87 @@ +use acvm::acir::native_types::WitnessMapError; +use hex::FromHexError; +use nargo::{errors::CompileError, NargoError}; +use nargo_toml::ManifestError; +use noirc_abi::errors::{AbiError, InputParserError}; +use std::path::PathBuf; +use thiserror::Error; + +#[derive(Debug, Error)] +pub(crate) enum FilesystemError { + #[error("Error: {} is not a valid path\nRun either `nargo compile` to generate missing build artifacts or `nargo prove` to construct a proof", .0.display())] + PathNotValid(PathBuf), + #[error("Error: could not parse hex build artifact (proof, proving and/or verification keys, ACIR checksum) ({0})")] + HexArtifactNotValid(FromHexError), + #[error( + " Error: cannot find {0}.toml file.\n Expected location: {1:?} \n Please generate this file at the expected location." + )] + MissingTomlFile(String, PathBuf), + + /// Input parsing error + #[error(transparent)] + InputParserError(#[from] InputParserError), + + /// WitnessMap serialization error + #[error(transparent)] + WitnessMapSerialization(#[from] WitnessMapError), + + #[error("Error: could not deserialize build program: {0}")] + ProgramSerializationError(String), +} + +#[derive(Debug, Error)] +pub(crate) enum CliError { + #[error("{0}")] + Generic(String), + #[error("Error: destination {} already exists", .0.display())] + DestinationAlreadyExists(PathBuf), + + #[error("Failed to verify proof {}", .0.display())] + InvalidProof(PathBuf), + + #[error("Invalid package name {0}. Did you mean to use `--name`?")] + InvalidPackageName(String), + + /// ABI encoding/decoding error + #[error(transparent)] + AbiError(#[from] AbiError), + + /// Filesystem errors + #[error(transparent)] + FilesystemError(#[from] FilesystemError), + + #[error(transparent)] + LspError(#[from] async_lsp::Error), + + /// Error from Nargo + #[error(transparent)] + NargoError(#[from] NargoError), + + /// Error from Manifest + #[error(transparent)] + ManifestError(#[from] ManifestError), + + /// Error from the compilation pipeline + #[error(transparent)] + CompileError(#[from] CompileError), + + /// Error related to backend selection/installation. + #[error(transparent)] + BackendError(#[from] BackendError), + + /// Error related to communication with backend. + #[error(transparent)] + BackendCommunicationError(#[from] backend_interface::BackendError), +} + +#[derive(Debug, thiserror::Error)] +pub(crate) enum BackendError { + #[error("No backend is installed with the name {0}")] + UnknownBackend(String), + + #[error("The backend {0} is already installed")] + AlreadyInstalled(String), + + #[error("Backend installation failed: {0}")] + InstallationError(#[from] std::io::Error), +} diff --git a/noir/tooling/nargo_cli/src/main.rs b/noir/tooling/nargo_cli/src/main.rs new file mode 100644 index 00000000000..92bd7b94988 --- /dev/null +++ b/noir/tooling/nargo_cli/src/main.rs @@ -0,0 +1,28 @@ +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] + +//! Nargo is the package manager for Noir +//! This name was used because it sounds like `cargo` and +//! Noir Package Manager abbreviated is npm, which is already taken. + +mod backends; +mod cli; +mod errors; + +use color_eyre::config::HookBuilder; + +const PANIC_MESSAGE: &str = "This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at https://github.com/noir-lang/noir/issues/.\nIf there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new?labels=bug&template=bug_report.yml"; + +fn main() { + // Register a panic hook to display more readable panic messages to end-users + let (panic_hook, _) = + HookBuilder::default().display_env_section(false).panic_section(PANIC_MESSAGE).into_hooks(); + panic_hook.install(); + + if let Err(report) = cli::start_cli() { + eprintln!("{report}"); + std::process::exit(1); + } +} diff --git a/noir/tooling/nargo_cli/tests/README.md b/noir/tooling/nargo_cli/tests/README.md new file mode 100644 index 00000000000..71e609ebf24 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/README.md @@ -0,0 +1,43 @@ +# Integration test directory structure + +Integration tests for the Noir compiler are broken down into the following directories: + +- `compile_failure`: programs which are not valid or unsatisfiable Noir code and so the compiler should reject. +- `compile_success_empty`: programs which are valid satisfiable Noir code but have no opcodes. +- `compile_success_contract`: contracts which are valid Noir code. +- `execution_success`: programs which are valid Noir satisfiable code and have opcodes. + +The current testing flow can be thought of as shown: +```mermaid +flowchart TD + + subgraph compile_failure + A1[Attempt to compile] --> A2[Assert compilation fails] + end + + subgraph compile_success_empty + B1[Attempt to compile] --> B2[Assert compilation succeeds] + B2 --> B3[Assert empty circuit] + end + + subgraph execution_success + C1[Attempt to compile] --> C2[Assert compilation succeeds] + C2 --> C3[Write circuit to file] + C3 --> C4[Assert execution succeeds] + C4 --> C5[Write witness to file] + + C6[Publish witness + circuit as artifact] + C3 --> C6 + C5 --> C6 + end + + subgraph compile_success_contract + D1[Attempt to compile] --> D2[Assert compilation succeeds] + end +``` + +## `execution_success` vs `compile_success_empty` + +Note that `execution_success` and `compile_success_empty` are distinct as `compile_success_empty` is expected to compile down to an empty circuit. This may not be possible for some argument-less circuits in the situation where instructions have side-effects or certain compiler optimizations are missing, but once moved to `compile_success_empty` a program compiling down to a non-empty circuit is a compiler regression. + + diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz new file mode 100644 index 00000000000..cc92863a4a8 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/witness.gz new file mode 100644 index 00000000000..454a9b75e04 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz new file mode 100644 index 00000000000..7572c9ac2cf Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz new file mode 100644 index 00000000000..76f5c8a2fe2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz new file mode 100644 index 00000000000..46405fc2029 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz new file mode 100644 index 00000000000..3145b77d957 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz new file mode 100644 index 00000000000..42e66d90f73 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz new file mode 100644 index 00000000000..0cfc48c525e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz new file mode 100644 index 00000000000..633bec13563 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz new file mode 100644 index 00000000000..68e9df80789 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz new file mode 100644 index 00000000000..681a0290f75 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz new file mode 100644 index 00000000000..b0a38188cab Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz new file mode 100644 index 00000000000..0cc489d8932 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/witness.gz new file mode 100644 index 00000000000..5c060e1b469 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/6/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz new file mode 100644 index 00000000000..787db190b49 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz new file mode 100644 index 00000000000..cc96fd18e00 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz new file mode 100644 index 00000000000..7f14d2a932c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/witness.gz new file mode 100644 index 00000000000..d51356eb6c1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/7/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz new file mode 100644 index 00000000000..5ddc1ba38e6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz new file mode 100644 index 00000000000..0bb522d210e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz new file mode 100644 index 00000000000..fd31cc3bfa6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz new file mode 100644 index 00000000000..450a83edc9c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz new file mode 100644 index 00000000000..376ae46ff4f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz new file mode 100644 index 00000000000..706a5784953 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz new file mode 100644 index 00000000000..b274cd72649 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/witness.gz new file mode 100644 index 00000000000..f000e986c3d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz new file mode 100644 index 00000000000..795d22712b2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz new file mode 100644 index 00000000000..c3763958eeb Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz new file mode 100644 index 00000000000..8d87f8bc575 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/witness.gz new file mode 100644 index 00000000000..c56b373217d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz new file mode 100644 index 00000000000..42d701ede8a Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz new file mode 100644 index 00000000000..8229809cc95 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz new file mode 100644 index 00000000000..c4e7f86f219 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/witness.gz new file mode 100644 index 00000000000..16880cedea2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assert/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz new file mode 100644 index 00000000000..d71ac1b6b0e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/witness.gz new file mode 100644 index 00000000000..3e073aac635 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz new file mode 100644 index 00000000000..a682df0b963 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/witness.gz new file mode 100644 index 00000000000..35e05b7622b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz new file mode 100644 index 00000000000..5fb7041cdf1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz new file mode 100644 index 00000000000..0c5dc12cf1c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz new file mode 100644 index 00000000000..4756ea6b632 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz new file mode 100644 index 00000000000..890e987dd74 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz new file mode 100644 index 00000000000..45c1cc44c8e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz new file mode 100644 index 00000000000..bdc4e70ba09 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz new file mode 100644 index 00000000000..233a1e25f33 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/witness.gz new file mode 100644 index 00000000000..16880cedea2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz new file mode 100644 index 00000000000..697832be207 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/witness.gz new file mode 100644 index 00000000000..10cffba7141 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz new file mode 100644 index 00000000000..69cbde31d9d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz new file mode 100644 index 00000000000..844178f0430 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz new file mode 100644 index 00000000000..a093703d4b3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/witness.gz new file mode 100644 index 00000000000..2d9b4cf245b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz new file mode 100644 index 00000000000..2cf3b7251e6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz new file mode 100644 index 00000000000..628e5fbc6d8 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz new file mode 100644 index 00000000000..be47506c42f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/witness.gz new file mode 100644 index 00000000000..d51356eb6c1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz new file mode 100644 index 00000000000..b69e231774b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz new file mode 100644 index 00000000000..844178f0430 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz new file mode 100644 index 00000000000..59b89c22bc3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/witness.gz new file mode 100644 index 00000000000..266c94d043a Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz new file mode 100644 index 00000000000..e4155f58ead Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/witness.gz new file mode 100644 index 00000000000..3e7c051ffc4 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz new file mode 100644 index 00000000000..9117511d800 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/witness.gz new file mode 100644 index 00000000000..162d33a5fd3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz new file mode 100644 index 00000000000..cdc28517544 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/witness.gz new file mode 100644 index 00000000000..5fe202b72f0 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz new file mode 100644 index 00000000000..d1819212993 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz new file mode 100644 index 00000000000..f4a9c9f6dda Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz new file mode 100644 index 00000000000..73c742a2dd1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/witness.gz new file mode 100644 index 00000000000..1529254d597 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz new file mode 100644 index 00000000000..4e17ecc5d7b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/witness.gz new file mode 100644 index 00000000000..9a911d62512 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz new file mode 100644 index 00000000000..1a64fd03980 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz new file mode 100644 index 00000000000..95b5064a5a7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz new file mode 100644 index 00000000000..04baae8d290 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/witness.gz new file mode 100644 index 00000000000..6e9e8ecd1d0 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz new file mode 100644 index 00000000000..f69df4781ec Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/witness.gz new file mode 100644 index 00000000000..87cf83430f7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz new file mode 100644 index 00000000000..100a208bcd8 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/witness.gz new file mode 100644 index 00000000000..3530c6f59c1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz new file mode 100644 index 00000000000..9702ca340a5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz new file mode 100644 index 00000000000..3fbf07be37e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz new file mode 100644 index 00000000000..db158f61882 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/witness.gz new file mode 100644 index 00000000000..3fead7f6b2e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz new file mode 100644 index 00000000000..27f6f353d25 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/witness.gz new file mode 100644 index 00000000000..b26110156a0 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz new file mode 100644 index 00000000000..c0c91d81546 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/witness.gz new file mode 100644 index 00000000000..46e192995f3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz new file mode 100644 index 00000000000..4069ca2cb5e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/witness.gz new file mode 100644 index 00000000000..bf62ea672eb Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz new file mode 100644 index 00000000000..9f5f787c655 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/witness.gz new file mode 100644 index 00000000000..3204207ec63 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz new file mode 100644 index 00000000000..625ae64a11d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/witness.gz new file mode 100644 index 00000000000..17d93cc4d19 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz new file mode 100644 index 00000000000..49f7e6afcf4 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/witness.gz new file mode 100644 index 00000000000..118042d5841 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz new file mode 100644 index 00000000000..57ca1d59fed Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/witness.gz new file mode 100644 index 00000000000..3530c6f59c1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz new file mode 100644 index 00000000000..1249975b27c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/witness.gz new file mode 100644 index 00000000000..0d48d549824 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz new file mode 100644 index 00000000000..fe9ac34ed17 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/witness.gz new file mode 100644 index 00000000000..b3813a1f976 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz new file mode 100644 index 00000000000..834f57e1ee7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/witness.gz new file mode 100644 index 00000000000..d12168c557b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz new file mode 100644 index 00000000000..4b2fbcd3462 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/witness.gz new file mode 100644 index 00000000000..38bdf1f7263 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz new file mode 100644 index 00000000000..ac18684a07e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz new file mode 100644 index 00000000000..ceaf7ad008e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz new file mode 100644 index 00000000000..032b36d1629 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/witness.gz new file mode 100644 index 00000000000..fa79236ad55 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz new file mode 100644 index 00000000000..271b0ddd649 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/witness.gz new file mode 100644 index 00000000000..37c6d67fada Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz new file mode 100644 index 00000000000..dff5ebe0a87 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz new file mode 100644 index 00000000000..acc00ece890 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz new file mode 100644 index 00000000000..8b56f25b2cf Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/witness.gz new file mode 100644 index 00000000000..310c2cba8c4 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz new file mode 100644 index 00000000000..bb060b5ebcc Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/witness.gz new file mode 100644 index 00000000000..025b2d9ea44 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz new file mode 100644 index 00000000000..7c336747f92 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz new file mode 100644 index 00000000000..1efbfebfaad Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz new file mode 100644 index 00000000000..75f2bcfdb0b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz new file mode 100644 index 00000000000..b2aa4a0b23f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz new file mode 100644 index 00000000000..c4e7f86f219 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/witness.gz new file mode 100644 index 00000000000..16880cedea2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz new file mode 100644 index 00000000000..ea9187f4084 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/witness.gz new file mode 100644 index 00000000000..3199dac0924 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz new file mode 100644 index 00000000000..e73668fd86c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/witness.gz new file mode 100644 index 00000000000..d2a6bdba5c8 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz new file mode 100644 index 00000000000..b3411dc96a7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/witness.gz new file mode 100644 index 00000000000..d79dfba9359 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz new file mode 100644 index 00000000000..a2faad65143 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/witness.gz new file mode 100644 index 00000000000..251984d6292 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz new file mode 100644 index 00000000000..9108d663e86 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/witness.gz new file mode 100644 index 00000000000..a094ba3246b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz new file mode 100644 index 00000000000..ec6bc2c73a0 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/witness.gz new file mode 100644 index 00000000000..79d009caea4 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz new file mode 100644 index 00000000000..b8577dbd3ac Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz new file mode 100644 index 00000000000..7c125021d96 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz new file mode 100644 index 00000000000..9401237fd8c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz new file mode 100644 index 00000000000..5f3c241de56 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz new file mode 100644 index 00000000000..c9462cfa87f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/witness.gz new file mode 100644 index 00000000000..4d120219b14 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/generics/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz new file mode 100644 index 00000000000..8b6a0d9db65 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/witness.gz new file mode 100644 index 00000000000..41fe927e809 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz new file mode 100644 index 00000000000..9be98aef491 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/witness.gz new file mode 100644 index 00000000000..743d797096b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz new file mode 100644 index 00000000000..eab354be13d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz new file mode 100644 index 00000000000..329d15dfb17 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz new file mode 100644 index 00000000000..21cb3898a2d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/witness.gz new file mode 100644 index 00000000000..4ab0b124e70 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz new file mode 100644 index 00000000000..ff6e6f6c394 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/witness.gz new file mode 100644 index 00000000000..93c5b96bdf3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/import/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz new file mode 100644 index 00000000000..1c4c50039eb Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz new file mode 100644 index 00000000000..b3d60e315ec Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz new file mode 100644 index 00000000000..cb74273e4d7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz new file mode 100644 index 00000000000..42bcc0ccbd1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz new file mode 100644 index 00000000000..d054abe1df0 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/witness.gz new file mode 100644 index 00000000000..80a779d4464 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz new file mode 100644 index 00000000000..75b1cbb5072 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz new file mode 100644 index 00000000000..6351d29dd11 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz new file mode 100644 index 00000000000..c45cd40f28e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/witness.gz new file mode 100644 index 00000000000..4e90289d5e1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz new file mode 100644 index 00000000000..05b5e23ae3e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/witness.gz new file mode 100644 index 00000000000..58c7b52ef85 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modules/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz new file mode 100644 index 00000000000..ff6e6f6c394 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/witness.gz new file mode 100644 index 00000000000..6f12eac202f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz new file mode 100644 index 00000000000..a99124a5e3a Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/witness.gz new file mode 100644 index 00000000000..02931c632ff Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/modulus/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz new file mode 100644 index 00000000000..9f518522755 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz new file mode 100644 index 00000000000..62a1378dece Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz new file mode 100644 index 00000000000..270cfcaf53c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz new file mode 100644 index 00000000000..a3161ac44f9 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz new file mode 100644 index 00000000000..3db0a495a9d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz new file mode 100644 index 00000000000..9c9e80efe8f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz new file mode 100644 index 00000000000..02c9f32e3c5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz new file mode 100644 index 00000000000..caf34e2b734 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz new file mode 100644 index 00000000000..0327f600884 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz new file mode 100644 index 00000000000..b3f3f1a3b24 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz new file mode 100644 index 00000000000..dc260ce2aa7 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz new file mode 100644 index 00000000000..f61ba4ec0cf Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz new file mode 100644 index 00000000000..032b36d1629 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/witness.gz new file mode 100644 index 00000000000..f1ea0249fe9 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz new file mode 100644 index 00000000000..0668e2eca25 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/witness.gz new file mode 100644 index 00000000000..bf62ea672eb Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/references/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz new file mode 100644 index 00000000000..66b4abc42dc Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz new file mode 100644 index 00000000000..ea06e69e18e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz new file mode 100644 index 00000000000..6f4ffaa488f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz new file mode 100644 index 00000000000..c0b900e8119 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz new file mode 100644 index 00000000000..5c0339446c5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz new file mode 100644 index 00000000000..095aef252ee Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz new file mode 100644 index 00000000000..f29fbef8d3f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/witness.gz new file mode 100644 index 00000000000..4e90289d5e1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz new file mode 100644 index 00000000000..0bf8db7df70 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz new file mode 100644 index 00000000000..637e61f60de Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz new file mode 100644 index 00000000000..047e59422ee Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz new file mode 100644 index 00000000000..91bf1aeb7ad Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz new file mode 100644 index 00000000000..a2de8064bb5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz new file mode 100644 index 00000000000..d5762dfc7d5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz new file mode 100644 index 00000000000..7f6715a12af Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz new file mode 100644 index 00000000000..c7be868682e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz new file mode 100644 index 00000000000..82747c17417 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz new file mode 100644 index 00000000000..6627fd7d53f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz new file mode 100644 index 00000000000..39a17a5a529 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz new file mode 100644 index 00000000000..a35e3011ee6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz new file mode 100644 index 00000000000..59b62b9c99d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/witness.gz new file mode 100644 index 00000000000..321a76492da Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz new file mode 100644 index 00000000000..d7ec1ebc477 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/witness.gz new file mode 100644 index 00000000000..35e05b7622b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz new file mode 100644 index 00000000000..84fc5cc5de2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz new file mode 100644 index 00000000000..2afa317a120 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz new file mode 100644 index 00000000000..452780c4d30 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz new file mode 100644 index 00000000000..5896584fa8a Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz new file mode 100644 index 00000000000..9338b74aabd Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/witness.gz new file mode 100644 index 00000000000..9e7641cea1e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz new file mode 100644 index 00000000000..a47defb9fe6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/witness.gz new file mode 100644 index 00000000000..a8e277ea795 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz new file mode 100644 index 00000000000..5a2c524f26b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/witness.gz new file mode 100644 index 00000000000..35e05b7622b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz new file mode 100644 index 00000000000..d7ec1ebc477 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/witness.gz new file mode 100644 index 00000000000..94ea8c8f2b1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz new file mode 100644 index 00000000000..8c5fd3c0bd4 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz new file mode 100644 index 00000000000..4b051d62ee2 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz new file mode 100644 index 00000000000..1916c475919 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz new file mode 100644 index 00000000000..171330f5142 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz new file mode 100644 index 00000000000..6bbdaef4a9b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz new file mode 100644 index 00000000000..6f15adc6525 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz new file mode 100644 index 00000000000..7b605a2b87b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz new file mode 100644 index 00000000000..148355f9335 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/acir.gz new file mode 100644 index 00000000000..6b1f189a331 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/witness.gz new file mode 100644 index 00000000000..f404e58ade3 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slice_struct_field/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz new file mode 100644 index 00000000000..7a053fcb196 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz new file mode 100644 index 00000000000..359b2f75601 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz new file mode 100644 index 00000000000..424f4bd2d0f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/witness.gz new file mode 100644 index 00000000000..72a93aabbfe Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/strings/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz new file mode 100644 index 00000000000..e9de8adcb38 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/witness.gz new file mode 100644 index 00000000000..a8e277ea795 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz new file mode 100644 index 00000000000..f66ed17a0cf Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/witness.gz new file mode 100644 index 00000000000..82307dcb96e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz new file mode 100644 index 00000000000..8ddb62e8799 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/witness.gz new file mode 100644 index 00000000000..e2eb3145306 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz new file mode 100644 index 00000000000..b658b4111f6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/witness.gz new file mode 100644 index 00000000000..b52a8644265 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz new file mode 100644 index 00000000000..697832be207 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/witness.gz new file mode 100644 index 00000000000..10cffba7141 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/submodules/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz new file mode 100644 index 00000000000..df6294bc970 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz new file mode 100644 index 00000000000..b2ac9601bae Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz new file mode 100644 index 00000000000..2371186e8fc Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz new file mode 100644 index 00000000000..610802628c6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz new file mode 100644 index 00000000000..4deef489b9c Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz new file mode 100644 index 00000000000..71d29209eba Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz new file mode 100644 index 00000000000..02d2bd105f1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz new file mode 100644 index 00000000000..610802628c6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/acir.gz new file mode 100644 index 00000000000..1d34f5becaa Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/witness.gz new file mode 100644 index 00000000000..c3b8e758662 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_as_return_type/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz new file mode 100644 index 00000000000..531a1baf42e Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/witness.gz new file mode 100644 index 00000000000..c3b8e758662 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz new file mode 100644 index 00000000000..6eb630ce2ff Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/witness.gz new file mode 100644 index 00000000000..60fc9526465 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz new file mode 100644 index 00000000000..6eb630ce2ff Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/witness.gz new file mode 100644 index 00000000000..60fc9526465 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz new file mode 100644 index 00000000000..79ae7dccb3d Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz new file mode 100644 index 00000000000..0eb0d6f09f6 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz new file mode 100644 index 00000000000..a053f565e5b Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz new file mode 100644 index 00000000000..10cffba7141 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz new file mode 100644 index 00000000000..7855747826f Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/witness.gz new file mode 100644 index 00000000000..8137a9d31c5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz new file mode 100644 index 00000000000..eda28c748c5 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz differ diff --git a/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/witness.gz b/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/witness.gz new file mode 100644 index 00000000000..444c8e01cd1 Binary files /dev/null and b/noir/tooling/nargo_cli/tests/acir_artifacts/xor/target/witness.gz differ diff --git a/noir/tooling/nargo_cli/tests/codegen-verifier.rs b/noir/tooling/nargo_cli/tests/codegen-verifier.rs new file mode 100644 index 00000000000..f991f72b108 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/codegen-verifier.rs @@ -0,0 +1,37 @@ +//! This integration test aims to check that the `nargo codegen-verifier` will successfully create a +//! file containing a verifier for a simple program. + +use assert_cmd::prelude::*; +use predicates::prelude::*; +use std::process::Command; + +use assert_fs::prelude::{PathAssert, PathChild}; + +#[test] +fn simple_verifier_codegen() { + let test_dir = assert_fs::TempDir::new().unwrap(); + std::env::set_current_dir(&test_dir).unwrap(); + + // Create trivial program + let project_name = "hello_world"; + let project_dir = test_dir.child(project_name); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("new").arg(project_name); + cmd.assert().success(); + + std::env::set_current_dir(&project_dir).unwrap(); + + // Run `nargo codegen-verifier` + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("codegen-verifier"); + cmd.assert() + .success() + .stdout(predicate::str::contains("Contract successfully created and located at")); + + project_dir + .child("contract") + .child("hello_world") + .child("plonk_vk.sol") + .assert(predicate::path::is_file()); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml new file mode 100644 index 00000000000..2eaf67246e1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "assert_constant_fail" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/src/main.nr new file mode 100644 index 00000000000..cf682607083 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/assert_constant_fail/src/main.nr @@ -0,0 +1,10 @@ +use dep::std::assert_constant; + +fn main(x: Field) { + foo(5, x); +} + +fn foo(constant: Field, non_constant: Field) { + assert_constant(constant); + assert_constant(non_constant); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml new file mode 100644 index 00000000000..9fcdcc10bb7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "assert_eq_struct" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/src/main.nr new file mode 100644 index 00000000000..54b937e5f1d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/assert_eq_struct/src/main.nr @@ -0,0 +1,5 @@ +struct myStruct {} +// `assert_eq` should not allow asserting equality between types for which `==` is not defined. +fn main(x: myStruct, y: pub myStruct) { + assert_eq(x, y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml new file mode 100644 index 00000000000..7ce776e5ce6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_assert_fail" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Prover.toml new file mode 100644 index 00000000000..11497a473bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/Prover.toml @@ -0,0 +1 @@ +x = "0" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/src/main.nr new file mode 100644 index 00000000000..da9d4ec1ac8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/brillig_assert_fail/src/main.nr @@ -0,0 +1,11 @@ +// Tests a very simple program. +// +// The features being tested is using assert on brillig +fn main(x: Field) { + assert(1 == conditional(x as bool)); +} + +unconstrained fn conditional(x: bool) -> Field { + assert(x); + 1 +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml new file mode 100644 index 00000000000..191121e59b7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "constrain_typo" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/src/main.nr new file mode 100644 index 00000000000..ee99663da46 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/constrain_typo/src/main.nr @@ -0,0 +1,7 @@ + +// This should not compile as the keyword +// is `constrain` and not `constrai` + +fn main(x : Field, y : Field) { + constrai x != y; +} \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml new file mode 100644 index 00000000000..a32696d3370 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "custom_entry" +type = "bin" +# Testing that this file is missing and doesn't fallback to default `main.nr` file +entry = "src/foobarbaz.nr" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/src/main.nr new file mode 100644 index 00000000000..00e94414c0b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/custom_entry_not_found/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field) { + assert(x == 1); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml new file mode 100644 index 00000000000..afe5a5134ca --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dep_impl_primitive" +type = "bin" +authors = [""] +[dependencies] +bad_impl = { path = "../../test_libraries/bad_impl" } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Prover.toml new file mode 100644 index 00000000000..7d4290a117a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/Prover.toml @@ -0,0 +1 @@ +x = 1 diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/src/main.nr new file mode 100644 index 00000000000..e61ae82b62c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dep_impl_primitive/src/main.nr @@ -0,0 +1,5 @@ +use dep::bad_impl; + +fn main(x: Field) { + x.something(); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml new file mode 100644 index 00000000000..8334a38eb4b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "depend_on_bin" +type = "bin" +authors = [""] +[dependencies] +bin_dep = { path = "../../test_libraries/bin_dep" } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Prover.toml new file mode 100644 index 00000000000..7d4290a117a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/Prover.toml @@ -0,0 +1 @@ +x = 1 diff --git a/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/src/main.nr new file mode 100644 index 00000000000..4e03e8eb41e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/depend_on_bin/src/main.nr @@ -0,0 +1,5 @@ +use dep::bin_dep; + +fn main(x : Field) { + assert(x == 1); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml new file mode 100644 index 00000000000..aad13c7d97f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "divide_by_zero" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/src/main.nr new file mode 100644 index 00000000000..58adc5444b1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_constants/src/main.nr @@ -0,0 +1,6 @@ +use dep::std; + +fn main() { + let a: Field = 3 / 0; + std::println(a); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml new file mode 100644 index 00000000000..22ff18075cd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "div_by_zero_modulo" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/src/main.nr new file mode 100644 index 00000000000..d938ab7fca8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_modulo/src/main.nr @@ -0,0 +1,7 @@ +fn main() { + let a: u32 = 6; + let b = 3; + let c = 0; + let res = (a * b) % c; + assert(res != 5); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml new file mode 100644 index 00000000000..30a7eb62645 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "div_by_zero_numerator_witness" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/src/main.nr new file mode 100644 index 00000000000..f51b26d5ba1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_numerator_witness/src/main.nr @@ -0,0 +1,6 @@ +use dep::std; + +fn main(x: Field) { + let a: Field = x / 0; + std::println(a); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml new file mode 100644 index 00000000000..e4968f6182d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "div_by_zero_witness" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Prover.toml new file mode 100644 index 00000000000..a1f166bf325 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/Prover.toml @@ -0,0 +1,2 @@ +x = "3" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/src/main.nr new file mode 100644 index 00000000000..a814f88f320 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/div_by_zero_witness/src/main.nr @@ -0,0 +1,6 @@ +use dep::std; +// It is expected that `y` must be equal to 0. +fn main(x: Field, y: pub Field) { + let a: Field = x / y; + std::println(a); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml new file mode 100644 index 00000000000..18352cb34b5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dup_trait_implementation_4" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/main.nr new file mode 100644 index 00000000000..e03fe8b3eeb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/main.nr @@ -0,0 +1,5 @@ +mod module1; +mod module2; +mod module3; + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module1.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module1.nr new file mode 100644 index 00000000000..4d41ff2909a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module1.nr @@ -0,0 +1,2 @@ +trait MyTrait { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module2.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module2.nr new file mode 100644 index 00000000000..3cadb6d78cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module2.nr @@ -0,0 +1,2 @@ +struct MyStruct { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module3.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module3.nr new file mode 100644 index 00000000000..17874893190 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_4/src/module3.nr @@ -0,0 +1,6 @@ +use crate::module1::MyTrait; +use crate::module2::MyStruct; +// those are not the same 'Path', but they refer to the same trait & impl +// so a Duplicate error should be thrown +impl MyTrait for MyStruct {} +impl crate::module1::MyTrait for crate::module2::MyStruct { } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml new file mode 100644 index 00000000000..40b7c3d0269 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dup_trait_implementation_5" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/main.nr new file mode 100644 index 00000000000..b5719009898 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/main.nr @@ -0,0 +1,6 @@ +mod module1; +mod module2; +mod module3; +mod module4; + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module1.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module1.nr new file mode 100644 index 00000000000..4d41ff2909a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module1.nr @@ -0,0 +1,2 @@ +trait MyTrait { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module2.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module2.nr new file mode 100644 index 00000000000..3cadb6d78cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module2.nr @@ -0,0 +1,2 @@ +struct MyStruct { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module3.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module3.nr new file mode 100644 index 00000000000..ac886d441cd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module3.nr @@ -0,0 +1,4 @@ +use crate::module1::MyTrait; +use crate::module2::MyStruct; + +impl MyTrait for MyStruct {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module4.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module4.nr new file mode 100644 index 00000000000..dfa660f80b1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_implementation_5/src/module4.nr @@ -0,0 +1,3 @@ +// another module in the crate implements the same trait + struct +// a Duplicate error should be thrown +impl crate::module1::MyTrait for crate::module2::MyStruct { } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml new file mode 100644 index 00000000000..078a336c282 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_1" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/src/main.nr new file mode 100644 index 00000000000..863139333f7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/src/main.nr @@ -0,0 +1,6 @@ +trait MyTrait { + fn SomeFunc(); + fn SomeFunc(); +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml new file mode 100644 index 00000000000..41e1a3b3fd9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_2" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/src/main.nr new file mode 100644 index 00000000000..cdcac745208 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/src/main.nr @@ -0,0 +1,6 @@ +trait MyTrait { + let SomeConst: u32; + let SomeConst: Field; +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml new file mode 100644 index 00000000000..1388f3c83ee --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_3" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/src/main.nr new file mode 100644 index 00000000000..f6ed35468b9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/src/main.nr @@ -0,0 +1,6 @@ +trait MyTrait { + type SomeType; + type SomeType; +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml new file mode 100644 index 00000000000..43e8096548b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_4" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/src/main.nr new file mode 100644 index 00000000000..fc0a7011a5d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/src/main.nr @@ -0,0 +1,6 @@ +trait MyTrait { + let MyItem: u32; + fn MyItem(); +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml new file mode 100644 index 00000000000..0af8ef88cea --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_5" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/src/main.nr new file mode 100644 index 00000000000..da42d27ac36 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/src/main.nr @@ -0,0 +1,6 @@ +trait MyTrait { + fn MyItem(); + let MyItem: u32; +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml new file mode 100644 index 00000000000..dd5f13438ec --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "dup_trait_items_6" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/src/main.nr new file mode 100644 index 00000000000..a1a731d943b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/src/main.nr @@ -0,0 +1,15 @@ +trait MyTrait { + fn SomeFunc() { }; + fn SomeFunc() { }; +} + +struct MyStruct { +} + +impl MyTrait for MyStruct { + fn SomeFunc() { + } +} + +fn main() { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml new file mode 100644 index 00000000000..a4c82c70642 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "duplicate_declaration" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/src/main.nr new file mode 100644 index 00000000000..e4433ef4078 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/duplicate_declaration/src/main.nr @@ -0,0 +1,8 @@ +// Duplicate functions should not compile +fn hello(x: Field) -> Field { + x +} + +fn hello(x: Field) -> Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml new file mode 100644 index 00000000000..7f1c2c097a4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dyn_index_fail_nested_array" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Prover.toml new file mode 100644 index 00000000000..00ffa6e4620 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/Prover.toml @@ -0,0 +1,13 @@ +y = "2" + +[[x]] +a = "1" +b = "2" + +[[x]] +a = "3" +b = "4" + +[[x]] +a = "5" +b = "6" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/src/main.nr new file mode 100644 index 00000000000..954d2e77c6e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dyn_index_fail_nested_array/src/main.nr @@ -0,0 +1,8 @@ +struct Foo { + a: Field, + b: Field, +} + +fn main(mut x: [Foo; 3], y: pub Field) { + assert(x[y + 2].a == 5); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml new file mode 100644 index 00000000000..2c44a5356c3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dynamic_index_failure" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Prover.toml new file mode 100644 index 00000000000..caf3448c56f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/Prover.toml @@ -0,0 +1,2 @@ +x = [104, 101, 108, 108, 111] +z = "4" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/src/main.nr new file mode 100644 index 00000000000..0af5f90eea6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/dynamic_index_failure/src/main.nr @@ -0,0 +1,21 @@ +fn main(mut x: [u32; 5], z: Field) { + let idx = z + 10; + + x[z] = 4; + // Dynamic index is greater than length of the array + assert(x[idx] != 0); + // TODO(#2133): Provide more accurate call stacks for arrays merged in if statements + // if z != 20 { + // x[0] = x[4]; + // } else { + // // TODO: Dynamic predicate still gives index out of bounds error + // if idx as u32 < 3 { + // x[idx] = 10; + // } + // x[idx] = 10; + // for i in 0..5 { + // x[idx] = x[i]; + // } + // } + // assert(x[idx] != 0); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml new file mode 100644 index 00000000000..94934f13e56 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "field_modulo" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/src/main.nr new file mode 100644 index 00000000000..a482b68806b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/field_modulo/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field) -> pub Field { + x % 2 +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml new file mode 100644 index 00000000000..ed607023878 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "integer_literal_overflow" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/src/main.nr new file mode 100644 index 00000000000..d89505c0085 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/integer_literal_overflow/src/main.nr @@ -0,0 +1,5 @@ +fn main() { + foo(1234) +} + +fn foo(_x: u4) {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml new file mode 100644 index 00000000000..99d184acdcf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "invalid_dependency_name" +type = "bin" +authors = [""] +[dependencies] +bad_name = { path = "../../test_libraries/bad_name" } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/src/main.nr new file mode 100644 index 00000000000..faf1ba0045a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/invalid_dependency_name/src/main.nr @@ -0,0 +1 @@ +fn main(x: Field) { } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml new file mode 100644 index 00000000000..d6e4e632f95 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "multiple_contracts" +type = "contract" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/src/main.nr new file mode 100644 index 00000000000..a6c49d75378 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/multiple_contracts/src/main.nr @@ -0,0 +1,3 @@ +contract Foo {} + +contract Bar {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml new file mode 100644 index 00000000000..9aa843d16dc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "multiple_primary_attributes_fail" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/src/main.nr new file mode 100644 index 00000000000..c8d8b0a1969 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/multiple_primary_attributes_fail/src/main.nr @@ -0,0 +1,6 @@ + +#[oracle(oracleName)] +#[builtin(builtinName)] +fn main(x: Field) -> pub Field { + x + 1 +} \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml new file mode 100644 index 00000000000..05db8252f3b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "mutability_regression_2911" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/src/main.nr new file mode 100644 index 00000000000..a0d53706f97 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/src/main.nr @@ -0,0 +1,5 @@ +// Expect 'Variable must be mutable to be assigned to' error +fn main() { + let slice : &mut [Field] = &mut []; + slice = &mut (*slice).push_back(1); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/Nargo.toml new file mode 100644 index 00000000000..0d243d0029d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "no_impl_from_function" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/src/main.nr new file mode 100644 index 00000000000..b0c485c2bf5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/no_impl_from_function/src/main.nr @@ -0,0 +1,26 @@ +fn main() { + let array: [Field; 3] = [1, 2, 3]; + assert(foo(array)); + + // Ensure this still works if we have to infer the type of the integer literals + let array = [1, 2, 3]; + assert(foo(array)); +} + +fn foo(x: T) -> bool where T: Eq { + x.eq(x) +} + +trait Eq { + fn eq(self, other: Self) -> bool; +} + +impl Eq for [T; N] where T: Eq { + fn eq(self, other: Self) -> bool { + let mut ret = true; + for i in 0 .. self.len() { + ret &= self[i].eq(other[i]); + } + ret + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/Nargo.toml new file mode 100644 index 00000000000..5179c0f6a5c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "no_nested_impl" +type = "bin" +authors = [""] +compiler_version = ">=0.18.0" + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/src/main.nr new file mode 100644 index 00000000000..916567a7c04 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/no_nested_impl/src/main.nr @@ -0,0 +1,21 @@ +fn main() { + let a: [[[[Field; 2]; 2]; 2]; 2] = [[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]]; + assert(a.eq(a)); +} + +trait Eq { + fn eq(self, other: Self) -> bool; +} + +impl Eq for [T; 2] where T: Eq { + fn eq(self, other: Self) -> bool { + self[0].eq(other[0]) + & self[0].eq(other[0]) + } +} +// Impl for u32 but not Field +impl Eq for u32 { + fn eq(self, other: Self) -> bool { + self == other + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml new file mode 100644 index 00000000000..89f30bb1ba5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "orphaned_trait_impl" +type = "bin" +authors = [""] +[dependencies] +crate1 = { path = "crate1" } +crate2 = { path = "crate2" } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Prover.toml new file mode 100644 index 00000000000..2c1854573a4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 2 diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml new file mode 100644 index 00000000000..de1eddf2cf0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "crate1" +type = "lib" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/src/lib.nr b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/src/lib.nr new file mode 100644 index 00000000000..4d41ff2909a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate1/src/lib.nr @@ -0,0 +1,2 @@ +trait MyTrait { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml new file mode 100644 index 00000000000..c86c5edf51a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "crate2" +type = "lib" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/src/lib.nr b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/src/lib.nr new file mode 100644 index 00000000000..3cadb6d78cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/crate2/src/lib.nr @@ -0,0 +1,2 @@ +struct MyStruct { +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/src/main.nr new file mode 100644 index 00000000000..dfd88d8f074 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/orphaned_trait_impl/src/main.nr @@ -0,0 +1,6 @@ +impl dep::crate1::MyTrait for dep::crate2::MyStruct { +} + +fn main(x: Field, y: pub Field) { + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml new file mode 100644 index 00000000000..612e3e7aaf6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "overflowing_assignment" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/src/main.nr new file mode 100644 index 00000000000..6b529103ca3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/overflowing_assignment/src/main.nr @@ -0,0 +1,5 @@ +fn main() { + let x:u8 = -1; + let y:u8 = 300; + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml new file mode 100644 index 00000000000..a279bfb053a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "overlapping_generic_impls" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/src/main.nr new file mode 100644 index 00000000000..95e4d53bf93 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/overlapping_generic_impls/src/main.nr @@ -0,0 +1,6 @@ +trait Trait { fn t(self); } + +impl Trait for T { fn t(self){} } +impl Trait for u32 { fn t(self){} } + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml new file mode 100644 index 00000000000..88382674780 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/src/main.nr new file mode 100644 index 00000000000..faf1ba0045a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/package_name_empty/src/main.nr @@ -0,0 +1 @@ +fn main(x: Field) { } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml new file mode 100644 index 00000000000..4882b83b8bf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "hyphenated-name" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/src/main.nr new file mode 100644 index 00000000000..faf1ba0045a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/package_name_hyphen/src/main.nr @@ -0,0 +1 @@ +fn main(x: Field) { } diff --git a/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml new file mode 100644 index 00000000000..7c5e7f70774 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/Nargo.toml @@ -0,0 +1,7 @@ + +[package] +name = "primary_attribute_struct" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/src/main.nr new file mode 100644 index 00000000000..8922ef60091 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/primary_attribute_struct/src/main.nr @@ -0,0 +1,8 @@ +// An primary attribute should not be able to be added to a struct defintion +#[oracle(some_oracle)] +struct SomeStruct{ + x: Field, + y: Field +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml new file mode 100644 index 00000000000..349698cc32d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "radix_non_constant_length" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/src/main.nr new file mode 100644 index 00000000000..c6dd68d925c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/radix_non_constant_length/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: Field, y: pub u32) { + let bytes = x.to_be_bytes(y); + assert(bytes[0] == 0); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml new file mode 100644 index 00000000000..fc159b7efc1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "slice_access_failure" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/src/main.nr new file mode 100644 index 00000000000..6e8b5c7d841 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_access_failure/src/main.nr @@ -0,0 +1,13 @@ +fn main(x: Field, y: pub Field) { + let mut slice = [0; 2]; + if x == y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + // This constraint should fail as the slice length is 3 and the index is 3 + // The right hand side AND case ensures that the circuit inputs have not changed + // and we always hit the else case in the if statement above. + assert((slice[3] == 0) & (slice[2] != y)); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml new file mode 100644 index 00000000000..5134032264c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "slice_insert_failure" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/src/main.nr new file mode 100644 index 00000000000..38892f01e12 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_insert_failure/src/main.nr @@ -0,0 +1,11 @@ +fn main(x: Field, y: pub Field) { + let mut slice = [0; 2]; + if x == y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + slice = slice.insert(10, 100); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml new file mode 100644 index 00000000000..1e13dfe6483 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "slice_remove_failure" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/src/main.nr new file mode 100644 index 00000000000..f9faa25384b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/slice_remove_failure/src/main.nr @@ -0,0 +1,11 @@ +fn main(x: Field, y: pub Field) { + let mut slice = [0; 2]; + if x == y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + let (removed_slice, removed_elem) = slice.remove(10); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/Nargo.toml new file mode 100644 index 00000000000..379e964d70a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "trait_incorrect_generic_count" +type = "bin" +authors = [""] +compiler_version = ">=0.18.0" + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/src/main.nr new file mode 100644 index 00000000000..d65d55894ea --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/trait_incorrect_generic_count/src/main.nr @@ -0,0 +1,12 @@ +fn main() { + let x: u32 = 0; + x.trait_fn(); +} + +trait Trait { + fn trait_fn(x: T) -> T {} +} + +impl Trait for u32 { + fn trait_fn(x: A) -> A { x } +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/Nargo.toml new file mode 100644 index 00000000000..36db098686f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/Nargo.toml @@ -0,0 +1,2 @@ +[workspace] +members = ["crates/a", "crates/b"] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml new file mode 100644 index 00000000000..8d0e1aca4a9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "a" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Prover.toml new file mode 100644 index 00000000000..b76c88bf536 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/Prover.toml @@ -0,0 +1,3 @@ +# Deliberately setting these to fail to prove this is being executed +x = "1" +y = "2" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/src/main.nr new file mode 100644 index 00000000000..cf72627da2e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/a/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field, y: pub Field) { + assert(x == y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml new file mode 100644 index 00000000000..f316511340f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "b" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/src/main.nr new file mode 100644 index 00000000000..4e1fd3c9035 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_fail/crates/b/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field, y: pub Field) { + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/Nargo.toml new file mode 100644 index 00000000000..36db098686f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/Nargo.toml @@ -0,0 +1,2 @@ +[workspace] +members = ["crates/a", "crates/b"] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/Prover.toml new file mode 100644 index 00000000000..465ef562de4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/src/main.nr new file mode 100644 index 00000000000..550e5034a7b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/a/src/main.nr @@ -0,0 +1,3 @@ +fn main(x : Field, y : pub Field) { + assert(x == y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml new file mode 100644 index 00000000000..f316511340f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "b" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Prover.toml b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/src/main.nr b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/src/main.nr new file mode 100644 index 00000000000..6e170de75fc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_failure/workspace_missing_toml/crates/b/src/main.nr @@ -0,0 +1,3 @@ +fn main(x : Field, y : pub Field) { + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml new file mode 100644 index 00000000000..ed5e9ec0910 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "simple_contract" +type = "contract" +authors = [""] + +[dependencies] + diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/src/main.nr new file mode 100644 index 00000000000..ddcb5d54d78 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/contract_with_impl/src/main.nr @@ -0,0 +1,7 @@ +contract Foo { + struct T { x: [Field] } + + impl T { + fn t(self){} + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml new file mode 100644 index 00000000000..fb1969acc43 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "no_entry_points" +type = "contract" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/src/main.nr new file mode 100644 index 00000000000..b768653262a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/non_entry_point_method/src/main.nr @@ -0,0 +1,6 @@ +contract Foo { + struct PlaceholderStruct{x : u32 } + + #[contract_library_method] + fn has_mut(_context: &mut PlaceholderStruct) {} +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml new file mode 100644 index 00000000000..ed5e9ec0910 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "simple_contract" +type = "contract" +authors = [""] + +[dependencies] + diff --git a/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/src/main.nr new file mode 100644 index 00000000000..88edd4ac2c3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_contract/simple_contract/src/main.nr @@ -0,0 +1,14 @@ +contract Foo { + fn double(x: Field) -> pub Field { + x * 2 + } + fn triple(x: Field) -> pub Field { + x * 3 + } + internal fn quadruple(x: Field) -> pub Field { + x * 4 + } + open internal fn skibbidy(x: Field) -> pub Field { + x * 5 + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml new file mode 100644 index 00000000000..78b0e5b7b18 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "attributes_multiple" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/src/main.nr new file mode 100644 index 00000000000..581fb989b4c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_multiple/src/main.nr @@ -0,0 +1,7 @@ +fn main() { + another_func() +} + +#[aztec(private)] +#[internal] +fn another_func() {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml new file mode 100644 index 00000000000..e05ccb8d925 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "attributes_struct" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/src/main.nr new file mode 100644 index 00000000000..0bad42aee57 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/attributes_struct/src/main.nr @@ -0,0 +1,8 @@ +#[some_attribute] +#[another_attribute] +struct SomeStruct { + a: Field, + b: Field +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml new file mode 100644 index 00000000000..ed2a51c0fb0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "auto_deref" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/src/main.nr new file mode 100644 index 00000000000..d69aff7e0d4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/auto_deref/src/main.nr @@ -0,0 +1,7 @@ +fn main() { + let a = &mut &mut &mut [1, 2, 3]; + assert(a[0] == 1); + + a[0] = 4; + assert(a[0] == 4); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml new file mode 100644 index 00000000000..cb5a7f3f2bd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_cast" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/src/main.nr new file mode 100644 index 00000000000..3ba29b52982 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_cast/src/main.nr @@ -0,0 +1,49 @@ +// Tests a very simple Brillig function. +// +// The features being tested are cast operations on brillig +fn main() { + bool_casts(); + field_casts(); + uint_casts(); + int_casts(); + mixed_casts(); +} + +unconstrained fn bool_casts() { + assert(false == 0 as bool); + assert(true == 1 as bool); + assert(true == 3 as bool); +} + +unconstrained fn field_casts() { + assert(5 as u8 as Field == 5); + assert(16 as u4 as Field == 0); +} + +unconstrained fn uint_casts() { + let x: u32 = 100; + assert(x as u2 == 0); + assert(x as u4 == 4); + assert(x as u6 == 36); + assert(x as u8 == 100); + assert(x as u64 == 100); + assert(x as u126 == 100); +} + +unconstrained fn int_casts() { + let x: i32 = 100; + assert(x as i2 == 0); + assert(x as i4 == 4); + assert(x as i6 == -28 as i6); + assert(x as i8 == 100); + assert(x as i8 == 100); + assert(x as i8 == 100); +} + +unconstrained fn mixed_casts() { + assert(100 as u32 as i32 as u32 == 100); + assert(13 as u4 as i2 as u32 == 1); + assert(15 as u4 as i2 as u32 == 3); + assert(1 as u8 as bool == true); + assert(true as i8 == 1); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml new file mode 100644 index 00000000000..fb17e881f4c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_field_binary_operations" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/src/main.nr new file mode 100644 index 00000000000..54f06858846 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_field_binary_operations/src/main.nr @@ -0,0 +1,25 @@ +// Tests arithmetic operations on fields +fn main() { + let x = 4; + let y = 2; + assert((x + y) == add(x, y)); + assert((x - y) == sub(x, y)); + assert((x * y) == mul(x, y)); + assert((x / y) == div(x, y)); +} + +unconstrained fn add(x: Field, y: Field) -> Field { + x + y +} + +unconstrained fn sub(x: Field, y: Field) -> Field { + x - y +} + +unconstrained fn mul(x: Field, y: Field) -> Field { + x * y +} + +unconstrained fn div(x: Field, y: Field) -> Field { + x / y +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml new file mode 100644 index 00000000000..cd550ce0252 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_integer_binary_operations" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/src/main.nr new file mode 100644 index 00000000000..a873bcd5dbd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_integer_binary_operations/src/main.nr @@ -0,0 +1,77 @@ +// Tests arithmetic operations on integers +fn main() { + let x: u32 = 6; + let y: u32 = 2; + + assert((x + y) == add(x, y)); + + assert((x - y) == sub(x, y)); + + assert((x * y) == mul(x, y)); + + assert((x / y) == div(x, y)); + // TODO SSA => ACIR has some issues with i32 ops + assert(check_signed_div(6, 2, 3)); + + assert(eq(1, 2) == false); + assert(eq(1, 1)); + + assert(lt(x, y) == false); + assert(lt(y, x)); + + assert((x & y) == and(x, y)); + assert((x | y) == or(x, y)); + // TODO SSA => ACIR has some issues with xor ops + assert(check_xor(x, y, 4)); + assert((x >> y) == shr(x, y)); + assert((x << y) == shl(x, y)); +} + +unconstrained fn add(x: u32, y: u32) -> u32 { + x + y +} + +unconstrained fn sub(x: u32, y: u32) -> u32 { + x - y +} + +unconstrained fn mul(x: u32, y: u32) -> u32 { + x * y +} + +unconstrained fn div(x: u32, y: u32) -> u32 { + x / y +} + +unconstrained fn check_signed_div(x: i32, y: i32, result: i32) -> bool { + (x / y) == result +} + +unconstrained fn eq(x: u32, y: u32) -> bool { + x == y +} + +unconstrained fn lt(x: u32, y: u32) -> bool { + x < y +} + +unconstrained fn and(x: u32, y: u32) -> u32 { + x & y +} + +unconstrained fn or(x: u32, y: u32) -> u32 { + x | y +} + +unconstrained fn check_xor(x: u32, y: u32, result: u32) -> bool { + (x ^ y) == result +} + +unconstrained fn shr(x: u32, y: u32) -> u32 { + x >> y +} + +unconstrained fn shl(x: u32, y: u32) -> u32 { + x << y +} + diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml new file mode 100644 index 00000000000..7bac4a06607 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_modulo" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/src/main.nr new file mode 100644 index 00000000000..ed0353b101a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_modulo/src/main.nr @@ -0,0 +1,27 @@ +// Tests a very simple program. +// +// The features being tested is modulo operations on brillig +fn main() { + assert(modulo(47, 3) == 2); + assert(modulo(2, 3) == 2); + assert(signed_modulo(5, 3) == 2); + assert(signed_modulo(2, 3) == 2); + + let minus_two: i4 = -2; // 14 + let minus_three: i4 = -3; // 13 + let minus_five: i4 = -5; // 11 + // (5 / -3) * -3 + 2 = -1 * -3 + 2 = 3 + 2 = 5 + assert(signed_modulo(5, minus_three) == 2); + // (-5 / 3) * 3 - 2 = -1 * 3 - 2 = -3 - 2 = -5 + assert(signed_modulo(minus_five, 3) == minus_two); + // (-5 / -3) * -3 - 2 = 1 * -3 - 2 = -3 - 2 = -5 + assert(signed_modulo(minus_five, minus_three) == minus_two); +} + +unconstrained fn modulo(x: u32, y: u32) -> u32 { + x % y +} + +unconstrained fn signed_modulo(x: i4, y: i4) -> i4 { + x % y +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml new file mode 100644 index 00000000000..a18b769550d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "brillig_to_bits" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/src/main.nr new file mode 100644 index 00000000000..7ff3d2467b5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/brillig_to_bits/src/main.nr @@ -0,0 +1,23 @@ +use dep::std; + +unconstrained fn main() { + let field = 1000; + let be_bits = field.to_be_bits(16); + let le_bits = field.to_le_bits(16); + + for i in 0..16 { + let x = be_bits[i]; + let y = le_bits[15 - i]; + assert(x == y); + } + + let x = 3; + let be_bits_x = x.to_be_bits(4); + let le_bits_x = x.to_le_bits(4); + + for i in 0..4 { + let be_bit = be_bits_x[i]; + let le_bit = le_bits_x[3 - i]; + assert(be_bit == le_bit); + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml new file mode 100644 index 00000000000..86ddff27910 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "closure_explicit_types" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/src/main.nr new file mode 100644 index 00000000000..eec2b90b5b2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/closure_explicit_types/src/main.nr @@ -0,0 +1,71 @@ +fn ret_normal_lambda1() -> fn() -> Field { + || 10 +} +// return lamda that captures a thing +fn ret_closure1() -> fn[(Field,)]() -> Field { + let x = 20; + || x + 10 +} +// return lamda that captures two things +fn ret_closure2() -> fn[(Field,Field)]() -> Field { + let x = 20; + let y = 10; + || x + y + 10 +} +// return lamda that captures two things with different types +fn ret_closure3() -> fn[(u32,u64)]() -> u64 { + let x: u32 = 20; + let y: u64 = 10; + || x as u64 + y + 10 +} +// accepts closure that has 1 thing in its env, calls it and returns the result +fn accepts_closure1(f: fn[(Field,)]() -> Field) -> Field { + f() +} +// accepts closure that has 1 thing in its env and returns it +fn accepts_closure2(f: fn[(Field,)]() -> Field) -> fn[(Field,)]() -> Field { + f +} +// accepts closure with different types in the capture group +fn accepts_closure3(f: fn[(u32, u64)]() -> u64) -> u64 { + f() +} +// generic over closure environments +fn add_results(f1: fn[Env1]() -> Field, f2: fn[Env2]() -> Field) -> Field { + f1() + f2() +} +// a *really* generic function +fn map(arr: [T; N], f: fn[Env](T) -> U) -> [U; N] { + let first_elem = f(arr[0]); + let mut ret = [first_elem; N]; + + for i in 1..N { + ret[i] = f(arr[i]); + } + + ret +} + +fn main() { + assert(ret_normal_lambda1()() == 10); + assert(ret_closure1()() == 30); + assert(ret_closure2()() == 40); + assert(ret_closure3()() == 40); + + let x = 50; + assert(accepts_closure1(|| x) == 50); + assert(accepts_closure2(|| x + 10)() == 60); + + let y: u32 = 30; + let z: u64 = 40; + assert(accepts_closure3(|| y as u64 + z) == 70); + + let w = 50; + assert(add_results(|| 100, || x) == 150); + assert(add_results(|| x + 100, || w + x) == 250); + + let arr = [1, 2, 3, 4]; + + assert(map(arr, |n| n + 1) == [2, 3, 4, 5]); + assert(map(arr, |n| n + x) == [51, 52, 53, 54]); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml new file mode 100644 index 00000000000..74710a6ac2a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "comptime_recursion_regression" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Prover.toml new file mode 100644 index 00000000000..745ce7c2361 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/Prover.toml @@ -0,0 +1,2 @@ +x = 5 +y = 6 diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/src/main.nr new file mode 100644 index 00000000000..0461fd9c4cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_recursion_regression/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: Field, y: Field) { + let flag = (x == 1) | (y == 2); + assert(flag | false == flag); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml new file mode 100644 index 00000000000..7d215a22496 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "comptime_sort" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/src/main.nr new file mode 100644 index 00000000000..a24a6ebaba6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/comptime_sort/src/main.nr @@ -0,0 +1,7 @@ +fn main() { + let unsorted: [u8; 3] = [3, 1, 2]; + let sorted = unsorted.sort(); + assert(sorted[0] == 1); + assert(sorted[1] == 2); + assert(sorted[2] == 3); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml new file mode 100644 index 00000000000..1a62c5af20c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_547" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Prover.toml new file mode 100644 index 00000000000..3d2b4b14efe --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/Prover.toml @@ -0,0 +1 @@ +x = 1 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/src/main.nr new file mode 100644 index 00000000000..e47d23516a5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_547/src/main.nr @@ -0,0 +1,16 @@ +fn main(x: Field) -> pub Field { + // Regression test for issue #547 + // Warning: it must be kept at the start of main + let arr: [u8; 2] = [1, 2]; + if arr[0] != arr[1] { + for i in 0..1 { + assert(i != 2); + } + } + // Regression for predicate simplification + x + safe_inverse(0) +} + +fn safe_inverse(n: Field) -> Field { + if n == 0 { 0 } else { 1 / n } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml new file mode 100644 index 00000000000..b440cb26e46 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_579" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/src/main.nr new file mode 100644 index 00000000000..a479a7a6fbf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_579/src/main.nr @@ -0,0 +1,28 @@ +fn main() { + //Regression for Issue #579 + let result1_true = test(true); + assert(result1_true.array_param[0] == 1); + let result1_false = test(false); + assert(result1_false.array_param[0] == 0); +} + +struct MyStruct579 { + array_param: [u32; 2] +} + +impl MyStruct579 { + fn new(array_param: [u32; 2]) -> MyStruct579 { + MyStruct579 { + array_param: array_param + } + } +} + +fn test(flag: bool) -> MyStruct579 { + let mut my_struct = MyStruct579::new([0; 2]); + + if flag == true { + my_struct= MyStruct579::new([1; 2]); + } + my_struct +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml new file mode 100644 index 00000000000..f2b13c4d547 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_to_bits" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/src/main.nr new file mode 100644 index 00000000000..5446cfbb1e4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/conditional_regression_to_bits/src/main.nr @@ -0,0 +1,28 @@ +use dep::std; + +fn main() { + //Regression for to_le_bits() constant evaluation + // binary array representation of u8 1 + let arr: [u8; 2] = [1, 2]; + let as_bits_hardcode_1 = [1, 0]; + let mut c1 = 0; + for i in 0..2 { + let mut as_bits = (arr[i] as Field).to_le_bits(2); + c1 = c1 + as_bits[0] as Field; + + if i == 0 { + assert(arr[i] == 1); // 1 + for k in 0..2 { + assert(as_bits_hardcode_1[k] == as_bits[k]); + } + } + if i == 1 { + assert(arr[i] == 2); //2 + for k in 0..2 { + assert(as_bits_hardcode_1[k] != as_bits[k]); + } + } + } + assert(c1 == 1); +} + diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml new file mode 100644 index 00000000000..fdb0df17112 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "ec_baby_jubjub" +description = "Baby Jubjub sanity checks" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/src/main.nr new file mode 100644 index 00000000000..e7f32999454 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/ec_baby_jubjub/src/main.nr @@ -0,0 +1,174 @@ +// Tests may be checked against https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/tree/main/poc +use dep::std::ec::tecurve::affine::Curve as AffineCurve; +use dep::std::ec::tecurve::affine::Point as Gaffine; +use dep::std::ec::tecurve::curvegroup::Curve; +use dep::std::ec::tecurve::curvegroup::Point as G; + +use dep::std::ec::swcurve::affine::Point as SWGaffine; +use dep::std::ec::swcurve::curvegroup::Point as SWG; + +use dep::std::ec::montcurve::affine::Point as MGaffine; +use dep::std::ec::montcurve::curvegroup::Point as MG; + +fn main() { + // This test only makes sense if Field is the right prime field. + if 21888242871839275222246405745257275088548364400416034343698204186575808495617 == 0 { + // Define Baby Jubjub (ERC-2494) parameters in affine representation + let bjj_affine = AffineCurve::new(168700, + 168696, + Gaffine::new(995203441582195749578291179787384436505546430278305826713579947235728471134, + 5472060717959818805561601436314318772137091100104008585924551046643952123905)); + // Test addition + let p1_affine = Gaffine::new(17777552123799933955779906779655732241715742912184938656739573121738514868268, + 2626589144620713026669568689430873010625803728049924121243784502389097019475); + let p2_affine = Gaffine::new(16540640123574156134436876038791482806971768689494387082833631921987005038935, + 20819045374670962167435360035096875258406992893633759881276124905556507972311); + + let p3_affine = bjj_affine.add(p1_affine, p2_affine); + assert(p3_affine.eq(Gaffine::new(7916061937171219682591368294088513039687205273691143098332585753343424131937, + 14035240266687799601661095864649209771790948434046947201833777492504781204499))); + // Test scalar multiplication + let p4_affine = bjj_affine.mul(2, p1_affine); + assert(p4_affine.eq(Gaffine::new(6890855772600357754907169075114257697580319025794532037257385534741338397365, + 4338620300185947561074059802482547481416142213883829469920100239455078257889))); + assert(p4_affine.eq(bjj_affine.bit_mul([0, 1], p1_affine))); + // Test subtraction + let p5_affine = bjj_affine.subtract(p3_affine, p3_affine); + assert(p5_affine.eq(Gaffine::zero())); + // Check that these points are on the curve + assert(bjj_affine.contains(bjj_affine.gen) + & bjj_affine.contains(p1_affine) + & bjj_affine.contains(p2_affine) + & bjj_affine.contains(p3_affine) + & bjj_affine.contains(p4_affine) + & bjj_affine.contains(p5_affine)); + // Test CurveGroup equivalents + let bjj = bjj_affine.into_group(); // Baby Jubjub + let p1 = p1_affine.into_group(); + let p2 = p2_affine.into_group(); + let p3 = p3_affine.into_group(); + let p4 = p4_affine.into_group(); + let p5 = p5_affine.into_group(); + // Test addition + assert(p3.eq(bjj.add(p1, p2))); + // Test scalar multiplication + assert(p4.eq(bjj.mul(2, p1))); + assert(p4.eq(bjj.bit_mul([0, 1], p1))); + // Test subtraction + assert(G::zero().eq(bjj.subtract(p3, p3))); + assert(p5.eq(G::zero())); + // Check that these points are on the curve + assert(bjj.contains(bjj.gen) + & bjj.contains(p1) + & bjj.contains(p2) + & bjj.contains(p3) + & bjj.contains(p4) + & bjj.contains(p5)); + // Test SWCurve equivalents of the above + // First the affine representation + let bjj_swcurve_affine = bjj_affine.into_swcurve(); + + let p1_swcurve_affine = bjj_affine.map_into_swcurve(p1_affine); + let p2_swcurve_affine = bjj_affine.map_into_swcurve(p2_affine); + let p3_swcurve_affine = bjj_affine.map_into_swcurve(p3_affine); + let p4_swcurve_affine = bjj_affine.map_into_swcurve(p4_affine); + let p5_swcurve_affine = bjj_affine.map_into_swcurve(p5_affine); + // Addition + assert(p3_swcurve_affine.eq(bjj_swcurve_affine.add(p1_swcurve_affine, p2_swcurve_affine))); + // Doubling + assert(p4_swcurve_affine.eq(bjj_swcurve_affine.mul(2, p1_swcurve_affine))); + assert(p4_swcurve_affine.eq(bjj_swcurve_affine.bit_mul([0, 1], p1_swcurve_affine))); + // Subtraction + assert(SWGaffine::zero().eq(bjj_swcurve_affine.subtract(p3_swcurve_affine, p3_swcurve_affine))); + assert(p5_swcurve_affine.eq(SWGaffine::zero())); + // Check that these points are on the curve + assert(bjj_swcurve_affine.contains(bjj_swcurve_affine.gen) + & bjj_swcurve_affine.contains(p1_swcurve_affine) + & bjj_swcurve_affine.contains(p2_swcurve_affine) + & bjj_swcurve_affine.contains(p3_swcurve_affine) + & bjj_swcurve_affine.contains(p4_swcurve_affine) + & bjj_swcurve_affine.contains(p5_swcurve_affine)); + // Then the CurveGroup representation + let bjj_swcurve = bjj.into_swcurve(); + + let p1_swcurve = bjj.map_into_swcurve(p1); + let p2_swcurve = bjj.map_into_swcurve(p2); + let p3_swcurve = bjj.map_into_swcurve(p3); + let p4_swcurve = bjj.map_into_swcurve(p4); + let p5_swcurve = bjj.map_into_swcurve(p5); + // Addition + assert(p3_swcurve.eq(bjj_swcurve.add(p1_swcurve, p2_swcurve))); + // Doubling + assert(p4_swcurve.eq(bjj_swcurve.mul(2, p1_swcurve))); + assert(p4_swcurve.eq(bjj_swcurve.bit_mul([0, 1], p1_swcurve))); + // Subtraction + assert(SWG::zero().eq(bjj_swcurve.subtract(p3_swcurve, p3_swcurve))); + assert(p5_swcurve.eq(SWG::zero())); + // Check that these points are on the curve + assert(bjj_swcurve.contains(bjj_swcurve.gen) + & bjj_swcurve.contains(p1_swcurve) + & bjj_swcurve.contains(p2_swcurve) + & bjj_swcurve.contains(p3_swcurve) + & bjj_swcurve.contains(p4_swcurve) + & bjj_swcurve.contains(p5_swcurve)); + // Test MontCurve conversions + // First the affine representation + let bjj_montcurve_affine = bjj_affine.into_montcurve(); + + let p1_montcurve_affine = p1_affine.into_montcurve(); + let p2_montcurve_affine = p2_affine.into_montcurve(); + let p3_montcurve_affine = p3_affine.into_montcurve(); + let p4_montcurve_affine = p4_affine.into_montcurve(); + let p5_montcurve_affine = p5_affine.into_montcurve(); + // Addition + assert(p3_montcurve_affine.eq(bjj_montcurve_affine.add(p1_montcurve_affine, p2_montcurve_affine))); + // Doubling + assert(p4_montcurve_affine.eq(bjj_montcurve_affine.mul(2, p1_montcurve_affine))); + assert(p4_montcurve_affine.eq(bjj_montcurve_affine.bit_mul([0, 1], p1_montcurve_affine))); + // Subtraction + assert(MGaffine::zero().eq(bjj_montcurve_affine.subtract(p3_montcurve_affine, p3_montcurve_affine))); + assert(p5_montcurve_affine.eq(MGaffine::zero())); + // Check that these points are on the curve + assert(bjj_montcurve_affine.contains(bjj_montcurve_affine.gen) + & bjj_montcurve_affine.contains(p1_montcurve_affine) + & bjj_montcurve_affine.contains(p2_montcurve_affine) + & bjj_montcurve_affine.contains(p3_montcurve_affine) + & bjj_montcurve_affine.contains(p4_montcurve_affine) + & bjj_montcurve_affine.contains(p5_montcurve_affine)); + // Then the CurveGroup representation + let bjj_montcurve = bjj.into_montcurve(); + + let p1_montcurve = p1_montcurve_affine.into_group(); + let p2_montcurve = p2_montcurve_affine.into_group(); + let p3_montcurve = p3_montcurve_affine.into_group(); + let p4_montcurve = p4_montcurve_affine.into_group(); + let p5_montcurve = p5_montcurve_affine.into_group(); + // Addition + assert(p3_montcurve.eq(bjj_montcurve.add(p1_montcurve, p2_montcurve))); + // Doubling + assert(p4_montcurve.eq(bjj_montcurve.mul(2, p1_montcurve))); + assert(p4_montcurve.eq(bjj_montcurve.bit_mul([0, 1], p1_montcurve))); + // Subtraction + assert(MG::zero().eq(bjj_montcurve.subtract(p3_montcurve, p3_montcurve))); + assert(p5_montcurve.eq(MG::zero())); + // Check that these points are on the curve + assert(bjj_montcurve.contains(bjj_montcurve.gen) + & bjj_montcurve.contains(p1_montcurve) + & bjj_montcurve.contains(p2_montcurve) + & bjj_montcurve.contains(p3_montcurve) + & bjj_montcurve.contains(p4_montcurve) + & bjj_montcurve.contains(p5_montcurve)); + // Elligator 2 map-to-curve + let ell2_pt_map = bjj_affine.elligator2_map(27); + + assert(ell2_pt_map.eq(MGaffine::new(7972459279704486422145701269802978968072470631857513331988813812334797879121, + 8142420778878030219043334189293412482212146646099536952861607542822144507872).into_tecurve())); + // SWU map-to-curve + let swu_pt_map = bjj_affine.swu_map(5, 27); + + assert(swu_pt_map.eq(bjj_affine.map_from_swcurve( + SWGaffine::new(2162719247815120009132293839392097468339661471129795280520343931405114293888, + 5341392251743377373758788728206293080122949448990104760111875914082289313973) + ))); + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml new file mode 100644 index 00000000000..58d8a993e16 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/generators/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "generators" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/generators/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/generators/src/main.nr new file mode 100644 index 00000000000..20bdedee50f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/generators/src/main.nr @@ -0,0 +1,56 @@ +// TODO? +// the syntax for these return types is very difficult to get right :/ +// for arguments this can be handled with a generic Env (or with Fn traits when we add them) +// but for return types neither fo these will help, you need to type out the exact type +fn make_counter() -> fn[(&mut Field,)]() -> Field { + let mut x = &mut 0; + + || { + *x = *x + 1; + *x + } +} + +fn fibonacci_generator() -> fn[(&mut Field, &mut Field)]() -> Field { + let mut x = &mut 1; + let mut y = &mut 2; + + || { + let old_x = *x; + let old_y = *y; + + *y = *x + *y; + *x = old_y; + + old_x + } +} +// we'll be able to un-hardcode the array length if we have the ::<> syntax proposed in https://github.com/noir-lang/noir/issues/2458 +fn get_some(generator: fn[Env]() -> Field) -> [Field; 5] { + [0, 0, 0, 0, 0].map(|_| generator()) +} + +fn test_fib() { + let fib = fibonacci_generator(); + + assert(fib() == 1); + assert(fib() == 2); + assert(fib() == 3); + assert(fib() == 5); + + assert(get_some(fib) == [8, 13, 21, 34, 55]); +} + +fn test_counter() { + let counter = make_counter(); + assert(counter() == 1); + assert(counter() == 2); + assert(counter() == 3); + + assert(get_some(counter) == [4, 5, 6, 7, 8]); +} + +fn main() { + test_fib(); + test_counter(); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml new file mode 100644 index 00000000000..968fc5300e6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "higher_order_fn_selector" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/src/main.nr new file mode 100644 index 00000000000..99093c581b5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/higher_order_fn_selector/src/main.nr @@ -0,0 +1,30 @@ +fn g(x: &mut Field) -> () { + *x *= 2; +} + +fn h(x: &mut Field) -> () { + *x *= 3; +} + +fn selector(flag: &mut bool) -> fn(&mut Field) -> () { + let my_func = if *flag { g } else { h }; + // Flip the flag for the next function call + *flag = !(*flag); + my_func +} + +fn main() { + let mut flag: bool = true; + + let mut x: Field = 100; + let returned_func = selector(&mut flag); + returned_func(&mut x); + + assert(x == 200); + + let mut y: Field = 100; + let returned_func2 = selector(&mut flag); + returned_func2(&mut y); + + assert(y == 300); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml new file mode 100644 index 00000000000..ef9bdce2640 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "impl_with_where_clause" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/src/main.nr new file mode 100644 index 00000000000..de3078be8ba --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/impl_with_where_clause/src/main.nr @@ -0,0 +1,27 @@ +fn main() { + let array: [Field; 3] = [1, 2, 3]; + assert(array.eq(array)); + // Ensure this still works if we have to infer the type of the integer literals + let array = [1, 2, 3]; + assert(array.eq(array)); +} + +trait Eq { + fn eq(self, other: Self) -> bool; +} + +impl Eq for [T; 3] where T: Eq { + fn eq(self, other: Self) -> bool { + let mut ret = true; + for i in 0 .. self.len() { + ret &= self[i].eq(other[i]); + } + ret + } +} + +impl Eq for Field { + fn eq(self, other: Field) -> bool { + self == other + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml new file mode 100644 index 00000000000..073456fa7f6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "inner_outer_cl" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/src/main.nr new file mode 100644 index 00000000000..ce847b56b93 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/inner_outer_cl/src/main.nr @@ -0,0 +1,12 @@ +fn main() { + let z1 = 0; + let z2 = 1; + let cl_outer = |x| { + let cl_inner = |y| { + x + y + z2 + }; + cl_inner(1) + z1 + }; + let result = cl_outer(1); + assert(result == 3); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml new file mode 100644 index 00000000000..4786a87ff65 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "instruction_deduplication" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr new file mode 100644 index 00000000000..43c0a382185 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr @@ -0,0 +1,5 @@ +fn main(x: Field) { + // This is a regression test for #2450. + // The compiler should recognize that the `(x as u32)` instructions are duplicates and so have the same output. + assert(x as u32 == x as u32); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml new file mode 100644 index 00000000000..539c536b944 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "intrinsic_die" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr new file mode 100644 index 00000000000..88f7a3634c1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/intrinsic_die/src/main.nr @@ -0,0 +1,8 @@ +use dep::std; +// This test checks that we perform dead-instruction-elimination on intrinsic functions. +fn main(x: Field) { + let bytes = x.to_be_bytes(32); + + let hash = std::hash::pedersen_commitment([x]); + let _p1 = std::scalar_mul::fixed_base_embedded_curve(x, 0); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml new file mode 100644 index 00000000000..def6e33b39a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "let_stmt" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/src/main.nr new file mode 100644 index 00000000000..6c63ecd6e12 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/let_stmt/src/main.nr @@ -0,0 +1,11 @@ +struct Foo { + a: u64, +} + +fn main() { + let _ = 42; + let _ = 42; + + let Foo { a: _ } = Foo { a: 42 }; + let _regression_2786 = [Foo { a: 1 }; 8]; +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml new file mode 100644 index 00000000000..793ae612730 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "main_return" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Prover.toml new file mode 100644 index 00000000000..63e9878811a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/Prover.toml @@ -0,0 +1 @@ +x = "8" diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/src/main.nr new file mode 100644 index 00000000000..06347eb0919 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/main_return/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: pub Field) -> pub Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml new file mode 100644 index 00000000000..835c945c3b8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "numeric_generics" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/src/main.nr new file mode 100644 index 00000000000..1e03a382fed --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/numeric_generics/src/main.nr @@ -0,0 +1,39 @@ +fn main() { + let a = id([1, 2]); + let b = id([1, 2, 3]); + + let itWorks1 = MyStruct { data: a }; + assert(itWorks1.data[1] == 2); + let itWorks2 = MyStruct { data: b }; + assert(itWorks2.data[1] == 2); + + let c = [1, 2]; + let itAlsoWorks = MyStruct { data: c }; + assert(itAlsoWorks.data[1] == 2); + + assert(foo(itWorks2).data[0] == itWorks2.data[0] + 1); +} + +fn id(x: [Field; I]) -> [Field; I] { + x +} + +struct MyStruct { + data: [Field; S], +} + +impl MyStruct { + fn insert(mut self: Self, index: Field, elem: Field) -> Self { + // Regression test for numeric generics on impls + assert(index as u64 < S as u64); + + self.data[index] = elem; + self + } +} + +fn foo(mut s: MyStruct<2+1>) -> MyStruct<10/2-2> { + s.data[0] = s.data[0] + 1; + s +} + diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml new file mode 100644 index 00000000000..d9bec3c3096 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/option/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "option" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/option/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/option/src/main.nr new file mode 100644 index 00000000000..1f879bd375f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/option/src/main.nr @@ -0,0 +1,63 @@ +use dep::std::option::Option; + +fn main() { + let ten = 10; // giving this a name, to ensure that the Option functions work with closures + let none = Option::none(); + let some = Option::some(3); + + assert(none.is_none()); + assert(some.is_some()); + + assert(some.unwrap() == 3); + + assert(none.unwrap_or(2) == 2); + assert(some.unwrap_or(2) == 3); + + assert(none.unwrap_or_else(|| 5) == 5); + assert(some.unwrap_or_else(|| 5) == 3); + assert(none.unwrap_or_else(|| ten + 5) == 15); + assert(some.unwrap_or_else(|| ten + 5) == 3); + + assert(none.map(|x| x * 2).is_none()); + assert(some.map(|x| x * 2).unwrap() == 6); + assert(some.map(|x| x * ten).unwrap() == 30); + + assert(none.map_or(0, |x| x * 2) == 0); + assert(some.map_or(0, |x| x * 2) == 6); + assert(none.map_or(0, |x| x * ten) == 0); + assert(some.map_or(0, |x| x * ten) == 30); + + assert(none.map_or_else(|| 0, |x| x * 2) == 0); + assert(some.map_or_else(|| 0, |x| x * 2) == 6); + assert(none.map_or_else(|| 0, |x| x * ten) == 0); + assert(some.map_or_else(|| ten, |x| x * 2) == 6); + + assert(none.and(none).is_none()); + assert(none.and(some).is_none()); + assert(some.and(none).is_none()); + assert(some.and(some).is_some()); + + let add1_u64 = |value: Field| Option::some(value as u64 + 1); + + assert(none.and_then(|_value| Option::none()).is_none()); + assert(none.and_then(add1_u64).is_none()); + assert(some.and_then(|_value| Option::none()).is_none()); + assert(some.and_then(add1_u64).unwrap() == 4); + assert(some.and_then(|x| Option::some(x + ten)).unwrap() == 13); + + assert(none.or(none).is_none()); + assert(none.or(some).is_some()); + assert(some.or(none).is_some()); + assert(some.or(some).is_some()); + + assert(none.or_else(|| Option::none()).is_none()); + assert(none.or_else(|| Option::some(5)).is_some()); + assert(some.or_else(|| Option::none()).is_some()); + assert(some.or_else(|| Option::some(5)).is_some()); + assert(some.or_else(|| Option::some(ten)).is_some()); + + assert(none.xor(none).is_none()); + assert(none.xor(some).is_some()); + assert(some.xor(none).is_some()); + assert(some.xor(some).is_none()); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml new file mode 100644 index 00000000000..0310e55ed7e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "references_aliasing" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/src/main.nr new file mode 100644 index 00000000000..0d96bc2a734 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/references_aliasing/src/main.nr @@ -0,0 +1,28 @@ +fn main() { + let mut x = 100; + let mut xref = &mut x; + increment(xref); + assert(*xref == 101); + + regression_2445(); +} + +fn increment(mut r: &mut Field) { + *r = *r + 1; +} +// If aliasing within arrays and constant folding within the mem2reg pass aren't +// handled, we'll fail to optimize out all the references in this function. +fn regression_2445() { + let mut var = 0; + let ref = &mut &mut var; + + let mut array = [ref, ref]; + + **array[0] = 1; + **array[1] = 2; + + assert(var == 2); + assert(**ref == 2); + assert(**array[0] == 2); + assert(**array[1] == 2); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml new file mode 100644 index 00000000000..6b9f9a24038 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "regression_2099" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/src/main.nr new file mode 100644 index 00000000000..185a6426cb3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/regression_2099/src/main.nr @@ -0,0 +1,34 @@ +use dep::std::ec::tecurve::affine::Curve as AffineCurve; +use dep::std::ec::tecurve::affine::Point as Gaffine; +use dep::std::ec::tecurve::curvegroup::Curve; +use dep::std::ec::tecurve::curvegroup::Point as G; + +use dep::std::ec::swcurve::affine::Point as SWGaffine; +use dep::std::ec::swcurve::curvegroup::Point as SWG; + +use dep::std::ec::montcurve::affine::Point as MGaffine; +use dep::std::ec::montcurve::curvegroup::Point as MG; + +fn main() { + // Define Baby Jubjub (ERC-2494) parameters in affine representation + let bjj_affine = AffineCurve::new(168700, + 168696, + Gaffine::new(995203441582195749578291179787384436505546430278305826713579947235728471134, + 5472060717959818805561601436314318772137091100104008585924551046643952123905)); + // Test addition + let p1_affine = Gaffine::new(17777552123799933955779906779655732241715742912184938656739573121738514868268, + 2626589144620713026669568689430873010625803728049924121243784502389097019475); + let p2_affine = Gaffine::new(16540640123574156134436876038791482806971768689494387082833631921987005038935, + 20819045374670962167435360035096875258406992893633759881276124905556507972311); + let _p3_affine = bjj_affine.add(p1_affine, p2_affine); + // Test SWCurve equivalents of the above + // First the affine representation + let bjj_swcurve_affine = bjj_affine.into_swcurve(); + + let p1_swcurve_affine = bjj_affine.map_into_swcurve(p1_affine); + let p2_swcurve_affine = bjj_affine.map_into_swcurve(p2_affine); + + let _p3_swcurve_affine_from_add = bjj_swcurve_affine.add(p1_swcurve_affine, p2_swcurve_affine); + // Check that these points are on the curve + assert(bjj_swcurve_affine.contains(p1_swcurve_affine)); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml new file mode 100644 index 00000000000..4f778574417 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ret_fn_ret_cl" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Prover.toml new file mode 100644 index 00000000000..3a627b9188b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/Prover.toml @@ -0,0 +1 @@ +x = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/src/main.nr new file mode 100644 index 00000000000..89083b076b6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/ret_fn_ret_cl/src/main.nr @@ -0,0 +1,33 @@ +fn f(x: Field) -> Field { + x + 1 +} + +fn ret_fn() -> fn(Field) -> Field { + f +} +// TODO: in the advanced implicitly generic function with closures branch +// which would support higher-order functions in a better way +// support returning closures: +// +// fn ret_closure() -> fn(Field) -> Field { +// let y = 1; +// let inner_closure = |z| -> Field{ +// z + y +// }; +// inner_closure +// } +fn ret_lambda() -> fn(Field) -> Field { + let cl = |z: Field| -> Field { + z + 1 + }; + cl +} + +fn main(x: Field) { + let result_fn = ret_fn(); + assert(result_fn(x) == x + 1); + // let result_closure = ret_closure(); + // assert(result_closure(x) == x + 1); + let result_lambda = ret_lambda(); + assert(result_lambda(x) == x + 1); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml new file mode 100644 index 00000000000..4f1811cc669 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_array_param" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Prover.toml new file mode 100644 index 00000000000..66f0b9ccc1c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/Prover.toml @@ -0,0 +1 @@ +xs = [0, 1] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/src/main.nr new file mode 100644 index 00000000000..6dd7c34dab5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_array_param/src/main.nr @@ -0,0 +1,6 @@ +// This program tests: +// - the allocation of virtual arrays for array params to main +// - load instructions for such arrays +fn main(xs: [Field; 2]) -> pub Field { + xs[1] +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml new file mode 100644 index 00000000000..13178336eea --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_program_no_body" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Prover.toml new file mode 100644 index 00000000000..c2b2ccfd9f1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/Prover.toml @@ -0,0 +1,2 @@ +_x = "3" +_y = "4" diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/src/main.nr new file mode 100644 index 00000000000..21719018f3f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_program_no_body/src/main.nr @@ -0,0 +1,9 @@ +// Tests a very simple program. +// +// The features being tested are: +// - Abi generation of private and public +// main parameters. +// +// This program will never fail since there are +// no assertions being applied. +fn main(_x: Field, _y: pub Field) {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml new file mode 100644 index 00000000000..1db9099be7e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_range" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/src/main.nr new file mode 100644 index 00000000000..3f595cfd817 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/simple_range/src/main.nr @@ -0,0 +1,6 @@ +// Tests a very simple program. +// +// The features being tested is casting to an integer +fn main(x: Field) { + let _z = x as u32; +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml new file mode 100644 index 00000000000..aaccd85a444 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "specialization" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/src/main.nr new file mode 100644 index 00000000000..9cd32e0f1eb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/specialization/src/main.nr @@ -0,0 +1,15 @@ +struct Foo {} + +impl Foo { + fn foo(_self: Self) -> Field { 1 } +} + +impl Foo { + fn foo(_self: Self) -> Field { 2 } +} + +fn main() { + let f1: Foo = Foo {}; + let f2: Foo = Foo {}; + assert(f1.foo() + f2.foo() == 3); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml new file mode 100644 index 00000000000..6b9bbd9b65f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "str_as_bytes" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/src/main.nr new file mode 100644 index 00000000000..6fdd926ce7f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/str_as_bytes/src/main.nr @@ -0,0 +1,18 @@ +use dep::std; +fn main() { + let a = "hello"; + let b = a.as_bytes(); + assert(b[0] == 104); + assert(b[1] == 101); + assert(b[2] == 108); + assert(b[3] == 108); + assert(b[4] == 111); + assert(b.len() == 5); + let mut c = a.as_bytes_vec(); + assert(c.get(0) == 104); + assert(c.get(1) == 101); + assert(c.get(2) == 108); + assert(c.get(3) == 108); + assert(c.get(4) == 111); + assert(c.len() == 5); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml new file mode 100644 index 00000000000..ef47f3b4ba1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "to_bits" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/src/main.nr new file mode 100644 index 00000000000..84ace83903a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/to_bits/src/main.nr @@ -0,0 +1,21 @@ +fn main() { + let field = 1000; + let be_bits = field.to_be_bits(16); + let le_bits = field.to_le_bits(16); + + for i in 0..16 { + let x = be_bits[i]; + let y = le_bits[15 - i]; + assert(x == y); + } + + let x = 3; + let be_bits_x = x.to_be_bits(4); + let le_bits_x = x.to_le_bits(4); + + for i in 0..4 { + let be_bit = be_bits_x[i]; + let le_bit = le_bits_x[3 - i]; + assert(be_bit == le_bit); + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml new file mode 100644 index 00000000000..bd31596297a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "trait_allowed_item_name_matches" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/src/main.nr new file mode 100644 index 00000000000..44cad58c2a6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_allowed_item_name_matches/src/main.nr @@ -0,0 +1,25 @@ +trait Trait1 { + // types and consts with the same name are allowed + type Tralala; + let Tralala: u32; +} + +trait Trait2 { + // consts and types with the same name are allowed + let Tralala: u32; + type Tralala; +} + +trait Trait3 { + // types and functions with the same name are allowed + type Tralala; + fn Tralala(); +} + +trait Trait4 { + // functions and types with the same name are allowed + fn Tralala(); + type Tralala; +} + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml new file mode 100644 index 00000000000..79d78c1aa51 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "trait_associated_member_names_clashes" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/src/main.nr new file mode 100644 index 00000000000..412a75010f6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_associated_member_names_clashes/src/main.nr @@ -0,0 +1,36 @@ +trait Trait1 { + fn tralala() -> Field; +} + +trait Trait2 { + fn tralala() -> Field; +} + +struct Struct1 { +} + +impl Struct1 { + fn tralala() -> Field { + 123456 + } +} + +impl Trait1 for Struct1 { + fn tralala() -> Field { + 111111 + } +} + +impl Trait2 for Struct1 { + fn tralala() -> Field { + 222222 + } +} + +fn main() { + // the struct impl takes priority over trait methods + assert(Struct1::tralala() == 123456); + // TODO: uncomment these, once we support the :: syntax + //assert(::tralala() == 111111); + //assert(::tralala() == 222222); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml new file mode 100644 index 00000000000..938e224ec02 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_default_implementation" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Prover.toml new file mode 100644 index 00000000000..71805e71e8e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "1" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/src/main.nr new file mode 100644 index 00000000000..e1f29ce3f48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_default_implementation/src/main.nr @@ -0,0 +1,26 @@ +use dep::std; + +trait Default { + fn default(x: Field, y: Field) -> Self; + + fn method2(x: Field) -> Field { + x + } + +} + +struct Foo { + bar: Field, + array: [Field; 2], +} + +impl Default for Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: x, array: [x,y] } + } +} + +fn main(x: Field) { + let first = Foo::method2(x); + assert(first == x); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml new file mode 100644 index 00000000000..1bb7522d6e1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "trait_function_calls" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/src/main.nr new file mode 100644 index 00000000000..39d28a5a3b3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_function_calls/src/main.nr @@ -0,0 +1,615 @@ +// a more thorough test for trait function/method calls from within trait function/method calls +// This tests all combinations of caller+callee pairs. For each of these, the following combination of properties are tried: +// *) method (has self parameter) vs function (no self parameter) +// *) default vs overriden vs overriden (no default) +// test order is: +// 1) trait method -> trait method +// 1a) trait default method -> trait default method +// 1b) trait default method -> trait overriden method +// 1c) trait default method -> trait overriden (no default) method +// 1d) trait overriden method -> trait default method +// 1e) trait overriden method -> trait overriden method +// 1f) trait overriden method -> trait overriden (no default) method +// 1g) trait overriden (no default) method -> trait default method +// 1h) trait overriden (no default) method -> trait overriden method +// 1i) trait overriden (no default) method -> trait overriden (no default) method +// 2) trait method -> trait function +// 2a) - subcases are the same as the above +// ... +// 2i) +// 3{a..i}) trait function -> trait method +// 4{a..i}) trait function -> trait function +// 1) trait method -> trait method +// 1a) trait default method -> trait default method +trait Trait1a { + fn trait_method1(self) -> Field { + self.trait_method2() * 7892 - self.vl + } + fn trait_method2(self) -> Field { + 43278 + } +} +struct Struct1a { vl: Field } +impl Trait1a for Struct1a { } +// 1b) trait default method -> trait overriden method +trait Trait1b { + fn trait_method1(self) -> Field { + self.trait_method2() * 2832 - self.vl + } + fn trait_method2(self) -> Field { + 9323 + } +} +struct Struct1b { vl: Field } +impl Trait1b for Struct1b { + fn trait_method2(self) -> Field { + 2394 + } +} +// 1c) trait default method -> trait overriden (no default) method +trait Trait1c { + fn trait_method1(self) -> Field { + self.trait_method2() * 7635 - self.vl + } + fn trait_method2(self) -> Field; +} +struct Struct1c { vl: Field } +impl Trait1c for Struct1c { + fn trait_method2(self) -> Field { + 5485 + } +} +// 1d) trait overriden method -> trait default method +trait Trait1d { + fn trait_method1(self) -> Field { + self.trait_method2() * 2825 - self.vl + } + fn trait_method2(self) -> Field { + 29341 + } +} +struct Struct1d { vl: Field } +impl Trait1d for Struct1d { + fn trait_method1(self) -> Field { + self.trait_method2() * 9342 - self.vl + } +} +// 1e) trait overriden method -> trait overriden method +trait Trait1e { + fn trait_method1(self) -> Field { + self.trait_method2() * 85465 - self.vl + } + fn trait_method2(self) -> Field { + 2381 + } +} +struct Struct1e { vl: Field } +impl Trait1e for Struct1e { + fn trait_method1(self) -> Field { + self.trait_method2() * 47324 - self.vl + } + fn trait_method2(self) -> Field { + 58945 + } +} +// 1f) trait overriden method -> trait overriden (no default) method +trait Trait1f { + fn trait_method1(self) -> Field { + self.trait_method2() * 43257 - self.vl + } + fn trait_method2(self) -> Field; +} +struct Struct1f { vl: Field } +impl Trait1f for Struct1f { + fn trait_method1(self) -> Field { + self.trait_method2() * 34875 - self.vl + } + fn trait_method2(self) -> Field { + 5748 + } +} +// 1g) trait overriden (no default) method -> trait default method +trait Trait1g { + fn trait_method1(self) -> Field; + fn trait_method2(self) -> Field { + 37845 + } +} +struct Struct1g { vl: Field } +impl Trait1g for Struct1g { + fn trait_method1(self) -> Field { + self.trait_method2() * 7854 - self.vl + } +} +// 1h) trait overriden (no default) method -> trait overriden method +trait Trait1h { + fn trait_method1(self) -> Field; + fn trait_method2(self) -> Field { + 7823 + } +} +struct Struct1h { vl: Field } +impl Trait1h for Struct1h { + fn trait_method1(self) -> Field { + self.trait_method2() * 3482 - self.vl + } + fn trait_method2(self) -> Field { + 8542 + } +} +// 1i) trait overriden (no default) method -> trait overriden (no default) method +trait Trait1i { + fn trait_method1(self) -> Field; + fn trait_method2(self) -> Field; +} +struct Struct1i { vl: Field } +impl Trait1i for Struct1i { + fn trait_method1(self) -> Field { + self.trait_method2() * 23478 - self.vl + } + fn trait_method2(self) -> Field { + 98543 + } +} +// 2) trait method -> trait function +// 2a) trait default method -> trait default function +trait Trait2a { + fn trait_method1(self) -> Field { + Self::trait_function2() * 2385 - self.vl + } + fn trait_function2() -> Field { + 7843 + } +} +struct Struct2a { vl: Field } +impl Trait2a for Struct2a { } +// 2b) trait default method -> trait overriden function +trait Trait2b { + fn trait_method1(self) -> Field { + Self::trait_function2() * 6583 - self.vl + } + fn trait_function2() -> Field { + 3752 + } +} +struct Struct2b { vl: Field } +impl Trait2b for Struct2b { + fn trait_function2() -> Field { + 8477 + } +} +// 2c) trait default method -> trait overriden (no default) function +trait Trait2c { + fn trait_method1(self) -> Field { + Self::trait_function2() * 2831 - self.vl + } + fn trait_function2() -> Field; +} +struct Struct2c { vl: Field } +impl Trait2c for Struct2c { + fn trait_function2() -> Field { + 8342 + } +} +// 2d) trait overriden method -> trait default function +trait Trait2d { + fn trait_method1(self) -> Field { + Self::trait_function2() * 924 - self.vl + } + fn trait_function2() -> Field { + 384 + } +} +struct Struct2d { vl: Field } +impl Trait2d for Struct2d { + fn trait_method1(self) -> Field { + Self::trait_function2() * 3984 - self.vl + } +} +// 2e) trait overriden method -> trait overriden function +trait Trait2e { + fn trait_method1(self) -> Field { + Self::trait_function2() * 3642 - self.vl + } + fn trait_function2() -> Field { + 97342 + } +} +struct Struct2e { vl: Field } +impl Trait2e for Struct2e { + fn trait_method1(self) -> Field { + Self::trait_function2() * 7363 - self.vl + } + fn trait_function2() -> Field { + 39400 + } +} +// 2f) trait overriden method -> trait overriden (no default) function +trait Trait2f { + fn trait_method1(self) -> Field { + Self::trait_function2() * 2783 - self.vl + } + fn trait_function2() -> Field; +} +struct Struct2f { vl: Field } +impl Trait2f for Struct2f { + fn trait_method1(self) -> Field { + Self::trait_function2() * 6362 - self.vl + } + fn trait_function2() -> Field { + 72311 + } +} +// 2g) trait overriden (no default) method -> trait default function +trait Trait2g { + fn trait_method1(self) -> Field; + fn trait_function2() -> Field { + 19273 + } +} +struct Struct2g { vl: Field } +impl Trait2g for Struct2g { + fn trait_method1(self) -> Field { + Self::trait_function2() * 9123 - self.vl + } +} +// 2h) trait overriden (no default) method -> trait overriden function +trait Trait2h { + fn trait_method1(self) -> Field; + fn trait_function2() -> Field { + 1281 + } +} +struct Struct2h { vl: Field } +impl Trait2h for Struct2h { + fn trait_method1(self) -> Field { + Self::trait_function2() * 4833 - self.vl + } + fn trait_function2() -> Field { + 5335 + } +} +// 2i) trait overriden (no default) method -> trait overriden (no default) function +trait Trait2i { + fn trait_method1(self) -> Field; + fn trait_function2() -> Field; +} +struct Struct2i { vl: Field } +impl Trait2i for Struct2i { + fn trait_method1(self) -> Field { + Self::trait_function2() * 2291 - self.vl + } + fn trait_function2() -> Field { + 3322 + } +} +// 3 trait function -> trait method +// 3a) trait default function -> trait default method +trait Trait3a { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 8344 - b.vl + a + } + fn trait_method2(self) -> Field { + 19212 + } +} +struct Struct3a { vl: Field } +impl Trait3a for Struct3a { } +// 3b) trait default function -> trait overriden method +trait Trait3b { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 9233 - b.vl + a + } + fn trait_method2(self) -> Field { + 9111 + } +} +struct Struct3b { vl: Field } +impl Trait3b for Struct3b { + fn trait_method2(self) -> Field { + 2392 + } +} +// 3c) trait default function -> trait overriden (no default) method +trait Trait3c { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 2822 - b.vl + a + } + fn trait_method2(self) -> Field; +} +struct Struct3c { vl: Field } +impl Trait3c for Struct3c { + fn trait_method2(self) -> Field { + 7743 + } +} +// 3d) trait overriden function -> trait default method +trait Trait3d { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 291 - b.vl + a + } + fn trait_method2(self) -> Field { + 3328 + } +} +struct Struct3d { vl: Field } +impl Trait3d for Struct3d { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 4933 - b.vl + a + } +} +// 3e) trait overriden function -> trait overriden method +trait Trait3e { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 71231 - b.vl + a + } + fn trait_method2(self) -> Field { + 373 + } +} +struct Struct3e { vl: Field } +impl Trait3e for Struct3e { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 81232 - b.vl + a + } + fn trait_method2(self) -> Field { + 80002 + } +} +// 3f) trait overriden function -> trait overriden (no default) method +trait Trait3f { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 28223 - b.vl + a + } + fn trait_method2(self) -> Field; +} +struct Struct3f { vl: Field } +impl Trait3f for Struct3f { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 29223 - b.vl + a + } + fn trait_method2(self) -> Field { + 63532 + } +} +// 3g) trait overriden (no default) function -> trait default method +trait Trait3g { + fn trait_function1(a: Field, b: Self) -> Field; + fn trait_method2(self) -> Field { + 8887 + } +} +struct Struct3g { vl: Field } +impl Trait3g for Struct3g { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 31337 - b.vl + a + } +} +// 3h) trait overriden (no default) function -> trait overriden method +trait Trait3h { + fn trait_function1(a: Field, b: Self) -> Field; + fn trait_method2(self) -> Field { + 293 + } +} +struct Struct3h { vl: Field } +impl Trait3h for Struct3h { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 74747 - b.vl + a + } + fn trait_method2(self) -> Field { + 6283 + } +} +// 3i) trait overriden (no default) function -> trait overriden (no default) method +trait Trait3i { + fn trait_function1(a: Field, b: Self) -> Field; + fn trait_method2(self) -> Field; +} +struct Struct3i { vl: Field } +impl Trait3i for Struct3i { + fn trait_function1(a: Field, b: Self) -> Field { + b.trait_method2() * 1237 - b.vl + a + } + fn trait_method2(self) -> Field { + 84352 + } +} +// 4) trait function -> trait function +// 4a) trait default function -> trait default function +trait Trait4a { + fn trait_function1() -> Field { + Self::trait_function2() * 3842 + } + fn trait_function2() -> Field { + 2932 + } +} +struct Struct4a { vl: Field } +impl Trait4a for Struct4a { } +// 4b) trait default function -> trait overriden function +trait Trait4b { + fn trait_function1() -> Field { + Self::trait_function2() * 3842 + } + fn trait_function2() -> Field { + 2932 + } +} +struct Struct4b { vl: Field } +impl Trait4b for Struct4b { + fn trait_function2() -> Field { + 9353 + } +} +// 4c) trait default function -> trait overriden (no default) function +trait Trait4c { + fn trait_function1() -> Field { + Self::trait_function2() * 7832 + } + fn trait_function2() -> Field; +} +struct Struct4c { vl: Field } +impl Trait4c for Struct4c { + fn trait_function2() -> Field { + 2928 + } +} +// 4d) trait overriden function -> trait default function +trait Trait4d { + fn trait_function1() -> Field { + Self::trait_function2() * 2283 + } + fn trait_function2() -> Field { + 9332 + } +} +struct Struct4d { vl: Field } +impl Trait4d for Struct4d { + fn trait_function1() -> Field { + Self::trait_function2() * 8374 + } +} +// 4e) trait overriden function -> trait overriden function +trait Trait4e { + fn trait_function1() -> Field { + Self::trait_function2() * 94329 + } + fn trait_function2() -> Field { + 28328 + } +} +struct Struct4e { vl: Field } +impl Trait4e for Struct4e { + fn trait_function1() -> Field { + Self::trait_function2() * 12323 + } + fn trait_function2() -> Field { + 38434 + } +} +// 4f) trait overriden function -> trait overriden (no default) function +trait Trait4f { + fn trait_function1() -> Field { + Self::trait_function2() * 23723 + } + fn trait_function2() -> Field; +} +struct Struct4f { vl: Field } +impl Trait4f for Struct4f { + fn trait_function1() -> Field { + Self::trait_function2() * 21392 + } + fn trait_function2() -> Field { + 4394 + } +} +// 4g) trait overriden (no default) function -> trait default function +trait Trait4g { + fn trait_function1() -> Field; + fn trait_function2() -> Field { + 2932 + } +} +struct Struct4g { vl: Field } +impl Trait4g for Struct4g { + fn trait_function1() -> Field { + Self::trait_function2() * 3345 + } +} +// 4h) trait overriden (no default) function -> trait overriden function +trait Trait4h { + fn trait_function1() -> Field; + fn trait_function2() -> Field { + 5756 + } +} +struct Struct4h { vl: Field } +impl Trait4h for Struct4h { + fn trait_function1() -> Field { + Self::trait_function2() * 6478 + } + fn trait_function2() -> Field { + 5435 + } +} +// 4i) trait overriden (no default) function -> trait overriden (no default) function +trait Trait4i { + fn trait_function1() -> Field; + fn trait_function2() -> Field; +} +struct Struct4i { vl: Field } +impl Trait4i for Struct4i { + fn trait_function1() -> Field { + Self::trait_function2() * 8239 + } + fn trait_function2() -> Field { + 2032 + } +} + +fn main() { + let t1a = Struct1a { vl: 1234 }; + assert(t1a.trait_method1() == 341548742); + let t1b = Struct1b { vl: 4444 }; + assert(t1b.trait_method1() == 6775364); + let t1c = Struct1c { vl: 3946 }; + assert(t1c.trait_method1() == 41874029); + let t1d = Struct1d { vl: 9234 }; + assert(t1d.trait_method1() == 274094388); + let t1e = Struct1e { vl: 5438 }; + assert(t1e.trait_method1() == 2789507742); + let t1f = Struct1f { vl: 6237 }; + assert(t1f.trait_method1() == 200455263); + let t1g = Struct1g { vl: 43587 }; + assert(t1g.trait_method1() == 297191043); + let t1h = Struct1h { vl: 3984 }; + assert(t1h.trait_method1() == 29739260); + let t1i = Struct1i { vl: 9234 }; + assert(t1i.trait_method1() == 2313583320); + let t2a = Struct2a { vl: 4362 }; + assert(t2a.trait_method1() == 18701193); + let t2b = Struct2b { vl: 8347 }; + assert(t2b.trait_method1() == 55795744); + let t2c = Struct2c { vl: 1923 }; + assert(t2c.trait_method1() == 23614279); + let t2d = Struct2d { vl: 92384 }; + assert(t2d.trait_method1() == 1437472); + let t2e = Struct2e { vl: 83943 }; + assert(t2e.trait_method1() == 290018257); + let t2f = Struct2f { vl: 8237 }; + assert(t2f.trait_method1() == 460034345); + let t2g = Struct2g { vl: 1232 }; + assert(t2g.trait_method1() == 175826347); + let t2h = Struct2h { vl: 7222 }; + assert(t2h.trait_method1() == 25776833); + let t2i = Struct2i { vl: 1821 }; + assert(t2i.trait_method1() == 7608881); + let t3a = Struct3a { vl: 93248 }; + assert(Struct3a::trait_function1(5, t3a) == 160211685); + let t3b = Struct3b { vl: 76763 }; + assert(Struct3b::trait_function1(62, t3b) == 22008635); + let t3c = Struct3c { vl: 3833 }; + assert(Struct3c::trait_function1(25, t3c) == 21846938); + let t3d = Struct3d { vl: 5645 }; + assert(Struct3d::trait_function1(73, t3d) == 16411452); + let t3e = Struct3e { vl: 22912 }; + assert(Struct3e::trait_function1(92, t3e) == 6498699644); + let t3f = Struct3f { vl: 3256 }; + assert(Struct3f::trait_function1(77, t3f) == 1856592457); + let t3g = Struct3g { vl: 22832 }; + assert(Struct3g::trait_function1(23, t3g) == 278469110); + let t3h = Struct3h { vl: 4933 }; + assert(Struct3h::trait_function1(17, t3h) == 469630485); + let t3i = Struct3i { vl: 39432 }; + assert(Struct3i::trait_function1(54, t3i) == 104304046); + assert(Struct4a::trait_function1() == 11264744); + assert(Struct4b::trait_function1() == 35934226); + assert(Struct4c::trait_function1() == 22932096); + assert(Struct4d::trait_function1() == 78146168); + assert(Struct4e::trait_function1() == 473622182); + assert(Struct4f::trait_function1() == 93996448); + assert(Struct4g::trait_function1() == 9807540); + assert(Struct4h::trait_function1() == 35207930); + assert(Struct4i::trait_function1() == 16741648); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml new file mode 100644 index 00000000000..c1b5d0aaa6c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_generics" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr new file mode 100644 index 00000000000..bb6d6e74726 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_generics/src/main.nr @@ -0,0 +1,59 @@ +struct Empty {} + +trait Foo { + fn foo(self) -> u32; +} + +impl Foo for Empty { + fn foo(_self: Self) -> u32 { 32 } +} + +impl Foo for Empty { + fn foo(_self: Self) -> u32 { 64 } +} + +fn main() { + let x: Empty = Empty {}; + let y: Empty = Empty {}; + let z = Empty {}; + + assert(x.foo() == 32); + assert(y.foo() == 64); + // Types matching multiple impls will currently choose + // the first matching one instead of erroring + assert(z.foo() == 32); + + call_impl_with_generic_struct(); + call_impl_with_generic_function(); +} +// Ensure we can call a generic impl +fn call_impl_with_generic_struct() { + let x: u8 = 7; + let y: i8 = 8; + let s2_u8 = S2 { x }; + let s2_i8 = S2 { x: y }; + assert(s2_u8.t2().x == 7); + assert(s2_i8.t2().x == 8); +} + +trait T2 { + fn t2(self) -> Self; +} + +struct S2 { x: T } + +impl T2 for S2 { + fn t2(self) -> Self { self } +} + +fn call_impl_with_generic_function() { + assert(3.t3(7) == 7); +} + +trait T3 { + fn t3(self, x: T) -> T; +} + +impl T3 for u32 { + fn t3(self, y: U) -> U { y } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml new file mode 100644 index 00000000000..efa176099cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_multi_module_test" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/main.nr new file mode 100644 index 00000000000..77c30ce602b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/main.nr @@ -0,0 +1,8 @@ +mod module1; +mod module2; +mod module3; +mod module4; +mod module5; +mod module6; + +fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module1.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module1.nr new file mode 100644 index 00000000000..4d41ff2909a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module1.nr @@ -0,0 +1,2 @@ +trait MyTrait { +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module2.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module2.nr new file mode 100644 index 00000000000..3cadb6d78cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module2.nr @@ -0,0 +1,2 @@ +struct MyStruct { +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module3.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module3.nr new file mode 100644 index 00000000000..2485a2ba7a1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module3.nr @@ -0,0 +1,4 @@ +use crate::module1::MyTrait; +use crate::module2::MyStruct; +// ensure we can implement traits that are imported with the `use` syntax +impl MyTrait for MyStruct {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module4.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module4.nr new file mode 100644 index 00000000000..f9458e83c4a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module4.nr @@ -0,0 +1,2 @@ +trait MyTrait4 { +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module5.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module5.nr new file mode 100644 index 00000000000..cd9b7f0bf39 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module5.nr @@ -0,0 +1,2 @@ +struct MyStruct5 { +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module6.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module6.nr new file mode 100644 index 00000000000..35f5ce3a183 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_multi_module_test/src/module6.nr @@ -0,0 +1,2 @@ +// ensure we can implement traits using the Path syntax +impl crate::module4::MyTrait4 for crate::module5::MyStruct5 { } diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml new file mode 100644 index 00000000000..1ccf15adc14 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_override_implementation" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Prover.toml new file mode 100644 index 00000000000..71805e71e8e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "1" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/src/main.nr new file mode 100644 index 00000000000..a385efc63fd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_override_implementation/src/main.nr @@ -0,0 +1,71 @@ +use dep::std; + +trait Default { + fn default(x: Field, y: Field) -> Self; + + fn method2(x: Field) -> Field { + x + } +} + +struct Foo { + bar: Field, + array: [Field; 2], +} + +impl Default for Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: x, array: [x,y] } + } + + fn method2(x: Field) -> Field { + x * 3 + } +} + +trait F { + fn f1(self) -> Field; + fn f2(self) -> Field { 2 } + fn f3(self) -> Field { 3 } + fn f4(self) -> Field { 4 } + fn f5(self) -> Field { 5 } +} + +struct Bar {} + +impl F for Bar { + fn f5(self) -> Field { 50 } + fn f1(self) -> Field { 10 } + fn f3(self) -> Field { 30 } +} +// Impls on mutable references are temporarily disabled +// impl F for &mut Bar { +// fn f1(self) -> Field { 101 } +// fn f5(self) -> Field { 505 } +// } +fn main(x: Field) { + let first = Foo::method2(x); + assert(first == 3 * x); + + let bar = Bar {}; + + assert(bar.f1() == 10, "1"); + assert(bar.f2() == 2, "2"); + assert(bar.f3() == 30, "3"); + assert(bar.f4() == 4, "4"); + assert(bar.f5() == 50, "5"); + + let mut bar_mut = Bar {}; + // Impls on mutable references are temporarily disabled + // assert_eq((&mut bar_mut).f1(), 101); + // assert((&mut bar_mut).f2() == 2, "7"); + // assert((&mut bar_mut).f3() == 3, "8"); + // assert((&mut bar_mut).f4() == 4, "9"); + // assert((&mut bar_mut).f5() == 505, "10"); + assert(bar_mut.f1() == 10, "10"); + assert(bar_mut.f2() == 2, "12"); + assert(bar_mut.f3() == 30, "13"); + assert(bar_mut.f4() == 4, "14"); + assert(bar_mut.f5() == 50, "15"); +} + diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/Nargo.toml new file mode 100644 index 00000000000..71c541ccd4f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_self" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/src/main.nr new file mode 100644 index 00000000000..0150da68315 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_static_methods/src/main.nr @@ -0,0 +1,41 @@ +trait ATrait { + fn asd() -> Self; + + fn static_method() -> Field { + Self::static_method_2() + } + + fn static_method_2() -> Field { + 100 + } +} + +struct Foo { + x: Field +} +impl ATrait for Foo { + fn asd() -> Self { + // This should pass as Self should be bound to Foo while typechecking this + Foo{x: 100} + } +} + +struct Bar { + x: Field +} +impl ATrait for Bar { + // The trait method is declared as returning `Self` + // but explicitly specifying the type in the impl should work + fn asd() -> Bar { + Bar{x: 100} + } + + fn static_method_2() -> Field { + 200 + } +} + +fn main() { + assert(Foo::static_method() == 100); + assert(Bar::static_method() == 200); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml new file mode 100644 index 00000000000..1bbde8bfd79 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_where_clause" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/main.nr new file mode 100644 index 00000000000..5fd7e78abf4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/main.nr @@ -0,0 +1,56 @@ +// TODO(#2568): Currently we only support trait constraints in a few cases. +// There's a bunch of other places where they can pop up: +// - trait methods (trait Foo where T: ... { ) +// - structs (struct Foo where T: ...) +// import the traits from another module to ensure the where clauses are ok with that +mod the_trait; +use crate::the_trait::Asd; +use crate::the_trait::StaticTrait; + +struct Add10 { x: Field, } +struct Add20 { x: Field, } +struct Add30 { x: Field, } +struct AddXY { x: Field, y: Field, } + +impl Asd for Add10 { fn asd(self) -> Field { self.x + 10 } } +impl Asd for Add20 { fn asd(self) -> Field { self.x + 20 } } +impl Asd for Add30 { fn asd(self) -> Field { self.x + 30 } } + +impl Asd for AddXY { + fn asd(self) -> Field { + self.x + self.y + } +} + +struct Static100 {} +impl StaticTrait for Static100 { + // use default implementation for static_function, which returns 100 +} + +struct Static200 {} +impl StaticTrait for Static200 { + fn static_function(slf: Self) -> Field { 200 } +} + +fn assert_asd_eq_100(t: T) where T: crate::the_trait::Asd { + assert(t.asd() == 100); +} + +fn add_one_to_static_function(t: T) -> Field where T: StaticTrait { + T::static_function(t) + 1 +} + +fn main() { + let x = Add10 { x: 90 }; + let z = Add20 { x: 80 }; + let a = Add30 { x: 70 }; + let xy = AddXY { x: 30, y: 70 }; + + assert_asd_eq_100(x); + assert_asd_eq_100(z); + assert_asd_eq_100(a); + assert_asd_eq_100(xy); + + assert(add_one_to_static_function(Static100 {}) == 101); + assert(add_one_to_static_function(Static200 {}) == 201); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/the_trait.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/the_trait.nr new file mode 100644 index 00000000000..c5cac4a1186 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/trait_where_clause/src/the_trait.nr @@ -0,0 +1,9 @@ +trait Asd { + fn asd(self) -> Field; +} + +trait StaticTrait { + fn static_function(slf: Self) -> Field { + 100 + } +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml new file mode 100644 index 00000000000..a33e8681807 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "traits" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Prover.toml new file mode 100644 index 00000000000..71805e71e8e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "1" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/traits/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/src/main.nr new file mode 100644 index 00000000000..784ff01a883 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/traits/src/main.nr @@ -0,0 +1,21 @@ +use dep::std; + +trait Default { + fn default(x: Field, y: Field) -> Self; +} + +struct Foo { + bar: Field, + array: [Field; 2], +} + +impl Default for Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: x, array: [x,y] } + } +} + +fn main(x: Field, y: Field) { + let first = Foo::default(x, y); + assert(first.bar == x); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml new file mode 100644 index 00000000000..8ab6f708b8a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "unary_operators" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/src/main.nr new file mode 100644 index 00000000000..ef622fd3eb9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unary_operators/src/main.nr @@ -0,0 +1,7 @@ +fn main() { + let x = -1; + assert(x == 1 - 2); + + let y: i32 = -1; + assert(x == 1 - 2); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml new file mode 100644 index 00000000000..48d0f5938d8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "unconstrained_empty" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/src/main.nr new file mode 100644 index 00000000000..5e5fb297236 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unconstrained_empty/src/main.nr @@ -0,0 +1 @@ +unconstrained fn main() {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml new file mode 100644 index 00000000000..7a15bd803c0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unit/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "unit" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unit/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/unit/src/main.nr new file mode 100644 index 00000000000..603829ec6db --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unit/src/main.nr @@ -0,0 +1,18 @@ +fn main() { + let _a = (); + let _b: () = _a; + let _c: () = (); + let _d = f1(); + let _e: () = f2(); + let _f: () = f3(); + let _g = f4(); +} + +fn f1() {} +fn f2() { + () +} +fn f3() -> () {} +fn f4() -> () { + () +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml new file mode 100644 index 00000000000..1447f07d81d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "unused_variables" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/src/main.nr new file mode 100644 index 00000000000..f82cace0509 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/unused_variables/src/main.nr @@ -0,0 +1 @@ +fn main(x: Field, y: pub Field) {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml new file mode 100644 index 00000000000..e4c3889c685 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "vectors" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Prover.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/src/main.nr new file mode 100644 index 00000000000..28187a4f619 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/vectors/src/main.nr @@ -0,0 +1,32 @@ +use dep::std::collections::vec::Vec; + +fn main(x: Field, y: pub Field) { + let mut vector = Vec::new(); + + assert(vector.len() == 0); + for i in 0..5 { + vector.push(i); + } + assert(vector.len() == 5); + for i in 0..5 { + assert(i == vector.get(i)); + } + + let last_elem = vector.pop(); + assert(last_elem == 4); + assert(vector.len() == 4); + + vector.insert(2, 100); + assert(vector.get(2) == 100); + assert(vector.get(4) == 3); + assert(vector.len() == 5); + + let removed_elem = vector.remove(3); + assert(removed_elem == 2); + assert(vector.get(3) == 3); + assert(vector.len() == 4); + + let mut inputs_vector = Vec::from_slice([x, y]); + assert(inputs_vector.get(0) == x); + assert(inputs_vector.get(1) == y); +} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/Nargo.toml new file mode 100644 index 00000000000..ea2ffc0d2eb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/Nargo.toml @@ -0,0 +1,7 @@ +[workspace] +members = [ + "library", + "library2", + "binary" +] +default-member = "binary" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/Nargo.toml new file mode 100644 index 00000000000..90d8321589b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "binary" +type = "bin" +authors = [""] +[dependencies] +library = { path = "../library" } \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/src/main.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/src/main.nr new file mode 100644 index 00000000000..ab0ae9a48b8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/binary/src/main.nr @@ -0,0 +1,2 @@ +use dep::library::ReExportMeFromAnotherLib; +fn main(_x: ReExportMeFromAnotherLib) {} diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/Nargo.toml new file mode 100644 index 00000000000..88831bada4e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "library" +type = "lib" +authors = [""] + +[dependencies] +library2 = { path = "../library2"} \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/src/lib.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/src/lib.nr new file mode 100644 index 00000000000..8e84662ed03 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library/src/lib.nr @@ -0,0 +1,2 @@ +// Re-export +use dep::library2::ReExportMeFromAnotherLib; diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/Nargo.toml b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/Nargo.toml new file mode 100644 index 00000000000..f2c20c0bf4a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "library" +type = "lib" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/src/lib.nr b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/src/lib.nr new file mode 100644 index 00000000000..7e5a29a1424 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/compile_success_empty/workspace_reexport_bug/library2/src/lib.nr @@ -0,0 +1,5 @@ +// When we re-export this type from another library and then use it in +// main, we get a panic +struct ReExportMeFromAnotherLib { + x : Field, +} diff --git a/noir/tooling/nargo_cli/tests/execute.rs b/noir/tooling/nargo_cli/tests/execute.rs new file mode 100644 index 00000000000..e2bef43b571 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execute.rs @@ -0,0 +1,19 @@ +#[allow(unused_imports)] +#[cfg(test)] +mod tests { + // Some of these imports are consumed by the injected tests + use assert_cmd::prelude::*; + use predicates::prelude::*; + + use std::collections::BTreeMap; + use std::fs; + use std::path::PathBuf; + use std::process::Command; + + use super::*; + + test_binary::build_test_binary_once!(mock_backend, "../backend_interface/test-binaries"); + + // include tests generated by `build.rs` + include!(concat!(env!("OUT_DIR"), "/execute.rs")); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml new file mode 100644 index 00000000000..3adf969538c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "1327_concrete_in_generic" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Prover.toml new file mode 100644 index 00000000000..e5fc42da053 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/Prover.toml @@ -0,0 +1 @@ +input = 1 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr new file mode 100644 index 00000000000..e1d601b13c9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr @@ -0,0 +1,64 @@ +// --- +fn new_concrete_c_over_d() -> C { + let d_method_interface = get_d_method_interface(); + C::new(d_method_interface) +} +// --- +// Map +struct B { + new_concrete_t_c_constructor: fn()->T_C, + } + +impl B { + fn new(new_concrete_t_c_constructor: fn () -> T_C) -> B { + B { new_concrete_t_c_constructor } + } + + fn get_t_c(self) -> T_C { + let new_concrete_t_c_constructor = self.new_concrete_t_c_constructor; + new_concrete_t_c_constructor() + } + } +// --- +// Set +struct C { + t_d_interface: MethodInterface, + } + +impl C { + fn new (t_d_interface: MethodInterface) -> Self { + C { t_d_interface } + } + + fn call_method_of_t_d(self, t_d: T_D) -> Field { + let some_method_on_t_d = self.t_d_interface.some_method_on_t_d; + some_method_on_t_d(t_d) + } + } +// --- +struct MethodInterface { + some_method_on_t_d: fn(T_D)->Field, + } +// --- +// Note +struct D { + d: Field, + } + +fn d_method(input: D) -> Field { + input.d * input.d +} + +fn get_d_method_interface() -> MethodInterface { + MethodInterface { some_method_on_t_d: d_method } +} +// --- +fn main(input: Field) -> pub Field { + let b: B> = B::new(new_concrete_c_over_d); + let c: C = b.get_t_c(); // Singleton + let d: D = D { d: input }; // Note + let output = c.call_method_of_t_d(d); + + output +} +// --- diff --git a/noir/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml new file mode 100644 index 00000000000..a0fd8d98027 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1_mul/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "1_mul" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/1_mul/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/1_mul/Prover.toml new file mode 100644 index 00000000000..9bff601c75a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1_mul/Prover.toml @@ -0,0 +1,3 @@ +x = "3" +y = "4" +z = "429981696" diff --git a/noir/tooling/nargo_cli/tests/execution_success/1_mul/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/1_mul/src/main.nr new file mode 100644 index 00000000000..8f4032dbd75 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/1_mul/src/main.nr @@ -0,0 +1,9 @@ +// Test unsafe integer multiplication with overflow: 12^8 = 429 981 696 +// The circuit should handle properly the growth of the bit size +fn main(mut x: u32, y: u32, z: u32) { + x *= y; + x *= x; //144 + x *= x; //20736 + x *= x; //429 981 696 + assert(x == z); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml new file mode 100644 index 00000000000..f689c97f760 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/2_div/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "2_div" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/2_div/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/2_div/Prover.toml new file mode 100644 index 00000000000..ee6f0ef229a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/2_div/Prover.toml @@ -0,0 +1,3 @@ +x = "7" +y = "3" +z = "2" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/2_div/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/2_div/src/main.nr new file mode 100644 index 00000000000..e16cc5be229 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/2_div/src/main.nr @@ -0,0 +1,7 @@ +// Testing integer division: 7/3 = 2 +fn main(mut x: u32, y: u32, z: u32) { + let a = x % y; + assert(x / y == z); + assert(a == x - z * y); + assert((50 as u64) % (9 as u64) == 5); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml new file mode 100644 index 00000000000..0bd2caef024 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/3_add/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "3_add" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/3_add/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/3_add/Prover.toml new file mode 100644 index 00000000000..5d777c023db --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/3_add/Prover.toml @@ -0,0 +1,3 @@ +x = "3" +y = "4" +z = "7" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/3_add/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/3_add/src/main.nr new file mode 100644 index 00000000000..480348dc1cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/3_add/src/main.nr @@ -0,0 +1,8 @@ +// Test integer addition: 3 + 4 = 7 +fn main(mut x: u32, y: u32, z: u32) { + x += y; + assert(x == z); + + x *= 8; + assert(x > 9); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml new file mode 100644 index 00000000000..b282bfe6287 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/4_sub/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "4_sub" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/4_sub/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/4_sub/Prover.toml new file mode 100644 index 00000000000..1240475dee3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/4_sub/Prover.toml @@ -0,0 +1,3 @@ +x = "12" +y = "2418266113" +z = "1876701195" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/4_sub/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/4_sub/src/main.nr new file mode 100644 index 00000000000..6aef8e7b208 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/4_sub/src/main.nr @@ -0,0 +1,6 @@ +use dep::std; +// Test unsafe integer subtraction with underflow: 12 - 2418266113 = 1876701195 modulo 2^32 +fn main(mut x: u32, y: u32, z: u32) { + x = std::wrapping_sub(x,y); + assert(x == z); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml new file mode 100644 index 00000000000..dd9a21b44bf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/5_over/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "5_over" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/5_over/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/5_over/Prover.toml new file mode 100644 index 00000000000..9a1986329ca --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/5_over/Prover.toml @@ -0,0 +1,2 @@ +x = "43046721" +y = "3793632897" diff --git a/noir/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr new file mode 100644 index 00000000000..f24ff06cb2a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr @@ -0,0 +1,10 @@ +use dep::std; +// Test unsafe integer arithmetic +// Test odd bits integer +fn main(mut x: u32, y: u32) { + x = std::wrapping_mul(x,x); + assert(y == x); + + let c: u3 = 2; + assert(c > x as u3); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/6/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/6/Nargo.toml new file mode 100644 index 00000000000..9774a5d8c47 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "6" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/6/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/6/Prover.toml new file mode 100644 index 00000000000..1c52aef063c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6/Prover.toml @@ -0,0 +1,39 @@ + +# hello as bytes +# used : https://emn178.github.io/online-tools/sha256.html +x = [104, 101, 108, 108, 111] + +result = [ + 0x2c, + 0xf2, + 0x4d, + 0xba, + 0x5f, + 0xb0, + 0xa3, + 0x0e, + 0x26, + 0xe8, + 0x3b, + 0x2a, + 0xc5, + 0xb9, + 0xe2, + 0x9e, + 0x1b, + 0x16, + 0x1e, + 0x5c, + 0x1f, + 0xa7, + 0x42, + 0x5e, + 0x73, + 0x04, + 0x33, + 0x62, + 0x93, + 0x8b, + 0x98, + 0x24, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/6/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/6/src/main.nr new file mode 100644 index 00000000000..5ecb809e68b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6/src/main.nr @@ -0,0 +1,19 @@ +// Sha256 circuit where the input is 5 bytes +// not five field elements since sha256 operates over +// bytes. +// +// If you do not cast, it will take all the bytes from the field element! +// Mimc input is an array of field elements +// The function is called mimc_bn254 to emphasize its parameters are chosen for bn254 curve, it should be used only with a proving system using the same curve (e.g Plonk from Aztec) +use dep::std; + +fn main(x: [u8; 5], result: pub [u8; 32]) { + let mut digest = std::hash::sha256(x); + digest[0] = 5 as u8; + digest = std::hash::sha256(x); + assert(digest == result); + + let y = [12, 45, 78, 41]; + let h = std::hash::mimc::mimc_bn254(y); + assert(h == 18226366069841799622585958305961373004333097209608110160936134895615261821931); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml new file mode 100644 index 00000000000..c75df3e468e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6_array/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "6_array" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/6_array/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/6_array/Prover.toml new file mode 100644 index 00000000000..2e2ed310ba1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6_array/Prover.toml @@ -0,0 +1,8 @@ +x = [104, 101, 108, 108, 111] +y = [10, 81, 18, 48, 0] +z = "59" +t = "10" + +#7128 +#15309 +#16349 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr new file mode 100644 index 00000000000..6aa05f58b71 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr @@ -0,0 +1,53 @@ +use dep::std; +//Basic tests for arrays +fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) { + let mut c = 2301; + z = y[4]; + //Test 1: + for i in 0..5 { + c = z*z*y[i]; + z -= c; + } + assert(z == 0); //y[4]=0, so c and z are always 0 + //Test 2: + c = 2301 as u32; + for i in 0..5 { + c = t+2 as u32; + c = std::wrapping_mul(std::wrapping_mul(z,z),x[i]); + z =std::wrapping_add(z, std::wrapping_sub(x[i]*y[i] , c)); + } + assert(z == 3814912846); + //Test 3: + c = 2300001 as u32; + z = y[4]; + for i in 0..5 { + z = z + x[i]*y[i]; + for _i in 0..3 { + c = std::wrapping_sub(i as u32,2 as u32); + z = std::wrapping_mul(z,c); + } + } + assert(z == 41472); + //Test 4: + z = y[4]; + for i in 0..3 { + z += x[i] * y[i]; + for j in 0..2 { + z += x[i+j] - y[i+j]; + } + } + assert(z == 11539); + //Test 5: + let cc = if z < 1 { x } else { y }; + assert(cc[0] == y[0]); + // Test 6: for-each loops + for y_elem in y { + for x_elem in x { + assert(x_elem != y_elem); + } + } + // Test 7: Arrays of tuples/structs + let mut tuple_array = [(1, 2), (3, 4), (5, 6)]; + tuple_array[1] = (7, 8); + assert(tuple_array[1].1 == 8); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/7/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/7/Nargo.toml new file mode 100644 index 00000000000..f69f89468d7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "7" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/7/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/7/Prover.toml new file mode 100644 index 00000000000..bc3784726d2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7/Prover.toml @@ -0,0 +1,38 @@ + +# hello as bytes +# https://toolkitbay.com/tkb/tool/BLAKE2s_256 +x = [104, 101, 108, 108, 111] +result = [ + 0x19, + 0x21, + 0x3b, + 0xac, + 0xc5, + 0x8d, + 0xee, + 0x6d, + 0xbd, + 0xe3, + 0xce, + 0xb9, + 0xa4, + 0x7c, + 0xbb, + 0x33, + 0x0b, + 0x3d, + 0x86, + 0xf8, + 0xcc, + 0xa8, + 0x99, + 0x7e, + 0xb0, + 0x0b, + 0xe4, + 0x56, + 0xf1, + 0x40, + 0xca, + 0x25, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/7/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/7/src/main.nr new file mode 100644 index 00000000000..a6bba978644 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7/src/main.nr @@ -0,0 +1,10 @@ +// This is the same as Blake2s example. +// +// Pre-alpha dependencies must now be prefixed with the word "dep". +// The line below indicates that we would like to pull in the standard library dependency. +use dep::std; + +fn main(x: [u8; 5], result: [u8; 32]) { + let digest = std::hash::blake2s(x); + assert(digest == result); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml new file mode 100644 index 00000000000..cec14ff7d6a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7_function/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "7_function" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/7_function/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/7_function/Prover.toml new file mode 100644 index 00000000000..9140e7f7530 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7_function/Prover.toml @@ -0,0 +1,6 @@ +x = "59" +y = "5" +a = "1" + +arr1=[3320379920, 1938147428, 1942509796, 1795943184, 24853, 0, 0, 0, 0] +arr2=[2912727897, 3590519536, 1687587470, 3896107618, 1092831095, 0, 0, 0, 0] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr new file mode 100644 index 00000000000..95568dd4ccd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr @@ -0,0 +1,139 @@ +//Tests for function calling +fn f1(mut x: Field) -> Field { + x = x + 1; + x = f2(x); + x +} + +fn f2(mut x: Field) -> Field { + x += 2; + x +} +// Simple example +fn test0(mut a: Field) { + a = f2(a); + assert(a == 3); +} +// Nested call +fn test1(mut a: Field) { + a = f1(a); + assert(a == 4); +} + +fn test2(z: Field, t: u32) { + let a = z + t as Field; + assert(a == 64); + let e = pow(z, t as Field); + assert(e == 714924299); +} + +fn pow(base: Field, exponent: Field) -> Field { + let mut r = 1 as Field; + let b = exponent.to_le_bits(32 as u32); + for i in 1..33 { + r = r*r; + r = (b[32-i] as Field) * (r * base) + (1 - b[32-i] as Field) * r; + } + r +} + +fn test3(x: [u8; 3]) -> [u8; 3] { + let mut buffer = [0 as u8; 3]; + for i in 0..3 { + buffer[i] = x[i]; + } + assert(buffer == x); + buffer +} + +fn test_multiple(x: u32, y: u32) -> (u32, u32) { + (y, x) +} + +fn test_multiple2() -> my_struct { + my_struct { a: 5 as u32, b: 7 as u32 } +} + +fn test_multiple3(x: u32, y: u32) { + assert(x == y); +} + +struct my_struct { + a: u32, + b: u32, +} + +struct my2 { + aa: my_struct, + bb: my_struct, +} + +fn test_multiple4(s: my_struct) { + assert(s.a == s.b + 2); +} + +fn test_multiple5(a: (u32, u32)) { + assert(a.0 == a.1 + 2); +} + +fn test_multiple6(a: my2, b: my_struct, c: (my2, my_struct)) { + test_multiple4(a.aa); + test_multiple5((b.a, b.b)); + assert(c.0.aa.a == c.1.a); +} + +fn foo(a: [Field; N]) -> [Field; N] { + a +} + +fn bar() -> [Field; 1] { + foo([0]) +} + +fn main(x: u32, y: u32, a: Field, arr1: [u32; 9], arr2: [u32; 9]) { + let mut ss: my_struct = my_struct { b: x, a: x + 2 }; + test_multiple4(ss); + test_multiple5((ss.a, ss.b)); + let my = my2 { aa: ss, bb: ss }; + ss.a = 61; + test_multiple6(my, ss, (my, ss)); + + let my_block = { + let mut ab = f2(a); + ab = ab + a; + (x, ab) + }; + assert(my_block.1 == 4); + + test0(a); + test1(a); + test2(x as Field, y); + assert(bar()[0] == 0); + + let mut b = [0 as u8, 5 as u8, 2 as u8]; + let c = test3(b); + assert(b == c); + b[0] = 1 as u8; + let cc = test3(b); + assert(c != cc); + let e = test_multiple(x, y); + assert(e.1 == e.0 + 54 as u32); + let d = test_multiple2(); + assert(d.b == d.a + 2 as u32); + test_multiple3(y, y); + //Regression test for issue #628: + let result = first(arr_to_field(arr1), arr_to_field(arr2)); + assert(result[0] == arr1[0] as Field); +} +// Issue #628 +fn arr_to_field(arr: [u32; 9]) -> [Field; 9] { + let mut as_field: [Field; 9] = [0 as Field; 9]; + for i in 0..9 { + as_field[i] = arr[i] as Field; + } + as_field +} + +fn first(a: [Field; 9], _b: [Field; 9]) -> [Field; 9] { + a +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml new file mode 100644 index 00000000000..c9160aa2592 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "arithmetic_binary_operations" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Prover.toml new file mode 100644 index 00000000000..63382a9f640 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/Prover.toml @@ -0,0 +1,3 @@ +x = "3" +y = "4" +z = "5" diff --git a/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr new file mode 100644 index 00000000000..69554f413a4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr @@ -0,0 +1,15 @@ +// Tests a very simple program. +// +// The features being tested are: +// Binary addition, multiplication, division, constant modulo +// x = 3, y = 4, z = 5 +fn main(x: Field, y: Field, z: Field) -> pub Field { + //cast + assert(y as u1 == 0); + + let a = x + x; // 3 + 3 = 6 + let b = a - y; // 6 - 4 = 2 + let c = b * z; // 2 * 5 = 10 + let d = c / a; // 10 / 6 (This uses field inversion, so we test it by multiplying by `a`) + d * a +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml new file mode 100644 index 00000000000..25684b00377 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "array_dynamic" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Prover.toml new file mode 100644 index 00000000000..750b3129ec9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/Prover.toml @@ -0,0 +1,9 @@ +x = [104, 101, 108, 108, 111] +z = "59" +t = "10" +index = [0,1,2,3,4] +index2 = [0,1,2,3,4] +offset = 1 +sublen = 2 + + diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr new file mode 100644 index 00000000000..9e21334e510 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr @@ -0,0 +1,30 @@ +fn main(x: [u32; 5], mut z: u32, t: u32, index: [Field;5], index2: [Field;5], offset: Field, sublen: Field) { + let idx = (z - 5 * t - 5) as Field; + //dynamic array test + dyn_array(x, idx, idx - 3); + //regression for issue 1283 + let mut s = 0; + let x3 = [246, 159, 32, 176, 8]; + for i in 0..5 { + s += x3[index[i]]; + } + assert(s != 0); + + if 3 < (sublen as u32) { + assert(index[offset + 3] == index2[3]); + } +} + +fn dyn_array(mut x: [u32; 5], y: Field, z: Field) { + assert(x[y] == 111); + assert(x[z] == 101); + x[z] = 0; + assert(x[y] == 111); + assert(x[1] == 0); + if y as u32 < 10 { + x[y] = x[y] - 2; + } else { + x[y] = 0; + } + assert(x[4] == 109); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml new file mode 100644 index 00000000000..1020d4905b1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_eq/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "array_eq" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_eq/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/array_eq/Prover.toml new file mode 100644 index 00000000000..ecfed7de213 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_eq/Prover.toml @@ -0,0 +1,2 @@ +a = [77,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] +b = [77,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_eq/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/array_eq/src/main.nr new file mode 100644 index 00000000000..5bbd595898c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_eq/src/main.nr @@ -0,0 +1,4 @@ +// Simple example of checking where two arrays are equal +fn main(a: [Field; 32], b: [Field; 32]) { + assert(a == b); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml new file mode 100644 index 00000000000..24ac6ff7f13 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_len/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "array_len" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_len/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/array_len/Prover.toml new file mode 100644 index 00000000000..a5ffe607b73 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_len/Prover.toml @@ -0,0 +1,3 @@ +len3 = [1, 2, 3] +len4 = [1, 2, 3, 4] +x = 123 diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_len/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/array_len/src/main.nr new file mode 100644 index 00000000000..b60762f4636 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_len/src/main.nr @@ -0,0 +1,24 @@ +fn len_plus_1(array: [T; N]) -> Field { + array.len() + 1 +} + +fn add_lens(a: [T; N], b: [Field; M]) -> Field { + a.len() + b.len() +} + +fn nested_call(b: [Field; N]) -> Field { + len_plus_1(b) +} + +fn main(x: Field, len3: [u8; 3], len4: [Field; 4]) { + assert(len_plus_1(len3) == 4); + assert(len_plus_1(len4) == 5); + assert(add_lens(len3, len4) == 7); + assert(nested_call(len4) == 5); + // std::array::len returns a compile-time known value + assert(len4[len3.len()] == 4); + // Regression for #1023, ensure .len still works after calling to_le_bytes on a witness. + // This was needed because normally .len is evaluated before acir-gen where to_le_bytes + // on a witness is only evaluated during/after acir-gen. + assert(x.to_le_bytes(8).len() != 0); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml new file mode 100644 index 00000000000..2e4bbdf97ee --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_neq/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "array_neq" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_neq/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/array_neq/Prover.toml new file mode 100644 index 00000000000..3aad77f6d4d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_neq/Prover.toml @@ -0,0 +1,2 @@ +a = [77,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] +b = [44,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_neq/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/array_neq/src/main.nr new file mode 100644 index 00000000000..a3e51dc5066 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_neq/src/main.nr @@ -0,0 +1,4 @@ +// Simple example of checking where two arrays are different +fn main(a: [Field; 32], b: [Field; 32]) { + assert(a != b); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml new file mode 100644 index 00000000000..28e9c65a0dc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_sort/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "array_sort" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_sort/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/array_sort/Prover.toml new file mode 100644 index 00000000000..e0d79da4da6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_sort/Prover.toml @@ -0,0 +1 @@ +xs = [2, 1, 3] diff --git a/noir/tooling/nargo_cli/tests/execution_success/array_sort/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/array_sort/src/main.nr new file mode 100644 index 00000000000..4f40a2cee84 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/array_sort/src/main.nr @@ -0,0 +1,6 @@ +fn main(xs: [u8; 3]) { + let sorted = xs.sort(); + assert(sorted[0] == 1); + assert(sorted[1] == 2); + assert(sorted[2] == 3); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml new file mode 100644 index 00000000000..7780d53459e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "assert" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/assert/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/assert/src/main.nr new file mode 100644 index 00000000000..00e94414c0b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field) { + assert(x == 1); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml new file mode 100644 index 00000000000..c6a1daaed19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "assert_statement" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Prover.toml new file mode 100644 index 00000000000..5d1dc99124f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/Prover.toml @@ -0,0 +1,2 @@ +x = "3" +y = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr new file mode 100644 index 00000000000..2646a0b85c2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr @@ -0,0 +1,7 @@ +// Tests a very simple program. +// +// The features being tested is assertion +fn main(x: Field, y: pub Field) { + assert(x == y, "x and y are not equal"); + assert_eq(x, y, "x and y are not equal"); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml new file mode 100644 index 00000000000..4ef7b3aa5a6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "assign_ex" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Prover.toml new file mode 100644 index 00000000000..8c12ebba6cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "2" diff --git a/noir/tooling/nargo_cli/tests/execution_success/assign_ex/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/src/main.nr new file mode 100644 index 00000000000..b5cfc162cc4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/assign_ex/src/main.nr @@ -0,0 +1,14 @@ +fn main(x: Field, y: Field) { + let mut z = x + y; + assert(z == 3); + z = x * y; + assert(z == 2); + + regression_3057(); +} +// Ensure parsing parenthesized lvalues works +fn regression_3057() { + let mut array = [[0, 1], [2, 3]]; + (array[0])[1] = 2; + assert(array[0][1] == 2); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml new file mode 100644 index 00000000000..e9a28577079 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_and/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bit_and" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_and/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_and/Prover.toml new file mode 100644 index 00000000000..40ce2b0bc27 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_and/Prover.toml @@ -0,0 +1,2 @@ +x = "0x00" +y = "0x10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr new file mode 100644 index 00000000000..0bc1d9a49bd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr @@ -0,0 +1,16 @@ +// You can only do bit operations with integers. +// (Kobi/Daira/Circom/#37) https://github.com/iden3/circom/issues/37 +fn main(x: Field, y: Field) { + let x_as_u8 = x as u8; + let y_as_u8 = y as u8; + + assert((x_as_u8 & y_as_u8) == x_as_u8); + //bitwise and with 1 bit: + let flag = (x == 0) & (y == 16); + assert(flag); + //bitwise and with odd bits: + let x_as_u11 = x as u11; + let y_as_u11 = y as u11; + assert((x_as_u11 & y_as_u11) == x_as_u11); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml new file mode 100644 index 00000000000..81272be4e98 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bit_shifts_comptime" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Prover.toml new file mode 100644 index 00000000000..cfd62c406cb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/Prover.toml @@ -0,0 +1 @@ +x = 64 diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr new file mode 100644 index 00000000000..8afed4c1e1e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr @@ -0,0 +1,21 @@ +fn main(x: u64) { + let two: u64 = 2; + let three: u64 = 3; + // shifts on constant values + assert(two << 2 == 8); + assert((two << 3) / 8 == two); + assert((three >> 1) == 1); + // shifts on runtime values + assert(x << 1 == 128); + assert(x >> 2 == 16); + + regression_2250(); +} + +fn regression_2250() { + let a: u1 = 1 >> 1; + assert(a == 0); + + let b: u32 = 1 >> 32; + assert(b == 0); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml new file mode 100644 index 00000000000..f60c7dbe658 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bit_shifts_runtime" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Prover.toml new file mode 100644 index 00000000000..98d8630792e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/Prover.toml @@ -0,0 +1,2 @@ +x = 64 +y = 1 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/src/main.nr new file mode 100644 index 00000000000..a2c873a7e7f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bit_shifts_runtime/src/main.nr @@ -0,0 +1,8 @@ +fn main(x: u64, y: u64) { + // runtime shifts on compile-time known values + assert(64 << y == 128); + assert(64 >> y == 32); + // runtime shifts on runtime values + assert(x << y == 128); + assert(x >> y == 32); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml new file mode 100644 index 00000000000..fe42e1efa11 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_not/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bool_not" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_not/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/bool_not/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_not/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr new file mode 100644 index 00000000000..935d8cc074d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: u1) { + assert(!x == 0); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml new file mode 100644 index 00000000000..e139a7a2947 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_or/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "bool_or" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_or/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/bool_or/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_or/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr new file mode 100644 index 00000000000..6cb959e61e6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr @@ -0,0 +1,6 @@ +fn main(x: u1, y: u1) { + assert(x | y == 1); + + assert(x | y | x == 1); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml new file mode 100644 index 00000000000..aef4fd56d4f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_acir_as_brillig" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Prover.toml new file mode 100644 index 00000000000..11497a473bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/Prover.toml @@ -0,0 +1 @@ +x = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr new file mode 100644 index 00000000000..5bd6ce0adb2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr @@ -0,0 +1,42 @@ +fn main(x: u32) { + assert(entry_point(x) == 2); + swap_entry_point(x, x + 1); + assert(deep_entry_point(x) == 4); +} + +fn inner(x: u32) -> u32 { + x + 1 +} + +unconstrained fn entry_point(x: u32) -> u32 { + inner(x + 1) +} + +fn swap(x: u32, y: u32) -> (u32, u32) { + (y, x) +} + +unconstrained fn swap_entry_point(x: u32, y: u32) { + let swapped = swap(x, y); + assert(swapped.0 == y); + assert(swapped.1 == x); + let swapped_twice = swap(swapped.0, swapped.1); + assert(swapped_twice.0 == x); + assert(swapped_twice.1 == y); +} + +fn level_3(x: u32) -> u32 { + x + 1 +} + +fn level_2(x: u32) -> u32 { + level_3(x + 1) +} + +fn level_1(x: u32) -> u32 { + level_2(x + 1) +} + +unconstrained fn deep_entry_point(x: u32) -> u32 { + level_1(x + 1) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml new file mode 100644 index 00000000000..a4433e380a9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_arrays" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Prover.toml new file mode 100644 index 00000000000..6371ea2b28b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/Prover.toml @@ -0,0 +1 @@ +x = ["1", "2", "3"] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr new file mode 100644 index 00000000000..e535b6001a4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr @@ -0,0 +1,28 @@ +// Tests a very simple program. +// +// The features being tested are array reads and writes +fn main(x: [Field; 3]) { + read_array(x); + read_write_array(x); +} + +unconstrained fn read_array(x: [Field; 3]) { + assert(x[0] == 1); + let y = [1, 5, 27]; + + assert(y[x[0]] == 5); +} + +unconstrained fn read_write_array(x: [Field; 3]) { + let mut y = x; + + y[0] = 5; + + assert(y[0] == 5); + assert(y[1] == 2); + assert(y[2] == 3); + + assert(x[0] == 1); + assert(x[1] == 2); + assert(x[2] == 3); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml new file mode 100644 index 00000000000..b7d9231ab75 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_assert" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr new file mode 100644 index 00000000000..91e4cebd9d3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr @@ -0,0 +1,12 @@ +// Tests a very simple program. +// +// The features being tested is using assert on brillig +fn main(x: Field) { + assert(1 == conditional(x as bool)); +} + +unconstrained fn conditional(x: bool) -> Field { + assert(x, "x is false"); + assert_eq(x, true, "x is false"); + 1 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml new file mode 100644 index 00000000000..a497b6f48cc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_blake2s" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Prover.toml new file mode 100644 index 00000000000..8f95d95505f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/Prover.toml @@ -0,0 +1,35 @@ +x = [104, 101, 108, 108, 111] +result = [ + 0x19, + 0x21, + 0x3b, + 0xac, + 0xc5, + 0x8d, + 0xee, + 0x6d, + 0xbd, + 0xe3, + 0xce, + 0xb9, + 0xa4, + 0x7c, + 0xbb, + 0x33, + 0x0b, + 0x3d, + 0x86, + 0xf8, + 0xcc, + 0xa8, + 0x99, + 0x7e, + 0xb0, + 0x0b, + 0xe4, + 0x56, + 0xf1, + 0x40, + 0xca, + 0x25, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/src/main.nr new file mode 100644 index 00000000000..5bd52666ae9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_blake2s/src/main.nr @@ -0,0 +1,11 @@ +use dep::std; +// Tests a very simple program. +// +// The features being tested is blake2s in brillig +fn main(x: [u8; 5], result: [u8; 32]) { + assert(blake2s(x) == result); +} + +unconstrained fn blake2s(x: [u8; 5]) -> [u8; 32] { + std::hash::blake2s(x) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml new file mode 100644 index 00000000000..7cc53a33a8a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_calls" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Prover.toml new file mode 100644 index 00000000000..11497a473bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/Prover.toml @@ -0,0 +1 @@ +x = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr new file mode 100644 index 00000000000..5c39713f5bb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr @@ -0,0 +1,58 @@ +// Tests a very simple program. +// +// The features being tested is brillig calls +fn main(x: u32) { + assert(entry_point(x) == 2); + swap_entry_point(x, x + 1); + assert(deep_entry_point(x) == 4); + multiple_values_entry_point(x); +} + +unconstrained fn returns_multiple_values(x: u32) -> (u32, u32, u32, u32) { + (x + 1, x + 2, x + 3, x + 4) +} + +unconstrained fn multiple_values_entry_point(x: u32) { + let (a, b, c, d) = returns_multiple_values(x); + assert(a == x + 1); + assert(b == x + 2); + assert(c == x + 3); + assert(d == x + 4); +} + +unconstrained fn inner(x: u32) -> u32 { + x + 1 +} + +unconstrained fn entry_point(x: u32) -> u32 { + inner(x + 1) +} + +unconstrained fn swap(x: u32, y: u32) -> (u32, u32) { + (y, x) +} + +unconstrained fn swap_entry_point(x: u32, y: u32) { + let swapped = swap(x, y); + assert(swapped.0 == y); + assert(swapped.1 == x); + let swapped_twice = swap(swapped.0, swapped.1); + assert(swapped_twice.0 == x); + assert(swapped_twice.1 == y); +} + +unconstrained fn level_3(x: u32) -> u32 { + x + 1 +} + +unconstrained fn level_2(x: u32) -> u32 { + level_3(x + 1) +} + +unconstrained fn level_1(x: u32) -> u32 { + level_2(x + 1) +} + +unconstrained fn deep_entry_point(x: u32) -> u32 { + level_1(x + 1) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml new file mode 100644 index 00000000000..e360f2d6338 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_calls_array" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Prover.toml new file mode 100644 index 00000000000..99580ca45bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/Prover.toml @@ -0,0 +1 @@ +x = ["1","2","3"] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr new file mode 100644 index 00000000000..1b1d89f6366 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr @@ -0,0 +1,33 @@ +// Tests a very simple program. +// +// The features being tested is brillig calls passing arrays around +fn main(x: [u32; 3]) { + assert(entry_point(x) == 9); + another_entry_point(x); +} + +unconstrained fn inner(x: [u32; 3]) -> [u32; 3] { + [x[0] + 1, x[1] + 1, x[2] + 1] +} + +unconstrained fn entry_point(x: [u32; 3]) -> u32 { + let y = inner(x); + y[0] + y[1] + y[2] +} + +unconstrained fn nested_fn_that_allocates(value: u32) -> u32 { + let x = [value, value, value]; + let y = inner(x); + y[0] + y[1] + y[2] +} + +unconstrained fn another_entry_point(x: [u32; 3]) { + assert(x[0] == 1); + assert(x[1] == 2); + assert(x[2] == 3); + assert(nested_fn_that_allocates(1) == 6); + // x should be unchanged + assert(x[0] == 1); + assert(x[1] == 2); + assert(x[2] == 3); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml new file mode 100644 index 00000000000..1553cd525ff --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_calls_conditionals" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Prover.toml new file mode 100644 index 00000000000..99580ca45bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/Prover.toml @@ -0,0 +1 @@ +x = ["1","2","3"] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr new file mode 100644 index 00000000000..0a1718d0171 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr @@ -0,0 +1,36 @@ +// Tests a very simple program. +// +// The features being tested is brillig calls with conditionals +fn main(x: [u32; 3]) { + assert(entry_point(x[0]) == 7); + assert(entry_point(x[1]) == 8); + assert(entry_point(x[2]) == 9); + assert(entry_point(42) == 0); +} + +unconstrained fn inner_1() -> u32 { + 7 +} + +unconstrained fn inner_2() -> u32 { + 8 +} + +unconstrained fn inner_3() -> u32 { + 9 +} + +unconstrained fn entry_point(x: u32) -> u32 { + let mut result: u32 = 0; + + if x == 1 { + result = inner_1(); + } else if x == 2 { + result = inner_2(); + } else if x == 3 { + result = inner_3(); + } + + result +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml new file mode 100644 index 00000000000..6a8be620fee --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_conditional" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr new file mode 100644 index 00000000000..a59336a877b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr @@ -0,0 +1,10 @@ +// Tests a very simple program. +// +// The features being tested is basic conditonal on brillig +fn main(x: Field) { + assert(4 == conditional(x == 1)); +} + +unconstrained fn conditional(x: bool) -> Field { + if x { 4 } else { 5 } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml new file mode 100644 index 00000000000..972dd9ce93b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_ecdsa" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Prover.toml new file mode 100644 index 00000000000..e78fc19cb71 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/Prover.toml @@ -0,0 +1,169 @@ + +hashed_message = [ + 0x3a, + 0x73, + 0xf4, + 0x12, + 0x3a, + 0x5c, + 0xd2, + 0x12, + 0x1f, + 0x21, + 0xcd, + 0x7e, + 0x8d, + 0x35, + 0x88, + 0x35, + 0x47, + 0x69, + 0x49, + 0xd0, + 0x35, + 0xd9, + 0xc2, + 0xda, + 0x68, + 0x06, + 0xb4, + 0x63, + 0x3a, + 0xc8, + 0xc1, + 0xe2, +] +pub_key_x = [ + 0xa0, + 0x43, + 0x4d, + 0x9e, + 0x47, + 0xf3, + 0xc8, + 0x62, + 0x35, + 0x47, + 0x7c, + 0x7b, + 0x1a, + 0xe6, + 0xae, + 0x5d, + 0x34, + 0x42, + 0xd4, + 0x9b, + 0x19, + 0x43, + 0xc2, + 0xb7, + 0x52, + 0xa6, + 0x8e, + 0x2a, + 0x47, + 0xe2, + 0x47, + 0xc7, +] +pub_key_y = [ + 0x89, + 0x3a, + 0xba, + 0x42, + 0x54, + 0x19, + 0xbc, + 0x27, + 0xa3, + 0xb6, + 0xc7, + 0xe6, + 0x93, + 0xa2, + 0x4c, + 0x69, + 0x6f, + 0x79, + 0x4c, + 0x2e, + 0xd8, + 0x77, + 0xa1, + 0x59, + 0x3c, + 0xbe, + 0xe5, + 0x3b, + 0x03, + 0x73, + 0x68, + 0xd7, +] +signature = [ + 0xe5, + 0x08, + 0x1c, + 0x80, + 0xab, + 0x42, + 0x7d, + 0xc3, + 0x70, + 0x34, + 0x6f, + 0x4a, + 0x0e, + 0x31, + 0xaa, + 0x2b, + 0xad, + 0x8d, + 0x97, + 0x98, + 0xc3, + 0x80, + 0x61, + 0xdb, + 0x9a, + 0xe5, + 0x5a, + 0x4e, + 0x8d, + 0xf4, + 0x54, + 0xfd, + 0x28, + 0x11, + 0x98, + 0x94, + 0x34, + 0x4e, + 0x71, + 0xb7, + 0x87, + 0x70, + 0xcc, + 0x93, + 0x1d, + 0x61, + 0xf4, + 0x80, + 0xec, + 0xbb, + 0x0b, + 0x89, + 0xd6, + 0xeb, + 0x69, + 0x69, + 0x01, + 0x61, + 0xe4, + 0x9a, + 0x71, + 0x5f, + 0xcd, + 0x55, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/src/main.nr new file mode 100644 index 00000000000..23f017aa336 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_ecdsa/src/main.nr @@ -0,0 +1,11 @@ +use dep::std; +// Tests a very simple program. +// +// The features being tested is ecdsa in brillig +fn main(hashed_message: [u8;32], pub_key_x: [u8;32], pub_key_y: [u8;32], signature: [u8;64]) { + assert(ecdsa(hashed_message, pub_key_x, pub_key_y, signature)); +} + +unconstrained fn ecdsa(hashed_message: [u8;32], pub_key_x: [u8;32], pub_key_y: [u8;32], signature: [u8;64]) -> bool { + std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml new file mode 100644 index 00000000000..decd9a9412a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_fns_as_values" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Prover.toml new file mode 100644 index 00000000000..11497a473bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/Prover.toml @@ -0,0 +1 @@ +x = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr new file mode 100644 index 00000000000..2f5d14583d5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr @@ -0,0 +1,36 @@ +use dep::std; + +struct MyStruct { + operation: fn (u32) -> u32, +} + +fn main(x: u32) { + assert(wrapper(increment, x) == x + 1); + assert(wrapper(increment_acir, x) == x + 1); + assert(wrapper(decrement, x) == std::wrapping_sub(x, 1)); + assert(wrapper_with_struct(MyStruct { operation: increment }, x) == x + 1); + assert(wrapper_with_struct(MyStruct { operation: decrement }, x) == std::wrapping_sub(x, 1)); + // https://github.com/noir-lang/noir/issues/1975 + assert(increment(x) == x + 1); +} + +unconstrained fn wrapper(func: fn (u32) -> u32, param: u32) -> u32 { + func(param) +} + +unconstrained fn increment(x: u32) -> u32 { + x + 1 +} + +unconstrained fn decrement(x: u32) -> u32 { + x - 1 +} + +unconstrained fn wrapper_with_struct(my_struct: MyStruct, param: u32) -> u32 { + let func = my_struct.operation; + func(param) +} + +fn increment_acir(x: u32) -> u32 { + x + 1 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml new file mode 100644 index 00000000000..7cfcc745f0d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_hash_to_field" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Prover.toml new file mode 100644 index 00000000000..ecdcfd1fb00 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/Prover.toml @@ -0,0 +1 @@ +input = "27" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/src/main.nr new file mode 100644 index 00000000000..4b4177a521e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_hash_to_field/src/main.nr @@ -0,0 +1,11 @@ +use dep::std; +// Tests a very simple program. +// +// The features being tested is hash_to_field in brillig +fn main(input: Field) -> pub Field { + hash_to_field(input) +} + +unconstrained fn hash_to_field(input: Field) -> Field { + std::hash::hash_to_field([input]) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml new file mode 100644 index 00000000000..8196884fe2b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_identity_function" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Prover.toml new file mode 100644 index 00000000000..55cccb955a9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/Prover.toml @@ -0,0 +1,2 @@ +x = "3" + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr new file mode 100644 index 00000000000..f41188b1f0d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr @@ -0,0 +1,32 @@ +struct myStruct { + foo: Field, + foo_arr: [Field; 2], +} +// Tests a very simple program. +// +// The features being tested is the identity function in Brillig +fn main(x: Field) { + assert(x == identity(x)); + // TODO: add support for array comparison + let arr = identity_array([x, x]); + assert(x == arr[0]); + assert(x == arr[1]); + + let s = myStruct { foo: x, foo_arr: [x, x] }; + let identity_struct = identity_struct(s); + assert(x == identity_struct.foo); + assert(x == identity_struct.foo_arr[0]); + assert(x == identity_struct.foo_arr[1]); +} + +unconstrained fn identity(x: Field) -> Field { + x +} + +unconstrained fn identity_array(arr: [Field; 2]) -> [Field; 2] { + arr +} + +unconstrained fn identity_struct(s: myStruct) -> myStruct { + s +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml new file mode 100644 index 00000000000..8cacf2186b8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_keccak" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Prover.toml new file mode 100644 index 00000000000..d65c4011d3f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/Prover.toml @@ -0,0 +1,35 @@ +x = 0xbd +result = [ + 0x5a, + 0x50, + 0x2f, + 0x9f, + 0xca, + 0x46, + 0x7b, + 0x26, + 0x6d, + 0x5b, + 0x78, + 0x33, + 0x65, + 0x19, + 0x37, + 0xe8, + 0x05, + 0x27, + 0x0c, + 0xa3, + 0xf3, + 0xaf, + 0x1c, + 0x0d, + 0xd2, + 0x46, + 0x2d, + 0xca, + 0x4b, + 0x3b, + 0x1a, + 0xbf, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr new file mode 100644 index 00000000000..1e9b65a6eb4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr @@ -0,0 +1,25 @@ +use dep::std; +// Tests a very simple program. +// +// The features being tested is keccak256 in brillig +fn main(x: Field, result: [u8; 32]) { + // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field + // The padding is taken care of by the program + let digest = keccak256([x as u8], 1); + assert(digest == result); + //#1399: variable meesage size + let message_size = 4; + let hash_a = keccak256([1, 2, 3, 4], message_size); + let hash_b = keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size); + + assert(hash_a == hash_b); + + let message_size_big = 8; + let hash_c = keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size_big); + + assert(hash_a != hash_c); +} + +unconstrained fn keccak256(data: [u8; N], msg_len: u32) -> [u8; 32] { + std::hash::keccak256(data, msg_len) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml new file mode 100644 index 00000000000..1212397c4db --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_loop" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Prover.toml new file mode 100644 index 00000000000..22cd5b7c12f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/Prover.toml @@ -0,0 +1 @@ +sum = "6" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr new file mode 100644 index 00000000000..05d35469342 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr @@ -0,0 +1,23 @@ +// Tests a very simple program. +// +// The features being tested is basic looping on brillig +fn main(sum: u32) { + assert(loop(4) == sum); + assert(plain_loop() == sum); +} + +unconstrained fn loop(x: u32) -> u32 { + let mut sum = 0; + for i in 0..x { + sum = sum + i; + } + sum +} + +unconstrained fn plain_loop() -> u32 { + let mut sum = 0; + for i in 0..4 { + sum = sum + i; + } + sum +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml new file mode 100644 index 00000000000..c36c8a0a2bd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "brillig_nested_arrays" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Prover.toml new file mode 100644 index 00000000000..26fdbc19975 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/Prover.toml @@ -0,0 +1,2 @@ +x = "0" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/src/main.nr new file mode 100644 index 00000000000..d0a60ac0a58 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_arrays/src/main.nr @@ -0,0 +1,30 @@ +struct Header { + params: [Field; 3], +} + +struct MyNote { + plain: Field, + array: [Field; 2], + header: Header, +} + +unconstrained fn access_nested(notes: [MyNote; 2], x: Field, y: Field) -> Field { + notes[x].array[y] + notes[y].array[x] + notes[x].plain + notes[y].header.params[x] +} + +unconstrained fn create_inside_brillig(x: Field, y: Field) { + let header = Header { params: [1, 2, 3] }; + let note0 = MyNote { array: [1, 2], plain: 3, header }; + let note1 = MyNote { array: [4, 5], plain: 6, header }; + assert(access_nested([note0, note1], x, y) == (2 + 4 + 3 + 1)); +} + +fn main(x: Field, y: Field) { + let header = Header { params: [1, 2, 3] }; + let note0 = MyNote { array: [1, 2], plain: 3, header }; + let note1 = MyNote { array: [4, 5], plain: 6, header }; + + create_inside_brillig(x, y); + assert(access_nested([note0, note1], x, y) == (2 + 4 + 3 + 1)); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml new file mode 100644 index 00000000000..d84338cdbb4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "brillig_nested_slices" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Prover.toml new file mode 100644 index 00000000000..c52564de922 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/Prover.toml @@ -0,0 +1,2 @@ +a = "5" +b = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/src/main.nr new file mode 100644 index 00000000000..3d8a6748ccf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_nested_slices/src/main.nr @@ -0,0 +1,72 @@ +use dep::std::slice; +// Tests nested slice passing to/from functions +unconstrained fn push_back_to_slice(slice: [T], item: T) -> [T] { + slice.push_back(item) +} + +struct NestedSliceStruct { + id: Field, + arr: [Field] +} + +unconstrained fn create_foo(id: Field, value: Field) -> NestedSliceStruct { + let mut arr = [id]; + arr = arr.push_back(value); + NestedSliceStruct { id, arr } +} + +unconstrained fn main(a: Field, b: Field) { + let mut slice = [create_foo(a, b), create_foo(b, a)]; + assert(slice.len() == 2); + + assert(slice[0].id == a); + assert(slice[0].arr[0] == a); + assert(slice[1].id == b); + assert(slice[1].arr[1] == a); + + slice = push_back_to_slice(slice, create_foo(0, 42)); + assert(slice.len() == 3); + + assert(slice[0].id == a); + assert(slice[0].arr[0] == a); + assert(slice[1].id == b); + assert(slice[1].arr[1] == a); + + assert(slice[2].id == 0); + assert(slice[2].arr[0] == 0); + assert(slice[2].arr[1] == 42); + + slice = slice.push_front(create_foo(1, 43)); + slice = slice.push_back(create_foo(2, 44)); + + assert(slice.len() == 5); + + let pop_front_result = slice.pop_front(); + slice = pop_front_result.1; + assert(pop_front_result.0.id == 1); + + let pop_back_result = slice.pop_back(); + slice = pop_back_result.0; + assert(pop_back_result.1.id == 2); + + assert(slice.len() == 3); + + let mut remove_result = slice.remove(0); + slice = remove_result.0; + let mut removed_item = remove_result.1; + assert(removed_item.arr[0] == a); + + remove_result = slice.remove(1); + slice = remove_result.0; + removed_item = remove_result.1; + assert(removed_item.arr[0] == 0); + + let last_item = slice[0]; + + assert(last_item.id == b); + slice = slice.insert(1, removed_item); + + assert(slice.len() == 2); + assert(slice[0].id == b); + assert(slice[1].id == 0); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml new file mode 100644 index 00000000000..ef882ea8da0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_not" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr new file mode 100644 index 00000000000..d34b3edb4b6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr @@ -0,0 +1,11 @@ +// Tests a very simple Brillig function. +// +// The features being tested is not instruction on brillig +fn main(x: Field, y: Field) { + assert(false == not_operator(x as bool)); + assert(true == not_operator(y as bool)); +} + +unconstrained fn not_operator(x: bool) -> bool { + !x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml new file mode 100644 index 00000000000..13bd913cef7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_oracle" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Prover.toml new file mode 100644 index 00000000000..2b26a4ce471 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/Prover.toml @@ -0,0 +1,2 @@ +x = "10" + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr new file mode 100644 index 00000000000..86cf6ff1498 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr @@ -0,0 +1,26 @@ +use dep::std::slice; +// Tests oracle usage in brillig/unconstrained functions +fn main(x: Field) { + get_number_sequence_wrapper(20); +} +// TODO(#1911): This function does not need to be an oracle but acts +// as a useful test while we finalize code generation for slices in Brillig +#[oracle(get_number_sequence)] +unconstrained fn get_number_sequence(_size: Field) -> [Field] {} +// TODO(#1911) +#[oracle(get_reverse_number_sequence)] +unconstrained fn get_reverse_number_sequence(_size: Field) -> [Field] {} + +unconstrained fn get_number_sequence_wrapper(size: Field) { + let slice = get_number_sequence(size); + for i in 0..19 as u32 { + assert(slice[i] == i as Field); + } + + let reversed_slice = get_reverse_number_sequence(size); + // Regression test that we have not overwritten memory + for i in 0..19 as u32 { + assert(slice[i] == reversed_slice[19 - i]); + } +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml new file mode 100644 index 00000000000..6327caa0a09 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_pedersen" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Prover.toml new file mode 100644 index 00000000000..db1ebdf6c51 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/Prover.toml @@ -0,0 +1,7 @@ +x = "0" +y = "1" +salt = "42" + +out_x = "0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402" +out_y = "0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126" +out_hash = "0x0d98561fb02ca04d00801dfdc118b2a24cea0351963587712a28d368041370e1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr new file mode 100644 index 00000000000..2379818c454 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr @@ -0,0 +1,22 @@ +use dep::std; + +unconstrained fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field, out_hash: Field) { + let res = std::hash::pedersen_commitment_with_separator([x, y], 0); + assert(res.x == out_x); + assert(res.y == out_y); + + let res_hash = std::hash::pedersen_hash_with_separator([x, y], 0); + assert_eq(res_hash, out_hash); + + assert(res_hash != res.x); + + let raw_data = [x, y]; + let mut state = 0; + for i in 0..(2 as u32) { + state = state * 8 + raw_data[i]; + } + state += salt; + let hash = std::hash::pedersen_commitment_with_separator([state], 0); + assert(std::hash::pedersen_commitment_with_separator([43], 0).x == hash.x); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml new file mode 100644 index 00000000000..087eeefd5ac --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_recursion" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Prover.toml new file mode 100644 index 00000000000..3a627b9188b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/Prover.toml @@ -0,0 +1 @@ +x = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr new file mode 100644 index 00000000000..a87ef28bc56 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr @@ -0,0 +1,14 @@ +// Tests a very simple program. +// +// The feature being tested is brillig recursion +fn main(x: u32) { + assert(fibonacci(x) == 55); +} + +unconstrained fn fibonacci(x: u32) -> u32 { + if x <= 1 { + x + } else { + fibonacci(x - 1) + fibonacci(x - 2) + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml new file mode 100644 index 00000000000..0f64b862ba0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_references" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Prover.toml new file mode 100644 index 00000000000..151faa5a9b1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/Prover.toml @@ -0,0 +1 @@ +x = "2" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_references/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/src/main.nr new file mode 100644 index 00000000000..e1f906beb0a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_references/src/main.nr @@ -0,0 +1,49 @@ +unconstrained fn main(mut x: Field) { + add1(&mut x); + assert(x == 3); + // https://github.com/noir-lang/noir/issues/1899 + // let mut s = S { y: x }; + // s.add2(); + // assert(s.y == 5); + // Test that normal mutable variables are still copied + let mut a = 0; + mutate_copy(a); + assert(a == 0); + // Test something 3 allocations deep + let mut nested_allocations = Nested { y: &mut &mut 0 }; + add1(*nested_allocations.y); + assert(**nested_allocations.y == 1); + // Test nested struct allocations with a mutable reference to an array. + let mut c = C { foo: 0, bar: &mut C2 { array: &mut [1, 2] } }; + *c.bar.array = [3, 4]; + let arr: [Field; 2] = *c.bar.array; + assert(arr[0] == 3); + assert(arr[1] == 4); +} + +unconstrained fn add1(x: &mut Field) { + *x += 1; +} + +struct S { y: Field } + +struct Nested { y: &mut &mut Field } + +struct C { + foo: Field, + bar: &mut C2, +} + +struct C2 { + array: &mut [Field; 2] +} + +impl S { + unconstrained fn add2(&mut self) { + self.y += 2; + } +} + +unconstrained fn mutate_copy(mut a: Field) { + a = 7; +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml new file mode 100644 index 00000000000..eefd041b899 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_scalar_mul" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Prover.toml new file mode 100644 index 00000000000..69b91cb5f31 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/Prover.toml @@ -0,0 +1,7 @@ +a = "1" +a_pub_x = "0x0000000000000000000000000000000000000000000000000000000000000001" +a_pub_y = "0x0000000000000002cf135e7506a45d632d270d45f1181294833fc48d823f272c" + +b = "2" +b_pub_x = "0x06ce1b0827aafa85ddeb49cdaa36306d19a74caa311e13d46d8bc688cdbffffe" +b_pub_y = "0x1c122f81a3a14964909ede0ba2a6855fc93faf6fa1a788bf467be7e7a43f80ac" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr new file mode 100644 index 00000000000..30c51ce0f50 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr @@ -0,0 +1,16 @@ +use dep::std; + +unconstrained fn main(a: Field, a_pub_x: pub Field, a_pub_y: pub Field, b: Field, b_pub_x: pub Field, b_pub_y: pub Field) { + let mut priv_key = a; + let mut pub_x: Field = a_pub_x; + let mut pub_y: Field = a_pub_y; + if a != 1 { + // Change `a` in Prover.toml to test input `b` + priv_key = b; + pub_x = b_pub_x; + pub_y = b_pub_y; + } + let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); + assert(res[0] == pub_x); + assert(res[1] == pub_y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml new file mode 100644 index 00000000000..1b598abbf74 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_schnorr" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Prover.toml new file mode 100644 index 00000000000..2faf2018e07 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/Prover.toml @@ -0,0 +1,70 @@ +message = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +message_field = "0x010203040506070809" +pub_key_x = "0x04b260954662e97f00cab9adb773a259097f7a274b83b113532bce27fa3fb96a" +pub_key_y = "0x2fd51571db6c08666b0edfbfbc57d432068bccd0110a39b166ab243da0037197" +signature = [ + 1, + 13, + 119, + 112, + 212, + 39, + 233, + 41, + 84, + 235, + 255, + 93, + 245, + 172, + 186, + 83, + 157, + 253, + 76, + 77, + 33, + 128, + 178, + 15, + 214, + 67, + 105, + 107, + 177, + 234, + 77, + 48, + 27, + 237, + 155, + 84, + 39, + 84, + 247, + 27, + 22, + 8, + 176, + 230, + 24, + 115, + 145, + 220, + 254, + 122, + 135, + 179, + 171, + 4, + 214, + 202, + 64, + 199, + 19, + 84, + 239, + 138, + 124, + 12, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/src/main.nr new file mode 100644 index 00000000000..107b311f6ab --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_schnorr/src/main.nr @@ -0,0 +1,19 @@ +use dep::std; +// Note: If main has any unsized types, then the verifier will never be able +// to figure out the circuit instance +unconstrained fn main(message: [u8; 10], message_field: Field, pub_key_x: Field, pub_key_y: Field, signature: [u8; 64]) { + // Regression for issue #2421 + // We want to make sure that we can accurately verify a signature whose message is a slice vs. an array + let message_field_bytes = message_field.to_be_bytes(10); + for i in 0..10 { + assert(message[i] == message_field_bytes[i]); + } + // Is there ever a situation where someone would want + // to ensure that a signature was invalid? + // Check that passing a slice as the message is valid + let valid_signature = std::schnorr::verify_signature(pub_key_x, pub_key_y, signature, message_field_bytes); + assert(valid_signature); + // Check that passing an array as the message is valid + let valid_signature = std::schnorr::verify_signature(pub_key_x, pub_key_y, signature, message); + assert(valid_signature); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml new file mode 100644 index 00000000000..7140fa0fd0b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_sha256" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Prover.toml new file mode 100644 index 00000000000..374ae90ad78 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/Prover.toml @@ -0,0 +1,35 @@ +x = 0xbd +result = [ + 0x68, + 0x32, + 0x57, + 0x20, + 0xaa, + 0xbd, + 0x7c, + 0x82, + 0xf3, + 0x0f, + 0x55, + 0x4b, + 0x31, + 0x3d, + 0x05, + 0x70, + 0xc9, + 0x5a, + 0xcc, + 0xbb, + 0x7d, + 0xc4, + 0xb5, + 0xaa, + 0xe1, + 0x12, + 0x04, + 0xc0, + 0x8f, + 0xfe, + 0x73, + 0x2b, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/src/main.nr new file mode 100644 index 00000000000..e76109df9c3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_sha256/src/main.nr @@ -0,0 +1,14 @@ +use dep::std; +// Tests a very simple program. +// +// The features being tested is sha256 in brillig +fn main(x: Field, result: [u8; 32]) { + assert(result == sha256(x)); +} + +unconstrained fn sha256(x: Field) -> [u8; 32] { + // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field + // The padding is taken care of by the program + std::hash::sha256([x as u8]) +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml new file mode 100644 index 00000000000..5f6caad088a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "brillig_slices" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/src/main.nr new file mode 100644 index 00000000000..48bc8a76bb8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_slices/src/main.nr @@ -0,0 +1,140 @@ +use dep::std::slice; +unconstrained fn main(x: Field, y: Field) { + let mut slice: [Field] = [y, x]; + assert(slice.len() == 2); + + slice = slice.push_back(7); + assert(slice.len() == 3); + assert(slice[0] == y); + assert(slice[1] == x); + assert(slice[2] == 7); + // Array set on slice target + slice[0] = x; + slice[1] = y; + slice[2] = 1; + + assert(slice[0] == x); + assert(slice[1] == y); + assert(slice[2] == 1); + + slice = push_front_to_slice(slice, 2); + assert(slice.len() == 4); + assert(slice[0] == 2); + assert(slice[1] == x); + assert(slice[2] == y); + assert(slice[3] == 1); + + let (item, popped_front_slice) = slice.pop_front(); + slice = popped_front_slice; + assert(item == 2); + + assert(slice.len() == 3); + assert(slice[0] == x); + assert(slice[1] == y); + assert(slice[2] == 1); + + let (popped_back_slice, another_item) = slice.pop_back(); + slice = popped_back_slice; + assert(another_item == 1); + + assert(slice.len() == 2); + assert(slice[0] == x); + assert(slice[1] == y); + + slice = slice.insert(1, 2); + assert(slice.len() == 3); + assert(slice[0] == x); + assert(slice[1] == 2); + assert(slice[2] == y); + + let (removed_slice, should_be_2) = slice.remove(1); + slice = removed_slice; + assert(should_be_2 == 2); + + assert(slice.len() == 2); + assert(slice[0] == x); + assert(slice[1] == y); + + let (slice_with_only_x, should_be_y) = slice.remove(1); + slice = slice_with_only_x; + assert(should_be_y == y); + + assert(slice.len() == 1); + assert(slice[0] == x); + + let (empty_slice, should_be_x) = slice.remove(0); + assert(should_be_x == x); + assert(empty_slice.len() == 0); + + regression_merge_slices(x, y); +} +// Tests slice passing to/from functions +unconstrained fn push_front_to_slice(slice: [T], item: T) -> [T] { + slice.push_front(item) +} +// The parameters to this function must come from witness values (inputs to main) +unconstrained fn regression_merge_slices(x: Field, y: Field) { + merge_slices_if(x, y); + merge_slices_else(x); +} + +unconstrained fn merge_slices_if(x: Field, y: Field) { + let slice = merge_slices_return(x, y); + assert(slice[2] == 10); + assert(slice.len() == 3); + + let slice = merge_slices_mutate(x, y); + assert(slice[3] == 5); + assert(slice.len() == 4); + + let slice = merge_slices_mutate_in_loop(x, y); + assert(slice[6] == 4); + assert(slice.len() == 7); +} + +unconstrained fn merge_slices_else(x: Field) { + let slice = merge_slices_return(x, 5); + assert(slice[0] == 0); + assert(slice[1] == 0); + assert(slice.len() == 2); + + let slice = merge_slices_mutate(x, 5); + assert(slice[2] == 5); + assert(slice.len() == 3); + + let slice = merge_slices_mutate_in_loop(x, 5); + assert(slice[2] == 5); + assert(slice.len() == 3); +} +// Test returning a merged slice without a mutation +unconstrained fn merge_slices_return(x: Field, y: Field) -> [Field] { + let slice = [0; 2]; + if x != y { + if x != 20 { slice.push_back(y) } else { slice } + } else { + slice + } +} +// Test mutating a slice inside of an if statement +unconstrained fn merge_slices_mutate(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + slice +} +// Test mutating a slice inside of a loop in an if statement +unconstrained fn merge_slices_mutate_in_loop(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + for i in 0..5 { + slice = slice.push_back(i); + } + } else { + slice = slice.push_back(x); + } + slice +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml new file mode 100644 index 00000000000..df6c818c90f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_to_be_bytes" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Prover.toml new file mode 100644 index 00000000000..07fe857ac7c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/Prover.toml @@ -0,0 +1 @@ +x = "2040124" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/src/main.nr new file mode 100644 index 00000000000..9d78411f060 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_be_bytes/src/main.nr @@ -0,0 +1,12 @@ +unconstrained fn main(x: Field) -> pub [u8; 31] { + // The result of this byte array will be big-endian + let byte_array = x.to_be_bytes(31); + let mut bytes = [0; 31]; + for i in 0..31 { + bytes[i] = byte_array[i]; + } + assert(bytes[30] == 60); + assert(bytes[29] == 33); + assert(bytes[28] == 31); + bytes +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml new file mode 100644 index 00000000000..991f3d1e46c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_to_bytes_integration" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Prover.toml new file mode 100644 index 00000000000..23f7acea449 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/Prover.toml @@ -0,0 +1,2 @@ +x = "2040124" +_y = "0x2000000000000000000000000000000000000000000000000000000000000000" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr new file mode 100644 index 00000000000..e8e5b9db9ca --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr @@ -0,0 +1,27 @@ +use dep::std; + +unconstrained fn main(x: Field, _y: Field) { + // The result of this byte array will be big-endian + let y: Field = 2040124; + let be_byte_array = y.to_be_bytes(31); + // The result of this byte array will be little-endian + let le_byte_array = x.to_le_bytes(31); + + assert(le_byte_array[0] == 60); + assert(le_byte_array[0] == be_byte_array[30]); + assert(le_byte_array[1] == be_byte_array[29]); + assert(le_byte_array[2] == be_byte_array[28]); + + let z = 0 - 1; + let p_bytes = std::field::modulus_le_bytes(); + let z_bytes = z.to_le_bytes(32); + assert(p_bytes[10] == z_bytes[10]); + assert(p_bytes[0] == z_bytes[0] as u8 + 1 as u8); + + let p_bits = std::field::modulus_le_bits(); + let z_bits = z.to_le_bits(std::field::modulus_num_bits() as u32); + assert(z_bits[0] == 0); + assert(p_bits[100] == z_bits[100]); + + _y.to_le_bits(std::field::modulus_num_bits() as u32); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml new file mode 100644 index 00000000000..c2ce8ad01b5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_to_le_bytes" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Prover.toml new file mode 100644 index 00000000000..07fe857ac7c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/Prover.toml @@ -0,0 +1 @@ +x = "2040124" diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/src/main.nr new file mode 100644 index 00000000000..77d292cf01b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_to_le_bytes/src/main.nr @@ -0,0 +1,10 @@ +unconstrained fn main(x: Field) -> pub [u8; 31] { + // The result of this byte array will be little-endian + let byte_array = x.to_le_bytes(31); + assert(byte_array.len() == 31); + let mut bytes = [0; 31]; + for i in 0..31 { + bytes[i] = byte_array[i]; + } + bytes +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml new file mode 100644 index 00000000000..f74a2a82964 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_top_level" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Prover.toml new file mode 100644 index 00000000000..a0150a0e562 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +array = ["4", "5", "6"] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr new file mode 100644 index 00000000000..6dfd98b2c3e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr @@ -0,0 +1,6 @@ +// Tests a very simple program. +// +// The feature being tested is brillig as the entry point. +unconstrained fn main(array: [Field; 3], x: pub Field) -> pub [Field; 2] { + [array[x], array[x + 1]] +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml new file mode 100644 index 00000000000..f23ecc787d0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "brillig_unitialised_arrays" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Prover.toml new file mode 100644 index 00000000000..b6626a67e19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 0 diff --git a/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr new file mode 100644 index 00000000000..5ec657b0d35 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr @@ -0,0 +1,12 @@ +fn main(x: Field, y: Field) -> pub Field { + let notes = create_notes(x, y); + sum_x(notes, x, y) +} + +fn sum_x(notes: [Field; 2], x: Field, y: Field) -> Field { + notes[x] + notes[y] +} + +unconstrained fn create_notes(x: Field, y: Field) -> [Field; 2] { + [x, y] +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml new file mode 100644 index 00000000000..6571019494e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "cast_bool" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Prover.toml new file mode 100644 index 00000000000..f489cbac003 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/Prover.toml @@ -0,0 +1,2 @@ +x = "10" +y = "10" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr new file mode 100644 index 00000000000..422d3b98f83 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr @@ -0,0 +1,6 @@ +fn main(x: Field, y: Field) { + let z = x == y; + let t = z as u8; + assert(t == 1); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml new file mode 100644 index 00000000000..01936c7be65 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "closures_mut_ref" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Prover.toml new file mode 100644 index 00000000000..11497a473bc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/Prover.toml @@ -0,0 +1 @@ +x = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr new file mode 100644 index 00000000000..5a743d1b633 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr @@ -0,0 +1,30 @@ +fn main(mut x: Field) { + let one = 1; + let add1 = |z| { + *z = *z + one; + }; + + let two = 2; + let add2 = |z| { + *z = *z + two; + }; + + add1(&mut x); + assert(x == 1); + + add2(&mut x); + assert(x == 3); + + issue_2120(); +} +// https://github.com/noir-lang/noir/issues/2120 +fn issue_2120() { + let x1 = &mut 42; + let set_x1 = |y| { *x1 = y; }; + + assert(*x1 == 42); + set_x1(44); + assert(*x1 == 44); + set_x1(*x1); + assert(*x1 == 44); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml new file mode 100644 index 00000000000..28ca01332df --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_1" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Prover.toml new file mode 100644 index 00000000000..baad8be126a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/Prover.toml @@ -0,0 +1,38 @@ +c=[2, 4, 3, 0, ] +a=0 +x = [104, 101, 108, 108, 111] + +result = [ + 0x2c, + 0xf2, + 0x4d, + 0xba, + 0x5f, + 0xb0, + 0xa3, + 0x0e, + 0x26, + 0xe8, + 0x3b, + 0x2a, + 0xc5, + 0xb9, + 0xe2, + 0x9e, + 0x1b, + 0x16, + 0x1e, + 0x5c, + 0x1f, + 0xa7, + 0x42, + 0x5e, + 0x73, + 0x04, + 0x33, + 0x62, + 0x93, + 0x8b, + 0x98, + 0x24, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr new file mode 100644 index 00000000000..5064c82bce9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr @@ -0,0 +1,93 @@ +use dep::std; + +fn sort(mut a: [u32; 4]) -> [u32; 4] { + for i in 1..4 { + for j in 0..i { + if a[i] < a[j] { + let c = a[j]; + a[j] = a[i]; + a[i] = c; + } + } + } + a +} + +fn must_be_zero(x: u8) { + assert(x == 0); +} + +fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { + //Test case for short-circuit + let mut data = [0 as u32; 32]; + let mut ba = a; + for i in 0..32 { + let i_u32 = i as u32; + if i_u32 == a { + for j in 0..4 { + data[i + j] = c[4 - 1 - j]; + for k in 0..4 { + ba = ba +data[k]; + } + if ba == 4864 { + c[3]=ba; + } + } + } + } + assert(data[31] == 0); + assert(ba != 13); + //Test case for conditional with arrays from function parameters + let b = sort([1, 2, 3, 4]); + assert(b[0] == 1); + + if a == 0 { + must_be_zero(0); + c[0] = 3; + } else { + must_be_zero(1); + c[0] = 1; + c[1] = c[2] / a + 11 % a; + let f1 = a as Field; + assert(10 / f1 != 0); + } + assert(c[0] == 3); + + let mut y = 0; + if a == 0 { + let digest = std::hash::sha256(x); + y = digest[0]; + } else { + y = 5; + } + assert(y == result[0]); + c = sort(c); + assert(c[0] == 0); + //test 1 + let mut x: u32 = 0; + if a == 0 { + c[0] = 12; + if a != 0 { + x = 6; + } else { + x = 2; + assert(x == 2); + } + } else { + x = 5; + assert(x == 5); + } + if c[0] == 0 { + x = 3; + } + assert(x == 2); + //test2: loops + let mut x: u32 = 0; + x = a - a; + for i in 0..4 { + if c[i] == 0 { + x = i as u32 +2; + } + } + assert(x == 0); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml new file mode 100644 index 00000000000..153c5d38b99 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_2" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Prover.toml new file mode 100644 index 00000000000..73fa4a5e31a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/Prover.toml @@ -0,0 +1,2 @@ +c=[2, 4, 3, 0, ] +a=0 diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr new file mode 100644 index 00000000000..5b3f64f6be5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr @@ -0,0 +1,51 @@ +use dep::std; + +fn must_be_zero(x: u8) { + assert(x == 0); +} + +fn test3(x: u8) { + if x == 0 { + must_be_zero(x); + } +} + +fn test4() -> [u32; 4] { + let b: [u32; 4] = [1, 2, 3, 4]; + b +} + +fn main(a: u32, mut c: [u32; 4]) { + test3(1); + + if a == 0 { + c = test4(); + } else { + assert(c[1] != 2); + } + if false { + c[1] = 5; + } + assert(c[1] == 2); + + test5(4); + // Test case for function synchronisation + let mut c_sync = 0; + if a == 42 { + c_sync = foo2(); + } else { + c_sync = foo2() + foo2(); + } + assert(c_sync == 6); +} + +fn test5(a: u32) { + if a > 1 { + let q = a / 2; + assert(q == 2); + } +} + +fn foo2() -> Field { + 3 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml new file mode 100644 index 00000000000..987b51ae126 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_421" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Prover.toml new file mode 100644 index 00000000000..73fa4a5e31a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/Prover.toml @@ -0,0 +1,2 @@ +c=[2, 4, 3, 0, ] +a=0 diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr new file mode 100644 index 00000000000..5789afb76db --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr @@ -0,0 +1,10 @@ +fn main(a: u32, mut c: [u32; 4]) { + //Issue reported in #421 + if a == c[0] { + assert(c[0] == 0); + } else if a == c[1] { + assert(c[1] == 0); + } else if a == c[2] { + assert(c[2] == 0); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml new file mode 100644 index 00000000000..ed11341c5b0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_661" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Prover.toml new file mode 100644 index 00000000000..baad8be126a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/Prover.toml @@ -0,0 +1,38 @@ +c=[2, 4, 3, 0, ] +a=0 +x = [104, 101, 108, 108, 111] + +result = [ + 0x2c, + 0xf2, + 0x4d, + 0xba, + 0x5f, + 0xb0, + 0xa3, + 0x0e, + 0x26, + 0xe8, + 0x3b, + 0x2a, + 0xc5, + 0xb9, + 0xe2, + 0x9e, + 0x1b, + 0x16, + 0x1e, + 0x5c, + 0x1f, + 0xa7, + 0x42, + 0x5e, + 0x73, + 0x04, + 0x33, + 0x62, + 0x93, + 0x8b, + 0x98, + 0x24, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr new file mode 100644 index 00000000000..03102eb775e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr @@ -0,0 +1,28 @@ +fn main(a: u32, mut c: [u32; 4]) { + // Regression for issue #661: + let mut c_661: [u32; 1] = [0]; + if a > 5 { + c_661 = issue_661_foo(issue_661_bar(c), a); + } else { + c_661 = issue_661_foo(issue_661_bar(c), a + 2); + } + assert(c_661[0] < 20000); +} + +fn test5(a: u32) { + if a > 1 { + let q = a / 2; + assert(q == 2); + } +} + +fn issue_661_foo(array: [u32;4], b: u32) -> [u32;1] { + [array[0] + b] +} + +fn issue_661_bar(a: [u32;4]) -> [u32;4] { + let mut b: [u32; 4] = [0; 4]; + b[0]=a[0]+1; + b +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml new file mode 100644 index 00000000000..92f5a869bc4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_regression_short_circuit" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Prover.toml new file mode 100644 index 00000000000..baad8be126a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/Prover.toml @@ -0,0 +1,38 @@ +c=[2, 4, 3, 0, ] +a=0 +x = [104, 101, 108, 108, 111] + +result = [ + 0x2c, + 0xf2, + 0x4d, + 0xba, + 0x5f, + 0xb0, + 0xa3, + 0x0e, + 0x26, + 0xe8, + 0x3b, + 0x2a, + 0xc5, + 0xb9, + 0xe2, + 0x9e, + 0x1b, + 0x16, + 0x1e, + 0x5c, + 0x1f, + 0xa7, + 0x42, + 0x5e, + 0x73, + 0x04, + 0x33, + 0x62, + 0x93, + 0x8b, + 0x98, + 0x24, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr new file mode 100644 index 00000000000..d260fa49dc3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr @@ -0,0 +1,38 @@ +use dep::std; + +fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { + //regression for short-circuit2 + if 35 == a { + assert(false); + } + bar(a as Field); + + if a == 3 { + c = test4(); + } + assert(c[1] != 2); + call_intrinsic(x, result); +} + +fn foo() { + let mut x = 1; + x /= 0; +} + +fn bar(x: Field) { + if x == 15 { + foo(); + } +} + +fn call_intrinsic(x: [u8; 5], result: [u8; 32]) { + let mut digest = std::hash::sha256(x); + digest[0] = 5 as u8; + digest = std::hash::sha256(x); + assert(digest == result); +} + +fn test4() -> [u32; 4] { + let b: [u32; 4] = [1, 2, 3, 4]; + b +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Nargo.toml new file mode 100644 index 00000000000..54a082081f7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "conditional_underflow" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Prover.toml new file mode 100644 index 00000000000..ca65e8b9428 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/Prover.toml @@ -0,0 +1 @@ +x = "4" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/src/main.nr new file mode 100644 index 00000000000..be70b67be5e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/conditional_regression_underflow/src/main.nr @@ -0,0 +1,15 @@ +// Regression test for https://github.com/noir-lang/noir/issues/3493 +fn main(x: u4) { + if x == 10 { + x + 15; + } + if x == 9 { + x << 3; + } + if x == 8 { + x * 3; + } + if x == 7 { + x - 8; + } +} \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml new file mode 100644 index 00000000000..35cf2e080c1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "custom_entry" +type = "bin" +entry = "src/foobarbaz.nr" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Prover.toml new file mode 100644 index 00000000000..4dd6b405159 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/Prover.toml @@ -0,0 +1 @@ +x = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/custom_entry/src/foobarbaz.nr b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/src/foobarbaz.nr new file mode 100644 index 00000000000..00e94414c0b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/custom_entry/src/foobarbaz.nr @@ -0,0 +1,3 @@ +fn main(x: Field) { + assert(x == 1); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml new file mode 100644 index 00000000000..9550d50cf15 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "debug_logs" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr new file mode 100644 index 00000000000..6accdf725d9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr @@ -0,0 +1,81 @@ +use dep::std; + +fn main(x: Field, y: pub Field) { + let string = "i: {i}, j: {j}"; + std::println(string); + // A `fmtstr` lets you easily perform string interpolation. + let fmt_str: fmtstr<14, (Field, Field)> = f"i: {x}, j: {y}"; + let fmt_str = string_identity(fmt_str); + std::println(fmt_str); + + let fmt_str_no_type = f"i: {x}, j: {y}"; + std::println(fmt_str_no_type); + + let fmt_str_generic = string_with_generics(fmt_str_no_type); + std::println(fmt_str_generic); + + let s = myStruct { y: x, x: y }; + std::println(s); + + std::println(f"randomstring{x}{x}"); + + let fmt_str = string_with_partial_generics(f"i: {x}, s: {s}"); + std::println(fmt_str); + + std::println(x); + std::println([x, y]); + + let foo = fooStruct { my_struct: s, foo: 15 }; + std::println(f"s: {s}, foo: {foo}"); + + std::println(f"x: 0, y: 1"); + + let s_2 = myStruct { x: 20, y: 30 }; + std::println(f"s1: {s}, s2: {s_2}"); + + let bar = fooStruct { my_struct: s_2, foo: 20 }; + std::println(f"foo1: {foo}, foo2: {bar}"); + + let struct_string = if x != 5 { f"{foo}" } else { f"{bar}" }; + std::println(struct_string); + + regression_2906(); +} + +fn string_identity(string: fmtstr<14, (Field, Field)>) -> fmtstr<14, (Field, Field)> { + string +} + +fn string_with_generics(string: fmtstr) -> fmtstr { + string +} + +fn string_with_partial_generics(string: fmtstr) -> fmtstr { + string +} + +struct myStruct { + y: Field, + x: Field, +} + +struct fooStruct { + my_struct: myStruct, + foo: Field, +} + +fn regression_2906() { + let array_two_vals = [1, 2]; + dep::std::println(f"array_two_vals: {array_two_vals}"); + + let label_two_vals = "12"; + dep::std::println(f"label_two_vals: {label_two_vals}"); + + let array_five_vals = [1, 2, 3, 4, 5]; + dep::std::println(f"array_five_vals: {array_five_vals}"); + + let label_five_vals = "12345"; + dep::std::println(f"label_five_vals: {label_five_vals}"); + + dep::std::println(f"array_five_vals: {array_five_vals}, label_five_vals: {label_five_vals}"); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml new file mode 100644 index 00000000000..8b75d71ae12 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Nargo.toml @@ -0,0 +1,8 @@ +[package] +name = "diamond_deps_0" +type = "bin" +authors = [""] + +[dependencies] +dep1 = { path = "../../test_libraries/diamond_deps_1" } +dep2 = { path = "../../test_libraries/diamond_deps_2" } diff --git a/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Prover.toml new file mode 100644 index 00000000000..a713241e7dd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/Prover.toml @@ -0,0 +1,3 @@ +x = 1 +y = 1 +return = 5 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr new file mode 100644 index 00000000000..ca95c6e0aa8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr @@ -0,0 +1,7 @@ +use dep::dep1::call_dep1_then_dep2; +use dep::dep2::call_dep2; +use dep::dep2::RESOLVE_THIS; + +fn main(x: Field, y: pub Field) -> pub Field { + call_dep1_then_dep2(x, y) + call_dep2(x, y) + RESOLVE_THIS +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml new file mode 100644 index 00000000000..3f1b1386ba7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "distinct_keyword" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/src/main.nr new file mode 100644 index 00000000000..0e55a011a48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/distinct_keyword/src/main.nr @@ -0,0 +1,4 @@ +// Example that uses the distinct keyword +fn main(x: pub Field) -> distinct pub [Field;2] { + [x + 1, x] +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml new file mode 100644 index 00000000000..a4edd2e4288 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "double_verify_proof" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Prover.toml new file mode 100644 index 00000000000..3e6d996d0e1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/Prover.toml @@ -0,0 +1,12 @@ +input_aggregation_object = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"] +# key_hash = "0x17a5d2b205c1bf45b015ba33bc2f0beb7fbb36682f31f953b8d4d093c8644be5" +# proof = ["0x0000000000000000000000000000000000000000000000000000000000000003","0x0000000000000000000000000000008f66908323784e7c5259f4eefab77ca881","0x0000000000000000000000000000000000109cac7b943f9b737d7b023d4f5d8a","0x000000000000000000000000000000e991d3ac0a68a252bd3cd09cd1b43fe1b4","0x000000000000000000000000000000000014213d346a426777351fdabaa0fa26","0x000000000000000000000000000000e4603692a76af630015380b08d0e13c239","0x0000000000000000000000000000000000149e7046461203c1b72392bb93c262","0x000000000000000000000000000000c27ffc719f223ca6ef5476a5b66f03a4a8","0x000000000000000000000000000000000003718c62098243e3c1f38090e61753","0x000000000000000000000000000000749492aa98716ce5bf7c06e5c2a0a8a528","0x000000000000000000000000000000000018e4c7d33848bccdc3eed924bfaa15","0x0000000000000000000000000000004e10a37f41fd7c4fe32982daa498530d62","0x00000000000000000000000000000000001b76c8c59489c63f11280187109dd7","0x0000000000000000000000000000002a6cd84d3b8537a7c3cb0cb9461f02e4bb","0x0000000000000000000000000000000000197e524fd48ca5ccb30d6c5ffe689d","0x0000000000000000000000000000000013bf25498ce1f51078c06dac450c0325","0x000000000000000000000000000000000018d347b88a0c32e32571deb9b40466","0x00000000000000000000000000000060d496191298eb1b1c2ce18f9a4afcfc55","0x000000000000000000000000000000000024e11b8e8fcb45b8628cb9cc565513","0x00000000000000000000000000000004e976f6d12fff6250eea2d21c570d3d6a","0x00000000000000000000000000000000000967dbd89d2c7dc0121ea71ded7203","0x000000000000000000000000000000d96f810588c0daa43e88d765a3f82ea9b7","0x00000000000000000000000000000000001f69d7015fe6694bd1d4d61049dae9","0x000000000000000000000000000000c539910d0f81a890fa3d996a676db39640","0x000000000000000000000000000000000026d8b64020a669e24f740b4eba633a","0x000000000000000000000000000000c53cc90f99c40eb5d449f38180d9e9c8b6","0x00000000000000000000000000000000001071ddf2bacc2367dfb2c5084b7dd1","0x0000000000000000000000000000001b9791181eb174db1a50d903fa9fea9999","0x0000000000000000000000000000000000118c059d41a95311a5c361c6a9a00d","0x0000000000000000000000000000003caf4ad04551a3ffba19cc6a1fff457370","0x00000000000000000000000000000000001dc4d8be804c5289fbf54183f93149","0x00000000000000000000000000000050766764bb82799df5172043c515956263","0x00000000000000000000000000000000000a5849adbac9c33e53571b29aab672","0x0000000000000000000000000000002edb078e589d44ac93e283680b34adf574","0x000000000000000000000000000000000015e9e187c4fb683ca78d52a2a0301b","0x00000000000000000000000000000048ac0f1db3575ed0f84d61ab6cbdd53d9f","0x00000000000000000000000000000000002ddc4243fbc7104347d29a823194ae","0x00000000000000000000000000000070ad92aeea2bdea4277ffdfa3d3ed93443","0x000000000000000000000000000000000003bad3e3aae806c278094cb682a8e0","0x000000000000000000000000000000fb74b99eb44c80d8f7ba83d7e9e2efa5c0","0x00000000000000000000000000000000002819cc14e399c1dadc4f921e2a58fa","0x000000000000000000000000000000e3938bb3e7866c6499ec44fb72549efca0","0x00000000000000000000000000000000002d8264d5cdc2109da12e1864aca147","0x000000000000000000000000000000b12d7828cacbe86350f0b171b0cb0d1cd4","0x0000000000000000000000000000000000244155cecb315326f05641cac9475c","0x070b059f9471e22eed5a9ea08093dba3c59c941634611884c5f0f1a1a6b93e5c","0x118124ada70b46c7d23a6ca8b90d545f30e028b1689fe5c55c86bf55f42e0401","0x25dca6ad78c03ce1f7783cc39a5ea5ef90b318d5edf4f1367d4451c1db3c113e","0x0d9557b4e661b5c53b84fcb41f05d15c0ca112430db16f56d0ab54032fffe734","0x06aedf13a3b182784f4d64162f4706759f95e42fc8dc17d1b8b5f551dafdc007","0x132f97ab5f1f8817689b17e336125c5273d6970a1b3b0901fd26d193a4d2dce4","0x1b0c9980b5b09343e807d82bad307a06d1bfadcd1fa50be666c2907d31ef43e1","0x1ce7000cb24ecc1f2ff9d9507b2290513fed574a84d893811cb54a3c0bc51ccc","0x2e1df58d36444c2dfda98991847422f56ef66f079d26eb7f8110d0d7c46b2c0c","0x166c2f821be7c3e3e4440980e73770840194f14d003778b7fbcdd2690776255c","0x1ae8390287e2eb117851a5011575ba3801e5ee5c66a8f7432e2a2fb13c276008","0x047c09806bfb272d940d9b802e3e49b40050fd0f66717e8b325c5d4834b13aac","0x08f81300d7f64e5b281b37005c7c936800a1fa1ecce2fd1664b8ba9069627558","0x2ed7260e623b68d580304751341bb72141314b881e9e8dade626bf5cde8a077c","0x23e04c035fd9396ca06cdc0171f24da00287e87b338bf45992e2ea41a589d560","0x285c5583cbd4609a347a7781a030975402d8e58a99fd72e4c53f4789da3b100c","0x2cd85f0437cf87c7c8881301ce6ee1080329e29a006ef16ff79ba4d20eec4ab8","0x12eb74da267caf98c494db16c87f90f510fdca1f8095b40156a6f0bb066e3400","0x2267004535c434df4cbee1a356e48b1f317cb849ac69c3eb94e377d2274f1e08","0x2c9d4ce9d1d8b8cf1cb90cbc3e121f570c8260c53b48ed2070d474d5a6f12c4e","0x2c6c83ffaad6f30da5aa696973ccfbd0337cb7a5e5f9e5fc8e826dce21e8f51c","0x056c23922e9435f93853044ba96a1c12db97f47053987df5187269ce884ec00f","0x09e82d129a8f5d26cc609fcbd7a865c6dbe8f17fba09fc804acec716bcfffabb","0x0e643693068a8454606e3b4c05e6af7adc39ee8f207b7b0b7d2b245ef1b13567","0x12e040137285ab81f47bd6cc3424f92edc8aeb9e86ecf996af8781a726627013","0x00f01a11c2990ecba44568cb7b2bd25edb46f760ed26ff69e6160c86539d8563","0x28a91699dfa4e85e18e8621d39a147a40930701d2d88546e01adb71a1f8e407f","0x000000000000000000000000000000009d7cc0b2d2bdef816f4fb17e7a6f6c08","0x00000000000000000000000000000000bcfc1a7030171f681f2c6e97c61f4e70","0x00000000000000000000000000000000dc7b742d8d704f4ecf092bb111cf30d8","0x13b099dc4869006fde9df04bf36f4c8f08d4491cc6229ac36a98f93214c79b6a","0x008fa95e0d431d617d8d3288fde7f8bbe36492019943e2018564633528575892","0x0fc66c06bdff20dba4dc491d5cd13cc209c4d2d9e29802db665bb397c2a4e754","0x0fe48ae6623efbaadce6d6b75b87be6caa19c2fd4d94a74149ceb6bcb88251e1","0x1bb41738028855cb5e0085edcd62cff208121427ea19a57425a0cf6bb68deb93","0x0fbc646333ddc21ab1a77b01a35973a56d5a617c482a21a231497fd3cc9b74c1","0x19ab9eaa1a902faff2dd9baa19ff00cea9086baa8c28bcdb95f7a3549eaf09b4","0x25e2b7a7643df4d964cd787b593888b00abfe3ce79e8deaa6d68fd1686b84bcb","0x2d134d7eea07414451e54854d61d5b71245434d0638bba9a1184914f65f2521c","0x03df94e38e9eed8586acd277d180d5d515b49d89d37525f871be2ff4552c586c","0x0b102abb146839f073c4a2514e65a8962f48ee8bbd1801e815d9c42d34665ebd","0x000000000000000000000000000000b7a4109cb92b514401fb63667454a9c892","0x0000000000000000000000000000000000016fce7f8ef56fef466636f3fbc3de","0x00000000000000000000000000000005f2d1c401a7aa14ac7e9fce7c21ec2e1a","0x00000000000000000000000000000000000621322c74c5d0da5eb71a4f2b046f","0x00000000000000000000000000000073d774ad7f61b1c1b93800f7838cca6bde","0x00000000000000000000000000000000002d603cc025e6af192394df113d4677","0x00000000000000000000000000000066a2a702b4d4b1a24af9c56cacb18ae4b8","0x00000000000000000000000000000000000124a3c25b427cfb6fca07525c5b8d"] +# public_inputs = ["0x0000000000000000000000000000000000000000000000000000000000000003"] +# verification_key = ["0x2b337de1c8c14f22ec9b9e2f96afef3652627366f8170a0a948dad4ac1bd5e80","0x0000000000000000000000000000000000000000000000000000000000000008","0x0000000000000000000000000000000000000000000000000000000000000005","0x0000000000000000000000000000000000000000000000000000000000000008","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000000000092139c61bae1a44f0fc7689507414be688","0x00000000000000000000000000000000000160ce4e279582f91bde4f03f5e9a2","0x0000000000000000000000000000005dc2d37f658c3b2d60f24740eb13b65d79","0x000000000000000000000000000000000007e3e8a5d98a1177ec85bf88f163a5","0x000000000000000000000000000000dc3035fbd7ff16412a8fd7da587a935298","0x000000000000000000000000000000000023d08e2817ac16990004ed11d8fc66","0x000000000000000000000000000000356a5ad59c646c746a8d09f5d154e47c4f","0x00000000000000000000000000000000000708529196af3c8e16ffa580c26182","0x0000000000000000000000000000002ddfe70eb7a1280596e8e4a804f118a6dd","0x000000000000000000000000000000000013757e15a0905f298303784a161b21","0x000000000000000000000000000000a23a729df796935c7824e3a26be794829b","0x000000000000000000000000000000000005775b6c146c4a59856e869fe5a70e","0x000000000000000000000000000000eef0c9e088fd2d45aa40311082d1f2809b","0x00000000000000000000000000000000001d539ccbfc556d0ad59307a218de65","0x000000000000000000000000000000a2c848beceb6ab7806fd3b88037b8410fc","0x0000000000000000000000000000000000177004deeb1f9d401fd7b1af1a5ac8","0x0000000000000000000000000000002508eb63672a733f20de1a97644be4f540","0x00000000000000000000000000000000000d82d51f2f75d806285fd248c819b8","0x000000000000000000000000000000d002f9100cbba8a29f13b11513c53c59d0","0x000000000000000000000000000000000006cd3b0e3460533b9e5ea2cdc0fcbb","0x000000000000000000000000000000f45ea38a93b2f810c5633ddb54927c1c96","0x000000000000000000000000000000000021791de65f9a28ec7024b1a87ab4f3","0x000000000000000000000000000000926511a0439502c86885a8c6f0327aa7ad","0x000000000000000000000000000000000029fa14a969c5d81ed3abbbfb11220a","0x000000000000000000000000000000b84c3258e8206f560e5b5b18cbeafef87e","0x00000000000000000000000000000000002a910445cd8fc895e5d235cd8ea185","0x000000000000000000000000000000887e67f15e84bcb8507a5064a363f6043b","0x000000000000000000000000000000000014dc6643d801c3ef27c2066b6e2bb4","0x000000000000000000000000000000e38e900b42c314ba803088e8fbf125203f","0x000000000000000000000000000000000020690fd4869db418306046b38161dc","0x0000000000000000000000000000001e2fa856bf7951b8292b1e88185993629c","0x0000000000000000000000000000000000048a85e0bbac7c60ad3d78f601f63c","0x0000000000000000000000000000006f457719495073d3666d77a625aeab0c51","0x00000000000000000000000000000000002623ad892dc62b1fa7d0a650f0d470","0x000000000000000000000000000000dbfcc8a467e021c03b13f74a9f79c3a10c","0x0000000000000000000000000000000000295f6f10976c37bd9c6f96bb7187d5","0x000000000000000000000000000000c13ef9a937cc12420fb38d9ab8e848e85e","0x000000000000000000000000000000000003560a3b334e887532f605c9cb7628","0x0000000000000000000000000000009bcebf08a4599cdda0fb96312d4dc0c7a9","0x000000000000000000000000000000000015adc8bb1e01c835f48959d1237bd6","0x00000000000000000000000000000047762ab839e4ff63c77605a9f383da37c2","0x000000000000000000000000000000000016a8c3c53d89660cf271522cd301fb","0x000000000000000000000000000000f0c8539a0b5f94420a513f9c305b932bfe","0x00000000000000000000000000000000002957ba01d9de5638f808f88a692533","0x000000000000000000000000000000ab17c6189d67d3bf5dd2f3885de0151b6f","0x0000000000000000000000000000000000060d8aa43fdc434d1942263f364d95","0x0000000000000000000000000000005d292333b3adb497f00b4bc32d45229060","0x00000000000000000000000000000000001a1018a66221883639f2898a66f345","0x00000000000000000000000000000006555a806b1993291deba0dc44e2abf431","0x00000000000000000000000000000000000cacff7099a9d5e35a21f4a00b2dc3","0x000000000000000000000000000000f50c11ba95d349c36d143eefd12e494950","0x00000000000000000000000000000000001022e8c5f02d639bc9dd8bc4407f99","0x000000000000000000000000000000c76828795098eda73d50b4b585c60afc60","0x00000000000000000000000000000000002bf09c0ec7011e93888962f2406630","0x00000000000000000000000000000049e5c83a8978d832fb8e144548e3ca1adb","0x00000000000000000000000000000000000e0ec242c2e160a984f61ca5adf5f5","0x0000000000000000000000000000009c5d6e08a6605ab4513748ac0fa017dd1c","0x00000000000000000000000000000000001f54baa07558e5fb055bd9ba49c067","0x0000000000000000000000000000001e1ee7ee29bbb5e4b080c6091c1433ce62","0x000000000000000000000000000000000024aec62a9d9763499267dc98c33428","0x0000000000000000000000000000001a96755946ff16f0d6632365f0eb0ab4d4","0x000000000000000000000000000000000028cf3e22bcd53782ebc3e0490e27e5","0x00000000000000000000000000000043148d7d8c9ba43f2133fab4201435a364","0x0000000000000000000000000000000000234ce541f1f5117dd404cfaf01a229","0x000000000000000000000000000000a7fb95ffb461d9514a1070e2d2403982ef","0x00000000000000000000000000000000003016955028b6390f446c3fd0c5b424","0x00000000000000000000000000000008863c3b7cd7cddc20ba79ce915051c56e","0x000000000000000000000000000000000013ef666111b0be56a235983d397d2a","0x000000000000000000000000000000e3993f465fc9f56e93ac769e597b752c1c","0x0000000000000000000000000000000000217f7c4235161e9a3c16c45b6ca499","0x0000000000000000000000000000008ffa4cd96bc67b0b7df5678271e1114075","0x0000000000000000000000000000000000256467bfcb63d9fdcb5dde397757ad","0x00000000000000000000000000000054e5eb270bb64bde6e6ececadfd8c3236c","0x00000000000000000000000000000000000e52d1bd75812c33c6f3d79ee4b94c","0x000000000000000000000000000000484a2c641dce55bc2dd64ef0cd790a7fea","0x00000000000000000000000000000000000ff417d256be43e73c8b1aa85bdda3","0x0000000000000000000000000000000b72e7b7713ab5da44e0f864182e748a23","0x00000000000000000000000000000000001a221055f1625ad833a44705f5f74e","0x00000000000000000000000000000067a99a34e9b81a17ad001db02e29bcb82a","0x000000000000000000000000000000000018a6c02e398389827568fa960e86e2","0x000000000000000000000000000000bb29f26f9890d6cc6401f4921d5884edca","0x00000000000000000000000000000000000868357b28039385c5a5058b6d358e","0x00000000000000000000000000000036fb6e229dde8edf7ec858b12d7e8be485","0x00000000000000000000000000000000001060afe929554ca473103f5e68193c","0x00000000000000000000000000000015226e07e207744c0857074dcab883af4a","0x00000000000000000000000000000000000b1c02619282755533457230b19b4a","0x0000000000000000000000000000001f2a0277e4807e6e1cbabca21dde5eb5e1","0x00000000000000000000000000000000000d928deafed363659688ed4ccdef52","0x000000000000000000000000000000363f0c994e91cecad25835338edee2294f","0x00000000000000000000000000000000002eea648c8732596b1314fe2a4d2f05","0x000000000000000000000000000000b2671d2ae51d31c1210433c3972bb64578","0x00000000000000000000000000000000000ab49886c2b94bd0bd3f6ed1dbbe2c"] +# proof_b = ["0x0000000000000000000000000000000000000000000000000000000000000003","0x0000000000000000000000000000002ab91b132e624f2a408aa8c9bf31cca8d7","0x000000000000000000000000000000000015ad57528e0f065c820cc5ad4eab81","0x0000000000000000000000000000001acb78b1b6a5c9a6ec8bf2272b463014da","0x0000000000000000000000000000000000117fd65346e04bf3666d2ab3f24c90","0x000000000000000000000000000000aad0adaf9a768ba6a178f804edac5c8943","0x000000000000000000000000000000000004a11c7d31f25c20e3af16f9b01f71","0x0000000000000000000000000000001f0ae9bb921893ce2710148eb1fcd99e39","0x0000000000000000000000000000000000123fda5008d3709f5afeda01de1930","0x000000000000000000000000000000971c2a8d0119097fd82b7a8074a14853f8","0x000000000000000000000000000000000009965b998750710678da7891d8aba6","0x0000000000000000000000000000002d6ef3813ba14a5f5202afed6b1c41de1c","0x000000000000000000000000000000000020366bfdb2f9279c43d66f90dfdf4d","0x00000000000000000000000000000041389f221eadec33e1b87518668c3bc92e","0x00000000000000000000000000000000000d3858169bb0432ab761d4be8ef03e","0x000000000000000000000000000000c1dbfe670dc912cb0fa1a0f633f81a4cef","0x00000000000000000000000000000000000fc0c403e668b0f51e07089082c32f","0x0000000000000000000000000000009a4fba9bf1369f637fd295c8bf795c9d02","0x00000000000000000000000000000000001d6d1e7286ce52401e6ea79d2cfa3d","0x0000000000000000000000000000004762bf7702ffe7a2c147e704280cd50bba","0x0000000000000000000000000000000000205797cdeaeff9a8d5ea4b95d41b1a","0x000000000000000000000000000000b3d43cc863ba8d98f51118c0db70761079","0x00000000000000000000000000000000002d2a3d10381bc6b47a693c1692b1b6","0x000000000000000000000000000000d35a69fb0e68729f71e651799c0d19e9eb","0x00000000000000000000000000000000002ade1dc7741b7f397271c10e596557","0x0000000000000000000000000000001a67b44714687085004e4142f700043298","0x00000000000000000000000000000000001bb7bbb7f45876b1d72e5d20cee106","0x00000000000000000000000000000025f1f1cbf43fad70cba255b37a19e88b0c","0x00000000000000000000000000000000000cc46b215fbd8e4b233cc74aab250b","0x0000000000000000000000000000008168026f51135fc1670664bc50e629917f","0x000000000000000000000000000000000004d822d80ba0c1bcbd4b000573c6f9","0x000000000000000000000000000000d85756249b937277eba3f5dcb89c56e7bb","0x000000000000000000000000000000000019a3a7a5b20dac138d7ddb1d499134","0x0000000000000000000000000000007621614c7ebc31a2177011f9da01668eb3","0x000000000000000000000000000000000024e9beb5d616ab120073170fc431e8","0x00000000000000000000000000000031fbf901896e958fbbed3e5c57aebbdd04","0x0000000000000000000000000000000000005ac0f10fcc255e179a40518875d4","0x0000000000000000000000000000002dab820c019bcca563b7dbdd26974653e9","0x00000000000000000000000000000000001a5655ec1a67f722b14c65d5c2197f","0x0000000000000000000000000000008e277e490196db5c19d09a9034e10c6432","0x000000000000000000000000000000000003f13b1af07db07eec88698d0aaf2a","0x0000000000000000000000000000002d618452e2b4c790d0551ea5863ed62e76","0x00000000000000000000000000000000001a7171e790a433a972d80218fb482d","0x0000000000000000000000000000005669975cd5bf65a739c0a35a8ab9b7963b","0x00000000000000000000000000000000000d27ffb6f00c86a0ce76a8067d1bce","0x03a0054fe9f93ab96e7c7ed6ec1ac641dffd99a1c804ee5db52cf1efa1a12c15","0x059324381c89c12c87d0f6c27963c31647721fdb02c125961da1a21cbfb3ed1c","0x04a5ead891b7c3f30329e6abcf2ac6903c3c1d8e68874f6baf3a6fc00e84533a","0x03c02f6b862734acf9d0c5133f8141b3a008c5499336a588b376a5dd86d9c837","0x1dd26b35c21c584c410df89d1fd549e7f5da9bb4fd290b7c528d92fbd652f5ad","0x2c8e7ef6f7a130769ae74d0f47aeab5c443492ef4b1ed0b3a9d61dfca80cbdda","0x2b074486c21c62e6eccf3191b3ab3c8df0fb98f0c44b9f0e9e2c281b908b83a6","0x149a6d620be135bba6bbfe8ac826df37567c8be78007e47cdcf5d6e4683d339e","0x119fdfd330036bde31af71e43bd5e191460605e4760d08a6e0ebddbdb5abfeeb","0x1713efc63c00b2de4f68e696d9d30c5603963484f4829e716de2796640864b09","0x1bb1862114cda3712c177b1b6bca0ecd9de7723925698aee83dc91ade7078d3e","0x049d965ad8ccf092dcae948491f702779a513db430e6ec7d15fa1847a6814235","0x093b2cb5b199e125b95d290923ee04ef34a27b6861cdd8fa2bf4308f4d02846a","0x2710c6cd6f14f8071976509d1002e915bfc182b843a3967134de380302423c72","0x24ecb2d6c6678496e574a4248fb813bcd289eda1873763e8afd0c23d340a11a8","0x298a49319f347529c22338a921af16346cdb2b55b81e5065c5cada84da8b53dd","0x2e27df8c780165bc9ed1cd2db3a618ac072c6909e9053ce2dbc4f2cc810c9612","0x07350f3a2e23c1ccbde0d39370159060de5b8df40ae7c58d3f9852b371f1adac","0x2fdf8bf8e2fa2acad0f6d6a3f73e7dc516e8e2d167128bf3a560972339122835","0x0d3ec457703c228d4b6cd1635df9d9bde51997d0228edef64d667cbd16f3cb70","0x148320b9ceab1f3be840dc38b0344e7db0755283d1eacf2dd472e99ee0fb473f","0x06febdcf4869a6b89fdeb0805612c53e139afc29d119a54bc3d72dc7de0f1a7b","0x0b9c542a2136974b7c8d4504e809c7b5adec39de020091c8d9d1460f84905cb0","0x1039ea84fa0387de593bd9897a00ca2d483d779232e77e45efcb5e572b119ee5","0x14d780dfd2d0787135ea6e0e0bf7cca4e28eb54663ce6ac305c5769ed192e11a","0x026127746f9cb625c3301bfbc41bc2c67949be75a032b8ceaddd1580378dd846","0x123cf1180af5fdf09444de423947c9a71790f2c85468b51ecc25fb7bf075a0d5","0x000000000000000000000000000000008419a4f769ceb72c3ac28f559331a5df","0x000000000000000000000000000000009e852c5c1891a89b79b64599e3d52d72","0x00000000000000000000000000000000b8f0b3c0c7549a0ab8a9fbde3478b505","0x056af493dda97ae84cdbbf9ce379e35bdd66e1223eebacdc4a6c2c92553604f4","0x023624c49a722bc8dc5d945b4b10be8ed6c608020e65038a470b5a407375c8aa","0x0ed9f8dd445bda548ef08b7a2ff233867c41b72786f98054597833a68cc9b900","0x2cbf3d04669aa3a0dcda95e19da879f36029abe28317f1ee69be28ddef2a0b87","0x284ca7049611e293aa4535dd7841a540996609d541814373b387b00069636f14","0x246a69ce4030b1e8a675eec89960bfe188bd4073f07afe74f7a77c0698c80bc5","0x1bbdab5d007c4743fbcbf3cc89252baf0b0e1b645b977434ccd4e7560d124761","0x210427e70ee1b484bbb0b4e98263faf24a45325236eed618d51dcb1cb3a9f60d","0x1fbc24b0bd5b0b8c514e138317cc332962714dd306b34939768d723d6ea2ca8e","0x1e74217a6bd46293e6eb721cad346b607a9d6953d677bc5a17fd195e299b9f0f","0x1d2c1e441a4db99b7c88d0b6429ca39792c984d4a63c2f7ab96cc07ee4947390","0x00000000000000000000000000000005b1e3524625c466540f3f7468172403cb","0x000000000000000000000000000000000013bb985f9d5562699347b5dfbc441e","0x000000000000000000000000000000f4fb87d7f481bb198aa6237a0c9ffd3c22","0x0000000000000000000000000000000000254c5f1b76e278f4c71cf5e71533dd","0x0000000000000000000000000000005a72a28b51be9c538b4d28b5106b9239b8","0x00000000000000000000000000000000000d02d80e1a73c82cb0dd8af1aabb3f","0x000000000000000000000000000000434c46502fc1c425a72a4717a3e44c3415","0x00000000000000000000000000000000001c8d74d967b9b65ff2772592a15d0e"] + +key_hash = "0x096129b1c6e108252fc5c829c4cc9b7e8f0d1fd9f29c2532b563d6396645e08f" +proof = ["0x0000000000000000000000000000000000000000000000000000000000000003","0x000000000000000000000000000000d62b795bec274279129a71195796825fcc","0x00000000000000000000000000000000000793ab763140f20a68a6bd2721fd74","0x00000000000000000000000000000053141d06d3307b36153f321511199e579c","0x00000000000000000000000000000000000a4b55d6c21f98a9c434911dcb5c67","0x0000000000000000000000000000005f9d324c0abd22cec92d99dbec438e9491","0x0000000000000000000000000000000000240dfafe1b53dc27147cbab14ea893","0x000000000000000000000000000000044a61d3aac32c6931247cf334a19d9611","0x000000000000000000000000000000000003f0f8cf4207bfa85c23ec9f8d0c88","0x00000000000000000000000000000002168a470e39ba2ac266f6b474de12045f","0x000000000000000000000000000000000025791e7d3feab542345c00ec5a30df","0x000000000000000000000000000000dcafd76d4c3640969c80e017b951ef6397","0x00000000000000000000000000000000001d27f75a1256771e88e0c86fc42dbc","0x0000000000000000000000000000007347ae7d2d9d7fc2b8f0baa014ee1fed9f","0x000000000000000000000000000000000018bd927f42bf7caf9555f56f09000d","0x000000000000000000000000000000041f765f83cbe5904c8f453f70a4531d10","0x00000000000000000000000000000000001858aabeeb5331a221419f4fed1c19","0x000000000000000000000000000000d254a54caaedf8287b9af951b2f2611121","0x000000000000000000000000000000000005ab493623c9563cf2e55ba5f18200","0x00000000000000000000000000000014f24cddc1a02440dc63637df8032c8074","0x000000000000000000000000000000000011950c16cef98471b1d78b935195a4","0x000000000000000000000000000000b0340b459e6bd5cc8f031c8654a502897f","0x00000000000000000000000000000000000e1cf3968dac4545a76a2ae58e512c","0x0000000000000000000000000000002adf7218aa06ca0d2c2e600dcc39193a2d","0x00000000000000000000000000000000001302e7e4b0f14749bd885ca25588b6","0x00000000000000000000000000000092009ce4056e79ab815d8cdfd4491138ae","0x000000000000000000000000000000000018af11e853c6cf2f0f6274b0da8133","0x000000000000000000000000000000dd3dc6f49232141718527b3a0e4b26e21d","0x00000000000000000000000000000000001a877853348a8b695c4f9a9aa4ce68","0x000000000000000000000000000000aecfc56ba07155450b368140d6324023b5","0x000000000000000000000000000000000029c11052798c57ece614617d33fcc2","0x000000000000000000000000000000eb106ffc816d16fb84e84b0b61157b2603","0x000000000000000000000000000000000026c3cac16206899a21cb5126841446","0x000000000000000000000000000000a782ed54805fe845068b362b58e2fa34ec","0x00000000000000000000000000000000000cf046a1bfcc666b7f28b572676073","0x000000000000000000000000000000b931c8dda60bb4aca4cc817f5540f1209f","0x000000000000000000000000000000000024ad50c3936fafc3d190e6a4874223","0x000000000000000000000000000000cce90cfbaf5671c8c8652db28a3a9566f7","0x000000000000000000000000000000000003574db9d0f84380c9635660f86354","0x0000000000000000000000000000003eb3e1dc31846a90f721e7a08c6d6dc4f7","0x000000000000000000000000000000000028999a700cd1abae1a288eebb9a91c","0x000000000000000000000000000000c1be4d385b11387e14eb9817050d772f78","0x000000000000000000000000000000000003c56b5bad8b4484c66ac921f1f102","0x000000000000000000000000000000ace245cabf0f00dc7fd253dd8af0377a14","0x0000000000000000000000000000000000107f1731fcf34b364c813599fa1df7","0x035b937d404932b542b706eb810ef4a7dca4566d4dde1ad6a8717f46167ead7e","0x17608cef3dc7960f41cb1295706df663727d45ee598a61e05e989d111449fb65","0x054712a950ad67da3aa860e49e6891f99b586b7f37caff94eb013fdb374b61ee","0x04b755083086c769b7f593e0e48d68dc54be808203351380ca5566a48149d8bb","0x17d7670b0915235f626fdc1d7e1134d2be906ef138d7843384b3ebc23b1d630f","0x064cf544ab5f4e3dab47960502cccc83321fb275068dfbdd3a2fcbc6dddcaa65","0x083338262712e2b66769ea40d9f412b18caa1bc81a51ff5a50b6c41f8c4b3d23","0x0cdd38958cab97defde00f4a5961b6fd676e29d9f2c352f6bb2c68b91f83f8af","0x02c8bdd005c2f43a0a8cbb2744916ce5c322dfa5b23367a829c12699f4036d32","0x25bac73c7e7b659fbea3135b7a0decf9db8dc3045bd2837dae337c64cc722546","0x19eb361aa419d37bce3d2e8b2b7692a02a9559e83d7f3d8fe9169970fbbc2cba","0x2494bd5106d00e05c7ea60e632e9fe03773b7f2c5b662aa37ec512a01f4a0775","0x18c52c2f2c6e7be1d7847c15e452a3a9c64316103d12e4b5b9a82fac4e940ee9","0x0e0342810456ef78f498c1bfa085a5f3cbc06db1f32fabd0ea9ad27dccac1680","0x024c13d6ef56af33ed7164ea8e47ddecc8a487b000d8b1b45edcd3895a503ba2","0x26e0d127f626bd39b55bc5d0c131dbf03fe006dc5c3edc57dda1e629799a4317","0x1b1140061bc52b15c4f5e100729a81968ee79dc03deb966a18850335a8e44a8b","0x1bb76f945199e71d531a89288912087a02dd0e83020e65d671485bf2e5e86e1a","0x29269900859c6d86e404185b415bf3b279cd100f38cfdb0077e8d6a299c4fd35","0x22b5e94bae2f6f0cdb424a3b12c4bf82cec3fb228e012c1974ed457827bbe012","0x18d3543a93249778e7a57936170dae85ffc47c2567f2d0076a32c0bb86fcf10a","0x03721dc2670206cde42a175fd56bcce32cf6cb8801450a8e8e4b3d4e07785973","0x2806db136dd214d3ac1478460855cae6a4324ab45cab35320d104fee26c260e8","0x1c3749f1937082afbbae9375b9be708cf339e1983e57ef4447f36cfa560c685c","0x1067b8cfb90ef08bcb48aea56b2716334241787c2004a95682d68a0685566fd0","0x0f41aee4416398f1d48ffc302403273cddef34a41f98507c53682041d82e51ff","0x10d854c9f0bfbdff7ca91a68f4978e9a79e7b14243d92f465f17bdf88d9f64f8","0x00000000000000000000000000000000018938b11099e0cdc05ddab84a153a97","0x0000000000000000000000000000000001d7dda1471f0dc3b3a3d3438c197982","0x00000000000000000000000000000000022682917da43ab9a6e9cbcece1db86d","0x2453913e6b0f36eab883ac4b0e0604d56aaeb9c55e641135173e63c342f1a660","0x05216c1b58dc43a49d01aaba3113b0e86be450fc17d28016e648e7162a1b67fb","0x152b34845a0222a2b41354c0d395a250d8363dc18748647d85acd89d6934ec56","0x1dfc6e971ce82b7dcda1f7f282713c6e22a8c79258a61209bda69719806da544","0x2968dd8b3af8e3953f1fbbd72f4c49b8270597bb27d4037adc157ac6083bee60","0x1b9425b88a4c7d39b3d75afe66917a9aa1d2055724392bc01fb918d84ff1410e","0x04ab571f236d8e750904dc307dd274003d9130f1a7110e4c1521cfb408877c73","0x2ad84f26fdc5831545272d02b806bb0e6dae44e71f73552c4eb9ff06030748c7","0x020e632b99d325db774b8630fb50b9a4e74d35b7f27d9fc02c65087ee747e42c","0x09a8c5a3171268cb61c02515c01c109889200ed13f415ae54df2078bbb887f92","0x1143281a9451abbb4c34c3fa84e7678c2af2e7ea8c05160a6f7f06988fc91af8","0x000000000000000000000000000000cbda736ca5cf6bc75413c2cc9e28ab0a68","0x00000000000000000000000000000000001ee78c9cc56aa5991062ae2e338587","0x000000000000000000000000000000bc9bfcdebb486f4cb314e681d2cc5f8df6","0x00000000000000000000000000000000000ad538431d04771bca7f633cb659ff","0x000000000000000000000000000000d45b317afcefa466a59bba9e171f1af70c","0x0000000000000000000000000000000000133c50180ea17932e4881124e7a7c6","0x000000000000000000000000000000fc9ed37f543775849f3e84eaa06f77f992","0x00000000000000000000000000000000001372873c9c051d1baff99248b8f70e"] +public_inputs = ["0x0000000000000000000000000000000000000000000000000000000000000003"] +verification_key = ["0x2b337de1c8c14f22ec9b9e2f96afef3652627366f8170a0a948dad4ac1bd5e80","0x0000000000000000000000000000000000000000000000000000000000000008","0x0000000000000000000000000000000000000000000000000000000000000005","0x0000000000000000000000000000000000000000000000000000000000000008","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000000000092139c61bae1a44f0fc7689507414be688","0x00000000000000000000000000000000000160ce4e279582f91bde4f03f5e9a2","0x0000000000000000000000000000005dc2d37f658c3b2d60f24740eb13b65d79","0x000000000000000000000000000000000007e3e8a5d98a1177ec85bf88f163a5","0x000000000000000000000000000000dc3035fbd7ff16412a8fd7da587a935298","0x000000000000000000000000000000000023d08e2817ac16990004ed11d8fc66","0x000000000000000000000000000000356a5ad59c646c746a8d09f5d154e47c4f","0x00000000000000000000000000000000000708529196af3c8e16ffa580c26182","0x0000000000000000000000000000002ddfe70eb7a1280596e8e4a804f118a6dd","0x000000000000000000000000000000000013757e15a0905f298303784a161b21","0x000000000000000000000000000000a23a729df796935c7824e3a26be794829b","0x000000000000000000000000000000000005775b6c146c4a59856e869fe5a70e","0x000000000000000000000000000000eef0c9e088fd2d45aa40311082d1f2809b","0x00000000000000000000000000000000001d539ccbfc556d0ad59307a218de65","0x000000000000000000000000000000a2c848beceb6ab7806fd3b88037b8410fc","0x0000000000000000000000000000000000177004deeb1f9d401fd7b1af1a5ac8","0x0000000000000000000000000000002508eb63672a733f20de1a97644be4f540","0x00000000000000000000000000000000000d82d51f2f75d806285fd248c819b8","0x000000000000000000000000000000d002f9100cbba8a29f13b11513c53c59d0","0x000000000000000000000000000000000006cd3b0e3460533b9e5ea2cdc0fcbb","0x000000000000000000000000000000f45ea38a93b2f810c5633ddb54927c1c96","0x000000000000000000000000000000000021791de65f9a28ec7024b1a87ab4f3","0x000000000000000000000000000000926511a0439502c86885a8c6f0327aa7ad","0x000000000000000000000000000000000029fa14a969c5d81ed3abbbfb11220a","0x000000000000000000000000000000b84c3258e8206f560e5b5b18cbeafef87e","0x00000000000000000000000000000000002a910445cd8fc895e5d235cd8ea185","0x000000000000000000000000000000887e67f15e84bcb8507a5064a363f6043b","0x000000000000000000000000000000000014dc6643d801c3ef27c2066b6e2bb4","0x000000000000000000000000000000e38e900b42c314ba803088e8fbf125203f","0x000000000000000000000000000000000020690fd4869db418306046b38161dc","0x0000000000000000000000000000001e2fa856bf7951b8292b1e88185993629c","0x0000000000000000000000000000000000048a85e0bbac7c60ad3d78f601f63c","0x0000000000000000000000000000006f457719495073d3666d77a625aeab0c51","0x00000000000000000000000000000000002623ad892dc62b1fa7d0a650f0d470","0x000000000000000000000000000000dbfcc8a467e021c03b13f74a9f79c3a10c","0x0000000000000000000000000000000000295f6f10976c37bd9c6f96bb7187d5","0x000000000000000000000000000000c13ef9a937cc12420fb38d9ab8e848e85e","0x000000000000000000000000000000000003560a3b334e887532f605c9cb7628","0x0000000000000000000000000000009bcebf08a4599cdda0fb96312d4dc0c7a9","0x000000000000000000000000000000000015adc8bb1e01c835f48959d1237bd6","0x00000000000000000000000000000047762ab839e4ff63c77605a9f383da37c2","0x000000000000000000000000000000000016a8c3c53d89660cf271522cd301fb","0x000000000000000000000000000000f0c8539a0b5f94420a513f9c305b932bfe","0x00000000000000000000000000000000002957ba01d9de5638f808f88a692533","0x000000000000000000000000000000ab17c6189d67d3bf5dd2f3885de0151b6f","0x0000000000000000000000000000000000060d8aa43fdc434d1942263f364d95","0x0000000000000000000000000000005d292333b3adb497f00b4bc32d45229060","0x00000000000000000000000000000000001a1018a66221883639f2898a66f345","0x00000000000000000000000000000006555a806b1993291deba0dc44e2abf431","0x00000000000000000000000000000000000cacff7099a9d5e35a21f4a00b2dc3","0x000000000000000000000000000000f50c11ba95d349c36d143eefd12e494950","0x00000000000000000000000000000000001022e8c5f02d639bc9dd8bc4407f99","0x000000000000000000000000000000c76828795098eda73d50b4b585c60afc60","0x00000000000000000000000000000000002bf09c0ec7011e93888962f2406630","0x00000000000000000000000000000049e5c83a8978d832fb8e144548e3ca1adb","0x00000000000000000000000000000000000e0ec242c2e160a984f61ca5adf5f5","0x0000000000000000000000000000009c5d6e08a6605ab4513748ac0fa017dd1c","0x00000000000000000000000000000000001f54baa07558e5fb055bd9ba49c067","0x0000000000000000000000000000001e1ee7ee29bbb5e4b080c6091c1433ce62","0x000000000000000000000000000000000024aec62a9d9763499267dc98c33428","0x0000000000000000000000000000001a96755946ff16f0d6632365f0eb0ab4d4","0x000000000000000000000000000000000028cf3e22bcd53782ebc3e0490e27e5","0x00000000000000000000000000000043148d7d8c9ba43f2133fab4201435a364","0x0000000000000000000000000000000000234ce541f1f5117dd404cfaf01a229","0x000000000000000000000000000000a7fb95ffb461d9514a1070e2d2403982ef","0x00000000000000000000000000000000003016955028b6390f446c3fd0c5b424","0x00000000000000000000000000000008863c3b7cd7cddc20ba79ce915051c56e","0x000000000000000000000000000000000013ef666111b0be56a235983d397d2a","0x000000000000000000000000000000e3993f465fc9f56e93ac769e597b752c1c","0x0000000000000000000000000000000000217f7c4235161e9a3c16c45b6ca499","0x0000000000000000000000000000008ffa4cd96bc67b0b7df5678271e1114075","0x0000000000000000000000000000000000256467bfcb63d9fdcb5dde397757ad","0x00000000000000000000000000000054e5eb270bb64bde6e6ececadfd8c3236c","0x00000000000000000000000000000000000e52d1bd75812c33c6f3d79ee4b94c","0x000000000000000000000000000000484a2c641dce55bc2dd64ef0cd790a7fea","0x00000000000000000000000000000000000ff417d256be43e73c8b1aa85bdda3","0x0000000000000000000000000000000b72e7b7713ab5da44e0f864182e748a23","0x00000000000000000000000000000000001a221055f1625ad833a44705f5f74e","0x00000000000000000000000000000067a99a34e9b81a17ad001db02e29bcb82a","0x000000000000000000000000000000000018a6c02e398389827568fa960e86e2","0x000000000000000000000000000000bb29f26f9890d6cc6401f4921d5884edca","0x00000000000000000000000000000000000868357b28039385c5a5058b6d358e","0x00000000000000000000000000000036fb6e229dde8edf7ec858b12d7e8be485","0x00000000000000000000000000000000001060afe929554ca473103f5e68193c","0x00000000000000000000000000000015226e07e207744c0857074dcab883af4a","0x00000000000000000000000000000000000b1c02619282755533457230b19b4a","0x0000000000000000000000000000001f2a0277e4807e6e1cbabca21dde5eb5e1","0x00000000000000000000000000000000000d928deafed363659688ed4ccdef52","0x000000000000000000000000000000363f0c994e91cecad25835338edee2294f","0x00000000000000000000000000000000002eea648c8732596b1314fe2a4d2f05","0x000000000000000000000000000000b2671d2ae51d31c1210433c3972bb64578","0x00000000000000000000000000000000000ab49886c2b94bd0bd3f6ed1dbbe2c"] +proof_b = ["0x0000000000000000000000000000000000000000000000000000000000000003","0x000000000000000000000000000000f05c69448ca29bdf52076f9b073bb30fed","0x000000000000000000000000000000000028c86bb3e27b4aaaaef126f7df5349","0x00000000000000000000000000000026ae031fc93594375dfc7f3bbe027f97d5","0x000000000000000000000000000000000000dd12c7290fe7f775796a233b8590","0x000000000000000000000000000000c1ee6631704de424d010c5c4ac8293ac49","0x00000000000000000000000000000000002f41818c9aa83f5c8d9bdd128015b9","0x000000000000000000000000000000b50a5801482f7e3a5de8ab3cce0f10b0d3","0x000000000000000000000000000000000022a0bc69c293dbf293b25bc9eef7f8","0x0000000000000000000000000000003b02abf1967ef394154dc15d763135e903","0x00000000000000000000000000000000000d8a2ee46acc6d1ed8d517b56d47c8","0x00000000000000000000000000000039bf0d1b3d8cf9de898f101c626e978d78","0x0000000000000000000000000000000000008faa7df2451a24d291a9b584f1a5","0x000000000000000000000000000000c1dae329ed7adf63a2d89a5f16fb98b6d8","0x00000000000000000000000000000000001ff0bc16fc0bd4aa2d6255690453c2","0x000000000000000000000000000000d12d7589f853a9b472613efa56689beaf1","0x00000000000000000000000000000000002d6fbc798f4403751df6aeee8bedd3","0x0000000000000000000000000000007c1fa069cb17194fecf88db9dd54a4ee36","0x0000000000000000000000000000000000268e026f9814822a42b2d59eec5d24","0x000000000000000000000000000000c3fb56beab774218cd63498fc050a5fd9b","0x00000000000000000000000000000000000071c014d7b5063f005a0bc2ee1af4","0x000000000000000000000000000000ae12b25371c6af42bbe0a85cddd2eaebc7","0x000000000000000000000000000000000026d270e1ffc9c7c344c694dfadda83","0x00000000000000000000000000000080280858c6be461716921caa3c26f3f6f3","0x000000000000000000000000000000000001dcdd3f39e27d0ce6aa5d14dff4c1","0x000000000000000000000000000000080e1d2c913c834ebcf7e0600c076c08fd","0x00000000000000000000000000000000002df3d142217694e65fb7c355d62764","0x000000000000000000000000000000e5e336f3f59d77e500f49771bfbeb12e83","0x000000000000000000000000000000000028fffe08bdc4c0690643d2e1a1275f","0x000000000000000000000000000000db5618b32afc13e18f21b39f3fbede9d11","0x00000000000000000000000000000000001d244818370d43fb7e8bc67e03787b","0x0000000000000000000000000000006bcc1fd3f9f78449ad1df1bc11bc379edd","0x000000000000000000000000000000000009ac9cbb285edbf5b3a973f3f5f1cb","0x000000000000000000000000000000fd885905b6c0fc95bb4dd0b11f6797d4b3","0x000000000000000000000000000000000021f07995cdd835145e19c38127c562","0x000000000000000000000000000000bbbf2b975c2c97ae4b45c4a52059e53ee3","0x000000000000000000000000000000000024158163788841cf4590bbc1e89a90","0x0000000000000000000000000000009aca93d2b1386ea412d4b36ea5bb9894a8","0x00000000000000000000000000000000002532d1d210e8ed4c2f5c00cbaaa475","0x000000000000000000000000000000634a88caa1d77cb6b5fe77cac31458fc31","0x00000000000000000000000000000000000bdf18bae92fce7cfddab5520cac6e","0x000000000000000000000000000000622e9626255170ccec77602c755aa193e1","0x000000000000000000000000000000000001d4edba370e04436a988bad05dada","0x000000000000000000000000000000b52934323a0aec8f803cdaafee2ab7bfb2","0x0000000000000000000000000000000000155312af5e0e25ca9fd61aef9e58ed","0x06270b517855f6f6a608e432883d1d1030a12a1e33022dc142b7728691421da2","0x2af7c794d7b720b25eb1df0afd8c8e3c15b6e518194c3caea7966a5f8210ff04","0x073fe573aeb27d81a5713be93e1365390dcbc3c8e7439ff1d36a84cc014f5642","0x11351b961147431e54535248b58b35cf5cddb9b13827899167617d7a96794d64","0x297c9421c9c3db286770787c35b86bc41583386491b4ae55e5fa81aefa21efc4","0x0f4eeca3ff4a3495f859898937688652d33f9b4dd3e003e12adf15278e0997c3","0x133e3d8b82721d40d919f2326810ba6f07eff3f7d20d86b2bde692a811522019","0x2c502f53c9698b73bb8c8f9b9cf2d705d16a64a7040348b4b39c637a2064316c","0x0cbc1971e1c566cde9d9125c91cdc88e817db182692f836c1a5170a6246eaf73","0x12c47793e7db706c637cd4b4d96d227f569850176b852b1fe8ad522ddb38ef0e","0x0cd7b300e9309a135285be1aeb02b152f97931a7357ab6d609a2cb1970aab877","0x2a7789dfe286c9d0a7592f1c9316e730cb14c9d843aefc4764d76e7f8571c96a","0x248ac54ce3dbf37796621882a4ac76046df5ab680da487fd85cce76b1ae392d3","0x149d1d07cebe320f77b03533e34912545cedeae62bd9778d37724728762b5710","0x00fe29daebdaed61309790e70e2dcefa3f3af4c6c965ce424b8dbcf09b8e4b49","0x2b75b3bace61b731d7f0c003a144b62b0a4fbe9f0d14ca89b0652b70210014b3","0x2588ef27cfb6e0d8c6f9a969b2da44fead30a02ed70a563fd15aa45bb671de1c","0x2b74d7674b55642697b4a1e226eddb0e4918b2d57aa5b99093dc46cadcdea000","0x244c626845d3a5040f08f01e9611f968ad675ca857789149b13a0cfa83a2e064","0x2cb8d02f90cae33fd7bcfb80af4aff067c4f5fc4b3f9228d5b8f768bc8f6c971","0x1372f3d1f04e0c39a50e823d5da03d70bebe19a1b8e28f8c2ff601cc0bfc0095","0x19af6601d2613426a50b7c35d60562a5f2f2634e6af56dac13459632e15570ee","0x13c2a16ed3b65dcd9414659be79af17995d344de34eaf962343b0f1e76c73a57","0x0dd5dcdbd50b8774831d4f01f930804d38b4266dfee085185530880a0c3903c0","0x07e91848d660b11b722638680ac60f20db9507fdc8d610ce762600f5a1aacd29","0x1f9c2a94d10c0a7fb60292cfc46fd3d2501181bea0ffe1f5f2501d474be3a785","0x14edb9c5bd389eae08a5ea2a7a1662894e1e878c142084d966a625bef68cf7c3","0x00000000000000000000000000000000cecd01810814d175f0a533f0067618c4","0x00000000000000000000000000000000f82935013ce5c82720c63e533af41db8","0x000000000000000000000000000000012185688171b6bed850e748b66f7222ac","0x2dd7f5ff2150155c2ac86ebe28d9ecbca2eea812b0021ab2bceae111cfea8325","0x04ea6c2daf2b9e827d2213c3d03953410dcf1ed67ba34a3c00e772be92606a8b","0x163f2bd18dcde52f99b9867c944780fd718d1612927053b139b280fc55013d1b","0x05e388fd160ccac30a8f7b18a4bd042f705e92b5937e8c0e9478e2ff623907c6","0x00ba3f6f527d6ed3ff17a63b1d5be3c42bdfae88fdf63311fc7b871157939309","0x16187d9daa8c2e5a1a9ab15be7ca6a8feebfb31bea76f9a3ca69381881c70561","0x0f64522e4904edb7377b14a7b9dad848829167324ef5c016346b3ad8251191ee","0x273bbe6000a4001dce369e5a36cc0b0ca3fd351665b688238aa8c556a6ca6b8e","0x022d2232efb2faa8307846c9a4c697aabad1b7f1336b35ad72fa8922975b49d9","0x0d82d478bff3955c4b0a34ef94427ca5f9da23147ad953c89f2e428277ec2825","0x18d886be90343010659c231583be61a138e28e37c24771e3cb61fbe2587d0671","0x000000000000000000000000000000196ba6a58dbeb7c34cb1d6287e23d434de","0x00000000000000000000000000000000001df8ae8a1589590f8863c1fefd8dfd","0x000000000000000000000000000000f30e11b2c5fbefa166cbb9f58c5f8e1a4c","0x000000000000000000000000000000000026420ade7666bc0ab1cf1fd9d0c534","0x0000000000000000000000000000000feb5b7d8260d25a1ee1ce76ff461673fc","0x00000000000000000000000000000000002bd2ac6223a80671b777bf5dca70a4","0x000000000000000000000000000000690f757006d2fa1ddb0114c9f268783537","0x000000000000000000000000000000000023ad36feadd91e50118f32e97a0204"] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr new file mode 100644 index 00000000000..ecc00bbd560 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr @@ -0,0 +1,28 @@ +use dep::std; + +fn main( + verification_key: [Field; 114], + proof: [Field; 94], + public_inputs: [Field; 1], + key_hash: Field, + input_aggregation_object: [Field; 16], + proof_b: [Field; 94] +) -> pub [Field; 16] { + let output_aggregation_object_a = std::verify_proof(verification_key.as_slice(), + proof.as_slice(), + public_inputs.as_slice(), + key_hash, + input_aggregation_object); + + let output_aggregation_object = std::verify_proof(verification_key.as_slice(), + proof_b.as_slice(), + public_inputs.as_slice(), + key_hash, + output_aggregation_object_a); + + let mut output = [0; 16]; + for i in 0..16 { + output[i] = output_aggregation_object[i]; + } + output +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml new file mode 100644 index 00000000000..58fdf96f0e3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "ecdsa_secp256k1" +description = "ECDSA secp256k1 verification" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Prover.toml new file mode 100644 index 00000000000..412c7b36e4c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/Prover.toml @@ -0,0 +1,209 @@ + +hashed_message = [ + 0x3a, + 0x73, + 0xf4, + 0x12, + 0x3a, + 0x5c, + 0xd2, + 0x12, + 0x1f, + 0x21, + 0xcd, + 0x7e, + 0x8d, + 0x35, + 0x88, + 0x35, + 0x47, + 0x69, + 0x49, + 0xd0, + 0x35, + 0xd9, + 0xc2, + 0xda, + 0x68, + 0x06, + 0xb4, + 0x63, + 0x3a, + 0xc8, + 0xc1, + 0xe2, +] +message = [ + 0x49, + 0x6e, + 0x73, + 0x74, + 0x72, + 0x75, + 0x63, + 0x74, + 0x69, + 0x6f, + 0x6e, + 0x73, + 0x20, + 0x75, + 0x6e, + 0x63, + 0x6c, + 0x65, + 0x61, + 0x72, + 0x2c, + 0x20, + 0x61, + 0x73, + 0x6b, + 0x20, + 0x61, + 0x67, + 0x61, + 0x69, + 0x6e, + 0x20, + 0x6c, + 0x61, + 0x74, + 0x65, + 0x72, + 0x2e, +] +pub_key_x = [ + 0xa0, + 0x43, + 0x4d, + 0x9e, + 0x47, + 0xf3, + 0xc8, + 0x62, + 0x35, + 0x47, + 0x7c, + 0x7b, + 0x1a, + 0xe6, + 0xae, + 0x5d, + 0x34, + 0x42, + 0xd4, + 0x9b, + 0x19, + 0x43, + 0xc2, + 0xb7, + 0x52, + 0xa6, + 0x8e, + 0x2a, + 0x47, + 0xe2, + 0x47, + 0xc7, +] +pub_key_y = [ + 0x89, + 0x3a, + 0xba, + 0x42, + 0x54, + 0x19, + 0xbc, + 0x27, + 0xa3, + 0xb6, + 0xc7, + 0xe6, + 0x93, + 0xa2, + 0x4c, + 0x69, + 0x6f, + 0x79, + 0x4c, + 0x2e, + 0xd8, + 0x77, + 0xa1, + 0x59, + 0x3c, + 0xbe, + 0xe5, + 0x3b, + 0x03, + 0x73, + 0x68, + 0xd7, +] +signature = [ + 0xe5, + 0x08, + 0x1c, + 0x80, + 0xab, + 0x42, + 0x7d, + 0xc3, + 0x70, + 0x34, + 0x6f, + 0x4a, + 0x0e, + 0x31, + 0xaa, + 0x2b, + 0xad, + 0x8d, + 0x97, + 0x98, + 0xc3, + 0x80, + 0x61, + 0xdb, + 0x9a, + 0xe5, + 0x5a, + 0x4e, + 0x8d, + 0xf4, + 0x54, + 0xfd, + 0x28, + 0x11, + 0x98, + 0x94, + 0x34, + 0x4e, + 0x71, + 0xb7, + 0x87, + 0x70, + 0xcc, + 0x93, + 0x1d, + 0x61, + 0xf4, + 0x80, + 0xec, + 0xbb, + 0x0b, + 0x89, + 0xd6, + 0xeb, + 0x69, + 0x69, + 0x01, + 0x61, + 0xe4, + 0x9a, + 0x71, + 0x5f, + 0xcd, + 0x55, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr new file mode 100644 index 00000000000..552fcea9af7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr @@ -0,0 +1,10 @@ +use dep::std; + +fn main(message: [u8;38], hashed_message: [u8;32], pub_key_x: [u8;32], pub_key_y: [u8;32], signature: [u8;64]) { + // Hash the message, since secp256k1 expects a hashed_message + let expected = std::hash::sha256(message); + assert(hashed_message == expected); + + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml new file mode 100644 index 00000000000..87e8d529566 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "ecdsa_secp256r1" +description = "ECDSA secp256r1 verification" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Prover.toml new file mode 100644 index 00000000000..a45f799877b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/Prover.toml @@ -0,0 +1,20 @@ +hashed_message = [ + 84, 112, 91, 163, 186, 175, 219, 223, 186, 140, 95, 154, 112, 247, 168, 155, 238, 152, + 217, 6, 181, 62, 49, 7, 77, 167, 186, 236, 220, 13, 169, 173, +] +pub_key_x = [ + 85, 15, 71, 16, 3, 243, 223, 151, 195, 223, 80, 106, 199, 151, 246, 114, 31, 177, 161, + 251, 123, 143, 111, 131, 210, 36, 73, 138, 101, 200, 142, 36, +] +pub_key_y = [ + 19, 96, 147, 215, 1, 46, 80, 154, 115, 113, 92, 189, 11, 0, 163, 204, 15, 244, 181, + 192, 27, 63, 250, 25, 106, 177, 251, 50, 112, 54, 184, 230, +] +signature = [ + 44, 112, 168, 208, 132, 182, 43, 252, 92, 224, 54, 65, 202, 249, 247, 42, + 212, 218, 140, 129, 191, 230, 236, 148, 135, 187, 94, 27, 239, 98, 161, 50, + 24, 173, 158, 226, 158, 175, 53, 31, 220, 80, 241, 82, 12, 66, 94, 155, + 144, 138, 7, 39, 139, 67, 176, 236, 123, 135, 39, 120, 193, 78, 7, 132 +] + + diff --git a/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr new file mode 100644 index 00000000000..d23573d13a6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr @@ -0,0 +1,6 @@ +use dep::std; + +fn main(hashed_message: [u8;32], pub_key_x: [u8;32], pub_key_y: [u8;32], signature: [u8;64]) { + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + assert(valid_signature); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml new file mode 100644 index 00000000000..0f545c2febc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/eddsa/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "eddsa" +description = "Eddsa verification" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/eddsa/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/eddsa/Prover.toml new file mode 100644 index 00000000000..53555202ca6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/eddsa/Prover.toml @@ -0,0 +1,3 @@ +_priv_key_a = 123 +_priv_key_b = 456 +msg = 789 diff --git a/noir/tooling/nargo_cli/tests/execution_success/eddsa/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/eddsa/src/main.nr new file mode 100644 index 00000000000..12e8ea92785 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/eddsa/src/main.nr @@ -0,0 +1,46 @@ +use dep::std::compat; +use dep::std::ec::consts::te::baby_jubjub; +use dep::std::hash; +use dep::std::eddsa::eddsa_poseidon_verify; +fn main(msg: pub Field, _priv_key_a: Field, _priv_key_b: Field) { + // Skip this test for non-bn254 backends + if compat::is_bn254() { + let bjj = baby_jubjub(); + + let pub_key_a = bjj.curve.mul(_priv_key_a, bjj.curve.gen); + // let pub_key_b = bjj.curve.mul(_priv_key_b, bjj.curve.gen); + // Manually computed as fields can't use modulo. Importantantly the commitment is within + // the subgroup order. Note that choice of hash is flexible for this step. + // let r_a = hash::pedersen_commitment([_priv_key_a, msg])[0] % bjj.suborder; // modulus computed manually + let r_a = 1414770703199880747815475415092878800081323795074043628810774576767372531818; + // let r_b = hash::pedersen_commitment([_priv_key_b, msg])[0] % bjj.suborder; // modulus computed manually + let r_b = 571799555715456644614141527517766533395606396271089506978608487688924659618; + + let r8_a = bjj.curve.mul(r_a, bjj.base8); + let r8_b = bjj.curve.mul(r_b, bjj.base8); + // let h_a: [Field; 6] = hash::poseidon::bn254::hash_5([ + // r8_a.x, + // r8_a.y, + // pub_key_a.x, + // pub_key_a.y, + // msg, + // ]); + // let h_b: [Field; 6] = hash::poseidon::bn254::hash_5([ + // r8_b.x, + // r8_b.y, + // pub_key_b.x, + // pub_key_b.y, + // msg, + // ]); + // let s_a = (r_a + _priv_key_a * h_a) % bjj.suborder; // modulus computed manually + let s_a = 30333430637424319196043722294837632681219980330991241982145549329256671548; + // let s_b = (r_b + _priv_key_b * h_b) % bjj.suborder; // modulus computed manually + let s_b = 1646085314320208098241070054368798527940102577261034947654839408482102287019; + // User A verifies their signature over the message + assert(eddsa_poseidon_verify(pub_key_a.x, pub_key_a.y, s_a, r8_a.x, r8_a.y, msg)); + // User B's signature over the message can't be used with user A's pub key + assert(!eddsa_poseidon_verify(pub_key_a.x, pub_key_a.y, s_b, r8_b.x, r8_b.y, msg)); + // User A's signature over the message can't be used with another message + assert(!eddsa_poseidon_verify(pub_key_a.x, pub_key_a.y, s_a, r8_a.x, r8_a.y, msg + 1)); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml new file mode 100644 index 00000000000..37487d0043c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "field_attribute" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/field_attribute/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/src/main.nr new file mode 100644 index 00000000000..dda83db40de --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/field_attribute/src/main.nr @@ -0,0 +1,19 @@ +// Test integer addition: 3 + 4 = 7 +fn main(mut x: u32) { + assert(x > foo()); +} + +#[field(bn254)] +fn foo() -> u32 { + 1 +} + +#[field(23)] +fn foo() -> u32 { + 2 +} + +#[field(bls12_381)] +fn foo() -> u32 { + 3 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml new file mode 100644 index 00000000000..19c8ff28ec7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/generics/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "generics" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/generics/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/generics/Prover.toml new file mode 100644 index 00000000000..85f1e9f96f2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/generics/Prover.toml @@ -0,0 +1,2 @@ +x = "2" +y = "2" diff --git a/noir/tooling/nargo_cli/tests/execution_success/generics/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/generics/src/main.nr new file mode 100644 index 00000000000..3edce1ed8e7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/generics/src/main.nr @@ -0,0 +1,67 @@ +struct Bar { + one: Field, + two: Field, + other: T, +} + +fn foo(bar: Bar) { + assert(bar.one == bar.two); +} + +struct BigInt { + limbs: [u32; N], +} + +impl BigInt { + // `N` is in scope of all methods in the impl + fn first(first: BigInt, second: BigInt) -> Self { + assert(first.limbs != second.limbs); + first + } + + fn second(first: BigInt, second: Self) -> Self { + assert(first.limbs != second.limbs); + second + } +} + +impl Bar { + fn get_other(self) -> Field { + self.other + } +} + +fn main(x: Field, y: Field) { + let bar1: Bar = Bar { one: x, two: y, other: 0 }; + let bar2 = Bar { one: x, two: y, other: [0] }; + + foo(bar1); + foo(bar2); + // Test generic impls + let int1 = BigInt { limbs: [1] }; + let int2 = BigInt { limbs: [2] }; + let BigInt { limbs } = int1.second(int2).first(int1); + assert(limbs == int2.limbs); + // Test impl exclusively for Bar + assert(bar1.get_other() == bar1.other); + // Expected type error + // assert(bar2.get_other() == bar2.other); + let one = x; + let two = y; + let nested_generics: Bar> = Bar { one, two, other: Bar { one, two, other: 0 } }; + assert(nested_generics.other.other == bar1.get_other()); + + let _ = regression_2055([1, 2, 3]); +} + +fn regression_2055(bytes: [u8; LEN]) -> Field { + let mut f = 0; + let mut b = 1; + let mut len = LEN - 1; // FAILS + for i in 0..LEN { + let j = len - i; + f += (bytes[j] as Field) * b; + b *= 256; + } + f +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml new file mode 100644 index 00000000000..3b4d6be2353 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "global_consts" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/global_consts/Prover.toml new file mode 100644 index 00000000000..66f7feb1dda --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/Prover.toml @@ -0,0 +1,4 @@ +a = [77,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] +b = [44,75,108,209,54,16,50,202,155,210,174,185,217,0,170,77,69,217,234,216,10,201,66,51,116,196,81,167,37,77,7,102] +c = [3, 3, 3] +d = [5, 5, 5, 5, 5] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/baz.nr b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/baz.nr new file mode 100644 index 00000000000..4271de81118 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/baz.nr @@ -0,0 +1,5 @@ +pub fn from_baz(x: [Field; crate::foo::MAGIC_NUMBER]) { + for i in 0..crate::foo::MAGIC_NUMBER { + assert(x[i] == crate::foo::MAGIC_NUMBER); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo.nr b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo.nr new file mode 100644 index 00000000000..7b0ae75b74b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo.nr @@ -0,0 +1,11 @@ +mod bar; + +global N: Field = 5; +global MAGIC_NUMBER: Field = 3; +global TYPE_INFERRED = 42; + +pub fn from_foo(x: [Field; bar::N]) { + for i in 0..bar::N { + assert(x[i] == bar::N); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr new file mode 100644 index 00000000000..b8d0b85b0f3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr @@ -0,0 +1,5 @@ +global N: Field = 5; + +pub fn from_bar(x: Field) -> Field { + x * N +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr new file mode 100644 index 00000000000..a749ec77da6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr @@ -0,0 +1,96 @@ +mod foo; +mod baz; + +global M: Field = 32; +global L: Field = 10; // Unused globals currently allowed +global N: Field = 5; +global T_LEN = 2; // Type inference is allowed on globals +//global N: Field = 5; // Uncomment to see duplicate globals error +struct Dummy { + x: [Field; N], + y: [Field; foo::MAGIC_NUMBER] +} + +struct Test { + v: Field, +} +global VALS: [Test; 1] = [Test { v: 100 }]; +global NESTED = [VALS, VALS]; + +fn main( + a: [Field; M + N - N], + b: [Field; 30 + N / 2], + c: pub [Field; foo::MAGIC_NUMBER], + d: [Field; foo::bar::N] +) { + let test_struct = Dummy { x: d, y: c }; + + for i in 0..foo::MAGIC_NUMBER { + assert(c[i] == foo::MAGIC_NUMBER); + assert(test_struct.y[i] == foo::MAGIC_NUMBER); + assert(test_struct.y[i] != NESTED[1][0].v); + } + + assert(N != M); + + let expected: u32 = 42; + assert(foo::TYPE_INFERRED == expected); + + let mut y = 5; + let mut x = M; + for i in 0..N * N { + let M: Field = 10; + x = M; + + y = i; + } + assert(y == 24); + assert(x == 10); + + let q = multiplyByM(3); + assert(q == 96); + + arrays_neq(a, b); + + let t: [Field; T_LEN] = [N, M]; + assert(t[1] == 32); + + assert(15 == mysubmodule::my_helper()); + + let add_submodules_N = mysubmodule::N + foo::bar::N; + assert(15 == add_submodules_N); + let add_from_bar_N = mysubmodule::N + foo::bar::from_bar(1); + assert(15 == add_from_bar_N); + // Example showing an array filled with (mysubmodule::N + 2) 0's + let sugared = [0; mysubmodule::N + 2]; + assert(sugared[mysubmodule::N + 1] == 0); + + let arr: [Field; mysubmodule::N] = [N; 10]; + assert((arr[0] == 5) & (arr[9] == 5)); + + foo::from_foo(d); + baz::from_baz(c); +} + +fn multiplyByM(x: Field) -> Field { + x * M +} + +fn arrays_neq(a: [Field; M], b: [Field; M]) { + assert(a != b); +} + +mod mysubmodule { + global N: Field = 10; + global L: Field = 50; + + fn my_bool_or(x: u1, y: u1) { + assert(x | y == 1); + } + + pub fn my_helper() -> Field { + let N: Field = 15; // Like in Rust, local variables override globals + let x = N; + x + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml new file mode 100644 index 00000000000..a00a7bdc050 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "hash_to_field" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Prover.toml new file mode 100644 index 00000000000..f6597d3f78a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/Prover.toml @@ -0,0 +1 @@ +input = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr new file mode 100644 index 00000000000..5af1c5af55e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/hash_to_field/src/main.nr @@ -0,0 +1,5 @@ +use dep::std; + +fn main(input: Field) -> pub Field { + std::hash::hash_to_field([input]) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml new file mode 100644 index 00000000000..8f8a79e7e83 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "higher_order_functions" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Prover.toml new file mode 100644 index 00000000000..b373bb827c4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/Prover.toml @@ -0,0 +1 @@ +w = 1 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/src/main.nr new file mode 100644 index 00000000000..479cdbbe7bf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/higher_order_functions/src/main.nr @@ -0,0 +1,97 @@ +fn main(w: Field) -> pub Field { + let f = if 3 * 7 > 200 as u32 { foo } else { bar }; + assert(f()[1] == 2); + // Lambdas: + assert(twice(|x| x * 2, 5) == 20); + assert((|x, y| x + y + 1)(2, 3) == 6); + // nested lambdas + assert((|a, b| { + a + (|c| c + 2)(b) + })(0, 1) + == 3); + // Closures: + let a = 42; + let g = || a; + assert(g() == 42); + // When you copy mutable variables, + // the capture of the copies shouldn't change: + let mut x = 2; + x = x + 1; + let z = x; + // Add extra mutations to ensure we can mutate x without the + // captured z changing. + x = x + 1; + assert((|y| y + z)(1) == 4); + // When you capture mutable variables, + // again, the captured variable doesn't change: + let closure_capturing_mutable = (|y| y + x); + assert(closure_capturing_mutable(1) == 5); + x += 1; + assert(closure_capturing_mutable(1) == 5); + + regression_2154(); + + let ret = twice(add1, 3); + + test_array_functions(); + w + ret +} +/// Test the array functions in std::array +fn test_array_functions() { + let two = 2; // giving this a name, to ensure that the Option functions work with closures + let myarray: [i32; 3] = [1, 2, 3]; + assert(myarray.any(|n| n > 2)); + assert(myarray.any(|n| n > two)); + + let evens: [i32; 3] = myarray.map(|n| n * two); // [2, 4, 6] + assert(evens.all(|n| n > 1)); + assert(evens.all(|n| n >= two)); + + assert(evens.fold(0, |a, b| a + b) == 12); + assert(evens.fold(0, |a, b| a + b + two) == 18); + assert(evens.reduce(|a, b| a + b) == 12); + assert(evens.reduce(|a, b| a + b + two) == 16); + // TODO: is this a sort_via issue with the new backend, + // or something more general? + // + // currently it fails only with `--experimental-ssa` with + // "not yet implemented: Cast into signed" + // but it worked with the original ssa backend + // (before dropping it) + // + // opened #2121 for it + // https://github.com/noir-lang/noir/issues/2121 + // let descending = myarray.sort_via(|a, b| a > b); + // assert(descending == [3, 2, 1]); + assert(evens.map(|n| n / 2) == myarray); + assert(evens.map(|n| n / two) == myarray); +} + +fn foo() -> [u32; 2] { + [1, 3] +} + +fn bar() -> [u32; 2] { + [3, 2] +} + +fn add1(x: Field) -> Field { + x + 1 +} + +fn twice(f: fn(Field) -> Field, x: Field) -> Field { + f(f(x)) +} +// Fixing an ICE, where rewriting the closures +// during monomorphization didn't correspond +// to an internal `if` type +// found by @jfecher: +// https://github.com/noir-lang/noir/pull/1959#issuecomment-1658992989 +// issue https://github.com/noir-lang/noir/issues/2154 +fn regression_2154() { + let x: u32 = 32; + + let closure_if_else = if x > 2 { || x } else { || x + 2342 }; + + assert(closure_if_else() == 32); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml new file mode 100644 index 00000000000..2f0dc93d120 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "if_else_chain" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Prover.toml new file mode 100644 index 00000000000..84aeb36ac21 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/Prover.toml @@ -0,0 +1,2 @@ +a=0 +c=[2, 4, 3, 0, ] diff --git a/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr new file mode 100644 index 00000000000..2705d5b3111 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr @@ -0,0 +1,15 @@ +fn main(a: u32, mut c: [u32; 4]) { + if a == c[0] { + assert(c[0] == 0); + } else if a == c[1] { + assert(c[1] == 0); + } else if a == c[2] { + assert(c[2] == 0); + } else if a == c[3] { + // expect to match this case + assert(c[3] == 0); + } else { + assert(c[0] == 10); + } +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/import/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/import/Nargo.toml new file mode 100644 index 00000000000..c92328f106c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/import/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "import" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/import/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/import/Prover.toml new file mode 100644 index 00000000000..8c12ebba6cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/import/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "2" diff --git a/noir/tooling/nargo_cli/tests/execution_success/import/src/import.nr b/noir/tooling/nargo_cli/tests/execution_success/import/src/import.nr new file mode 100644 index 00000000000..ef3f0d94c28 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/import/src/import.nr @@ -0,0 +1,3 @@ +pub fn hello(x: Field) -> Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/import/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/import/src/main.nr new file mode 100644 index 00000000000..7dcc16fed16 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/import/src/main.nr @@ -0,0 +1,9 @@ +mod import; +use crate::import::hello; + +fn main(x: Field, y: Field) { + let _k = dep::std::hash::pedersen_commitment([x]); + let _l = hello(x); + + assert(x != import::hello(y)); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml new file mode 100644 index 00000000000..6e639b64f58 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "integer_array_indexing" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Prover.toml new file mode 100644 index 00000000000..1496028f60a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/Prover.toml @@ -0,0 +1,2 @@ +arr = [1, 2, 3] +x = 2 diff --git a/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr new file mode 100644 index 00000000000..1698c68161b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr @@ -0,0 +1,10 @@ +global ARRAY_LEN: u32 = 3; + +fn main(arr: [Field; ARRAY_LEN], x: u32) -> pub Field { + let mut value = arr[ARRAY_LEN - 1]; + + value += arr[0 as u32]; + value += arr[1 as Field]; + + value + x as Field +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml new file mode 100644 index 00000000000..7e48c3b342c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/keccak256/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "keccak256" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/keccak256/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/keccak256/Prover.toml new file mode 100644 index 00000000000..d65c4011d3f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/keccak256/Prover.toml @@ -0,0 +1,35 @@ +x = 0xbd +result = [ + 0x5a, + 0x50, + 0x2f, + 0x9f, + 0xca, + 0x46, + 0x7b, + 0x26, + 0x6d, + 0x5b, + 0x78, + 0x33, + 0x65, + 0x19, + 0x37, + 0xe8, + 0x05, + 0x27, + 0x0c, + 0xa3, + 0xf3, + 0xaf, + 0x1c, + 0x0d, + 0xd2, + 0x46, + 0x2d, + 0xca, + 0x4b, + 0x3b, + 0x1a, + 0xbf, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr new file mode 100644 index 00000000000..ff2167694d6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr @@ -0,0 +1,21 @@ +// Keccak256 example +// +use dep::std; + +fn main(x: Field, result: [u8; 32]) { + // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field + // The padding is taken care of by the program + let digest = std::hash::keccak256([x as u8], 1); + assert(digest == result); + //#1399: variable meesage size + let message_size = 4; + let hash_a = std::hash::keccak256([1, 2, 3, 4], message_size); + let hash_b = std::hash::keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size); + + assert(hash_a == hash_b); + + let message_size_big = 8; + let hash_c = std::hash::keccak256([1, 2, 3, 4, 0, 0, 0, 0], message_size_big); + + assert(hash_a != hash_c); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml new file mode 100644 index 00000000000..c1cedb6c657 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "main_bool_arg" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Prover.toml new file mode 100644 index 00000000000..f932e0b4817 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/Prover.toml @@ -0,0 +1,2 @@ +x = true +y = [true, false] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/src/main.nr new file mode 100644 index 00000000000..111a23ec0c2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/main_bool_arg/src/main.nr @@ -0,0 +1,8 @@ +fn main(x: bool, y: [bool;2]) { + if x { + assert(1 != 2); + } + + assert(x); + assert(y[0] != y[1]); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml new file mode 100644 index 00000000000..f09458411d8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "merkle_insert" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml new file mode 100644 index 00000000000..0656908c063 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/Prover.toml @@ -0,0 +1,11 @@ +old_root = "0x2131c74af6250d1246797588ff075b672e3d2e6805f9c6b313ade8f6b9e12802" +old_leaf = "0x2df8b940e5890e4e1377e05373fae69a1d754f6935e6a780b666947431f2cdcd" +old_hash_path = [ + "0x03542cb720369f19a74fd05b4edfbedb27a78514ad3283f1b3270a1656cced8e", + "0x1278272f6e617666b18c52349c4bbe94249a8ab59add2ee0a142168a92b7ffc2", + "0x2547cfd7699ad1f331fb77b30a3445c6043a4c62b5b1215356b2924607bf937b", +] +new_root = "0x25e2a8ee5b85e5b546ae27832b9b53f5fae5b371e3e7f8cddda839f41669fc68" +leaf = "0x23fe6c8f2426b793f0f156f57efbecbea52e951af761634a85e80cc1a9fb5003" +index = "0" +mimc_input = [12, 45, 78, 41] diff --git a/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr new file mode 100644 index 00000000000..ac9a7b34ea3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/merkle_insert/src/main.nr @@ -0,0 +1,22 @@ +use dep::std; +use dep::std::hash::mimc; + +fn main( + old_root: Field, + old_leaf: Field, + old_hash_path: [Field; 3], + new_root: pub Field, + leaf: Field, + index: Field, + mimc_input: [Field; 4] +) { + assert(old_root == std::merkle::compute_merkle_root(old_leaf, index, old_hash_path)); + + let calculated_root = std::merkle::compute_merkle_root(leaf, index, old_hash_path); + assert(new_root == calculated_root); + + let h = mimc::mimc_bn254(mimc_input); + // Regression test for PR #891 + std::println(h); + assert(h == 18226366069841799622585958305961373004333097209608110160936134895615261821931); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml new file mode 100644 index 00000000000..b2916487e8c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "mock_oracle" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Prover.toml new file mode 100644 index 00000000000..2b26a4ce471 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/Prover.toml @@ -0,0 +1,2 @@ +x = "10" + diff --git a/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr new file mode 100644 index 00000000000..90fca7993cc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr @@ -0,0 +1,27 @@ +use dep::std::test::OracleMock; + +struct Point { + x: Field, + y: Field, +} + +#[oracle(foo)] +unconstrained fn foo_oracle(_point: Point, _array: [Field; 4]) -> Field {} + +unconstrained fn main() { + let array = [1, 2, 3, 4]; + let another_array = [4, 3, 2, 1]; + let point = Point { x: 14, y: 27 }; + + OracleMock::mock("foo").returns(42).times(1); + let mock = OracleMock::mock("foo").returns(0); + assert_eq(42, foo_oracle(point, array)); + assert_eq(0, foo_oracle(point, array)); + mock.clear(); + + OracleMock::mock("foo").with_params((point, array)).returns(10); + OracleMock::mock("foo").with_params((point, another_array)).returns(20); + assert_eq(10, foo_oracle(point, array)); + assert_eq(20, foo_oracle(point, another_array)); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml new file mode 100644 index 00000000000..ab1d6e962d7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "modules" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/modules/Prover.toml new file mode 100644 index 00000000000..c0a0cdfbeb0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules/Prover.toml @@ -0,0 +1,2 @@ +x = "2" +y = "13" diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr b/noir/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr new file mode 100644 index 00000000000..ef3f0d94c28 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr @@ -0,0 +1,3 @@ +pub fn hello(x: Field) -> Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/modules/src/main.nr new file mode 100644 index 00000000000..167f7e671a0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules/src/main.nr @@ -0,0 +1,14 @@ +mod foo; +// This is a comment. +// +// `main` is the entry point to a binary +// +// You can have a `Binary` or a `Library` +// Release : 0.2 +// +// To run a proof on the command line, type `cargo run prove {proof_name}` +// +// To verify that proof, type `cargo run verify {proof_name}` +fn main(x: Field, y: pub Field) { + assert(x != foo::hello(y)); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml new file mode 100644 index 00000000000..bfcfe08fa79 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules_more/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "modules_more" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules_more/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/modules_more/Prover.toml new file mode 100644 index 00000000000..39a4ddb9d15 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules_more/Prover.toml @@ -0,0 +1,4 @@ + + x = "5" + y = "15" + \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo.nr b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo.nr new file mode 100644 index 00000000000..fa531a1a2f0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo.nr @@ -0,0 +1,5 @@ +mod bar; + +fn hello(x: Field) -> Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr new file mode 100644 index 00000000000..1665f720be6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr @@ -0,0 +1,3 @@ +pub fn from_bar(x: Field) -> Field { + x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/main.nr new file mode 100644 index 00000000000..93b76d62845 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modules_more/src/main.nr @@ -0,0 +1,5 @@ +mod foo; +// An example of the module system +fn main(x: Field, y: Field) { + assert(x != foo::bar::from_bar(y)); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml new file mode 100644 index 00000000000..256eeef058f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modulus/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "modulus" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/modulus/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/modulus/Prover.toml new file mode 100644 index 00000000000..d435609bb1a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modulus/Prover.toml @@ -0,0 +1,290 @@ +bn254_modulus_be_bytes = [ + 48, + 100, + 78, + 114, + 225, + 49, + 160, + 41, + 184, + 80, + 69, + 182, + 129, + 129, + 88, + 93, + 40, + 51, + 232, + 72, + 121, + 185, + 112, + 145, + 67, + 225, + 245, + 147, + 240, + 0, + 0, + 1, +] +bn254_modulus_be_bits = [ + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr new file mode 100644 index 00000000000..35f63fdc8c5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr @@ -0,0 +1,25 @@ +use dep::std; + +fn main(bn254_modulus_be_bytes: [u8; 32], bn254_modulus_be_bits: [u1; 254]) { + let modulus_size = std::field::modulus_num_bits(); + // NOTE: The constraints used in this circuit will only work when testing nargo with the plonk bn254 backend + assert(modulus_size == 254); + + let modulus_be_byte_array = std::field::modulus_be_bytes(); + for i in 0..32 { + assert(modulus_be_byte_array[i] == bn254_modulus_be_bytes[i]); + } + let modulus_le_byte_array = std::field::modulus_le_bytes(); + for i in 0..32 { + assert(modulus_le_byte_array[i] == bn254_modulus_be_bytes[31 - i]); + } + + let modulus_be_bits = std::field::modulus_be_bits(); + for i in 0..254 { + assert(modulus_be_bits[i] == bn254_modulus_be_bits[i]); + } + let modulus_le_bits = std::field::modulus_le_bits(); + for i in 0..254 { + assert(modulus_le_bits[i] == bn254_modulus_be_bits[253 - i]); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml new file mode 100644 index 00000000000..72642bebc15 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "nested_array_dynamic" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Prover.toml new file mode 100644 index 00000000000..6c7e77b581d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/Prover.toml @@ -0,0 +1,29 @@ +y = "3" + +[[x]] +a = "1" +b = ["2", "3", "20"] + +[x.bar] +inner = ["100", "101", "102"] + +[[x]] +a = "4" # idx = 3, flattened start idx = 7 +b = ["5", "6", "21"] # idx = 4, flattened start idx = 8 + +[x.bar] +inner = ["103", "104", "105"] # idx = 5, flattened start idx = 11 + +[[x]] +a = "7" +b = ["8", "9", "22"] + +[x.bar] +inner = ["106", "107", "108"] + +[[x]] +a = "10" # idx = 9, flattened start idx = 21 +b = ["11", "12", "23"] # idx = 10, flattened start idx = 22 + +[x.bar] +inner = ["109", "110", "111"] # idx = 11, flattened start idx = 25 diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr new file mode 100644 index 00000000000..2c53822d6b9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr @@ -0,0 +1,76 @@ +struct Bar { + inner: [Field; 3], +} + +struct Foo { + a: Field, + b: [Field; 3], + bar: Bar, +} + +struct FooParent { + array: [Field; 3], + foos: [Foo; 4], +} + +fn main(mut x: [Foo; 4], y: pub Field) { + assert(x[y - 3].a == 1); + assert(x[y - 3].b == [2, 3, 20]); + assert(x[y - 2].a == 4); + assert(x[y - 2].b == [5, 6, 21]); + assert(x[y - 1].a == 7); + assert(x[y - 1].b == [8, 9, 22]); + assert(x[y].a == 10); + assert(x[y].b == [11, 12, 23]); + assert(x[y].bar.inner == [109, 110, 111]); + // Check dynamic array set + if y != 2 { + x[y].a = 50; + } else { + x[y].a = 100; + } + assert(x[3].a == 50); + + if y == 2 { + x[y - 1].b = [50, 51, 52]; + } else { + x[y - 1].b = [100, 101, 102]; + } + assert(x[2].b == [100, 101, 102]); + + assert(x[y - 3].bar.inner == [100, 101, 102]); + assert(x[y - 2].bar.inner == [103, 104, 105]); + assert(x[y - 1].bar.inner == [106, 107, 108]); + assert(x[y].bar.inner == [109, 110, 111]); + + let foo_parent_one = FooParent { array: [0, 1, 2], foos: x }; + let foo_parent_two = FooParent { array: [3, 4, 5], foos: x }; + let mut foo_parents = [foo_parent_one, foo_parent_two]; + + assert(foo_parents[y - 3].foos[y - 3].b == [2, 3, 20]); + assert(foo_parents[y - 3].foos[y - 2].b == [5, 6, 21]); + assert(foo_parents[y - 3].foos[y - 1].b == [100, 101, 102]); + assert(foo_parents[y - 3].foos[y].b == [11, 12, 23]); + + assert(foo_parents[y - 3].foos[y].a == 50); + + assert(foo_parents[1].foos[1].b == [5, 6, 21]); + if y == 2 { + foo_parents[y - 2].foos[y - 2].b = [10, 9, 8]; + } else { + foo_parents[y - 2].foos[y - 2].b = [20, 19, 18]; + } + assert(foo_parents[1].foos[1].b == [20, 19, 18]); + + assert(foo_parents[1].foos[1].b[2] == 18); + if y == 3 { + foo_parents[y - 2].foos[y - 2].b[y - 1] = 5000; + } else { + foo_parents[y - 2].foos[y - 2].b[y - 1] = 1000; + } + assert(foo_parents[1].foos[1].b[2] == 5000); + // Set a dynamic array value + foo_parents[y - 2].foos[y - 3].b = foo_parents[y - 2].foos[y - 2].b; + assert(foo_parents[1].foos[0].b == [20, 19, 5000]); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml new file mode 100644 index 00000000000..02d2e6e6a4e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "nested_arrays_from_brillig" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Prover.toml new file mode 100644 index 00000000000..1a59cd124a7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/Prover.toml @@ -0,0 +1 @@ +values = [1,2,3,4,5,6] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/src/main.nr new file mode 100644 index 00000000000..1bcbd7d5421 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_arrays_from_brillig/src/main.nr @@ -0,0 +1,26 @@ +struct Header { + params: [Field; 3], +} + +struct MyNote { + plain: Field, + array: [Field; 2], + header: Header, +} + +fn access_nested(notes: [MyNote; 2]) -> Field { + notes[0].array[1] + notes[1].array[0] + notes[0].plain + notes[1].header.params[0] +} + +unconstrained fn create_inside_brillig(values: [Field; 6]) -> [MyNote; 2] { + let header = Header { params: [values[0], values[1], values[2]] }; + let note0 = MyNote { array: [values[0], values[1]], plain: values[2], header }; + let note1 = MyNote { array: [values[3], values[4]], plain: values[5], header }; + [note0, note1] +} + +fn main(values: [Field; 6]) { + let notes = create_inside_brillig(values); + assert(access_nested(notes) == (2 + 4 + 3 + 1)); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml new file mode 100644 index 00000000000..c8925ed97b4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "nested_slice_dynamic" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Prover.toml new file mode 100644 index 00000000000..7127baac5bf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/Prover.toml @@ -0,0 +1 @@ +y = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr new file mode 100644 index 00000000000..a3007d5d0dc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr @@ -0,0 +1,49 @@ +struct Bar { + inner: [Field; 3], +} + +struct Foo { + a: Field, + b: [Field; 3], + bar: Bar, +} + +fn main(y: Field) { + let foo_one = Foo { a: 1, b: [2, 3, 20], bar: Bar { inner: [100, 101, 102] } }; + let foo_two = Foo { a: 4, b: [5, 6, 21], bar: Bar { inner: [103, 104, 105] } }; + let foo_three = Foo { a: 7, b: [8, 9, 22], bar: Bar { inner: [106, 107, 108] } }; + let foo_four = Foo { a: 10, b: [11, 12, 23], bar: Bar { inner: [109, 110, 111] } }; + let mut x = [foo_one]; + x = x.push_back(foo_two); + x = x.push_back(foo_three); + x = x.push_back(foo_four); + + assert(x[y - 3].a == 1); + assert(x[y - 3].b == [2, 3, 20]); + assert(x[y - 2].a == 4); + assert(x[y - 2].b == [5, 6, 21]); + assert(x[y - 1].a == 7); + assert(x[y - 1].b == [8, 9, 22]); + assert(x[y].a == 10); + assert(x[y].b == [11, 12, 23]); + assert(x[y].bar.inner == [109, 110, 111]); + + if y != 2 { + x[y - 2].a = 50; + } else { + x[y - 2].a = 100; + } + assert(x[y - 2].a == 50); + + if y == 2 { + x[y - 1].b = [50, 51, 52]; + } else { + x[y - 1].b = [100, 101, 102]; + } + assert(x[2].b == [100, 101, 102]); + + assert(x[y - 3].bar.inner == [100, 101, 102]); + assert(x[y - 2].bar.inner == [103, 104, 105]); + assert(x[y - 1].bar.inner == [106, 107, 108]); + assert(x[y].bar.inner == [109, 110, 111]); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml new file mode 100644 index 00000000000..65fd3b5cf59 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "pedersen_check" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Prover.toml new file mode 100644 index 00000000000..db1ebdf6c51 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/Prover.toml @@ -0,0 +1,7 @@ +x = "0" +y = "1" +salt = "42" + +out_x = "0x054aa86a73cb8a34525e5bbed6e43ba1198e860f5f3950268f71df4591bde402" +out_y = "0x209dcfbf2cfb57f9f6046f44d71ac6faf87254afc7407c04eb621a6287cac126" +out_hash = "0x0d98561fb02ca04d00801dfdc118b2a24cea0351963587712a28d368041370e1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr new file mode 100644 index 00000000000..90ef218249b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr @@ -0,0 +1,22 @@ +use dep::std; + +fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field, out_hash: Field) { + let res = std::hash::pedersen_commitment([x, y]); + assert(res.x == out_x); + assert(res.y == out_y); + + let res_hash = std::hash::pedersen_hash_with_separator([x, y], 0); + assert_eq(res_hash, out_hash); + + assert(res_hash != res.x); + + let raw_data = [x, y]; + let mut state = 0; + for i in 0..2 { + state = state * 8 + raw_data[i]; + } + state += salt; + let hash = std::hash::pedersen_commitment([state]); + assert(std::hash::pedersen_commitment([43]).x == hash.x); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml new file mode 100644 index 00000000000..a8e2b3d5a2c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "poseidon_bn254_hash" +description = "Poseidon 254-bit permutation test on 3 elements with alpha = 5" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Prover.toml new file mode 100644 index 00000000000..8eecf9a3db2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/Prover.toml @@ -0,0 +1,4 @@ +x1 = [1,2] +y1 = "0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a" +x2 = [1,2,3,4] +y2 = "0x299c867db6c1fdd79dcefa40e4510b9837e60ebb1ce0663dbaa525df65250465" diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr new file mode 100644 index 00000000000..3d30ebad279 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr @@ -0,0 +1,9 @@ +use dep::std::hash::poseidon; + +fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) { + let hash1 = poseidon::bn254::hash_2(x1); + assert(hash1 == y1); + + let hash2 = poseidon::bn254::hash_4(x2); + assert(hash2 == y2); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml new file mode 100644 index 00000000000..de4b1a44668 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "poseidonsponge_x5_254" +description = "Variable-length Poseidon-128 sponge test on 7 elements with alpha = 5" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Prover.toml new file mode 100644 index 00000000000..f8a6be57b24 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/Prover.toml @@ -0,0 +1 @@ +x = [1,2,3,4,5,6,7] diff --git a/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr new file mode 100644 index 00000000000..910a17c8c89 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr @@ -0,0 +1,8 @@ +use dep::std::hash::poseidon; + +fn main(x: [Field; 7]) { + // Test optimized sponge + let result = poseidon::bn254::sponge(x); + + assert(result == 0x080ae1669d62f0197190573d4a325bfb8d8fc201ce3127cbac0c47a7ac81ac48); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml new file mode 100644 index 00000000000..b5b4a9fdf61 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "pred_eq" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Prover.toml new file mode 100644 index 00000000000..465ef562de4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/pred_eq/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/src/main.nr new file mode 100644 index 00000000000..d1e79a3e408 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/pred_eq/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: Field, y: Field) { + let p = x == y; + assert(p == true); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/references/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/references/Nargo.toml new file mode 100644 index 00000000000..c4be4d4218d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/references/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "references" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/references/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/references/Prover.toml new file mode 100644 index 00000000000..151faa5a9b1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/references/Prover.toml @@ -0,0 +1 @@ +x = "2" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/references/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/references/src/main.nr new file mode 100644 index 00000000000..1a9be5f82b9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/references/src/main.nr @@ -0,0 +1,226 @@ +fn main(mut x: Field) { + add1(&mut x); + assert(x == 3); + + let mut s = S { y: x }; + s.add2(); + assert(s.y == 5); + // Regression for #1946: Method resolution error when calling &mut methods with a variable of type &mut T + let s_ref = &mut s; + s_ref.add2(); + assert(s.y == 7); + // Test that normal mutable variables are still copied + let mut a = 0; + mutate_copy(a); + assert(a == 0); + // Test something 3 allocations deep + let mut nested_allocations = Nested { y: &mut &mut 0 }; + add1(*nested_allocations.y); + assert(**nested_allocations.y == 1); + // Test nested struct allocations with a mutable reference to an array. + let mut c = C { foo: 0, bar: &mut C2 { array: &mut [1, 2] } }; + *c.bar.array = [3, 4]; + assert(*c.bar.array == [3, 4]); + + regression_1887(); + regression_2054(); + regression_2030(); + regression_2255(); + + assert(x == 3); + regression_2218_if_inner_if(x, 10); + regression_2218_if_inner_else(20, x); + regression_2218_else(x, 3); + regression_2218_loop(x, 10); + + regression_2560(s_ref); +} + +fn add1(x: &mut Field) { + *x += 1; +} + +struct S { y: Field } + +struct Nested { y: &mut &mut Field } + +struct C { + foo: Field, + bar: &mut C2, +} + +struct C2 { + array: &mut [Field; 2] +} + +impl S { + fn add2(&mut self) { + self.y += 2; + } + + fn get_y(self) -> Field { + self.y + } +} + +fn mutate_copy(mut a: Field) { + a = 7; +} +// Previously the `foo.bar` in `foo.bar.mutate()` would insert an automatic dereference +// of `foo` which caused the method to wrongly be mutating a copy of bar rather than the original. +fn regression_1887() { + let foo = &mut Foo { bar: Bar { x: 0 } }; + foo.bar.mutate(); + assert(foo.bar.x == 32); +} + +struct Foo { bar: Bar } +struct Bar { x: Field } + +impl Bar { + fn mutate(&mut self) { + self.x = 32; + } +} +// Ensure that mutating a variable does not also mutate its copy +fn regression_2054() { + let mut x = 2; + let z = x; + + x += 1; + assert(z == 2); +} +// The compiler was still trying to convert an LValue from an array of structs to struct of arrays indexing, +// even though this conversion was mostly removed elsewhere. +fn regression_2030() { + let ref = &mut 0; + let mut array = [ref, ref]; + let _ = *array[0]; + *array[0] = 1; +} +// The `mut x: &mut ...` caught a bug handling lvalues where a double-dereference would occur internally +// in one step rather than being tracked by two separate steps. This lead to assigning the 1 value to the +// incorrect outer `mut` reference rather than the correct `&mut` reference. +fn regression_2255() { + let x = &mut 0; + regression_2255_helper(x); + assert(*x == 1); +} + +fn regression_2255_helper(mut x: &mut Field) { + *x = 1; +} + +fn regression_2218(x: Field, y: Field) -> Field { + let q = &mut &mut 0; + let q1 = *q; + let q2 = *q; + + if x != y { + *q1 = 1; + // Make sure that we correct load reference aliases through multiple blocks + if x != 20 { + *q1 = 10; + *q2 = 2; // now we'd expect q1 == q2 == 2 + assert(*q1 == 2); + } else { + *q2 = 15; + assert(*q1 == 15); + } + } else { + *q2 = 20; + assert(*q1 == 20); + } + // Have to assign value to return it + let value = *q1; + value +} + +fn regression_2218_if_inner_if(x: Field, y: Field) { + let value = regression_2218(x, y); + assert(value == 2); +} + +fn regression_2218_if_inner_else(x: Field, y: Field) { + let value = regression_2218(x, y); + assert(value == 15); +} + +fn regression_2218_else(x: Field, y: Field) { + let value = regression_2218(x, y); + assert(value == 20); +} + +fn regression_2218_loop(x: Field, y: Field) { + let q = &mut &mut 0; + let q1 = *q; + let q2 = *q; + + for _ in 0..1 { + if x != y { + *q1 = 10; + *q2 = 2; // now we'd expect q1 == q2 == 2 + assert(*q1 == 2); + } else { + *q2 = 20; + assert(*q1 == 20); + } + } + assert(*q1 == 2); + + for _ in 0..1 { + for _ in 0..5 { + if x != y { + *q1 = 1; + // Make sure that we correct load reference aliases through multiple blocks + if x != 20 { + *q1 = 10; + *q2 = 2; // now we'd expect q1 == q2 == 2 + assert(*q1 == 2); + } + } else { + *q2 = 20; + assert(*q1 == 20); + } + } + if x != y { + *q1 = 1; + for _ in 0..5 { + // Make sure that we correct load reference aliases through multiple blocks + if x != 20 { + *q1 = 10; + *q2 = 2; // now we'd expect q1 == q2 == 2 + assert(*q1 == 2); + } + } + } else { + *q2 = 20; + assert(*q1 == 20); + } + } + assert(*q1 == 2); + + if x != y { + for _ in 0..5 { + if x != y { + *q1 = 1; + // Make sure that we correct load reference aliases through multiple blocks + if x != 20 { + *q1 = 10; + *q2 = 2; // now we'd expect q1 == q2 == 2 + assert(*q1 == 2); + } + } + } + } else { + *q2 = 20; + assert(*q1 == 20); + } + assert(*q1 == 2); +} +// This is more a feature test than a proper regression. +// Before, we never automatically dereferenced objects in method calls to their value types. +// Now, we insert as many `*` as necessary to get to `S`. +fn regression_2560(s_ref: &mut S) { + assert(s_ref.get_y() == 7); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml new file mode 100644 index 00000000000..0f6961c41d3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/regression/Prover.toml new file mode 100644 index 00000000000..2875190982f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression/Prover.toml @@ -0,0 +1,2 @@ +x = [0x3f, 0x1c, 0xb8, 0x99, 0xab] +z = 3 diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/regression/src/main.nr new file mode 100644 index 00000000000..ed3dbf23a24 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression/src/main.nr @@ -0,0 +1,107 @@ +global NIBBLE_LENGTH: Field = 16; + +fn compact_decode(input: [u8; N], length: Field) -> ([u4; NIBBLE_LENGTH], Field) { + assert(2 * input.len() as u64 <= NIBBLE_LENGTH as u64); + assert(length as u64 <= input.len() as u64); + + let mut nibble = [0 as u4; NIBBLE_LENGTH]; + + let first_nibble = (input[0] >> 4) as u4; + let parity = first_nibble as u1; + + if parity == 1 { + nibble[0] = (input[0] & 0x0f) as u4; + for i in 1..input.len() { + if i as u64 < length as u64 { + let x = input[i]; + nibble[2*i - 1] = (x >> 4) as u4; + nibble[2*i] = (x & 0x0f) as u4; + } + } + } else { + for i in 0..2 { + if (i as u64) < length as u64 - 1 { + let x = input[i + 1]; + nibble[2*i] = (x >> 4) as u4; + nibble[2*i + 1] = (x & 0x0f) as u4; + } + } + } + + let out = (nibble, 2 * length + (parity as Field) - 2); + + out +} + +fn enc(value: [u8; N], value_length: Field) -> ([u8; 32], Field) { + assert(value.len() as u8 >= value_length as u8); + let mut out_value = [0; 32]; + if value_length == 0 { + let out = (out_value, value_length); + out + } else if value_length as u8 < 31 { + out_value[0] = 0x80 + value_length as u8; + + for i in 1..value.len() { + out_value[i] = value[i-1]; + } + + let out = (out_value, value_length + 1); + + out + } else { + let out = (out_value, 32); + out + } +} + +fn bitshift_literal_0() -> u64 { + let mut bits: u64 = 0; + bits |= 1 << 0; + + bits +} +fn bitshift_literal_4() -> u64 { + let mut bits: u64 = 0; + bits |= 1 << 4; + + bits +} +fn bitshift_variable(idx: u64) -> u64 { + let mut bits: u64 = 0; + bits |= 1 << idx; + + bits +} + +fn main(x: [u8; 5], z: Field) { + //Issue 1144 + let (nib, len) = compact_decode(x, z); + assert(len == 5); + assert([nib[0], nib[1], nib[2], nib[3], nib[4]] == [15, 1, 12, 11, 8]); + // Issue 1169 + let val1 = [ + 0xb8, 0x8f, 0x61, 0xe6, 0xfb, 0xda, 0x83, 0xfb, 0xff, 0xfa, 0xbe, 0x36, 0x41, 0x12, 0x13, + 0x74, 0x80, 0x39, 0x80, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 + ]; + let val1_length = 20; + + let enc_val1 = enc(val1, val1_length); + + assert(enc_val1.0 == [ + 0x94, 0xb8, 0x8f, 0x61, 0xe6, 0xfb, 0xda, 0x83, 0xfb, 0xff, 0xfa, 0xbe, 0x36, 0x41, + 0x12, 0x13, 0x74, 0x80, 0x39, 0x80, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + ]); + assert(enc_val1.1 == 21); + // Issue 2399 + let result_0 = bitshift_literal_0(); + assert(result_0 == 1); + let result_4 = bitshift_literal_4(); + assert(result_4 == 16); + let result_0 = bitshift_variable(0); + assert(result_0 == 1); + let result_4 = bitshift_variable(4); + assert(result_4 == 16); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml new file mode 100644 index 00000000000..fb2b3c42fdd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_2854" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_2854/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/src/main.nr new file mode 100644 index 00000000000..eccff8225b6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_2854/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field) -> pub i127 { + x as i127 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml new file mode 100644 index 00000000000..93a0ba6f25a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_mem_op_predicate" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Prover.toml new file mode 100644 index 00000000000..3621f24082c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/Prover.toml @@ -0,0 +1,2 @@ +x = [4,3,1,5,111] +idx = 12 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr new file mode 100644 index 00000000000..4b5ca67f6de --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr @@ -0,0 +1,8 @@ +fn main(mut x: [u32; 5], idx: Field) { + // We should not hit out of bounds here as we have a predicate + // that should not be hit + if idx as u32 < 3 { + x[idx] = 10; + } + assert(x[4] == 111); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml new file mode 100644 index 00000000000..aed6aa06714 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_method_cannot_be_found" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Prover.toml new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/Prover.toml @@ -0,0 +1 @@ + diff --git a/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/src/main.nr new file mode 100644 index 00000000000..1a6931a6870 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/regression_method_cannot_be_found/src/main.nr @@ -0,0 +1,23 @@ +use dep::std; +struct Item { + id: Field, +} + +impl Item { + fn log(self) { + let id = self.id; + std::println(id); + } +} + +fn create(something: V) -> V { + something +} + +fn main() { + let a = Item { id: 1 }; + let b = create(a); + let _id = b.id; + // Regression for: cannot find this method + b.log(); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml new file mode 100644 index 00000000000..926114ec374 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "scalar_mul" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Prover.toml new file mode 100644 index 00000000000..69b91cb5f31 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/Prover.toml @@ -0,0 +1,7 @@ +a = "1" +a_pub_x = "0x0000000000000000000000000000000000000000000000000000000000000001" +a_pub_y = "0x0000000000000002cf135e7506a45d632d270d45f1181294833fc48d823f272c" + +b = "2" +b_pub_x = "0x06ce1b0827aafa85ddeb49cdaa36306d19a74caa311e13d46d8bc688cdbffffe" +b_pub_y = "0x1c122f81a3a14964909ede0ba2a6855fc93faf6fa1a788bf467be7e7a43f80ac" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr new file mode 100644 index 00000000000..4f0a83ea9e5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr @@ -0,0 +1,16 @@ +use dep::std; + +fn main(a: Field, a_pub_x: pub Field, a_pub_y: pub Field, b: Field, b_pub_x: pub Field, b_pub_y: pub Field) { + let mut priv_key = a; + let mut pub_x: Field = a_pub_x; + let mut pub_y: Field = a_pub_y; + if a != 1 { + // Change `a` in Prover.toml to test input `b` + priv_key = b; + pub_x = b_pub_x; + pub_y = b_pub_y; + } + let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); + assert(res[0] == pub_x); + assert(res[1] == pub_y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml new file mode 100644 index 00000000000..aa24a2f3caf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/schnorr/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "schnorr" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/schnorr/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/schnorr/Prover.toml new file mode 100644 index 00000000000..2faf2018e07 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/schnorr/Prover.toml @@ -0,0 +1,70 @@ +message = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +message_field = "0x010203040506070809" +pub_key_x = "0x04b260954662e97f00cab9adb773a259097f7a274b83b113532bce27fa3fb96a" +pub_key_y = "0x2fd51571db6c08666b0edfbfbc57d432068bccd0110a39b166ab243da0037197" +signature = [ + 1, + 13, + 119, + 112, + 212, + 39, + 233, + 41, + 84, + 235, + 255, + 93, + 245, + 172, + 186, + 83, + 157, + 253, + 76, + 77, + 33, + 128, + 178, + 15, + 214, + 67, + 105, + 107, + 177, + 234, + 77, + 48, + 27, + 237, + 155, + 84, + 39, + 84, + 247, + 27, + 22, + 8, + 176, + 230, + 24, + 115, + 145, + 220, + 254, + 122, + 135, + 179, + 171, + 4, + 214, + 202, + 64, + 199, + 19, + 84, + 239, + 138, + 124, + 12, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/schnorr/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/schnorr/src/main.nr new file mode 100644 index 00000000000..d5eb92fd5f8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/schnorr/src/main.nr @@ -0,0 +1,19 @@ +use dep::std; +// Note: If main has any unsized types, then the verifier will never be able +// to figure out the circuit instance +fn main(message: [u8; 10], message_field: Field, pub_key_x: Field, pub_key_y: Field, signature: [u8; 64]) { + // Regression for issue #2421 + // We want to make sure that we can accurately verify a signature whose message is a slice vs. an array + let message_field_bytes = message_field.to_be_bytes(10); + for i in 0..10 { + assert(message[i] == message_field_bytes[i]); + } + // Is there ever a situation where someone would want + // to ensure that a signature was invalid? + // Check that passing a slice as the message is valid + let valid_signature = std::schnorr::verify_signature(pub_key_x, pub_key_y, signature, message_field_bytes); + assert(valid_signature); + // Check that passing an array as the message is valid + let valid_signature = std::schnorr::verify_signature(pub_key_x, pub_key_y, signature, message); + assert(valid_signature); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml new file mode 100644 index 00000000000..255d2156ef6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha256/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "sha256" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha256/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/sha256/Prover.toml new file mode 100644 index 00000000000..c4df1b749bb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha256/Prover.toml @@ -0,0 +1,36 @@ + +x = 0xbd +result = [ + 0x68, + 0x32, + 0x57, + 0x20, + 0xaa, + 0xbd, + 0x7c, + 0x82, + 0xf3, + 0x0f, + 0x55, + 0x4b, + 0x31, + 0x3d, + 0x05, + 0x70, + 0xc9, + 0x5a, + 0xcc, + 0xbb, + 0x7d, + 0xc4, + 0xb5, + 0xaa, + 0xe1, + 0x12, + 0x04, + 0xc0, + 0x8f, + 0xfe, + 0x73, + 0x2b, +] diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha256/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/sha256/src/main.nr new file mode 100644 index 00000000000..fd5340e2384 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha256/src/main.nr @@ -0,0 +1,19 @@ +// Sha256 example +// +// Calls Sha256 from the standard library. +// +// The Compiler sees this special function and creates an ACIR gate +// +// The ACIR SHA256 gate is passed to PLONK who should +// know how to create the necessary constraints. +// +// Not yet here: For R1CS, it is more about manipulating arithmetic gates to get performance +// This can be done in ACIR! +use dep::std; + +fn main(x: Field, result: [u8; 32]) { + // We use the `as` keyword here to denote the fact that we want to take just the first byte from the x Field + // The padding is taken care of by the program + let digest = std::hash::sha256([x as u8]); + assert(digest == result); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml new file mode 100644 index 00000000000..efd691fce58 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "sha2_byte" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Prover.toml new file mode 100644 index 00000000000..2f82f14a58d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/Prover.toml @@ -0,0 +1,5 @@ +# Values obtainable from https://emn178.github.io/online-tools/sha256.html and https://emn178.github.io/online-tools/sha512.html +x = 0xbd +result256 = [0x68, 0x32, 0x57, 0x20, 0xaa, 0xbd, 0x7c, 0x82, 0xf3, 0x0f, 0x55, 0x4b, 0x31, 0x3d, 0x05, 0x70, 0xc9, 0x5a, 0xcc, 0xbb, 0x7d, 0xc4, 0xb5, 0xaa, 0xe1, 0x12, 0x04, 0xc0, 0x8f, 0xfe, 0x73, 0x2b] +result512 = [0x29, 0x6e, 0x22, 0x67, 0xd7, 0x4c, 0x27, 0x8d, 0xaa, 0xaa, 0x94, 0x0d, 0x17, 0xb0, 0xcf, 0xb7, 0x4a, 0x50, 0x83, 0xf8, 0xe0, 0x69, 0x72, 0x6d, 0x8c, 0x84, 0x1c, 0xbe, 0x59, 0x6e, 0x04, 0x31, 0xcb, 0x77, 0x41, 0xa5, 0xb5, 0x0f, 0x71, 0x66, 0x6c, 0xfd, 0x54, 0xba, 0xcb, 0x7b, 0x00, 0xae, 0xa8, 0x91, 0x49, 0x9c, 0xf4, 0xef, 0x6a, 0x03, 0xc8, 0xa8, 0x3f, 0xe3, 0x7c, 0x3f, 0x7b, 0xaf] + diff --git a/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr new file mode 100644 index 00000000000..fa8ddfbdf69 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr @@ -0,0 +1,10 @@ +// Test Noir implementations of SHA256 and SHA512 on a one-byte message. +use dep::std; + +fn main(x: Field, result256: [u8; 32], result512: [u8; 64]) { + let digest256 = std::sha256::digest([x as u8]); + assert(digest256 == result256); + + let digest512 = std::sha512::digest([x as u8]); + assert(digest512 == result512); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml new file mode 100644 index 00000000000..47676a806e8 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "signed_arithmetic" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Prover.toml new file mode 100644 index 00000000000..e0e584b7380 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/Prover.toml @@ -0,0 +1,3 @@ +x = "5" +y = "8" +z = "-15" diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/src/main.nr new file mode 100644 index 00000000000..7a997d177ba --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_arithmetic/src/main.nr @@ -0,0 +1,32 @@ +fn main(mut x: i32, mut y: i32, z: i32) { + let mut s1: i8 = 5; + let mut s2: i8 = 8; + assert(s1 + s2 == 13); + assert(x + y == 13); + + s2= -8; + y = -y; + assert(s1 + s2 == -3); + assert(x + y == -3); + + s1 = -15; + assert(s1 - s2 == -7); + assert(z - y == -7); + + s1 = -5; + s2 = 8; + x = -x; + y = -y; + assert(s1 - s2 == -13); + assert(x - y == -13); + + s2 = -8; + y = -y; + assert(s1 * s2 == 40); + assert(x * y == 40); + + s1 = 1; + s2 = -8; + assert(s1 * s2 == -8); + assert(x / x * y == -8); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml new file mode 100644 index 00000000000..0d631a00b05 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_division/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "signed_division" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_division/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/signed_division/Prover.toml new file mode 100644 index 00000000000..ee6f0ef229a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_division/Prover.toml @@ -0,0 +1,3 @@ +x = "7" +y = "3" +z = "2" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/signed_division/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/signed_division/src/main.nr new file mode 100644 index 00000000000..6289a2f9ed9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/signed_division/src/main.nr @@ -0,0 +1,21 @@ +use dep::std; +// Testing signed integer division: +// 7/3 = 2 +// -7/3 = -2 +// -7/-3 = 2 +// 7/-3 = -2 +fn main(mut x: i32, mut y: i32, mut z: i32) { + // 7/3 = 2 + assert(x / y == z); + // -7/3 = -2 + let minus_x = std::wrapping_sub(0, x); + let minus_z = std::wrapping_sub(0, z); + let minus_y = std::wrapping_sub(0, y); + assert(x + minus_x == 0); + assert(z + minus_z == 0); + assert(minus_x / y == minus_z); + // -7/-3 = 2 + assert(minus_x / minus_y == z); + // 7/-3 = -2 + assert(x / minus_y == minus_z); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml new file mode 100644 index 00000000000..b6d22d82631 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_2d_array" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Prover.toml new file mode 100644 index 00000000000..a4616f907bb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/Prover.toml @@ -0,0 +1,3 @@ +x = "1" +y = "2" +array_input = [[1, 2], [3, 3]] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/src/main.nr new file mode 100644 index 00000000000..2ecdd4bc15f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_2d_array/src/main.nr @@ -0,0 +1,8 @@ +// Test accessing a multidimensional array +fn main(x: Field, y: Field, array_input: [[Field; 2]; 2]) { + assert(array_input[0][0] == x); + assert(array_input[0][1] == y); + + let arr: [[Field; 2]; 1] = [[3, 3]]; + assert_eq(arr[0], array_input[1]); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml new file mode 100644 index 00000000000..6c5b0e4ca9a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_add_and_ret_arr" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Prover.toml new file mode 100644 index 00000000000..3d2b4b14efe --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/Prover.toml @@ -0,0 +1 @@ +x = 1 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/src/main.nr new file mode 100644 index 00000000000..016c4fedf40 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_add_and_ret_arr/src/main.nr @@ -0,0 +1,8 @@ +// A simple program to test that SSA array values elements +// aren't disconnected from their instruction results, and +// that dead instruction elemination looks inside of arrays +// when deciding whether of not an instruction should be +// retained. +fn main(x: Field) -> pub [Field; 1] { + [x + 1] +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml new file mode 100644 index 00000000000..be425f22e5c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_bitwise" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Prover.toml new file mode 100644 index 00000000000..aa3715f9b3d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/Prover.toml @@ -0,0 +1,4 @@ +a = 1 +b = 0 +c = "10" +d = "11" diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/src/main.nr new file mode 100644 index 00000000000..9ab738ae04d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_bitwise/src/main.nr @@ -0,0 +1,9 @@ +fn main(a: bool, b: bool, c: u8, d: u8) -> pub u8 { + let i = a & b; + let j = a ^ b; + let k = a | b; + let x = c & d; + let y = c ^ d; + let z = c | d; + (i as u8) + (j as u8) + (k as u8) + x + y + z +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml new file mode 100644 index 00000000000..06685628444 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_comparison" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Prover.toml new file mode 100644 index 00000000000..ed94d313315 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/Prover.toml @@ -0,0 +1,2 @@ +x = "3" +y = "4" diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr new file mode 100644 index 00000000000..05800440459 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr @@ -0,0 +1,6 @@ +// Tests a very simple program. +// +// The features being tested is comparison +fn main(x: Field, y: Field) { + assert(x as u32 < y as u32); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml new file mode 100644 index 00000000000..c00e60bdbc0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_mut" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Prover.toml new file mode 100644 index 00000000000..7d4290a117a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/Prover.toml @@ -0,0 +1 @@ +x = 1 diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr new file mode 100644 index 00000000000..d0715dbafe0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr @@ -0,0 +1,6 @@ +// A simple program to test mutable variables +fn main(x: Field) -> pub Field { + let mut y = 2; + y += x; + y +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml new file mode 100644 index 00000000000..52c86b36efb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_not/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_not" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_not/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_not/Prover.toml new file mode 100644 index 00000000000..b3accc9dd32 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_not/Prover.toml @@ -0,0 +1 @@ +x = false \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr new file mode 100644 index 00000000000..ba172625fe4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr @@ -0,0 +1,4 @@ +// A simple program for testing the NOT op +fn main(x: bool) -> pub bool { + !x +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml new file mode 100644 index 00000000000..cd8422ac482 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_print/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_print" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_print/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_print/Prover.toml new file mode 100644 index 00000000000..2c1854573a4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_print/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 2 diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_print/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_print/src/main.nr new file mode 100644 index 00000000000..6038b995af0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_print/src/main.nr @@ -0,0 +1,8 @@ +// Simple program for testing the logging +// of single witnesses and witness arrays. +use dep::std; + +fn main(x: Field, y: pub Field) { + std::println(x); + std::println([x, y]); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml new file mode 100644 index 00000000000..28967a28a55 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_program_addition" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr new file mode 100644 index 00000000000..0390d79e83b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr @@ -0,0 +1,5 @@ +// The feature being tested is handling of +// a binary operation. +fn main(x: Field) -> pub Field { + x + 1 +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml new file mode 100644 index 00000000000..12cbc8da1d3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "simple_radix" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Prover.toml new file mode 100644 index 00000000000..1ddfb7dc8e4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/Prover.toml @@ -0,0 +1 @@ +x = 2 \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr new file mode 100644 index 00000000000..4a335e1bade --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr @@ -0,0 +1,7 @@ +// Simple program to test to_radix +fn main(x: Field) { + let bits = x.to_le_bits(3); + assert(bits[0] == 0); + assert(bits[1] == 1); + assert(bits[2] == 0); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml new file mode 100644 index 00000000000..7e9579b0af4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_shield" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml new file mode 100644 index 00000000000..7878e4b8281 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/Prover.toml @@ -0,0 +1,11 @@ +# Random test key +priv_key = "0x000000000000000000000000000000000000000000000000000000616c696365" +note_root = "0x02278fc806225cd696bd502049f7bb98624536de56d09343f8a26ac1876b23a0" +index = "0" +note_hash_path = [ + "0x1cdcf02431ba623767fe389337d011df1048dcc24b98ed81cec97627bab454a0", + "0x0b5e9666e7323ce925c28201a97ddf4144ac9d148448ed6f49f9008719c1b85b", + "0x22ec636f8ad30ef78c42b7fe2be4a4cacf5a445cfb5948224539f59a11d70775", +] +to_pubkey_x = "0x0000000000000000000000000000000000000000000000000000000000000001" +to_pubkey_y = "0x0000000000000002cf135e7506a45d632d270d45f1181294833fc48d823f272c" diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shield/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/src/main.nr new file mode 100644 index 00000000000..c46d3b4594c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shield/src/main.nr @@ -0,0 +1,29 @@ +use dep::std; + +fn main( + // Public key of note + // all notes have the same denomination + priv_key: Field, + // Merkle membership proof + note_root: pub Field, + index: Field, + note_hash_path: [Field; 3], + // Receiver public key + to_pubkey_x: Field, + to_pubkey_y: Field +) -> pub [Field; 2] { + // Compute public key from private key to show ownership + let pubkey = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); + let pubkey_x = pubkey[0]; + let pubkey_y = pubkey[1]; + // Compute input note commitment + let note_commitment = std::hash::pedersen_commitment([pubkey_x, pubkey_y]); + // Compute input note nullifier + let nullifier = std::hash::pedersen_commitment([note_commitment.x, index, priv_key]); + // Compute output note nullifier + let receiver_note_commitment = std::hash::pedersen_commitment([to_pubkey_x, to_pubkey_y]); + // Check that the input note nullifier is in the root + assert(note_root == std::merkle::compute_merkle_root(note_commitment.x, index, note_hash_path)); + + [nullifier.x, receiver_note_commitment.x] +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml new file mode 100644 index 00000000000..2e75d5feada --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "simple_shift_left_right" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Prover.toml new file mode 100644 index 00000000000..07890234a19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/Prover.toml @@ -0,0 +1 @@ +x = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr new file mode 100644 index 00000000000..40698af6ce7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr @@ -0,0 +1,8 @@ +// Tests a very simple program. +// +// The features being tested are left and right shifts. +fn main(x: u32) { + let z = x >> 4; + let t = x << 4; + assert(z == t >> 8); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml new file mode 100644 index 00000000000..a02faeae27a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "slice_dynamic_index" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Prover.toml new file mode 100644 index 00000000000..0e5dfd5638d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/Prover.toml @@ -0,0 +1 @@ +x = "5" diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr new file mode 100644 index 00000000000..2e5c0122dfb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr @@ -0,0 +1,308 @@ +fn main(x: Field) { + // The parameters to this function must come directly from witness values (inputs to main). + regression_dynamic_slice_index(x - 1, x - 4); +} + +fn regression_dynamic_slice_index(x: Field, y: Field) { + let mut slice = []; + for i in 0..5 { + slice = slice.push_back(i); + } + assert(slice.len() == 5); + + dynamic_slice_index_set_if(slice, x, y); + dynamic_slice_index_set_else(slice, x, y); + dynamic_slice_index_set_nested_if_else_else(slice, x, y); + dynamic_slice_index_set_nested_if_else_if(slice, x, y + 1); + dynamic_slice_index_if(slice, x); + dynamic_array_index_if([0, 1, 2, 3, 4], x); + dynamic_slice_index_else(slice, x); + + dynamic_slice_merge_if(slice, x); + dynamic_slice_merge_else(slice, x); + dynamic_slice_merge_two_ifs(slice, x); + dynamic_slice_merge_mutate_between_ifs(slice, x, y); + dynamic_slice_merge_push_then_pop(slice, x, y); +} + +fn dynamic_slice_index_set_if(mut slice: [Field], x: Field, y: Field) { + assert(slice[x] == 4); + assert(slice[y] == 1); + slice[y] = 0; + assert(slice[x] == 4); + assert(slice[1] == 0); + if x as u32 < 10 { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + slice[x - 1] = slice[x]; + } else { + slice[x] = 0; + } + assert(slice[3] == 2); + assert(slice[4] == 2); +} + +fn dynamic_slice_index_set_else(mut slice: [Field], x: Field, y: Field) { + assert(slice[x] == 4); + assert(slice[y] == 1); + slice[y] = 0; + assert(slice[x] == 4); + assert(slice[1] == 0); + if x as u32 > 10 { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + slice[x - 1] = slice[x]; + } else { + slice[x] = 0; + } + assert(slice[4] == 0); +} +// This tests the case of missing a store instruction in the else branch +// of merging slices +fn dynamic_slice_index_if(mut slice: [Field], x: Field) { + if x as u32 < 10 { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + } else { + assert(slice[x] == 0); + } + assert(slice[4] == 2); +} + +fn dynamic_array_index_if(mut array: [Field; 5], x: Field) { + if x as u32 < 10 { + assert(array[x] == 4); + array[x] = array[x] - 2; + } else { + assert(array[x] == 0); + } + assert(array[4] == 2); +} +// This tests the case of missing a store instruction in the then branch +// of merging slices +fn dynamic_slice_index_else(mut slice: [Field], x: Field) { + if x as u32 > 10 { + assert(slice[x] == 0); + } else { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + } + assert(slice[4] == 2); +} + +fn dynamic_slice_merge_if(mut slice: [Field], x: Field) { + if x as u32 < 10 { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + + slice = slice.push_back(10); + // Having an array set here checks whether we appropriately + // handle a slice length that is not yet resolving to a constant + // during flattening + slice[x] = 10; + assert(slice[slice.len() - 1] == 10); + assert(slice.len() == 6); + + slice[x] = 20; + slice[x] = slice[x] + 10; + + slice = slice.push_front(11); + assert(slice[0] == 11); + assert(slice.len() == 7); + assert(slice[5] == 30); + + slice = slice.push_front(12); + assert(slice[0] == 12); + assert(slice.len() == 8); + assert(slice[6] == 30); + + let (popped_slice, last_elem) = slice.pop_back(); + assert(last_elem == 10); + assert(popped_slice.len() == 7); + + let (first_elem, rest_of_slice) = popped_slice.pop_front(); + assert(first_elem == 12); + assert(rest_of_slice.len() == 6); + // TODO(#2462): SliceInsert and SliceRemove with a dynamic index are not yet implemented in ACIR gen + slice = rest_of_slice.insert(2, 20); + assert(slice[2] == 20); + assert(slice[6] == 30); + assert(slice.len() == 7); + // TODO(#2462): SliceInsert and SliceRemove with a dynamic index are not yet implemented in ACIR gen + let (removed_slice, removed_elem) = slice.remove(3); + // The deconstructed tuple assigns to the slice but is not seen outside of the if statement + // without a direct assignment + slice = removed_slice; + + assert(removed_elem == 1); + assert(slice.len() == 6); + } else { + assert(slice[x] == 0); + slice = slice.push_back(20); + } + + assert(slice.len() == 6); + assert(slice[slice.len() - 1] == 30); +} + +fn dynamic_slice_merge_else(mut slice: [Field], x: Field) { + if x as u32 > 10 { + assert(slice[x] == 0); + slice[x] = 2; + } else { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + slice = slice.push_back(10); + } + assert(slice.len() == 6); + assert(slice[slice.len() - 1] == 10); + + slice = slice.push_back(20); + assert(slice.len() == 7); + assert(slice[slice.len() - 1] == 20); +} + +fn dynamic_slice_index_set_nested_if_else_else(mut slice: [Field], x: Field, y: Field) { + assert(slice[x] == 4); + assert(slice[y] == 1); + slice[y] = 0; + assert(slice[x] == 4); + assert(slice[1] == 0); + if x as u32 < 10 { + slice[x] = slice[x] - 2; + if y != 1 { + slice[x] = slice[x] + 20; + } else { + if x == 5 { + // We should not hit this case + assert(slice[x] == 22); + } else { + slice[x] = 10; + slice = slice.push_back(15); + assert(slice.len() == 6); + } + assert(slice[4] == 10); + } + } else { + slice[x] = 0; + } + assert(slice[4] == 10); + assert(slice.len() == 6); + assert(slice[slice.len() - 1] == 15); + + slice = slice.push_back(20); + assert(slice.len() == 7); + assert(slice[slice.len() - 1] == 20); +} + +fn dynamic_slice_index_set_nested_if_else_if(mut slice: [Field], x: Field, y: Field) { + assert(slice[x] == 4); + assert(slice[y] == 2); + slice[y] = 0; + assert(slice[x] == 4); + assert(slice[2] == 0); + if x as u32 < 10 { + slice[x] = slice[x] - 2; + // TODO: this panics as we have a load for the slice in flattening + if y == 1 { + slice[x] = slice[x] + 20; + } else { + if x == 4 { + slice[x] = 5; + } + assert(slice[4] == 5); + } + } else { + slice[x] = 0; + } + assert(slice[4] == 5); +} + +fn dynamic_slice_merge_two_ifs(mut slice: [Field], x: Field) { + if x as u32 > 10 { + assert(slice[x] == 0); + slice[x] = 2; + } else { + assert(slice[x] == 4); + slice[x] = slice[x] - 2; + slice = slice.push_back(10); + } + + assert(slice.len() == 6); + assert(slice[slice.len() - 1] == 10); + + if x == 20 { + slice = slice.push_back(20); + } + + slice = slice.push_back(15); + + assert(slice.len() == 7); + assert(slice[slice.len() - 1] == 15); + + slice = slice.push_back(20); + assert(slice.len() == 8); + assert(slice[slice.len() - 1] == 20); +} + +fn dynamic_slice_merge_mutate_between_ifs(mut slice: [Field], x: Field, y: Field) { + if x != y { + slice[x] = 50; + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice[x] = slice[x] - 2; + slice = slice.push_back(x); + } + + slice = slice.push_back(30); + assert(slice.len() == 8); + + if x == 20 { + slice = slice.push_back(20); + } + + slice = slice.push_back(15); + + if x != 20 { + slice = slice.push_back(50); + } + + slice = slice.push_back(60); + assert(slice.len() == 11); + assert(slice[x] == 50); + assert(slice[slice.len() - 4] == 30); + assert(slice[slice.len() - 3] == 15); + assert(slice[slice.len() - 2] == 50); + assert(slice[slice.len() - 1] == 60); +} + +fn dynamic_slice_merge_push_then_pop(mut slice: [Field], x: Field, y: Field) { + if x != y { + slice[x] = 5; + slice = slice.push_back(y); + slice = slice.push_back(x); + assert(slice.len() == 7); + + let (popped_slice, elem) = slice.pop_back(); + assert(slice.len() == 7); + assert(elem == x); + slice = popped_slice; + } else { + slice = slice.push_back(x); + } + + slice = slice.push_back(30); + assert(slice.len() == 7); + + if x == 20 { + slice = slice.push_back(20); + } + + let (slice, elem) = slice.pop_back(); + assert(elem == 30); + + let (_, elem) = slice.pop_back(); + assert(elem == y); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Nargo.toml new file mode 100644 index 00000000000..9530ebf9271 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "slice_struct_field" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Prover.toml new file mode 100644 index 00000000000..7127baac5bf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/Prover.toml @@ -0,0 +1 @@ +y = "3" diff --git a/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/src/main.nr new file mode 100644 index 00000000000..c00fdf85180 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slice_struct_field/src/main.nr @@ -0,0 +1,177 @@ +struct FooParent { + parent_arr: [Field; 3], + foos: [Foo], +} + +struct Bar { + inner: [Field; 3], +} + +struct Foo { + a: Field, + b: [Field], + bar: Bar, +} + +fn main(y: pub Field) { + let mut b_one = [2, 3, 20]; + b_one = b_one.push_back(20); + let foo_one = Foo { a: 1, b: b_one, bar: Bar { inner: [100, 101, 102] } }; + + let mut b_two = [5, 6, 21]; + b_two = b_two.push_back(21); + let foo_two = Foo { a: 4, b: b_two, bar: Bar { inner: [103, 104, 105] } }; + + let foo_three = Foo { a: 7, b: [8, 9, 22], bar: Bar { inner: [106, 107, 108] } }; + let foo_four = Foo { a: 10, b: [11, 12, 23], bar: Bar { inner: [109, 110, 111] } }; + + let mut x = [foo_one, foo_two]; + x = x.push_back(foo_three); + x = x.push_back(foo_four); + + assert(x[y - 3].a == 1); + let struct_slice = x[y - 3].b; + for i in 0..4 { + assert(struct_slice[i] == b_one[i]); + } + + assert(x[y - 2].a == 4); + let struct_slice = x[y - 2].b; + for i in 0..4 { + assert(struct_slice[i] == b_two[i]); + } + + assert(x[y - 1].a == 7); + let struct_slice = x[y - 1].b; + assert(struct_slice[0] == 8); + assert(struct_slice[1] == 9); + assert(struct_slice[2] == 22); + + assert(x[y].a == 10); + let struct_slice = x[y].b; + assert(struct_slice[0] == 11); + assert(struct_slice[1] == 12); + assert(struct_slice[2] == 23); + assert(x[y].bar.inner == [109, 110, 111]); + + assert(x[y - 3].bar.inner == [100, 101, 102]); + assert(x[y - 2].bar.inner == [103, 104, 105]); + assert(x[y - 1].bar.inner == [106, 107, 108]); + assert(x[y].bar.inner == [109, 110, 111]); + // Check that switching the lhs and rhs is still valid + assert([109, 110, 111] == x[y].bar.inner); + // TODO: Enable merging nested slices + // if y != 2 { + // x[y].a = 50; + // } else { + // x[y].a = 100; + // } + // assert(x[3].a == 50); + // if y == 2 { + // x[y - 1].b = [50, 51, 52]; + // } else { + // x[y - 1].b = [100, 101, 102]; + // } + // assert(x[2].b[0] == 100); + // assert(x[2].b[1] == 101); + // assert(x[2].b[2] == 102); + let q = x.push_back(foo_four); + let foo_parent_one = FooParent { parent_arr: [0, 1, 2], foos: x }; + let foo_parent_two = FooParent { parent_arr: [3, 4, 5], foos: q }; + let mut foo_parents = [foo_parent_one]; + foo_parents = foo_parents.push_back(foo_parent_two); + // TODO: make a separate test for compile time + // foo_parents[1].foos.push_back(foo_four); + // TODO: Merging nested slices is broken + // if y == 3 { + // foo_parents[y - 2].foos[y - 1].b[y - 1] = 5000; + // } else { + // foo_parents[y - 2].foos[y - 1].b[y - 1] = 1000; + // } + assert(foo_parents[y - 2].foos[y - 2].b[y - 1] == 21); + foo_parents[y - 2].foos[y - 2].b[y - 1] = 5000; + assert(foo_parents[y - 2].foos[y - 2].b[y - 1] == 5000); + + let b_array = foo_parents[y - 2].foos[y - 3].b; + assert(foo_parents[y - 2].foos[y - 3].a == 1); + assert(b_array[0] == 2); + assert(b_array[1] == 3); + assert(b_array[2] == 20); + assert(b_array[3] == 20); + + let b_array = foo_parents[y - 2].foos[y - 2].b; + assert(foo_parents[y - 2].foos[y - 2].a == 4); + assert(b_array[0] == 5); + assert(b_array[1] == 6); + assert(b_array[2] == 5000); + assert(b_array[3] == 21); + + assert(foo_parents[y - 2].foos[y - 1].a == 7); + foo_parents[y - 2].foos[y - 1].a = 50; + + let b_array = foo_parents[y - 2].foos[y - 1].b; + assert(b_array[2] == 22); + assert(b_array.len() == 3); + // Test setting a nested array with non-dynamic + let x = [5, 6, 5000, 21, 100, 101].as_slice(); + foo_parents[y - 2].foos[y - 1].b = x; + + assert(foo_parents[y - 2].foos[y - 1].b.len() == 6); + assert(foo_parents[y - 2].foos[y - 1].b[4] == 100); + assert(foo_parents[y - 2].foos[y - 1].b[5] == 101); + + test_basic_intrinsics_nested_slices(foo_parents, y); + // TODO(#3364): still have to enable slice intrinsics on dynamic nested slices + // assert(foo_parents[y - 2].foos.len() == 5); + // foo_parents[y - 2].foos = foo_parents[y - 2].foos.push_back(foo_four); + // assert(foo_parents[y - 2].foos.len() == 6); + let b_array = foo_parents[y - 2].foos[y - 1].b; + assert(b_array[0] == 5); + assert(b_array[1] == 6); + assert(b_array[2] == 5000); + assert(b_array[3] == 21); + + let b_array = foo_parents[y - 2].foos[y].b; + assert(foo_parents[y - 2].foos[y].a == 10); + assert(b_array[0] == 11); + assert(b_array[1] == 12); + assert(b_array[2] == 23); + + assert(foo_parents[y - 2].foos[y - 3].bar.inner == [100, 101, 102]); + assert(foo_parents[y - 2].foos[y - 2].bar.inner == [103, 104, 105]); + assert(foo_parents[y - 2].foos[y - 1].bar.inner == [106, 107, 108]); + assert(foo_parents[y - 2].foos[y].bar.inner == [109, 110, 111]); +} + +fn test_basic_intrinsics_nested_slices(mut foo_parents: [FooParent], y: Field) { + foo_parents[y - 2].foos[y - 1].b = foo_parents[y - 2].foos[y - 1].b.push_back(500); + assert(foo_parents[y - 2].foos[y - 1].b.len() == 7); + assert(foo_parents[y - 2].foos[y - 1].b[6] == 500); + + let (popped_slice, last_elem) = foo_parents[y - 2].foos[y - 1].b.pop_back(); + foo_parents[y - 2].foos[y - 1].b = popped_slice; + assert(foo_parents[y - 2].foos[y - 1].b.len() == 6); + assert(last_elem == 500); + + foo_parents[y - 2].foos[y - 1].b = foo_parents[y - 2].foos[y - 1].b.push_front(11); + assert(foo_parents[y - 2].foos[y - 1].b.len() == 7); + assert(foo_parents[y - 2].foos[y - 1].b[0] == 11); + + let (first_elem, rest_of_slice) = foo_parents[y - 2].foos[y - 1].b.pop_front(); + foo_parents[y - 2].foos[y - 1].b = rest_of_slice; + assert(foo_parents[y - 2].foos[y - 1].b.len() == 6); + assert(first_elem == 11); + + foo_parents[y - 2].foos[y - 1].b = foo_parents[y - 2].foos[y - 1].b.insert(2, 20); + assert(foo_parents[y - 2].foos[y - 1].b.len() == 7); + assert(foo_parents[y - 2].foos[y - 1].b[y - 1] == 20); + assert(foo_parents[y - 2].foos[y - 1].b[y] == 5000); + assert(foo_parents[y - 2].foos[y - 1].b[6] == 101); + + let (rest_of_slice, removed_elem) = foo_parents[y - 2].foos[y - 1].b.remove(3); + foo_parents[y - 2].foos[y - 1].b = rest_of_slice; + assert(removed_elem == 5000); + assert(foo_parents[y - 2].foos[y - 1].b.len() == 6); + assert(foo_parents[y - 2].foos[y - 1].b[2] == 20); + assert(foo_parents[y - 2].foos[y - 1].b[3] == 21); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml new file mode 100644 index 00000000000..3eec413bc07 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slices/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "slices" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/slices/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/slices/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slices/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/slices/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/slices/src/main.nr new file mode 100644 index 00000000000..c377d2e5b2f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/slices/src/main.nr @@ -0,0 +1,299 @@ +use dep::std::slice; +use dep::std; + +fn main(x: Field, y: pub Field) { + let mut slice = [0; 2]; + assert(slice[0] == 0); + assert(slice[0] != 1); + slice[0] = x; + assert(slice[0] == x); + + let slice_plus_10 = slice.push_back(y); + assert(slice_plus_10[2] == 10); + assert(slice_plus_10[2] != 8); + assert(slice_plus_10.len() == 3); + + let mut new_slice = []; + for i in 0..5 { + new_slice = new_slice.push_back(i); + } + assert(new_slice.len() == 5); + + new_slice = new_slice.push_front(20); + assert(new_slice[0] == 20); + assert(new_slice.len() == 6); + + let (popped_slice, last_elem) = new_slice.pop_back(); + assert(last_elem == 4); + assert(popped_slice.len() == 5); + + let (first_elem, rest_of_slice) = popped_slice.pop_front(); + assert(first_elem == 20); + assert(rest_of_slice.len() == 4); + + new_slice = rest_of_slice.insert(2, 100); + assert(new_slice[2] == 100); + assert(new_slice[4] == 3); + assert(new_slice.len() == 5); + + let (remove_slice, removed_elem) = new_slice.remove(3); + assert(removed_elem == 2); + assert(remove_slice[3] == 3); + assert(remove_slice.len() == 4); + + let append = [1, 2].append([3, 4, 5]); + assert(append.len() == 5); + assert(append[0] == 1); + assert(append[4] == 5); + + regression_2083(); + // The parameters to this function must come from witness values (inputs to main) + regression_merge_slices(x, y); + regression_2370(); +} +// Ensure that slices of struct/tuple values work. +fn regression_2083() { + let y = [(1, 2)]; + let y = y.push_back((3, 4)); // [(1, 2), (3, 4)] + let y = y.push_back((5, 6)); // [(1, 2), (3, 4), (5, 6)] + assert(y[2].1 == 6); + + let y = y.push_front((10, 11)); // [(10, 11), (1, 2), (3, 4), (5, 6)] + let y = y.push_front((12, 13)); // [(12, 13), (10, 11), (1, 2), (3, 4), (5, 6)] + assert(y[1].0 == 10); + + let y = y.insert(1, (55, 56)); // [(12, 13), (55, 56), (10, 11), (1, 2), (3, 4), (5, 6)] + assert(y[0].1 == 13); + assert(y[1].1 == 56); + assert(y[2].0 == 10); + + let (y, x) = y.remove(2); // [(12, 13), (55, 56), (1, 2), (3, 4), (5, 6)] + assert(y[2].0 == 1); + assert(x.0 == 10); + assert(x.1 == 11); + + let (x, y) = y.pop_front(); // [(55, 56), (1, 2), (3, 4), (5, 6)] + assert(y[0].0 == 55); + assert(x.0 == 12); + assert(x.1 == 13); + + let (y, x) = y.pop_back(); // [(55, 56), (1, 2), (3, 4)] + assert(y.len() == 3); + assert(x.0 == 5); + assert(x.1 == 6); +} +// The parameters to this function must come from witness values (inputs to main) +fn regression_merge_slices(x: Field, y: Field) { + merge_slices_if(x, y); + merge_slices_else(x); +} + +fn merge_slices_if(x: Field, y: Field) { + let slice = merge_slices_return(x, y); + assert(slice.len() == 3); + assert(slice[2] == 10); + + let slice = merge_slices_mutate(x, y); + assert(slice.len() == 4); + assert(slice[3] == 5); + + let slice = merge_slices_mutate_in_loop(x, y); + assert(slice.len() == 7); + assert(slice[6] == 4); + + let slice = merge_slices_mutate_two_ifs(x, y); + assert(slice.len() == 6); + assert(slice[3] == 5); + assert(slice[4] == 15); + assert(slice[5] == 30); + + let slice = merge_slices_mutate_between_ifs(x, y); + assert(slice.len() == 8); + assert(slice[3] == 5); + assert(slice[4] == 30); + assert(slice[5] == 15); + assert(slice[6] == 50); + assert(slice[7] == 60); + + merge_slices_push_then_pop(x, y); + + let slice = merge_slices_push_then_insert(x, y); + assert(slice.len() == 7); + assert(slice[1] == 50); + assert(slice[2] == 0); + assert(slice[5] == 30); + assert(slice[6] == 100); + + let slice = merge_slices_remove_between_ifs(x, y); + assert(slice.len() == 5); +} + +fn merge_slices_else(x: Field) { + let slice = merge_slices_return(x, 5); + assert(slice[0] == 0); + assert(slice[1] == 0); + assert(slice.len() == 2); + + let slice = merge_slices_mutate(x, 5); + assert(slice[2] == 5); + assert(slice.len() == 3); + + let slice = merge_slices_mutate_in_loop(x, 5); + assert(slice[2] == 5); + assert(slice.len() == 3); +} +// Test returning a merged slice without a mutation +fn merge_slices_return(x: Field, y: Field) -> [Field] { + let slice = [0; 2]; + if x != y { + if x != 20 { slice.push_back(y) } else { slice } + } else { + slice + } +} +// Test mutating a slice inside of an if statement +fn merge_slices_mutate(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + slice +} +// Test mutating a slice inside of a loop in an if statement +fn merge_slices_mutate_in_loop(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + for i in 0..5 { + slice = slice.push_back(i); + } + } else { + slice = slice.push_back(x); + } + slice +} + +fn merge_slices_mutate_two_ifs(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + if x == 20 { + slice = slice.push_back(20); + } + + slice = slice.push_back(15); + slice = slice.push_back(30); + + slice +} + +fn merge_slices_mutate_between_ifs(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + slice = slice.push_back(30); + + if x == 20 { + slice = slice.push_back(20); + } + + slice = slice.push_back(15); + + if x != 20 { + slice = slice.push_back(50); + } + + slice = slice.push_back(60); + + slice +} + +fn merge_slices_push_then_pop(x: Field, y: Field) { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + slice = slice.push_back(30); + + if x == 20 { + slice = slice.push_back(20); + } + + let (slice, elem) = slice.pop_back(); + assert(slice.len() == 4); + assert(elem == 30); + + let (slice, elem) = slice.pop_back(); + assert(slice.len() == 3); + assert(elem == x); +} + +fn merge_slices_push_then_insert(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + slice = slice.push_back(30); + + if x == 20 { + slice = slice.push_back(20); + slice = slice.push_back(15); + } + + slice = slice.insert(1, 50); + // Test that we can use slice insert the same as slice push back + slice = slice.insert(6, 100); + + slice +} + +fn merge_slices_remove_between_ifs(x: Field, y: Field) -> [Field] { + let mut slice = [0; 2]; + if x != y { + slice = slice.push_back(y); + slice = slice.push_back(x); + } else { + slice = slice.push_back(x); + } + + let (mut slice, elem) = slice.remove(2); + assert(elem == y); + + if x == 20 { + slice = slice.push_back(20); + } + + slice = slice.push_back(15); + + if x != 20 { + slice = slice.push_back(50); + } + + slice +} +// Previously, we'd get a type error when trying to assign an array of a different size to +// an existing array variable. Now, we infer the variable must be a slice. +fn regression_2370() { + let mut slice = []; + slice = [1, 2, 3]; +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml new file mode 100644 index 00000000000..76a9beb6909 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/strings/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "strings" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/strings/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/strings/Prover.toml new file mode 100644 index 00000000000..0d1bd92b5de --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/strings/Prover.toml @@ -0,0 +1,4 @@ +message = "hello world" +y = 5 +hex_as_string = "0x41" +hex_as_field = "0x41" diff --git a/noir/tooling/nargo_cli/tests/execution_success/strings/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/strings/src/main.nr new file mode 100644 index 00000000000..cb2218837f3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/strings/src/main.nr @@ -0,0 +1,73 @@ +use dep::std; +// Test global string literals +global HELLO_WORLD = "hello world"; + +fn main(message: pub str<11>, y: Field, hex_as_string: str<4>, hex_as_field: Field) { + let mut bad_message = "hello world"; + + assert(message == "hello world"); + assert(message == HELLO_WORLD); + let x = 10; + let z = x * 5; + std::println(10); + + std::println(z); // x * 5 in println not yet supported + std::println(x); + + let array = [1, 2, 3, 5, 8]; + assert(y == 5); // Change to y != 5 to see how the later print statements are not called + std::println(array); + + bad_message = "hell\0\"world"; + std::println(bad_message); + assert(message != bad_message); + + let hash = std::hash::pedersen_commitment([x]); + std::println(hash); + + assert(hex_as_string == "0x41"); + // assert(hex_as_string != 0x41); This will fail with a type mismatch between str[4] and Field + assert(hex_as_field == 0x41); +} + +#[test] +fn test_prints_strings() { + let message = "hello world!"; + + std::println(message); + std::println("goodbye world"); +} + +#[test] +fn test_prints_array() { + let array = [1, 2, 3, 5, 8]; + + let s = Test { a: 1, b: 2, c: [3, 4] }; + std::println(s); + + std::println(array); + + let hash = std::hash::pedersen_commitment(array); + std::println(hash); +} + +fn failed_constraint(hex_as_field: Field) { + // TODO(#2116): Note that `println` will not work if a failed constraint can be + // evaluated at compile time. + // When this method is called from a test method or with constant values + // a `Failed constraint` compile error will be caught before this `println` + // is executed as the input will be a constant. + std::println(hex_as_field); + assert(hex_as_field != 0x41); +} + +#[test] +fn test_failed_constraint() { + failed_constraint(0x41); +} + +struct Test { + a: Field, + b: Field, + c: [Field; 2], +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml new file mode 100644 index 00000000000..6622edd0653 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "struct" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/struct/Prover.toml new file mode 100644 index 00000000000..7d59cc81807 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct/Prover.toml @@ -0,0 +1,2 @@ +x = "0" +y = "1" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/struct/src/main.nr new file mode 100644 index 00000000000..45c5e347e5a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct/src/main.nr @@ -0,0 +1,75 @@ +struct Foo { + bar: Field, + array: [Field; 2], +} + +struct Pair { + first: Foo, + second: Field, +} + +impl Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: 0, array: [x,y] } + } +} + +impl Pair { + fn foo(p: Self) -> Foo { + p.first + } + + fn bar(self) -> Field { + self.foo().bar + } +} + +struct Nested { + a: Field, + b: Field +} +struct MyStruct { + my_bool: bool, + my_int: u32, + my_nest: Nested, +} +fn test_struct_in_tuple(a_bool: bool, x: Field, y: Field) -> (MyStruct, bool) { + let my_struct = MyStruct { my_bool: a_bool, my_int: 5, my_nest: Nested { a: x, b: y } }; + (my_struct, a_bool) +} + +struct Animal { + legs: Field, + eyes: u8, +} + +fn get_dog() -> Animal { + let dog = Animal { legs: 4, eyes: 2 }; + dog +} + +struct Unit; + +fn main(x: Field, y: Field) { + let unit = Unit {}; + + let first = Foo::default(x, y); + let p = Pair { first, second: 1 }; + + assert(p.bar() == x); + assert(p.second == y); + assert(p.first.array[0] != p.first.array[1]); + // Nested structs + let (struct_from_tuple, a_bool) = test_struct_in_tuple(true, x, y); + assert(struct_from_tuple.my_bool == true); + assert(a_bool == true); + assert(struct_from_tuple.my_int == 5); + assert(struct_from_tuple.my_nest.a == 0); + // Regression test for issue #670 + let Animal { legs, eyes } = get_dog(); + let six = legs + eyes as Field; + + assert(six == 6); + + let Animal { legs: _, eyes: _ } = get_dog(); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml new file mode 100644 index 00000000000..40160fb397f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "struct_array_inputs" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Prover.toml new file mode 100644 index 00000000000..c2212c1a9c9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/Prover.toml @@ -0,0 +1,11 @@ +[[foos]] +bar = 0 +baz = 0 + +[[foos]] +bar = 0 +baz = 0 + +[[foos]] +bar = 1 +baz = 2 diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr new file mode 100644 index 00000000000..4a367558671 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr @@ -0,0 +1,8 @@ +struct Foo { + bar: Field, + baz: Field, +} + +fn main(foos: [Foo; 3]) -> pub Field { + foos[2].bar + foos[2].baz +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml new file mode 100644 index 00000000000..767f51acda3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "struct_fields_ordering" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Prover.toml new file mode 100644 index 00000000000..70640bba4cc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/Prover.toml @@ -0,0 +1,3 @@ +[y] +foo = "5" +bar = "7" diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/src/main.nr new file mode 100644 index 00000000000..1a2e2d462e2 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_fields_ordering/src/main.nr @@ -0,0 +1,12 @@ +// Note that fields are not in alphabetical order. +// We want to check that this ordering is maintained +struct myStruct { + foo: u32, + bar: Field, +} + +fn main(y: pub myStruct) { + assert(y.foo == 5); + assert(y.bar == 7); +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml new file mode 100644 index 00000000000..7dd6f78b750 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "struct_inputs" +type = "bin" +authors = [""] + +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Prover.toml new file mode 100644 index 00000000000..339da5b1a00 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/Prover.toml @@ -0,0 +1,19 @@ +x = "5" + +[y] +foo = "5" +bar = "10" +message = "hello" + +[z] +val = "1" +array = [0, 1] +message = "helld" + +[a] +baz = 0 + +[a.bar_struct] +val = "1" +array = [0, 1] +message = "hello" diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr new file mode 100644 index 00000000000..ea3a6bbe25f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr @@ -0,0 +1,6 @@ +mod bar; + +struct fooStruct { + bar_struct: bar::barStruct, + baz: Field, +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr new file mode 100644 index 00000000000..6d879326677 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr @@ -0,0 +1,7 @@ +global N = 2; + +struct barStruct { + val: Field, + array: [Field; 2], + message: str<5>, +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr new file mode 100644 index 00000000000..5b03483cbaf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr @@ -0,0 +1,34 @@ +mod foo; + +struct myStruct { + foo: u32, + bar: Field, + message: str<5>, +} + +fn main(x: Field, y: pub myStruct, z: pub foo::bar::barStruct, a: pub foo::fooStruct) -> pub Field { + let struct_from_bar = foo::bar::barStruct { val: 1, array: [0, 1], message: "hello" }; + + check_inner_struct(a, z); + + for i in 0..struct_from_bar.array.len() { + assert(struct_from_bar.array[i] == z.array[i]); + } + assert(z.val == struct_from_bar.val); + + assert((struct_from_bar.val * x) == x); + + assert(x != y.bar); + + assert(y.message == "hello"); + assert(a.bar_struct.message == struct_from_bar.message); + + a.bar_struct.array[1] +} + +fn check_inner_struct(a: foo::fooStruct, z: foo::bar::barStruct) { + assert(a.bar_struct.val == z.val); + for i in 0..a.bar_struct.array.len() { + assert(a.bar_struct.array[i] == z.array[i]); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml new file mode 100644 index 00000000000..082afdf3f10 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/submodules/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "submodules" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/submodules/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/submodules/Prover.toml new file mode 100644 index 00000000000..b6626a67e19 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/submodules/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 0 diff --git a/noir/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr new file mode 100644 index 00000000000..813f3a26a20 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr @@ -0,0 +1,15 @@ +use mysubmodule::my_helper; + +fn main(x: u1, y: u1) { + my_helper(); + mysubmodule::my_bool_or(x, y); +} + +mod mysubmodule { + pub fn my_bool_or(x: u1, y: u1) { + assert(x | y == 1); + } + + pub fn my_helper() {} +} + diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml new file mode 100644 index 00000000000..e9d2e30b4c4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "to_be_bytes" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Prover.toml new file mode 100644 index 00000000000..07fe857ac7c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/Prover.toml @@ -0,0 +1 @@ +x = "2040124" diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/src/main.nr new file mode 100644 index 00000000000..64d54ddff66 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_be_bytes/src/main.nr @@ -0,0 +1,12 @@ +fn main(x: Field) -> pub [u8; 31] { + // The result of this byte array will be big-endian + let byte_array = x.to_be_bytes(31); + let mut bytes = [0; 31]; + for i in 0..31 { + bytes[i] = byte_array[i]; + } + if (bytes[30] != 60) | (bytes[29] != 33) | (bytes[28] != 31) { + assert(false); + } + bytes +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml new file mode 100644 index 00000000000..1e117b83883 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "to_bytes_consistent" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Prover.toml new file mode 100644 index 00000000000..07fe857ac7c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/Prover.toml @@ -0,0 +1 @@ +x = "2040124" diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/src/main.nr new file mode 100644 index 00000000000..638b34c9bab --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_consistent/src/main.nr @@ -0,0 +1,13 @@ +// This test aims to check that we have consistent behavior +// between a `to_be_bytes` call (which is radix decomposition under the hood) +// with constant inputs or with witness inputs. +// x = 2040124 +fn main(x: Field) { + let byte_array = x.to_be_bytes(31); + let x_as_constant = 2040124; + let constant_byte_array = x_as_constant.to_be_bytes(31); + assert(constant_byte_array.len() == byte_array.len()); + for i in 0..constant_byte_array.len() { + assert(constant_byte_array[i] == byte_array[i]); + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml new file mode 100644 index 00000000000..c89c32eb06c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "to_bytes_integration" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Prover.toml new file mode 100644 index 00000000000..bc4693e434a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/Prover.toml @@ -0,0 +1,2 @@ +x = "2040124" +a = "0x2000000000000000000000000000000000000000000000000000000000000000" diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr new file mode 100644 index 00000000000..3c43caf1806 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr @@ -0,0 +1,25 @@ +use dep::std; + +fn main(x: Field, a: Field) { + let y: Field = 2040124; + let be_byte_array = y.to_be_bytes(31); + let le_byte_array = x.to_le_bytes(31); + + assert(le_byte_array[0] == 60); + assert(le_byte_array[0] == be_byte_array[30]); + assert(le_byte_array[1] == be_byte_array[29]); + assert(le_byte_array[2] == be_byte_array[28]); + + let z = 0 - 1; + let p_bytes = std::field::modulus_le_bytes(); + let z_bytes = z.to_le_bytes(32); + assert(p_bytes[10] == z_bytes[10]); + assert(p_bytes[0] == z_bytes[0] as u8 + 1 as u8); + + let p_bits = std::field::modulus_le_bits(); + let z_bits = z.to_le_bits(std::field::modulus_num_bits() as u32); + assert(z_bits[0] == 0); + assert(p_bits[100] == z_bits[100]); + + a.to_le_bits(std::field::modulus_num_bits() as u32); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml new file mode 100644 index 00000000000..3d02c3510fd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "to_le_bytes" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Prover.toml new file mode 100644 index 00000000000..07fe857ac7c --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/Prover.toml @@ -0,0 +1 @@ +x = "2040124" diff --git a/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr new file mode 100644 index 00000000000..05eefc0f143 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr @@ -0,0 +1,11 @@ +fn main(x: Field) -> pub [u8; 31] { + // The result of this byte array will be little-endian + let byte_array = x.to_le_bytes(31); + assert(byte_array.len() == 31); + + let mut bytes = [0; 31]; + for i in 0..31 { + bytes[i] = byte_array[i]; + } + bytes +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml new file mode 100644 index 00000000000..afd89f0c3a1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "trait_as_return_type" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Prover.toml new file mode 100644 index 00000000000..a0cd58138b6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/Prover.toml @@ -0,0 +1 @@ +x = "5" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/src/main.nr new file mode 100644 index 00000000000..f6828a356c1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_as_return_type/src/main.nr @@ -0,0 +1,51 @@ +trait SomeTrait { + fn magic_number(self) -> Field; +} + +struct A {} +struct B {} +struct C { + x: Field +} + +impl SomeTrait for A { + fn magic_number(self) -> Field { + 2 + } +} + +impl SomeTrait for B { + fn magic_number(self) -> Field { + 4 + } +} + +impl SomeTrait for C { + fn magic_number(self) -> Field { + self.x + } +} + +fn factory_a() -> impl SomeTrait { + A {} +} + +fn factory_b() -> impl SomeTrait { + B {} +} + +fn factory_c(x: Field) -> impl SomeTrait { + C { x } +} +// x = 15 +fn main(x: u32) { + let a = factory_a(); + let b = B {}; + let b2 = factory_b(); + assert(a.magic_number() == 2); + assert(b.magic_number() == 4); + assert(b2.magic_number() == 4); + let c = factory_c(10); + assert(c.magic_number() == 10); + assert(factory_c(13).magic_number() == 13); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml new file mode 100644 index 00000000000..845498737c1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "trait_impl_base_type" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Prover.toml new file mode 100644 index 00000000000..a0cd58138b6 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/Prover.toml @@ -0,0 +1 @@ +x = "5" \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/src/main.nr new file mode 100644 index 00000000000..bb11dcab73a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/trait_impl_base_type/src/main.nr @@ -0,0 +1,115 @@ +trait Fieldable { + fn to_field(self) -> Field; +} + +impl Fieldable for u32 { + fn to_field(self) -> Field { + let res = self as Field; + res * 3 + } +} + +impl Fieldable for [u32; 3] { + fn to_field(self) -> Field { + let res = self[0] + self[1] + self[2]; + res as Field + } +} + +impl Fieldable for bool { + fn to_field(self) -> Field { + if self { + 14 + } else { + 3 + } + } +} + +impl Fieldable for (u32, bool) { + fn to_field(self) -> Field { + if self.1 { + self.0 as Field + } else { + 32 + } + } +} + +impl Fieldable for Field { + fn to_field(self) -> Field { + self + } +} + +impl Fieldable for str<6> { + fn to_field(self) -> Field { + 6 + } +} + +impl Fieldable for () { + fn to_field(self) -> Field { + 0 + } +} + +type Point2D = [Field; 2]; +type Point2DAlias = Point2D; + +impl Fieldable for Point2DAlias { + fn to_field(self) -> Field { + self[0] + self[1] + } +} + +impl Fieldable for fmtstr<14, (Field, Field)> { + fn to_field(self) -> Field { + 52 + } +} + +impl Fieldable for fn(u32) -> u32 { + fn to_field(self) -> Field { + self(10) as Field + } +} + +fn some_func(x: u32) -> u32 { + x * 2 - 3 +} + +impl Fieldable for u64 { + fn to_field(self) -> Field { + 66 as Field + } +} +// x = 15 +fn main(x: u32) { + assert(x.to_field() == 15); + let arr: [u32; 3] = [3, 5, 8]; + assert(arr.to_field() == 16); + let b_true = 2 == 2; + assert(b_true.to_field() == 14); + let b_false = 2 == 3; + assert(b_false.to_field() == 3); + let f = 13 as Field; + assert(f.to_field() == 13); + let k_true = (12 as u32, true); + assert(k_true.to_field() == 12); + let k_false = (11 as u32, false); + assert(k_false.to_field() == 32); + let m = "String"; + assert(m.to_field() == 6); + let unit = (); + assert(unit.to_field() == 0); + let point: Point2DAlias = [2, 3]; + assert(point.to_field() == 5); + let i: Field = 2; + let j: Field = 6; + assert(f"i: {i}, j: {j}".to_field() == 52); + assert(some_func.to_field() == 17); + + let mut y = 0 as u64; + assert(y.to_field() == 66); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml new file mode 100644 index 00000000000..555c3b38b98 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "traits_in_crates_1" +type = "bin" +authors = [""] +[dependencies] +crate1 = { path = "crate1" } +crate2 = { path = "crate2" } diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Prover.toml new file mode 100644 index 00000000000..c2005d59807 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 11 diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml new file mode 100644 index 00000000000..f49603ba203 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "crate1" +type = "lib" +authors = [""] +[dependencies] +crate2 = { path = "../crate2" } diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/src/lib.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/src/lib.nr new file mode 100644 index 00000000000..62dd5a2c111 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate1/src/lib.nr @@ -0,0 +1,9 @@ +trait MyTrait { + fn Add10(&mut self); +} + +impl MyTrait for dep::crate2::MyStruct { + fn Add10(&mut self) { + self.Q += 10; + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml new file mode 100644 index 00000000000..c86c5edf51a --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "crate2" +type = "lib" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/src/lib.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/src/lib.nr new file mode 100644 index 00000000000..c59bf0387c1 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/crate2/src/lib.nr @@ -0,0 +1,3 @@ +struct MyStruct { + Q: Field, +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/src/main.nr new file mode 100644 index 00000000000..7ba2f63c5c0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_1/src/main.nr @@ -0,0 +1,5 @@ +fn main(x: Field, y: pub Field) { + let mut V = dep::crate2::MyStruct { Q: x }; + V.Add10(); + assert(V.Q == y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml new file mode 100644 index 00000000000..11a86a08402 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "traits_in_crates_2" +type = "bin" +authors = [""] +[dependencies] +crate1 = { path = "crate1" } +crate2 = { path = "crate2" } diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Prover.toml new file mode 100644 index 00000000000..c2005d59807 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/Prover.toml @@ -0,0 +1,2 @@ +x = 1 +y = 11 diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml new file mode 100644 index 00000000000..de1eddf2cf0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "crate1" +type = "lib" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/src/lib.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/src/lib.nr new file mode 100644 index 00000000000..59a28a50c79 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate1/src/lib.nr @@ -0,0 +1,3 @@ +trait MyTrait { + fn Add10(&mut self); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml new file mode 100644 index 00000000000..885d41f0a27 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "crate2" +type = "lib" +authors = [""] +[dependencies] +crate1 = { path = "../crate1" } diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/src/lib.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/src/lib.nr new file mode 100644 index 00000000000..38870489131 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/crate2/src/lib.nr @@ -0,0 +1,9 @@ +struct MyStruct { + Q: Field, +} + +impl dep::crate1::MyTrait for MyStruct { + fn Add10(&mut self) { + self.Q += 10; + } +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/src/main.nr new file mode 100644 index 00000000000..7ba2f63c5c0 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/traits_in_crates_2/src/main.nr @@ -0,0 +1,5 @@ +fn main(x: Field, y: pub Field) { + let mut V = dep::crate2::MyStruct { Q: x }; + V.Add10(); + assert(V.Q == y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml new file mode 100644 index 00000000000..f4af6cfe6e3 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "tuple_inputs" +type = "bin" +authors = [""] +[dependencies] \ No newline at end of file diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Prover.toml new file mode 100644 index 00000000000..43d62a7a15b --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/Prover.toml @@ -0,0 +1,12 @@ +pair = [1, 0] +x = [[0, 1, 2], [3, 4, 5]] + +[[struct_pair]] +a = "1" +b = ["2", "3", "20"] + +[struct_pair.bar] +inner = ["100", "101", "102"] + +[[struct_pair]] +inner = ["103", "104", "105"] diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/src/main.nr new file mode 100644 index 00000000000..38fec58f14f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuple_inputs/src/main.nr @@ -0,0 +1,35 @@ +struct Bar { + inner: [Field; 3], +} + +struct Foo { + a: Field, + b: [Field; 3], + bar: Bar, +} + +fn main(pair: (Field, Field), x: [(u8, u8, u8); 2], struct_pair: (Foo, Bar)) -> pub (Field, u8) { + let mut start_val = 0; + for i in 0..2 { + assert(x[i].0 == start_val); + assert(x[i].1 == start_val + 1); + assert(x[i].2 == start_val + 2); + start_val += 3; + } + + assert(struct_pair.0.a == 1); + assert(struct_pair.0.b == [2, 3, 20]); + assert(struct_pair.0.bar.inner == [100, 101, 102]); + assert(struct_pair.1.inner == [103, 104, 105]); + + let (u, v) = if pair.0 as u32 < 1 { + (pair.0, pair.0 + 1) + } else { + (pair.0 + 1, pair.0) + }; + + assert(u == pair.0 + 1); + assert(v == pair.0); + + (u, v as u8) +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml new file mode 100644 index 00000000000..f6ed9f1e649 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuples/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "tuples" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuples/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/tuples/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuples/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr new file mode 100644 index 00000000000..5526fcad422 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr @@ -0,0 +1,22 @@ +fn main(x: Field, y: Field) { + let pair = (x, y); + assert(pair.0 == 1); + assert(pair.1 == 0); + + let (a, b) = if true { (0, 1) } else { (2, 3) }; + assert(a == 0); + assert(b == 1); + + let (u, v) = if x as u32 < 1 { (x, x + 1) } else { (x + 1, x) }; + assert(u == x + 1); + assert(v == x); + // Test mutating tuples + let mut mutable = ((0, 0), 1, 2, 3); + mutable.0 = (x, y); + mutable.2 = 7; + assert(mutable.0.0 == 1); + assert(mutable.0.1 == 0); + assert(mutable.1 == 1); + assert(mutable.2 == 7); + assert(mutable.3 == 3); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml new file mode 100644 index 00000000000..a12df601a91 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "type_aliases" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Prover.toml new file mode 100644 index 00000000000..771df41899d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/Prover.toml @@ -0,0 +1 @@ +x = [2, 3] diff --git a/noir/tooling/nargo_cli/tests/execution_success/type_aliases/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/src/main.nr new file mode 100644 index 00000000000..ee62b0b7260 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/type_aliases/src/main.nr @@ -0,0 +1,33 @@ +type Foo = [T; 2]; + +type Bar = Field; + +type One = (A, B); +type Two = One; +type Three = Two; + +struct MyStruct { + foo: Bar, +} + +fn main(x: [Field; 2]) { + let a: Foo = [1, 2]; + assert(a[0] != x[0]); + + let b: Bar = 2; + assert(x[0] == b); + + let c: u8 = 1; + let d: u32 = 2; + let e: Three = (c, d); + assert(e.0 == 1); + + let s = MyStruct { foo: 10 }; + assert(s.foo == 10); + + let _regression2502: Regression2502Alias = Regression2502 {}; +} +// An ICE was occurring if a type alias referred to a struct before it was initialized +// during name resolution. The fix was to initialize structs during def collection instead. +type Regression2502Alias = Regression2502; +struct Regression2502 {} diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/Nargo.toml new file mode 100644 index 00000000000..36db098686f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/Nargo.toml @@ -0,0 +1,2 @@ +[workspace] +members = ["crates/a", "crates/b"] diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml new file mode 100644 index 00000000000..8d0e1aca4a9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "a" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Prover.toml new file mode 100644 index 00000000000..465ef562de4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/src/main.nr new file mode 100644 index 00000000000..cf72627da2e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/a/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field, y: pub Field) { + assert(x == y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml new file mode 100644 index 00000000000..f316511340f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "b" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Prover.toml new file mode 100644 index 00000000000..a0397e89477 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "0" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/src/main.nr new file mode 100644 index 00000000000..4e1fd3c9035 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace/crates/b/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field, y: pub Field) { + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Nargo.toml new file mode 100644 index 00000000000..3828c5d0677 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Nargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["a"] +default-member = "a" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Prover.toml new file mode 100644 index 00000000000..8c12ebba6cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "2" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml new file mode 100644 index 00000000000..8d0e1aca4a9 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "a" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Prover.toml new file mode 100644 index 00000000000..465ef562de4 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/Prover.toml @@ -0,0 +1,2 @@ +x = "1" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/src/main.nr new file mode 100644 index 00000000000..cf72627da2e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/a/src/main.nr @@ -0,0 +1,3 @@ +fn main(x: Field, y: pub Field) { + assert(x == y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml new file mode 100644 index 00000000000..f316511340f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "b" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Prover.toml new file mode 100644 index 00000000000..83fcd8678e7 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/Prover.toml @@ -0,0 +1,3 @@ +# Deliberately setting these to fail to prove this is NOT executed since a default is specified +x = "1" +y = "1" diff --git a/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/src/main.nr new file mode 100644 index 00000000000..6e170de75fc --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/workspace_default_member/b/src/main.nr @@ -0,0 +1,3 @@ +fn main(x : Field, y : pub Field) { + assert(x != y); +} diff --git a/noir/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml b/noir/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml new file mode 100644 index 00000000000..ddf3b6d86c5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/xor/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "xor" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/execution_success/xor/Prover.toml b/noir/tooling/nargo_cli/tests/execution_success/xor/Prover.toml new file mode 100644 index 00000000000..f28f2f8cc48 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/xor/Prover.toml @@ -0,0 +1,2 @@ +x = "5" +y = "10" diff --git a/noir/tooling/nargo_cli/tests/execution_success/xor/src/main.nr b/noir/tooling/nargo_cli/tests/execution_success/xor/src/main.nr new file mode 100644 index 00000000000..4ceef1b518f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/execution_success/xor/src/main.nr @@ -0,0 +1,5 @@ +fn main(x: u32, y: pub u32) { + let m = x ^ y; + + assert(m != 10); +} diff --git a/noir/tooling/nargo_cli/tests/gates_report.sh b/noir/tooling/nargo_cli/tests/gates_report.sh new file mode 100755 index 00000000000..e06e6812e9d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/gates_report.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +# These tests are incompatible with gas reporting +excluded_dirs=("workspace" "workspace_default_member") + +# These tests cause failures in CI with a stack overflow for some reason. +ci_excluded_dirs=("eddsa") + +current_dir=$(pwd) +base_path="$current_dir/execution_success" +test_dirs=$(ls $base_path) + +# We generate a Noir workspace which contains all of the test cases +# This allows us to generate a gates report using `nargo info` for all of them at once. + +echo "[workspace]" > Nargo.toml +echo "members = [" >> Nargo.toml + +for dir in $test_dirs; do + if [[ " ${excluded_dirs[@]} " =~ " ${dir} " ]]; then + continue + fi + + if [[ ${CI-false} = "true" ]] && [[ " ${ci_excluded_dirs[@]} " =~ " ${dir} " ]]; then + continue + fi + + echo " \"execution_success/$dir\"," >> Nargo.toml +done + +echo "]" >> Nargo.toml + +nargo info --json > gates_report.json + +rm Nargo.toml diff --git a/noir/tooling/nargo_cli/tests/hello_world.rs b/noir/tooling/nargo_cli/tests/hello_world.rs new file mode 100644 index 00000000000..bc7022d1567 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/hello_world.rs @@ -0,0 +1,55 @@ +//! This integration test aims to mirror the steps taken by a new user using Nargo for the first time. +//! It then follows the steps published at https://noir-lang.org/getting_started/hello_world.html +//! Any modifications to the commands run here MUST be documented in the noir-lang book. + +use assert_cmd::prelude::*; +use predicates::prelude::*; +use std::process::Command; + +use assert_fs::prelude::{FileWriteStr, PathAssert, PathChild}; + +#[test] +fn hello_world_example() { + let test_dir = assert_fs::TempDir::new().unwrap(); + std::env::set_current_dir(&test_dir).unwrap(); + + let project_name = "hello_world"; + let project_dir = test_dir.child(project_name); + + // `nargo new hello_world` + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("new").arg(project_name); + cmd.assert().success().stdout(predicate::str::contains("Project successfully created!")); + + project_dir.child("src").assert(predicate::path::is_dir()); + project_dir.child("Nargo.toml").assert(predicate::path::is_file()); + + std::env::set_current_dir(&project_dir).unwrap(); + + // `nargo check` + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("check"); + cmd.assert() + .success() + .stdout(predicate::str::contains("Constraint system successfully built!")); + + project_dir.child("Prover.toml").assert(predicate::path::is_file()); + project_dir.child("Verifier.toml").assert(predicate::path::is_file()); + + // `nargo prove` + project_dir.child("Prover.toml").write_str("x = 1\ny = 2").unwrap(); + + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("prove"); + cmd.assert().success(); + + project_dir + .child("proofs") + .child(format!("{project_name}.proof")) + .assert(predicate::path::is_file()); + + // `nargo verify p` + let mut cmd = Command::cargo_bin("nargo").unwrap(); + cmd.arg("verify"); + cmd.assert().success(); +} diff --git a/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml b/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml new file mode 100644 index 00000000000..3d2cf2c6096 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "should_fail_with_mismatch" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Prover.toml b/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/src/main.nr b/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/src/main.nr new file mode 100644 index 00000000000..a677b10b0cd --- /dev/null +++ b/noir/tooling/nargo_cli/tests/noir_test_failure/should_fail_mismatch/src/main.nr @@ -0,0 +1,14 @@ +#[test(should_fail_with = "Not equal")] +fn test_different_string() { + assert_eq(0, 1, "Different string"); +} +// The assert message has a space +#[test(should_fail_with = "Not equal")] +fn test_with_extra_space() { + assert_eq(0, 1, "Not equal "); +} +// The assert message has a space +#[test(should_fail_with = "Not equal")] +fn test_runtime_mismatch() { + assert_eq(dep::std::hash::pedersen_commitment([27])[0], 0, "Not equal "); +} diff --git a/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml b/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml new file mode 100644 index 00000000000..21bce3d2b2d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "should_fail_with_match" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Prover.toml b/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/src/main.nr b/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/src/main.nr new file mode 100644 index 00000000000..d2b7d155a32 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/noir_test_success/should_fail_with_matches/src/main.nr @@ -0,0 +1,19 @@ +#[test(should_fail_with = "Not equal")] +fn test_should_fail_with_match() { + assert_eq(0, 1, "Not equal"); +} + +#[test(should_fail)] +fn test_should_fail_without_match() { + assert_eq(0, 1); +} + +#[test(should_fail_with = "Not equal")] +fn test_should_fail_with_runtime_match() { + assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0, "Not equal"); +} + +#[test(should_fail)] +fn test_should_fail_without_runtime_match() { + assert_eq(dep::std::hash::pedersen_commitment([27]).x, 0); +} diff --git a/noir/tooling/nargo_cli/tests/rebuild.sh b/noir/tooling/nargo_cli/tests/rebuild.sh new file mode 100755 index 00000000000..d89402fb1cf --- /dev/null +++ b/noir/tooling/nargo_cli/tests/rebuild.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -e + +excluded_dirs=("workspace" "workspace_default_member") + +current_dir=$(pwd) +base_path="$current_dir/execution_success" + +# Clear the acir_artifacts directory of any existing artifacts +rm -rf $current_dir/acir_artifacts +mkdir -p $current_dir/acir_artifacts + +# Loop over every directory +for dir in $base_path/*; do + if [[ ! -d $dir ]]; then + continue + fi + + dir_name=$(basename "$dir") + + if [[ ! " ${excluded_dirs[@]} " =~ " ${dir_name} " ]]; then + if [[ ! -d "$current_dir/acir_artifacts/$dir_name" ]]; then + mkdir -p $current_dir/acir_artifacts/$dir_name + fi + + cd $dir + if [ -d ./target/ ]; then + rm -r ./target/ + fi + nargo compile && nargo execute witness + + # Rename witness.tr to witness.gz + if [ -f ./target/witness.tr ]; then + mv ./target/witness.tr ./target/witness.gz + fi + + # Extract bytecode field from JSON, base64 decode it, and save it to the target directory + if [ -f ./target/${dir_name}.json ]; then + jq -r '.bytecode' ./target/${dir_name}.json | base64 -d > ./target/acir.gz + fi + + # Delete the JSON file after extracting bytecode field + rm ./target/${dir_name}.json + + # Clear the target directory in acir_artifacts + if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then + rm -r "$current_dir/acir_artifacts/$dir_name/target" + fi + mkdir $current_dir/acir_artifacts/$dir_name/target + + # Move the artifacts from the target directory to the corresponding directory in acir_artifacts + mv ./target/*.gz $current_dir/acir_artifacts/$dir_name/target/ + + cd $base_path + fi +done diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml b/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml new file mode 100644 index 00000000000..62ffe95922d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "bad_impl" +type = "lib" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/src/lib.nr b/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/src/lib.nr new file mode 100644 index 00000000000..a96a6cbf91f --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/bad_impl/src/lib.nr @@ -0,0 +1,5 @@ +impl Field { + fn something(self) -> Field { + self + } +} diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml b/noir/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml new file mode 100644 index 00000000000..74f6f66524d --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/bad_name/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "bad-name" +type = "lib" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bad_name/src/lib.nr b/noir/tooling/nargo_cli/tests/test_libraries/bad_name/src/lib.nr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml b/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml new file mode 100644 index 00000000000..7cc99c1c5c5 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "bin_dep" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/src/main.nr b/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/src/main.nr new file mode 100644 index 00000000000..042c85a8afb --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/bin_dep/src/main.nr @@ -0,0 +1,3 @@ +fn call_dep1_then_dep2(x: Field, y: Field) { + assert(x == y); +} diff --git a/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml new file mode 100644 index 00000000000..f7770e07469 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "diamond_deps_1" +type = "lib" +authors = [""] +[dependencies] +dep2 = { path = "../diamond_deps_2" } diff --git a/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/src/lib.nr b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/src/lib.nr new file mode 100644 index 00000000000..60c001ec64e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_1/src/lib.nr @@ -0,0 +1,5 @@ +use dep::dep2::call_dep2; + +pub fn call_dep1_then_dep2(x: Field, y: Field) -> Field { + call_dep2(x, y) +} diff --git a/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml new file mode 100644 index 00000000000..2dbba1b7a9e --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "diamond_deps_2" +type = "lib" +authors = [""] +[dependencies] diff --git a/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/src/lib.nr b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/src/lib.nr new file mode 100644 index 00000000000..46dce3d5600 --- /dev/null +++ b/noir/tooling/nargo_cli/tests/test_libraries/diamond_deps_2/src/lib.nr @@ -0,0 +1,5 @@ +global RESOLVE_THIS = 3; + +pub fn call_dep2(x: Field, y: Field) -> Field { + x + y +} diff --git a/noir/tooling/nargo_fmt/Cargo.toml b/noir/tooling/nargo_fmt/Cargo.toml new file mode 100644 index 00000000000..921c9893ab5 --- /dev/null +++ b/noir/tooling/nargo_fmt/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "nargo_fmt" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +bytecount = "0.6.3" +noirc_frontend.workspace = true +serde.workspace = true +toml.workspace = true +thiserror.workspace = true + +[dev-dependencies] +similar-asserts = "1.5.0" diff --git a/noir/tooling/nargo_fmt/build.rs b/noir/tooling/nargo_fmt/build.rs new file mode 100644 index 00000000000..cd93866ece9 --- /dev/null +++ b/noir/tooling/nargo_fmt/build.rs @@ -0,0 +1,73 @@ +use std::fs::File; +use std::io::Write; +use std::path::{Path, PathBuf}; +use std::{env, fs}; + +fn main() { + let out_dir = env::var("OUT_DIR").unwrap(); + let destination = Path::new(&out_dir).join("execute.rs"); + let mut test_file = File::create(destination).unwrap(); + + // Try to find the directory that Cargo sets when it is running; otherwise fallback to assuming the CWD + // is the root of the repository and append the crate path + let manifest_dir = match std::env::var("CARGO_MANIFEST_DIR") { + Ok(dir) => PathBuf::from(dir), + Err(_) => std::env::current_dir().unwrap().join("crates").join("nargo_cli"), + }; + let test_dir = manifest_dir.join("tests"); + + generate_formatter_tests(&mut test_file, &test_dir); +} + +fn generate_formatter_tests(test_file: &mut File, test_data_dir: &Path) { + let inputs_dir = test_data_dir.join("input"); + let outputs_dir = test_data_dir.join("expected"); + + let test_case_files = + fs::read_dir(inputs_dir).unwrap().flatten().filter(|c| c.path().is_file()); + + for file in test_case_files { + let file_path = file.path(); + let file_name = file_path.file_name().unwrap(); + let test_name = file_path.file_stem().unwrap().to_str().unwrap(); + + if test_name.contains('-') { + panic!( + "Invalid test directory: {test_name}. Cannot include `-`, please convert to `_`" + ); + }; + + let input_source_path = file.path(); + let input_source = std::fs::read_to_string(input_source_path).unwrap(); + + let config = input_source + .lines() + .flat_map(|line| line.strip_prefix("//@")) + .collect::>() + .join("\n"); + + let output_source_path = outputs_dir.join(file_name); + let output_source = std::fs::read_to_string(output_source_path).unwrap(); + + write!( + test_file, + r##" +#[test] +fn format_{test_name}() {{ + let input = r#"{input_source}"#; + let expected_output = r#"{output_source}"#; + + + let (parsed_module, errors) = noirc_frontend::parse_program(&input); + + let config = nargo_fmt::Config::of("{config}").unwrap(); + let fmt_text = nargo_fmt::format(&input, parsed_module, &config); + + + similar_asserts::assert_eq!(fmt_text, expected_output); +}} + "## + ) + .expect("Could not write templated test file."); + } +} diff --git a/noir/tooling/nargo_fmt/src/config.rs b/noir/tooling/nargo_fmt/src/config.rs new file mode 100644 index 00000000000..2bb5d97c0af --- /dev/null +++ b/noir/tooling/nargo_fmt/src/config.rs @@ -0,0 +1,74 @@ +use std::path::Path; + +use crate::errors::ConfigError; + +macro_rules! config { + ($($field_name:ident: $field_ty:ty, $default_value:expr, $description:expr );+ $(;)*) => ( + pub struct Config { + $( + #[doc = $description] + pub $field_name: $field_ty + ),+ + } + + impl Config { + pub fn fill_from_toml(&mut self, toml: TomlConfig) { + $( + if let Some(value) = toml.$field_name { + self.$field_name = value; + } + )+ + } + } + + impl Default for Config { + fn default() -> Self { + Self { + $( + $field_name: $default_value, + )+ + } + } + } + + #[derive(serde::Deserialize, serde::Serialize, Clone)] + pub struct TomlConfig { + $( + #[doc = $description] + pub $field_name: Option<$field_ty> + ),+ + } + ) +} + +config! { + max_width: usize, 100, "Maximum width of each line"; + tab_spaces: usize, 4, "Number of spaces per tab"; + remove_nested_parens: bool, true, "Remove nested parens"; + error_on_lost_comment: bool, true, "Error if unable to get comments"; + short_array_element_width_threshold: usize, 10, "Width threshold for an array element to be considered short"; + array_width: usize, 100, "Maximum width of an array literal before falling back to vertical formatting"; + fn_call_width: usize, 60, "Maximum width of the args of a function call before falling back to vertical formatting"; + single_line_if_else_max_width: usize, 50, "Maximum line length for single line if-else expressions"; +} + +impl Config { + pub fn read(path: &Path) -> Result { + let config_path = path.join("noirfmt.toml"); + + let input = match std::fs::read_to_string(&config_path) { + Ok(input) => input, + Err(cause) if cause.kind() == std::io::ErrorKind::NotFound => String::new(), + Err(cause) => return Err(ConfigError::ReadFailed(config_path, cause)), + }; + + Self::of(&input) + } + + pub fn of(s: &str) -> Result { + let mut config = Self::default(); + let toml = toml::from_str(s).map_err(ConfigError::MalformedFile)?; + config.fill_from_toml(toml); + Ok(config) + } +} diff --git a/noir/tooling/nargo_fmt/src/errors.rs b/noir/tooling/nargo_fmt/src/errors.rs new file mode 100644 index 00000000000..e0a1758ae0f --- /dev/null +++ b/noir/tooling/nargo_fmt/src/errors.rs @@ -0,0 +1,12 @@ +use std::path::PathBuf; + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum ConfigError { + #[error("Cannot read file {0} - {1}")] + ReadFailed(PathBuf, std::io::Error), + + #[error("noirfmt.toml is badly formed, could not parse.\n\n {0}")] + MalformedFile(#[from] toml::de::Error), +} diff --git a/noir/tooling/nargo_fmt/src/lib.rs b/noir/tooling/nargo_fmt/src/lib.rs new file mode 100644 index 00000000000..d731934c3c3 --- /dev/null +++ b/noir/tooling/nargo_fmt/src/lib.rs @@ -0,0 +1,36 @@ +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] + +/// A Rust code formatting utility designed to manage and format untouched fragments of source code, +/// including comments, whitespace, and other characters. While the module doesn't directly address comments, +/// it treats them as unchanged fragments, ensuring their original placement and content remain preserved. +/// +/// Key methods include: +/// - `format_missing`: Addresses characters between the last processed position and a given end position, +/// capturing comments and other untouched sequences. +/// - `format_missing_indent`: Functions similarly to `format_missing`, but introduces added indentation. +/// - `format_missing_inner`: The core method for handling missing fragments, appending them to the output buffer. +/// Pure whitespace fragments might be replaced or adjusted based on context. +/// - `push_vertical_spaces`: Standardizes vertical spacing, eliminating potential excessive empty lines +/// or ensuring adequate vertical separation. +/// +/// By recognizing and properly handling these untouched fragments, the utility ensures comments remain intact +/// in both placement and content during the formatting process. +mod config; +pub mod errors; +mod rewrite; +mod utils; +mod visitor; + +use noirc_frontend::ParsedModule; +use visitor::FmtVisitor; + +pub use config::Config; + +pub fn format(source: &str, parsed_module: ParsedModule, config: &Config) -> String { + let mut fmt = FmtVisitor::new(source, config); + fmt.visit_file(parsed_module); + fmt.finish() +} diff --git a/noir/tooling/nargo_fmt/src/rewrite.rs b/noir/tooling/nargo_fmt/src/rewrite.rs new file mode 100644 index 00000000000..c1ac585985e --- /dev/null +++ b/noir/tooling/nargo_fmt/src/rewrite.rs @@ -0,0 +1,5 @@ +mod array; +mod infix; + +pub(crate) use array::rewrite as array; +pub(crate) use infix::rewrite as infix; diff --git a/noir/tooling/nargo_fmt/src/rewrite/array.rs b/noir/tooling/nargo_fmt/src/rewrite/array.rs new file mode 100644 index 00000000000..9c49d827528 --- /dev/null +++ b/noir/tooling/nargo_fmt/src/rewrite/array.rs @@ -0,0 +1,85 @@ +use noirc_frontend::{hir::resolution::errors::Span, token::Token, Expression}; + +use crate::{ + utils::{Expr, FindToken}, + visitor::FmtVisitor, +}; + +pub(crate) fn rewrite(mut visitor: FmtVisitor, array: Vec, array_span: Span) -> String { + let pattern: &[_] = &[' ', '\t']; + + visitor.indent.block_indent(visitor.config); + let nested_indent = visitor.shape(); + + let indent_str = nested_indent.indent.to_string(); + + let mut last_position = array_span.start() + 1; + let end_position = array_span.end() - 1; + + let mut items = array.into_iter().peekable(); + + let mut result = Vec::new(); + while let Some(item) = items.next() { + let item_span = item.span; + + let start: u32 = last_position; + let end = item_span.start(); + + let leading = visitor.slice(start..end).trim_matches(pattern); + let item = visitor.format_sub_expr(item); + let next_start = items.peek().map_or(end_position, |expr| expr.span.start()); + let trailing = visitor.slice(item_span.end()..next_start); + let offset = trailing + .find_token(Token::Comma) + .map(|span| span.end() as usize) + .unwrap_or(trailing.len()); + let trailing = trailing[..offset].trim_end_matches(',').trim_matches(pattern); + last_position = item_span.end() + offset as u32; + + let (leading, _) = visitor.format_comment_in_block(leading); + let (trailing, _) = visitor.format_comment_in_block(trailing); + + result.push(Expr { leading, value: item, trailing, different_line: false }); + } + + let slice = visitor.slice(last_position..end_position); + let (comment, _) = visitor.format_comment_in_block(slice); + result.push(Expr { + leading: "".into(), + value: "".into(), + trailing: comment, + different_line: false, + }); + + visitor.indent.block_unindent(visitor.config); + + let mut items_str = String::new(); + let mut items = result.into_iter().peekable(); + while let Some(next) = items.next() { + items_str.push_str(&next.leading); + if next.leading.contains('\n') && !next.value.is_empty() { + items_str.push_str(&indent_str); + } + items_str.push_str(&next.value); + items_str.push_str(&next.trailing); + + if let Some(item) = items.peek() { + if !item.value.is_empty() { + items_str.push(','); + } + + if !item.leading.contains('\n') && !next.value.is_empty() { + items_str.push(' '); + } + } + } + + crate::visitor::expr::wrap_exprs( + "[", + "]", + items_str.trim().into(), + nested_indent, + visitor.shape(), + true, + ) +} diff --git a/noir/tooling/nargo_fmt/src/rewrite/infix.rs b/noir/tooling/nargo_fmt/src/rewrite/infix.rs new file mode 100644 index 00000000000..0fbfa07a841 --- /dev/null +++ b/noir/tooling/nargo_fmt/src/rewrite/infix.rs @@ -0,0 +1,112 @@ +use std::iter::zip; + +use noirc_frontend::{Expression, ExpressionKind}; + +use crate::{ + utils::{first_line_width, is_single_line}, + visitor::{ExpressionType, FmtVisitor, Shape}, +}; + +pub(crate) fn rewrite(visitor: FmtVisitor, expr: Expression, shape: Shape) -> String { + match flatten(visitor.fork(), &expr) { + Some((exprs, separators)) => rewrite_single_line(shape, &exprs, &separators) + .unwrap_or_else(|| rewrite_multiline(visitor, &exprs, &separators)), + None => { + let ExpressionKind::Infix(infix) = expr.kind else { unreachable!() }; + + format!( + "{} {} {}", + visitor.format_sub_expr(infix.lhs), + infix.operator.contents.as_string(), + visitor.format_sub_expr(infix.rhs) + ) + } + } +} + +fn rewrite_single_line(shape: Shape, exprs: &[String], separators: &[String]) -> Option { + let mut result = String::new(); + + for (rewrite, separator) in zip(exprs, separators) { + if !is_single_line(rewrite) || result.len() > shape.width { + return None; + } + + result.push_str(rewrite); + result.push(' '); + result.push_str(separator); + result.push(' '); + } + + let last = exprs.last().unwrap(); + result.push_str(last); + + if first_line_width(&result) > shape.width { + return None; + } + + result.into() +} + +fn rewrite_multiline(visitor: FmtVisitor, exprs: &[String], separators: &[String]) -> String { + let mut visitor = visitor.fork(); + visitor.indent.block_indent(visitor.config); + let indent_str = visitor.indent.to_string_with_newline(); + + let mut result = exprs[0].clone(); + + for (rewrite, separator) in exprs[1..].iter().zip(separators.iter()) { + result.push_str(&indent_str); + result.push_str(separator); + result.push(' '); + result.push_str(rewrite); + } + + result +} + +pub(crate) fn flatten( + mut visitor: FmtVisitor, + mut node: &Expression, +) -> Option<(Vec, Vec)> { + let top_operator = match node.kind { + ExpressionKind::Infix(ref infix) => infix.operator.contents, + _ => return None, + }; + + let mut result = Vec::new(); + + let mut stack: Vec<&Expression> = Vec::new(); + let mut separators = Vec::new(); + + loop { + match &node.kind { + ExpressionKind::Infix(infix) if top_operator == infix.operator.contents => { + stack.push(node); + node = &infix.lhs; + } + _ => { + let rewrite = if result.is_empty() { + visitor.format_expr(node.clone(), ExpressionType::SubExpression) + } else { + visitor.indent.block_indent(visitor.config); + visitor.format_expr(node.clone(), ExpressionType::SubExpression) + }; + + result.push(rewrite); + + let Some(pop) = stack.pop() else { break; }; + + match &pop.kind { + ExpressionKind::Infix(infix) => { + separators.push(infix.operator.contents.to_string()); + node = &infix.rhs; + } + _ => unreachable!(), + } + } + } + } + + (result, separators).into() +} diff --git a/noir/tooling/nargo_fmt/src/utils.rs b/noir/tooling/nargo_fmt/src/utils.rs new file mode 100644 index 00000000000..13938079e68 --- /dev/null +++ b/noir/tooling/nargo_fmt/src/utils.rs @@ -0,0 +1,277 @@ +use crate::visitor::FmtVisitor; +use noirc_frontend::hir::resolution::errors::Span; +use noirc_frontend::lexer::Lexer; +use noirc_frontend::token::Token; +use noirc_frontend::{Expression, Ident, Param, Visibility}; + +pub(crate) fn changed_comment_content(original: &str, new: &str) -> bool { + comments(original).ne(comments(new)) +} + +pub(crate) fn comments(source: &str) -> impl Iterator + '_ { + Lexer::new(source).skip_comments(false).flatten().filter_map(|spanned| { + if let Token::LineComment(content, _) | Token::BlockComment(content, _) = + spanned.into_token() + { + Some(content) + } else { + None + } + }) +} + +#[derive(Debug)] +pub(crate) struct Expr { + pub(crate) leading: String, + pub(crate) value: String, + pub(crate) trailing: String, + pub(crate) different_line: bool, +} + +impl Expr { + pub(crate) fn total_width(&self) -> usize { + comment_len(&self.leading) + self.value.chars().count() + comment_len(&self.trailing) + } + + pub(crate) fn is_multiline(&self) -> bool { + self.leading.contains('\n') || self.trailing.contains('\n') + } +} + +pub(crate) struct Exprs<'me, T> { + pub(crate) visitor: &'me FmtVisitor<'me>, + pub(crate) elements: std::iter::Peekable>, + pub(crate) last_position: u32, + pub(crate) end_position: u32, +} + +impl<'me, T: Item> Exprs<'me, T> { + pub(crate) fn new(visitor: &'me FmtVisitor<'me>, span: Span, elements: Vec) -> Self { + Self { + visitor, + last_position: span.start() + 1, /*(*/ + end_position: span.end() - 1, /*)*/ + elements: elements.into_iter().peekable(), + } + } +} + +impl Iterator for Exprs<'_, T> { + type Item = Expr; + + fn next(&mut self) -> Option { + let element = self.elements.next()?; + let element_span = element.span(); + + let start = self.last_position; + let end = element_span.start(); + + let is_last = self.elements.peek().is_none(); + let next_start = self.elements.peek().map_or(self.end_position, |expr| expr.start()); + + let (leading, different_line) = self.leading(start, end); + let expr = element.format(self.visitor); + let trailing = self.trailing(element_span.end(), next_start, is_last); + + Expr { leading, value: expr, trailing, different_line }.into() + } +} + +impl<'me, T> Exprs<'me, T> { + pub(crate) fn leading(&mut self, start: u32, end: u32) -> (String, bool) { + let mut different_line = false; + + let leading = self.visitor.slice(start..end); + let leading_trimmed = leading.trim(); + + let starts_with_block_comment = leading_trimmed.starts_with("/*"); + let ends_with_block_comment = leading_trimmed.ends_with("*/"); + let starts_with_single_line_comment = leading_trimmed.starts_with("//"); + + if ends_with_block_comment { + let comment_end = leading_trimmed.rfind(|c| c == '/').unwrap(); + + if leading[comment_end..].contains('\n') { + different_line = true; + } + } else if starts_with_single_line_comment || starts_with_block_comment { + different_line = true; + }; + + (leading_trimmed.to_string(), different_line) + } + + pub(crate) fn trailing(&mut self, start: u32, end: u32, is_last: bool) -> String { + let slice = self.visitor.slice(start..end); + let comment_end = find_comment_end(slice, is_last); + let trailing = slice[..comment_end].trim_matches(',').trim(); + self.last_position = start + (comment_end as u32); + trailing.to_string() + } +} + +pub(crate) trait FindToken { + fn find_token(&self, token: Token) -> Option; + fn find_token_with(&self, f: impl Fn(&Token) -> bool) -> Option; +} + +impl FindToken for str { + fn find_token(&self, token: Token) -> Option { + Lexer::new(self).flatten().find_map(|it| (it.token() == &token).then(|| it.to_span())) + } + + fn find_token_with(&self, f: impl Fn(&Token) -> bool) -> Option { + Lexer::new(self) + .skip_comments(false) + .flatten() + .find_map(|spanned| f(spanned.token()).then(|| spanned.to_span().end())) + } +} + +pub(crate) fn find_comment_end(slice: &str, is_last: bool) -> usize { + fn find_comment_end(slice: &str) -> usize { + slice + .find_token_with(|token| { + matches!(token, Token::LineComment(_, _) | Token::BlockComment(_, _)) + }) + .map(|index| index as usize) + .unwrap_or(slice.len()) + } + + if is_last { + return slice.len(); + } + + let mut block_open_index = slice.find("/*"); + if let Some(index) = block_open_index { + match slice.find('/') { + Some(slash) if slash < index => block_open_index = None, + _ if slice[..index].ends_with('/') => block_open_index = None, + _ => (), + } + } + + let newline_index = slice.find('\n'); + if let Some(separator_index) = + slice.find_token(Token::Comma).map(|index| index.start() as usize) + { + match (block_open_index, newline_index) { + (Some(block), None) if block > separator_index => separator_index + 1, + (Some(block), None) => { + let slice = &slice[block..]; + std::cmp::max(find_comment_end(slice) + block, separator_index + 1) + } + (Some(block), Some(newline)) if block < newline => { + let slice = &slice[block..]; + std::cmp::max(find_comment_end(slice) + block, separator_index + 1) + } + (_, Some(newline)) if newline > separator_index => newline + 1, + _ => slice.len(), + } + } else if let Some(newline_index) = newline_index { + newline_index + 1 + } else { + 0 + } +} + +fn comment_len(comment: &str) -> usize { + match comment { + "" => 0, + _ => { + let len = comment.trim().len(); + if len > 0 { + len + 6 + } else { + len + } + } + } +} + +pub(crate) fn count_newlines(slice: &str) -> usize { + bytecount::count(slice.as_bytes(), b'\n') +} + +pub(crate) trait Item { + fn span(&self) -> Span; + + fn format(self, visitor: &FmtVisitor) -> String; + + fn start(&self) -> u32 { + self.span().start() + } + + fn end(&self) -> u32 { + self.span().end() + } +} + +impl Item for Expression { + fn span(&self) -> Span { + self.span + } + + fn format(self, visitor: &FmtVisitor) -> String { + visitor.format_sub_expr(self) + } +} + +impl Item for (Ident, Expression) { + fn span(&self) -> Span { + let (name, value) = self; + (name.span().start()..value.span.end()).into() + } + + fn format(self, visitor: &FmtVisitor) -> String { + let (name, expr) = self; + + let name = name.0.contents; + let expr = visitor.format_sub_expr(expr); + + if name == expr { + name + } else { + format!("{name}: {expr}") + } + } +} + +impl Item for Param { + fn span(&self) -> Span { + self.span + } + + fn format(self, visitor: &FmtVisitor) -> String { + let visibility = match self.visibility { + Visibility::Public => "pub ", + Visibility::Private => "", + }; + let pattern = visitor.slice(self.pattern.span()); + let ty = visitor.slice(self.typ.span.unwrap()); + + format!("{pattern}: {visibility}{ty}") + } +} + +impl Item for Ident { + fn span(&self) -> Span { + self.span() + } + + fn format(self, visitor: &FmtVisitor) -> String { + visitor.slice(self.span()).into() + } +} + +pub(crate) fn first_line_width(exprs: &str) -> usize { + exprs.lines().next().map_or(0, |line: &str| line.chars().count()) +} + +pub(crate) fn is_single_line(s: &str) -> bool { + !s.chars().any(|c| c == '\n') +} + +pub(crate) fn last_line_contains_single_line_comment(s: &str) -> bool { + s.lines().last().map_or(false, |line| line.contains("//")) +} diff --git a/noir/tooling/nargo_fmt/src/visitor.rs b/noir/tooling/nargo_fmt/src/visitor.rs new file mode 100644 index 00000000000..cf3b3a41e8a --- /dev/null +++ b/noir/tooling/nargo_fmt/src/visitor.rs @@ -0,0 +1,284 @@ +pub(crate) mod expr; +mod item; +mod stmt; + +use noirc_frontend::{hir::resolution::errors::Span, lexer::Lexer, token::Token}; + +use crate::{ + config::Config, + utils::{self, FindToken}, +}; + +pub(crate) struct FmtVisitor<'me> { + ignore_next_node: bool, + pub(crate) config: &'me Config, + buffer: String, + pub(crate) source: &'me str, + pub(crate) indent: Indent, + last_position: u32, +} + +impl<'me> FmtVisitor<'me> { + pub(crate) fn new(source: &'me str, config: &'me Config) -> Self { + Self { + ignore_next_node: false, + buffer: String::new(), + config, + source, + last_position: 0, + indent: Indent { block_indent: 0 }, + } + } + + pub(crate) fn slice(&self, span: impl Into) -> &'me str { + let span = span.into(); + &self.source[span.start() as usize..span.end() as usize] + } + + fn span_after(&self, span: impl Into, token: Token) -> Span { + let span = span.into(); + + let slice = self.slice(span); + let offset = slice.find_token(token).unwrap().end(); + + (span.start() + offset..span.end()).into() + } + + fn span_before(&self, span: impl Into, token: Token) -> Span { + let span = span.into(); + + let slice = self.slice(span); + let offset = slice.find_token(token).unwrap().start(); + + (span.start() + offset..span.end()).into() + } + + pub(crate) fn shape(&self) -> Shape { + Shape { + width: self.config.max_width.saturating_sub(self.indent.width()), + indent: self.indent, + } + } + + pub(crate) fn fork(&self) -> Self { + Self { + buffer: String::new(), + ignore_next_node: self.ignore_next_node, + config: self.config, + source: self.source, + last_position: self.last_position, + indent: self.indent, + } + } + + pub(crate) fn finish(self) -> String { + self.buffer + } + + fn at_start(&self) -> bool { + self.buffer.is_empty() + } + + fn push_str(&mut self, s: &str) { + let comments = Lexer::new(s).skip_comments(false).flatten().flat_map(|token| { + if let Token::LineComment(content, _) | Token::BlockComment(content, _) = + token.into_token() + { + let content = content.trim(); + content.strip_prefix("noir-fmt:").map(ToOwned::to_owned) + } else { + None + } + }); + + for comment in comments { + match comment.as_str() { + "ignore" => self.ignore_next_node = true, + this => unreachable!("unknown settings {this}"), + } + } + + self.buffer.push_str(s); + } + + #[track_caller] + fn push_rewrite(&mut self, rewrite: String, span: Span) { + let original = self.slice(span); + let changed_comment_content = utils::changed_comment_content(original, &rewrite); + + if changed_comment_content && self.config.error_on_lost_comment { + panic!("not formatted because a comment would be lost: {rewrite:?}"); + } + + self.format_missing_indent(span.start(), true); + + let rewrite = if changed_comment_content || std::mem::take(&mut self.ignore_next_node) { + original.to_string() + } else { + rewrite + }; + + self.push_str(&rewrite); + + if rewrite.starts_with('{') && rewrite.ends_with('}') { + self.ignore_next_node = false; + } + } + + #[track_caller] + fn format_missing_indent(&mut self, end: u32, should_indent: bool) { + self.format_missing_inner(end, |this, last_slice, slice| { + this.push_str(last_slice.trim_end()); + + if (last_slice == slice && !this.at_start()) || this.buffer.ends_with("*/") { + this.push_str("\n"); + } + + if should_indent { + let indent = this.indent.to_string(); + this.push_str(&indent); + } + }); + } + + #[track_caller] + fn format_missing_inner( + &mut self, + end: u32, + process_last_slice: impl Fn(&mut Self, &str, &str), + ) { + let start = self.last_position; + + if start == end { + if !self.at_start() { + process_last_slice(self, "", ""); + } + return; + } + + let slice = self.slice(start..end); + self.last_position = end; + + if slice.trim().is_empty() && !self.at_start() { + self.push_vertical_spaces(slice); + process_last_slice(self, "", slice); + } else { + let (result, last_end) = self.format_comment_in_block(slice); + if result.trim().is_empty() { + process_last_slice(self, slice, slice); + } else { + let last_snippet = &slice[last_end as usize..]; + self.push_str(&result); + process_last_slice(self, last_snippet, &result); + } + } + } + + pub(crate) fn format_comment_in_block(&mut self, slice: &str) -> (String, u32) { + let mut result = String::new(); + let comments = Lexer::new(slice).skip_comments(false).skip_whitespaces(false).flatten(); + + let indent = self.indent.to_string(); + for comment in comments { + let span = comment.to_span(); + + match comment.token() { + Token::LineComment(_, _) | Token::BlockComment(_, _) => { + let comment = &slice[span.start() as usize..span.end() as usize]; + if result.ends_with('\n') { + result.push_str(&indent); + } else if !self.at_start() { + result.push(' '); + } + result.push_str(comment); + } + Token::Whitespace(whitespaces) => { + let mut visitor = self.fork(); + if whitespaces.contains('\n') { + visitor.push_vertical_spaces(whitespaces.trim_matches(' ')); + result.push_str(&visitor.finish()); + } + } + _ => {} + } + } + + (result, slice.len() as u32) + } + + fn push_vertical_spaces(&mut self, slice: &str) { + let newline_upper_bound = 2; + let newline_lower_bound = 1; + + let mut newline_count = utils::count_newlines(slice); + let offset = self.buffer.chars().rev().take_while(|c| *c == '\n').count(); + + if newline_count + offset > newline_upper_bound { + if offset >= newline_upper_bound { + newline_count = 0; + } else { + newline_count = newline_upper_bound - offset; + } + } else if newline_count + offset < newline_lower_bound { + if offset >= newline_lower_bound { + newline_count = 0; + } else { + newline_count = newline_lower_bound - offset; + } + } + + let blank_lines = "\n".repeat(newline_count); + self.push_str(&blank_lines); + } + + pub(crate) fn format_comment(&self, span: Span) -> String { + let slice = self.slice(span).trim(); + let pos = slice.find('/'); + + if !slice.is_empty() && pos.is_some() { + slice.to_string() + } else { + String::new() + } + } +} + +#[derive(Clone, Copy, Debug, Default)] +pub(crate) struct Indent { + block_indent: usize, +} + +impl Indent { + pub(crate) fn width(&self) -> usize { + self.block_indent + } + + pub(crate) fn block_indent(&mut self, config: &Config) { + self.block_indent += config.tab_spaces; + } + + pub(crate) fn block_unindent(&mut self, config: &Config) { + self.block_indent -= config.tab_spaces; + } + + pub(crate) fn to_string_with_newline(self) -> String { + "\n".to_string() + &self.to_string() + } + + #[allow(clippy::inherent_to_string)] + pub(crate) fn to_string(self) -> String { + " ".repeat(self.block_indent) + } +} + +#[derive(Clone, Copy, Debug)] +pub(crate) struct Shape { + pub(crate) width: usize, + pub(crate) indent: Indent, +} + +#[derive(PartialEq, Eq, Debug)] +pub(crate) enum ExpressionType { + Statement, + SubExpression, +} diff --git a/noir/tooling/nargo_fmt/src/visitor/expr.rs b/noir/tooling/nargo_fmt/src/visitor/expr.rs new file mode 100644 index 00000000000..8492fd5c05d --- /dev/null +++ b/noir/tooling/nargo_fmt/src/visitor/expr.rs @@ -0,0 +1,629 @@ +use noirc_frontend::{ + hir::resolution::errors::Span, lexer::Lexer, token::Token, ArrayLiteral, BlockExpression, + ConstructorExpression, Expression, ExpressionKind, IfExpression, Literal, Statement, + StatementKind, UnaryOp, +}; + +use super::{ExpressionType, FmtVisitor, Indent, Shape}; +use crate::{ + rewrite, + utils::{self, first_line_width, Expr, FindToken, Item}, + Config, +}; + +impl FmtVisitor<'_> { + pub(crate) fn visit_expr(&mut self, expr: Expression, expr_type: ExpressionType) { + let span = expr.span; + let rewrite = self.format_expr(expr, expr_type); + self.push_rewrite(rewrite, span); + self.last_position = span.end(); + } + + pub(crate) fn format_sub_expr(&self, expression: Expression) -> String { + self.format_expr(expression, ExpressionType::SubExpression) + } + + pub(crate) fn format_expr( + &self, + Expression { kind, mut span }: Expression, + expr_type: ExpressionType, + ) -> String { + match kind { + ExpressionKind::Block(block) => { + let mut visitor = self.fork(); + visitor.visit_block(block, span); + visitor.buffer + } + ExpressionKind::Prefix(prefix) => { + let op = match prefix.operator { + UnaryOp::Minus => "-", + UnaryOp::Not => "!", + UnaryOp::MutableReference => "&mut ", + UnaryOp::Dereference { implicitly_added } => { + if implicitly_added { + "" + } else { + "*" + } + } + }; + + format!("{op}{}", self.format_sub_expr(prefix.rhs)) + } + ExpressionKind::Cast(cast) => { + format!("{} as {}", self.format_sub_expr(cast.lhs), cast.r#type) + } + kind @ ExpressionKind::Infix(_) => { + let shape = self.shape(); + rewrite::infix(self.fork(), Expression { kind, span }, shape) + } + ExpressionKind::Call(call_expr) => { + let args_span = + self.span_before(call_expr.func.span.end()..span.end(), Token::LeftParen); + + let callee = self.format_sub_expr(*call_expr.func); + let args = format_parens( + self.config.fn_call_width.into(), + self.fork(), + false, + call_expr.arguments, + args_span, + ); + + format!("{callee}{args}") + } + ExpressionKind::MethodCall(method_call_expr) => { + let args_span = self.span_before( + method_call_expr.method_name.span().end()..span.end(), + Token::LeftParen, + ); + + let object = self.format_sub_expr(method_call_expr.object); + let method = method_call_expr.method_name.to_string(); + let args = format_parens( + self.config.fn_call_width.into(), + self.fork(), + false, + method_call_expr.arguments, + args_span, + ); + + format!("{object}.{method}{args}") + } + ExpressionKind::MemberAccess(member_access_expr) => { + let lhs_str = self.format_sub_expr(member_access_expr.lhs); + format!("{}.{}", lhs_str, member_access_expr.rhs) + } + ExpressionKind::Index(index_expr) => { + let index_span = self + .span_before(index_expr.collection.span.end()..span.end(), Token::LeftBracket); + + let collection = self.format_sub_expr(index_expr.collection); + let index = format_brackets(self.fork(), false, vec![index_expr.index], index_span); + + format!("{collection}{index}") + } + ExpressionKind::Tuple(exprs) => { + format_parens(None, self.fork(), exprs.len() == 1, exprs, span) + } + ExpressionKind::Literal(literal) => match literal { + Literal::Integer(_) | Literal::Bool(_) | Literal::Str(_) | Literal::FmtStr(_) => { + self.slice(span).to_string() + } + Literal::Array(ArrayLiteral::Repeated { repeated_element, length }) => { + let repeated = self.format_sub_expr(*repeated_element); + let length = self.format_sub_expr(*length); + + format!("[{repeated}; {length}]") + } + Literal::Array(ArrayLiteral::Standard(exprs)) => { + rewrite::array(self.fork(), exprs, span) + } + Literal::Unit => "()".to_string(), + }, + ExpressionKind::Parenthesized(mut sub_expr) => { + let remove_nested_parens = self.config.remove_nested_parens; + + let mut leading; + let mut trailing; + + loop { + let leading_span = span.start() + 1..sub_expr.span.start(); + let trailing_span = sub_expr.span.end()..span.end() - 1; + + leading = self.format_comment(leading_span.into()); + trailing = self.format_comment(trailing_span.into()); + + if let ExpressionKind::Parenthesized(ref sub_sub_expr) = sub_expr.kind { + if remove_nested_parens && leading.is_empty() && trailing.is_empty() { + span = sub_expr.span; + sub_expr = sub_sub_expr.clone(); + continue; + } + } + + break; + } + + if !leading.contains("//") && !trailing.contains("//") { + let sub_expr = self.format_sub_expr(*sub_expr); + format!("({leading}{sub_expr}{trailing})") + } else { + let mut visitor = self.fork(); + + let indent = visitor.indent.to_string_with_newline(); + visitor.indent.block_indent(self.config); + let nested_indent = visitor.indent.to_string_with_newline(); + + let sub_expr = visitor.format_sub_expr(*sub_expr); + + let mut result = String::new(); + result.push('('); + + if !leading.is_empty() { + result.push_str(&nested_indent); + result.push_str(&leading); + } + + result.push_str(&nested_indent); + result.push_str(&sub_expr); + + if !trailing.is_empty() { + result.push_str(&nested_indent); + result.push_str(&trailing); + } + + result.push_str(&indent); + result.push(')'); + + result + } + } + ExpressionKind::Constructor(constructor) => { + let type_name = self.slice(span.start()..constructor.type_name.span().end()); + let fields_span = self + .span_before(constructor.type_name.span().end()..span.end(), Token::LeftBrace); + + self.format_struct_lit(type_name, fields_span, *constructor) + } + ExpressionKind::If(if_expr) => { + let allow_single_line = expr_type == ExpressionType::SubExpression; + + if allow_single_line { + let mut visitor = self.fork(); + visitor.indent = Indent::default(); + if let Some(line) = visitor.format_if_single_line(*if_expr.clone()) { + return line; + } + } + + self.format_if(*if_expr) + } + ExpressionKind::Lambda(_) | ExpressionKind::Variable(_) => self.slice(span).to_string(), + ExpressionKind::Error => unreachable!(), + } + } + + fn format_if(&self, if_expr: IfExpression) -> String { + let condition_str = self.format_sub_expr(if_expr.condition); + let consequence_str = self.format_sub_expr(if_expr.consequence); + + let mut result = format!("if {condition_str} {consequence_str}"); + + if let Some(alternative) = if_expr.alternative { + let alternative = if let Some(ExpressionKind::If(if_expr)) = + extract_simple_expr(alternative.clone()).map(|expr| expr.kind) + { + self.format_if(*if_expr) + } else { + self.format_expr(alternative, ExpressionType::Statement) + }; + + result.push_str(" else "); + result.push_str(&alternative); + }; + + result + } + + fn format_if_single_line(&self, if_expr: IfExpression) -> Option { + let condition_str = self.format_sub_expr(if_expr.condition); + let consequence_str = self.format_sub_expr(extract_simple_expr(if_expr.consequence)?); + + let if_str = if let Some(alternative) = if_expr.alternative { + let alternative_str = if let Some(ExpressionKind::If(_)) = + extract_simple_expr(alternative.clone()).map(|expr| expr.kind) + { + return None; + } else { + self.format_expr(extract_simple_expr(alternative)?, ExpressionType::Statement) + }; + + format!("if {} {{ {} }} else {{ {} }}", condition_str, consequence_str, alternative_str) + } else { + format!("if {{{}}} {{{}}}", condition_str, consequence_str) + }; + + (if_str.len() <= self.config.single_line_if_else_max_width).then_some(if_str) + } + + fn format_struct_lit( + &self, + type_name: &str, + fields_span: Span, + constructor: ConstructorExpression, + ) -> String { + let fields = { + let mut visitor = self.fork(); + let is_unit_struct = constructor.fields.is_empty(); + + visitor.indent.block_indent(visitor.config); + + let nested_indent = visitor.shape(); + let exprs: Vec<_> = + utils::Exprs::new(&visitor, fields_span, constructor.fields).collect(); + let exprs = format_exprs( + visitor.config, + Tactic::HorizontalVertical, + false, + exprs, + nested_indent, + ); + + visitor.indent.block_unindent(visitor.config); + + if exprs.contains('\n') { + format!( + "{}{exprs}{}", + nested_indent.indent.to_string_with_newline(), + visitor.shape().indent.to_string_with_newline() + ) + } else if is_unit_struct { + exprs + } else { + format!(" {exprs} ") + } + }; + + format!("{type_name} {{{fields}}}") + } + + pub(crate) fn visit_block(&mut self, block: BlockExpression, block_span: Span) { + if block.is_empty() { + self.visit_empty_block(block_span); + return; + } + + self.last_position = block_span.start() + 1; // `{` + self.push_str("{"); + + self.trim_spaces_after_opening_brace(&block.0); + + self.indent.block_indent(self.config); + + self.visit_stmts(block.0); + + let span = (self.last_position..block_span.end() - 1).into(); + self.close_block(span); + self.last_position = block_span.end(); + } + + fn trim_spaces_after_opening_brace(&mut self, block: &[Statement]) { + if let Some(first_stmt) = block.first() { + let slice = self.slice(self.last_position..first_stmt.span.start()); + let len = + slice.chars().take_while(|ch| ch.is_whitespace()).collect::().rfind('\n'); + self.last_position += len.unwrap_or(0) as u32; + } + } + + pub(crate) fn visit_empty_block(&mut self, block_span: Span) { + let slice = self.slice(block_span); + let comment_str = slice[1..slice.len() - 1].trim(); + + if comment_str.is_empty() { + self.push_str("{}"); + } else { + self.push_str("{"); + self.indent.block_indent(self.config); + self.close_block(block_span); + }; + + self.last_position = block_span.end(); + } + + pub(crate) fn close_block(&mut self, span: Span) { + let slice = self.slice(span); + + for spanned in Lexer::new(slice).skip_comments(false).flatten() { + match spanned.token() { + Token::LineComment(_, _) | Token::BlockComment(_, _) => { + let token_span = spanned.to_span(); + + let offset = token_span.start(); + let sub_slice = &slice[token_span.start() as usize..token_span.end() as usize]; + + let span_in_between = span.start()..span.start() + offset; + let slice_in_between = self.slice(span_in_between); + let comment_on_same_line = !slice_in_between.contains('\n'); + + if comment_on_same_line { + self.push_str(" "); + self.push_str(sub_slice); + } else { + self.push_str(&self.indent.to_string_with_newline()); + self.push_str(sub_slice); + } + } + _ => {} + } + } + + self.indent.block_unindent(self.config); + self.push_str(&self.indent.to_string_with_newline()); + self.push_str("}"); + } +} + +#[allow(clippy::too_many_arguments)] +pub(crate) fn format_seq( + prefix: &str, + suffix: &str, + mut visitor: FmtVisitor, + trailing_comma: bool, + exprs: Vec, + span: Span, + tactic: Tactic, + soft_newline: bool, +) -> String { + visitor.indent.block_indent(visitor.config); + + let nested_indent = visitor.shape(); + let exprs: Vec<_> = utils::Exprs::new(&visitor, span, exprs).collect(); + let exprs = format_exprs(visitor.config, tactic, trailing_comma, exprs, nested_indent); + + visitor.indent.block_unindent(visitor.config); + + wrap_exprs(prefix, suffix, exprs, nested_indent, visitor.shape(), soft_newline) +} + +fn format_brackets( + visitor: FmtVisitor, + trailing_comma: bool, + exprs: Vec, + span: Span, +) -> String { + let array_width = visitor.config.array_width; + format_seq( + "[", + "]", + visitor, + trailing_comma, + exprs, + span, + Tactic::LimitedHorizontalVertical(array_width), + false, + ) +} + +fn format_parens( + max_width: Option, + visitor: FmtVisitor, + trailing_comma: bool, + exprs: Vec, + span: Span, +) -> String { + let tactic = max_width.map(Tactic::LimitedHorizontalVertical).unwrap_or(Tactic::Horizontal); + format_seq("(", ")", visitor, trailing_comma, exprs, span, tactic, false) +} + +fn format_exprs( + config: &Config, + tactic: Tactic, + trailing_comma: bool, + exprs: Vec, + shape: Shape, +) -> String { + let mut result = String::new(); + let indent_str = shape.indent.to_string(); + + let tactic = tactic.definitive(&exprs, config.short_array_element_width_threshold); + let mut exprs = exprs.into_iter().enumerate().peekable(); + let mut line_len = 0; + let mut prev_expr_trailing_comment = false; + + while let Some((index, expr)) = exprs.next() { + let is_first = index == 0; + let separate = exprs.peek().is_some() || trailing_comma; + let separate_len = usize::from(separate); + + match tactic { + DefinitiveTactic::Vertical + if !is_first && !expr.value.is_empty() && !result.is_empty() => + { + result.push('\n'); + result.push_str(&indent_str); + } + DefinitiveTactic::Horizontal if !is_first => { + result.push(' '); + } + DefinitiveTactic::Mixed => { + let total_width = expr.total_width() + separate_len; + + if line_len > 0 && line_len + 1 + total_width > shape.width + || prev_expr_trailing_comment + { + result.push('\n'); + result.push_str(&indent_str); + line_len = 0; + } else if line_len > 0 { + result.push(' '); + line_len += 1; + } + + line_len += total_width; + } + _ => {} + } + + result.push_str(&expr.leading); + + if expr.different_line { + result.push('\n'); + result.push_str(&indent_str); + line_len = expr.value.chars().count(); + } else if !expr.leading.is_empty() { + result.push(' '); + } + + result.push_str(&expr.value); + + if tactic == DefinitiveTactic::Horizontal { + result.push_str(&expr.trailing); + } + + if separate && expr.trailing.find_token(Token::Comma).is_none() { + result.push(','); + } + + if tactic != DefinitiveTactic::Horizontal { + prev_expr_trailing_comment = !expr.trailing.is_empty(); + + if !expr.different_line && !expr.trailing.is_empty() { + result.push(' '); + } + + result.push_str(&expr.trailing); + } + } + + result +} + +pub(crate) fn wrap_exprs( + prefix: &str, + suffix: &str, + exprs: String, + nested_shape: Shape, + shape: Shape, + soft_newline: bool, +) -> String { + let first_line_width = first_line_width(&exprs); + + let force_one_line = + if soft_newline { !exprs.contains('\n') } else { first_line_width <= shape.width }; + + if force_one_line { + let allow_trailing_newline = exprs + .lines() + .last() + .unwrap_or_default() + .find_token_with(|token| matches!(token, Token::LineComment(_, _))) + .is_some(); + + let trailing_newline = if allow_trailing_newline { + shape.indent.to_string_with_newline() + } else { + String::new() + }; + + format!("{prefix}{exprs}{trailing_newline}{suffix}") + } else { + let nested_indent_str = nested_shape.indent.to_string_with_newline(); + let indent_str = shape.indent.to_string_with_newline(); + + format!("{prefix}{nested_indent_str}{exprs}{indent_str}{suffix}") + } +} + +#[derive(PartialEq, Eq, Clone, Copy)] +pub(crate) enum Tactic { + Horizontal, + HorizontalVertical, + LimitedHorizontalVertical(usize), + Mixed, +} + +impl Tactic { + fn definitive( + self, + exprs: &[Expr], + short_array_element_width_threshold: usize, + ) -> DefinitiveTactic { + let tactic = || { + let has_single_line_comment = exprs.iter().any(|item| { + has_single_line_comment(&item.leading) || has_single_line_comment(&item.trailing) + }); + + let limit = match self { + _ if has_single_line_comment => return DefinitiveTactic::Vertical, + + Tactic::Horizontal => return DefinitiveTactic::Horizontal, + Tactic::LimitedHorizontalVertical(limit) => limit, + Tactic::HorizontalVertical | Tactic::Mixed => 100, + }; + + let (sep_count, total_width): (usize, usize) = exprs + .iter() + .map(|expr| expr.total_width()) + .fold((0, 0), |(sep_count, total_width), width| { + (sep_count + 1, total_width + width) + }); + + let total_sep_len = sep_count.saturating_sub(1); + let real_total = total_width + total_sep_len; + + if real_total <= limit && !exprs.iter().any(|expr| expr.is_multiline()) { + DefinitiveTactic::Horizontal + } else if self == Tactic::Mixed { + DefinitiveTactic::Mixed + } else { + DefinitiveTactic::Vertical + } + }; + + tactic().reduce(exprs, short_array_element_width_threshold) + } +} + +#[derive(Debug, PartialEq, Eq, Clone, Copy)] +enum DefinitiveTactic { + Vertical, + Horizontal, + Mixed, +} + +impl DefinitiveTactic { + fn reduce(self, exprs: &[Expr], short_array_element_width_threshold: usize) -> Self { + match self { + DefinitiveTactic::Vertical + if no_long_exprs(exprs, short_array_element_width_threshold) => + { + DefinitiveTactic::Mixed + } + DefinitiveTactic::Vertical | DefinitiveTactic::Horizontal | DefinitiveTactic::Mixed => { + self + } + } + } +} + +fn has_single_line_comment(slice: &str) -> bool { + slice.trim_start().starts_with("//") +} + +fn no_long_exprs(exprs: &[Expr], max_width: usize) -> bool { + exprs.iter().all(|expr| expr.value.len() <= max_width) +} + +fn extract_simple_expr(expr: Expression) -> Option { + if let ExpressionKind::Block(mut block) = expr.kind { + if block.len() == 1 { + if let StatementKind::Expression(expr) = block.pop().unwrap() { + return expr.into(); + } + } + } + + None +} diff --git a/noir/tooling/nargo_fmt/src/visitor/item.rs b/noir/tooling/nargo_fmt/src/visitor/item.rs new file mode 100644 index 00000000000..7774618afea --- /dev/null +++ b/noir/tooling/nargo_fmt/src/visitor/item.rs @@ -0,0 +1,149 @@ +use noirc_frontend::{ + parser::{Item, ItemKind}, + token::Token, + Distinctness, NoirFunction, ParsedModule, Visibility, +}; + +use crate::{utils::last_line_contains_single_line_comment, visitor::expr::format_seq}; + +use super::expr::Tactic::LimitedHorizontalVertical; + +impl super::FmtVisitor<'_> { + fn format_fn_before_block(&self, func: NoirFunction, start: u32) -> (String, bool) { + let tactic = LimitedHorizontalVertical(self.config.max_width); + + let name_span = func.name_ident().span(); + let func_span = func.span(); + + let mut result = self.slice(start..name_span.end()).to_owned(); + + let params_open = + self.span_before(name_span.end()..func_span.start(), Token::LeftParen).start(); + + let last_span = if func.parameters().is_empty() { + params_open..func_span.start() + } else { + func.parameters().last().unwrap().span.end()..func_span.start() + }; + + let params_end = self.span_after(last_span, Token::RightParen).start(); + + let params_span = params_open..params_end; + let return_type_span = func.return_type().span; + let parameters = func.def.parameters; + + if !func.def.generics.is_empty() { + let full_span = name_span.end()..params_open; + let start = name_span.end(); + let end = self.span_after(full_span, Token::Greater).start(); + + let generics = func.def.generics; + let span = (start..end).into(); + let generics = format_seq("<", ">", self.fork(), false, generics, span, tactic, false); + + result.push_str(&generics); + } + + let parameters = if parameters.is_empty() { + self.slice(params_span).into() + } else { + format_seq("(", ")", self.fork(), false, parameters, params_span.into(), tactic, true) + }; + + result.push_str(¶meters); + + if let Some(span) = return_type_span { + result.push_str(" -> "); + + if let Distinctness::Distinct = func.def.return_distinctness { + result.push_str("distinct "); + } + + if let Visibility::Public = func.def.return_visibility { + result.push_str("pub "); + } + + result.push_str(self.slice(span)); + + let slice = self.slice(span.end()..func_span.start()); + if !slice.trim().is_empty() { + result.push_str(slice); + } + } else { + result.push_str(self.slice(params_end..func_span.start())); + } + + let maybe_comment = self.slice(params_end..func_span.start()); + + (result.trim_end().to_string(), last_line_contains_single_line_comment(maybe_comment)) + } + + pub(crate) fn visit_file(&mut self, module: ParsedModule) { + self.visit_module(module); + self.format_missing_indent(self.source.len() as u32, false); + } + + fn visit_module(&mut self, module: ParsedModule) { + for Item { kind, span } in module.items { + match kind { + ItemKind::Function(func) => { + self.format_missing_indent(span.start(), true); + + if std::mem::take(&mut self.ignore_next_node) { + self.push_str(self.slice(span)); + self.last_position = span.end(); + continue; + } + + let (fn_before_block, force_brace_newline) = + self.format_fn_before_block(func.clone(), span.start()); + + self.push_str(&fn_before_block); + self.push_str(if force_brace_newline { "\n" } else { " " }); + + self.visit_block(func.def.body, func.def.span); + } + ItemKind::Submodules(module) => { + self.format_missing_indent(span.start(), true); + + if std::mem::take(&mut self.ignore_next_node) { + self.push_str(self.slice(span)); + self.last_position = span.end(); + continue; + } + + let name = module.name; + let after_brace = self.span_after(span, Token::LeftBrace).start(); + self.last_position = after_brace; + + let keyword = if module.is_contract { "contract" } else { "mod" }; + + self.push_str(&format!("{keyword} {name} ")); + + if module.contents.items.is_empty() { + self.visit_empty_block((after_brace - 1..span.end()).into()); + continue; + } else { + self.push_str("{"); + self.indent.block_indent(self.config); + self.visit_module(module.contents); + } + + self.close_block((self.last_position..span.end() - 1).into()); + self.last_position = span.end(); + } + ItemKind::Import(_) + | ItemKind::Struct(_) + | ItemKind::Trait(_) + | ItemKind::TraitImpl(_) + | ItemKind::Impl(_) + | ItemKind::TypeAlias(_) + | ItemKind::Global(_) + | ItemKind::ModuleDecl(_) => { + self.push_rewrite(self.slice(span).to_string(), span); + self.last_position = span.end(); + } + } + } + } +} diff --git a/noir/tooling/nargo_fmt/src/visitor/stmt.rs b/noir/tooling/nargo_fmt/src/visitor/stmt.rs new file mode 100644 index 00000000000..b6dd67323fa --- /dev/null +++ b/noir/tooling/nargo_fmt/src/visitor/stmt.rs @@ -0,0 +1,84 @@ +use std::iter::zip; + +use noirc_frontend::{ + ConstrainKind, ConstrainStatement, ExpressionKind, ForRange, Statement, StatementKind, +}; + +use super::ExpressionType; + +impl super::FmtVisitor<'_> { + pub(crate) fn visit_stmts(&mut self, stmts: Vec) { + let len = stmts.len(); + + for (Statement { kind, span }, index) in zip(stmts, 1..) { + let is_last = index == len; + + match kind { + StatementKind::Expression(expr) => self.visit_expr( + expr, + if is_last { ExpressionType::SubExpression } else { ExpressionType::Statement }, + ), + StatementKind::Semi(expr) => { + self.visit_expr(expr, ExpressionType::Statement); + self.push_str(";"); + } + StatementKind::Let(let_stmt) => { + let let_str = + self.slice(span.start()..let_stmt.expression.span.start()).trim_end(); + let expr_str = + self.format_expr(let_stmt.expression, ExpressionType::SubExpression); + + self.push_rewrite(format!("{let_str} {expr_str};"), span); + } + StatementKind::Constrain(ConstrainStatement(expr, message, kind)) => { + let message = + message.map_or(String::new(), |message| format!(", \"{message}\"")); + let constrain = match kind { + ConstrainKind::Assert => { + let assertion = self.format_sub_expr(expr); + + format!("assert({assertion}{message});") + } + ConstrainKind::AssertEq => { + if let ExpressionKind::Infix(infix) = expr.kind { + let lhs = self.format_sub_expr(infix.lhs); + let rhs = self.format_sub_expr(infix.rhs); + + format!("assert_eq({lhs}, {rhs}{message});") + } else { + unreachable!() + } + } + ConstrainKind::Constrain => { + let expr = self.format_sub_expr(expr); + format!("constrain {expr};") + } + }; + + self.push_rewrite(constrain, span); + } + StatementKind::For(for_stmt) => { + let identifier = self.slice(for_stmt.identifier.span()); + let range = match for_stmt.range { + ForRange::Range(start, end) => format!( + "{}..{}", + self.format_sub_expr(start), + self.format_sub_expr(end) + ), + ForRange::Array(array) => self.format_sub_expr(array), + }; + let block = self.format_sub_expr(for_stmt.block); + + let result = format!("for {identifier} in {range} {block}"); + self.push_rewrite(result, span); + } + StatementKind::Assign(_) => { + self.push_rewrite(self.slice(span).to_string(), span); + } + StatementKind::Error => unreachable!(), + } + + self.last_position = span.end(); + } + } +} diff --git a/noir/tooling/nargo_fmt/tests/execute.rs b/noir/tooling/nargo_fmt/tests/execute.rs new file mode 100644 index 00000000000..d8802fd926b --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/execute.rs @@ -0,0 +1,5 @@ +#[cfg(test)] +mod tests { + // include tests generated by `build.rs` + include!(concat!(env!("OUT_DIR"), "/execute.rs")); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/add.nr b/noir/tooling/nargo_fmt/tests/expected/add.nr new file mode 100644 index 00000000000..341ed06f3e6 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/add.nr @@ -0,0 +1,7 @@ +fn main(mut x: u32, y: u32, z: u32) { + x += y; + assert(x == z); + + x *= 8; + assert(x > 9); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/array.nr b/noir/tooling/nargo_fmt/tests/expected/array.nr new file mode 100644 index 00000000000..3341afb31a5 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/array.nr @@ -0,0 +1,39 @@ +fn big_array() { + [ + 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000, + 10000000000000000000, + 100000000000000000000, + 1000000000000000000000, + 10000000000000000000000, + 100000000000000000000000, + 1000000000000000000000000 + ]; + + [ + 1, + 10 + ]; + + [ + // hello! + 1, + 10 + ]; + + [ + // hello! + 1, + // asd + 10 + ]; + + [ + // hello! + 1, + // asd + 10 + // asdasd + ]; + + [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/call.nr b/noir/tooling/nargo_fmt/tests/expected/call.nr new file mode 100644 index 00000000000..3c9b36e8403 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/call.nr @@ -0,0 +1,36 @@ +fn foo() { + my_function(10, some_value, another_func(20, 30)); + + outer_function(some_function(), // Original inner function call + another_function() // Original inner function call + ); + + outer_function(some_function(), // Original inner function call + another_function() // Original inner function call + ); + + my_function(// Comment + some_value, + /* Multiline + Comment */ + another_func(20, 30)); + + my_function(some_function(10, "arg1", another_function()), + another_func(20, some_function(), 30)); + + outer_function(some_function(), + another_function(some_function(), some_value)); + + assert_eq(x, y); + + assert_eq(x, y, "message"); + + assert(x); + + assert(x, "message"); + + assert(x == y); + + assert(p4_affine.eq(Gaffine::new(6890855772600357754907169075114257697580319025794532037257385534741338397365, + 4338620300185947561074059802482547481416142213883829469920100239455078257889))); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/cast.nr b/noir/tooling/nargo_fmt/tests/expected/cast.nr new file mode 100644 index 00000000000..63008168f84 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/cast.nr @@ -0,0 +1,3 @@ +fn main() { + x as u8 +} diff --git a/noir/tooling/nargo_fmt/tests/expected/comment.nr b/noir/tooling/nargo_fmt/tests/expected/comment.nr new file mode 100644 index 00000000000..fae425acfd0 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/comment.nr @@ -0,0 +1,27 @@ +fn comment1() { + // +} + +// random comment + +fn comment2() { // Test +} + +fn comment3() // some comment +{} + +fn comment4() +// some comment +{} + +fn comment5() // some comment +{} + +fn comment6() // some comment some comment some comment some comment some comment some comment so +{} + +fn comment7() +// some comment some comment some comment some comment some comment some comment some comment +{} + +fn comment8(/*test*/) {} diff --git a/noir/tooling/nargo_fmt/tests/expected/contract.nr b/noir/tooling/nargo_fmt/tests/expected/contract.nr new file mode 100644 index 00000000000..0d9bd2f100d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/contract.nr @@ -0,0 +1,78 @@ +// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +// Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +// Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +contract Benchmarking { + use dep::value_note::{ + utils::{increment, decrement}, + value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}, + }; + + use dep::aztec::{ + context::{Context}, + note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + selector::compute_selector, + log::emit_unencrypted_log, + state_vars::{map::Map, public_state::PublicState, set::Set}, + types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, + types::address::{AztecAddress}, + }; + + struct Storage { + notes: Map>, + balances: Map>, + } + + impl Storage { + fn init(context: Context) -> pub Self { + Storage { + notes: Map::new(context, 1, |context, slot| { Set::new(context, slot, ValueNoteMethods) }), + balances: Map::new(context, 2, |context, slot| { PublicState::new(context, slot, FieldSerializationMethods) }), + } + } + } + + #[aztec(private)] + fn constructor() {} + + // Nec tincidunt praesent semper feugiat nibh sed pulvinar. Nibh nisl condimentum id venenatis a. + #[aztec(private)] + fn create_note(owner: Field, value: Field) { + increment(storage.notes.at(owner), value, owner); + } + + // Diam quam nulla porttitor massa id. Elit ullamcorper dignissim cras tincidunt lobortis feugiat. + #[aztec(private)] + fn recreate_note(owner: Field, index: u32) { + let owner_notes = storage.notes.at(owner); + let getter_options = NoteGetterOptions::new().set_limit(1).set_offset(index); + let notes = owner_notes.get_notes(getter_options); + let note = notes[0].unwrap_unchecked(); + owner_notes.remove(note); + increment(owner_notes, note.value, owner); + } + + // Ultrices in iaculis nunc sed augue lacus. + #[aztec(public)] + fn increment_balance(owner: Field, value: Field) { + let current = storage.balances.at(owner).read(); + storage.balances.at(owner).write(current + value); + let _callStackItem1 = context.call_public_function(context.this_address(), + compute_selector("broadcast(Field)"), + [owner]); + } + + // Est ultricies integer quis auctor elit sed. In nibh mauris cursus mattis molestie a iaculis. + #[aztec(public)] + fn broadcast(owner: Field) { + emit_unencrypted_log(&mut context, storage.balances.at(owner).read()); + } + + unconstrained fn compute_note_hash_and_nullifier(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] { + let note_header = NoteHeader::new(contract_address, nonce, storage_slot); + note_utils::compute_note_hash_and_nullifier(ValueNoteMethods, note_header, preimage) + } +} + +// Uses the token bridge contract, which tells which input token we need to talk to and handles the exit funds to L1 +contract Uniswap {} diff --git a/noir/tooling/nargo_fmt/tests/expected/empty.nr b/noir/tooling/nargo_fmt/tests/expected/empty.nr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_fmt/tests/expected/expr.nr b/noir/tooling/nargo_fmt/tests/expected/expr.nr new file mode 100644 index 00000000000..03a26835ee3 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/expr.nr @@ -0,0 +1,137 @@ +// Test some empty blocks. +fn qux() { + {} + + { /* a block with a comment */ + } + {} + { + // A block with a comment. + } + + { + { + { + // A block with a comment. + } + } + } +} + +fn foo_return() { + "yay" +} + +fn fooblock() { + { + "inner-block" + } +} + +fn fooblock() { + { + { + { + "inner-block" + } + } + } +} + +fn comment() { + // this is a test comment + 1 +} + +fn only_comment() { + // Keep this here +} + +fn only_comments() { + // Keep this here + // Keep this here +} + +fn only_comments() { + // Keep this here + // Keep this here +} + +fn commnet() { + 1 + // +} + +fn test() { + 34 +} + +fn test() { + // 324 + 34 +} + +fn line() { + 42; // 42 +} + +fn line() { + 42; // 42 + 42; + // hello +} + +fn line() { + 42; // 42 + // 42 + // hello +} + +fn parenthesized() { + value + (x as Field) +} + +fn parenthesized() { + (i as u8) + (j as u8) + (k as u8) + x + y + z +} + +fn parenthesized() { + value + (/*test*/x as Field/*test*/) +} + +fn parenthesized() { + value + ( + // line + x as Field + ) +} + +fn constructor() { + Point { x: 5, y: 10 }; +} + +fn if_expr() { + if true { + println("Hello :D"); + } +} + +fn return_if_expr() { + if true { 42 } else { 40 + 2 } +} + +fn return_if_expr() { + if true { + 42 + }; + + if true { 42 } else { 40 + 2 } +} + +fn if_if() { + if cond { + some(); + } else { + none(); + }.bar().baz(); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/fn.nr b/noir/tooling/nargo_fmt/tests/expected/fn.nr new file mode 100644 index 00000000000..5bca2dd8bb1 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/fn.nr @@ -0,0 +1,33 @@ +fn main(x: pub u8, y: u8) {} + +fn main(x: pub u8, y: u8) -> pub Field {} + +fn main(x: A, y: B) -> pub Field where A: Eq, B: Eq {} + +fn main() +// hello +{} + +fn main( + // hello +) {} + +fn main( + // hello + unit: () +) {} + +fn main() where T: Eq {} + +fn main( + tape: [Field; TAPE_LEN], + initial_registers: [Field; REGISTER_COUNT], + initial_memory: [Field; MEM_COUNT], + initial_program_counter: Field, + initial_call_stack: [Field; MAX_CALL_STACK], + initial_call_stack_pointer: u64 +) -> pub ExecutionResult {} + +fn apply_binary_field_op(lhs: RegisterIndex, rhs: RegisterIndex, result: RegisterIndex, op: u8, registers: &mut Registers) -> bool {} + +fn main() -> distinct pub [Field;2] {} diff --git a/noir/tooling/nargo_fmt/tests/expected/for.nr b/noir/tooling/nargo_fmt/tests/expected/for.nr new file mode 100644 index 00000000000..98dff672bef --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/for.nr @@ -0,0 +1,21 @@ +fn for_stmt() { + for elem in self { + ret &= predicate(elem); + } +} + +fn for_stmt() { + for i in 0..(C1 - 1) { + for _j in 1..(C1 - i - 1) { + b *= b; + } + + z *= if b == 1 { 1 } else { c }; + + c *= c; + + t *= if b == 1 { 1 } else { c }; + + b = t; + } +} diff --git a/noir/tooling/nargo_fmt/tests/expected/global.nr b/noir/tooling/nargo_fmt/tests/expected/global.nr new file mode 100644 index 00000000000..e73cf96ccbe --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/global.nr @@ -0,0 +1,9 @@ +//! Super module :] + +// super global variable +global answer = 42; + +// Super module :] + +// super global variable +global answer = 42; diff --git a/noir/tooling/nargo_fmt/tests/expected/if.nr b/noir/tooling/nargo_fmt/tests/expected/if.nr new file mode 100644 index 00000000000..39ad7d18cdd --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/if.nr @@ -0,0 +1,53 @@ +//@error_on_lost_comment=false +fn main() { + let (x,y) = if is_square(gx1) { + (x1, sqrt(gx1)) + } else { + (x2, sqrt(gx2)) + }; + + let n = if x != y { + if x != 20 { slice.push_back(y) } else { slice } + } else { + slice + }; + + if false { + (); + (); + } + + if false // lone if comment + { + (); + (); + } + + let a = if 0 > 1 { 0 } else { 0 }; + + if true { + (); + } else if false { + (); + (); + } else { + (); + (); + (); + } + + if true // else-if-chain if comment + { + (); + } + else if false // else-if-chain else-if comment + { + (); + (); + } else // else-if-chain else comment + { + (); + (); + (); + } +} diff --git a/noir/tooling/nargo_fmt/tests/expected/ignore.nr b/noir/tooling/nargo_fmt/tests/expected/ignore.nr new file mode 100644 index 00000000000..1c84e178f34 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/ignore.nr @@ -0,0 +1,26 @@ +fn main() { + // noir-fmt:ignore + assert( x != y ); + assert(x != y); + { + // noir-fmt:ignore + }; + assert(x != y); +} +// noir-fmt:ignore +fn main() { +1; +2; +3; +} +// noir-fmt:ignore +mod items { +fn hello() {} +} + +fn mk_array() { + // noir-fmt:ignore + let array = [1, + ]; + let array = [1]; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/index.nr b/noir/tooling/nargo_fmt/tests/expected/index.nr new file mode 100644 index 00000000000..54f2ed2cf39 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/index.nr @@ -0,0 +1,9 @@ +fn foo() { + let arr = [10, 20, 30, 40]; + arr[2]; + arr[2]; + arr[/*test*/ 2]; + arr[2/*test*/]; + arr[// test + 2]; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/infix.nr b/noir/tooling/nargo_fmt/tests/expected/infix.nr new file mode 100644 index 00000000000..cbc73045fe3 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/infix.nr @@ -0,0 +1,18 @@ +//@error_on_lost_comment=false +fn foo() { + 40 + 2; + !40 + 2; + 40 + 2 == 42; + + 40/*test*/ + 2 == 42; + 40 + 2/*test*/ == 42; +} + +fn big() { + assert(bjj_affine.contains(bjj_affine.gen) + & bjj_affine.contains(p1_affine) + & bjj_affine.contains(p2_affine) + & bjj_affine.contains(p3_affine) + & bjj_affine.contains(p4_affine) + & bjj_affine.contains(p5_affine)); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/let.nr b/noir/tooling/nargo_fmt/tests/expected/let.nr new file mode 100644 index 00000000000..b60ae644790 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/let.nr @@ -0,0 +1,54 @@ +//@error_on_lost_comment=false +fn let_() { + let fn_call = my_function(some_function(10, "arg1", another_function()), + another_func(20, some_function(), 30)); + let array = [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; + + let padded_sha256_hash: [u8; 259] = [ + // Padded hash + 209, 50, 135, 178, 4, 155, 190, 229, 228, 111, 61, 174, 8, 49, 48, 116, 90, 226, 77, 7, 111, 27, 19, 113, 154, 48, 138, 136, 138, 15, 230, 132, 32, 4, 0, 5, 1, 2, 4, 3, 101, 1, 72, 134, 96, 9, 6, 13, 48, 49, + 48, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 0, + // Rest is padded with 0s until max bytes + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + + let a = BigUint56 { limbs: [1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }; + + let person = Person { + first_name: "John", + last_name: "Doe", + home_address: Address { street: "123 Main St", city: "Exampleville", zip_code: "12345" } + }; + + let person = Person { + first_name: "John", + last_name: "Doe", + home_address: Address { + street: "123 Main St", + city: "Exampleville", + zip_code: "12345", + master: Person { + first_name: "John", + last_name: "Doe", + home_address: Address { street: "123 Main St", city: "Exampleville", zip_code: "12345" } + } + } + }; + + let expr = Expr { + // A boolean literal (true, false). + kind: ExprKind::Bool(true) + }; + + let expr = Expr { /*A boolean literal (true, false).*/ kind: ExprKind::Bool(true) }; + + let mut V = dep::crate2::MyStruct { Q: x }; + let mut V = dep::crate2::MyStruct {}; + let mut V = dep::crate2::MyStruct {/*test*/}; + let mut V = dep::crate2::MyStruct { + // sad + }; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/literals.nr b/noir/tooling/nargo_fmt/tests/expected/literals.nr new file mode 100644 index 00000000000..5a9a735337f --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/literals.nr @@ -0,0 +1,24 @@ +//@error_on_lost_comment=false +fn main() { + [1, 2, 3, 4, 5]; + + [1; 5]; + + [0xff; 5]; + + [0 as u8; MAX_BYTES]; + + true; + + "hello world"; + + "hell\0\"world"; + + f"i: {i}, j: {j}"; + + (); + + (/*test*/); + + () +} diff --git a/noir/tooling/nargo_fmt/tests/expected/member_access.nr b/noir/tooling/nargo_fmt/tests/expected/member_access.nr new file mode 100644 index 00000000000..2330ec826c7 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/member_access.nr @@ -0,0 +1,15 @@ +struct Address { + city: String, + country: String, +} + +struct Person { + name: String, + age: u8, + address: Address, +} + +fn foo(p: Person) { + p.name; + p.address.country; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/method_call.nr b/noir/tooling/nargo_fmt/tests/expected/method_call.nr new file mode 100644 index 00000000000..c2ee71237f8 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/method_call.nr @@ -0,0 +1,3 @@ +fn foo() { + my_object.some_method(10, var_value, inner_method(20, 30)); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/module.nr b/noir/tooling/nargo_fmt/tests/expected/module.nr new file mode 100644 index 00000000000..e419543dbc4 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/module.nr @@ -0,0 +1,23 @@ +mod a { + mod b { + struct Data { + a: Field + } + } + + fn data(a: Field) -> Data { + Data { a } + } + + fn data2(a: Field) -> Data2 { + Data2 { a } + } + + mod tests { + #[test] + fn test() { + data(1); + data2(1); + } + } +} diff --git a/noir/tooling/nargo_fmt/tests/expected/nested_if_else.nr b/noir/tooling/nargo_fmt/tests/expected/nested_if_else.nr new file mode 100644 index 00000000000..dfd203189e8 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/nested_if_else.nr @@ -0,0 +1,9 @@ +fn nested_if_else() { + if false { + 1 + } else if false { + 2 + } else { + 3 + } +} diff --git a/noir/tooling/nargo_fmt/tests/expected/nested_parens.nr b/noir/tooling/nargo_fmt/tests/expected/nested_parens.nr new file mode 100644 index 00000000000..53eaa63c279 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/nested_parens.nr @@ -0,0 +1,5 @@ +//@remove_nested_parens=false +fn main() { + ((())); + ((((((((())))))))); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/parens.nr b/noir/tooling/nargo_fmt/tests/expected/parens.nr new file mode 100644 index 00000000000..e6c4f91879c --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/parens.nr @@ -0,0 +1,46 @@ +fn main(x: u64, y: pub u64) { + ( + // + 1 + ); + + ( + // a + 1 + // b + ); + + ( + // test + 1 + ); + + ( + // 1 + ( + // 2 + 2 + ) + ); + + (/*a*/( + // test + 1 + )/*b*/); + + ( + // test + 1 + ); + + (/*a*/1); + + (1/*b*/); + + (/*c*/1/*d*/); + + (/*test*/1/*test 2*/); + + (()); + (()); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/print.nr b/noir/tooling/nargo_fmt/tests/expected/print.nr new file mode 100644 index 00000000000..e169f565455 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/print.nr @@ -0,0 +1,5 @@ +use dep::std; + +fn main() { + std::println("Hello world"); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/print2.nr b/noir/tooling/nargo_fmt/tests/expected/print2.nr new file mode 100644 index 00000000000..80284444af8 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/print2.nr @@ -0,0 +1,5 @@ +use dep::std; + +fn main( ) { + std::println("Hello world"); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/read_array.nr b/noir/tooling/nargo_fmt/tests/expected/read_array.nr new file mode 100644 index 00000000000..d2619884b5d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/read_array.nr @@ -0,0 +1,6 @@ +fn read_array(x: [Field; 3]) { + assert(x[0] == 1); + let y = [1, 5, 27]; + + assert(y[x[0]] == 5); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/single_fn.nr b/noir/tooling/nargo_fmt/tests/expected/single_fn.nr new file mode 100644 index 00000000000..b02291fc50d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/single_fn.nr @@ -0,0 +1,3 @@ +fn main() { + // hello +} diff --git a/noir/tooling/nargo_fmt/tests/expected/single_mod.nr b/noir/tooling/nargo_fmt/tests/expected/single_mod.nr new file mode 100644 index 00000000000..3c04a12d34b --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/single_mod.nr @@ -0,0 +1 @@ +mod hello {} diff --git a/noir/tooling/nargo_fmt/tests/expected/struct.nr b/noir/tooling/nargo_fmt/tests/expected/struct.nr new file mode 100644 index 00000000000..cf1795892d2 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/struct.nr @@ -0,0 +1,73 @@ +struct Foo { + bar: Field, + array: [Field; 2], +} + +struct Pair { + first: Foo, + second: Field, +} + +impl Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: 0, array: [x,y] } + } +} + +impl Pair { + fn foo(p: Self) -> Foo { + p.first + } + + fn bar(self) -> Field { + self.foo().bar + } +} + +struct Nested { + a: Field, + b: Field +} +struct MyStruct { + my_bool: bool, + my_int: u32, + my_nest: Nested, +} +fn test_struct_in_tuple(a_bool: bool, x: Field, y: Field) -> (MyStruct, bool) { + let my_struct = MyStruct { my_bool: a_bool, my_int: 5, my_nest: Nested { a: x, b: y } }; + (my_struct, a_bool) +} + +struct Animal { + legs: Field, + eyes: u8, +} + +fn get_dog() -> Animal { + let dog = Animal { legs: 4, eyes: 2 }; + dog +} + +fn main(x: Field, y: Field) { + let first = Foo::default(x, y); + let p = Pair { first, second: 1 }; + + assert(p.bar() == x); + assert(p.second == y); + assert(p.first.array[0] != p.first.array[1]); + + // Nested structs + let (struct_from_tuple, a_bool) = test_struct_in_tuple(true, x, y); + assert(struct_from_tuple.my_bool == true); + assert(a_bool == true); + assert(struct_from_tuple.my_int == 5); + assert(struct_from_tuple.my_nest.a == 0); + + // Regression test for issue #670 + let Animal { legs, eyes } = get_dog(); + let six = legs + eyes as Field; + + assert(six == 6); + + let Animal { legs: _, eyes: _ } = get_dog(); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/submodule.nr b/noir/tooling/nargo_fmt/tests/expected/submodule.nr new file mode 100644 index 00000000000..88e005b7ac2 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/submodule.nr @@ -0,0 +1,30 @@ +mod a { + // hello +} + +mod a { + // hello + mod b { + // hello + } +} + +mod a { + mod b { + mod c {} + } +} + +mod a { + // 1 + // 2 + // 3 + /*test*/ +} + +mod a { + /**/ + mod b { + mod c {} + } +} diff --git a/noir/tooling/nargo_fmt/tests/expected/tuple.nr b/noir/tooling/nargo_fmt/tests/expected/tuple.nr new file mode 100644 index 00000000000..c3b32904f15 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/tuple.nr @@ -0,0 +1,32 @@ +fn main() { + (1,); + (// hello + 1,); + (/*hello*/ 1,); + (1/*hello*/,); + (1,); + (/*test*/ 1,); + (/*a*/ 1/*b*/,); + (/*a*/ 1/*b*/, /*c*/ 2/*d*/, /*c*/ 2/*d*/); + (/*a*/ 1/*b*/, /*c*/ 2/*d*/, /*c*/ 2/*d*/, /*e*/ 3/*f*/); + + (1/*1*/, 2/* 2*/); + + (1/*test*/,); + + (// + 1,); + + (// 1 + 1, // 2, + 2); + + (/*1*/ 1, /*2*/ 2); + + // FIXME: + (((//2 + 1,),),); + (/*a*/ + 1/*b*/, +/*c*/ 2/*d*/, /*c*/ 2/*d*/, /*e*/ 3/*f*/); +} diff --git a/noir/tooling/nargo_fmt/tests/expected/unary_operators.nr b/noir/tooling/nargo_fmt/tests/expected/unary_operators.nr new file mode 100644 index 00000000000..ffea1713c06 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/unary_operators.nr @@ -0,0 +1,10 @@ +//@error_on_lost_comment=false +fn main() { + -1; + -/*test*/1; + -/*test*/1; + + &mut 1; + *v; + ***v; +} diff --git a/noir/tooling/nargo_fmt/tests/expected/vec.nr b/noir/tooling/nargo_fmt/tests/expected/vec.nr new file mode 100644 index 00000000000..1c9a791961e --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/expected/vec.nr @@ -0,0 +1,60 @@ +struct Vec { + slice: [T] +} + +// A mutable vector type implemented as a wrapper around immutable slices. +// A separate type is technically not needed but helps differentiate which operations are mutable. +impl Vec { + pub fn new() -> Self { + Self { slice: [] } + } + + // Create a Vec containing each element from the given slice. + // Mutations to the resulting Vec will not affect the original slice. + pub fn from_slice(slice: [T]) -> Self { + Self { slice } + } + + /// Get an element from the vector at the given index. + /// Panics if the given index + /// points beyond the end of the vector. + pub fn get(self, index: Field) -> T { + self.slice[index] + } + + /// Push a new element to the end of the vector, returning a + /// new vector with a length one greater than the + /// original unmodified vector. + pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); + } + + /// Pop an element from the end of the given vector, returning + /// a new vector with a length of one less than the given vector, + /// as well as the popped element. + /// Panics if the given vector's length is zero. + pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem + } + + /// Insert an element at a specified index, shifting all elements + /// after it to the right + pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); + } + + /// Remove an element at a specified index, shifting all elements + /// after it to the left, returning the removed element + pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem + } + + /// Returns the number of elements in the vector + pub fn len(self) -> Field { + self.slice.len() + } +} diff --git a/noir/tooling/nargo_fmt/tests/input/add.nr b/noir/tooling/nargo_fmt/tests/input/add.nr new file mode 100644 index 00000000000..6f2892942c1 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/add.nr @@ -0,0 +1,7 @@ +fn main(mut x: u32, y: u32, z: u32) { + x += y; + assert(x == z); + + x *= 8; + assert(x>9); +} diff --git a/noir/tooling/nargo_fmt/tests/input/array.nr b/noir/tooling/nargo_fmt/tests/input/array.nr new file mode 100644 index 00000000000..73651ef76bd --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/array.nr @@ -0,0 +1,39 @@ +fn big_array() { + [ + 1,10,100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000, + 10000000000000000000, + 100000000000000000000, + 1000000000000000000000, + 10000000000000000000000, + 100000000000000000000000, + 1000000000000000000000000, + ]; + + [ + 1, + 10, + ]; + + [ +// hello! +1, +10, + ]; + + [ +// hello! +1, +// asd +10, + ]; + + [ +// hello! +1, +// asd +10, +// asdasd + ]; + + [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; +} diff --git a/noir/tooling/nargo_fmt/tests/input/call.nr b/noir/tooling/nargo_fmt/tests/input/call.nr new file mode 100644 index 00000000000..2e9a612e6d8 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/call.nr @@ -0,0 +1,47 @@ +fn foo() { + my_function( 10,some_value,another_func( 20 , 30) ); + + outer_function(some_function(), // Original inner function call + another_function(), // Original inner function call + ); + + outer_function( + + + some_function(), // Original inner function call + another_function(), // Original inner function call + ); + + my_function( + // Comment + some_value, + /* Multiline + Comment */ + another_func( 20, 30 ) + ); + + my_function( + some_function( 10, "arg1", another_function() ), + another_func (20, some_function() , 30 ) + ); + + outer_function( + some_function(), + + + another_function( + some_function(), some_value) + ); + + assert_eq( x, y ); + + assert_eq( x, y, "message" ); + + assert( x ); + + assert( x, "message" ); + + assert( x == y ); + + assert(p4_affine.eq(Gaffine::new(6890855772600357754907169075114257697580319025794532037257385534741338397365, 4338620300185947561074059802482547481416142213883829469920100239455078257889))); +} diff --git a/noir/tooling/nargo_fmt/tests/input/cast.nr b/noir/tooling/nargo_fmt/tests/input/cast.nr new file mode 100644 index 00000000000..dfbb370e2bb --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/cast.nr @@ -0,0 +1,4 @@ +fn main() { + +x as u8 +} diff --git a/noir/tooling/nargo_fmt/tests/input/comment.nr b/noir/tooling/nargo_fmt/tests/input/comment.nr new file mode 100644 index 00000000000..0e203a82d66 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/comment.nr @@ -0,0 +1,32 @@ +fn comment1() { + // +} + +// random comment + +fn comment2() { // Test +} + +fn comment3() // some comment +{ +} + +fn comment4() +// some comment +{ +} + +fn comment5() // some comment +{ +} + +fn comment6() // some comment some comment some comment some comment some comment some comment so +{ +} + +fn comment7() +// some comment some comment some comment some comment some comment some comment some comment +{ +} + +fn comment8(/*test*/) {} diff --git a/noir/tooling/nargo_fmt/tests/input/contract.nr b/noir/tooling/nargo_fmt/tests/input/contract.nr new file mode 100644 index 00000000000..6bc5c552110 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/contract.nr @@ -0,0 +1,76 @@ +// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +// Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +// Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +// Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +contract Benchmarking { + use dep::value_note::{ + utils::{increment, decrement}, + value_note::{VALUE_NOTE_LEN, ValueNote, ValueNoteMethods}, + }; + + use dep::aztec::{ + context::{Context}, + note::{utils as note_utils, note_getter_options::NoteGetterOptions, note_header::NoteHeader}, + selector::compute_selector, + log::emit_unencrypted_log, + state_vars::{map::Map, public_state::PublicState, set::Set}, + types::type_serialization::field_serialization::{FieldSerializationMethods, FIELD_SERIALIZED_LEN}, + types::address::{AztecAddress}, + }; + + struct Storage { + notes: Map>, + balances: Map>, + } + + impl Storage { + fn init(context: Context) -> pub Self { + Storage { + notes: Map::new(context, 1, |context, slot| { Set::new(context, slot, ValueNoteMethods) }), + balances: Map::new(context, 2, |context, slot| { PublicState::new(context, slot, FieldSerializationMethods) }), + } + } + } + + #[aztec(private)] + fn constructor() {} + + // Nec tincidunt praesent semper feugiat nibh sed pulvinar. Nibh nisl condimentum id venenatis a. + #[aztec(private)] + fn create_note(owner: Field, value: Field) { + increment(storage.notes.at(owner), value, owner); + } + + // Diam quam nulla porttitor massa id. Elit ullamcorper dignissim cras tincidunt lobortis feugiat. + #[aztec(private)] + fn recreate_note(owner: Field, index: u32) { + let owner_notes = storage.notes.at(owner); + let getter_options = NoteGetterOptions::new().set_limit(1).set_offset(index); + let notes = owner_notes.get_notes(getter_options); + let note = notes[0].unwrap_unchecked(); + owner_notes.remove(note); + increment(owner_notes, note.value, owner); + } + + // Ultrices in iaculis nunc sed augue lacus. + #[aztec(public)] + fn increment_balance(owner: Field, value: Field) { + let current = storage.balances.at(owner).read(); + storage.balances.at(owner).write(current + value); + let _callStackItem1 = context.call_public_function(context.this_address(), compute_selector("broadcast(Field)"), [owner]); + } + + // Est ultricies integer quis auctor elit sed. In nibh mauris cursus mattis molestie a iaculis. + #[aztec(public)] + fn broadcast(owner: Field) { + emit_unencrypted_log(&mut context, storage.balances.at(owner).read()); + } + + unconstrained fn compute_note_hash_and_nullifier(contract_address: Field, nonce: Field, storage_slot: Field, preimage: [Field; VALUE_NOTE_LEN]) -> [Field; 4] { + let note_header = NoteHeader::new(contract_address, nonce, storage_slot); + note_utils::compute_note_hash_and_nullifier(ValueNoteMethods, note_header, preimage) + } +} + +// Uses the token bridge contract, which tells which input token we need to talk to and handles the exit funds to L1 +contract Uniswap {} diff --git a/noir/tooling/nargo_fmt/tests/input/empty.nr b/noir/tooling/nargo_fmt/tests/input/empty.nr new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/nargo_fmt/tests/input/expr.nr b/noir/tooling/nargo_fmt/tests/input/expr.nr new file mode 100644 index 00000000000..b4edcbbed5f --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/expr.nr @@ -0,0 +1,153 @@ +// Test some empty blocks. +fn qux() { + {} + + { /* a block with a comment */ } + { + + } + { + // A block with a comment. + } + + { + { + { + // A block with a comment. + } + } + } +} + +fn foo_return() { + "yay" +} + +fn fooblock() { + { + "inner-block" + } +} + +fn fooblock() { + { + { + { + "inner-block" + } + } + } +} + +fn comment() { + // this is a test comment + 1 +} + +fn only_comment() { + // Keep this here +} + +fn only_comments() { +// Keep this here +// Keep this here +} + +fn only_comments() { + // Keep this here + // Keep this here +} + +fn commnet() { + 1 + // +} + +fn test() { + + + + + + 34 +} + +fn test() { + + + + + // 324 + 34 +} + +fn line() { + 42; // 42 +} + + +fn line() { + 42;// 42 + 42; +// hello +} + + +fn line() { + 42;// 42 + // 42 +// hello +} + +fn parenthesized() { + value + ( x as Field ) +} + +fn parenthesized() { + ( i as u8 ) + ( j as u8 ) + ( k as u8 ) + x + y + z +} + +fn parenthesized() { + value + ( /*test*/x as Field /*test*/ ) +} + +fn parenthesized() { + value + ( +// line + x as Field + ) +} + +fn constructor() { + Point{x :5, + y: 10 }; +} + +fn if_expr() { + if true { println("Hello :D"); } +} + +fn return_if_expr() { + if true { +42 +} +else +{ 40 + 2 } +} + +fn return_if_expr() { + if true {42}; + + if true { + 42 + } + else { + 40 + + 2 } +} + +fn if_if() { +if cond { some(); } else { none(); } + .bar() + .baz(); +} \ No newline at end of file diff --git a/noir/tooling/nargo_fmt/tests/input/fn.nr b/noir/tooling/nargo_fmt/tests/input/fn.nr new file mode 100644 index 00000000000..f503db99853 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/fn.nr @@ -0,0 +1,26 @@ +fn main(x: pub u8, y: u8) {} + +fn main(x: pub u8, y: u8) -> pub Field {} + +fn main(x: A, y: B) -> pub Field where A: Eq, B: Eq {} + +fn main() +// hello +{} + +fn main( + // hello +) {} + +fn main( + // hello + unit: () +) {} + +fn main() where T: Eq {} + +fn main(tape: [Field; TAPE_LEN], initial_registers: [Field; REGISTER_COUNT], initial_memory: [Field; MEM_COUNT], initial_program_counter: Field, initial_call_stack: [Field; MAX_CALL_STACK], initial_call_stack_pointer: u64) -> pub ExecutionResult {} + +fn apply_binary_field_op(lhs: RegisterIndex, rhs: RegisterIndex, result: RegisterIndex, op: u8, registers: &mut Registers) -> bool {} + +fn main() -> distinct pub [Field;2] {} diff --git a/noir/tooling/nargo_fmt/tests/input/for.nr b/noir/tooling/nargo_fmt/tests/input/for.nr new file mode 100644 index 00000000000..99b796df820 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/for.nr @@ -0,0 +1,24 @@ +fn for_stmt() { + for elem in self { + ret &= predicate(elem); + } +} + +fn for_stmt() { + for i in 0..(C1-1) { + + for _j in 1..(C1-i-1) { + + b *= b; + + } + + z *= if b == 1 { 1 } else { c }; + + c *= c; + + t *= if b == 1 { 1 } else { c }; + + b = t; + } +} diff --git a/noir/tooling/nargo_fmt/tests/input/global.nr b/noir/tooling/nargo_fmt/tests/input/global.nr new file mode 100644 index 00000000000..bf023c61805 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/global.nr @@ -0,0 +1,17 @@ +//! Super module :] + +// super global variable +global answer = 42; + +// Super module :] + + + + + + + + + +// super global variable +global answer = 42; diff --git a/noir/tooling/nargo_fmt/tests/input/if.nr b/noir/tooling/nargo_fmt/tests/input/if.nr new file mode 100644 index 00000000000..be72eb79a18 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/if.nr @@ -0,0 +1,57 @@ +//@error_on_lost_comment=false +fn main() { + let (x,y) = if is_square(gx1) {(x1, sqrt(gx1))} else {(x2, sqrt(gx2))}; + + let n = if x != y { if x != 20 { slice.push_back(y) } else { slice } } else { slice }; + + if false + { + (); + (); + } + + if false // lone if comment + { + (); + (); + } + + + let a = + if 0 > 1 { + 0 + } + else + { + 0 + }; + + + if true + { + (); + } else if false { + (); + (); + } + else { + (); + (); + (); + } + + if true // else-if-chain if comment + { + (); + } + else if false // else-if-chain else-if comment + { + (); + (); + } else // else-if-chain else comment + { + (); + (); + (); + } +} diff --git a/noir/tooling/nargo_fmt/tests/input/ignore.nr b/noir/tooling/nargo_fmt/tests/input/ignore.nr new file mode 100644 index 00000000000..e095d2e9f1f --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/ignore.nr @@ -0,0 +1,27 @@ +fn main() { + // noir-fmt:ignore + assert( x != y ); + assert( x != y ); + { + // noir-fmt:ignore + }; + assert( x != y ); +} +// noir-fmt:ignore +fn main() { +1; +2; +3; +} +// noir-fmt:ignore +mod items { +fn hello() {} +} + +fn mk_array() { + // noir-fmt:ignore + let array = [1, + ]; + let array = [1, + ]; +} diff --git a/noir/tooling/nargo_fmt/tests/input/index.nr b/noir/tooling/nargo_fmt/tests/input/index.nr new file mode 100644 index 00000000000..7d10e897b8d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/index.nr @@ -0,0 +1,10 @@ +fn foo() { + let arr = [10, 20, 30, 40]; + arr [2]; + arr [2]; + arr [/*test*/2]; + arr [2/*test*/]; + arr [ + // test + 2]; +} \ No newline at end of file diff --git a/noir/tooling/nargo_fmt/tests/input/infix.nr b/noir/tooling/nargo_fmt/tests/input/infix.nr new file mode 100644 index 00000000000..059e58c6b64 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/infix.nr @@ -0,0 +1,13 @@ +//@error_on_lost_comment=false +fn foo() { + 40 + 2; + !40+2; + 40 + 2 == 42; + +40/*test*/ + 2 == 42; + 40 + 2/*test*/ == 42; +} + +fn big() { + assert(bjj_affine.contains(bjj_affine.gen) & bjj_affine.contains(p1_affine) & bjj_affine.contains(p2_affine) & bjj_affine.contains(p3_affine) & bjj_affine.contains(p4_affine) & bjj_affine.contains(p5_affine)); +} diff --git a/noir/tooling/nargo_fmt/tests/input/let.nr b/noir/tooling/nargo_fmt/tests/input/let.nr new file mode 100644 index 00000000000..67c4ab8bd52 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/let.nr @@ -0,0 +1,35 @@ +//@error_on_lost_comment=false +fn let_() { + let fn_call = my_function(some_function( 10, "arg1", another_function() ),another_func (20, some_function() , 30 )); + let array = [[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]], [[13, 14, 15], [16, 17, 18]]]; + + let padded_sha256_hash: [u8; 259] = [ + // Padded hash + 209, 50, 135, 178, 4, 155, 190, 229, 228, 111, 61, 174, 8, 49, 48, 116, 90, 226, 77, 7, 111, 27, 19, 113, 154, 48, 138, 136, 138, 15, 230, 132, 32, 4, 0, 5, 1, 2, 4, 3, 101, 1, 72, 134, 96, 9, 6, 13, 48, 49, + 48, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 0, + // Rest is padded with 0s until max bytes + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]; + + let a = BigUint56 {limbs:[1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}; + + let person = Person { first_name: "John", last_name: "Doe", home_address: Address { street: "123 Main St", city: "Exampleville", zip_code: "12345" } }; + + let person = Person { first_name: "John", last_name: "Doe", home_address: Address { street: "123 Main St", city: "Exampleville", zip_code: "12345", master: Person { first_name: "John", last_name: "Doe", home_address: Address { street: "123 Main St", city: "Exampleville", zip_code: "12345" } } } }; + + let expr = Expr {// A boolean literal (true, false). +kind: ExprKind::Bool(true), + }; + + let expr = Expr {/*A boolean literal (true, false).*/kind: ExprKind::Bool(true),}; + + let mut V = dep::crate2::MyStruct { Q: x }; + let mut V = dep::crate2::MyStruct {}; + let mut V = dep::crate2::MyStruct {/*test*/}; + let mut V = dep::crate2::MyStruct { + // sad + }; +} diff --git a/noir/tooling/nargo_fmt/tests/input/literals.nr b/noir/tooling/nargo_fmt/tests/input/literals.nr new file mode 100644 index 00000000000..fbdc7676845 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/literals.nr @@ -0,0 +1,25 @@ +//@error_on_lost_comment=false +fn main() { + [1,2,3,4,5]; + + + [1;5]; + + [0xff;5]; + + [0 as u8; MAX_BYTES]; + + true; + + "hello world"; + + "hell\0\"world"; + + f"i: {i}, j: {j}"; + + ( ); + + (/*test*/); + + () +} diff --git a/noir/tooling/nargo_fmt/tests/input/member_access.nr b/noir/tooling/nargo_fmt/tests/input/member_access.nr new file mode 100644 index 00000000000..abcab671836 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/member_access.nr @@ -0,0 +1,15 @@ +struct Address { + city: String, + country: String, +} + +struct Person { + name: String, + age: u8, + address: Address, +} + +fn foo(p: Person) { + p . name; + p.address . country; +} diff --git a/noir/tooling/nargo_fmt/tests/input/method_call.nr b/noir/tooling/nargo_fmt/tests/input/method_call.nr new file mode 100644 index 00000000000..175647b4650 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/method_call.nr @@ -0,0 +1,3 @@ +fn foo() { + my_object . some_method( 10,var_value,inner_method( 20 , 30) ); +} diff --git a/noir/tooling/nargo_fmt/tests/input/module.nr b/noir/tooling/nargo_fmt/tests/input/module.nr new file mode 100644 index 00000000000..e419543dbc4 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/module.nr @@ -0,0 +1,23 @@ +mod a { + mod b { + struct Data { + a: Field + } + } + + fn data(a: Field) -> Data { + Data { a } + } + + fn data2(a: Field) -> Data2 { + Data2 { a } + } + + mod tests { + #[test] + fn test() { + data(1); + data2(1); + } + } +} diff --git a/noir/tooling/nargo_fmt/tests/input/nested_if_else.nr b/noir/tooling/nargo_fmt/tests/input/nested_if_else.nr new file mode 100644 index 00000000000..8aa120e3b18 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/nested_if_else.nr @@ -0,0 +1,3 @@ +fn nested_if_else() { + if false { 1 } else if false { 2 } else { 3 } +} diff --git a/noir/tooling/nargo_fmt/tests/input/nested_parens.nr b/noir/tooling/nargo_fmt/tests/input/nested_parens.nr new file mode 100644 index 00000000000..53eaa63c279 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/nested_parens.nr @@ -0,0 +1,5 @@ +//@remove_nested_parens=false +fn main() { + ((())); + ((((((((())))))))); +} diff --git a/noir/tooling/nargo_fmt/tests/input/parens.nr b/noir/tooling/nargo_fmt/tests/input/parens.nr new file mode 100644 index 00000000000..769b477a34d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/parens.nr @@ -0,0 +1,53 @@ +fn main(x : u64, y : pub u64) { + ( +// +1 + ); + +( +// a +1 +// b +); + +( +// test + 1 + ); + + ( +// 1 +( +// 2 + 2 +) +); + + ( + + /*a*/ + + ( + + // test + 1 + ) + /*b*/ +); + + ( + // test + 1 + ); + + ( /*a*/ 1 ); + + ( 1 /*b*/ ); + + ( /*c*/ 1 /*d*/ ); + + ( /*test*/ 1 /*test 2*/ ); + + ((())); + (((((((((((((((()))))))))))))))); +} diff --git a/noir/tooling/nargo_fmt/tests/input/print.nr b/noir/tooling/nargo_fmt/tests/input/print.nr new file mode 100644 index 00000000000..8afa562dada --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/print.nr @@ -0,0 +1,3 @@ +use dep::std; + +fn main() { std::println("Hello world"); } diff --git a/noir/tooling/nargo_fmt/tests/input/print2.nr b/noir/tooling/nargo_fmt/tests/input/print2.nr new file mode 100644 index 00000000000..07ef9dd0386 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/print2.nr @@ -0,0 +1,5 @@ +use dep::std; + +fn main( ) { +std::println("Hello world"); +} diff --git a/noir/tooling/nargo_fmt/tests/input/read_array.nr b/noir/tooling/nargo_fmt/tests/input/read_array.nr new file mode 100644 index 00000000000..d2619884b5d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/read_array.nr @@ -0,0 +1,6 @@ +fn read_array(x: [Field; 3]) { + assert(x[0] == 1); + let y = [1, 5, 27]; + + assert(y[x[0]] == 5); +} diff --git a/noir/tooling/nargo_fmt/tests/input/single_fn.nr b/noir/tooling/nargo_fmt/tests/input/single_fn.nr new file mode 100644 index 00000000000..c7ee3bbd3aa --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/single_fn.nr @@ -0,0 +1,3 @@ +fn main() { + // hello +} \ No newline at end of file diff --git a/noir/tooling/nargo_fmt/tests/input/single_mod.nr b/noir/tooling/nargo_fmt/tests/input/single_mod.nr new file mode 100644 index 00000000000..f02dbfb5464 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/single_mod.nr @@ -0,0 +1 @@ +mod hello {} \ No newline at end of file diff --git a/noir/tooling/nargo_fmt/tests/input/struct.nr b/noir/tooling/nargo_fmt/tests/input/struct.nr new file mode 100644 index 00000000000..5e3530e8364 --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/struct.nr @@ -0,0 +1,77 @@ +struct Foo { + bar: Field, + array: [Field; 2], +} + +struct Pair { + first: Foo, + second: Field, +} + +impl Foo { + fn default(x: Field,y: Field) -> Self { + Self { bar: 0, array: [x,y] } + } +} + +impl Pair { + fn foo(p: Self) -> Foo { + p.first + } + + fn bar(self) -> Field { + self.foo().bar + } +} + +struct Nested { + a: Field, + b: Field +} +struct MyStruct { + my_bool: bool, + my_int: u32, + my_nest: Nested, +} +fn test_struct_in_tuple(a_bool : bool,x:Field, y:Field) -> (MyStruct, bool) { + let my_struct = MyStruct { + my_bool: a_bool, + my_int: 5, + my_nest: Nested{a:x,b:y}, + }; + (my_struct, a_bool) +} + +struct Animal { + legs: Field, + eyes: u8, +} + +fn get_dog() -> Animal { + let dog = Animal { legs: 4, eyes: 2 }; + dog +} + +fn main(x: Field, y: Field) { + let first = Foo::default(x,y); + let p = Pair { first, second: 1 }; + + assert(p.bar() == x); + assert(p.second == y); + assert(p.first.array[0] != p.first.array[1]); + + // Nested structs + let (struct_from_tuple, a_bool) = test_struct_in_tuple(true,x,y); + assert(struct_from_tuple.my_bool == true); + assert(a_bool == true); + assert(struct_from_tuple.my_int == 5); + assert(struct_from_tuple.my_nest.a == 0); + + // Regression test for issue #670 + let Animal { legs, eyes } = get_dog(); + let six = legs + eyes as Field; + + assert(six == 6); + + let Animal { legs: _, eyes: _ } = get_dog(); +} diff --git a/noir/tooling/nargo_fmt/tests/input/submodule.nr b/noir/tooling/nargo_fmt/tests/input/submodule.nr new file mode 100644 index 00000000000..d5b162fd28d --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/submodule.nr @@ -0,0 +1,25 @@ +mod a { +// hello +} + +mod a { +// hello + mod b { +// hello + } +} + +mod a {mod b {mod c {}}} + +mod a { +// 1 +// 2 +// 3 +/*test*/ +} + +mod a { + /**/ mod b { + mod c {} + } +} diff --git a/noir/tooling/nargo_fmt/tests/input/tuple.nr b/noir/tooling/nargo_fmt/tests/input/tuple.nr new file mode 100644 index 00000000000..da3b6ed597b --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/tuple.nr @@ -0,0 +1,48 @@ +fn main() { +(1,); +( +// hello +1,); +(/*hello*/1,); +(1,/*hello*/); + ( 1, ); +( /*test*/1, ); +( /*a*/1/*b*/, ); +( /*a*/1/*b*/, /*c*/2/*d*/, /*c*/2/*d*/ ); +( /*a*/1/*b*/, /*c*/2/*d*/, /*c*/2/*d*/, /*e*/3/*f*/ ); + +( 1 /*1*/ , 2 /* 2*/ ); + + + + +( 1, /*test*/ ); + + ( +// +1, +); + +( +// 1 +1, +// 2, +2, +); + +(/*1*/1, /*2*/2); + +// FIXME: +((( +//2 +1,),),); +( + /*a*/ + 1 + /*b*/, +/*c*/ +2/*d*/, +/*c*/2/*d*/, +/*e*/3/*f*/ +); +} diff --git a/noir/tooling/nargo_fmt/tests/input/unary_operators.nr b/noir/tooling/nargo_fmt/tests/input/unary_operators.nr new file mode 100644 index 00000000000..4324b8045cc --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/unary_operators.nr @@ -0,0 +1,10 @@ +//@error_on_lost_comment=false +fn main() { + -1; +-/*test*/1; + -/*test*/1; + + & mut 1; + * v; + * * * v; +} \ No newline at end of file diff --git a/noir/tooling/nargo_fmt/tests/input/vec.nr b/noir/tooling/nargo_fmt/tests/input/vec.nr new file mode 100644 index 00000000000..1c9a791961e --- /dev/null +++ b/noir/tooling/nargo_fmt/tests/input/vec.nr @@ -0,0 +1,60 @@ +struct Vec { + slice: [T] +} + +// A mutable vector type implemented as a wrapper around immutable slices. +// A separate type is technically not needed but helps differentiate which operations are mutable. +impl Vec { + pub fn new() -> Self { + Self { slice: [] } + } + + // Create a Vec containing each element from the given slice. + // Mutations to the resulting Vec will not affect the original slice. + pub fn from_slice(slice: [T]) -> Self { + Self { slice } + } + + /// Get an element from the vector at the given index. + /// Panics if the given index + /// points beyond the end of the vector. + pub fn get(self, index: Field) -> T { + self.slice[index] + } + + /// Push a new element to the end of the vector, returning a + /// new vector with a length one greater than the + /// original unmodified vector. + pub fn push(&mut self, elem: T) { + self.slice = self.slice.push_back(elem); + } + + /// Pop an element from the end of the given vector, returning + /// a new vector with a length of one less than the given vector, + /// as well as the popped element. + /// Panics if the given vector's length is zero. + pub fn pop(&mut self) -> T { + let (popped_slice, last_elem) = self.slice.pop_back(); + self.slice = popped_slice; + last_elem + } + + /// Insert an element at a specified index, shifting all elements + /// after it to the right + pub fn insert(&mut self, index: Field, elem: T) { + self.slice = self.slice.insert(index, elem); + } + + /// Remove an element at a specified index, shifting all elements + /// after it to the left, returning the removed element + pub fn remove(&mut self, index: Field) -> T { + let (new_slice, elem) = self.slice.remove(index); + self.slice = new_slice; + elem + } + + /// Returns the number of elements in the vector + pub fn len(self) -> Field { + self.slice.len() + } +} diff --git a/noir/tooling/nargo_toml/Cargo.toml b/noir/tooling/nargo_toml/Cargo.toml new file mode 100644 index 00000000000..c835ddd936c --- /dev/null +++ b/noir/tooling/nargo_toml/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "nargo_toml" +description = "Utilities for working with Nargo.toml files" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +dirs.workspace = true +fm.workspace = true +nargo.workspace = true +noirc_frontend.workspace = true +serde.workspace = true +thiserror.workspace = true +toml.workspace = true +url.workspace = true +semver = "1.0.20" + +[dev-dependencies] diff --git a/noir/tooling/nargo_toml/src/errors.rs b/noir/tooling/nargo_toml/src/errors.rs new file mode 100644 index 00000000000..fdbdc317bf9 --- /dev/null +++ b/noir/tooling/nargo_toml/src/errors.rs @@ -0,0 +1,84 @@ +use std::path::PathBuf; + +use nargo::package::PackageType; +use noirc_frontend::graph::CrateName; +use thiserror::Error; + +/// Errors covering situations where a package is either missing, malformed or does not pass semver +/// validation checks. +#[derive(Debug, Error)] +pub enum ManifestError { + /// Package doesn't have a manifest file + #[error("cannot find a Nargo.toml for {0}")] + MissingFile(PathBuf), + + #[error("Cannot read file {0} - does it exist?")] + ReadFailed(PathBuf), + + #[error("Nargo.toml is missing a parent directory")] + MissingParent, + + #[error("Missing `type` field in {0}")] + MissingPackageType(PathBuf), + + #[error("Cannot use `{1}` for `type` field in {0}")] + InvalidPackageType(PathBuf, String), + + /// Package manifest is unreadable. + #[error("Nargo.toml is badly formed, could not parse.\n\n {0}")] + MalformedFile(#[from] toml::de::Error), + + #[error("Unexpected workspace definition found in {0}")] + UnexpectedWorkspace(PathBuf), + + #[error("Cannot find file {entry} which was specified as the `entry` field in {toml}")] + MissingEntryFile { toml: PathBuf, entry: PathBuf }, + + #[error( + r#"Cannot find file {entry} which is defaulted due to specifying `type = "{package_type}"` in {toml}"# + )] + MissingDefaultEntryFile { toml: PathBuf, entry: PathBuf, package_type: PackageType }, + + #[error("{} found in {toml}", if name.is_empty() { "Empty package name".into() } else { format!("Invalid package name `{name}`") })] + InvalidPackageName { toml: PathBuf, name: String }, + + #[error("{} found in {toml}", if name.is_empty() { "Empty dependency name".into() } else { format!("Invalid dependency name `{name}`") })] + InvalidDependencyName { toml: PathBuf, name: String }, + + #[error("Invalid directory path {directory} in {toml}: It must point to a subdirectory")] + InvalidDirectory { toml: PathBuf, directory: PathBuf }, + + /// Encountered error while downloading git repository. + #[error("{0}")] + GitError(String), + + #[error("Selected package `{0}` was not found")] + MissingSelectedPackage(CrateName), + + #[error("Default package was not found. Does {0} exist in your workspace?")] + MissingDefaultPackage(PathBuf), + + #[error("Package `{0}` has type `bin` but you cannot depend on binary packages")] + BinaryDependency(CrateName), + + #[error("Missing `name` field in {toml}")] + MissingNameField { toml: PathBuf }, + + #[error("No common ancestor between {root} and {current}")] + NoCommonAncestor { root: PathBuf, current: PathBuf }, + + #[error(transparent)] + SemverError(SemverError), +} + +#[derive(Error, Debug, PartialEq, Eq, Clone)] +pub enum SemverError { + #[error("Incompatible compiler version in package {package_name}. Required compiler version is {required_compiler_version} but the compiler version is {compiler_version_found}.\n Update the compiler_version field in Nargo.toml to >={compiler_version_found} or compile this project with version {compiler_version_found}")] + IncompatibleVersion { + package_name: CrateName, + required_compiler_version: String, + compiler_version_found: String, + }, + #[error("Could not parse the required compiler version for package {package_name} in Nargo.toml. Error: {error}")] + CouldNotParseRequiredVersion { package_name: String, error: String }, +} diff --git a/noir/tooling/nargo_toml/src/git.rs b/noir/tooling/nargo_toml/src/git.rs new file mode 100644 index 00000000000..80e57247ae6 --- /dev/null +++ b/noir/tooling/nargo_toml/src/git.rs @@ -0,0 +1,55 @@ +use std::path::PathBuf; + +/// Creates a unique folder name for a GitHub repo +/// by using its URL and tag +fn resolve_folder_name(base: &url::Url, tag: &str) -> String { + let mut folder_name = base.domain().unwrap().to_owned(); + folder_name.push_str(base.path()); + folder_name.push_str(tag); + folder_name +} + +fn nargo_crates() -> PathBuf { + dirs::home_dir().unwrap().join("nargo") +} + +fn git_dep_location(base: &url::Url, tag: &str) -> PathBuf { + let folder_name = resolve_folder_name(base, tag); + + nargo_crates().join(folder_name) +} + +/// XXX: I'd prefer to use a GitHub library however, there +/// does not seem to be an easy way to download a repo at a specific +/// tag +/// github-rs looks promising, however it seems to require an API token +/// +/// One advantage of using "git clone" is that there is effectively no rate limit +pub(crate) fn clone_git_repo(url: &str, tag: &str) -> Result { + use std::process::Command; + + let base = match url::Url::parse(url) { + Ok(base) => base, + Err(err) => return Err(err.to_string()), + }; + + let loc = git_dep_location(&base, tag); + if loc.exists() { + return Ok(loc); + } + + Command::new("git") + .arg("-c") + .arg("advice.detachedHead=false") + .arg("clone") + .arg("--depth") + .arg("1") + .arg("--branch") + .arg(tag) + .arg(base.as_str()) + .arg(&loc) + .status() + .expect("git clone command failed to start"); + + Ok(loc) +} diff --git a/noir/tooling/nargo_toml/src/lib.rs b/noir/tooling/nargo_toml/src/lib.rs new file mode 100644 index 00000000000..223ed2da081 --- /dev/null +++ b/noir/tooling/nargo_toml/src/lib.rs @@ -0,0 +1,459 @@ +#![forbid(unsafe_code)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] +#![cfg_attr(not(test), warn(unused_crate_dependencies, unused_extern_crates))] + +use std::{ + collections::BTreeMap, + path::{Component, Path, PathBuf}, +}; + +use fm::{NormalizePath, FILE_EXTENSION}; +use nargo::{ + package::{Dependency, Package, PackageType}, + workspace::Workspace, +}; +use noirc_frontend::graph::CrateName; +use serde::Deserialize; + +mod errors; +mod git; +mod semver; + +pub use errors::ManifestError; +use git::clone_git_repo; + +/// Returns the [PathBuf] of the directory containing the `Nargo.toml` by searching from `current_path` to the root of its [Path]. +/// +/// Returns a [ManifestError] if no parent directories of `current_path` contain a manifest file. +pub fn find_package_root(current_path: &Path) -> Result { + let root = path_root(current_path); + let manifest_path = find_package_manifest(&root, current_path)?; + + let package_root = + manifest_path.parent().expect("infallible: manifest file path can't be root directory"); + + Ok(package_root.to_path_buf()) +} + +// TODO(#2323): We are probably going to need a "filepath utils" crate soon +fn path_root(path: &Path) -> PathBuf { + let mut components = path.components(); + + match (components.next(), components.next()) { + // Preserve prefix if one exists + (Some(prefix @ Component::Prefix(_)), Some(root @ Component::RootDir)) => { + PathBuf::from(prefix.as_os_str()).join(root.as_os_str()) + } + (Some(root @ Component::RootDir), _) => PathBuf::from(root.as_os_str()), + _ => PathBuf::new(), + } +} + +/// Returns the [PathBuf] of the `Nargo.toml` file by searching from `current_path` and stopping at `root_path`. +/// +/// Returns a [ManifestError] if no parent directories of `current_path` contain a manifest file. +pub fn find_package_manifest( + root_path: &Path, + current_path: &Path, +) -> Result { + if current_path.starts_with(root_path) { + let mut found_toml_paths = Vec::new(); + for path in current_path.ancestors() { + if let Ok(toml_path) = get_package_manifest(path) { + found_toml_paths.push(toml_path); + } + // While traversing, break once we process the root specified + if path == root_path { + break; + } + } + + // Return the shallowest Nargo.toml, which will be the last in the list + found_toml_paths.pop().ok_or_else(|| ManifestError::MissingFile(current_path.to_path_buf())) + } else { + Err(ManifestError::NoCommonAncestor { + root: root_path.to_path_buf(), + current: current_path.to_path_buf(), + }) + } +} +/// Returns the [PathBuf] of the `Nargo.toml` file in the `current_path` directory. +/// +/// Returns a [ManifestError] if `current_path` does not contain a manifest file. +pub fn get_package_manifest(current_path: &Path) -> Result { + let toml_path = current_path.join("Nargo.toml"); + if toml_path.exists() { + Ok(toml_path) + } else { + Err(ManifestError::MissingFile(current_path.to_path_buf())) + } +} + +#[derive(Debug, Deserialize, Clone)] +struct PackageConfig { + package: PackageMetadata, + #[serde(default)] + dependencies: BTreeMap, +} + +impl PackageConfig { + fn resolve_to_package(&self, root_dir: &Path) -> Result { + let name = if let Some(name) = &self.package.name { + name.parse().map_err(|_| ManifestError::InvalidPackageName { + toml: root_dir.join("Nargo.toml"), + name: name.into(), + })? + } else { + return Err(ManifestError::MissingNameField { toml: root_dir.join("Nargo.toml") }); + }; + + let mut dependencies: BTreeMap = BTreeMap::new(); + for (name, dep_config) in self.dependencies.iter() { + let name = name.parse().map_err(|_| ManifestError::InvalidDependencyName { + toml: root_dir.join("Nargo.toml"), + name: name.into(), + })?; + let resolved_dep = dep_config.resolve_to_dependency(root_dir)?; + + dependencies.insert(name, resolved_dep); + } + + let package_type = match self.package.package_type.as_deref() { + Some("lib") => PackageType::Library, + Some("bin") => PackageType::Binary, + Some("contract") => PackageType::Contract, + Some(invalid) => { + return Err(ManifestError::InvalidPackageType( + root_dir.join("Nargo.toml"), + invalid.to_string(), + )) + } + None => return Err(ManifestError::MissingPackageType(root_dir.join("Nargo.toml"))), + }; + + let entry_path = if let Some(entry_path) = &self.package.entry { + let custom_entry_path = root_dir.join(entry_path); + if custom_entry_path.exists() { + custom_entry_path + } else { + return Err(ManifestError::MissingEntryFile { + toml: root_dir.join("Nargo.toml"), + entry: custom_entry_path, + }); + } + } else { + let default_entry_path = match package_type { + PackageType::Library => { + root_dir.join("src").join("lib").with_extension(FILE_EXTENSION) + } + PackageType::Binary | PackageType::Contract => { + root_dir.join("src").join("main").with_extension(FILE_EXTENSION) + } + }; + + if default_entry_path.exists() { + default_entry_path + } else { + return Err(ManifestError::MissingDefaultEntryFile { + toml: root_dir.join("Nargo.toml"), + entry: default_entry_path, + package_type, + }); + } + }; + + Ok(Package { + compiler_required_version: self.package.compiler_version.clone(), + root_dir: root_dir.to_path_buf(), + entry_path, + package_type, + name, + dependencies, + }) + } +} + +/// Contains all the information about a package, as loaded from a `Nargo.toml`. +#[derive(Debug, Deserialize, Clone)] +#[serde(untagged)] +enum Config { + /// Represents a `Nargo.toml` with package fields. + Package { + #[serde(flatten)] + package_config: PackageConfig, + }, + /// Represents a `Nargo.toml` with workspace fields. + Workspace { + #[serde(alias = "workspace")] + workspace_config: WorkspaceConfig, + }, +} + +impl TryFrom for Config { + type Error = toml::de::Error; + + fn try_from(toml: String) -> Result { + toml::from_str(&toml) + } +} + +impl TryFrom<&str> for Config { + type Error = toml::de::Error; + + fn try_from(toml: &str) -> Result { + toml::from_str(toml) + } +} + +/// Tracks the root_dir of a `Nargo.toml` and the contents inside the file. +struct NargoToml { + root_dir: PathBuf, + config: Config, +} + +#[derive(Default, Debug, Deserialize, Clone)] +#[serde(rename_all = "kebab-case")] +struct WorkspaceConfig { + /// List of members in this workspace. + members: Vec, + /// Specifies the default crate to interact with in the context (similarly to how we have nargo as the default crate in this repository). + default_member: Option, +} + +#[allow(dead_code)] +#[derive(Default, Debug, Deserialize, Clone)] +struct PackageMetadata { + name: Option, + #[serde(alias = "type")] + package_type: Option, + entry: Option, + description: Option, + authors: Option>, + // If no compiler version is supplied, the latest is used + // For now, we state that all packages must be compiled under the same + // compiler version. + // We also state that ACIR and the compiler will upgrade in lockstep. + // so you will not need to supply an ACIR and compiler version + compiler_version: Option, + backend: Option, + license: Option, +} + +#[derive(Debug, Deserialize, Clone)] +#[serde(untagged)] +/// Enum representing the different types of ways to +/// supply a source for the dependency +enum DependencyConfig { + Github { git: String, tag: String, directory: Option }, + Path { path: String }, +} + +impl DependencyConfig { + fn resolve_to_dependency(&self, pkg_root: &Path) -> Result { + let dep = match self { + Self::Github { git, tag, directory } => { + let dir_path = clone_git_repo(git, tag).map_err(ManifestError::GitError)?; + let project_path = if let Some(directory) = directory { + let internal_path = dir_path.join(directory).normalize(); + if !internal_path.starts_with(&dir_path) { + return Err(ManifestError::InvalidDirectory { + toml: pkg_root.join("Nargo.toml"), + directory: directory.into(), + }); + } + internal_path + } else { + dir_path + }; + let toml_path = project_path.join("Nargo.toml"); + let package = resolve_package_from_toml(&toml_path)?; + Dependency::Remote { package } + } + Self::Path { path } => { + let dir_path = pkg_root.join(path); + let toml_path = dir_path.join("Nargo.toml"); + let package = resolve_package_from_toml(&toml_path)?; + Dependency::Local { package } + } + }; + + // Cannot depend on a binary + // TODO: Can we depend upon contracts? + if dep.is_binary() { + Err(ManifestError::BinaryDependency(dep.package_name().clone())) + } else { + Ok(dep) + } + } +} + +fn toml_to_workspace( + nargo_toml: NargoToml, + package_selection: PackageSelection, +) -> Result { + let workspace = match nargo_toml.config { + Config::Package { package_config } => { + let member = package_config.resolve_to_package(&nargo_toml.root_dir)?; + match &package_selection { + PackageSelection::Selected(selected_name) if selected_name != &member.name => { + return Err(ManifestError::MissingSelectedPackage(member.name)) + } + _ => Workspace { + root_dir: nargo_toml.root_dir, + selected_package_index: Some(0), + members: vec![member], + }, + } + } + Config::Workspace { workspace_config } => { + let mut members = Vec::new(); + let mut selected_package_index = None; + for (index, member_path) in workspace_config.members.into_iter().enumerate() { + let package_root_dir = nargo_toml.root_dir.join(&member_path); + let package_toml_path = package_root_dir.join("Nargo.toml"); + let member = resolve_package_from_toml(&package_toml_path)?; + + match &package_selection { + PackageSelection::Selected(selected_name) => { + if &member.name == selected_name { + selected_package_index = Some(index); + } + } + PackageSelection::DefaultOrAll => { + if Some(&member_path) == workspace_config.default_member.as_ref() { + selected_package_index = Some(index); + } + } + PackageSelection::All => selected_package_index = None, + } + + members.push(member); + } + + // If the selected_package_index is still `None` but we have see a default_member or selected package, + // we want to present an error to users + match package_selection { + PackageSelection::Selected(selected_name) => { + if selected_package_index.is_none() { + return Err(ManifestError::MissingSelectedPackage(selected_name)); + } + } + PackageSelection::DefaultOrAll => match workspace_config.default_member { + // If `default-member` is specified but we don't have a selected_package_index, we need to fail + Some(default_path) if selected_package_index.is_none() => { + return Err(ManifestError::MissingDefaultPackage(default_path)); + } + // However, if there wasn't a `default-member`, we select All, so no error is needed + _ => (), + }, + PackageSelection::All => (), + } + + Workspace { root_dir: nargo_toml.root_dir, members, selected_package_index } + } + }; + + Ok(workspace) +} + +fn read_toml(toml_path: &Path) -> Result { + let toml_path = toml_path.normalize(); + let toml_as_string = std::fs::read_to_string(&toml_path) + .map_err(|_| ManifestError::ReadFailed(toml_path.to_path_buf()))?; + let root_dir = toml_path.parent().ok_or(ManifestError::MissingParent)?; + let nargo_toml = + NargoToml { root_dir: root_dir.to_path_buf(), config: toml_as_string.try_into()? }; + + Ok(nargo_toml) +} + +/// Resolves a Nargo.toml file into a `Package` struct as defined by our `nargo` core. +fn resolve_package_from_toml(toml_path: &Path) -> Result { + let nargo_toml = read_toml(toml_path)?; + + match nargo_toml.config { + Config::Package { package_config } => { + package_config.resolve_to_package(&nargo_toml.root_dir) + } + Config::Workspace { .. } => { + Err(ManifestError::UnexpectedWorkspace(toml_path.to_path_buf())) + } + } +} + +#[derive(Debug, PartialEq, Eq)] +pub enum PackageSelection { + Selected(CrateName), + DefaultOrAll, + All, +} + +/// Resolves a Nargo.toml file into a `Workspace` struct as defined by our `nargo` core. +pub fn resolve_workspace_from_toml( + toml_path: &Path, + package_selection: PackageSelection, + current_compiler_version: Option, +) -> Result { + let nargo_toml = read_toml(toml_path)?; + let workspace = toml_to_workspace(nargo_toml, package_selection)?; + if let Some(current_compiler_version) = current_compiler_version { + semver::semver_check_workspace(workspace.clone(), current_compiler_version)?; + } + Ok(workspace) +} + +#[test] +fn parse_standard_toml() { + let src = r#" + + [package] + name = "test" + authors = ["kev", "foo"] + compiler_version = "*" + + [dependencies] + rand = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} + cool = { tag = "next", git = "https://github.com/rust-lang-nursery/rand"} + hello = {path = "./noir_driver"} + "#; + + assert!(Config::try_from(String::from(src)).is_ok()); + assert!(Config::try_from(src).is_ok()); +} + +#[test] +fn parse_package_toml_no_deps() { + let src = r#" + [package] + name = "test" + authors = ["kev", "foo"] + compiler_version = "*" + "#; + + assert!(Config::try_from(String::from(src)).is_ok()); + assert!(Config::try_from(src).is_ok()); +} + +#[test] +fn parse_workspace_toml() { + let src = r#" + [workspace] + members = ["a", "b"] + "#; + + assert!(Config::try_from(String::from(src)).is_ok()); + assert!(Config::try_from(src).is_ok()); +} + +#[test] +fn parse_workspace_default_member_toml() { + let src = r#" + [workspace] + members = ["a", "b"] + default-member = "a" + "#; + + assert!(Config::try_from(String::from(src)).is_ok()); + assert!(Config::try_from(src).is_ok()); +} diff --git a/noir/tooling/nargo_toml/src/semver.rs b/noir/tooling/nargo_toml/src/semver.rs new file mode 100644 index 00000000000..de722f06bd8 --- /dev/null +++ b/noir/tooling/nargo_toml/src/semver.rs @@ -0,0 +1,196 @@ +use crate::{errors::SemverError, ManifestError}; +use nargo::{ + package::{Dependency, Package}, + workspace::Workspace, +}; +use semver::{Version, VersionReq}; + +// Check that all of the packages in the workspace are compatible with the current compiler version +pub(crate) fn semver_check_workspace( + workspace: Workspace, + current_compiler_version: String, +) -> Result<(), ManifestError> { + let version = Version::parse(¤t_compiler_version) + .expect("The compiler version is not a valid semver version"); + for package in &workspace.members { + semver_check_package(package, &version).map_err(ManifestError::SemverError)?; + } + + Ok(()) +} + +// Check that a package and all of its dependencies are compatible with the current compiler version +pub(crate) fn semver_check_package( + package: &Package, + compiler_version: &Version, +) -> Result<(), SemverError> { + // Check that this package's compiler version requirements are satisfied + if let Some(version) = &package.compiler_required_version { + let version_req = match VersionReq::parse(version) { + Ok(version_req) => version_req, + Err(err) => { + return Err(SemverError::CouldNotParseRequiredVersion { + package_name: package.name.clone().into(), + error: err.to_string(), + }) + } + }; + if !version_req.matches(compiler_version) { + return Err(SemverError::IncompatibleVersion { + package_name: package.name.clone(), + required_compiler_version: version.clone(), + compiler_version_found: strip_build_meta_data(compiler_version), + }); + }; + } + + // Check that all of this package's dependencies' compiler version requirements are satisfied + for dep in package.dependencies.values() { + match dep { + Dependency::Local { package } | Dependency::Remote { package } => { + semver_check_package(package, compiler_version)?; + } + } + } + + Ok(()) +} + +// Strip the build meta data from the version string since it is ignored by semver. +fn strip_build_meta_data(version: &Version) -> String { + let version_string = version.to_string(); + let mut split = version_string.split('+'); + split.next().expect("split was called on an empty string").to_string() +} + +#[cfg(test)] +mod tests { + use std::{collections::BTreeMap, path::PathBuf, str::FromStr}; + + use nargo::package::PackageType; + use noirc_frontend::graph::CrateName; + + use super::*; + + #[test] + fn test_semver_check_smoke() { + let compiler_version = Version::parse("0.1.0").unwrap(); + + let mut package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0 and required version from the package is 0.1.0\n error: {err:?}") + }; + + package.compiler_required_version = Some("0.2.0".to_string()); + let got_err = match semver_check_package(&package, &compiler_version) { + Ok(_) => panic!("semver check should have failed. compiler version is 0.1.0 and required version from the package is 0.2.0"), + Err(err) => err, + }; + + let expected_version_error = SemverError::IncompatibleVersion { + package_name: CrateName::from_str("test").unwrap(), + required_compiler_version: "0.2.0".to_string(), + compiler_version_found: "0.1.0".to_string(), + }; + assert_eq!(got_err, expected_version_error); + } + + #[test] + fn test_semver_dependency_check_smoke() { + let compiler_version = Version::parse("0.1.0").unwrap(); + + let mut package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + let valid_dependency = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("good_dependency").unwrap(), + dependencies: BTreeMap::new(), + }; + let invalid_dependency = Package { + compiler_required_version: Some("0.2.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("bad_dependency").unwrap(), + dependencies: BTreeMap::new(), + }; + + package.dependencies.insert( + CrateName::from_str("test_dep_valid").unwrap(), + Dependency::Local { package: valid_dependency.clone() }, + ); + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0 and required version from the package is 0.1.0\n error: {err:?}") + }; + + package.dependencies.insert( + CrateName::from_str("test_dep_invalid").unwrap(), + Dependency::Local { package: invalid_dependency.clone() }, + ); + let got_err = match semver_check_package(&package,&compiler_version) { + Ok(_) => panic!("semver check should have failed. compiler version is 0.1.0 and required version from the package is 0.2.0"), + Err(err) => err, + }; + + let expected_version_error = SemverError::IncompatibleVersion { + package_name: CrateName::from_str("bad_dependency").unwrap(), + required_compiler_version: "0.2.0".to_string(), + compiler_version_found: "0.1.0".to_string(), + }; + assert_eq!(got_err, expected_version_error); + } + + #[test] + fn test_semver_carrot() { + let compiler_version = Version::parse("0.2.0").unwrap(); + + let package = Package { + compiler_required_version: Some(">=0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.2.0 and required version from the package is >=0.1.0\n error: {err:?}") + }; + } + + #[test] + fn test_semver_build_data() { + let compiler_version = Version::parse("0.1.0+this-is-ignored-by-semver").unwrap(); + + let package = Package { + compiler_required_version: Some("0.1.0".to_string()), + root_dir: PathBuf::new(), + package_type: PackageType::Library, + entry_path: PathBuf::new(), + name: CrateName::from_str("test").unwrap(), + dependencies: BTreeMap::new(), + }; + + if let Err(err) = semver_check_package(&package, &compiler_version) { + panic!("semver check should have passed. compiler version is 0.1.0+build_data and required version from the package is 0.1.0\n The build data should be ignored\n error: {err:?}") + }; + } +} diff --git a/noir/tooling/noir_codegen/.eslintignore b/noir/tooling/noir_codegen/.eslintignore new file mode 100644 index 00000000000..491fc35975b --- /dev/null +++ b/noir/tooling/noir_codegen/.eslintignore @@ -0,0 +1,2 @@ +node_modules +lib diff --git a/noir/tooling/noir_codegen/.eslintrc.cjs b/noir/tooling/noir_codegen/.eslintrc.cjs new file mode 100644 index 00000000000..33335c2a877 --- /dev/null +++ b/noir/tooling/noir_codegen/.eslintrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + extends: ["../../.eslintrc.js"], +}; diff --git a/noir/tooling/noir_codegen/.gitignore b/noir/tooling/noir_codegen/.gitignore new file mode 100644 index 00000000000..721d05448d6 --- /dev/null +++ b/noir/tooling/noir_codegen/.gitignore @@ -0,0 +1,4 @@ +crs +lib + +!test/*/target diff --git a/noir/tooling/noir_codegen/.mocharc.json b/noir/tooling/noir_codegen/.mocharc.json new file mode 100644 index 00000000000..82855d2ddf4 --- /dev/null +++ b/noir/tooling/noir_codegen/.mocharc.json @@ -0,0 +1,11 @@ +{ + "require": "ts-node/register", + "loader": "ts-node/esm", + "extensions": [ + "ts", + "cjs" + ], + "spec": [ + "test/**/*.test.ts*" + ] +} \ No newline at end of file diff --git a/noir/tooling/noir_codegen/README.md b/noir/tooling/noir_codegen/README.md new file mode 100644 index 00000000000..c24c12ff987 --- /dev/null +++ b/noir/tooling/noir_codegen/README.md @@ -0,0 +1,4 @@ + +## Acknowledgements + +`noir-codegen` repurposes the CLI code from https://github.com/dethcrypto/TypeChain, used under the MIT license. \ No newline at end of file diff --git a/noir/tooling/noir_codegen/package.json b/noir/tooling/noir_codegen/package.json new file mode 100644 index 00000000000..17772461dff --- /dev/null +++ b/noir/tooling/noir_codegen/package.json @@ -0,0 +1,53 @@ +{ + "name": "@noir-lang/noir_codegen", + "collaborators": [ + "The Noir Team " + ], + "version": "0.19.2", + "packageManager": "yarn@3.5.1", + "license": "(MIT OR Apache-2.0)", + "type": "module", + "dependencies": { + "@noir-lang/types": "workspace:*", + "glob": "^10.3.10", + "lodash": "^4.17.21", + "ts-command-line-args": "^2.5.1" + }, + "files": [ + "lib", + "package.json" + ], + "source": "src/index.ts", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bin": { + "noir-codegen": "lib/main.js" + }, + "scripts": { + "dev": "tsc-multi --watch", + "build": "tsc", + "test": "ts-node --esm src/main.ts ./test/assert_lt/target/** --out-dir ./test/codegen && yarn test:node && rm -rf ./test/codegen", + "test:node": "mocha --timeout 25000 --exit --config ./.mocharc.json", + "prettier": "prettier 'src/**/*.ts'", + "prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", + "clean": "rm -rf ./lib" + }, + "devDependencies": { + "@noir-lang/noir_js": "workspace:*", + "@types/chai": "^4", + "@types/lodash": "^4", + "@types/mocha": "^10.0.1", + "@types/node": "^20.6.2", + "@types/prettier": "^3", + "chai": "^4.3.8", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "mocha": "^10.2.0", + "prettier": "3.0.3", + "ts-node": "^10.9.1", + "typescript": "^5.2.2" + } +} diff --git a/noir/tooling/noir_codegen/src/index.ts b/noir/tooling/noir_codegen/src/index.ts new file mode 100644 index 00000000000..1f8d2d183d4 --- /dev/null +++ b/noir/tooling/noir_codegen/src/index.ts @@ -0,0 +1,28 @@ +import { CompiledCircuit } from '@noir-lang/types'; + +const codegenImports = `import { InputMap, InputValue } from "@noir-lang/noirc_abi" +import { Noir } from "@noir-lang/noir_js"`; + +const codegenFunction = ( + name: string, + compiled_program: CompiledCircuit, +) => `export async function ${name}(args: InputMap): Promise { + const program = new Noir(${JSON.stringify(compiled_program)}); + const { returnValue } = await program.execute(args); + return returnValue; +}`; + +export const codegen = (programs: [string, CompiledCircuit][]): string => { + const results = [codegenImports]; + for (const [name, program] of programs) { + results.push(codegenFunction(name, stripUnwantedFields(program))); + } + + return results.join('\n\n'); +}; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function stripUnwantedFields(value: any): CompiledCircuit { + const { abi, bytecode } = value; + return { abi, bytecode }; +} diff --git a/noir/tooling/noir_codegen/src/main.ts b/noir/tooling/noir_codegen/src/main.ts new file mode 100644 index 00000000000..591e7420dba --- /dev/null +++ b/noir/tooling/noir_codegen/src/main.ts @@ -0,0 +1,47 @@ +#! /usr/bin/env node + +import { CompiledCircuit } from '@noir-lang/types'; +import fs from 'fs'; +import path from 'path'; +import { parseArgs } from './parseArgs.js'; +import { glob } from './utils/glob.js'; +import { codegen } from './index.js'; + +function main() { + const cliConfig = parseArgs(); + const cwd = process.cwd(); + + const files = getFilesToProcess(cwd, cliConfig.files); + if (files.length === 0) { + throw new Error('No files passed.' + '\n' + `\`${cliConfig.files}\` didn't match any input files in ${cwd}`); + } + + const programs = files.map((file_path): [string, CompiledCircuit] => { + const program_name = path.parse(file_path).name; + const file_contents = fs.readFileSync(file_path).toString(); + const { abi, bytecode } = JSON.parse(file_contents); + + return [program_name, { abi, bytecode }]; + }); + + const result = codegen(programs); + + const outputDir = path.resolve(cliConfig.outDir ?? './codegen'); + const outputFile = path.join(outputDir, 'index.ts'); + if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir); + fs.writeFileSync(outputFile, result); +} + +function getFilesToProcess(cwd: string, filesOrPattern: string[]) { + let res = glob(cwd, filesOrPattern); + + if (res.length === 0) { + // If there are no files found, but first parameter is surrounded with single quotes, we try again without quotes + const match = filesOrPattern[0].match(/'([\s\S]*)'/)?.[1]; + if (match) res = glob(cwd, [match]); + } + + return res; +} + +main(); diff --git a/noir/tooling/noir_codegen/src/parseArgs.ts b/noir/tooling/noir_codegen/src/parseArgs.ts new file mode 100644 index 00000000000..58468c1b8f8 --- /dev/null +++ b/noir/tooling/noir_codegen/src/parseArgs.ts @@ -0,0 +1,64 @@ +import { parse as commandLineArgs } from 'ts-command-line-args'; + +const DEFAULT_GLOB_PATTERN = './target/**/*.json'; + +export interface ParsedArgs { + files: string[]; + outDir?: string | undefined; + inputDir?: string | undefined; +} + +export function parseArgs(): ParsedArgs { + const rawOptions = commandLineArgs( + { + glob: { + type: String, + defaultOption: true, + multiple: true, + defaultValue: [DEFAULT_GLOB_PATTERN], + description: + 'Pattern that will be used to find program artifacts. Remember about adding quotes: noir-codegen "**/*.json".', + }, + 'out-dir': { type: String, optional: true, description: 'Output directory for generated files.' }, + 'input-dir': { + type: String, + optional: true, + description: + 'Directory containing program artifact files. Inferred as lowest common path of all files if not specified.', + }, + help: { type: Boolean, defaultValue: false, alias: 'h', description: 'Prints this message.' }, + }, + { + helpArg: 'help', + headerContentSections: [ + { + content: `\ + noir-codegen generates TypeScript wrappers for Noir programs to simplify replicating your Noir logic in JS.`, + }, + ], + footerContentSections: [ + { + header: 'Example Usage', + content: `\ + noir-codegen --out-dir app/noir_programs './target/*.json' + + + You can read more about noir-codegen at {underline https://github.com/noir-lang/noir}.`, + }, + ], + }, + ); + + return { + files: rawOptions.glob, + outDir: rawOptions['out-dir'], + inputDir: rawOptions['input-dir'], + }; +} + +interface CommandLineArgs { + glob: string[]; + 'out-dir'?: string; + 'input-dir'?: string; + help: boolean; +} diff --git a/noir/tooling/noir_codegen/src/utils/glob.ts b/noir/tooling/noir_codegen/src/utils/glob.ts new file mode 100644 index 00000000000..15deaf72e44 --- /dev/null +++ b/noir/tooling/noir_codegen/src/utils/glob.ts @@ -0,0 +1,9 @@ +import { sync as globSync } from 'glob'; +import _ from 'lodash'; +const { flatten, uniq } = _; + +export function glob(cwd: string, patternsOrFiles: string[]): string[] { + const matches = patternsOrFiles.map((p) => globSync(p, { ignore: 'node_modules/**', absolute: true, cwd })); + + return uniq(flatten(matches)); +} diff --git a/noir/tooling/noir_codegen/test/assert_lt/Nargo.toml b/noir/tooling/noir_codegen/test/assert_lt/Nargo.toml new file mode 100644 index 00000000000..f32ec18cae7 --- /dev/null +++ b/noir/tooling/noir_codegen/test/assert_lt/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "assert_lt" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/noir_codegen/test/assert_lt/src/main.nr b/noir/tooling/noir_codegen/test/assert_lt/src/main.nr new file mode 100644 index 00000000000..0698cbce4a8 --- /dev/null +++ b/noir/tooling/noir_codegen/test/assert_lt/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: u64, y: pub u64) -> pub u64 { + assert(x < y); + x + y +} diff --git a/noir/tooling/noir_codegen/test/assert_lt/target/assert_lt.json b/noir/tooling/noir_codegen/test/assert_lt/target/assert_lt.json new file mode 100644 index 00000000000..3b2b1b2c5a1 --- /dev/null +++ b/noir/tooling/noir_codegen/test/assert_lt/target/assert_lt.json @@ -0,0 +1 @@ +{"hash":13834844072603749544,"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":64},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":64},"visibility":"public"}],"param_witnesses":{"x":[1],"y":[2]},"return_type":{"kind":"integer","sign":"unsigned","width":64},"return_witnesses":[12]},"bytecode":"H4sIAAAAAAAA/+1WUW6DMAx1QksZoGr72jUcAiX8VbvJ0Oj9j7ChJpKbtXw0NpvUWkImUXixn53w3gDgHc6mfh7t/ZGMtR9TU96HeYuHtp36ZjLWfGIzjK7DthsPzjjTue6rcdZOrnX9MA49Dqa1kzl1gz3h2bL7sTDCMhmJbylmTDOT8WEhjXfjH/DcB8u8zwVygWifmL/9lTnWzSWKsxHA3QJf00vlveWvERJIUU4x0eb86aEJppljVox9oO+Py8QTV1Jnw6a85t7vSL8pwvN89j7gd88o8q79Gr2wRt3AeSFz4XvRSyokl5MAtSfgGO2ZCewdsDibLRVrDzIXTMxfqiLIGXPeMdY1gb/Fg8+tznJY50eSGmfB2DNrqciCD+tCRc4X5FNFJmIWnkhu3BL+t4qc8y75aySqIkvGOP9CRWKaGQ0ydUrsgUUVWXlfw4OpyAouVWQN66pITDPDqSJfQaZxuVVkxZhzzVgLTv5uHbDwXhN+vwGywklHPBQAAA=="} \ No newline at end of file diff --git a/noir/tooling/noir_codegen/test/index.test.ts b/noir/tooling/noir_codegen/test/index.test.ts new file mode 100644 index 00000000000..702ba1f9cbb --- /dev/null +++ b/noir/tooling/noir_codegen/test/index.test.ts @@ -0,0 +1,11 @@ +import { expect } from 'chai'; +import { assert_lt } from './codegen/index.js'; + +it('codegens a callable function', async () => { + const result = await assert_lt({ + x: '2', + y: '3', + }); + + expect(result).to.be.eq('0x05'); +}); diff --git a/noir/tooling/noir_codegen/tsconfig.json b/noir/tooling/noir_codegen/tsconfig.json new file mode 100644 index 00000000000..30dd2a7ee5f --- /dev/null +++ b/noir/tooling/noir_codegen/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "esnext", + "declaration": true, + "emitDeclarationOnly": false, + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./lib", + "esModuleInterop": true, + "resolveJsonModule": true, + "strict": true, + "noImplicitAny": false, + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/noir/tooling/noir_js/.eslintignore b/noir/tooling/noir_js/.eslintignore new file mode 100644 index 00000000000..e34f38f3450 --- /dev/null +++ b/noir/tooling/noir_js/.eslintignore @@ -0,0 +1,3 @@ +node_modules +test/backend/barretenberg.ts +lib diff --git a/noir/tooling/noir_js/.eslintrc.cjs b/noir/tooling/noir_js/.eslintrc.cjs new file mode 100644 index 00000000000..33335c2a877 --- /dev/null +++ b/noir/tooling/noir_js/.eslintrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + extends: ["../../.eslintrc.js"], +}; diff --git a/noir/tooling/noir_js/.gitignore b/noir/tooling/noir_js/.gitignore new file mode 100644 index 00000000000..5b57ba1708d --- /dev/null +++ b/noir/tooling/noir_js/.gitignore @@ -0,0 +1,3 @@ +crs + +!test/noir_compiled_examples/*/target diff --git a/noir/tooling/noir_js/.mocharc.cjs.json b/noir/tooling/noir_js/.mocharc.cjs.json new file mode 100644 index 00000000000..c1c37373f18 --- /dev/null +++ b/noir/tooling/noir_js/.mocharc.cjs.json @@ -0,0 +1,6 @@ +{ + "extensions": ["cjs"], + "spec": [ + "test/node/**/*.test.cjs" + ] +} \ No newline at end of file diff --git a/noir/tooling/noir_js/.mocharc.json b/noir/tooling/noir_js/.mocharc.json new file mode 100644 index 00000000000..c2e70b73d0f --- /dev/null +++ b/noir/tooling/noir_js/.mocharc.json @@ -0,0 +1,8 @@ +{ + "require": "ts-node/register", + "loader": "ts-node/esm", + "extensions": ["ts", "cjs"], + "spec": [ + "test/node/**/*.test.ts*" + ] +} \ No newline at end of file diff --git a/noir/tooling/noir_js/package.json b/noir/tooling/noir_js/package.json new file mode 100644 index 00000000000..51bc7550200 --- /dev/null +++ b/noir/tooling/noir_js/package.json @@ -0,0 +1,55 @@ +{ + "name": "@noir-lang/noir_js", + "collaborators": [ + "The Noir Team " + ], + "version": "0.19.2", + "packageManager": "yarn@3.5.1", + "license": "(MIT OR Apache-2.0)", + "type": "module", + "dependencies": { + "@noir-lang/acvm_js": "workspace:*", + "@noir-lang/noirc_abi": "workspace:*", + "@noir-lang/types": "workspace:*" + }, + "files": [ + "lib", + "package.json" + ], + "source": "src/index.ts", + "main": "lib/index.cjs", + "module": "lib/index.mjs", + "exports": { + "require": "./lib/index.cjs", + "types": "./lib/index.d.ts", + "default": "./lib/index.mjs" + }, + "types": "lib/index.d.ts", + "scripts": { + "dev": "tsc-multi --watch", + "build": "tsc-multi", + "test": "yarn test:node:esm && yarn test:node:cjs", + "test:node:esm": "mocha --timeout 25000 --exit --config ./.mocharc.json", + "test:node:cjs": "mocha --timeout 25000 --exit --config ./.mocharc.cjs.json", + "prettier": "prettier 'src/**/*.ts'", + "prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", + "clean": "rm -rf ./lib" + }, + "devDependencies": { + "@types/chai": "^4", + "@types/mocha": "^10.0.1", + "@types/node": "^20.6.2", + "@types/prettier": "^3", + "chai": "^4.3.8", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "mocha": "^10.2.0", + "prettier": "3.0.3", + "ts-node": "^10.9.1", + "tsc-multi": "^1.1.0", + "typescript": "^5.2.2" + } +} diff --git a/noir/tooling/noir_js/src/base64_decode.ts b/noir/tooling/noir_js/src/base64_decode.ts new file mode 100644 index 00000000000..d53aed187c7 --- /dev/null +++ b/noir/tooling/noir_js/src/base64_decode.ts @@ -0,0 +1,13 @@ +// Since this is a simple function, we can use feature detection to +// see if we are in the nodeJs environment or the browser environment. +export function base64Decode(input: string): Uint8Array { + if (typeof Buffer !== 'undefined') { + // Node.js environment + return Buffer.from(input, 'base64'); + } else if (typeof atob === 'function') { + // Browser environment + return Uint8Array.from(atob(input), (c) => c.charCodeAt(0)); + } else { + throw new Error('No implementation found for base64 decoding.'); + } +} diff --git a/noir/tooling/noir_js/src/index.ts b/noir/tooling/noir_js/src/index.ts new file mode 100644 index 00000000000..5e700a5b583 --- /dev/null +++ b/noir/tooling/noir_js/src/index.ts @@ -0,0 +1,23 @@ +import * as acvm from '@noir-lang/acvm_js'; +import * as abi from '@noir-lang/noirc_abi'; +import { CompiledCircuit, ProofData } from '@noir-lang/types'; + +export { + ecdsa_secp256r1_verify, + ecdsa_secp256k1_verify, + keccak256, + blake2s256, + sha256, + xor, + and, +} from '@noir-lang/acvm_js'; + +export { WitnessMap, ForeignCallHandler, ForeignCallInput, ForeignCallOutput } from '@noir-lang/acvm_js'; + +export { Noir } from './program.js'; + +/** @ignore */ +export { acvm, abi }; + +// type exports for typedoc +export { CompiledCircuit, ProofData }; diff --git a/noir/tooling/noir_js/src/program.ts b/noir/tooling/noir_js/src/program.ts new file mode 100644 index 00000000000..711413bbc84 --- /dev/null +++ b/noir/tooling/noir_js/src/program.ts @@ -0,0 +1,94 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { Backend, CompiledCircuit, ProofData } from '@noir-lang/types'; +import { generateWitness } from './witness_generation.js'; +import initAbi, { abiDecode, InputMap, InputValue } from '@noir-lang/noirc_abi'; +import initACVM, { compressWitness, ForeignCallHandler } from '@noir-lang/acvm_js'; + +export class Noir { + constructor( + private circuit: CompiledCircuit, + private backend?: Backend, + ) {} + + /** @ignore */ + async init(): Promise { + // If these are available, then we are in the + // web environment. For the node environment, this + // is a no-op. + if (typeof initAbi === 'function') { + await Promise.all([initAbi(), initACVM()]); + } + } + + /** + * + * @description + * Destroys the underlying backend instance. + * + * @example + * ```typescript + * await noir.destroy(); + * ``` + * + */ + async destroy(): Promise { + await this.backend?.destroy(); + } + + private getBackend(): Backend { + if (this.backend === undefined) throw new Error('Operation requires a backend but none was provided'); + return this.backend; + } + + // Initial inputs to your program + /** + * @description + * Allows to execute a circuit to get its witness and return value. + * + * @example + * ```typescript + * async execute(inputs) + * ``` + */ + async execute( + inputs: InputMap, + foreignCallHandler?: ForeignCallHandler, + ): Promise<{ witness: Uint8Array; returnValue: InputValue }> { + await this.init(); + const witness = await generateWitness(this.circuit, inputs, foreignCallHandler); + const { return_value: returnValue } = abiDecode(this.circuit.abi, witness); + return { witness: compressWitness(witness), returnValue }; + } + + /** + * + * @description + * Generates a witness and a proof given an object as input. + * + * @example + * ```typescript + * async generateFinalproof(input) + * ``` + * + */ + async generateFinalProof(inputs: InputMap): Promise { + const { witness } = await this.execute(inputs); + return this.getBackend().generateFinalProof(witness); + } + + /** + * + * @description + * Instantiates the verification key and verifies a proof. + * + * + * @example + * ```typescript + * async verifyFinalProof(proof) + * ``` + * + */ + async verifyFinalProof(proofData: ProofData): Promise { + return this.getBackend().verifyFinalProof(proofData); + } +} diff --git a/noir/tooling/noir_js/src/witness_generation.ts b/noir/tooling/noir_js/src/witness_generation.ts new file mode 100644 index 00000000000..e3ddb1a2a21 --- /dev/null +++ b/noir/tooling/noir_js/src/witness_generation.ts @@ -0,0 +1,27 @@ +import { abiEncode, InputMap } from '@noir-lang/noirc_abi'; +import { base64Decode } from './base64_decode.js'; +import { executeCircuit, WitnessMap, ForeignCallHandler, ForeignCallInput } from '@noir-lang/acvm_js'; +import { CompiledCircuit } from '@noir-lang/types'; + +const defaultForeignCallHandler: ForeignCallHandler = (name: string, args: ForeignCallInput[]) => { + throw Error(`Unexpected oracle during execution: ${name}(${args.join(', ')})`); +}; + +// Generates the witnesses needed to feed into the chosen proving system +export async function generateWitness( + compiledProgram: CompiledCircuit, + inputs: InputMap, + foreignCallHandler: ForeignCallHandler = defaultForeignCallHandler, +): Promise { + // Throws on ABI encoding error + const witnessMap = abiEncode(compiledProgram.abi, inputs); + + // Execute the circuit to generate the rest of the witnesses and serialize + // them into a Uint8Array. + try { + const solvedWitness = await executeCircuit(base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler); + return solvedWitness; + } catch (err) { + throw new Error(`Circuit execution failed: ${err}`); + } +} diff --git a/noir/tooling/noir_js/test/node/cjs.test.cjs b/noir/tooling/noir_js/test/node/cjs.test.cjs new file mode 100644 index 00000000000..8698f9dfe2b --- /dev/null +++ b/noir/tooling/noir_js/test/node/cjs.test.cjs @@ -0,0 +1,80 @@ +/* eslint-disable no-undef */ +/* eslint-disable @typescript-eslint/no-var-requires */ +const chai = require('chai'); +const assert_lt_json = require('../noir_compiled_examples/assert_lt/target/assert_lt.json'); +const { Noir } = require('@noir-lang/noir_js'); + +it('generates witnesses successfully', async () => { + const inputs = { + x: '2', + y: '3', + }; + const _solvedWitness = await new Noir(assert_lt_json).execute(inputs); +}); + +it('string input and number input are the same', async () => { + const inputsString = { + x: '2', + y: '3', + }; + const inputsNumber = { + x: 2, + y: 3, + }; + const solvedWitnessString = await new Noir(assert_lt_json).execute(inputsString); + const solvedWitnessNumber = await new Noir(assert_lt_json).execute(inputsNumber); + chai.expect(solvedWitnessString).to.deep.equal(solvedWitnessNumber); +}); + +it('string input and number input are the same', async () => { + const inputsString = { + x: '2', + y: '3', + }; + const inputsNumber = { + x: 2, + y: 3, + }; + + const solvedWitnessString = await new Noir(assert_lt_json).execute(inputsString); + const solvedWitnessNumber = await new Noir(assert_lt_json).execute(inputsNumber); + chai.expect(solvedWitnessString).to.deep.equal(solvedWitnessNumber); +}); + +it('0x prefixed string input for inputs will throw', async () => { + const inputsHexPrefix = { + x: '0x2', + y: '0x3', + }; + + try { + await new Noir(assert_lt_json).execute(inputsHexPrefix); + chai.expect.fail( + 'Expected generatedWitness to throw, due to inputs being prefixed with 0x. Currently not supported', + ); + } catch (error) { + // Successfully errored due to 0x not being supported. Update this test once/if we choose + // to support 0x prefixed inputs. + } +}); + +describe('input validation', () => { + it('x should be a uint64 not a string', async () => { + const inputs = { + x: 'foo', + y: '3', + }; + + try { + await new Noir(assert_lt_json).execute(inputs); + chai.expect.fail('Expected generatedWitness to throw, due to x not being convertible to a uint64'); + } catch (error) { + const knownError = error; + chai + .expect(knownError.message) + .to.equal( + 'Expected witness values to be integers, provided value causes `invalid digit found in string` error', + ); + } + }); +}); diff --git a/noir/tooling/noir_js/test/node/e2e.test.ts b/noir/tooling/noir_js/test/node/e2e.test.ts new file mode 100644 index 00000000000..33d64377b06 --- /dev/null +++ b/noir/tooling/noir_js/test/node/e2e.test.ts @@ -0,0 +1,128 @@ +import { expect } from 'chai'; +import assert_lt_json from '../noir_compiled_examples/assert_lt/target/assert_lt.json' assert { type: 'json' }; +import { Noir } from '@noir-lang/noir_js'; +import { BarretenbergBackend as Backend } from '@noir-lang/backend_barretenberg'; +import { CompiledCircuit } from '@noir-lang/types'; + +const assert_lt_program = assert_lt_json as CompiledCircuit; + +it('end-to-end proof creation and verification (outer)', async () => { + // Noir.Js part + const inputs = { + x: '2', + y: '3', + }; + + const program = new Noir(assert_lt_program); + + const { witness } = await program.execute(inputs); + + // bb.js part + // + // Proof creation + const prover = new Backend(assert_lt_program); + const proof = await prover.generateFinalProof(witness); + + // Proof verification + const isValid = await prover.verifyFinalProof(proof); + expect(isValid).to.be.true; +}); + +it('end-to-end proof creation and verification (outer) -- Program API', async () => { + // Noir.Js part + const inputs = { + x: '2', + y: '3', + }; + + // Initialize backend + const backend = new Backend(assert_lt_program); + // Initialize program + const program = new Noir(assert_lt_program, backend); + // Generate proof + const proof = await program.generateFinalProof(inputs); + + // Proof verification + const isValid = await program.verifyFinalProof(proof); + expect(isValid).to.be.true; +}); + +it('end-to-end proof creation and verification (inner)', async () => { + // Noir.Js part + const inputs = { + x: '2', + y: '3', + }; + + const program = new Noir(assert_lt_program); + + const { witness } = await program.execute(inputs); + + // bb.js part + // + // Proof creation + const prover = new Backend(assert_lt_program); + const proof = await prover.generateIntermediateProof(witness); + + // Proof verification + const isValid = await prover.verifyIntermediateProof(proof); + expect(isValid).to.be.true; +}); + +it('end-to-end proving and verification with different instances', async () => { + // Noir.Js part + const inputs = { + x: '2', + y: '3', + }; + + const program = new Noir(assert_lt_program); + + const { witness } = await program.execute(inputs); + + // bb.js part + const prover = new Backend(assert_lt_program); + + const proof = await prover.generateFinalProof(witness); + + const verifier = new Backend(assert_lt_program); + const proof_is_valid = await verifier.verifyFinalProof(proof); + expect(proof_is_valid).to.be.true; +}); + +// This bug occurs when we use the same backend to create an inner proof and then an outer proof +// and then try to verify either one of them. +// +// The panic occurs when we try to verify the outer/inner proof that was created. +// If we only create one type of proof, then this works as expected. +// +// If we do not create an inner proof, then this will work as expected. +it('[BUG] -- bb.js null function or function signature mismatch (outer-inner) ', async () => { + // Noir.Js part + const inputs = { + x: '2', + y: '3', + }; + + const program = new Noir(assert_lt_program); + + const { witness } = await program.execute(inputs); + + // bb.js part + // + // Proof creation + // + const prover = new Backend(assert_lt_program); + // Create a proof using both proving systems, the majority of the time + // one would only use outer proofs. + const proofOuter = await prover.generateFinalProof(witness); + const _proofInner = await prover.generateIntermediateProof(witness); + + // Proof verification + // + const isValidOuter = await prover.verifyFinalProof(proofOuter); + expect(isValidOuter).to.be.true; + // We can also try verifying an inner proof and it will fail. + const isValidInner = await prover.verifyIntermediateProof(_proofInner); + expect(isValidInner).to.be.true; +}); diff --git a/noir/tooling/noir_js/test/node/execute.test.ts b/noir/tooling/noir_js/test/node/execute.test.ts new file mode 100644 index 00000000000..bfaf80882ab --- /dev/null +++ b/noir/tooling/noir_js/test/node/execute.test.ts @@ -0,0 +1,16 @@ +import assert_lt_json from '../noir_compiled_examples/assert_lt/target/assert_lt.json' assert { type: 'json' }; +import { Noir } from '@noir-lang/noir_js'; +import { CompiledCircuit } from '@noir-lang/types'; +import { expect } from 'chai'; + +const assert_lt_program = assert_lt_json as CompiledCircuit; + +it('returns the return value of the circuit', async () => { + const inputs = { + x: '2', + y: '3', + }; + const { returnValue } = await new Noir(assert_lt_program).execute(inputs); + + expect(returnValue).to.be.eq('0x05'); +}); diff --git a/noir/tooling/noir_js/test/node/smoke.test.ts b/noir/tooling/noir_js/test/node/smoke.test.ts new file mode 100644 index 00000000000..6993a44f66e --- /dev/null +++ b/noir/tooling/noir_js/test/node/smoke.test.ts @@ -0,0 +1,77 @@ +import { expect } from 'chai'; +import assert_lt_json from '../noir_compiled_examples/assert_lt/target/assert_lt.json' assert { type: 'json' }; +import { CompiledCircuit } from '@noir-lang/types'; +import { Noir } from '@noir-lang/noir_js'; + +const assert_lt_program = assert_lt_json as CompiledCircuit; + +it('generates witnesses successfully', async () => { + const inputs = { + x: '2', + y: '3', + }; + expect(() => new Noir(assert_lt_program).execute(inputs)).to.not.throw; +}); + +it('string input and number input are the same', async () => { + const inputsString = { + x: '2', + y: '3', + }; + const inputsNumber = { + x: 2, + y: 3, + }; + const solvedWitnessString = await new Noir(assert_lt_program).execute(inputsString); + const solvedWitnessNumber = await new Noir(assert_lt_program).execute(inputsNumber); + expect(solvedWitnessString).to.deep.equal(solvedWitnessNumber); +}); + +it('string input and number input are the same', async () => { + const inputsString = { + x: '2', + y: '3', + }; + const inputsNumber = { + x: 2, + y: 3, + }; + + const solvedWitnessString = await new Noir(assert_lt_program).execute(inputsString); + const solvedWitnessNumber = await new Noir(assert_lt_program).execute(inputsNumber); + expect(solvedWitnessString).to.deep.equal(solvedWitnessNumber); +}); + +it('0x prefixed string input for inputs will throw', async () => { + const inputsHexPrefix = { + x: '0x2', + y: '0x3', + }; + + try { + await new Noir(assert_lt_program).execute(inputsHexPrefix); + expect.fail('Expected generatedWitness to throw, due to inputs being prefixed with 0x. Currently not supported'); + } catch (error) { + // Successfully errored due to 0x not being supported. Update this test once/if we choose + // to support 0x prefixed inputs. + } +}); + +describe('input validation', () => { + it('x should be a uint64 not a string', async () => { + const inputs = { + x: 'foo', + y: '3', + }; + + try { + await new Noir(assert_lt_program).execute(inputs); + expect.fail('Expected generatedWitness to throw, due to x not being convertible to a uint64'); + } catch (error) { + const knownError = error as Error; + expect(knownError.message).to.equal( + 'Expected witness values to be integers, provided value causes `invalid digit found in string` error', + ); + } + }); +}); diff --git a/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml new file mode 100644 index 00000000000..f32ec18cae7 --- /dev/null +++ b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/Nargo.toml @@ -0,0 +1,5 @@ +[package] +name = "assert_lt" +type = "bin" +authors = [""] +[dependencies] diff --git a/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr new file mode 100644 index 00000000000..0698cbce4a8 --- /dev/null +++ b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/src/main.nr @@ -0,0 +1,4 @@ +fn main(x: u64, y: pub u64) -> pub u64 { + assert(x < y); + x + y +} diff --git a/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/target/assert_lt.json b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/target/assert_lt.json new file mode 100644 index 00000000000..c01b2c5d3f5 --- /dev/null +++ b/noir/tooling/noir_js/test/noir_compiled_examples/assert_lt/target/assert_lt.json @@ -0,0 +1 @@ +{"hash":13834844072603749544,"backend":"acvm-backend-barretenberg","abi":{"parameters":[{"name":"x","type":{"kind":"integer","sign":"unsigned","width":64},"visibility":"private"},{"name":"y","type":{"kind":"integer","sign":"unsigned","width":64},"visibility":"public"}],"param_witnesses":{"x":[{ "start": 1, "end": 2 }],"y":[{ "start": 2, "end": 3 }]},"return_type":{"kind":"integer","sign":"unsigned","width":64},"return_witnesses":[12]},"bytecode":"H4sIAAAAAAAA/+1WUW6DMAx1QksZoGr72jUcAiX8VbvJ0Oj9j7ChJpKbtXw0NpvUWkImUXixn53w3gDgHc6mfh7t/ZGMtR9TU96HeYuHtp36ZjLWfGIzjK7DthsPzjjTue6rcdZOrnX9MA49Dqa1kzl1gz3h2bL7sTDCMhmJbylmTDOT8WEhjXfjH/DcB8u8zwVygWifmL/9lTnWzSWKsxHA3QJf00vlveWvERJIUU4x0eb86aEJppljVox9oO+Py8QTV1Jnw6a85t7vSL8pwvN89j7gd88o8q79Gr2wRt3AeSFz4XvRSyokl5MAtSfgGO2ZCewdsDibLRVrDzIXTMxfqiLIGXPeMdY1gb/Fg8+tznJY50eSGmfB2DNrqciCD+tCRc4X5FNFJmIWnkhu3BL+t4qc8y75aySqIkvGOP9CRWKaGQ0ydUrsgUUVWXlfw4OpyAouVWQN66pITDPDqSJfQaZxuVVkxZhzzVgLTv5uHbDwXhN+vwGywklHPBQAAA=="} \ No newline at end of file diff --git a/noir/tooling/noir_js/test/noir_compiled_examples/readme.md b/noir/tooling/noir_js/test/noir_compiled_examples/readme.md new file mode 100644 index 00000000000..26c571850ae --- /dev/null +++ b/noir/tooling/noir_js/test/noir_compiled_examples/readme.md @@ -0,0 +1,3 @@ +## Why + +While we do not automatically pull the .json files from .artifacts, we have these hard-coded versions of examples. diff --git a/noir/tooling/noir_js/tsc-multi.json b/noir/tooling/noir_js/tsc-multi.json new file mode 100644 index 00000000000..af26d1e4aa6 --- /dev/null +++ b/noir/tooling/noir_js/tsc-multi.json @@ -0,0 +1,7 @@ +{ + "targets": [ + { "extname": ".cjs", "module": "commonjs" }, + { "extname": ".mjs", "module": "esnext" } + ], + "projects": ["packages/*/tsconfig.json"] +} \ No newline at end of file diff --git a/noir/tooling/noir_js/tsconfig.json b/noir/tooling/noir_js/tsconfig.json new file mode 100644 index 00000000000..0dbc5204556 --- /dev/null +++ b/noir/tooling/noir_js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "esnext", + "declaration": true, + "module": "ESNext", + "moduleResolution": "node", + "outDir": "./lib", + "esModuleInterop": true, + "resolveJsonModule": true, + "strict": true, + "noImplicitAny": false, + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules"], + "references": [ + { + "path": "../noir_js_types" + }, + ] +} diff --git a/noir/tooling/noir_js_backend_barretenberg/.eslintignore b/noir/tooling/noir_js_backend_barretenberg/.eslintignore new file mode 100644 index 00000000000..b512c09d476 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/.eslintignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/noir/tooling/noir_js_backend_barretenberg/.eslintrc.cjs b/noir/tooling/noir_js_backend_barretenberg/.eslintrc.cjs new file mode 100644 index 00000000000..33335c2a877 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/.eslintrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + extends: ["../../.eslintrc.js"], +}; diff --git a/noir/tooling/noir_js_backend_barretenberg/.gitignore b/noir/tooling/noir_js_backend_barretenberg/.gitignore new file mode 100644 index 00000000000..689b3ca0701 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/.gitignore @@ -0,0 +1,2 @@ +crs +lib diff --git a/noir/tooling/noir_js_backend_barretenberg/fixup.sh b/noir/tooling/noir_js_backend_barretenberg/fixup.sh new file mode 100755 index 00000000000..80bd7ec71a5 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/fixup.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# Put these package.json files in the cjs and +# mjs directory respectively, so that +# tools can recognise that the .js files are either +# commonjs or ESM files. +self_path=$(dirname "$(readlink -f "$0")") + +cjs_package='{ + "type": "commonjs" +}' + +esm_package='{ + "type": "module" +}' + +echo "$cjs_package" > $self_path/lib/cjs/package.json +echo "$esm_package" > $self_path/lib/esm/package.json \ No newline at end of file diff --git a/noir/tooling/noir_js_backend_barretenberg/package.json b/noir/tooling/noir_js_backend_barretenberg/package.json new file mode 100644 index 00000000000..13c64dc1d65 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/package.json @@ -0,0 +1,47 @@ +{ + "name": "@noir-lang/backend_barretenberg", + "collaborators": [ + "The Noir Team " + ], + "version": "0.19.2", + "packageManager": "yarn@3.5.1", + "license": "(MIT OR Apache-2.0)", + "type": "module", + "source": "src/index.ts", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", + "exports": { + "require": "./lib/cjs/index.js", + "types": "./lib/esm/index.d.ts", + "default": "./lib/esm/index.js" + }, + "types": "lib/esm/index.d.ts", + "files": [ + "lib", + "package.json" + ], + "scripts": { + "dev": "tsc --watch", + "generate:package": "bash ./fixup.sh", + "build": "yarn clean && tsc && tsc -p ./tsconfig.cjs.json && yarn generate:package", + "clean": "rm -rf ./lib", + "prettier": "prettier 'src/**/*.ts'", + "prettier:fix": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" + }, + "dependencies": { + "@aztec/bb.js": "0.12.0", + "@noir-lang/types": "workspace:*", + "fflate": "^0.8.0" + }, + "devDependencies": { + "@types/node": "^20.6.2", + "@types/prettier": "^3", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "prettier": "3.0.3", + "typescript": "5.1.5" + } +} diff --git a/noir/tooling/noir_js_backend_barretenberg/src/base64_decode.ts b/noir/tooling/noir_js_backend_barretenberg/src/base64_decode.ts new file mode 100644 index 00000000000..d53aed187c7 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/src/base64_decode.ts @@ -0,0 +1,13 @@ +// Since this is a simple function, we can use feature detection to +// see if we are in the nodeJs environment or the browser environment. +export function base64Decode(input: string): Uint8Array { + if (typeof Buffer !== 'undefined') { + // Node.js environment + return Buffer.from(input, 'base64'); + } else if (typeof atob === 'function') { + // Browser environment + return Uint8Array.from(atob(input), (c) => c.charCodeAt(0)); + } else { + throw new Error('No implementation found for base64 decoding.'); + } +} diff --git a/noir/tooling/noir_js_backend_barretenberg/src/index.ts b/noir/tooling/noir_js_backend_barretenberg/src/index.ts new file mode 100644 index 00000000000..820cda93c83 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/src/index.ts @@ -0,0 +1,210 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { decompressSync as gunzip } from 'fflate'; +import { acirToUint8Array } from './serialize.js'; +import { Backend, CompiledCircuit, ProofData } from '@noir-lang/types'; +import { BackendOptions } from './types.js'; + +// This is the number of bytes in a UltraPlonk proof +// minus the public inputs. +const numBytesInProofWithoutPublicInputs: number = 2144; + +export class BarretenbergBackend implements Backend { + // These type assertions are used so that we don't + // have to initialize `api` and `acirComposer` in the constructor. + // These are initialized asynchronously in the `init` function, + // constructors cannot be asynchronous which is why we do this. + private api: any; + private acirComposer: any; + private acirUncompressedBytecode: Uint8Array; + + constructor( + acirCircuit: CompiledCircuit, + private options: BackendOptions = { threads: 1 }, + ) { + const acirBytecodeBase64 = acirCircuit.bytecode; + this.acirUncompressedBytecode = acirToUint8Array(acirBytecodeBase64); + } + + /** @ignore */ + async instantiate(): Promise { + if (!this.api) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + //@ts-ignore + const { Barretenberg, RawBuffer, Crs } = await import('@aztec/bb.js'); + const api = await Barretenberg.new(this.options.threads); + + const [_exact, _total, subgroupSize] = await api.acirGetCircuitSizes(this.acirUncompressedBytecode); + const crs = await Crs.new(subgroupSize + 1); + await api.commonInitSlabAllocator(subgroupSize); + await api.srsInitSrs(new RawBuffer(crs.getG1Data()), crs.numPoints, new RawBuffer(crs.getG2Data())); + + this.acirComposer = await api.acirNewAcirComposer(subgroupSize); + await api.acirInitProvingKey(this.acirComposer, this.acirUncompressedBytecode); + this.api = api; + } + } + + // Generate an outer proof. This is the proof for the circuit which will verify + // inner proofs and or can be seen as the proof created for regular circuits. + // + // The settings for this proof are the same as the settings for a "normal" proof + // ie one that is not in the recursive setting. + async generateFinalProof(decompressedWitness: Uint8Array): Promise { + const makeEasyToVerifyInCircuit = false; + return this.generateProof(decompressedWitness, makeEasyToVerifyInCircuit); + } + + // Generates an inner proof. This is the proof that will be verified + // in another circuit. + // + // This is sometimes referred to as a recursive proof. + // We avoid this terminology as the only property of this proof + // that matters, is the fact that it is easy to verify in another + // circuit. We _could_ choose to verify this proof in the CLI. + // + // We set `makeEasyToVerifyInCircuit` to true, which will tell the backend to + // generate the proof using components that will make the proof + // easier to verify in a circuit. + + /** + * + * @example + * ```typescript + * const intermediateProof = await backend.generateIntermediateProof(witness); + * ``` + */ + async generateIntermediateProof(witness: Uint8Array): Promise { + const makeEasyToVerifyInCircuit = true; + return this.generateProof(witness, makeEasyToVerifyInCircuit); + } + + /** @ignore */ + async generateProof(compressedWitness: Uint8Array, makeEasyToVerifyInCircuit: boolean): Promise { + await this.instantiate(); + const proofWithPublicInputs = await this.api.acirCreateProof( + this.acirComposer, + this.acirUncompressedBytecode, + gunzip(compressedWitness), + makeEasyToVerifyInCircuit, + ); + + const splitIndex = proofWithPublicInputs.length - numBytesInProofWithoutPublicInputs; + + const publicInputsConcatenated = proofWithPublicInputs.slice(0, splitIndex); + + const publicInputSize = 32; + const publicInputs: Uint8Array[] = []; + + for (let i = 0; i < publicInputsConcatenated.length; i += publicInputSize) { + const publicInput = publicInputsConcatenated.slice(i, i + publicInputSize); + publicInputs.push(publicInput); + } + + const proof = proofWithPublicInputs.slice(splitIndex); + + return { proof, publicInputs }; + } + + // Generates artifacts that will be passed to a circuit that will verify this proof. + // + // Instead of passing the proof and verification key as a byte array, we pass them + // as fields which makes it cheaper to verify in a circuit. + // + // The proof that is passed here will have been created using the `generateInnerProof` + // method. + // + // The number of public inputs denotes how many public inputs are in the inner proof. + + /** + * + * @example + * ```typescript + * const artifacts = await backend.generateIntermediateProofArtifacts(proof, numOfPublicInputs); + * ``` + */ + async generateIntermediateProofArtifacts( + proofData: ProofData, + numOfPublicInputs = 0, + ): Promise<{ + proofAsFields: string[]; + vkAsFields: string[]; + vkHash: string; + }> { + await this.instantiate(); + const proof = reconstructProofWithPublicInputs(proofData); + const proofAsFields = await this.api.acirSerializeProofIntoFields(this.acirComposer, proof, numOfPublicInputs); + + // TODO: perhaps we should put this in the init function. Need to benchmark + // TODO how long it takes. + await this.api.acirInitVerificationKey(this.acirComposer); + + // Note: If you don't init verification key, `acirSerializeVerificationKeyIntoFields`` will just hang on serialization + const vk = await this.api.acirSerializeVerificationKeyIntoFields(this.acirComposer); + + return { + proofAsFields: proofAsFields.map((p) => p.toString()), + vkAsFields: vk[0].map((vk) => vk.toString()), + vkHash: vk[1].toString(), + }; + } + + async verifyFinalProof(proofData: ProofData): Promise { + const proof = reconstructProofWithPublicInputs(proofData); + const makeEasyToVerifyInCircuit = false; + const verified = await this.verifyProof(proof, makeEasyToVerifyInCircuit); + return verified; + } + + /** + * + * @example + * ```typescript + * const isValidIntermediate = await backend.verifyIntermediateProof(proof); + * ``` + */ + async verifyIntermediateProof(proofData: ProofData): Promise { + const proof = reconstructProofWithPublicInputs(proofData); + const makeEasyToVerifyInCircuit = true; + return this.verifyProof(proof, makeEasyToVerifyInCircuit); + } + + /** @ignore */ + async verifyProof(proof: Uint8Array, makeEasyToVerifyInCircuit: boolean): Promise { + await this.instantiate(); + await this.api.acirInitVerificationKey(this.acirComposer); + return await this.api.acirVerifyProof(this.acirComposer, proof, makeEasyToVerifyInCircuit); + } + + async destroy(): Promise { + if (!this.api) { + return; + } + await this.api.destroy(); + } +} + +function reconstructProofWithPublicInputs(proofData: ProofData): Uint8Array { + // Flatten publicInputs + const publicInputsConcatenated = flattenUint8Arrays(proofData.publicInputs); + + // Concatenate publicInputs and proof + const proofWithPublicInputs = Uint8Array.from([...publicInputsConcatenated, ...proofData.proof]); + + return proofWithPublicInputs; +} + +function flattenUint8Arrays(arrays: Uint8Array[]): Uint8Array { + const totalLength = arrays.reduce((acc, val) => acc + val.length, 0); + const result = new Uint8Array(totalLength); + + let offset = 0; + for (const arr of arrays) { + result.set(arr, offset); + offset += arr.length; + } + + return result; +} + +// typedoc exports +export { Backend, BackendOptions, CompiledCircuit, ProofData }; diff --git a/noir/tooling/noir_js_backend_barretenberg/src/serialize.ts b/noir/tooling/noir_js_backend_barretenberg/src/serialize.ts new file mode 100644 index 00000000000..b15931848a0 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/src/serialize.ts @@ -0,0 +1,8 @@ +import { decompressSync as gunzip } from 'fflate'; +import { base64Decode } from './base64_decode.js'; + +// Converts bytecode from a base64 string to a Uint8Array +export function acirToUint8Array(base64EncodedBytecode: string): Uint8Array { + const compressedByteCode = base64Decode(base64EncodedBytecode); + return gunzip(compressedByteCode); +} diff --git a/noir/tooling/noir_js_backend_barretenberg/src/types.ts b/noir/tooling/noir_js_backend_barretenberg/src/types.ts new file mode 100644 index 00000000000..041e36fdf91 --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/src/types.ts @@ -0,0 +1,8 @@ +/** + * @description + * An options object, currently only used to specify the number of threads to use. + */ +export type BackendOptions = { + /** @description Number of threads */ + threads: number; +}; diff --git a/noir/tooling/noir_js_backend_barretenberg/tsconfig.cjs.json b/noir/tooling/noir_js_backend_barretenberg/tsconfig.cjs.json new file mode 100644 index 00000000000..15d273af62e --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "CommonJS", + "outDir": "./lib/cjs" + }, +} diff --git a/noir/tooling/noir_js_backend_barretenberg/tsconfig.json b/noir/tooling/noir_js_backend_barretenberg/tsconfig.json new file mode 100644 index 00000000000..1e28c044bba --- /dev/null +++ b/noir/tooling/noir_js_backend_barretenberg/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "esnext", + "declaration": true, + "emitDeclarationOnly": false, + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./lib/esm", + "esModuleInterop": true, + "resolveJsonModule": true, + "strict": true, + "noImplicitAny": false, + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules"], + "references": [ + { + "path": "../noir_js_types" + } + ] +} diff --git a/noir/tooling/noir_js_types/.eslintignore b/noir/tooling/noir_js_types/.eslintignore new file mode 100644 index 00000000000..3c3629e647f --- /dev/null +++ b/noir/tooling/noir_js_types/.eslintignore @@ -0,0 +1 @@ +node_modules diff --git a/noir/tooling/noir_js_types/.eslintrc.cjs b/noir/tooling/noir_js_types/.eslintrc.cjs new file mode 100644 index 00000000000..5a2cc7f1ec0 --- /dev/null +++ b/noir/tooling/noir_js_types/.eslintrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + extends: ['../../.eslintrc.js'], +}; diff --git a/noir/tooling/noir_js_types/.gitignore b/noir/tooling/noir_js_types/.gitignore new file mode 100644 index 00000000000..e92523b6247 --- /dev/null +++ b/noir/tooling/noir_js_types/.gitignore @@ -0,0 +1,3 @@ +lib + +*.tsbuildinfo diff --git a/noir/tooling/noir_js_types/.prettierrc b/noir/tooling/noir_js_types/.prettierrc new file mode 100644 index 00000000000..ef937f9697a --- /dev/null +++ b/noir/tooling/noir_js_types/.prettierrc @@ -0,0 +1,6 @@ +{ + "parser": "typescript", + "printWidth": 120, + "singleQuote": true, + "trailingComma": "all" +} \ No newline at end of file diff --git a/noir/tooling/noir_js_types/package.json b/noir/tooling/noir_js_types/package.json new file mode 100644 index 00000000000..3d74d335162 --- /dev/null +++ b/noir/tooling/noir_js_types/package.json @@ -0,0 +1,41 @@ +{ + "name": "@noir-lang/types", + "collaborators": [ + "The Noir Team " + ], + "packageManager": "yarn@3.5.1", + "version": "0.19.2", + "license": "(MIT OR Apache-2.0)", + "files": [ + "lib", + "package.json" + ], + "main": "lib/cjs/types.js", + "module": "lib/esm/types.js", + "types": "lib/esm/types.d.ts", + "scripts": { + "build:esm": "tsc", + "build:cjs": "tsc --module CommonJS --outDir lib/cjs", + "build": "yarn run build:cjs && yarn run build:esm", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0" + }, + "exports": { + ".": { + "import": "./lib/esm/types.js", + "require": "./lib/cjs/types.js", + "types": "./lib/esm/types.d.ts" + } + }, + "dependencies": { + "@noir-lang/noirc_abi": "workspace:*" + }, + "devDependencies": { + "@types/prettier": "^3", + "eslint": "^8.50.0", + "eslint-plugin-prettier": "^5.0.0", + "prettier": "3.0.3", + "typescript": "^5.2.2" + } +} diff --git a/noir/tooling/noir_js_types/src/types.ts b/noir/tooling/noir_js_types/src/types.ts new file mode 100644 index 00000000000..5ed6b1721e9 --- /dev/null +++ b/noir/tooling/noir_js_types/src/types.ts @@ -0,0 +1,60 @@ +import { Abi } from '@noir-lang/noirc_abi'; + +export interface Backend { + /** + * @description Generates a final proof (not meant to be verified in another circuit) */ + generateFinalProof(decompressedWitness: Uint8Array): Promise; + + /** + * @description Generates an intermediate proof (meant to be verified in another circuit) */ + generateIntermediateProof(decompressedWitness: Uint8Array): Promise; + + /** + * + * @description Retrieves the artifacts from a proof in the Field format + */ + generateIntermediateProofArtifacts( + proofData: ProofData, + numOfPublicInputs: number, + ): Promise<{ + /** @description An array of Fields containing the proof */ + proofAsFields: string[]; + /** @description An array of Fields containing the verification key */ + vkAsFields: string[]; + /** @description A Field containing the verification key hash */ + vkHash: string; + }>; + + /** + * @description Verifies a final proof */ + verifyFinalProof(proofData: ProofData): Promise; + + /** @description Verifies an intermediate proof */ + verifyIntermediateProof(proofData: ProofData): Promise; + + /** + * @description Destroys the backend */ + destroy(): Promise; +} + +/** + * @description + * The representation of a proof + * */ +export type ProofData = { + /** @description Public inputs of a proof */ + publicInputs: Uint8Array[]; + /** @description An byte array representing the proof */ + proof: Uint8Array; +}; + +/** + * @description + * The representation of a compiled circuit + * */ +export type CompiledCircuit = { + /** @description The bytecode of the circuit */ + bytecode: string; + /** @description ABI representation of the circuit */ + abi: Abi; +}; diff --git a/noir/tooling/noir_js_types/tsconfig.json b/noir/tooling/noir_js_types/tsconfig.json new file mode 100644 index 00000000000..0d5441cc5a2 --- /dev/null +++ b/noir/tooling/noir_js_types/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "module": "ESNext", + "moduleResolution": "node", + "outDir": "lib/esm", + "target": "ES2020", + "rootDir": "./src", + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/noir/tooling/noirc_abi/Cargo.toml b/noir/tooling/noirc_abi/Cargo.toml new file mode 100644 index 00000000000..b7fe1ef8084 --- /dev/null +++ b/noir/tooling/noirc_abi/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "noirc_abi" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +acvm.workspace = true +iter-extended.workspace = true +noirc_frontend.workspace = true +toml.workspace = true +serde_json = "1.0" +serde.workspace = true +thiserror.workspace = true +num-bigint = "0.4" +num-traits = "0.2" + +[dev-dependencies] +strum = "0.24" +strum_macros = "0.24" diff --git a/noir/tooling/noirc_abi/src/errors.rs b/noir/tooling/noirc_abi/src/errors.rs new file mode 100644 index 00000000000..687fecfcc1d --- /dev/null +++ b/noir/tooling/noirc_abi/src/errors.rs @@ -0,0 +1,55 @@ +use crate::{input_parser::InputValue, AbiParameter, AbiType}; +use acvm::acir::native_types::Witness; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum InputParserError { + #[error("input file is badly formed, could not parse, {0}")] + ParseInputMap(String), + #[error("Expected witness values to be integers, provided value causes `{0}` error")] + ParseStr(String), + #[error("Could not parse hex value {0}")] + ParseHexStr(String), + #[error("cannot parse value into {0:?}")] + AbiTypeMismatch(AbiType), + #[error("Expected argument `{0}`, but none was found")] + MissingArgument(String), +} + +impl From for InputParserError { + fn from(err: toml::ser::Error) -> Self { + Self::ParseInputMap(err.to_string()) + } +} + +impl From for InputParserError { + fn from(err: toml::de::Error) -> Self { + Self::ParseInputMap(err.to_string()) + } +} + +impl From for InputParserError { + fn from(err: serde_json::Error) -> Self { + Self::ParseInputMap(err.to_string()) + } +} + +#[derive(Debug, Error)] +pub enum AbiError { + #[error("Received parameters not expected by ABI: {0:?}")] + UnexpectedParams(Vec), + #[error("The parameter {} is expected to be a {:?} but found incompatible value {value:?}", .param.name, .param.typ)] + TypeMismatch { param: AbiParameter, value: InputValue }, + #[error("ABI expects the parameter `{0}`, but this was not found")] + MissingParam(String), + #[error( + "Could not read witness value at index {witness_index:?} (required for parameter \"{name}\")" + )] + MissingParamWitnessValue { name: String, witness_index: Witness }, + #[error("Attempted to write to witness index {0:?} but it is already initialized to a different value")] + InconsistentWitnessAssignment(Witness), + #[error("The return value is expected to be a {return_type:?} but found incompatible value {value:?}")] + ReturnTypeMismatch { return_type: AbiType, value: InputValue }, + #[error("No return value is expected but received {0:?}")] + UnexpectedReturnValue(InputValue), +} diff --git a/noir/tooling/noirc_abi/src/input_parser/json.rs b/noir/tooling/noirc_abi/src/input_parser/json.rs new file mode 100644 index 00000000000..e2b1a83ee6b --- /dev/null +++ b/noir/tooling/noirc_abi/src/input_parser/json.rs @@ -0,0 +1,191 @@ +use super::{parse_str_to_field, InputValue}; +use crate::{errors::InputParserError, Abi, AbiType, MAIN_RETURN_NAME}; +use acvm::FieldElement; +use iter_extended::{try_btree_map, try_vecmap}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +pub(crate) fn parse_json( + input_string: &str, + abi: &Abi, +) -> Result, InputParserError> { + // Parse input.json into a BTreeMap. + let data: BTreeMap = serde_json::from_str(input_string)?; + + // Convert arguments to field elements. + let mut parsed_inputs = try_btree_map(abi.to_btree_map(), |(arg_name, abi_type)| { + // Check that json contains a value for each argument in the ABI. + let value = data + .get(&arg_name) + .ok_or_else(|| InputParserError::MissingArgument(arg_name.clone()))?; + + InputValue::try_from_json(value.clone(), &abi_type, &arg_name) + .map(|input_value| (arg_name, input_value)) + })?; + + // If the json file also includes a return value then we parse it as well. + // This isn't required as the prover calculates the return value itself. + if let (Some(return_type), Some(json_return_value)) = + (&abi.return_type, data.get(MAIN_RETURN_NAME)) + { + let return_value = + InputValue::try_from_json(json_return_value.clone(), return_type, MAIN_RETURN_NAME)?; + parsed_inputs.insert(MAIN_RETURN_NAME.to_owned(), return_value); + } + + Ok(parsed_inputs) +} + +pub(crate) fn serialize_to_json( + input_map: &BTreeMap, + abi: &Abi, +) -> Result { + let mut json_map = try_btree_map(abi.to_btree_map(), |(key, param_type)| { + JsonTypes::try_from_input_value(&input_map[&key], ¶m_type) + .map(|value| (key.to_owned(), value)) + })?; + + if let (Some(return_type), Some(return_value)) = + (&abi.return_type, input_map.get(MAIN_RETURN_NAME)) + { + let return_value = JsonTypes::try_from_input_value(return_value, return_type)?; + json_map.insert(MAIN_RETURN_NAME.to_owned(), return_value); + } + + let json_string = serde_json::to_string(&json_map)?; + + Ok(json_string) +} + +#[derive(Debug, Deserialize, Serialize, Clone)] +#[serde(untagged)] +pub enum JsonTypes { + // This is most likely going to be a hex string + // But it is possible to support UTF-8 + String(String), + // Just a regular integer, that can fit in 64 bits. + // + // The JSON spec does not specify any limit on the size of integer number types, + // however we restrict the allowable size. Values which do not fit in a u64 should be passed + // as a string. + Integer(u64), + // Simple boolean flag + Bool(bool), + // Array of JsonTypes + Array(Vec), + // Struct of JsonTypes + Table(BTreeMap), +} + +impl JsonTypes { + pub fn try_from_input_value( + value: &InputValue, + abi_type: &AbiType, + ) -> Result { + let json_value = match (value, abi_type) { + (InputValue::Field(f), AbiType::Field | AbiType::Integer { .. }) => { + JsonTypes::String(Self::format_field_string(*f)) + } + (InputValue::Field(f), AbiType::Boolean) => JsonTypes::Bool(f.is_one()), + + (InputValue::Vec(vector), AbiType::Array { typ, .. }) => { + let array = + try_vecmap(vector, |value| JsonTypes::try_from_input_value(value, typ))?; + JsonTypes::Array(array) + } + + (InputValue::String(s), AbiType::String { .. }) => JsonTypes::String(s.to_string()), + + (InputValue::Struct(map), AbiType::Struct { fields, .. }) => { + let map_with_json_types = try_btree_map(fields, |(key, field_type)| { + JsonTypes::try_from_input_value(&map[key], field_type) + .map(|json_value| (key.to_owned(), json_value)) + })?; + JsonTypes::Table(map_with_json_types) + } + + (InputValue::Vec(vector), AbiType::Tuple { fields }) => { + let fields = try_vecmap(vector.iter().zip(fields), |(value, typ)| { + JsonTypes::try_from_input_value(value, typ) + })?; + JsonTypes::Array(fields) + } + + _ => return Err(InputParserError::AbiTypeMismatch(abi_type.clone())), + }; + Ok(json_value) + } + + /// This trims any leading zeroes. + /// A singular '0' will be prepended as well if the trimmed string has an odd length. + /// A hex string's length needs to be even to decode into bytes, as two digits correspond to + /// one byte. + fn format_field_string(field: FieldElement) -> String { + if field.is_zero() { + return "0x00".to_owned(); + } + let mut trimmed_field = field.to_hex().trim_start_matches('0').to_owned(); + if trimmed_field.len() % 2 != 0 { + trimmed_field = "0".to_owned() + &trimmed_field; + } + "0x".to_owned() + &trimmed_field + } +} + +impl InputValue { + pub fn try_from_json( + value: JsonTypes, + param_type: &AbiType, + arg_name: &str, + ) -> Result { + let input_value = match (value, param_type) { + (JsonTypes::String(string), AbiType::String { .. }) => InputValue::String(string), + ( + JsonTypes::String(string), + AbiType::Field | AbiType::Integer { .. } | AbiType::Boolean, + ) => InputValue::Field(parse_str_to_field(&string)?), + + ( + JsonTypes::Integer(integer), + AbiType::Field | AbiType::Integer { .. } | AbiType::Boolean, + ) => { + let new_value = FieldElement::from(i128::from(integer)); + + InputValue::Field(new_value) + } + + (JsonTypes::Bool(boolean), AbiType::Boolean) => InputValue::Field(boolean.into()), + + (JsonTypes::Array(array), AbiType::Array { typ, .. }) => { + let array_elements = + try_vecmap(array, |value| InputValue::try_from_json(value, typ, arg_name))?; + InputValue::Vec(array_elements) + } + + (JsonTypes::Table(table), AbiType::Struct { fields, .. }) => { + let native_table = try_btree_map(fields, |(field_name, abi_type)| { + // Check that json contains a value for each field of the struct. + let field_id = format!("{arg_name}.{field_name}"); + let value = table + .get(field_name) + .ok_or_else(|| InputParserError::MissingArgument(field_id.clone()))?; + InputValue::try_from_json(value.clone(), abi_type, &field_id) + .map(|input_value| (field_name.to_string(), input_value)) + })?; + + InputValue::Struct(native_table) + } + + (JsonTypes::Array(array), AbiType::Tuple { fields }) => { + let tuple_fields = try_vecmap(array.into_iter().zip(fields), |(value, typ)| { + InputValue::try_from_json(value, typ, arg_name) + })?; + InputValue::Vec(tuple_fields) + } + + (_, _) => return Err(InputParserError::AbiTypeMismatch(param_type.clone())), + }; + + Ok(input_value) + } +} diff --git a/noir/tooling/noirc_abi/src/input_parser/mod.rs b/noir/tooling/noirc_abi/src/input_parser/mod.rs new file mode 100644 index 00000000000..7bbcb42296c --- /dev/null +++ b/noir/tooling/noirc_abi/src/input_parser/mod.rs @@ -0,0 +1,299 @@ +use num_bigint::{BigInt, BigUint}; +use num_traits::{Num, Zero}; +use std::collections::BTreeMap; + +use acvm::FieldElement; +use serde::Serialize; + +use crate::errors::InputParserError; +use crate::{Abi, AbiType}; + +pub mod json; +mod toml; + +/// This is what all formats eventually transform into +/// For example, a toml file will parse into TomlTypes +/// and those TomlTypes will be mapped to Value +#[derive(Debug, Clone, Serialize, PartialEq)] +pub enum InputValue { + Field(FieldElement), + String(String), + Vec(Vec), + Struct(BTreeMap), +} + +impl InputValue { + /// Checks whether the ABI type matches the InputValue type + /// and also their arity + pub fn matches_abi(&self, abi_param: &AbiType) -> bool { + match (self, abi_param) { + (InputValue::Field(_), AbiType::Field) => true, + (InputValue::Field(field_element), AbiType::Integer { width, .. }) => { + field_element.num_bits() <= *width + } + (InputValue::Field(field_element), AbiType::Boolean) => { + field_element.is_one() || field_element.is_zero() + } + + (InputValue::Vec(array_elements), AbiType::Array { length, typ, .. }) => { + if array_elements.len() != *length as usize { + return false; + } + // Check that all of the array's elements' values match the ABI as well. + array_elements.iter().all(|input_value| input_value.matches_abi(typ)) + } + + (InputValue::String(string), AbiType::String { length }) => { + string.len() == *length as usize + } + + (InputValue::Struct(map), AbiType::Struct { fields, .. }) => { + if map.len() != fields.len() { + return false; + } + + let field_types = BTreeMap::from_iter(fields.iter().cloned()); + + // Check that all of the struct's fields' values match the ABI as well. + map.iter().all(|(field_name, field_value)| { + if let Some(field_type) = field_types.get(field_name) { + field_value.matches_abi(field_type) + } else { + false + } + }) + } + + (InputValue::Vec(vec_elements), AbiType::Tuple { fields }) => { + if vec_elements.len() != fields.len() { + return false; + } + + vec_elements + .iter() + .zip(fields) + .all(|(input_value, abi_param)| input_value.matches_abi(abi_param)) + } + + // All other InputValue-AbiType combinations are fundamentally incompatible. + _ => false, + } + } +} + +/// The different formats that are supported when parsing +/// the initial witness values +#[cfg_attr(test, derive(strum_macros::EnumIter))] +pub enum Format { + Json, + Toml, +} + +impl Format { + pub fn ext(&self) -> &'static str { + match self { + Format::Json => "json", + Format::Toml => "toml", + } + } +} + +impl Format { + pub fn parse( + &self, + input_string: &str, + abi: &Abi, + ) -> Result, InputParserError> { + match self { + Format::Json => json::parse_json(input_string, abi), + Format::Toml => toml::parse_toml(input_string, abi), + } + } + + pub fn serialize( + &self, + input_map: &BTreeMap, + abi: &Abi, + ) -> Result { + match self { + Format::Json => json::serialize_to_json(input_map, abi), + Format::Toml => toml::serialize_to_toml(input_map, abi), + } + } +} + +#[cfg(test)] +mod serialization_tests { + use std::collections::BTreeMap; + + use acvm::FieldElement; + use strum::IntoEnumIterator; + + use crate::{ + input_parser::InputValue, Abi, AbiParameter, AbiType, AbiVisibility, Sign, MAIN_RETURN_NAME, + }; + + use super::Format; + + #[test] + fn serialization_round_trip() { + let abi = Abi { + parameters: vec![ + AbiParameter { + name: "foo".into(), + typ: AbiType::Field, + visibility: AbiVisibility::Private, + }, + AbiParameter { + name: "bar".into(), + typ: AbiType::Struct { + path: "MyStruct".into(), + fields: vec![ + ("field1".into(), AbiType::Integer { sign: Sign::Unsigned, width: 8 }), + ( + "field2".into(), + AbiType::Array { length: 2, typ: Box::new(AbiType::Boolean) }, + ), + ], + }, + visibility: AbiVisibility::Private, + }, + ], + return_type: Some(AbiType::String { length: 5 }), + // These two fields are unused when serializing/deserializing to file. + param_witnesses: BTreeMap::new(), + return_witnesses: Vec::new(), + }; + + let input_map: BTreeMap = BTreeMap::from([ + ("foo".into(), InputValue::Field(FieldElement::one())), + ( + "bar".into(), + InputValue::Struct(BTreeMap::from([ + ("field1".into(), InputValue::Field(255u128.into())), + ( + "field2".into(), + InputValue::Vec(vec![ + InputValue::Field(true.into()), + InputValue::Field(false.into()), + ]), + ), + ])), + ), + (MAIN_RETURN_NAME.into(), InputValue::String("hello".to_owned())), + ]); + + for format in Format::iter() { + let serialized_inputs = format.serialize(&input_map, &abi).unwrap(); + + let reconstructed_input_map = format.parse(&serialized_inputs, &abi).unwrap(); + + assert_eq!(input_map, reconstructed_input_map); + } + } +} + +fn parse_str_to_field(value: &str) -> Result { + let big_num = if let Some(hex) = value.strip_prefix("0x") { + BigUint::from_str_radix(hex, 16) + } else { + BigUint::from_str_radix(value, 10) + }; + big_num.map_err(|err_msg| InputParserError::ParseStr(err_msg.to_string())).and_then(|bigint| { + if bigint < FieldElement::modulus() { + Ok(field_from_big_uint(bigint)) + } else { + Err(InputParserError::ParseStr(format!( + "Input exceeds field modulus. Values must fall within [0, {})", + FieldElement::modulus(), + ))) + } + }) +} + +fn parse_str_to_signed(value: &str, witdh: u32) -> Result { + let big_num = if let Some(hex) = value.strip_prefix("0x") { + BigInt::from_str_radix(hex, 16) + } else { + BigInt::from_str_radix(value, 10) + }; + + big_num.map_err(|err_msg| InputParserError::ParseStr(err_msg.to_string())).and_then(|bigint| { + let modulus: BigInt = FieldElement::modulus().into(); + let bigint = if bigint.sign() == num_bigint::Sign::Minus { + BigInt::from(2).pow(witdh) + bigint + } else { + bigint + }; + if bigint.is_zero() || (bigint.sign() == num_bigint::Sign::Plus && bigint < modulus) { + Ok(field_from_big_int(bigint)) + } else { + Err(InputParserError::ParseStr(format!( + "Input exceeds field modulus. Values must fall within [0, {})", + FieldElement::modulus(), + ))) + } + }) +} + +fn field_from_big_uint(bigint: BigUint) -> FieldElement { + FieldElement::from_be_bytes_reduce(&bigint.to_bytes_be()) +} + +fn field_from_big_int(bigint: BigInt) -> FieldElement { + match bigint.sign() { + num_bigint::Sign::Minus => { + unreachable!( + "Unsupported negative value; it should only be called with a positive value" + ) + } + num_bigint::Sign::NoSign => FieldElement::zero(), + num_bigint::Sign::Plus => FieldElement::from_be_bytes_reduce(&bigint.to_bytes_be().1), + } +} + +#[cfg(test)] +mod test { + use acvm::FieldElement; + use num_bigint::BigUint; + + use super::parse_str_to_field; + + fn big_uint_from_field(field: FieldElement) -> BigUint { + BigUint::from_bytes_be(&field.to_be_bytes()) + } + + #[test] + fn parse_empty_str_fails() { + // Check that this fails appropriately rather than being treated as 0, etc. + assert!(parse_str_to_field("").is_err()); + } + + #[test] + fn parse_fields_from_strings() { + let fields = vec![ + FieldElement::zero(), + FieldElement::one(), + FieldElement::from(u128::MAX) + FieldElement::one(), + // Equivalent to `FieldElement::modulus() - 1` + -FieldElement::one(), + ]; + + for field in fields { + let hex_field = format!("0x{}", field.to_hex()); + let field_from_hex = parse_str_to_field(&hex_field).unwrap(); + assert_eq!(field_from_hex, field); + + let dec_field = big_uint_from_field(field).to_string(); + let field_from_dec = parse_str_to_field(&dec_field).unwrap(); + assert_eq!(field_from_dec, field); + } + } + + #[test] + fn rejects_noncanonical_fields() { + let noncanonical_field = FieldElement::modulus().to_string(); + let parsed_field = parse_str_to_field(&noncanonical_field); + println!("{parsed_field:?}"); + } +} diff --git a/noir/tooling/noirc_abi/src/input_parser/toml.rs b/noir/tooling/noirc_abi/src/input_parser/toml.rs new file mode 100644 index 00000000000..645b59b00cd --- /dev/null +++ b/noir/tooling/noirc_abi/src/input_parser/toml.rs @@ -0,0 +1,178 @@ +use super::{parse_str_to_field, parse_str_to_signed, InputValue}; +use crate::{errors::InputParserError, Abi, AbiType, MAIN_RETURN_NAME}; +use acvm::FieldElement; +use iter_extended::{try_btree_map, try_vecmap}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +pub(crate) fn parse_toml( + input_string: &str, + abi: &Abi, +) -> Result, InputParserError> { + // Parse input.toml into a BTreeMap. + let data: BTreeMap = toml::from_str(input_string)?; + + // Convert arguments to field elements. + let mut parsed_inputs = try_btree_map(abi.to_btree_map(), |(arg_name, abi_type)| { + // Check that toml contains a value for each argument in the ABI. + let value = data + .get(&arg_name) + .ok_or_else(|| InputParserError::MissingArgument(arg_name.clone()))?; + + InputValue::try_from_toml(value.clone(), &abi_type, &arg_name) + .map(|input_value| (arg_name, input_value)) + })?; + + // If the toml file also includes a return value then we parse it as well. + // This isn't required as the prover calculates the return value itself. + if let (Some(return_type), Some(toml_return_value)) = + (&abi.return_type, data.get(MAIN_RETURN_NAME)) + { + let return_value = + InputValue::try_from_toml(toml_return_value.clone(), return_type, MAIN_RETURN_NAME)?; + parsed_inputs.insert(MAIN_RETURN_NAME.to_owned(), return_value); + } + + Ok(parsed_inputs) +} + +pub(crate) fn serialize_to_toml( + input_map: &BTreeMap, + abi: &Abi, +) -> Result { + let mut toml_map = try_btree_map(abi.to_btree_map(), |(key, param_type)| { + TomlTypes::try_from_input_value(&input_map[&key], ¶m_type) + .map(|toml_value| (key.clone(), toml_value)) + })?; + + if let (Some(return_type), Some(return_value)) = + (&abi.return_type, input_map.get(MAIN_RETURN_NAME)) + { + let return_value = TomlTypes::try_from_input_value(return_value, return_type)?; + toml_map.insert(MAIN_RETURN_NAME.to_owned(), return_value); + } + + let toml_string = toml::to_string(&toml_map)?; + + Ok(toml_string) +} + +#[derive(Debug, Deserialize, Serialize, Clone)] +#[serde(untagged)] +enum TomlTypes { + // This is most likely going to be a hex string + // But it is possible to support UTF-8 + String(String), + // Just a regular integer, that can fit in 64 bits + // Note that the toml spec specifies that all numbers are represented as `i64`s. + Integer(u64), + // Simple boolean flag + Bool(bool), + // Array of TomlTypes + Array(Vec), + // Struct of TomlTypes + Table(BTreeMap), +} + +impl TomlTypes { + fn try_from_input_value( + value: &InputValue, + abi_type: &AbiType, + ) -> Result { + let toml_value = match (value, abi_type) { + (InputValue::Field(f), AbiType::Field | AbiType::Integer { .. }) => { + let f_str = format!("0x{}", f.to_hex()); + TomlTypes::String(f_str) + } + (InputValue::Field(f), AbiType::Boolean) => TomlTypes::Bool(f.is_one()), + + (InputValue::Vec(vector), AbiType::Array { typ, .. }) => { + let array = + try_vecmap(vector, |value| TomlTypes::try_from_input_value(value, typ))?; + TomlTypes::Array(array) + } + + (InputValue::String(s), AbiType::String { .. }) => TomlTypes::String(s.to_string()), + + (InputValue::Struct(map), AbiType::Struct { fields, .. }) => { + let map_with_toml_types = try_btree_map(fields, |(key, field_type)| { + TomlTypes::try_from_input_value(&map[key], field_type) + .map(|toml_value| (key.to_owned(), toml_value)) + })?; + TomlTypes::Table(map_with_toml_types) + } + + (InputValue::Vec(vector), AbiType::Tuple { fields }) => { + let fields = try_vecmap(vector.iter().zip(fields), |(value, typ)| { + TomlTypes::try_from_input_value(value, typ) + })?; + TomlTypes::Array(fields) + } + + _ => return Err(InputParserError::AbiTypeMismatch(abi_type.clone())), + }; + Ok(toml_value) + } +} + +impl InputValue { + fn try_from_toml( + value: TomlTypes, + param_type: &AbiType, + arg_name: &str, + ) -> Result { + let input_value = match (value, param_type) { + (TomlTypes::String(string), AbiType::String { .. }) => InputValue::String(string), + ( + TomlTypes::String(string), + AbiType::Field + | AbiType::Integer { sign: crate::Sign::Unsigned, .. } + | AbiType::Boolean, + ) => InputValue::Field(parse_str_to_field(&string)?), + (TomlTypes::String(string), AbiType::Integer { sign: crate::Sign::Signed, width }) => { + InputValue::Field(parse_str_to_signed(&string, *width)?) + } + ( + TomlTypes::Integer(integer), + AbiType::Field | AbiType::Integer { .. } | AbiType::Boolean, + ) => { + let new_value = FieldElement::from(i128::from(integer)); + + InputValue::Field(new_value) + } + + (TomlTypes::Bool(boolean), AbiType::Boolean) => InputValue::Field(boolean.into()), + + (TomlTypes::Array(array), AbiType::Array { typ, .. }) => { + let array_elements = + try_vecmap(array, |value| InputValue::try_from_toml(value, typ, arg_name))?; + InputValue::Vec(array_elements) + } + + (TomlTypes::Table(table), AbiType::Struct { fields, .. }) => { + let native_table = try_btree_map(fields, |(field_name, abi_type)| { + // Check that json contains a value for each field of the struct. + let field_id = format!("{arg_name}.{field_name}"); + let value = table + .get(field_name) + .ok_or_else(|| InputParserError::MissingArgument(field_id.clone()))?; + InputValue::try_from_toml(value.clone(), abi_type, &field_id) + .map(|input_value| (field_name.to_string(), input_value)) + })?; + + InputValue::Struct(native_table) + } + + (TomlTypes::Array(array), AbiType::Tuple { fields }) => { + let tuple_fields = try_vecmap(array.into_iter().zip(fields), |(value, typ)| { + InputValue::try_from_toml(value, typ, arg_name) + })?; + InputValue::Vec(tuple_fields) + } + + (_, _) => return Err(InputParserError::AbiTypeMismatch(param_type.clone())), + }; + + Ok(input_value) + } +} diff --git a/noir/tooling/noirc_abi/src/lib.rs b/noir/tooling/noirc_abi/src/lib.rs new file mode 100644 index 00000000000..7092f05c26e --- /dev/null +++ b/noir/tooling/noirc_abi/src/lib.rs @@ -0,0 +1,597 @@ +#![forbid(unsafe_code)] +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] + +use acvm::{ + acir::native_types::{Witness, WitnessMap}, + FieldElement, +}; +use errors::AbiError; +use input_parser::InputValue; +use iter_extended::{try_btree_map, try_vecmap, vecmap}; +use noirc_frontend::{ + hir::Context, Signedness, StructType, Type, TypeBinding, TypeVariableKind, Visibility, +}; +use serde::{Deserialize, Serialize}; +use std::ops::Range; +use std::{collections::BTreeMap, str}; +// This is the ABI used to bridge the different TOML formats for the initial +// witness, the partial witness generator and the interpreter. +// +// This ABI has nothing to do with ACVM or ACIR. Although they implicitly have a relationship + +pub mod errors; +pub mod input_parser; +mod serialization; + +/// A map from the fields in an TOML/JSON file which correspond to some ABI to their values +pub type InputMap = BTreeMap; + +pub const MAIN_RETURN_NAME: &str = "return"; + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(tag = "kind", rename_all = "lowercase")] +/// Types that are allowed in the (main function in binary) +/// +/// we use this separation so that we can have types like Strings +/// without needing to introduce this in the Noir types +/// +/// NOTE: If Strings are introduced as a native type, the translation will +/// be straightforward. Whether exotic types like String will be natively supported +/// depends on the types of programs that users want to do. I don't envision string manipulation +/// in programs, however it is possible to support, with many complications like encoding character set +/// support. +pub enum AbiType { + Field, + Array { + length: u64, + #[serde(rename = "type")] + typ: Box, + }, + Integer { + sign: Sign, + width: u32, + }, + Boolean, + Struct { + path: String, + #[serde( + serialize_with = "serialization::serialize_struct_fields", + deserialize_with = "serialization::deserialize_struct_fields" + )] + fields: Vec<(String, AbiType)>, + }, + Tuple { + fields: Vec, + }, + String { + length: u64, + }, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +/// Represents whether the parameter is public or known only to the prover. +pub enum AbiVisibility { + Public, + // Constants are not allowed in the ABI for main at the moment. + // Constant, + Private, +} + +impl From for AbiVisibility { + fn from(value: Visibility) -> Self { + match value { + Visibility::Public => AbiVisibility::Public, + Visibility::Private => AbiVisibility::Private, + } + } +} + +impl From<&Visibility> for AbiVisibility { + fn from(value: &Visibility) -> Self { + match value { + Visibility::Public => AbiVisibility::Public, + Visibility::Private => AbiVisibility::Private, + } + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +/// Represents whether the return value should compromise of unique witness indices such that no +/// index occurs within the program's abi more than once. +/// +/// This is useful for application stacks that require an uniform abi across across multiple +/// circuits. When index duplication is allowed, the compiler may identify that a public input +/// reaches the output unaltered and is thus referenced directly, causing the input and output +/// witness indices to overlap. Similarly, repetitions of copied values in the output may be +/// optimized away. +pub enum AbiDistinctness { + Distinct, + DuplicationAllowed, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum Sign { + Unsigned, + Signed, +} + +impl AbiType { + pub fn from_type(context: &Context, typ: &Type) -> Self { + // Note; use strict_eq instead of partial_eq when comparing field types + // in this method, you most likely want to distinguish between public and private + match typ { + Type::FieldElement => Self::Field, + Type::Array(size, typ) => { + let length = size + .evaluate_to_u64() + .expect("Cannot have variable sized arrays as a parameter to main"); + let typ = typ.as_ref(); + Self::Array { length, typ: Box::new(Self::from_type(context, typ)) } + } + Type::Integer(sign, bit_width) => { + let sign = match sign { + Signedness::Unsigned => Sign::Unsigned, + Signedness::Signed => Sign::Signed, + }; + + Self::Integer { sign, width: *bit_width } + } + Type::TypeVariable(binding, TypeVariableKind::IntegerOrField) => { + match &*binding.borrow() { + TypeBinding::Bound(typ) => Self::from_type(context, typ), + TypeBinding::Unbound(_) => Self::from_type(context, &Type::default_int_type()), + } + } + Type::Bool => Self::Boolean, + Type::String(size) => { + let size = size + .evaluate_to_u64() + .expect("Cannot have variable sized strings as a parameter to main"); + Self::String { length: size } + } + Type::FmtString(_, _) => unreachable!("format strings cannot be used in the abi"), + Type::Error => unreachable!(), + Type::Unit => unreachable!(), + Type::Constant(_) => unreachable!(), + Type::TraitAsType(_) => unreachable!(), + Type::Struct(def, ref args) => { + let struct_type = def.borrow(); + let fields = struct_type.get_fields(args); + let fields = vecmap(fields, |(name, typ)| (name, Self::from_type(context, &typ))); + // For the ABI, we always want to resolve the struct paths from the root crate + let path = + context.fully_qualified_struct_path(context.root_crate_id(), struct_type.id); + Self::Struct { fields, path } + } + Type::Tuple(fields) => { + let fields = vecmap(fields, |typ| Self::from_type(context, typ)); + Self::Tuple { fields } + } + Type::TypeVariable(_, _) => unreachable!(), + Type::NamedGeneric(..) => unreachable!(), + Type::Forall(..) => unreachable!(), + Type::Function(_, _, _) => unreachable!(), + Type::MutableReference(_) => unreachable!("&mut cannot be used in the abi"), + Type::NotConstant => unreachable!(), + } + } + + /// Returns the number of field elements required to represent the type once encoded. + pub fn field_count(&self) -> u32 { + match self { + AbiType::Field | AbiType::Integer { .. } | AbiType::Boolean => 1, + AbiType::Array { length, typ } => typ.field_count() * (*length as u32), + AbiType::Struct { fields, .. } => { + fields.iter().fold(0, |acc, (_, field_type)| acc + field_type.field_count()) + } + AbiType::Tuple { fields } => { + fields.iter().fold(0, |acc, field_typ| acc + field_typ.field_count()) + } + AbiType::String { length } => *length as u32, + } + } +} + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +/// An argument or return value of the circuit's `main` function. +pub struct AbiParameter { + pub name: String, + #[serde(rename = "type")] + pub typ: AbiType, + pub visibility: AbiVisibility, +} + +impl AbiParameter { + pub fn is_public(&self) -> bool { + self.visibility == AbiVisibility::Public + } +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Abi { + /// An ordered list of the arguments to the program's `main` function, specifying their types and visibility. + pub parameters: Vec, + /// A map from the ABI's parameters to the indices they are written to in the [`WitnessMap`]. + /// This defines how to convert between the [`InputMap`] and [`WitnessMap`]. + pub param_witnesses: BTreeMap>>, + pub return_type: Option, + pub return_witnesses: Vec, +} + +impl Abi { + pub fn parameter_names(&self) -> Vec<&String> { + self.parameters.iter().map(|x| &x.name).collect() + } + + pub fn num_parameters(&self) -> usize { + self.parameters.len() + } + + /// Returns the number of field elements required to represent the ABI's input once encoded. + pub fn field_count(&self) -> u32 { + self.parameters.iter().map(|param| param.typ.field_count()).sum() + } + + /// Returns whether any values are needed to be made public for verification. + pub fn has_public_inputs(&self) -> bool { + self.return_type.is_some() || self.parameters.iter().any(|param| param.is_public()) + } + + /// Returns `true` if the ABI contains no parameters or return value. + pub fn is_empty(&self) -> bool { + self.return_type.is_none() && self.parameters.is_empty() + } + + pub fn to_btree_map(&self) -> BTreeMap { + let mut map = BTreeMap::new(); + for param in self.parameters.iter() { + map.insert(param.name.clone(), param.typ.clone()); + } + map + } + + /// ABI with only the public parameters + #[must_use] + pub fn public_abi(self) -> Abi { + let parameters: Vec<_> = + self.parameters.into_iter().filter(|param| param.is_public()).collect(); + let param_witnesses = self + .param_witnesses + .into_iter() + .filter(|(param_name, _)| parameters.iter().any(|param| ¶m.name == param_name)) + .collect(); + Abi { + parameters, + param_witnesses, + return_type: self.return_type, + return_witnesses: self.return_witnesses, + } + } + + /// Encode a set of inputs as described in the ABI into a `WitnessMap`. + pub fn encode( + &self, + input_map: &InputMap, + return_value: Option, + ) -> Result { + // Check that no extra witness values have been provided. + let param_names = self.parameter_names(); + if param_names.len() < input_map.len() { + let unexpected_params: Vec = + input_map.keys().filter(|param| !param_names.contains(param)).cloned().collect(); + return Err(AbiError::UnexpectedParams(unexpected_params)); + } + + // First encode each input separately, performing any input validation. + let encoded_input_map: BTreeMap> = self + .to_btree_map() + .into_iter() + .map(|(param_name, expected_type)| { + let value = input_map + .get(¶m_name) + .ok_or_else(|| AbiError::MissingParam(param_name.clone()))? + .clone(); + + if !value.matches_abi(&expected_type) { + let param = self + .parameters + .iter() + .find(|param| param.name == param_name) + .unwrap() + .clone(); + return Err(AbiError::TypeMismatch { param, value }); + } + + Self::encode_value(value, &expected_type).map(|v| (param_name, v)) + }) + .collect::>()?; + + // Write input field elements into witness indices specified in `self.param_witnesses`. + let mut witness_map: BTreeMap = encoded_input_map + .iter() + .flat_map(|(param_name, encoded_param_fields)| { + let param_witness_indices = range_to_vec(&self.param_witnesses[param_name]); + param_witness_indices + .iter() + .zip(encoded_param_fields.iter()) + .map(|(&witness, &field_element)| (witness, field_element)) + .collect::>() + }) + .collect::>(); + + // When encoding public inputs to be passed to the verifier, the user can must provide a return value + // to be inserted into the witness map. This is not needed when generating a witness when proving the circuit. + match (&self.return_type, return_value) { + (Some(return_type), Some(return_value)) => { + if !return_value.matches_abi(return_type) { + return Err(AbiError::ReturnTypeMismatch { + return_type: return_type.clone(), + value: return_value, + }); + } + let encoded_return_fields = Self::encode_value(return_value, return_type)?; + + // We need to be more careful when writing the return value's witness values. + // This is as it may share witness indices with other public inputs so we must check that when + // this occurs the witness values are consistent with each other. + self.return_witnesses.iter().zip(encoded_return_fields.iter()).try_for_each( + |(&witness, &field_element)| match witness_map.insert(witness, field_element) { + Some(existing_value) if existing_value != field_element => { + Err(AbiError::InconsistentWitnessAssignment(witness)) + } + _ => Ok(()), + }, + )?; + } + (None, Some(return_value)) => { + return Err(AbiError::UnexpectedReturnValue(return_value)) + } + // We allow not passing a return value despite the circuit defining one + // in order to generate the initial partial witness. + (_, None) => {} + } + + Ok(witness_map.into()) + } + + fn encode_value(value: InputValue, abi_type: &AbiType) -> Result, AbiError> { + let mut encoded_value = Vec::new(); + match (value, abi_type) { + (InputValue::Field(elem), _) => encoded_value.push(elem), + + (InputValue::Vec(vec_elements), AbiType::Array { typ, .. }) => { + for elem in vec_elements { + encoded_value.extend(Self::encode_value(elem, typ)?); + } + } + + (InputValue::String(string), _) => { + let str_as_fields = + string.bytes().map(|byte| FieldElement::from_be_bytes_reduce(&[byte])); + encoded_value.extend(str_as_fields); + } + + (InputValue::Struct(object), AbiType::Struct { fields, .. }) => { + for (field, typ) in fields { + encoded_value.extend(Self::encode_value(object[field].clone(), typ)?); + } + } + (InputValue::Vec(vec_elements), AbiType::Tuple { fields }) => { + for (value, typ) in vec_elements.into_iter().zip(fields) { + encoded_value.extend(Self::encode_value(value, typ)?); + } + } + _ => unreachable!("value should have already been checked to match abi type"), + } + Ok(encoded_value) + } + + /// Decode a `WitnessMap` into the types specified in the ABI. + pub fn decode( + &self, + witness_map: &WitnessMap, + ) -> Result<(InputMap, Option), AbiError> { + let public_inputs_map = + try_btree_map(self.parameters.clone(), |AbiParameter { name, typ, .. }| { + let param_witness_values = + try_vecmap(range_to_vec(&self.param_witnesses[&name]), |witness_index| { + witness_map + .get(&witness_index) + .ok_or_else(|| AbiError::MissingParamWitnessValue { + name: name.clone(), + witness_index, + }) + .copied() + })?; + + decode_value(&mut param_witness_values.into_iter(), &typ) + .map(|input_value| (name.clone(), input_value)) + })?; + + // We also attempt to decode the circuit's return value from `witness_map`. + let return_value = if let Some(return_type) = &self.return_type { + if let Ok(return_witness_values) = + try_vecmap(self.return_witnesses.clone(), |witness_index| { + witness_map + .get(&witness_index) + .ok_or_else(|| AbiError::MissingParamWitnessValue { + name: MAIN_RETURN_NAME.to_string(), + witness_index, + }) + .copied() + }) + { + Some(decode_value(&mut return_witness_values.into_iter(), return_type)?) + } else { + // Unlike for the circuit inputs, we tolerate not being able to find the witness values for the return value. + // This is because the user may be decoding a partial witness map for which is hasn't been calculated yet. + // If a return value is expected, this should be checked for by the user. + None + } + } else { + None + }; + + Ok((public_inputs_map, return_value)) + } +} + +fn decode_value( + field_iterator: &mut impl Iterator, + value_type: &AbiType, +) -> Result { + // This function assumes that `field_iterator` contains enough `FieldElement`s in order to decode a `value_type` + // `Abi.decode` enforces that the encoded inputs matches the expected length defined by the ABI so this is safe. + let value = match value_type { + AbiType::Field | AbiType::Integer { .. } | AbiType::Boolean => { + let field_element = field_iterator.next().unwrap(); + + InputValue::Field(field_element) + } + AbiType::Array { length, typ } => { + let length = *length as usize; + let mut array_elements = Vec::with_capacity(length); + for _ in 0..length { + array_elements.push(decode_value(field_iterator, typ)?); + } + + InputValue::Vec(array_elements) + } + AbiType::String { length } => { + let field_elements: Vec = field_iterator.take(*length as usize).collect(); + + InputValue::String(decode_string_value(&field_elements)) + } + AbiType::Struct { fields, .. } => { + let mut struct_map = BTreeMap::new(); + + for (field_key, param_type) in fields { + let field_value = decode_value(field_iterator, param_type)?; + + struct_map.insert(field_key.to_owned(), field_value); + } + + InputValue::Struct(struct_map) + } + AbiType::Tuple { fields } => { + let mut tuple_elements = Vec::with_capacity(fields.len()); + for field_typ in fields { + tuple_elements.push(decode_value(field_iterator, field_typ)?); + } + + InputValue::Vec(tuple_elements) + } + }; + + Ok(value) +} + +fn decode_string_value(field_elements: &[FieldElement]) -> String { + let string_as_slice = vecmap(field_elements, |e| { + let mut field_as_bytes = e.to_be_bytes(); + let char_byte = field_as_bytes.pop().unwrap(); // A character in a string is represented by a u8, thus we just want the last byte of the element + assert!(field_as_bytes.into_iter().all(|b| b == 0)); // Assert that the rest of the field element's bytes are empty + char_byte + }); + + let final_string = str::from_utf8(&string_as_slice).unwrap(); + final_string.to_owned() +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct ContractEvent { + /// Event name + name: String, + /// The fully qualified path to the event definition + path: String, + + /// Fields of the event + #[serde( + serialize_with = "serialization::serialize_struct_fields", + deserialize_with = "serialization::deserialize_struct_fields" + )] + fields: Vec<(String, AbiType)>, +} + +impl ContractEvent { + pub fn from_struct_type(context: &Context, struct_type: &StructType) -> Self { + let fields = vecmap(struct_type.get_fields(&[]), |(name, typ)| { + (name, AbiType::from_type(context, &typ)) + }); + // For the ABI, we always want to resolve the struct paths from the root crate + let path = context.fully_qualified_struct_path(context.root_crate_id(), struct_type.id); + + Self { name: struct_type.name.0.contents.clone(), path, fields } + } +} + +fn range_to_vec(ranges: &[Range]) -> Vec { + let mut result = Vec::new(); + for range in ranges { + for witness in range.start.witness_index()..range.end.witness_index() { + result.push(witness.into()); + } + } + result +} + +#[cfg(test)] +mod test { + use std::collections::BTreeMap; + + use acvm::{acir::native_types::Witness, FieldElement}; + + use crate::{input_parser::InputValue, Abi, AbiParameter, AbiType, AbiVisibility, InputMap}; + + #[test] + fn witness_encoding_roundtrip() { + let abi = Abi { + parameters: vec![ + AbiParameter { + name: "thing1".to_string(), + typ: AbiType::Array { length: 2, typ: Box::new(AbiType::Field) }, + visibility: AbiVisibility::Public, + }, + AbiParameter { + name: "thing2".to_string(), + typ: AbiType::Field, + visibility: AbiVisibility::Public, + }, + ], + // Note that the return value shares a witness with `thing2` + param_witnesses: BTreeMap::from([ + ("thing1".to_string(), vec![(Witness(1)..Witness(3))]), + ("thing2".to_string(), vec![(Witness(3)..Witness(4))]), + ]), + return_type: Some(AbiType::Field), + return_witnesses: vec![Witness(3)], + }; + + // Note we omit return value from inputs + let inputs: InputMap = BTreeMap::from([ + ( + "thing1".to_string(), + InputValue::Vec(vec![ + InputValue::Field(FieldElement::one()), + InputValue::Field(FieldElement::one()), + ]), + ), + ("thing2".to_string(), InputValue::Field(FieldElement::zero())), + ]); + + let witness_map = abi.encode(&inputs, None).unwrap(); + let (reconstructed_inputs, return_value) = abi.decode(&witness_map).unwrap(); + + for (key, expected_value) in inputs { + assert_eq!(reconstructed_inputs[&key], expected_value); + } + + // We also decode the return value (we can do this immediately as we know it shares a witness with an input). + assert_eq!(return_value.unwrap(), reconstructed_inputs["thing2"]); + } +} diff --git a/noir/tooling/noirc_abi/src/serialization.rs b/noir/tooling/noirc_abi/src/serialization.rs new file mode 100644 index 00000000000..ed838803fab --- /dev/null +++ b/noir/tooling/noirc_abi/src/serialization.rs @@ -0,0 +1,137 @@ +use iter_extended::vecmap; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +use crate::AbiType; + +// This module exposes a custom serializer and deserializer for `BTreeMap` +// (representing the fields of a struct) to serialize it as a `Vec`. +// +// This is required as the struct is flattened into an array of field elements so the ordering of the struct's fields +// must be maintained. However, several serialization formats (notably JSON) do not provide strong guarantees about +// the ordering of elements in a map, this creates potential for improper ABI encoding of structs if the fields are +// deserialized into a different order. To prevent this, we store the fields in an array to create an unambiguous ordering. + +#[derive(Serialize, Deserialize)] +struct StructField { + name: String, + #[serde(rename = "type")] + typ: AbiType, +} + +pub(crate) fn serialize_struct_fields( + fields: &[(String, AbiType)], + s: S, +) -> Result +where + S: Serializer, +{ + let fields_vector = + vecmap(fields, |(name, typ)| StructField { name: name.to_owned(), typ: typ.to_owned() }); + + fields_vector.serialize(s) +} + +pub(crate) fn deserialize_struct_fields<'de, D>( + deserializer: D, +) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + let fields_vector = Vec::::deserialize(deserializer)?; + Ok(vecmap(fields_vector, |StructField { name, typ }| (name, typ))) +} + +#[cfg(test)] +mod tests { + use crate::{AbiParameter, AbiType, AbiVisibility, Sign}; + + #[test] + fn abi_parameter_serialization() { + let serialized_field = "{ + \"name\": \"thing1\", + \"visibility\": \"public\", + \"type\": { + \"kind\": \"field\" + } + }"; + + let expected_field = AbiParameter { + name: "thing1".to_string(), + typ: AbiType::Field, + visibility: AbiVisibility::Public, + }; + let deserialized_field: AbiParameter = serde_json::from_str(serialized_field).unwrap(); + assert_eq!(deserialized_field, expected_field); + + let serialized_array = "{ + \"name\": \"thing2\", + \"visibility\": \"private\", + \"type\": { + \"kind\": \"array\", + \"length\": 2, + \"type\": { + \"kind\": \"integer\", + \"width\": 3, + \"sign\": \"unsigned\" + } + } + }"; + + let expected_array = AbiParameter { + name: "thing2".to_string(), + typ: AbiType::Array { + length: 2, + typ: Box::new(AbiType::Integer { sign: Sign::Unsigned, width: 3 }), + }, + visibility: AbiVisibility::Private, + }; + let deserialized_array: AbiParameter = serde_json::from_str(serialized_array).unwrap(); + assert_eq!(deserialized_array, expected_array); + + let serialized_struct = "{ + \"name\":\"thing3\", + \"type\": { + \"kind\":\"struct\", + \"path\": \"MyStruct\", + \"fields\": [ + { + \"name\": \"field1\", + \"type\": { + \"kind\": \"integer\", + \"sign\": \"unsigned\", + \"width\": 3 + } + }, + { + \"name\":\"field2\", + \"type\": { + \"kind\":\"array\", + \"length\": 2, + \"type\": { + \"kind\":\"field\" + } + } + } + ] + }, + \"visibility\":\"private\" + }"; + + let expected_struct = AbiParameter { + name: "thing3".to_string(), + typ: AbiType::Struct { + path: "MyStruct".to_string(), + fields: vec![ + ("field1".to_string(), AbiType::Integer { sign: Sign::Unsigned, width: 3 }), + ( + "field2".to_string(), + AbiType::Array { length: 2, typ: Box::new(AbiType::Field) }, + ), + ], + }, + visibility: AbiVisibility::Private, + }; + let deserialized_struct: AbiParameter = serde_json::from_str(serialized_struct).unwrap(); + assert_eq!(deserialized_struct, expected_struct); + } +} diff --git a/noir/tooling/noirc_abi_wasm/.eslintignore b/noir/tooling/noirc_abi_wasm/.eslintignore new file mode 100644 index 00000000000..200ae222150 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/.eslintignore @@ -0,0 +1,2 @@ +node_modules +pkg \ No newline at end of file diff --git a/noir/tooling/noirc_abi_wasm/.eslintrc.js b/noir/tooling/noirc_abi_wasm/.eslintrc.js new file mode 100644 index 00000000000..33335c2a877 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ["../../.eslintrc.js"], +}; diff --git a/noir/tooling/noirc_abi_wasm/.mocharc.json b/noir/tooling/noirc_abi_wasm/.mocharc.json new file mode 100644 index 00000000000..27273835070 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/.mocharc.json @@ -0,0 +1,5 @@ +{ + "extension": ["ts"], + "spec": "test/node/**/*.test.ts", + "require": "ts-node/register" +} \ No newline at end of file diff --git a/noir/tooling/noirc_abi_wasm/CHANGELOG.md b/noir/tooling/noirc_abi_wasm/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/noir/tooling/noirc_abi_wasm/Cargo.toml b/noir/tooling/noirc_abi_wasm/Cargo.toml new file mode 100644 index 00000000000..c78c3ead0c3 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "noirc_abi_wasm" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + + +[lib] +crate-type = ["cdylib"] + +[dependencies] +acvm.workspace = true +noirc_abi.workspace = true +iter-extended.workspace = true +wasm-bindgen.workspace = true +serde.workspace = true +js-sys.workspace = true +console_error_panic_hook.workspace = true +gloo-utils.workspace = true + + +# This is an unused dependency, we are adding it +# so that we can enable the js feature in getrandom. +getrandom = { workspace = true, features = ["js"] } + +[build-dependencies] +build-data.workspace = true + +[dev-dependencies] +wasm-bindgen-test.workspace = true diff --git a/noir/tooling/noirc_abi_wasm/README.md b/noir/tooling/noirc_abi_wasm/README.md new file mode 100644 index 00000000000..77bc1f5fae2 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/README.md @@ -0,0 +1,17 @@ +# Noir Lang ABI JavaScript Package + +This JavaScript package enables users to ABI encode inputs to a Noir program, i.e. generating an initial witness. + +## Building from source + +Outside of the [noir repo](https://github.com/noir-lang/noir), this package can be built using the command below: + +```bash +nix build -L github:noir-lang/noir/master#abi_wasm +``` + +If you are within the noir repo and would like to build local changes, you can use: + +```bash +nix build -L #abi_wasm +``` diff --git a/noir/tooling/noirc_abi_wasm/build.rs b/noir/tooling/noirc_abi_wasm/build.rs new file mode 100644 index 00000000000..3b96be74ef3 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/build.rs @@ -0,0 +1,14 @@ +const GIT_COMMIT: &&str = &"GIT_COMMIT"; + +fn main() { + // Only use build_data if the environment variable isn't set + // The environment variable is always set when working via Nix + if std::env::var(GIT_COMMIT).is_err() { + build_data::set_GIT_COMMIT(); + build_data::set_GIT_DIRTY(); + build_data::no_debug_rebuilds(); + } + + build_data::set_SOURCE_TIMESTAMP(); + build_data::no_debug_rebuilds(); +} diff --git a/noir/tooling/noirc_abi_wasm/build.sh b/noir/tooling/noirc_abi_wasm/build.sh new file mode 100755 index 00000000000..37f2fd0a5a9 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/build.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +function require_command { + if ! command -v "$1" >/dev/null 2>&1; then + echo "Error: $1 is required but not installed." >&2 + exit 1 + fi +} +function check_installed { + if ! command -v "$1" >/dev/null 2>&1; then + echo "$1 is not installed. Please install it." >&2 + return 1 + fi + return 0 +} +function run_or_fail { + "$@" + local status=$? + if [ $status -ne 0 ]; then + echo "Command '$*' failed with exit code $status" >&2 + exit $status + fi +} + +require_command jq +require_command cargo +require_command wasm-bindgen +check_installed wasm-opt + +self_path=$(dirname "$(readlink -f "$0")") +export pname=$(cargo read-manifest | jq -r '.name') +export CARGO_TARGET_DIR=$self_path/target + +rm -rf $self_path/outputs >/dev/null 2>&1 +rm -rf $self_path/result >/dev/null 2>&1 + +if [ -v out ]; then + echo "Will install package to $out (defined outside installPhase.sh script)" +else + export out="$self_path/outputs/out" + echo "Will install package to $out" +fi + +run_or_fail $self_path/buildPhaseCargoCommand.sh +run_or_fail $self_path/installPhase.sh + +ln -s $out $self_path/result diff --git a/noir/tooling/noirc_abi_wasm/buildPhaseCargoCommand.sh b/noir/tooling/noirc_abi_wasm/buildPhaseCargoCommand.sh new file mode 100755 index 00000000000..1188d00953e --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/buildPhaseCargoCommand.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +function run_or_fail { + "$@" + local status=$? + if [ $status -ne 0 ]; then + echo "Command '$*' failed with exit code $status" >&2 + exit $status + fi +} +function run_if_available { + if command -v "$1" >/dev/null 2>&1; then + "$@" + else + echo "$1 is not installed. Please install it to use this feature." >&2 + fi +} + +export self_path=$(dirname "$(readlink -f "$0")") + +# Clear out the existing build artifacts as these aren't automatically removed by wasm-pack. +if [ -d ./pkg/ ]; then + rm -rf $self_path/pkg/ +fi + +TARGET=wasm32-unknown-unknown +WASM_BINARY=$CARGO_TARGET_DIR/$TARGET/release/${pname}.wasm + +NODE_DIR=$self_path/nodejs/ +BROWSER_DIR=$self_path/web/ +NODE_WASM=${NODE_DIR}/${pname}_bg.wasm +BROWSER_WASM=${BROWSER_DIR}/${pname}_bg.wasm + +# Build the new wasm package +run_or_fail cargo build --lib --release --target $TARGET --package ${pname} +run_or_fail wasm-bindgen $WASM_BINARY --out-dir $NODE_DIR --typescript --target nodejs +run_or_fail wasm-bindgen $WASM_BINARY --out-dir $BROWSER_DIR --typescript --target web +run_if_available wasm-opt $NODE_WASM -o $NODE_WASM -O +run_if_available wasm-opt $BROWSER_WASM -o $BROWSER_WASM -O \ No newline at end of file diff --git a/noir/tooling/noirc_abi_wasm/installPhase.sh b/noir/tooling/noirc_abi_wasm/installPhase.sh new file mode 100755 index 00000000000..d9b94f2d171 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/installPhase.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +export self_path=$(dirname "$(readlink -f "$0")") + +export out_path=$out/noirc_abi_wasm + +mkdir -p $out_path +cp $self_path/README.md $out_path/ +cp $self_path/package.json $out_path/ +cp -r $self_path/nodejs $out_path/ +cp -r $self_path/web $out_path/ diff --git a/noir/tooling/noirc_abi_wasm/package.json b/noir/tooling/noirc_abi_wasm/package.json new file mode 100644 index 00000000000..d307a186a7d --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/package.json @@ -0,0 +1,43 @@ +{ + "name": "@noir-lang/noirc_abi", + "collaborators": [ + "The Noir Team " + ], + "version": "0.19.2", + "license": "(MIT OR Apache-2.0)", + "files": [ + "nodejs", + "web", + "package.json" + ], + "publishConfig": { + "access": "public" + }, + "main": "./nodejs/noirc_abi_wasm.js", + "types": "./web/noirc_abi_wasm.d.ts", + "module": "./web/noirc_abi_wasm.js", + "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/noir-lang/noir.git" + }, + "scripts": { + "build": "bash ./build.sh", + "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha", + "test:browser": "web-test-runner", + "clean": "chmod u+w web nodejs || true && rm -rf ./nodejs ./web ./target ./result", + "nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json", + "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish", + "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0", + "build:nix": "nix build -L .#noirc_abi_wasm", + "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/noirc_abi_wasm/nodejs ./ && cp -rL ./result/noirc_abi_wasm/web ./" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@web/dev-server-esbuild": "^0.3.6", + "@web/test-runner": "^0.15.3", + "@web/test-runner-playwright": "^0.10.0", + "eslint": "^8.50.0", + "mocha": "^10.2.0" + } +} diff --git a/noir/tooling/noirc_abi_wasm/src/errors.rs b/noir/tooling/noirc_abi_wasm/src/errors.rs new file mode 100644 index 00000000000..14ee2d5fd8e --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/src/errors.rs @@ -0,0 +1,47 @@ +use js_sys::{Error, JsString}; +use noirc_abi::errors::{AbiError, InputParserError}; +use wasm_bindgen::prelude::wasm_bindgen; + +#[wasm_bindgen(typescript_custom_section)] +const ABI_ERROR: &'static str = r#" +export type ABIError = Error; +"#; + +/// JsAbiError is a raw js error. +/// It'd be ideal that ABI error was a subclass of Error, but for that we'd need to use JS snippets or a js module. +/// Currently JS snippets don't work with a nodejs target. And a module would be too much for just a custom error type. +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(extends = Error, js_name = "AbiError", typescript_type = "AbiError")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type JsAbiError; + + #[wasm_bindgen(constructor, js_class = "Error")] + fn constructor(message: JsString) -> JsAbiError; +} + +impl JsAbiError { + /// Creates a new execution error with the given call stack. + /// Call stacks won't be optional in the future, after removing ErrorLocation in ACVM. + pub fn new(message: String) -> Self { + JsAbiError::constructor(JsString::from(message)) + } +} + +impl From for JsAbiError { + fn from(value: String) -> Self { + JsAbiError::new(value) + } +} + +impl From for JsAbiError { + fn from(value: AbiError) -> Self { + JsAbiError::new(value.to_string()) + } +} + +impl From for JsAbiError { + fn from(value: InputParserError) -> Self { + JsAbiError::new(value.to_string()) + } +} diff --git a/noir/tooling/noirc_abi_wasm/src/js_witness_map.rs b/noir/tooling/noirc_abi_wasm/src/js_witness_map.rs new file mode 100644 index 00000000000..fcc6e75f18c --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/src/js_witness_map.rs @@ -0,0 +1,114 @@ +//! This can most likely be imported from acvm_js to avoid redefining it here. + +use acvm::{ + acir::native_types::{Witness, WitnessMap}, + FieldElement, +}; +use js_sys::{JsString, Map}; +use wasm_bindgen::prelude::{wasm_bindgen, JsValue}; + +#[wasm_bindgen(typescript_custom_section)] +const WITNESS_MAP: &'static str = r#" +// Map from witness index to hex string value of witness. +export type WitnessMap = Map; +"#; + +// WitnessMap +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(extends = Map, js_name = "WitnessMap", typescript_type = "WitnessMap")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type JsWitnessMap; + + #[wasm_bindgen(constructor, js_class = "Map")] + pub fn new() -> JsWitnessMap; + +} + +impl Default for JsWitnessMap { + fn default() -> Self { + Self::new() + } +} + +impl From for JsWitnessMap { + fn from(witness_map: WitnessMap) -> Self { + let js_map = JsWitnessMap::new(); + for (key, value) in witness_map { + js_map.set( + &js_sys::Number::from(key.witness_index()), + &field_element_to_js_string(&value), + ); + } + js_map + } +} + +impl From for WitnessMap { + fn from(js_map: JsWitnessMap) -> Self { + let mut witness_map = WitnessMap::new(); + js_map.for_each(&mut |value, key| { + let witness_index = Witness(key.as_f64().unwrap() as u32); + let witness_value = js_value_to_field_element(value).unwrap(); + witness_map.insert(witness_index, witness_value); + }); + witness_map + } +} + +pub(crate) fn js_value_to_field_element(js_value: JsValue) -> Result { + let hex_str = js_value.as_string().ok_or("failed to parse field element from non-string")?; + + FieldElement::from_hex(&hex_str) + .ok_or_else(|| format!("Invalid hex string: '{}'", hex_str).into()) +} + +pub(crate) fn field_element_to_js_string(field_element: &FieldElement) -> JsString { + // This currently maps `0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000` + // to the bigint `-1n`. This fails when converting back to a `FieldElement`. + // js_sys::BigInt::from_str(&value.to_hex()).unwrap() + + format!("0x{}", field_element.to_hex()).into() +} + +#[cfg(test)] +mod test { + use wasm_bindgen_test::wasm_bindgen_test as test; + + use std::collections::BTreeMap; + + use acvm::{ + acir::native_types::{Witness, WitnessMap}, + FieldElement, + }; + use wasm_bindgen::JsValue; + + use crate::JsWitnessMap; + + #[test] + fn test_witness_map_to_js() { + let witness_map = BTreeMap::from([ + (Witness(1), FieldElement::one()), + (Witness(2), FieldElement::zero()), + (Witness(3), -FieldElement::one()), + ]); + let witness_map = WitnessMap::from(witness_map); + + let js_map = JsWitnessMap::from(witness_map); + + assert_eq!( + js_map.get(&JsValue::from(1)), + JsValue::from_str("0x0000000000000000000000000000000000000000000000000000000000000001") + ); + assert_eq!( + js_map.get(&JsValue::from(2)), + JsValue::from_str("0x0000000000000000000000000000000000000000000000000000000000000000") + ); + assert_eq!( + js_map.get(&JsValue::from(3)), + // Equal to 21888242871839275222246405745257275088548364400416034343698204186575808495616, + // which is field modulus - 1: https://docs.rs/ark-bn254/latest/ark_bn254/ + JsValue::from_str("0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000") + ); + } +} diff --git a/noir/tooling/noirc_abi_wasm/src/lib.rs b/noir/tooling/noirc_abi_wasm/src/lib.rs new file mode 100644 index 00000000000..734ca1ff40e --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/src/lib.rs @@ -0,0 +1,149 @@ +#![warn(unused_crate_dependencies, unused_extern_crates)] +#![warn(unreachable_pub)] +#![warn(clippy::semicolon_if_nothing_returned)] + +// See Cargo.toml for explanation. +use getrandom as _; + +use acvm::acir::native_types::WitnessMap; +use iter_extended::try_btree_map; +use noirc_abi::{ + errors::InputParserError, + input_parser::{json::JsonTypes, InputValue}, + Abi, MAIN_RETURN_NAME, +}; +use serde::Serialize; +use std::collections::BTreeMap; + +use gloo_utils::format::JsValueSerdeExt; +use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; + +mod errors; +mod js_witness_map; + +use errors::JsAbiError; +use js_witness_map::JsWitnessMap; + +#[wasm_bindgen(typescript_custom_section)] +const INPUT_MAP: &'static str = r#" +export type Field = string | number | boolean; +export type InputValue = Field | Field[] | InputMap; +export type InputMap = { [key: string]: InputValue }; +"#; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(extends = js_sys::Object, js_name = "InputMap", typescript_type = "InputMap")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type JsInputMap; +} + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(extends = js_sys::Object, js_name = "InputValue", typescript_type = "InputValue")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type JsInputValue; +} + +#[wasm_bindgen(typescript_custom_section)] +const ABI: &'static str = r#" +export type Visibility = "public" | "private"; +export type Sign = "unsigned" | "signed"; +export type AbiType = + { kind: "field" } | + { kind: "boolean" } | + { kind: "string", length: number } | + { kind: "integer", sign: Sign, width: number } | + { kind: "array", length: number, type: AbiType } | + { kind: "tuple", fields: AbiType[] } | + { kind: "struct", path: string, fields: [string, AbiType][] }; + +export type AbiParameter = { + name: string, + type: AbiType, + visibility: Visibility, +}; + +export type Abi = { + parameters: AbiParameter[], + param_witnesses: Record, + return_type: AbiType | null, + return_witnesses: number[], +} +"#; + +#[wasm_bindgen] +extern "C" { + #[wasm_bindgen(extends = js_sys::Object, js_name = "Abi", typescript_type = "Abi")] + #[derive(Clone, Debug, PartialEq, Eq)] + pub type JsAbi; +} + +#[wasm_bindgen(js_name = abiEncode)] +pub fn abi_encode( + abi: JsAbi, + inputs: JsInputMap, + return_value: Option, +) -> Result { + console_error_panic_hook::set_once(); + let abi: Abi = + JsValueSerdeExt::into_serde(&JsValue::from(abi)).map_err(|err| err.to_string())?; + let inputs: BTreeMap = + JsValueSerdeExt::into_serde(&JsValue::from(inputs)).map_err(|err| err.to_string())?; + let return_value: Option = return_value + .map(|return_value| { + let toml_return_value = JsValueSerdeExt::into_serde(&JsValue::from(return_value)) + .expect("could not decode return value"); + InputValue::try_from_json( + toml_return_value, + abi.return_type.as_ref().unwrap(), + MAIN_RETURN_NAME, + ) + }) + .transpose()?; + + let abi_map = abi.to_btree_map(); + let parsed_inputs: BTreeMap = + try_btree_map(abi_map, |(arg_name, abi_type)| { + // Check that toml contains a value for each argument in the ABI. + let value = inputs + .get(&arg_name) + .ok_or_else(|| InputParserError::MissingArgument(arg_name.clone()))?; + InputValue::try_from_json(value.clone(), &abi_type, &arg_name) + .map(|input_value| (arg_name, input_value)) + })?; + + let witness_map = abi.encode(&parsed_inputs, return_value)?; + + Ok(witness_map.into()) +} + +#[wasm_bindgen(js_name = abiDecode)] +pub fn abi_decode(abi: JsAbi, witness_map: JsWitnessMap) -> Result { + console_error_panic_hook::set_once(); + let abi: Abi = + JsValueSerdeExt::into_serde(&JsValue::from(abi)).map_err(|err| err.to_string())?; + + let witness_map = WitnessMap::from(witness_map); + + let (inputs, return_value) = abi.decode(&witness_map)?; + + let abi_types = abi.to_btree_map(); + let inputs_map: BTreeMap = try_btree_map(inputs, |(key, value)| { + JsonTypes::try_from_input_value(&value, &abi_types[&key]).map(|value| (key, value)) + })?; + + let return_value = return_value + .map(|value| JsonTypes::try_from_input_value(&value, &abi.return_type.unwrap())) + .transpose()?; + + #[derive(Serialize)] + struct InputsAndReturn { + inputs: BTreeMap, + return_value: Option, + } + + let return_struct = InputsAndReturn { inputs: inputs_map, return_value }; + ::from_serde(&return_struct) + .map_err(|err| err.to_string().into()) +} diff --git a/noir/tooling/noirc_abi_wasm/test/browser/abi_encode.test.ts b/noir/tooling/noirc_abi_wasm/test/browser/abi_encode.test.ts new file mode 100644 index 00000000000..e1aaf0dc2c0 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/browser/abi_encode.test.ts @@ -0,0 +1,21 @@ +import { expect } from '@esm-bundle/chai'; +import initNoirAbi, { abiEncode, abiDecode, WitnessMap, Field } from '@noir-lang/noirc_abi'; +import { DecodedInputs } from '../types'; + +beforeEach(async () => { + await initNoirAbi(); +}); + +it('recovers original inputs when abi encoding and decoding', async () => { + const { abi, inputs } = await import('../shared/abi_encode'); + + const initial_witness: WitnessMap = abiEncode(abi, inputs); + const decoded_inputs: DecodedInputs = abiDecode(abi, initial_witness); + + const foo: Field = inputs.foo as Field; + const bar: Field[] = inputs.bar as Field[]; + expect(BigInt(decoded_inputs.inputs.foo)).to.be.equal(BigInt(foo)); + expect(BigInt(decoded_inputs.inputs.bar[0])).to.be.equal(BigInt(bar[0])); + expect(BigInt(decoded_inputs.inputs.bar[1])).to.be.equal(BigInt(bar[1])); + expect(decoded_inputs.return_value).to.be.null; +}); diff --git a/noir/tooling/noirc_abi_wasm/test/browser/errors.test.ts b/noir/tooling/noirc_abi_wasm/test/browser/errors.test.ts new file mode 100644 index 00000000000..429a2d446a3 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/browser/errors.test.ts @@ -0,0 +1,26 @@ +import { expect } from '@esm-bundle/chai'; +import initNoirAbi, { abiEncode } from '@noir-lang/noirc_abi'; + +beforeEach(async () => { + await initNoirAbi(); +}); + +it('errors when an integer input overflows', async () => { + const { abi, inputs } = await import('../shared/uint_overflow'); + + expect(() => abiEncode(abi, inputs)).to.throw( + 'The parameter foo is expected to be a Integer { sign: Unsigned, width: 32 } but found incompatible value Field(2³⁸)', + ); +}); + +it('errors when passing a field in place of an array', async () => { + const { abi, inputs } = await import('../shared/field_as_array'); + + expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Array { length: 2, typ: Field }'); +}); + +it('errors when passing an array in place of a field', async () => { + const { abi, inputs } = await import('../shared/array_as_field'); + + expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Field'); +}); diff --git a/noir/tooling/noirc_abi_wasm/test/node/abi_encode.test.ts b/noir/tooling/noirc_abi_wasm/test/node/abi_encode.test.ts new file mode 100644 index 00000000000..a49c10b6ea6 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/node/abi_encode.test.ts @@ -0,0 +1,17 @@ +import { expect } from 'chai'; +import { abiEncode, abiDecode, WitnessMap, Field } from '@noir-lang/noirc_abi'; +import { DecodedInputs } from '../types'; + +it('recovers original inputs when abi encoding and decoding', async () => { + const { abi, inputs } = await import('../shared/abi_encode'); + + const initial_witness: WitnessMap = abiEncode(abi, inputs); + const decoded_inputs: DecodedInputs = abiDecode(abi, initial_witness); + + const foo: Field = inputs.foo as Field; + const bar: Field[] = inputs.bar as Field[]; + expect(BigInt(decoded_inputs.inputs.foo)).to.be.equal(BigInt(foo)); + expect(BigInt(decoded_inputs.inputs.bar[0])).to.be.equal(BigInt(bar[0])); + expect(BigInt(decoded_inputs.inputs.bar[1])).to.be.equal(BigInt(bar[1])); + expect(decoded_inputs.return_value).to.be.null; +}); diff --git a/noir/tooling/noirc_abi_wasm/test/node/errors.test.ts b/noir/tooling/noirc_abi_wasm/test/node/errors.test.ts new file mode 100644 index 00000000000..0d007e64803 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/node/errors.test.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { abiEncode } from '@noir-lang/noirc_abi'; + +it('errors when an integer input overflows', async () => { + const { abi, inputs } = await import('../shared/uint_overflow'); + + expect(() => abiEncode(abi, inputs)).to.throw( + 'The parameter foo is expected to be a Integer { sign: Unsigned, width: 32 } but found incompatible value Field(2³⁸)', + ); +}); + +it('errors when passing a field in place of an array', async () => { + const { abi, inputs } = await import('../shared/field_as_array'); + + expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Array { length: 2, typ: Field }'); +}); + +it('errors when passing an array in place of a field', async () => { + const { abi, inputs } = await import('../shared/array_as_field'); + + expect(() => abiEncode(abi, inputs)).to.throw('cannot parse value into Field'); +}); diff --git a/noir/tooling/noirc_abi_wasm/test/shared/abi_encode.ts b/noir/tooling/noirc_abi_wasm/test/shared/abi_encode.ts new file mode 100644 index 00000000000..cb80c6710ba --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/shared/abi_encode.ts @@ -0,0 +1,20 @@ +import { Abi, InputMap } from '@noir-lang/noirc_abi'; + +export const abi: Abi = { + parameters: [ + { name: 'foo', type: { kind: 'field' }, visibility: 'private' }, + { + name: 'bar', + type: { kind: 'array', length: 2, type: { kind: 'field' } }, + visibility: 'private', + }, + ], + param_witnesses: { foo: [{ start: 1, end: 2 }], bar: [{ start: 2, end: 4 }] }, + return_type: null, + return_witnesses: [], +}; + +export const inputs: InputMap = { + foo: '1', + bar: ['1', '2'], +}; diff --git a/noir/tooling/noirc_abi_wasm/test/shared/array_as_field.ts b/noir/tooling/noirc_abi_wasm/test/shared/array_as_field.ts new file mode 100644 index 00000000000..0cc0035fa68 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/shared/array_as_field.ts @@ -0,0 +1,18 @@ +import { Abi, InputMap } from '@noir-lang/noirc_abi'; + +export const abi: Abi = { + parameters: [ + { + name: 'foo', + type: { kind: 'field' }, + visibility: 'private', + }, + ], + param_witnesses: { foo: [{ start: 1, end: 3 }] }, + return_type: null, + return_witnesses: [], +}; + +export const inputs: InputMap = { + foo: ['1', '2'], +}; diff --git a/noir/tooling/noirc_abi_wasm/test/shared/field_as_array.ts b/noir/tooling/noirc_abi_wasm/test/shared/field_as_array.ts new file mode 100644 index 00000000000..6ae709459de --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/shared/field_as_array.ts @@ -0,0 +1,18 @@ +import { Abi, InputMap } from '@noir-lang/noirc_abi'; + +export const abi: Abi = { + parameters: [ + { + name: 'foo', + type: { kind: 'array', length: 2, type: { kind: 'field' } }, + visibility: 'private', + }, + ], + param_witnesses: { foo: [{ start: 1, end: 3 }] }, + return_type: null, + return_witnesses: [], +}; + +export const inputs: InputMap = { + foo: '1', +}; diff --git a/noir/tooling/noirc_abi_wasm/test/shared/uint_overflow.ts b/noir/tooling/noirc_abi_wasm/test/shared/uint_overflow.ts new file mode 100644 index 00000000000..c6e066e2bcd --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/shared/uint_overflow.ts @@ -0,0 +1,18 @@ +import { Abi, InputMap } from '@noir-lang/noirc_abi'; + +export const abi: Abi = { + parameters: [ + { + name: 'foo', + type: { kind: 'integer', sign: 'unsigned', width: 32 }, + visibility: 'private', + }, + ], + param_witnesses: { foo: [{ start: 1, end: 2 }] }, + return_type: null, + return_witnesses: [], +}; + +export const inputs: InputMap = { + foo: `0x${(1n << 38n).toString(16)}`, +}; diff --git a/noir/tooling/noirc_abi_wasm/test/types.ts b/noir/tooling/noirc_abi_wasm/test/types.ts new file mode 100644 index 00000000000..3a72544b8d0 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/test/types.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type DecodedInputs = { inputs: Record; return_value: any }; diff --git a/noir/tooling/noirc_abi_wasm/tsconfig.json b/noir/tooling/noirc_abi_wasm/tsconfig.json new file mode 100644 index 00000000000..eef2ad84833 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "outDir": "lib", + "target": "ESNext", + "module": "ESNext", + "strict": true, + "experimentalDecorators": true, + "esModuleInterop": true, + "noImplicitAny": true, + "removeComments": false, + "preserveConstEnums": true, + "sourceMap": true, + "resolveJsonModule": true, + "importHelpers": true + } +} \ No newline at end of file diff --git a/noir/tooling/noirc_abi_wasm/web-test-runner.config.mjs b/noir/tooling/noirc_abi_wasm/web-test-runner.config.mjs new file mode 100644 index 00000000000..282c19c1cd2 --- /dev/null +++ b/noir/tooling/noirc_abi_wasm/web-test-runner.config.mjs @@ -0,0 +1,32 @@ +import { defaultReporter } from "@web/test-runner"; +import { summaryReporter } from "@web/test-runner"; +import { fileURLToPath } from "url"; +import { esbuildPlugin } from "@web/dev-server-esbuild"; +import { playwrightLauncher } from "@web/test-runner-playwright"; + +// eslint-disable-next-line no-undef +const reporter = process.env.CI ? summaryReporter() : defaultReporter(); + +export default { + browsers: [ + playwrightLauncher({ product: "chromium" }), + // playwrightLauncher({ product: "webkit" }), + // playwrightLauncher({ product: "firefox" }), + ], + plugins: [ + esbuildPlugin({ + ts: true, + }), + ], + files: ["test/browser/**/*.test.ts"], + nodeResolve: true, + testFramework: { + config: { + ui: "bdd", + timeout: 40000, + }, + }, + // eslint-disable-next-line no-undef + rootDir: fileURLToPath(new URL("./../../", import.meta.url)), + reporters: [reporter], +}; diff --git a/noir/tooling/readme.md b/noir/tooling/readme.md new file mode 100644 index 00000000000..20d1b560b5b --- /dev/null +++ b/noir/tooling/readme.md @@ -0,0 +1,15 @@ +# Structure + +Below we briefly describe the purpose of each tool-related crate in this repository. + +## nargo + +This is the default package manager used by Noir. One may draw similarities to Rusts' Cargo. + +## nargo_fmt + +This is the default formatter used by Noir, analogous to Rust's rustfmt. + +## lsp + +This is the platform agnostic implementation of Noir's Language Server. It implements the various features supported, but doesn't bind to any particular transport. Binding to a transport must be done when consuming the crate. diff --git a/noir/wasm-bindgen-cli.nix b/noir/wasm-bindgen-cli.nix new file mode 100644 index 00000000000..7c3910f032e --- /dev/null +++ b/noir/wasm-bindgen-cli.nix @@ -0,0 +1,43 @@ +{ lib +, rustPlatform +, fetchCrate +, nodejs +, pkg-config +, openssl +, stdenv +, curl +, darwin +, libiconv +, runCommand +}: + +rustPlatform.buildRustPackage rec { + pname = "wasm-bindgen-cli"; + version = "0.2.86"; + + src = fetchCrate { + inherit pname version; + sha256 = "sha256-56EOiLbdgAcoTrkyvB3t9TjtLaRvGxFUXx4haLwE2QY="; + }; + + cargoSha256 = "sha256-4CPBmz92PuPN6KeGDTdYPAf5+vTFk9EN5Cmx4QJy6yI="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ + curl + # Need libiconv and apple Security on Darwin. See https://github.com/ipetkov/crane/issues/156 + libiconv + darwin.apple_sdk.frameworks.Security + ]; + + doCheck = false; + + meta = with lib; { + homepage = "https://rustwasm.github.io/docs/wasm-bindgen/"; + license = with licenses; [ asl20 /* or */ mit ]; + description = "Facilitating high-level interactions between wasm modules and JavaScript"; + maintainers = with maintainers; [ nitsky rizary ]; + mainProgram = "wasm-bindgen"; + }; +} diff --git a/noir/yarn.lock b/noir/yarn.lock new file mode 100644 index 00000000000..87713e1f915 --- /dev/null +++ b/noir/yarn.lock @@ -0,0 +1,17858 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 6 + cacheKey: 8 + +"@75lb/deep-merge@npm:^1.1.1": + version: 1.1.1 + resolution: "@75lb/deep-merge@npm:1.1.1" + dependencies: + lodash.assignwith: ^4.2.0 + typical: ^7.1.1 + checksum: fd9063488d854bc5d2e1636426a51d7864d0d32d2d82c5b01a40e89466088680f6e2623345fb46782de438088b6d3f029b0eea6d79a7807e0000b365f6b8142b + languageName: node + linkType: hard + +"@aashutoshrathi/word-wrap@npm:^1.2.3": + version: 1.2.6 + resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" + checksum: ada901b9e7c680d190f1d012c84217ce0063d8f5c5a7725bb91ec3c5ed99bb7572680eb2d2938a531ccbaec39a95422fcd8a6b4a13110c7d98dd75402f66a0cd + languageName: node + linkType: hard + +"@adraffy/ens-normalize@npm:1.9.2": + version: 1.9.2 + resolution: "@adraffy/ens-normalize@npm:1.9.2" + checksum: a9fdeb9e080774c19e4b7f9f60aa5b37cf23fe0e8fe80284bf8221f7396e9f78642bfd39a09a94a4dc3fb8e70f2ac81545204bdcaf222d93f4c4c2ae1f0dca0b + languageName: node + linkType: hard + +"@algolia/autocomplete-core@npm:1.9.3": + version: 1.9.3 + resolution: "@algolia/autocomplete-core@npm:1.9.3" + dependencies: + "@algolia/autocomplete-plugin-algolia-insights": 1.9.3 + "@algolia/autocomplete-shared": 1.9.3 + checksum: ce78048568660184a4fa3c6548f344a7f5ce0ba45d4cfc233f9756b6d4f360afd5ae3a18efefcd27a626d3a0d6cf22d9cba3e21b217afae62b8e9d11bc4960da + languageName: node + linkType: hard + +"@algolia/autocomplete-plugin-algolia-insights@npm:1.9.3": + version: 1.9.3 + resolution: "@algolia/autocomplete-plugin-algolia-insights@npm:1.9.3" + dependencies: + "@algolia/autocomplete-shared": 1.9.3 + peerDependencies: + search-insights: ">= 1 < 3" + checksum: 030695bf692021c27f52a3d4931efed23032796e326d4ae7957ae91b51c36a10dc2d885fb043909e853f961c994b8e9ff087f50bb918cfa075370562251a199f + languageName: node + linkType: hard + +"@algolia/autocomplete-preset-algolia@npm:1.9.3": + version: 1.9.3 + resolution: "@algolia/autocomplete-preset-algolia@npm:1.9.3" + dependencies: + "@algolia/autocomplete-shared": 1.9.3 + peerDependencies: + "@algolia/client-search": ">= 4.9.1 < 6" + algoliasearch: ">= 4.9.1 < 6" + checksum: 1ab3273d3054b348eed286ad1a54b21807846326485507b872477b827dc688006d4f14233cebd0bf49b2932ec8e29eca6d76e48a3c9e9e963b25153b987549c0 + languageName: node + linkType: hard + +"@algolia/autocomplete-shared@npm:1.9.3": + version: 1.9.3 + resolution: "@algolia/autocomplete-shared@npm:1.9.3" + peerDependencies: + "@algolia/client-search": ">= 4.9.1 < 6" + algoliasearch: ">= 4.9.1 < 6" + checksum: 06014c8b08d30c452de079f48c0235d8fa09904bf511da8dc1b7e491819940fd4ff36b9bf65340242b2e157a26799a3b9aea01feee9c5bf67be3c48d7dff43d7 + languageName: node + linkType: hard + +"@algolia/cache-browser-local-storage@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/cache-browser-local-storage@npm:4.20.0" + dependencies: + "@algolia/cache-common": 4.20.0 + checksum: b9ca7e190ab77ddf4d30d22223345f69fc89899aa6887ee716e4ffcef14c8c9d28b782cb7cc96a0f04eed95a989878a6feca5b9aa6add0cd1846222c3308bb65 + languageName: node + linkType: hard + +"@algolia/cache-common@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/cache-common@npm:4.20.0" + checksum: a46377de8a309feea109aae1283fc9157c73766a4c51e3085870a1fc49f6e33698814379f3bbdf475713fa0663dace86fc90f0466e64469b1b885a0538abace4 + languageName: node + linkType: hard + +"@algolia/cache-in-memory@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/cache-in-memory@npm:4.20.0" + dependencies: + "@algolia/cache-common": 4.20.0 + checksum: 3d67dcfae431605c8b9b1502f14865722f13b97b2822e1e3ed53bbf7bf66a120a825ccf5ed03476ebdf4aa15482dad5bfc6c2c93d81f07f862c373c689f49317 + languageName: node + linkType: hard + +"@algolia/client-account@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/client-account@npm:4.20.0" + dependencies: + "@algolia/client-common": 4.20.0 + "@algolia/client-search": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: b59e9c7a324bbfba4abdab3f41d333522eb1abce7dab74e69d297acd9ee2a3c60e82e5e9db42e6a46b5ea26a35728533e6e4ff846c631b588ceb73d14dcbc5fb + languageName: node + linkType: hard + +"@algolia/client-analytics@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/client-analytics@npm:4.20.0" + dependencies: + "@algolia/client-common": 4.20.0 + "@algolia/client-search": 4.20.0 + "@algolia/requester-common": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: 0be4120ab72162e0640e49eedddff81bfc2c590e9a9322d1788b8c01e06fdabcaaaa9cd75b5b516e502deb888d3ba2285ac5e1c3bb91fc9eb552a24a716dc6e3 + languageName: node + linkType: hard + +"@algolia/client-common@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/client-common@npm:4.20.0" + dependencies: + "@algolia/requester-common": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: 88a27b5f8bba38349e1dbe47634e2ee159a413ff1a3baf6a65fbf244835f8d368e9f0a5ccce8bfe94ec405b38608be5bed45bcb140517f3aba6fe3b7045db373 + languageName: node + linkType: hard + +"@algolia/client-personalization@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/client-personalization@npm:4.20.0" + dependencies: + "@algolia/client-common": 4.20.0 + "@algolia/requester-common": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: ddb92ebe135564e03db6ac75da7fdc1c7500a0deffb7e41d5a02a413216a06daea008f8062dab606ba8af4c3c34e550354f48e6ea7b048882c385d915643799a + languageName: node + linkType: hard + +"@algolia/client-search@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/client-search@npm:4.20.0" + dependencies: + "@algolia/client-common": 4.20.0 + "@algolia/requester-common": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: 9fb6624dab6753f336f3207ee2af3558baeec4772ef739b6f6ed6a754c366e2e8d62cbf1cf8b28d5f763bec276a0a5fc36db2bf6f53a707890a411afcf550e92 + languageName: node + linkType: hard + +"@algolia/events@npm:^4.0.1": + version: 4.0.1 + resolution: "@algolia/events@npm:4.0.1" + checksum: 4f63943f4554cfcfed91d8b8c009a49dca192b81056d8c75e532796f64828cd69899852013e81ff3fff07030df8782b9b95c19a3da0845786bdfe22af42442c2 + languageName: node + linkType: hard + +"@algolia/logger-common@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/logger-common@npm:4.20.0" + checksum: 06ed28f76b630c8e7597534b15138ab6f71c10dfc6e13f1fb1b76965b39c88fd1d9cb3fe6bb9d046de6533ebcbe5ad92e751bc36fabe98ceda39d1d5f47bb637 + languageName: node + linkType: hard + +"@algolia/logger-console@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/logger-console@npm:4.20.0" + dependencies: + "@algolia/logger-common": 4.20.0 + checksum: 721dffe37563e2998d4c361f09a05736b4baa141bfb7da25d50f890ba8257ac99845dd94b43d0d6db38e2fdab96508a726e184a00e5b1e83ef18a16da6fc716c + languageName: node + linkType: hard + +"@algolia/requester-browser-xhr@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/requester-browser-xhr@npm:4.20.0" + dependencies: + "@algolia/requester-common": 4.20.0 + checksum: 669790c7dfd491318976b9d61d98d9785880d7385ba33669f3f8b9c66ea88320bcded82d34f58b5df74b2cb8beb62ef48a28d39117f7997be84348c9fa7f6132 + languageName: node + linkType: hard + +"@algolia/requester-common@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/requester-common@npm:4.20.0" + checksum: 8580ffd2be146bbdb5d4a57668bba4a5014f406cb2e5c65f596db6babab46c48d30c6e4732034ee1f987970aa27dcdab567959d654fa5fa74c4bcaf98312a724 + languageName: node + linkType: hard + +"@algolia/requester-node-http@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/requester-node-http@npm:4.20.0" + dependencies: + "@algolia/requester-common": 4.20.0 + checksum: 7857114b59c67e0d22e8a7ff3f755d11534a1602a4fc80802d3b35802777880a4980420914ea4a6e3e21198f5bacb95906289ce1bb9372458bf6a60a723bee59 + languageName: node + linkType: hard + +"@algolia/transporter@npm:4.20.0": + version: 4.20.0 + resolution: "@algolia/transporter@npm:4.20.0" + dependencies: + "@algolia/cache-common": 4.20.0 + "@algolia/logger-common": 4.20.0 + "@algolia/requester-common": 4.20.0 + checksum: f834d5c8fcb7dfa9b7044cb81e9fab44a32f9dd0c3868a0f85fe0de4f4d27ad11fdc9c3c78541bc944c2593f4be56517a8ce593309d062b8a46ca0d6fcb5dcbc + languageName: node + linkType: hard + +"@ampproject/remapping@npm:^2.2.0": + version: 2.2.1 + resolution: "@ampproject/remapping@npm:2.2.1" + dependencies: + "@jridgewell/gen-mapping": ^0.3.0 + "@jridgewell/trace-mapping": ^0.3.9 + checksum: 03c04fd526acc64a1f4df22651186f3e5ef0a9d6d6530ce4482ec9841269cf7a11dbb8af79237c282d721c5312024ff17529cd72cc4768c11e999b58e2302079 + languageName: node + linkType: hard + +"@aztec/bb.js@npm:0.12.0": + version: 0.12.0 + resolution: "@aztec/bb.js@npm:0.12.0" + dependencies: + comlink: ^4.4.1 + commander: ^10.0.1 + debug: ^4.3.4 + tslib: ^2.4.0 + bin: + bb.js: dest/node/main.js + checksum: d9d57b893b9b1c61949cb9bd911d4b7e1ece34965ccb9e122b39cd4e2edac9f06858abbe05c23f66141c9a74ff4861a354bfc5d62e5dcf772cfe8d1c783e2562 + languageName: node + linkType: hard + +"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.11, @babel/code-frame@npm:^7.16.0, @babel/code-frame@npm:^7.22.13, @babel/code-frame@npm:^7.8.3": + version: 7.22.13 + resolution: "@babel/code-frame@npm:7.22.13" + dependencies: + "@babel/highlight": ^7.22.13 + chalk: ^2.4.2 + checksum: 22e342c8077c8b77eeb11f554ecca2ba14153f707b85294fcf6070b6f6150aae88a7b7436dd88d8c9289970585f3fe5b9b941c5aa3aa26a6d5a8ef3f292da058 + languageName: node + linkType: hard + +"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.22.9, @babel/compat-data@npm:^7.23.2": + version: 7.23.2 + resolution: "@babel/compat-data@npm:7.23.2" + checksum: d8dc27437d40907b271161d4c88ffe72ccecb034c730deb1960a417b59a14d7c5ebca8cd80dd458a01cd396a7a329eb48cddcc3791b5a84da33d7f278f7bec6a + languageName: node + linkType: hard + +"@babel/core@npm:7.12.9": + version: 7.12.9 + resolution: "@babel/core@npm:7.12.9" + dependencies: + "@babel/code-frame": ^7.10.4 + "@babel/generator": ^7.12.5 + "@babel/helper-module-transforms": ^7.12.1 + "@babel/helpers": ^7.12.5 + "@babel/parser": ^7.12.7 + "@babel/template": ^7.12.7 + "@babel/traverse": ^7.12.9 + "@babel/types": ^7.12.7 + convert-source-map: ^1.7.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.1 + json5: ^2.1.2 + lodash: ^4.17.19 + resolve: ^1.3.2 + semver: ^5.4.1 + source-map: ^0.5.0 + checksum: 4d34eca4688214a4eb6bd5dde906b69a7824f17b931f52cd03628a8ac94d8fbe15565aebffdde106e974c8738cd64ac62c6a6060baa7139a06db1f18c4ff872d + languageName: node + linkType: hard + +"@babel/core@npm:^7.18.6, @babel/core@npm:^7.19.6": + version: 7.23.2 + resolution: "@babel/core@npm:7.23.2" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.22.13 + "@babel/generator": ^7.23.0 + "@babel/helper-compilation-targets": ^7.22.15 + "@babel/helper-module-transforms": ^7.23.0 + "@babel/helpers": ^7.23.2 + "@babel/parser": ^7.23.0 + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.2 + "@babel/types": ^7.23.0 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: 003897718ded16f3b75632d63cd49486bf67ff206cc7ebd1a10d49e2456f8d45740910d5ec7e42e3faf0deec7a2e96b1a02e766d19a67a8309053f0d4e57c0fe + languageName: node + linkType: hard + +"@babel/generator@npm:^7.12.5, @babel/generator@npm:^7.18.7, @babel/generator@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/generator@npm:7.23.0" + dependencies: + "@babel/types": ^7.23.0 + "@jridgewell/gen-mapping": ^0.3.2 + "@jridgewell/trace-mapping": ^0.3.17 + jsesc: ^2.5.1 + checksum: 8efe24adad34300f1f8ea2add420b28171a646edc70f2a1b3e1683842f23b8b7ffa7e35ef0119294e1901f45bfea5b3dc70abe1f10a1917ccdfb41bed69be5f1 + languageName: node + linkType: hard + +"@babel/helper-annotate-as-pure@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" + dependencies: + "@babel/types": ^7.22.5 + checksum: 53da330f1835c46f26b7bf4da31f7a496dee9fd8696cca12366b94ba19d97421ce519a74a837f687749318f94d1a37f8d1abcbf35e8ed22c32d16373b2f6198d + languageName: node + linkType: hard + +"@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.22.15" + dependencies: + "@babel/types": ^7.22.15 + checksum: 639c697a1c729f9fafa2dd4c9af2e18568190299b5907bd4c2d0bc818fcbd1e83ffeecc2af24327a7faa7ac4c34edd9d7940510a5e66296c19bad17001cf5c7a + languageName: node + linkType: hard + +"@babel/helper-compilation-targets@npm:^7.22.15, @babel/helper-compilation-targets@npm:^7.22.5, @babel/helper-compilation-targets@npm:^7.22.6": + version: 7.22.15 + resolution: "@babel/helper-compilation-targets@npm:7.22.15" + dependencies: + "@babel/compat-data": ^7.22.9 + "@babel/helper-validator-option": ^7.22.15 + browserslist: ^4.21.9 + lru-cache: ^5.1.1 + semver: ^6.3.1 + checksum: ce85196769e091ae54dd39e4a80c2a9df1793da8588e335c383d536d54f06baf648d0a08fc873044f226398c4ded15c4ae9120ee18e7dfd7c639a68e3cdc9980 + languageName: node + linkType: hard + +"@babel/helper-create-class-features-plugin@npm:^7.22.11, @babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/helper-create-class-features-plugin@npm:7.22.15" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-environment-visitor": ^7.22.5 + "@babel/helper-function-name": ^7.22.5 + "@babel/helper-member-expression-to-functions": ^7.22.15 + "@babel/helper-optimise-call-expression": ^7.22.5 + "@babel/helper-replace-supers": ^7.22.9 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 52c500d8d164abb3a360b1b7c4b8fff77bc4a5920d3a2b41ae6e1d30617b0dc0b972c1f5db35b1752007e04a748908b4a99bc872b73549ae837e87dcdde005a3 + languageName: node + linkType: hard + +"@babel/helper-create-regexp-features-plugin@npm:^7.18.6, @babel/helper-create-regexp-features-plugin@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/helper-create-regexp-features-plugin@npm:7.22.15" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + regexpu-core: ^5.3.1 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 0243b8d4854f1dc8861b1029a46d3f6393ad72f366a5a08e36a4648aa682044f06da4c6e87a456260e1e1b33c999f898ba591a0760842c1387bcc93fbf2151a6 + languageName: node + linkType: hard + +"@babel/helper-define-polyfill-provider@npm:^0.4.3": + version: 0.4.3 + resolution: "@babel/helper-define-polyfill-provider@npm:0.4.3" + dependencies: + "@babel/helper-compilation-targets": ^7.22.6 + "@babel/helper-plugin-utils": ^7.22.5 + debug: ^4.1.1 + lodash.debounce: ^4.0.8 + resolve: ^1.14.2 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 5d21e3f47b320e4b5b644195ec405e7ebc3739e48e65899efc808c5fa9c3bf5b06ce0d8ff5246ca99d1411e368f4557bc66730196c5781a5c4e986ee703bee79 + languageName: node + linkType: hard + +"@babel/helper-environment-visitor@npm:^7.22.20, @babel/helper-environment-visitor@npm:^7.22.5": + version: 7.22.20 + resolution: "@babel/helper-environment-visitor@npm:7.22.20" + checksum: d80ee98ff66f41e233f36ca1921774c37e88a803b2f7dca3db7c057a5fea0473804db9fb6729e5dbfd07f4bed722d60f7852035c2c739382e84c335661590b69 + languageName: node + linkType: hard + +"@babel/helper-function-name@npm:^7.22.5, @babel/helper-function-name@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-function-name@npm:7.23.0" + dependencies: + "@babel/template": ^7.22.15 + "@babel/types": ^7.23.0 + checksum: e44542257b2d4634a1f979244eb2a4ad8e6d75eb6761b4cfceb56b562f7db150d134bc538c8e6adca3783e3bc31be949071527aa8e3aab7867d1ad2d84a26e10 + languageName: node + linkType: hard + +"@babel/helper-hoist-variables@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-hoist-variables@npm:7.22.5" + dependencies: + "@babel/types": ^7.22.5 + checksum: 394ca191b4ac908a76e7c50ab52102669efe3a1c277033e49467913c7ed6f7c64d7eacbeabf3bed39ea1f41731e22993f763b1edce0f74ff8563fd1f380d92cc + languageName: node + linkType: hard + +"@babel/helper-member-expression-to-functions@npm:^7.22.15": + version: 7.23.0 + resolution: "@babel/helper-member-expression-to-functions@npm:7.23.0" + dependencies: + "@babel/types": ^7.23.0 + checksum: 494659361370c979ada711ca685e2efe9460683c36db1b283b446122596602c901e291e09f2f980ecedfe6e0f2bd5386cb59768285446530df10c14df1024e75 + languageName: node + linkType: hard + +"@babel/helper-module-imports@npm:^7.22.15, @babel/helper-module-imports@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/helper-module-imports@npm:7.22.15" + dependencies: + "@babel/types": ^7.22.15 + checksum: ecd7e457df0a46f889228f943ef9b4a47d485d82e030676767e6a2fdcbdaa63594d8124d4b55fd160b41c201025aec01fc27580352b1c87a37c9c6f33d116702 + languageName: node + linkType: hard + +"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.22.5, @babel/helper-module-transforms@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/helper-module-transforms@npm:7.23.0" + dependencies: + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-module-imports": ^7.22.15 + "@babel/helper-simple-access": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/helper-validator-identifier": ^7.22.20 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 6e2afffb058cf3f8ce92f5116f710dda4341c81cfcd872f9a0197ea594f7ce0ab3cb940b0590af2fe99e60d2e5448bfba6bca8156ed70a2ed4be2adc8586c891 + languageName: node + linkType: hard + +"@babel/helper-optimise-call-expression@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-optimise-call-expression@npm:7.22.5" + dependencies: + "@babel/types": ^7.22.5 + checksum: c70ef6cc6b6ed32eeeec4482127e8be5451d0e5282d5495d5d569d39eb04d7f1d66ec99b327f45d1d5842a9ad8c22d48567e93fc502003a47de78d122e355f7c + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:7.10.4": + version: 7.10.4 + resolution: "@babel/helper-plugin-utils@npm:7.10.4" + checksum: 639ed8fc462b97a83226cee6bb081b1d77e7f73e8b033d2592ed107ee41d96601e321e5ea53a33e47469c7f1146b250a3dcda5ab873c7de162ab62120c341a41 + languageName: node + linkType: hard + +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": + version: 7.22.5 + resolution: "@babel/helper-plugin-utils@npm:7.22.5" + checksum: c0fc7227076b6041acd2f0e818145d2e8c41968cc52fb5ca70eed48e21b8fe6dd88a0a91cbddf4951e33647336eb5ae184747ca706817ca3bef5e9e905151ff5 + languageName: node + linkType: hard + +"@babel/helper-remap-async-to-generator@npm:^7.22.20, @babel/helper-remap-async-to-generator@npm:^7.22.5": + version: 7.22.20 + resolution: "@babel/helper-remap-async-to-generator@npm:7.22.20" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-wrap-function": ^7.22.20 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 2fe6300a6f1b58211dffa0aed1b45d4958506d096543663dba83bd9251fe8d670fa909143a65b45e72acb49e7e20fbdb73eae315d9ddaced467948c3329986e7 + languageName: node + linkType: hard + +"@babel/helper-replace-supers@npm:^7.22.5, @babel/helper-replace-supers@npm:^7.22.9": + version: 7.22.20 + resolution: "@babel/helper-replace-supers@npm:7.22.20" + dependencies: + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-member-expression-to-functions": ^7.22.15 + "@babel/helper-optimise-call-expression": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: a0008332e24daedea2e9498733e3c39b389d6d4512637e000f96f62b797e702ee24a407ccbcd7a236a551590a38f31282829a8ef35c50a3c0457d88218cae639 + languageName: node + linkType: hard + +"@babel/helper-simple-access@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-simple-access@npm:7.22.5" + dependencies: + "@babel/types": ^7.22.5 + checksum: fe9686714caf7d70aedb46c3cce090f8b915b206e09225f1e4dbc416786c2fdbbee40b38b23c268b7ccef749dd2db35f255338fb4f2444429874d900dede5ad2 + languageName: node + linkType: hard + +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.22.5" + dependencies: + "@babel/types": ^7.22.5 + checksum: 1012ef2295eb12dc073f2b9edf3425661e9b8432a3387e62a8bc27c42963f1f216ab3124228015c748770b2257b4f1fda882ca8fa34c0bf485e929ae5bc45244 + languageName: node + linkType: hard + +"@babel/helper-split-export-declaration@npm:^7.22.6": + version: 7.22.6 + resolution: "@babel/helper-split-export-declaration@npm:7.22.6" + dependencies: + "@babel/types": ^7.22.5 + checksum: e141cace583b19d9195f9c2b8e17a3ae913b7ee9b8120246d0f9ca349ca6f03cb2c001fd5ec57488c544347c0bb584afec66c936511e447fd20a360e591ac921 + languageName: node + linkType: hard + +"@babel/helper-string-parser@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/helper-string-parser@npm:7.22.5" + checksum: 836851ca5ec813077bbb303acc992d75a360267aa3b5de7134d220411c852a6f17de7c0d0b8c8dcc0f567f67874c00f4528672b2a4f1bc978a3ada64c8c78467 + languageName: node + linkType: hard + +"@babel/helper-validator-identifier@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-validator-identifier@npm:7.22.20" + checksum: 136412784d9428266bcdd4d91c32bcf9ff0e8d25534a9d94b044f77fe76bc50f941a90319b05aafd1ec04f7d127cd57a179a3716009ff7f3412ef835ada95bdc + languageName: node + linkType: hard + +"@babel/helper-validator-option@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/helper-validator-option@npm:7.22.15" + checksum: 68da52b1e10002a543161494c4bc0f4d0398c8fdf361d5f7f4272e95c45d5b32d974896d44f6a0ea7378c9204988879d73613ca683e13bd1304e46d25ff67a8d + languageName: node + linkType: hard + +"@babel/helper-wrap-function@npm:^7.22.20": + version: 7.22.20 + resolution: "@babel/helper-wrap-function@npm:7.22.20" + dependencies: + "@babel/helper-function-name": ^7.22.5 + "@babel/template": ^7.22.15 + "@babel/types": ^7.22.19 + checksum: 221ed9b5572612aeb571e4ce6a256f2dee85b3c9536f1dd5e611b0255e5f59a3d0ec392d8d46d4152149156a8109f92f20379b1d6d36abb613176e0e33f05fca + languageName: node + linkType: hard + +"@babel/helpers@npm:^7.12.5, @babel/helpers@npm:^7.23.2": + version: 7.23.2 + resolution: "@babel/helpers@npm:7.23.2" + dependencies: + "@babel/template": ^7.22.15 + "@babel/traverse": ^7.23.2 + "@babel/types": ^7.23.0 + checksum: aaf4828df75ec460eaa70e5c9f66e6dadc28dae3728ddb7f6c13187dbf38030e142194b83d81aa8a31bbc35a5529a5d7d3f3cf59d5d0b595f5dd7f9d8f1ced8e + languageName: node + linkType: hard + +"@babel/highlight@npm:^7.22.13": + version: 7.22.20 + resolution: "@babel/highlight@npm:7.22.20" + dependencies: + "@babel/helper-validator-identifier": ^7.22.20 + chalk: ^2.4.2 + js-tokens: ^4.0.0 + checksum: 84bd034dca309a5e680083cd827a766780ca63cef37308404f17653d32366ea76262bd2364b2d38776232f2d01b649f26721417d507e8b4b6da3e4e739f6d134 + languageName: node + linkType: hard + +"@babel/parser@npm:^7.12.7, @babel/parser@npm:^7.18.8, @babel/parser@npm:^7.22.15, @babel/parser@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/parser@npm:7.23.0" + bin: + parser: ./bin/babel-parser.js + checksum: 453fdf8b9e2c2b7d7b02139e0ce003d1af21947bbc03eb350fb248ee335c9b85e4ab41697ddbdd97079698de825a265e45a0846bb2ed47a2c7c1df833f42a354 + languageName: node + linkType: hard + +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@npm:7.22.15" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 8910ca21a7ec7c06f7b247d4b86c97c5aa15ef321518f44f6f490c5912fdf82c605aaa02b90892e375d82ccbedeadfdeadd922c1b836c9dd4c596871bf654753 + languageName: node + linkType: hard + +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@npm:7.22.15" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + "@babel/plugin-transform-optional-chaining": ^7.22.15 + peerDependencies: + "@babel/core": ^7.13.0 + checksum: fbefedc0da014c37f1a50a8094ce7dbbf2181ae93243f23d6ecba2499b5b20196c2124d6a4dfe3e9e0125798e80593103e456352a4beb4e5c6f7c75efb80fdac + languageName: node + linkType: hard + +"@babel/plugin-proposal-object-rest-spread@npm:7.12.1": + version: 7.12.1 + resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.12.1" + dependencies: + "@babel/helper-plugin-utils": ^7.10.4 + "@babel/plugin-syntax-object-rest-spread": ^7.8.0 + "@babel/plugin-transform-parameters": ^7.12.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 221a41630c9a7162bf0416c71695b3f7f38482078a1d0d3af7abdc4f07ea1c9feed890399158d56c1d0278c971fe6f565ce822e9351e4481f7d98e9ff735dced + languageName: node + linkType: hard + +"@babel/plugin-proposal-private-property-in-object@npm:7.21.0-placeholder-for-preset-env.2": + version: 7.21.0-placeholder-for-preset-env.2 + resolution: "@babel/plugin-proposal-private-property-in-object@npm:7.21.0-placeholder-for-preset-env.2" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: d97745d098b835d55033ff3a7fb2b895b9c5295b08a5759e4f20df325aa385a3e0bc9bd5ad8f2ec554a44d4e6525acfc257b8c5848a1345cb40f26a30e277e91 + languageName: node + linkType: hard + +"@babel/plugin-syntax-async-generators@npm:^7.8.4": + version: 7.8.4 + resolution: "@babel/plugin-syntax-async-generators@npm:7.8.4" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 7ed1c1d9b9e5b64ef028ea5e755c0be2d4e5e4e3d6cf7df757b9a8c4cfa4193d268176d0f1f7fbecdda6fe722885c7fda681f480f3741d8a2d26854736f05367 + languageName: node + linkType: hard + +"@babel/plugin-syntax-class-properties@npm:^7.12.13": + version: 7.12.13 + resolution: "@babel/plugin-syntax-class-properties@npm:7.12.13" + dependencies: + "@babel/helper-plugin-utils": ^7.12.13 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 24f34b196d6342f28d4bad303612d7ff566ab0a013ce89e775d98d6f832969462e7235f3e7eaf17678a533d4be0ba45d3ae34ab4e5a9dcbda5d98d49e5efa2fc + languageName: node + linkType: hard + +"@babel/plugin-syntax-class-static-block@npm:^7.14.5": + version: 7.14.5 + resolution: "@babel/plugin-syntax-class-static-block@npm:7.14.5" + dependencies: + "@babel/helper-plugin-utils": ^7.14.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3e80814b5b6d4fe17826093918680a351c2d34398a914ce6e55d8083d72a9bdde4fbaf6a2dcea0e23a03de26dc2917ae3efd603d27099e2b98380345703bf948 + languageName: node + linkType: hard + +"@babel/plugin-syntax-dynamic-import@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-dynamic-import@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ce307af83cf433d4ec42932329fad25fa73138ab39c7436882ea28742e1c0066626d224e0ad2988724c82644e41601cef607b36194f695cb78a1fcdc959637bd + languageName: node + linkType: hard + +"@babel/plugin-syntax-export-namespace-from@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-export-namespace-from@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 85740478be5b0de185228e7814451d74ab8ce0a26fcca7613955262a26e99e8e15e9da58f60c754b84515d4c679b590dbd3f2148f0f58025f4ae706f1c5a5d4a + languageName: node + linkType: hard + +"@babel/plugin-syntax-import-assertions@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-syntax-import-assertions@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 2b8b5572db04a7bef1e6cd20debf447e4eef7cb012616f5eceb8fa3e23ce469b8f76ee74fd6d1e158ba17a8f58b0aec579d092fb67c5a30e83ccfbc5754916c1 + languageName: node + linkType: hard + +"@babel/plugin-syntax-import-attributes@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-syntax-import-attributes@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 197b3c5ea2a9649347f033342cb222ab47f4645633695205c0250c6bf2af29e643753b8bb24a2db39948bef08e7c540babfd365591eb57fc110cb30b425ffc47 + languageName: node + linkType: hard + +"@babel/plugin-syntax-import-meta@npm:^7.10.4": + version: 7.10.4 + resolution: "@babel/plugin-syntax-import-meta@npm:7.10.4" + dependencies: + "@babel/helper-plugin-utils": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 166ac1125d10b9c0c430e4156249a13858c0366d38844883d75d27389621ebe651115cb2ceb6dc011534d5055719fa1727b59f39e1ab3ca97820eef3dcab5b9b + languageName: node + linkType: hard + +"@babel/plugin-syntax-json-strings@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-json-strings@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: bf5aea1f3188c9a507e16efe030efb996853ca3cadd6512c51db7233cc58f3ac89ff8c6bdfb01d30843b161cfe7d321e1bf28da82f7ab8d7e6bc5464666f354a + languageName: node + linkType: hard + +"@babel/plugin-syntax-jsx@npm:7.12.1": + version: 7.12.1 + resolution: "@babel/plugin-syntax-jsx@npm:7.12.1" + dependencies: + "@babel/helper-plugin-utils": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: d4b9b589c484b2e0856799770f060dff34c67b24d7f4526f66309a0e0e9cf388a5c1f2c0da329d1973cc87d1b2cede8f3dc8facfac59e785d6393a003bcdd0f9 + languageName: node + linkType: hard + +"@babel/plugin-syntax-jsx@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-syntax-jsx@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8829d30c2617ab31393d99cec2978e41f014f4ac6f01a1cecf4c4dd8320c3ec12fdc3ce121126b2d8d32f6887e99ca1a0bad53dedb1e6ad165640b92b24980ce + languageName: node + linkType: hard + +"@babel/plugin-syntax-logical-assignment-operators@npm:^7.10.4": + version: 7.10.4 + resolution: "@babel/plugin-syntax-logical-assignment-operators@npm:7.10.4" + dependencies: + "@babel/helper-plugin-utils": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: aff33577037e34e515911255cdbb1fd39efee33658aa00b8a5fd3a4b903585112d037cce1cc9e4632f0487dc554486106b79ccd5ea63a2e00df4363f6d4ff886 + languageName: node + linkType: hard + +"@babel/plugin-syntax-nullish-coalescing-operator@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-nullish-coalescing-operator@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 87aca4918916020d1fedba54c0e232de408df2644a425d153be368313fdde40d96088feed6c4e5ab72aac89be5d07fef2ddf329a15109c5eb65df006bf2580d1 + languageName: node + linkType: hard + +"@babel/plugin-syntax-numeric-separator@npm:^7.10.4": + version: 7.10.4 + resolution: "@babel/plugin-syntax-numeric-separator@npm:7.10.4" + dependencies: + "@babel/helper-plugin-utils": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 01ec5547bd0497f76cc903ff4d6b02abc8c05f301c88d2622b6d834e33a5651aa7c7a3d80d8d57656a4588f7276eba357f6b7e006482f5b564b7a6488de493a1 + languageName: node + linkType: hard + +"@babel/plugin-syntax-object-rest-spread@npm:7.8.3, @babel/plugin-syntax-object-rest-spread@npm:^7.8.0, @babel/plugin-syntax-object-rest-spread@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-object-rest-spread@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: fddcf581a57f77e80eb6b981b10658421bc321ba5f0a5b754118c6a92a5448f12a0c336f77b8abf734841e102e5126d69110a306eadb03ca3e1547cab31f5cbf + languageName: node + linkType: hard + +"@babel/plugin-syntax-optional-catch-binding@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-optional-catch-binding@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 910d90e72bc90ea1ce698e89c1027fed8845212d5ab588e35ef91f13b93143845f94e2539d831dc8d8ededc14ec02f04f7bd6a8179edd43a326c784e7ed7f0b9 + languageName: node + linkType: hard + +"@babel/plugin-syntax-optional-chaining@npm:^7.8.3": + version: 7.8.3 + resolution: "@babel/plugin-syntax-optional-chaining@npm:7.8.3" + dependencies: + "@babel/helper-plugin-utils": ^7.8.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: eef94d53a1453361553c1f98b68d17782861a04a392840341bc91780838dd4e695209c783631cf0de14c635758beafb6a3a65399846ffa4386bff90639347f30 + languageName: node + linkType: hard + +"@babel/plugin-syntax-private-property-in-object@npm:^7.14.5": + version: 7.14.5 + resolution: "@babel/plugin-syntax-private-property-in-object@npm:7.14.5" + dependencies: + "@babel/helper-plugin-utils": ^7.14.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b317174783e6e96029b743ccff2a67d63d38756876e7e5d0ba53a322e38d9ca452c13354a57de1ad476b4c066dbae699e0ca157441da611117a47af88985ecda + languageName: node + linkType: hard + +"@babel/plugin-syntax-top-level-await@npm:^7.14.5": + version: 7.14.5 + resolution: "@babel/plugin-syntax-top-level-await@npm:7.14.5" + dependencies: + "@babel/helper-plugin-utils": ^7.14.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: bbd1a56b095be7820029b209677b194db9b1d26691fe999856462e66b25b281f031f3dfd91b1619e9dcf95bebe336211833b854d0fb8780d618e35667c2d0d7e + languageName: node + linkType: hard + +"@babel/plugin-syntax-typescript@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-syntax-typescript@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8ab7718fbb026d64da93681a57797d60326097fd7cb930380c8bffd9eb101689e90142c760a14b51e8e69c88a73ba3da956cb4520a3b0c65743aee5c71ef360a + languageName: node + linkType: hard + +"@babel/plugin-syntax-unicode-sets-regex@npm:^7.18.6": + version: 7.18.6 + resolution: "@babel/plugin-syntax-unicode-sets-regex@npm:7.18.6" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.18.6 + "@babel/helper-plugin-utils": ^7.18.6 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: a651d700fe63ff0ddfd7186f4ebc24447ca734f114433139e3c027bc94a900d013cf1ef2e2db8430425ba542e39ae160c3b05f06b59fd4656273a3df97679e9c + languageName: node + linkType: hard + +"@babel/plugin-transform-arrow-functions@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-arrow-functions@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 35abb6c57062802c7ce8bd96b2ef2883e3124370c688bbd67609f7d2453802fb73944df8808f893b6c67de978eb2bcf87bbfe325e46d6f39b5fcb09ece11d01a + languageName: node + linkType: hard + +"@babel/plugin-transform-async-generator-functions@npm:^7.23.2": + version: 7.23.2 + resolution: "@babel/plugin-transform-async-generator-functions@npm:7.23.2" + dependencies: + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-remap-async-to-generator": ^7.22.20 + "@babel/plugin-syntax-async-generators": ^7.8.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: e1abae0edcda7304d7c17702ac25a127578791b89c4f767d60589249fa3e50ec33f8c9ff39d3d8d41f00b29947654eaddd4fd586e04c4d598122db745fab2868 + languageName: node + linkType: hard + +"@babel/plugin-transform-async-to-generator@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-async-to-generator@npm:7.22.5" + dependencies: + "@babel/helper-module-imports": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-remap-async-to-generator": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b95f23f99dcb379a9f0a1c2a3bbea3f8dc0e1b16dc1ac8b484fe378370169290a7a63d520959a9ba1232837cf74a80e23f6facbe14fd42a3cda6d3c2d7168e62 + languageName: node + linkType: hard + +"@babel/plugin-transform-block-scoped-functions@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 416b1341858e8ca4e524dee66044735956ced5f478b2c3b9bc11ec2285b0c25d7dbb96d79887169eb938084c95d0a89338c8b2fe70d473bd9dc92e5d9db1732c + languageName: node + linkType: hard + +"@babel/plugin-transform-block-scoping@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-block-scoping@npm:7.23.0" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0cfe925cc3b5a3ad407e2253fab3ceeaa117a4b291c9cb245578880872999bca91bd83ffa0128ae9ca356330702e1ef1dcb26804f28d2cef678239caf629f73e + languageName: node + linkType: hard + +"@babel/plugin-transform-class-properties@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-class-properties@npm:7.22.5" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b830152dfc2ff2f647f0abe76e6251babdfbef54d18c4b2c73a6bf76b1a00050a5d998dac80dc901a48514e95604324943a9dd39317073fe0928b559e0e0c579 + languageName: node + linkType: hard + +"@babel/plugin-transform-class-static-block@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-class-static-block@npm:7.22.11" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.22.11 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-class-static-block": ^7.14.5 + peerDependencies: + "@babel/core": ^7.12.0 + checksum: 69f040506fad66f1c6918d288d0e0edbc5c8a07c8b4462c1184ad2f9f08995d68b057126c213871c0853ae0c72afc60ec87492049dfacb20902e32346a448bcb + languageName: node + linkType: hard + +"@babel/plugin-transform-classes@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-transform-classes@npm:7.22.15" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-compilation-targets": ^7.22.15 + "@babel/helper-environment-visitor": ^7.22.5 + "@babel/helper-function-name": ^7.22.5 + "@babel/helper-optimise-call-expression": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-replace-supers": ^7.22.9 + "@babel/helper-split-export-declaration": ^7.22.6 + globals: ^11.1.0 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: d3f4d0c107dd8a3557ea3575cc777fab27efa92958b41e4a9822f7499725c1f554beae58855de16ddec0a7b694e45f59a26cea8fbde4275563f72f09c6e039a0 + languageName: node + linkType: hard + +"@babel/plugin-transform-computed-properties@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-computed-properties@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/template": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c2a77a0f94ec71efbc569109ec14ea2aa925b333289272ced8b33c6108bdbb02caf01830ffc7e49486b62dec51911924d13f3a76f1149f40daace1898009e131 + languageName: node + linkType: hard + +"@babel/plugin-transform-destructuring@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-destructuring@npm:7.23.0" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: cd6dd454ccc2766be551e4f8a04b1acc2aa539fa19e5c7501c56cc2f8cc921dd41a7ffb78455b4c4b2f954fcab8ca4561ba7c9c7bd5af9f19465243603d18cc3 + languageName: node + linkType: hard + +"@babel/plugin-transform-dotall-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-dotall-regex@npm:7.22.5" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 409b658d11e3082c8f69e9cdef2d96e4d6d11256f005772425fb230cc48fd05945edbfbcb709dab293a1a2f01f9c8a5bb7b4131e632b23264039d9f95864b453 + languageName: node + linkType: hard + +"@babel/plugin-transform-duplicate-keys@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-duplicate-keys@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: bb1280fbabaab6fab2ede585df34900712698210a3bd413f4df5bae6d8c24be36b496c92722ae676a7a67d060a4624f4d6c23b923485f906bfba8773c69f55b4 + languageName: node + linkType: hard + +"@babel/plugin-transform-dynamic-import@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-dynamic-import@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 78fc9c532210bf9e8f231747f542318568ac360ee6c27e80853962c984283c73da3f8f8aebe83c2096090a435b356b092ed85de617a156cbe0729d847632be45 + languageName: node + linkType: hard + +"@babel/plugin-transform-exponentiation-operator@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.22.5" + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f2d660c1b1d51ad5fec1cd5ad426a52187204068c4158f8c4aa977b31535c61b66898d532603eef21c15756827be8277f724c869b888d560f26d7fe848bb5eae + languageName: node + linkType: hard + +"@babel/plugin-transform-export-namespace-from@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-export-namespace-from@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-export-namespace-from": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 73af5883a321ed56a4bfd43c8a7de0164faebe619287706896fc6ee2f7a4e69042adaa1338c0b8b4bdb9f7e5fdceb016fb1d40694cb43ca3b8827429e8aac4bf + languageName: node + linkType: hard + +"@babel/plugin-transform-for-of@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-transform-for-of@npm:7.22.15" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f395ae7bce31e14961460f56cf751b5d6e37dd27d7df5b1f4e49fec1c11b6f9cf71991c7ffbe6549878591e87df0d66af798cf26edfa4bfa6b4c3dba1fb2f73a + languageName: node + linkType: hard + +"@babel/plugin-transform-function-name@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-function-name@npm:7.22.5" + dependencies: + "@babel/helper-compilation-targets": ^7.22.5 + "@babel/helper-function-name": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: cff3b876357999cb8ae30e439c3ec6b0491a53b0aa6f722920a4675a6dd5b53af97a833051df4b34791fe5b3dd326ccf769d5c8e45b322aa50ee11a660b17845 + languageName: node + linkType: hard + +"@babel/plugin-transform-json-strings@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-json-strings@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-json-strings": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 50665e5979e66358c50e90a26db53c55917f78175127ac2fa05c7888d156d418ffb930ec0a109353db0a7c5f57c756ce01bfc9825d24cbfd2b3ec453f2ed8cba + languageName: node + linkType: hard + +"@babel/plugin-transform-literals@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-literals@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ec37cc2ffb32667af935ab32fe28f00920ec8a1eb999aa6dc6602f2bebd8ba205a558aeedcdccdebf334381d5c57106c61f52332045730393e73410892a9735b + languageName: node + linkType: hard + +"@babel/plugin-transform-logical-assignment-operators@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-logical-assignment-operators@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c664e9798e85afa7f92f07b867682dee7392046181d82f5d21bae6f2ca26dfe9c8375cdc52b7483c3fc09a983c1989f60eff9fbc4f373b0c0a74090553d05739 + languageName: node + linkType: hard + +"@babel/plugin-transform-member-expression-literals@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-member-expression-literals@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ec4b0e07915ddd4fda0142fd104ee61015c208608a84cfa13643a95d18760b1dc1ceb6c6e0548898b8c49e5959a994e46367260176dbabc4467f729b21868504 + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-amd@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-modules-amd@npm:7.23.0" + dependencies: + "@babel/helper-module-transforms": ^7.23.0 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 5d92875170a37b8282d4bcd805f55829b8fab0f9c8d08b53d32a7a0bfdc62b868e489b52d329ae768ecafc0c993eed0ad7a387baa673ac33211390a9f833ab5d + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-commonjs@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.23.0" + dependencies: + "@babel/helper-module-transforms": ^7.23.0 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-simple-access": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 7fb25997194053e167c4207c319ff05362392da841bd9f42ddb3caf9c8798a5d203bd926d23ddf5830fdf05eddc82c2810f40d1287e3a4f80b07eff13d1024b5 + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-systemjs@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-modules-systemjs@npm:7.23.0" + dependencies: + "@babel/helper-hoist-variables": ^7.22.5 + "@babel/helper-module-transforms": ^7.23.0 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-validator-identifier": ^7.22.20 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 2d481458b22605046badea2317d5cc5c94ac3031c2293e34c96f02063f5b02af0979c4da6a8fbc67cc249541575dc9c6d710db6b919ede70b7337a22d9fd57a7 + languageName: node + linkType: hard + +"@babel/plugin-transform-modules-umd@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-modules-umd@npm:7.22.5" + dependencies: + "@babel/helper-module-transforms": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 46622834c54c551b231963b867adbc80854881b3e516ff29984a8da989bd81665bd70e8cba6710345248e97166689310f544aee1a5773e262845a8f1b3e5b8b4 + languageName: node + linkType: hard + +"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.22.5" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 3ee564ddee620c035b928fdc942c5d17e9c4b98329b76f9cefac65c111135d925eb94ed324064cd7556d4f5123beec79abea1d4b97d1c8a2a5c748887a2eb623 + languageName: node + linkType: hard + +"@babel/plugin-transform-new-target@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-new-target@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 6b72112773487a881a1d6ffa680afde08bad699252020e86122180ee7a88854d5da3f15d9bca3331cf2e025df045604494a8208a2e63b486266b07c14e2ffbf3 + languageName: node + linkType: hard + +"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 167babecc8b8fe70796a7b7d34af667ebbf43da166c21689502e5e8cc93180b7a85979c77c9f64b7cce431b36718bd0a6df9e5e0ffea4ae22afb22cfef886372 + languageName: node + linkType: hard + +"@babel/plugin-transform-numeric-separator@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-numeric-separator@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-numeric-separator": ^7.10.4 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: af064d06a4a041767ec396a5f258103f64785df290e038bba9f0ef454e6c914f2ac45d862bbdad8fac2c7ad47fa4e95356f29053c60c100a0160b02a995fe2a3 + languageName: node + linkType: hard + +"@babel/plugin-transform-object-rest-spread@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-transform-object-rest-spread@npm:7.22.15" + dependencies: + "@babel/compat-data": ^7.22.9 + "@babel/helper-compilation-targets": ^7.22.15 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-transform-parameters": ^7.22.15 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 62197a6f12289c1c1bd57f3bed9f0f765ca32390bfe91e0b5561dd94dd9770f4480c4162dec98da094bc0ba99d2c2ebba68de47c019454041b0b7a68ba2ec66d + languageName: node + linkType: hard + +"@babel/plugin-transform-object-super@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-object-super@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-replace-supers": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b71887877d74cb64dbccb5c0324fa67e31171e6a5311991f626650e44a4083e5436a1eaa89da78c0474fb095d4ec322d63ee778b202d33aa2e4194e1ed8e62d7 + languageName: node + linkType: hard + +"@babel/plugin-transform-optional-catch-binding@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-optional-catch-binding@npm:7.22.11" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f17abd90e1de67c84d63afea29c8021c74abb2794d3a6eeafb0bbe7372d3db32aefca386e392116ec63884537a4a2815d090d26264d259bacc08f6e3ed05294c + languageName: node + linkType: hard + +"@babel/plugin-transform-optional-chaining@npm:^7.22.15, @babel/plugin-transform-optional-chaining@npm:^7.23.0": + version: 7.23.0 + resolution: "@babel/plugin-transform-optional-chaining@npm:7.23.0" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: f702634f2b97e5260dbec0d4bde05ccb6f4d96d7bfa946481aeacfa205ca846cb6e096a38312f9d51fdbdac1f258f211138c5f7075952e46a5bf8574de6a1329 + languageName: node + linkType: hard + +"@babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-transform-parameters@npm:7.22.15" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 541188bb7d1876cad87687b5c7daf90f63d8208ae83df24acb1e2b05020ad1c78786b2723ca4054a83fcb74fb6509f30c4cacc5b538ee684224261ad5fb047c1 + languageName: node + linkType: hard + +"@babel/plugin-transform-private-methods@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-private-methods@npm:7.22.5" + dependencies: + "@babel/helper-create-class-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 321479b4fcb6d3b3ef622ab22fd24001e43d46e680e8e41324c033d5810c84646e470f81b44cbcbef5c22e99030784f7cac92f1829974da7a47a60a7139082c3 + languageName: node + linkType: hard + +"@babel/plugin-transform-private-property-in-object@npm:^7.22.11": + version: 7.22.11 + resolution: "@babel/plugin-transform-private-property-in-object@npm:7.22.11" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-create-class-features-plugin": ^7.22.11 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-private-property-in-object": ^7.14.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4d029d84901e53c46dead7a46e2990a7bc62470f4e4ca58a0d063394f86652fd58fe4eea1eb941da3669cd536b559b9d058b342b59300026346b7a2a51badac8 + languageName: node + linkType: hard + +"@babel/plugin-transform-property-literals@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-property-literals@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 796176a3176106f77fcb8cd04eb34a8475ce82d6d03a88db089531b8f0453a2fb8b0c6ec9a52c27948bc0ea478becec449893741fc546dfc3930ab927e3f9f2e + languageName: node + linkType: hard + +"@babel/plugin-transform-react-constant-elements@npm:^7.18.12": + version: 7.22.5 + resolution: "@babel/plugin-transform-react-constant-elements@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 596db90e37174dd703f4859fef3c86156a7c8564d8351168ac6fdca79c912ef8b8746ae04516ac3909d2cc750702d58d451badacb3c54ea998938ad05d99f9d2 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-display-name@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-react-display-name@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a12bfd1e4e93055efca3ace3c34722571bda59d9740dca364d225d9c6e3ca874f134694d21715c42cc63d79efd46db9665bd4a022998767f9245f1e29d5d204d + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx-development@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-react-jsx-development@npm:7.22.5" + dependencies: + "@babel/plugin-transform-react-jsx": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 36bc3ff0b96bb0ef4723070a50cfdf2e72cfd903a59eba448f9fe92fea47574d6f22efd99364413719e1f3fb3c51b6c9b2990b87af088f8486a84b2a5f9e4560 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-jsx@npm:^7.22.15, @babel/plugin-transform-react-jsx@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/plugin-transform-react-jsx@npm:7.22.15" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-module-imports": ^7.22.15 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-jsx": ^7.22.5 + "@babel/types": ^7.22.15 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3899054e89550c3a0ef041af7c47ee266e2e934f498ee80fefeda778a6aa177b48aa8b4d2a8bf5848de977fec564571699ab952d9fa089c4c19b45ddb121df09 + languageName: node + linkType: hard + +"@babel/plugin-transform-react-pure-annotations@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-react-pure-annotations@npm:7.22.5" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 092021c4f404e267002099ec20b3f12dd730cb90b0d83c5feed3dc00dbe43b9c42c795a18e7c6c7d7bddea20c7dd56221b146aec81b37f2e7eb5137331c61120 + languageName: node + linkType: hard + +"@babel/plugin-transform-regenerator@npm:^7.22.10": + version: 7.22.10 + resolution: "@babel/plugin-transform-regenerator@npm:7.22.10" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + regenerator-transform: ^0.15.2 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: e13678d62d6fa96f11cb8b863f00e8693491e7adc88bfca3f2820f80cbac8336e7dec3a596eee6a1c4663b7ececc3564f2cd7fb44ed6d4ce84ac2bb7f39ecc6e + languageName: node + linkType: hard + +"@babel/plugin-transform-reserved-words@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-reserved-words@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3ffd7dbc425fe8132bfec118b9817572799cab1473113a635d25ab606c1f5a2341a636c04cf6b22df3813320365ed5a965b5eeb3192320a10e4cc2c137bd8bfc + languageName: node + linkType: hard + +"@babel/plugin-transform-runtime@npm:^7.18.6": + version: 7.23.2 + resolution: "@babel/plugin-transform-runtime@npm:7.23.2" + dependencies: + "@babel/helper-module-imports": ^7.22.15 + "@babel/helper-plugin-utils": ^7.22.5 + babel-plugin-polyfill-corejs2: ^0.4.6 + babel-plugin-polyfill-corejs3: ^0.8.5 + babel-plugin-polyfill-regenerator: ^0.5.3 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 09f4273bfe9600c67e72e26f853f11c24ee4c1cbb3935c4a28a94d388e7c0d8733479d868c333cb34e9c236f1765788c6daef7852331f5c70a3b5543fd0247a1 + languageName: node + linkType: hard + +"@babel/plugin-transform-shorthand-properties@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-shorthand-properties@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: a5ac902c56ea8effa99f681340ee61bac21094588f7aef0bc01dff98246651702e677552fa6d10e548c4ac22a3ffad047dd2f8c8f0540b68316c2c203e56818b + languageName: node + linkType: hard + +"@babel/plugin-transform-spread@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-spread@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-skip-transparent-expression-wrappers": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 5587f0deb60b3dfc9b274e269031cc45ec75facccf1933ea2ea71ced9fd3ce98ed91bb36d6cd26817c14474b90ed998c5078415f0eab531caf301496ce24c95c + languageName: node + linkType: hard + +"@babel/plugin-transform-sticky-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-sticky-regex@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 63b2c575e3e7f96c32d52ed45ee098fb7d354b35c2223b8c8e76840b32cc529ee0c0ceb5742fd082e56e91e3d82842a367ce177e82b05039af3d602c9627a729 + languageName: node + linkType: hard + +"@babel/plugin-transform-template-literals@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-template-literals@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 27e9bb030654cb425381c69754be4abe6a7c75b45cd7f962cd8d604b841b2f0fb7b024f2efc1c25cc53f5b16d79d5e8cfc47cacbdaa983895b3aeefa3e7e24ff + languageName: node + linkType: hard + +"@babel/plugin-transform-typeof-symbol@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-typeof-symbol@npm:7.22.5" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 82a53a63ffc3010b689ca9a54e5f53b2718b9f4b4a9818f36f9b7dba234f38a01876680553d2716a645a61920b5e6e4aaf8d4a0064add379b27ca0b403049512 + languageName: node + linkType: hard + +"@babel/plugin-transform-typescript@npm:^7.22.15": + version: 7.22.15 + resolution: "@babel/plugin-transform-typescript@npm:7.22.15" + dependencies: + "@babel/helper-annotate-as-pure": ^7.22.5 + "@babel/helper-create-class-features-plugin": ^7.22.15 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/plugin-syntax-typescript": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c5d96cdbf0e1512707aa1c1e3ac6b370a25fd9c545d26008ce44eb13a47bd7fd67a1eb799c98b5ccc82e33a345fda55c0055e1fe3ed97646ed405dd13020b226 + languageName: node + linkType: hard + +"@babel/plugin-transform-unicode-escapes@npm:^7.22.10": + version: 7.22.10 + resolution: "@babel/plugin-transform-unicode-escapes@npm:7.22.10" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 807f40ed1324c8cb107c45358f1903384ca3f0ef1d01c5a3c5c9b271c8d8eec66936a3dcc8d75ddfceea9421420368c2e77ae3adef0a50557e778dfe296bf382 + languageName: node + linkType: hard + +"@babel/plugin-transform-unicode-property-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-unicode-property-regex@npm:7.22.5" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 2495e5f663cb388e3d888b4ba3df419ac436a5012144ac170b622ddfc221f9ea9bdba839fa2bc0185cb776b578030666406452ec7791cbf0e7a3d4c88ae9574c + languageName: node + linkType: hard + +"@babel/plugin-transform-unicode-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-unicode-regex@npm:7.22.5" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 6b5d1404c8c623b0ec9bd436c00d885a17d6a34f3f2597996343ddb9d94f6379705b21582dfd4cec2c47fd34068872e74ab6b9580116c0566b3f9447e2a7fa06 + languageName: node + linkType: hard + +"@babel/plugin-transform-unicode-sets-regex@npm:^7.22.5": + version: 7.22.5 + resolution: "@babel/plugin-transform-unicode-sets-regex@npm:7.22.5" + dependencies: + "@babel/helper-create-regexp-features-plugin": ^7.22.5 + "@babel/helper-plugin-utils": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: c042070f980b139547f8b0179efbc049ac5930abec7fc26ed7a41d89a048d8ab17d362200e204b6f71c3c20d6991a0e74415e1a412a49adc8131c2a40c04822e + languageName: node + linkType: hard + +"@babel/preset-env@npm:^7.18.6, @babel/preset-env@npm:^7.19.4": + version: 7.23.2 + resolution: "@babel/preset-env@npm:7.23.2" + dependencies: + "@babel/compat-data": ^7.23.2 + "@babel/helper-compilation-targets": ^7.22.15 + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-validator-option": ^7.22.15 + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": ^7.22.15 + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": ^7.22.15 + "@babel/plugin-proposal-private-property-in-object": 7.21.0-placeholder-for-preset-env.2 + "@babel/plugin-syntax-async-generators": ^7.8.4 + "@babel/plugin-syntax-class-properties": ^7.12.13 + "@babel/plugin-syntax-class-static-block": ^7.14.5 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-syntax-export-namespace-from": ^7.8.3 + "@babel/plugin-syntax-import-assertions": ^7.22.5 + "@babel/plugin-syntax-import-attributes": ^7.22.5 + "@babel/plugin-syntax-import-meta": ^7.10.4 + "@babel/plugin-syntax-json-strings": ^7.8.3 + "@babel/plugin-syntax-logical-assignment-operators": ^7.10.4 + "@babel/plugin-syntax-nullish-coalescing-operator": ^7.8.3 + "@babel/plugin-syntax-numeric-separator": ^7.10.4 + "@babel/plugin-syntax-object-rest-spread": ^7.8.3 + "@babel/plugin-syntax-optional-catch-binding": ^7.8.3 + "@babel/plugin-syntax-optional-chaining": ^7.8.3 + "@babel/plugin-syntax-private-property-in-object": ^7.14.5 + "@babel/plugin-syntax-top-level-await": ^7.14.5 + "@babel/plugin-syntax-unicode-sets-regex": ^7.18.6 + "@babel/plugin-transform-arrow-functions": ^7.22.5 + "@babel/plugin-transform-async-generator-functions": ^7.23.2 + "@babel/plugin-transform-async-to-generator": ^7.22.5 + "@babel/plugin-transform-block-scoped-functions": ^7.22.5 + "@babel/plugin-transform-block-scoping": ^7.23.0 + "@babel/plugin-transform-class-properties": ^7.22.5 + "@babel/plugin-transform-class-static-block": ^7.22.11 + "@babel/plugin-transform-classes": ^7.22.15 + "@babel/plugin-transform-computed-properties": ^7.22.5 + "@babel/plugin-transform-destructuring": ^7.23.0 + "@babel/plugin-transform-dotall-regex": ^7.22.5 + "@babel/plugin-transform-duplicate-keys": ^7.22.5 + "@babel/plugin-transform-dynamic-import": ^7.22.11 + "@babel/plugin-transform-exponentiation-operator": ^7.22.5 + "@babel/plugin-transform-export-namespace-from": ^7.22.11 + "@babel/plugin-transform-for-of": ^7.22.15 + "@babel/plugin-transform-function-name": ^7.22.5 + "@babel/plugin-transform-json-strings": ^7.22.11 + "@babel/plugin-transform-literals": ^7.22.5 + "@babel/plugin-transform-logical-assignment-operators": ^7.22.11 + "@babel/plugin-transform-member-expression-literals": ^7.22.5 + "@babel/plugin-transform-modules-amd": ^7.23.0 + "@babel/plugin-transform-modules-commonjs": ^7.23.0 + "@babel/plugin-transform-modules-systemjs": ^7.23.0 + "@babel/plugin-transform-modules-umd": ^7.22.5 + "@babel/plugin-transform-named-capturing-groups-regex": ^7.22.5 + "@babel/plugin-transform-new-target": ^7.22.5 + "@babel/plugin-transform-nullish-coalescing-operator": ^7.22.11 + "@babel/plugin-transform-numeric-separator": ^7.22.11 + "@babel/plugin-transform-object-rest-spread": ^7.22.15 + "@babel/plugin-transform-object-super": ^7.22.5 + "@babel/plugin-transform-optional-catch-binding": ^7.22.11 + "@babel/plugin-transform-optional-chaining": ^7.23.0 + "@babel/plugin-transform-parameters": ^7.22.15 + "@babel/plugin-transform-private-methods": ^7.22.5 + "@babel/plugin-transform-private-property-in-object": ^7.22.11 + "@babel/plugin-transform-property-literals": ^7.22.5 + "@babel/plugin-transform-regenerator": ^7.22.10 + "@babel/plugin-transform-reserved-words": ^7.22.5 + "@babel/plugin-transform-shorthand-properties": ^7.22.5 + "@babel/plugin-transform-spread": ^7.22.5 + "@babel/plugin-transform-sticky-regex": ^7.22.5 + "@babel/plugin-transform-template-literals": ^7.22.5 + "@babel/plugin-transform-typeof-symbol": ^7.22.5 + "@babel/plugin-transform-unicode-escapes": ^7.22.10 + "@babel/plugin-transform-unicode-property-regex": ^7.22.5 + "@babel/plugin-transform-unicode-regex": ^7.22.5 + "@babel/plugin-transform-unicode-sets-regex": ^7.22.5 + "@babel/preset-modules": 0.1.6-no-external-plugins + "@babel/types": ^7.23.0 + babel-plugin-polyfill-corejs2: ^0.4.6 + babel-plugin-polyfill-corejs3: ^0.8.5 + babel-plugin-polyfill-regenerator: ^0.5.3 + core-js-compat: ^3.31.0 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 49327ef584b529b56aedd6577937b80c0d89603c68b23795495a13af04b5aa008db9ad04cd280423600cdc0d3cce13ae9d0d9a977db5c8193697b20ced8a10b2 + languageName: node + linkType: hard + +"@babel/preset-modules@npm:0.1.6-no-external-plugins": + version: 0.1.6-no-external-plugins + resolution: "@babel/preset-modules@npm:0.1.6-no-external-plugins" + dependencies: + "@babel/helper-plugin-utils": ^7.0.0 + "@babel/types": ^7.4.4 + esutils: ^2.0.2 + peerDependencies: + "@babel/core": ^7.0.0-0 || ^8.0.0-0 <8.0.0 + checksum: 4855e799bc50f2449fb5210f78ea9e8fd46cf4f242243f1e2ed838e2bd702e25e73e822e7f8447722a5f4baa5e67a8f7a0e403f3e7ce04540ff743a9c411c375 + languageName: node + linkType: hard + +"@babel/preset-react@npm:^7.18.6": + version: 7.22.15 + resolution: "@babel/preset-react@npm:7.22.15" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-validator-option": ^7.22.15 + "@babel/plugin-transform-react-display-name": ^7.22.5 + "@babel/plugin-transform-react-jsx": ^7.22.15 + "@babel/plugin-transform-react-jsx-development": ^7.22.5 + "@babel/plugin-transform-react-pure-annotations": ^7.22.5 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c3ef99dfa2e9f57d2e08603e883aa20f47630a826c8e413888a93ae6e0084b5016871e463829be125329d40a1ba0a89f7c43d77b6dab52083c225cb43e63d10e + languageName: node + linkType: hard + +"@babel/preset-typescript@npm:^7.18.6": + version: 7.23.2 + resolution: "@babel/preset-typescript@npm:7.23.2" + dependencies: + "@babel/helper-plugin-utils": ^7.22.5 + "@babel/helper-validator-option": ^7.22.15 + "@babel/plugin-syntax-jsx": ^7.22.5 + "@babel/plugin-transform-modules-commonjs": ^7.23.0 + "@babel/plugin-transform-typescript": ^7.22.15 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c4b065c90e7f085dd7a0e57032983ac230c7ffd1d616e4c2b66581e765d5befc9271495f33250bf1cf9b4d436239c8ca3b19ada9f6c419c70bdab2cf6c868f9f + languageName: node + linkType: hard + +"@babel/regjsgen@npm:^0.8.0": + version: 0.8.0 + resolution: "@babel/regjsgen@npm:0.8.0" + checksum: 89c338fee774770e5a487382170711014d49a68eb281e74f2b5eac88f38300a4ad545516a7786a8dd5702e9cf009c94c2f582d200f077ac5decd74c56b973730 + languageName: node + linkType: hard + +"@babel/runtime-corejs3@npm:^7.18.6": + version: 7.23.2 + resolution: "@babel/runtime-corejs3@npm:7.23.2" + dependencies: + core-js-pure: ^3.30.2 + regenerator-runtime: ^0.14.0 + checksum: 922f25c47996a8af604cea82441e41be8b11910e96c662511e54120078f4c64258c045a28a311467a8f14a0c17f46a1f057f7c0501e567869a4343a6ce017962 + languageName: node + linkType: hard + +"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.3, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.18.6, @babel/runtime@npm:^7.20.13, @babel/runtime@npm:^7.8.4": + version: 7.23.2 + resolution: "@babel/runtime@npm:7.23.2" + dependencies: + regenerator-runtime: ^0.14.0 + checksum: 6c4df4839ec75ca10175f636d6362f91df8a3137f86b38f6cd3a4c90668a0fe8e9281d320958f4fbd43b394988958585a17c3aab2a4ea6bf7316b22916a371fb + languageName: node + linkType: hard + +"@babel/template@npm:^7.12.7, @babel/template@npm:^7.22.15, @babel/template@npm:^7.22.5": + version: 7.22.15 + resolution: "@babel/template@npm:7.22.15" + dependencies: + "@babel/code-frame": ^7.22.13 + "@babel/parser": ^7.22.15 + "@babel/types": ^7.22.15 + checksum: 1f3e7dcd6c44f5904c184b3f7fe280394b191f2fed819919ffa1e529c259d5b197da8981b6ca491c235aee8dbad4a50b7e31304aa531271cb823a4a24a0dd8fd + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.18.8, @babel/traverse@npm:^7.23.2": + version: 7.23.2 + resolution: "@babel/traverse@npm:7.23.2" + dependencies: + "@babel/code-frame": ^7.22.13 + "@babel/generator": ^7.23.0 + "@babel/helper-environment-visitor": ^7.22.20 + "@babel/helper-function-name": ^7.23.0 + "@babel/helper-hoist-variables": ^7.22.5 + "@babel/helper-split-export-declaration": ^7.22.6 + "@babel/parser": ^7.23.0 + "@babel/types": ^7.23.0 + debug: ^4.1.0 + globals: ^11.1.0 + checksum: 26a1eea0dde41ab99dde8b9773a013a0dc50324e5110a049f5d634e721ff08afffd54940b3974a20308d7952085ac769689369e9127dea655f868c0f6e1ab35d + languageName: node + linkType: hard + +"@babel/types@npm:^7.12.7, @babel/types@npm:^7.20.0, @babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": + version: 7.23.0 + resolution: "@babel/types@npm:7.23.0" + dependencies: + "@babel/helper-string-parser": ^7.22.5 + "@babel/helper-validator-identifier": ^7.22.20 + to-fast-properties: ^2.0.0 + checksum: 215fe04bd7feef79eeb4d33374b39909ce9cad1611c4135a4f7fdf41fe3280594105af6d7094354751514625ea92d0875aba355f53e86a92600f290e77b0e604 + languageName: node + linkType: hard + +"@chainsafe/as-sha256@npm:^0.3.1": + version: 0.3.1 + resolution: "@chainsafe/as-sha256@npm:0.3.1" + checksum: 58ea733be1657b0e31dbf48b0dba862da0833df34a81c1460c7352f04ce90874f70003cbf34d0afb9e5e53a33ee2d63a261a8b12462be85b2ba0a6f7f13d6150 + languageName: node + linkType: hard + +"@chainsafe/persistent-merkle-tree@npm:^0.4.2": + version: 0.4.2 + resolution: "@chainsafe/persistent-merkle-tree@npm:0.4.2" + dependencies: + "@chainsafe/as-sha256": ^0.3.1 + checksum: f9cfcb2132a243992709715dbd28186ab48c7c0c696f29d30857693cca5526bf753974a505ef68ffd5623bbdbcaa10f9083f4dd40bf99eb6408e451cc26a1a9e + languageName: node + linkType: hard + +"@chainsafe/persistent-merkle-tree@npm:^0.5.0": + version: 0.5.0 + resolution: "@chainsafe/persistent-merkle-tree@npm:0.5.0" + dependencies: + "@chainsafe/as-sha256": ^0.3.1 + checksum: 2c67203da776c79cd3a6132e2d672fe132393b2e63dc71604e3134acc8c0ec25cc5e431051545939ea0f7c5ff2066fb806b9e5cab974ca085d046226a1671f7d + languageName: node + linkType: hard + +"@chainsafe/ssz@npm:^0.10.0": + version: 0.10.2 + resolution: "@chainsafe/ssz@npm:0.10.2" + dependencies: + "@chainsafe/as-sha256": ^0.3.1 + "@chainsafe/persistent-merkle-tree": ^0.5.0 + checksum: 6bb70cf741d0a19dd0b28b3f6f067b96fa39f556e2eefa6ac745b21db9c3b3a8393dc3cca8ff4a6ce065ed71ddc3fb1b2b390a92004b9d01067c26e2558e5503 + languageName: node + linkType: hard + +"@chainsafe/ssz@npm:^0.9.2": + version: 0.9.4 + resolution: "@chainsafe/ssz@npm:0.9.4" + dependencies: + "@chainsafe/as-sha256": ^0.3.1 + "@chainsafe/persistent-merkle-tree": ^0.4.2 + case: ^1.6.3 + checksum: c6eaedeae9e5618b3c666ff4507a27647f665a8dcf17d5ca86da4ed4788c5a93868f256d0005467d184fdf35ec03f323517ec2e55ec42492d769540a2ec396bc + languageName: node + linkType: hard + +"@colors/colors@npm:1.5.0": + version: 1.5.0 + resolution: "@colors/colors@npm:1.5.0" + checksum: d64d5260bed1d5012ae3fc617d38d1afc0329fec05342f4e6b838f46998855ba56e0a73833f4a80fa8378c84810da254f76a8a19c39d038260dc06dc4e007425 + languageName: node + linkType: hard + +"@cspotcode/source-map-support@npm:^0.8.0": + version: 0.8.1 + resolution: "@cspotcode/source-map-support@npm:0.8.1" + dependencies: + "@jridgewell/trace-mapping": 0.3.9 + checksum: 5718f267085ed8edb3e7ef210137241775e607ee18b77d95aa5bd7514f47f5019aa2d82d96b3bf342ef7aa890a346fa1044532ff7cc3009e7d24fce3ce6200fa + languageName: node + linkType: hard + +"@discoveryjs/json-ext@npm:0.5.7": + version: 0.5.7 + resolution: "@discoveryjs/json-ext@npm:0.5.7" + checksum: 2176d301cc258ea5c2324402997cf8134ebb212469c0d397591636cea8d3c02f2b3cf9fd58dcb748c7a0dade77ebdc1b10284fa63e608c033a1db52fddc69918 + languageName: node + linkType: hard + +"@docsearch/css@npm:3.5.2": + version: 3.5.2 + resolution: "@docsearch/css@npm:3.5.2" + checksum: d1d60dd230dd48f896755f21bd20b59583ba844212d7d336953ae48d389baaf868bdf83320fb734a4ed679c3f95b15d620cf3764cd538f6941cae239f8c9d35d + languageName: node + linkType: hard + +"@docsearch/react@npm:^3.1.1": + version: 3.5.2 + resolution: "@docsearch/react@npm:3.5.2" + dependencies: + "@algolia/autocomplete-core": 1.9.3 + "@algolia/autocomplete-preset-algolia": 1.9.3 + "@docsearch/css": 3.5.2 + algoliasearch: ^4.19.1 + peerDependencies: + "@types/react": ">= 16.8.0 < 19.0.0" + react: ">= 16.8.0 < 19.0.0" + react-dom: ">= 16.8.0 < 19.0.0" + search-insights: ">= 1 < 3" + peerDependenciesMeta: + "@types/react": + optional: true + react: + optional: true + react-dom: + optional: true + search-insights: + optional: true + checksum: 4b4584c2c73fc18cbd599047538896450974e134c2c74f19eb202db0ce8e6c3c49c6f65ed6ade61c796d476d3cbb55d6be58df62bc9568a0c72d88e42fca1d16 + languageName: node + linkType: hard + +"@docusaurus/core@npm:2.4.3, @docusaurus/core@npm:^2.4.0": + version: 2.4.3 + resolution: "@docusaurus/core@npm:2.4.3" + dependencies: + "@babel/core": ^7.18.6 + "@babel/generator": ^7.18.7 + "@babel/plugin-syntax-dynamic-import": ^7.8.3 + "@babel/plugin-transform-runtime": ^7.18.6 + "@babel/preset-env": ^7.18.6 + "@babel/preset-react": ^7.18.6 + "@babel/preset-typescript": ^7.18.6 + "@babel/runtime": ^7.18.6 + "@babel/runtime-corejs3": ^7.18.6 + "@babel/traverse": ^7.18.8 + "@docusaurus/cssnano-preset": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/react-loadable": 5.5.2 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + "@slorber/static-site-generator-webpack-plugin": ^4.0.7 + "@svgr/webpack": ^6.2.1 + autoprefixer: ^10.4.7 + babel-loader: ^8.2.5 + babel-plugin-dynamic-import-node: ^2.3.3 + boxen: ^6.2.1 + chalk: ^4.1.2 + chokidar: ^3.5.3 + clean-css: ^5.3.0 + cli-table3: ^0.6.2 + combine-promises: ^1.1.0 + commander: ^5.1.0 + copy-webpack-plugin: ^11.0.0 + core-js: ^3.23.3 + css-loader: ^6.7.1 + css-minimizer-webpack-plugin: ^4.0.0 + cssnano: ^5.1.12 + del: ^6.1.1 + detect-port: ^1.3.0 + escape-html: ^1.0.3 + eta: ^2.0.0 + file-loader: ^6.2.0 + fs-extra: ^10.1.0 + html-minifier-terser: ^6.1.0 + html-tags: ^3.2.0 + html-webpack-plugin: ^5.5.0 + import-fresh: ^3.3.0 + leven: ^3.1.0 + lodash: ^4.17.21 + mini-css-extract-plugin: ^2.6.1 + postcss: ^8.4.14 + postcss-loader: ^7.0.0 + prompts: ^2.4.2 + react-dev-utils: ^12.0.1 + react-helmet-async: ^1.3.0 + react-loadable: "npm:@docusaurus/react-loadable@5.5.2" + react-loadable-ssr-addon-v5-slorber: ^1.0.1 + react-router: ^5.3.3 + react-router-config: ^5.1.1 + react-router-dom: ^5.3.3 + rtl-detect: ^1.0.4 + semver: ^7.3.7 + serve-handler: ^6.1.3 + shelljs: ^0.8.5 + terser-webpack-plugin: ^5.3.3 + tslib: ^2.4.0 + update-notifier: ^5.1.0 + url-loader: ^4.1.1 + wait-on: ^6.0.1 + webpack: ^5.73.0 + webpack-bundle-analyzer: ^4.5.0 + webpack-dev-server: ^4.9.3 + webpack-merge: ^5.8.0 + webpackbar: ^5.0.2 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + bin: + docusaurus: bin/docusaurus.mjs + checksum: cce7173ee131364857c16f70f94155ba0e1b044cde54045fb0cf62ad138f8d8ef093f5aba7c7617a9aa0545b3ee3930aec2e09f645daec015696968338963013 + languageName: node + linkType: hard + +"@docusaurus/cssnano-preset@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/cssnano-preset@npm:2.4.3" + dependencies: + cssnano-preset-advanced: ^5.3.8 + postcss: ^8.4.14 + postcss-sort-media-queries: ^4.2.1 + tslib: ^2.4.0 + checksum: f4a4c60b075c23541da90e00ae26af2e7eaadf20d783b37b9110a5e34599e4e91947425e33bad58ba71abee81c85cca99f5d7d76575f53fbaf73617b55e39c62 + languageName: node + linkType: hard + +"@docusaurus/logger@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/logger@npm:2.4.3" + dependencies: + chalk: ^4.1.2 + tslib: ^2.4.0 + checksum: f026a8233aa317f16ce5b25c6785a431f319c52fc07a1b9e26f4b3df2197974e75830a16b6140314f8f4ef02dc19242106ec2ae1599740b26d516cc34c56102f + languageName: node + linkType: hard + +"@docusaurus/mdx-loader@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/mdx-loader@npm:2.4.3" + dependencies: + "@babel/parser": ^7.18.8 + "@babel/traverse": ^7.18.8 + "@docusaurus/logger": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@mdx-js/mdx": ^1.6.22 + escape-html: ^1.0.3 + file-loader: ^6.2.0 + fs-extra: ^10.1.0 + image-size: ^1.0.1 + mdast-util-to-string: ^2.0.0 + remark-emoji: ^2.2.0 + stringify-object: ^3.3.0 + tslib: ^2.4.0 + unified: ^9.2.2 + unist-util-visit: ^2.0.3 + url-loader: ^4.1.1 + webpack: ^5.73.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 5a774f7ea5f484e888b2bd1bf8b182279e3788afec779eb8920cf468b92ab8d83a1ae8be51925074241a4d1a38d989cfb366d2baf0f67ed6f063342395a7ca8e + languageName: node + linkType: hard + +"@docusaurus/module-type-aliases@npm:2.4.3, @docusaurus/module-type-aliases@npm:^2.4.0": + version: 2.4.3 + resolution: "@docusaurus/module-type-aliases@npm:2.4.3" + dependencies: + "@docusaurus/react-loadable": 5.5.2 + "@docusaurus/types": 2.4.3 + "@types/history": ^4.7.11 + "@types/react": "*" + "@types/react-router-config": "*" + "@types/react-router-dom": "*" + react-helmet-async: "*" + react-loadable: "npm:@docusaurus/react-loadable@5.5.2" + peerDependencies: + react: "*" + react-dom: "*" + checksum: 22ce1a6a20acc35cdd2ec57e55f29e65dbe0fb3a46aaa8c033ec78bf04cd3087f0523c816c744ed311095512dd686c83e0a8619cc1a2a937c27cd54527739c38 + languageName: node + linkType: hard + +"@docusaurus/plugin-content-blog@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-content-blog@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + cheerio: ^1.0.0-rc.12 + feed: ^4.2.2 + fs-extra: ^10.1.0 + lodash: ^4.17.21 + reading-time: ^1.5.0 + tslib: ^2.4.0 + unist-util-visit: ^2.0.3 + utility-types: ^3.10.0 + webpack: ^5.73.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 9fd41331c609b9488eea363e617e3763a814c75f83eb1b858cef402a0f5b96f67a342e25ff8c333489e550eb4d379eae09a88b986a97c25170fe203662e2f1ae + languageName: node + linkType: hard + +"@docusaurus/plugin-content-docs@npm:2.4.3, @docusaurus/plugin-content-docs@npm:^2.0.0-rc.1": + version: 2.4.3 + resolution: "@docusaurus/plugin-content-docs@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/module-type-aliases": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + "@types/react-router-config": ^5.0.6 + combine-promises: ^1.1.0 + fs-extra: ^10.1.0 + import-fresh: ^3.3.0 + js-yaml: ^4.1.0 + lodash: ^4.17.21 + tslib: ^2.4.0 + utility-types: ^3.10.0 + webpack: ^5.73.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: bc01201f64721131eb84f264e51c7497b8034d2a3d99d762169f5dc456c3d8882acfa01fdbaa8fdc6e2e220479b36e0c9e8e17397bf887884589535bdeaeb4bb + languageName: node + linkType: hard + +"@docusaurus/plugin-content-pages@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-content-pages@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + fs-extra: ^10.1.0 + tslib: ^2.4.0 + webpack: ^5.73.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 00439c2e1a1f345cd549739db13a3610b6d9f7ffa6cf7507ad6ac1f3c8d24041947acc2a446be7edf1a613cf354a50d1133aa28ddf64a0eff6ed8a31bf1a542f + languageName: node + linkType: hard + +"@docusaurus/plugin-debug@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-debug@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + fs-extra: ^10.1.0 + react-json-view: ^1.21.3 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 88955828b72e463e04501cc6bedf802208e377ae0f4d72735625bcbb47918afc4f2588355c6914064cfdbe4945d3da6473ce76319aa1f66dd975b3b43c4c39b0 + languageName: node + linkType: hard + +"@docusaurus/plugin-google-analytics@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-google-analytics@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 6e30de6b5c479493614a5552a295f07ffb9c83f3740a68c7d4dbac378b8288da7430f26cdc246d763855c6084ad86a6f87286e6c8b40f4817794bb1a04e109ea + languageName: node + linkType: hard + +"@docusaurus/plugin-google-gtag@npm:2.4.3, @docusaurus/plugin-google-gtag@npm:^2.4.0": + version: 2.4.3 + resolution: "@docusaurus/plugin-google-gtag@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 4aaac4d262b3bb7fc3f16620c5329b90db92bf28361ced54f2945fc0e4669483e2f36b076332e0ee9d11b6233cd2c81ca35c953119bad42171e62571c1692d6a + languageName: node + linkType: hard + +"@docusaurus/plugin-google-tag-manager@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-google-tag-manager@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: c3af89b4d41fab463d853cbfbe8f43d384f702dd09fd914fffcca01fdf94c282d1b98d762c9142fe21f6471f5dd643679e8d11344c95fdf6657aff0618c3c7a5 + languageName: node + linkType: hard + +"@docusaurus/plugin-sitemap@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/plugin-sitemap@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + fs-extra: ^10.1.0 + sitemap: ^7.1.1 + tslib: ^2.4.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: cf96b9f0e32cefa58e37a4bc2f0a112ea657f06faf47b780ec2ba39d5e2daca6486a73f3b376c56ad3bb42f3f0c3f70a783f1ce1964b74e2ba273e6f439e439b + languageName: node + linkType: hard + +"@docusaurus/preset-classic@npm:^2.4.0": + version: 2.4.3 + resolution: "@docusaurus/preset-classic@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/plugin-content-blog": 2.4.3 + "@docusaurus/plugin-content-docs": 2.4.3 + "@docusaurus/plugin-content-pages": 2.4.3 + "@docusaurus/plugin-debug": 2.4.3 + "@docusaurus/plugin-google-analytics": 2.4.3 + "@docusaurus/plugin-google-gtag": 2.4.3 + "@docusaurus/plugin-google-tag-manager": 2.4.3 + "@docusaurus/plugin-sitemap": 2.4.3 + "@docusaurus/theme-classic": 2.4.3 + "@docusaurus/theme-common": 2.4.3 + "@docusaurus/theme-search-algolia": 2.4.3 + "@docusaurus/types": 2.4.3 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: a321badc44696adf4ab2d4a5d6c93f595e8c17988aec9609d325928a1d60f5e0205b23fe849b28ddaed24f7935829e86c402f6b761d6e65db4224270b9dd443c + languageName: node + linkType: hard + +"@docusaurus/react-loadable@npm:5.5.2, react-loadable@npm:@docusaurus/react-loadable@5.5.2": + version: 5.5.2 + resolution: "@docusaurus/react-loadable@npm:5.5.2" + dependencies: + "@types/react": "*" + prop-types: ^15.6.2 + peerDependencies: + react: "*" + checksum: 930fb9e2936412a12461f210acdc154a433283921ca43ac3fc3b84cb6c12eb738b3a3719373022bf68004efeb1a928dbe36c467d7a1f86454ed6241576d936e7 + languageName: node + linkType: hard + +"@docusaurus/theme-classic@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/theme-classic@npm:2.4.3" + dependencies: + "@docusaurus/core": 2.4.3 + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/module-type-aliases": 2.4.3 + "@docusaurus/plugin-content-blog": 2.4.3 + "@docusaurus/plugin-content-docs": 2.4.3 + "@docusaurus/plugin-content-pages": 2.4.3 + "@docusaurus/theme-common": 2.4.3 + "@docusaurus/theme-translations": 2.4.3 + "@docusaurus/types": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + "@mdx-js/react": ^1.6.22 + clsx: ^1.2.1 + copy-text-to-clipboard: ^3.0.1 + infima: 0.2.0-alpha.43 + lodash: ^4.17.21 + nprogress: ^0.2.0 + postcss: ^8.4.14 + prism-react-renderer: ^1.3.5 + prismjs: ^1.28.0 + react-router-dom: ^5.3.3 + rtlcss: ^3.5.0 + tslib: ^2.4.0 + utility-types: ^3.10.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 215b7fa416f40ce68773265a168af47fa770583ebe33ec7b34c7e082dfe7c79252b589a6b26532cb0ab7dd089611a9cd0e20c94df097be320a227b98e3b3fbb8 + languageName: node + linkType: hard + +"@docusaurus/theme-common@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/theme-common@npm:2.4.3" + dependencies: + "@docusaurus/mdx-loader": 2.4.3 + "@docusaurus/module-type-aliases": 2.4.3 + "@docusaurus/plugin-content-blog": 2.4.3 + "@docusaurus/plugin-content-docs": 2.4.3 + "@docusaurus/plugin-content-pages": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-common": 2.4.3 + "@types/history": ^4.7.11 + "@types/react": "*" + "@types/react-router-config": "*" + clsx: ^1.2.1 + parse-numeric-range: ^1.3.0 + prism-react-renderer: ^1.3.5 + tslib: ^2.4.0 + use-sync-external-store: ^1.2.0 + utility-types: ^3.10.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 76817f548705542124d708c804e724674ec9bf996a5cb2a5c9a2919416367567cca4a3fa6055589990c339f6e1fb9d3944e25ed30b79fabe191db00d6ef986ca + languageName: node + linkType: hard + +"@docusaurus/theme-search-algolia@npm:2.4.3": + version: 2.4.3 + resolution: "@docusaurus/theme-search-algolia@npm:2.4.3" + dependencies: + "@docsearch/react": ^3.1.1 + "@docusaurus/core": 2.4.3 + "@docusaurus/logger": 2.4.3 + "@docusaurus/plugin-content-docs": 2.4.3 + "@docusaurus/theme-common": 2.4.3 + "@docusaurus/theme-translations": 2.4.3 + "@docusaurus/utils": 2.4.3 + "@docusaurus/utils-validation": 2.4.3 + algoliasearch: ^4.13.1 + algoliasearch-helper: ^3.10.0 + clsx: ^1.2.1 + eta: ^2.0.0 + fs-extra: ^10.1.0 + lodash: ^4.17.21 + tslib: ^2.4.0 + utility-types: ^3.10.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: 665d244c25bff21dd45c983c9b85f9827d2dd58945b802d645370b5e7092820532faf488c0bc0ce88e8fc0088c7f56eb9abb96589cf3857372c1b61bba6cbed7 + languageName: node + linkType: hard + +"@docusaurus/theme-translations@npm:2.4.3, @docusaurus/theme-translations@npm:^2.0.0-rc.1": + version: 2.4.3 + resolution: "@docusaurus/theme-translations@npm:2.4.3" + dependencies: + fs-extra: ^10.1.0 + tslib: ^2.4.0 + checksum: 8424583a130b0d32b6adf578dc5daeefaad199019c8a6a23fbd67577209be64923cde59d423ea9d41d6e7cfc2318e7fa6a17a665e8ae1c871ce0880525f9b8fd + languageName: node + linkType: hard + +"@docusaurus/types@npm:2.4.3, @docusaurus/types@npm:^2.4.1": + version: 2.4.3 + resolution: "@docusaurus/types@npm:2.4.3" + dependencies: + "@types/history": ^4.7.11 + "@types/react": "*" + commander: ^5.1.0 + joi: ^17.6.0 + react-helmet-async: ^1.3.0 + utility-types: ^3.10.0 + webpack: ^5.73.0 + webpack-merge: ^5.8.0 + peerDependencies: + react: ^16.8.4 || ^17.0.0 + react-dom: ^16.8.4 || ^17.0.0 + checksum: c123c45630e885b588f808baa06a97f8408a3381906f65cb92ae75732aedfca6ab2cada94f969c08e043b885b95298616440326259b789010e0986cbcd7a960b + languageName: node + linkType: hard + +"@docusaurus/utils-common@npm:2.4.3, @docusaurus/utils-common@npm:^2.0.0-rc.1": + version: 2.4.3 + resolution: "@docusaurus/utils-common@npm:2.4.3" + dependencies: + tslib: ^2.4.0 + peerDependencies: + "@docusaurus/types": "*" + peerDependenciesMeta: + "@docusaurus/types": + optional: true + checksum: 1ae315d8d8ce7a0163a698ffdca55b734d21f336512138c128bc0fa2a8d224edbaad0c8dbd7a3de2e8ef734dc2656c505d09066dee4fc84819d153593abb8984 + languageName: node + linkType: hard + +"@docusaurus/utils-validation@npm:2.4.3, @docusaurus/utils-validation@npm:^2.0.0-rc.1": + version: 2.4.3 + resolution: "@docusaurus/utils-validation@npm:2.4.3" + dependencies: + "@docusaurus/logger": 2.4.3 + "@docusaurus/utils": 2.4.3 + joi: ^17.6.0 + js-yaml: ^4.1.0 + tslib: ^2.4.0 + checksum: d3472b3f7a0a029c2cef1f00bc9db403d5f7e74e2091eccbc45d06f5776a84fd73bd1a18cf3a8a3cc0348ce49f753a1300deac670c2a82c56070cc40ca9df06e + languageName: node + linkType: hard + +"@docusaurus/utils@npm:2.4.3, @docusaurus/utils@npm:^2.0.0-rc.1": + version: 2.4.3 + resolution: "@docusaurus/utils@npm:2.4.3" + dependencies: + "@docusaurus/logger": 2.4.3 + "@svgr/webpack": ^6.2.1 + escape-string-regexp: ^4.0.0 + file-loader: ^6.2.0 + fs-extra: ^10.1.0 + github-slugger: ^1.4.0 + globby: ^11.1.0 + gray-matter: ^4.0.3 + js-yaml: ^4.1.0 + lodash: ^4.17.21 + micromatch: ^4.0.5 + resolve-pathname: ^3.0.0 + shelljs: ^0.8.5 + tslib: ^2.4.0 + url-loader: ^4.1.1 + webpack: ^5.73.0 + peerDependencies: + "@docusaurus/types": "*" + peerDependenciesMeta: + "@docusaurus/types": + optional: true + checksum: dd1aa7688d1a4b2775e13a91d528608ceab33c57a921404d9a989867c31c8ef17fe3892e4f5680dfb4a783da7b9973e2077e907ff4ac172927433e606e8fa9b9 + languageName: node + linkType: hard + +"@easyops-cn/autocomplete.js@npm:^0.38.1": + version: 0.38.1 + resolution: "@easyops-cn/autocomplete.js@npm:0.38.1" + dependencies: + cssesc: ^3.0.0 + immediate: ^3.2.3 + checksum: d88b61f12c383856b8d5cedf176a6d07a21e013dc2c78be029af81e2e026ece2bb988c6ea7f9951a2759c2e6f806ea1d1c9627bf36d9cbe376e897a94ce5da09 + languageName: node + linkType: hard + +"@easyops-cn/docusaurus-search-local@npm:^0.35.0": + version: 0.35.0 + resolution: "@easyops-cn/docusaurus-search-local@npm:0.35.0" + dependencies: + "@docusaurus/plugin-content-docs": ^2.0.0-rc.1 + "@docusaurus/theme-translations": ^2.0.0-rc.1 + "@docusaurus/utils": ^2.0.0-rc.1 + "@docusaurus/utils-common": ^2.0.0-rc.1 + "@docusaurus/utils-validation": ^2.0.0-rc.1 + "@easyops-cn/autocomplete.js": ^0.38.1 + "@node-rs/jieba": ^1.6.0 + cheerio: ^1.0.0-rc.3 + clsx: ^1.1.1 + debug: ^4.2.0 + fs-extra: ^10.0.0 + klaw-sync: ^6.0.0 + lunr: ^2.3.9 + lunr-languages: ^1.4.0 + mark.js: ^8.11.1 + tslib: ^2.4.0 + peerDependencies: + "@docusaurus/theme-common": ^2.0.0-rc.1 + react: ^16.14.0 || ^17.0.0 || ^18.0.0 + react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 + checksum: 726b7b5d52f3fd01286e5a97bb2f5d27ae0ace2be7a7742c92b0bf11d56f2f44a16f6b7af556f5676ffa2a3b94c244d17ea9804894553f94ba66b98249e1e10f + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/android-arm64@npm:0.17.19" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/android-arm@npm:0.17.19" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/android-x64@npm:0.17.19" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/darwin-arm64@npm:0.17.19" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/darwin-x64@npm:0.17.19" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/freebsd-arm64@npm:0.17.19" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/freebsd-x64@npm:0.17.19" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-arm64@npm:0.17.19" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-arm@npm:0.17.19" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-ia32@npm:0.17.19" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-loong64@npm:0.17.19" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-mips64el@npm:0.17.19" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-ppc64@npm:0.17.19" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-riscv64@npm:0.17.19" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-s390x@npm:0.17.19" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/linux-x64@npm:0.17.19" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/netbsd-x64@npm:0.17.19" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/openbsd-x64@npm:0.17.19" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/sunos-x64@npm:0.17.19" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/win32-arm64@npm:0.17.19" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/win32-ia32@npm:0.17.19" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.17.19": + version: 0.17.19 + resolution: "@esbuild/win32-x64@npm:0.17.19" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": + version: 4.4.0 + resolution: "@eslint-community/eslint-utils@npm:4.4.0" + dependencies: + eslint-visitor-keys: ^3.3.0 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: cdfe3ae42b4f572cbfb46d20edafe6f36fc5fb52bf2d90875c58aefe226892b9677fef60820e2832caf864a326fe4fc225714c46e8389ccca04d5f9288aabd22 + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.5.1": + version: 4.9.1 + resolution: "@eslint-community/regexpp@npm:4.9.1" + checksum: 06fb839e9c756f6375cc545c2f2e05a0a64576bd6370e8e3c07983fd29a3d6e164ef4aa48a361f7d27e6713ab79c83053ff6a2ccb78748bc955e344279c4a3b6 + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.6.1": + version: 4.8.1 + resolution: "@eslint-community/regexpp@npm:4.8.1" + checksum: 82d62c845ef42b810f268cfdc84d803a2da01735fb52e902fd34bdc09f92464a094fd8e4802839874b000b2f73f67c972859e813ba705233515d3e954f234bf2 + languageName: node + linkType: hard + +"@eslint/eslintrc@npm:^2.1.2": + version: 2.1.2 + resolution: "@eslint/eslintrc@npm:2.1.2" + dependencies: + ajv: ^6.12.4 + debug: ^4.3.2 + espree: ^9.6.0 + globals: ^13.19.0 + ignore: ^5.2.0 + import-fresh: ^3.2.1 + js-yaml: ^4.1.0 + minimatch: ^3.1.2 + strip-json-comments: ^3.1.1 + checksum: bc742a1e3b361f06fedb4afb6bf32cbd27171292ef7924f61c62f2aed73048367bcc7ac68f98c06d4245cd3fabc43270f844e3c1699936d4734b3ac5398814a7 + languageName: node + linkType: hard + +"@eslint/js@npm:8.50.0": + version: 8.50.0 + resolution: "@eslint/js@npm:8.50.0" + checksum: 302478f2acaaa7228729ec6a04f56641590185e1d8cd1c836a6db8a6b8009f80a57349341be9fbb9aa1721a7a569d1be3ffc598a33300d22816f11832095386c + languageName: node + linkType: hard + +"@esm-bundle/chai@npm:^4.3.4-fix.0": + version: 4.3.4 + resolution: "@esm-bundle/chai@npm:4.3.4" + dependencies: + "@types/chai": ^4.2.12 + checksum: 6d1237e9b8309b31ca55d12abe03642ab58550fdac24d0acbfeae6ab14182f72cedf646c6e858fd7ef592b4034ddd23ce5882ff22b8ab9b7952327e9f3f8c3f5 + languageName: node + linkType: hard + +"@ethersproject/abi@npm:5.7.0, @ethersproject/abi@npm:^5.1.2, @ethersproject/abi@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/abi@npm:5.7.0" + dependencies: + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/hash": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + checksum: bc6962bb6cb854e4d2a4d65b2c49c716477675b131b1363312234bdbb7e19badb7d9ce66f4ca2a70ae2ea84f7123dbc4e300a1bfe5d58864a7eafabc1466627e + languageName: node + linkType: hard + +"@ethersproject/abstract-provider@npm:5.7.0, @ethersproject/abstract-provider@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/abstract-provider@npm:5.7.0" + dependencies: + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/networks": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + "@ethersproject/web": ^5.7.0 + checksum: 74cf4696245cf03bb7cc5b6cbf7b4b89dd9a79a1c4688126d214153a938126d4972d42c93182198653ce1de35f2a2cad68be40337d4774b3698a39b28f0228a8 + languageName: node + linkType: hard + +"@ethersproject/abstract-signer@npm:5.7.0, @ethersproject/abstract-signer@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/abstract-signer@npm:5.7.0" + dependencies: + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + checksum: a823dac9cfb761e009851050ebebd5b229d1b1cc4a75b125c2da130ff37e8218208f7f9d1386f77407705b889b23d4a230ad67185f8872f083143e0073cbfbe3 + languageName: node + linkType: hard + +"@ethersproject/address@npm:5.7.0, @ethersproject/address@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/address@npm:5.7.0" + dependencies: + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/rlp": ^5.7.0 + checksum: 64ea5ebea9cc0e845c413e6cb1e54e157dd9fc0dffb98e239d3a3efc8177f2ff798cd4e3206cf3660ee8faeb7bef1a47dc0ebef0d7b132c32e61e550c7d4c843 + languageName: node + linkType: hard + +"@ethersproject/base64@npm:5.7.0, @ethersproject/base64@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/base64@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + checksum: 7dd5d734d623582f08f665434f53685041a3d3b334a0e96c0c8afa8bbcaab934d50e5b6b980e826a8fde8d353e0b18f11e61faf17468177274b8e7c69cd9742b + languageName: node + linkType: hard + +"@ethersproject/basex@npm:5.7.0, @ethersproject/basex@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/basex@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + checksum: 326087b7e1f3787b5fe6cd1cf2b4b5abfafbc355a45e88e22e5e9d6c845b613ffc5301d629b28d5c4d5e2bfe9ec424e6782c804956dff79be05f0098cb5817de + languageName: node + linkType: hard + +"@ethersproject/bignumber@npm:5.7.0, @ethersproject/bignumber@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/bignumber@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + bn.js: ^5.2.1 + checksum: 8c9a134b76f3feb4ec26a5a27379efb4e156b8fb2de0678a67788a91c7f4e30abe9d948638458e4b20f2e42380da0adacc7c9389d05fce070692edc6ae9b4904 + languageName: node + linkType: hard + +"@ethersproject/bytes@npm:5.7.0, @ethersproject/bytes@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/bytes@npm:5.7.0" + dependencies: + "@ethersproject/logger": ^5.7.0 + checksum: 66ad365ceaab5da1b23b72225c71dce472cf37737af5118181fa8ab7447d696bea15ca22e3a0e8836fdd8cfac161afe321a7c67d0dde96f9f645ddd759676621 + languageName: node + linkType: hard + +"@ethersproject/constants@npm:5.7.0, @ethersproject/constants@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/constants@npm:5.7.0" + dependencies: + "@ethersproject/bignumber": ^5.7.0 + checksum: 6d4b1355747cce837b3e76ec3bde70e4732736f23b04f196f706ebfa5d4d9c2be50904a390d4d40ce77803b98d03d16a9b6898418e04ba63491933ce08c4ba8a + languageName: node + linkType: hard + +"@ethersproject/contracts@npm:5.7.0": + version: 5.7.0 + resolution: "@ethersproject/contracts@npm:5.7.0" + dependencies: + "@ethersproject/abi": ^5.7.0 + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + checksum: 6ccf1121cba01b31e02f8c507cb971ab6bfed85706484a9ec09878ef1594a62215f43c4fdef8f4a4875b99c4a800bc95e3be69b1803f8ce479e07634b5a740c0 + languageName: node + linkType: hard + +"@ethersproject/hash@npm:5.7.0, @ethersproject/hash@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/hash@npm:5.7.0" + dependencies: + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/base64": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + checksum: 6e9fa8d14eb08171cd32f17f98cc108ec2aeca74a427655f0d689c550fee0b22a83b3b400fad7fb3f41cf14d4111f87f170aa7905bcbcd1173a55f21b06262ef + languageName: node + linkType: hard + +"@ethersproject/hdnode@npm:5.7.0, @ethersproject/hdnode@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/hdnode@npm:5.7.0" + dependencies: + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/basex": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/pbkdf2": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/sha2": ^5.7.0 + "@ethersproject/signing-key": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + "@ethersproject/wordlists": ^5.7.0 + checksum: bfe5ca2d89a42de73655f853170ef4766b933c5f481cddad709b3aca18823275b096e572f92d1602a052f80b426edde44ad6b9d028799775a7dad4a5bbed2133 + languageName: node + linkType: hard + +"@ethersproject/json-wallets@npm:5.7.0, @ethersproject/json-wallets@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/json-wallets@npm:5.7.0" + dependencies: + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/hdnode": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/pbkdf2": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/random": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + aes-js: 3.0.0 + scrypt-js: 3.0.1 + checksum: f583458d22db62efaaf94d38dd243482776a45bf90f9f3882fbad5aa0b8fd288b41eb7c1ff8ec0b99c9b751088e43d6173530db64dd33c59f9d8daa8d7ad5aa2 + languageName: node + linkType: hard + +"@ethersproject/keccak256@npm:5.7.0, @ethersproject/keccak256@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/keccak256@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + js-sha3: 0.8.0 + checksum: ff70950d82203aab29ccda2553422cbac2e7a0c15c986bd20a69b13606ed8bb6e4fdd7b67b8d3b27d4f841e8222cbaccd33ed34be29f866fec7308f96ed244c6 + languageName: node + linkType: hard + +"@ethersproject/logger@npm:5.7.0, @ethersproject/logger@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/logger@npm:5.7.0" + checksum: 075ab2f605f1fd0813f2e39c3308f77b44a67732b36e712d9bc085f22a84aac4da4f71b39bee50fe78da3e1c812673fadc41180c9970fe5e486e91ea17befe0d + languageName: node + linkType: hard + +"@ethersproject/networks@npm:5.7.1, @ethersproject/networks@npm:^5.7.0": + version: 5.7.1 + resolution: "@ethersproject/networks@npm:5.7.1" + dependencies: + "@ethersproject/logger": ^5.7.0 + checksum: 0339f312304c17d9a0adce550edb825d4d2c8c9468c1634c44172c67a9ed256f594da62c4cda5c3837a0f28b7fabc03aca9b492f68ff1fdad337ee861b27bd5d + languageName: node + linkType: hard + +"@ethersproject/pbkdf2@npm:5.7.0, @ethersproject/pbkdf2@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/pbkdf2@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/sha2": ^5.7.0 + checksum: b895adb9e35a8a127e794f7aadc31a2424ef355a70e51cde10d457e3e888bb8102373199a540cf61f2d6b9a32e47358f9c65b47d559f42bf8e596b5fd67901e9 + languageName: node + linkType: hard + +"@ethersproject/properties@npm:5.7.0, @ethersproject/properties@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/properties@npm:5.7.0" + dependencies: + "@ethersproject/logger": ^5.7.0 + checksum: 6ab0ccf0c3aadc9221e0cdc5306ce6cd0df7f89f77d77bccdd1277182c9ead0202cd7521329ba3acde130820bf8af299e17cf567d0d497c736ee918207bbf59f + languageName: node + linkType: hard + +"@ethersproject/providers@npm:5.7.2, @ethersproject/providers@npm:^5.7.1, @ethersproject/providers@npm:^5.7.2": + version: 5.7.2 + resolution: "@ethersproject/providers@npm:5.7.2" + dependencies: + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/base64": ^5.7.0 + "@ethersproject/basex": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/hash": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/networks": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/random": ^5.7.0 + "@ethersproject/rlp": ^5.7.0 + "@ethersproject/sha2": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + "@ethersproject/web": ^5.7.0 + bech32: 1.1.4 + ws: 7.4.6 + checksum: 1754c731a5ca6782ae9677f4a9cd8b6246c4ef21a966c9a01b133750f3c578431ec43ec254e699969c4a0f87e84463ded50f96b415600aabd37d2056aee58c19 + languageName: node + linkType: hard + +"@ethersproject/random@npm:5.7.0, @ethersproject/random@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/random@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + checksum: 017829c91cff6c76470852855108115b0b52c611b6be817ed1948d56ba42d6677803ec2012aa5ae298a7660024156a64c11fcf544e235e239ab3f89f0fff7345 + languageName: node + linkType: hard + +"@ethersproject/rlp@npm:5.7.0, @ethersproject/rlp@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/rlp@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + checksum: bce165b0f7e68e4d091c9d3cf47b247cac33252df77a095ca4281d32d5eeaaa3695d9bc06b2b057c5015353a68df89f13a4a54a72e888e4beeabbe56b15dda6e + languageName: node + linkType: hard + +"@ethersproject/sha2@npm:5.7.0, @ethersproject/sha2@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/sha2@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + hash.js: 1.1.7 + checksum: 09321057c022effbff4cc2d9b9558228690b5dd916329d75c4b1ffe32ba3d24b480a367a7cc92d0f0c0b1c896814d03351ae4630e2f1f7160be2bcfbde435dbc + languageName: node + linkType: hard + +"@ethersproject/signing-key@npm:5.7.0, @ethersproject/signing-key@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/signing-key@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + bn.js: ^5.2.1 + elliptic: 6.5.4 + hash.js: 1.1.7 + checksum: 8f8de09b0aac709683bbb49339bc0a4cd2f95598f3546436c65d6f3c3a847ffa98e06d35e9ed2b17d8030bd2f02db9b7bd2e11c5cf8a71aad4537487ab4cf03a + languageName: node + linkType: hard + +"@ethersproject/solidity@npm:5.7.0": + version: 5.7.0 + resolution: "@ethersproject/solidity@npm:5.7.0" + dependencies: + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/sha2": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + checksum: 9a02f37f801c96068c3e7721f83719d060175bc4e80439fe060e92bd7acfcb6ac1330c7e71c49f4c2535ca1308f2acdcb01e00133129aac00581724c2d6293f3 + languageName: node + linkType: hard + +"@ethersproject/strings@npm:5.7.0, @ethersproject/strings@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/strings@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + checksum: 5ff78693ae3fdf3cf23e1f6dc047a61e44c8197d2408c42719fef8cb7b7b3613a4eec88ac0ed1f9f5558c74fe0de7ae3195a29ca91a239c74b9f444d8e8b50df + languageName: node + linkType: hard + +"@ethersproject/transactions@npm:5.7.0, @ethersproject/transactions@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/transactions@npm:5.7.0" + dependencies: + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/rlp": ^5.7.0 + "@ethersproject/signing-key": ^5.7.0 + checksum: a31b71996d2b283f68486241bff0d3ea3f1ba0e8f1322a8fffc239ccc4f4a7eb2ea9994b8fd2f093283fd75f87bae68171e01b6265261f821369aca319884a79 + languageName: node + linkType: hard + +"@ethersproject/units@npm:5.7.0": + version: 5.7.0 + resolution: "@ethersproject/units@npm:5.7.0" + dependencies: + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/constants": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + checksum: 304714f848cd32e57df31bf545f7ad35c2a72adae957198b28cbc62166daa929322a07bff6e9c9ac4577ab6aa0de0546b065ed1b2d20b19e25748b7d475cb0fc + languageName: node + linkType: hard + +"@ethersproject/wallet@npm:5.7.0": + version: 5.7.0 + resolution: "@ethersproject/wallet@npm:5.7.0" + dependencies: + "@ethersproject/abstract-provider": ^5.7.0 + "@ethersproject/abstract-signer": ^5.7.0 + "@ethersproject/address": ^5.7.0 + "@ethersproject/bignumber": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/hash": ^5.7.0 + "@ethersproject/hdnode": ^5.7.0 + "@ethersproject/json-wallets": ^5.7.0 + "@ethersproject/keccak256": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/random": ^5.7.0 + "@ethersproject/signing-key": ^5.7.0 + "@ethersproject/transactions": ^5.7.0 + "@ethersproject/wordlists": ^5.7.0 + checksum: a4009bf7331eddab38e3015b5e9101ef92de7f705b00a6196b997db0e5635b6d83561674d46c90c6f77b87c0500fe4a6b0183ba13749efc22db59c99deb82fbd + languageName: node + linkType: hard + +"@ethersproject/web@npm:5.7.1, @ethersproject/web@npm:^5.7.0": + version: 5.7.1 + resolution: "@ethersproject/web@npm:5.7.1" + dependencies: + "@ethersproject/base64": ^5.7.0 + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + checksum: 7028c47103f82fd2e2c197ce0eecfacaa9180ffeec7de7845b1f4f9b19d84081b7a48227aaddde05a4aaa526af574a9a0ce01cc0fc75e3e371f84b38b5b16b2b + languageName: node + linkType: hard + +"@ethersproject/wordlists@npm:5.7.0, @ethersproject/wordlists@npm:^5.7.0": + version: 5.7.0 + resolution: "@ethersproject/wordlists@npm:5.7.0" + dependencies: + "@ethersproject/bytes": ^5.7.0 + "@ethersproject/hash": ^5.7.0 + "@ethersproject/logger": ^5.7.0 + "@ethersproject/properties": ^5.7.0 + "@ethersproject/strings": ^5.7.0 + checksum: 30eb6eb0731f9ef5faa44bf9c0c6e950bcaaef61e4d2d9ce0ae6d341f4e2d6d1f4ab4f8880bfce03b7aac4b862fb740e1421170cfbf8e2aafc359277d49e6e97 + languageName: node + linkType: hard + +"@fastify/busboy@npm:^2.0.0": + version: 2.0.0 + resolution: "@fastify/busboy@npm:2.0.0" + checksum: 41879937ce1dee6421ef9cd4da53239830617e1f0bb7a0e843940772cd72827205d05e518af6adabe6e1ea19301285fff432b9d11bad01a531e698bea95c781b + languageName: node + linkType: hard + +"@hapi/hoek@npm:^9.0.0": + version: 9.3.0 + resolution: "@hapi/hoek@npm:9.3.0" + checksum: 4771c7a776242c3c022b168046af4e324d116a9d2e1d60631ee64f474c6e38d1bb07092d898bf95c7bc5d334c5582798a1456321b2e53ca817d4e7c88bc25b43 + languageName: node + linkType: hard + +"@hapi/topo@npm:^5.0.0": + version: 5.1.0 + resolution: "@hapi/topo@npm:5.1.0" + dependencies: + "@hapi/hoek": ^9.0.0 + checksum: 604dfd5dde76d5c334bd03f9001fce69c7ce529883acf92da96f4fe7e51221bf5e5110e964caca287a6a616ba027c071748ab636ff178ad750547fba611d6014 + languageName: node + linkType: hard + +"@humanwhocodes/config-array@npm:^0.11.11": + version: 0.11.11 + resolution: "@humanwhocodes/config-array@npm:0.11.11" + dependencies: + "@humanwhocodes/object-schema": ^1.2.1 + debug: ^4.1.1 + minimatch: ^3.0.5 + checksum: db84507375ab77b8ffdd24f498a5b49ad6b64391d30dd2ac56885501d03964d29637e05b1ed5aefa09d57ac667e28028bc22d2da872bfcd619652fbdb5f4ca19 + languageName: node + linkType: hard + +"@humanwhocodes/module-importer@npm:^1.0.1": + version: 1.0.1 + resolution: "@humanwhocodes/module-importer@npm:1.0.1" + checksum: 0fd22007db8034a2cdf2c764b140d37d9020bbfce8a49d3ec5c05290e77d4b0263b1b972b752df8c89e5eaa94073408f2b7d977aed131faf6cf396ebb5d7fb61 + languageName: node + linkType: hard + +"@humanwhocodes/object-schema@npm:^1.2.1": + version: 1.2.1 + resolution: "@humanwhocodes/object-schema@npm:1.2.1" + checksum: a824a1ec31591231e4bad5787641f59e9633827d0a2eaae131a288d33c9ef0290bd16fda8da6f7c0fcb014147865d12118df10db57f27f41e20da92369fcb3f1 + languageName: node + linkType: hard + +"@isaacs/cliui@npm:^8.0.2": + version: 8.0.2 + resolution: "@isaacs/cliui@npm:8.0.2" + dependencies: + string-width: ^5.1.2 + string-width-cjs: "npm:string-width@^4.2.0" + strip-ansi: ^7.0.1 + strip-ansi-cjs: "npm:strip-ansi@^6.0.1" + wrap-ansi: ^8.1.0 + wrap-ansi-cjs: "npm:wrap-ansi@^7.0.0" + checksum: 4a473b9b32a7d4d3cfb7a614226e555091ff0c5a29a1734c28c72a182c2f6699b26fc6b5c2131dfd841e86b185aea714c72201d7c98c2fba5f17709333a67aeb + languageName: node + linkType: hard + +"@jest/schemas@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/schemas@npm:29.6.3" + dependencies: + "@sinclair/typebox": ^0.27.8 + checksum: 910040425f0fc93cd13e68c750b7885590b8839066dfa0cd78e7def07bbb708ad869381f725945d66f2284de5663bbecf63e8fdd856e2ae6e261ba30b1687e93 + languageName: node + linkType: hard + +"@jest/types@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/types@npm:29.6.3" + dependencies: + "@jest/schemas": ^29.6.3 + "@types/istanbul-lib-coverage": ^2.0.0 + "@types/istanbul-reports": ^3.0.0 + "@types/node": "*" + "@types/yargs": ^17.0.8 + chalk: ^4.0.0 + checksum: a0bcf15dbb0eca6bdd8ce61a3fb055349d40268622a7670a3b2eb3c3dbafe9eb26af59938366d520b86907b9505b0f9b29b85cec11579a9e580694b87cd90fcc + languageName: node + linkType: hard + +"@jridgewell/gen-mapping@npm:^0.3.0, @jridgewell/gen-mapping@npm:^0.3.2": + version: 0.3.3 + resolution: "@jridgewell/gen-mapping@npm:0.3.3" + dependencies: + "@jridgewell/set-array": ^1.0.1 + "@jridgewell/sourcemap-codec": ^1.4.10 + "@jridgewell/trace-mapping": ^0.3.9 + checksum: 4a74944bd31f22354fc01c3da32e83c19e519e3bbadafa114f6da4522ea77dd0c2842607e923a591d60a76699d819a2fbb6f3552e277efdb9b58b081390b60ab + languageName: node + linkType: hard + +"@jridgewell/resolve-uri@npm:^3.0.3, @jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.1 + resolution: "@jridgewell/resolve-uri@npm:3.1.1" + checksum: f5b441fe7900eab4f9155b3b93f9800a916257f4e8563afbcd3b5a5337b55e52bd8ae6735453b1b745457d9f6cdb16d74cd6220bbdd98cf153239e13f6cbb653 + languageName: node + linkType: hard + +"@jridgewell/set-array@npm:^1.0.1": + version: 1.1.2 + resolution: "@jridgewell/set-array@npm:1.1.2" + checksum: 69a84d5980385f396ff60a175f7177af0b8da4ddb81824cb7016a9ef914eee9806c72b6b65942003c63f7983d4f39a5c6c27185bbca88eb4690b62075602e28e + languageName: node + linkType: hard + +"@jridgewell/source-map@npm:^0.3.3": + version: 0.3.5 + resolution: "@jridgewell/source-map@npm:0.3.5" + dependencies: + "@jridgewell/gen-mapping": ^0.3.0 + "@jridgewell/trace-mapping": ^0.3.9 + checksum: 1ad4dec0bdafbade57920a50acec6634f88a0eb735851e0dda906fa9894e7f0549c492678aad1a10f8e144bfe87f238307bf2a914a1bc85b7781d345417e9f6f + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14": + version: 1.4.15 + resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" + checksum: b881c7e503db3fc7f3c1f35a1dd2655a188cc51a3612d76efc8a6eb74728bef5606e6758ee77423e564092b4a518aba569bbb21c9bac5ab7a35b0c6ae7e344c8 + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:0.3.9": + version: 0.3.9 + resolution: "@jridgewell/trace-mapping@npm:0.3.9" + dependencies: + "@jridgewell/resolve-uri": ^3.0.3 + "@jridgewell/sourcemap-codec": ^1.4.10 + checksum: d89597752fd88d3f3480845691a05a44bd21faac18e2185b6f436c3b0fd0c5a859fbbd9aaa92050c4052caf325ad3e10e2e1d1b64327517471b7d51babc0ddef + languageName: node + linkType: hard + +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": + version: 0.3.19 + resolution: "@jridgewell/trace-mapping@npm:0.3.19" + dependencies: + "@jridgewell/resolve-uri": ^3.1.0 + "@jridgewell/sourcemap-codec": ^1.4.14 + checksum: 956a6f0f6fec060fb48c6bf1f5ec2064e13cd38c8be3873877d4b92b4a27ba58289a34071752671262a3e3c202abcc3fa2aac64d8447b4b0fa1ba3c9047f1c20 + languageName: node + linkType: hard + +"@leichtgewicht/ip-codec@npm:^2.0.1": + version: 2.0.4 + resolution: "@leichtgewicht/ip-codec@npm:2.0.4" + checksum: 468de1f04d33de6d300892683d7c8aecbf96d1e2c5fe084f95f816e50a054d45b7c1ebfb141a1447d844b86a948733f6eebd92234da8581c84a1ad4de2946a2d + languageName: node + linkType: hard + +"@mdn/browser-compat-data@npm:^4.0.0": + version: 4.2.1 + resolution: "@mdn/browser-compat-data@npm:4.2.1" + checksum: 76eaa7dafed154040e769ba6d23f2dcb58e805ed3ccb376a5c4b76326c92643753c20194faed363870800dc3c1af26c107b8562710c8bb37aaee8c5ffe2a89cd + languageName: node + linkType: hard + +"@mdx-js/mdx@npm:^1.6.22": + version: 1.6.22 + resolution: "@mdx-js/mdx@npm:1.6.22" + dependencies: + "@babel/core": 7.12.9 + "@babel/plugin-syntax-jsx": 7.12.1 + "@babel/plugin-syntax-object-rest-spread": 7.8.3 + "@mdx-js/util": 1.6.22 + babel-plugin-apply-mdx-type-prop: 1.6.22 + babel-plugin-extract-import-names: 1.6.22 + camelcase-css: 2.0.1 + detab: 2.0.4 + hast-util-raw: 6.0.1 + lodash.uniq: 4.5.0 + mdast-util-to-hast: 10.0.1 + remark-footnotes: 2.0.0 + remark-mdx: 1.6.22 + remark-parse: 8.0.3 + remark-squeeze-paragraphs: 4.0.0 + style-to-object: 0.3.0 + unified: 9.2.0 + unist-builder: 2.0.3 + unist-util-visit: 2.0.3 + checksum: 0839b4a3899416326ea6578fe9e470af319da559bc6d3669c60942e456b49a98eebeb3358c623007b4786a2175a450d2c51cd59df64639013c5a3d22366931a6 + languageName: node + linkType: hard + +"@mdx-js/react@npm:^1.6.22": + version: 1.6.22 + resolution: "@mdx-js/react@npm:1.6.22" + peerDependencies: + react: ^16.13.1 || ^17.0.0 + checksum: bc84bd514bc127f898819a0c6f1a6915d9541011bd8aefa1fcc1c9bea8939f31051409e546bdec92babfa5b56092a16d05ef6d318304ac029299df5181dc94c8 + languageName: node + linkType: hard + +"@mdx-js/util@npm:1.6.22": + version: 1.6.22 + resolution: "@mdx-js/util@npm:1.6.22" + checksum: 4b393907e39a1a75214f0314bf72a0adfa5e5adffd050dd5efe9c055b8549481a3cfc9f308c16dfb33311daf3ff63added7d5fd1fe52db614c004f886e0e559a + languageName: node + linkType: hard + +"@metamask/eth-sig-util@npm:^4.0.0": + version: 4.0.1 + resolution: "@metamask/eth-sig-util@npm:4.0.1" + dependencies: + ethereumjs-abi: ^0.6.8 + ethereumjs-util: ^6.2.1 + ethjs-util: ^0.1.6 + tweetnacl: ^1.0.3 + tweetnacl-util: ^0.15.1 + checksum: 740df4c92a1282e6be4c00c86c1a8ccfb93e767596e43f6da895aa5bab4a28fc3c2209f0327db34924a4a1e9db72bc4d3dddfcfc45cca0b218c9ccbf7d1b1445 + languageName: node + linkType: hard + +"@noble/hashes@npm:1.1.2": + version: 1.1.2 + resolution: "@noble/hashes@npm:1.1.2" + checksum: 3c2a8cb7c2e053811032f242155d870c5eb98844d924d69702244d48804cb03b42d4a666c49c2b71164420d8229cb9a6f242b972d50d5bb2f1d673b98b041de2 + languageName: node + linkType: hard + +"@noble/hashes@npm:1.2.0, @noble/hashes@npm:~1.2.0": + version: 1.2.0 + resolution: "@noble/hashes@npm:1.2.0" + checksum: 8ca080ce557b8f40fb2f78d3aedffd95825a415ac8e13d7ffe3643f8626a8c2d99a3e5975b555027ac24316d8b3c02a35b8358567c0c23af681e6573602aa434 + languageName: node + linkType: hard + +"@noble/secp256k1@npm:1.7.1, @noble/secp256k1@npm:~1.7.0": + version: 1.7.1 + resolution: "@noble/secp256k1@npm:1.7.1" + checksum: d2301f1f7690368d8409a3152450458f27e54df47e3f917292de3de82c298770890c2de7c967d237eff9c95b70af485389a9695f73eb05a43e2bd562d18b18cb + languageName: node + linkType: hard + +"@node-rs/jieba-android-arm-eabi@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-android-arm-eabi@npm:1.7.2" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@node-rs/jieba-android-arm64@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-android-arm64@npm:1.7.2" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@node-rs/jieba-darwin-arm64@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-darwin-arm64@npm:1.7.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@node-rs/jieba-darwin-x64@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-darwin-x64@npm:1.7.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@node-rs/jieba-freebsd-x64@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-freebsd-x64@npm:1.7.2" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@node-rs/jieba-linux-arm-gnueabihf@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-linux-arm-gnueabihf@npm:1.7.2" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@node-rs/jieba-linux-arm64-gnu@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-linux-arm64-gnu@npm:1.7.2" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@node-rs/jieba-linux-arm64-musl@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-linux-arm64-musl@npm:1.7.2" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@node-rs/jieba-linux-x64-gnu@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-linux-x64-gnu@npm:1.7.2" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@node-rs/jieba-linux-x64-musl@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-linux-x64-musl@npm:1.7.2" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@node-rs/jieba-win32-arm64-msvc@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-win32-arm64-msvc@npm:1.7.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@node-rs/jieba-win32-ia32-msvc@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-win32-ia32-msvc@npm:1.7.2" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@node-rs/jieba-win32-x64-msvc@npm:1.7.2": + version: 1.7.2 + resolution: "@node-rs/jieba-win32-x64-msvc@npm:1.7.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@node-rs/jieba@npm:^1.6.0": + version: 1.7.2 + resolution: "@node-rs/jieba@npm:1.7.2" + dependencies: + "@node-rs/jieba-android-arm-eabi": 1.7.2 + "@node-rs/jieba-android-arm64": 1.7.2 + "@node-rs/jieba-darwin-arm64": 1.7.2 + "@node-rs/jieba-darwin-x64": 1.7.2 + "@node-rs/jieba-freebsd-x64": 1.7.2 + "@node-rs/jieba-linux-arm-gnueabihf": 1.7.2 + "@node-rs/jieba-linux-arm64-gnu": 1.7.2 + "@node-rs/jieba-linux-arm64-musl": 1.7.2 + "@node-rs/jieba-linux-x64-gnu": 1.7.2 + "@node-rs/jieba-linux-x64-musl": 1.7.2 + "@node-rs/jieba-win32-arm64-msvc": 1.7.2 + "@node-rs/jieba-win32-ia32-msvc": 1.7.2 + "@node-rs/jieba-win32-x64-msvc": 1.7.2 + dependenciesMeta: + "@node-rs/jieba-android-arm-eabi": + optional: true + "@node-rs/jieba-android-arm64": + optional: true + "@node-rs/jieba-darwin-arm64": + optional: true + "@node-rs/jieba-darwin-x64": + optional: true + "@node-rs/jieba-freebsd-x64": + optional: true + "@node-rs/jieba-linux-arm-gnueabihf": + optional: true + "@node-rs/jieba-linux-arm64-gnu": + optional: true + "@node-rs/jieba-linux-arm64-musl": + optional: true + "@node-rs/jieba-linux-x64-gnu": + optional: true + "@node-rs/jieba-linux-x64-musl": + optional: true + "@node-rs/jieba-win32-arm64-msvc": + optional: true + "@node-rs/jieba-win32-ia32-msvc": + optional: true + "@node-rs/jieba-win32-x64-msvc": + optional: true + checksum: 47108c5e84993ba2ddbc1d922ecb840b74668d61ff8ec83137a300c02e6c97748e64d98f23484dce7d1aee9d00dcf3d1921ccb5375b83ed8474650d0fc1e7e60 + languageName: node + linkType: hard + +"@nodelib/fs.scandir@npm:2.1.5": + version: 2.1.5 + resolution: "@nodelib/fs.scandir@npm:2.1.5" + dependencies: + "@nodelib/fs.stat": 2.0.5 + run-parallel: ^1.1.9 + checksum: a970d595bd23c66c880e0ef1817791432dbb7acbb8d44b7e7d0e7a22f4521260d4a83f7f9fd61d44fda4610105577f8f58a60718105fb38352baed612fd79e59 + languageName: node + linkType: hard + +"@nodelib/fs.stat@npm:2.0.5, @nodelib/fs.stat@npm:^2.0.2": + version: 2.0.5 + resolution: "@nodelib/fs.stat@npm:2.0.5" + checksum: 012480b5ca9d97bff9261571dbbec7bbc6033f69cc92908bc1ecfad0792361a5a1994bc48674b9ef76419d056a03efadfce5a6cf6dbc0a36559571a7a483f6f0 + languageName: node + linkType: hard + +"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": + version: 1.2.8 + resolution: "@nodelib/fs.walk@npm:1.2.8" + dependencies: + "@nodelib/fs.scandir": 2.1.5 + fastq: ^1.6.0 + checksum: 190c643f156d8f8f277bf2a6078af1ffde1fd43f498f187c2db24d35b4b4b5785c02c7dc52e356497b9a1b65b13edc996de08de0b961c32844364da02986dc53 + languageName: node + linkType: hard + +"@noir-lang/acvm_js@workspace:*, @noir-lang/acvm_js@workspace:acvm-repo/acvm_js": + version: 0.0.0-use.local + resolution: "@noir-lang/acvm_js@workspace:acvm-repo/acvm_js" + dependencies: + "@esm-bundle/chai": ^4.3.4-fix.0 + "@web/dev-server-esbuild": ^0.3.6 + "@web/test-runner": ^0.15.3 + "@web/test-runner-playwright": ^0.10.0 + chai: ^4.3.7 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + mocha: ^10.2.0 + prettier: 3.0.3 + ts-node: ^10.9.1 + typescript: ^5.0.4 + languageName: unknown + linkType: soft + +"@noir-lang/backend_barretenberg@workspace:*, @noir-lang/backend_barretenberg@workspace:tooling/noir_js_backend_barretenberg": + version: 0.0.0-use.local + resolution: "@noir-lang/backend_barretenberg@workspace:tooling/noir_js_backend_barretenberg" + dependencies: + "@aztec/bb.js": 0.12.0 + "@noir-lang/types": "workspace:*" + "@types/node": ^20.6.2 + "@types/prettier": ^3 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + fflate: ^0.8.0 + prettier: 3.0.3 + typescript: 5.1.5 + languageName: unknown + linkType: soft + +"@noir-lang/noir_codegen@workspace:tooling/noir_codegen": + version: 0.0.0-use.local + resolution: "@noir-lang/noir_codegen@workspace:tooling/noir_codegen" + dependencies: + "@noir-lang/noir_js": "workspace:*" + "@noir-lang/types": "workspace:*" + "@types/chai": ^4 + "@types/lodash": ^4 + "@types/mocha": ^10.0.1 + "@types/node": ^20.6.2 + "@types/prettier": ^3 + chai: ^4.3.8 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + glob: ^10.3.10 + lodash: ^4.17.21 + mocha: ^10.2.0 + prettier: 3.0.3 + ts-command-line-args: ^2.5.1 + ts-node: ^10.9.1 + typescript: ^5.2.2 + bin: + noir-codegen: lib/main.js + languageName: unknown + linkType: soft + +"@noir-lang/noir_js@workspace:*, @noir-lang/noir_js@workspace:tooling/noir_js": + version: 0.0.0-use.local + resolution: "@noir-lang/noir_js@workspace:tooling/noir_js" + dependencies: + "@noir-lang/acvm_js": "workspace:*" + "@noir-lang/noirc_abi": "workspace:*" + "@noir-lang/types": "workspace:*" + "@types/chai": ^4 + "@types/mocha": ^10.0.1 + "@types/node": ^20.6.2 + "@types/prettier": ^3 + chai: ^4.3.8 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + mocha: ^10.2.0 + prettier: 3.0.3 + ts-node: ^10.9.1 + tsc-multi: ^1.1.0 + typescript: ^5.2.2 + languageName: unknown + linkType: soft + +"@noir-lang/noir_wasm@workspace:*, @noir-lang/noir_wasm@workspace:compiler/wasm": + version: 0.0.0-use.local + resolution: "@noir-lang/noir_wasm@workspace:compiler/wasm" + dependencies: + "@esm-bundle/chai": ^4.3.4-fix.0 + "@web/dev-server-esbuild": ^0.3.6 + "@web/test-runner": ^0.15.3 + "@web/test-runner-playwright": ^0.10.0 + mocha: ^10.2.0 + peerDependencies: + "@noir-lang/source-resolver": "workspace:*" + languageName: unknown + linkType: soft + +"@noir-lang/noirc_abi@workspace:*, @noir-lang/noirc_abi@workspace:tooling/noirc_abi_wasm": + version: 0.0.0-use.local + resolution: "@noir-lang/noirc_abi@workspace:tooling/noirc_abi_wasm" + dependencies: + "@esm-bundle/chai": ^4.3.4-fix.0 + "@web/dev-server-esbuild": ^0.3.6 + "@web/test-runner": ^0.15.3 + "@web/test-runner-playwright": ^0.10.0 + eslint: ^8.50.0 + mocha: ^10.2.0 + languageName: unknown + linkType: soft + +"@noir-lang/root@workspace:.": + version: 0.0.0-use.local + resolution: "@noir-lang/root@workspace:." + dependencies: + "@typescript-eslint/eslint-plugin": ^6.7.3 + "@typescript-eslint/parser": ^6.7.3 + chai: ^4.3.7 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + mocha: ^10.2.0 + prettier: 3.0.3 + ts-node: ^10.9.1 + typescript: ^5.0.4 + languageName: unknown + linkType: soft + +"@noir-lang/source-resolver@workspace:*, @noir-lang/source-resolver@workspace:compiler/source-resolver": + version: 0.0.0-use.local + resolution: "@noir-lang/source-resolver@workspace:compiler/source-resolver" + dependencies: + "@types/node": ^20.5.7 + ava: ^5.2.0 + typescript: 4.9.4 + languageName: unknown + linkType: soft + +"@noir-lang/types@workspace:*, @noir-lang/types@workspace:tooling/noir_js_types": + version: 0.0.0-use.local + resolution: "@noir-lang/types@workspace:tooling/noir_js_types" + dependencies: + "@noir-lang/noirc_abi": "workspace:*" + "@types/prettier": ^3 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + prettier: 3.0.3 + typescript: ^5.2.2 + languageName: unknown + linkType: soft + +"@nomicfoundation/ethereumjs-block@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.2" + dependencies: + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + ethereum-cryptography: 0.1.3 + ethers: ^5.7.1 + checksum: 7ff744f44a01f1c059ca7812a1cfc8089f87aa506af6cb39c78331dca71b32993cbd6fa05ad03f8c4f4fab73bb998a927af69e0d8ff01ae192ee5931606e09f5 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-blockchain@npm:7.0.2": + version: 7.0.2 + resolution: "@nomicfoundation/ethereumjs-blockchain@npm:7.0.2" + dependencies: + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-ethash": 3.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + abstract-level: ^1.0.3 + debug: ^4.3.3 + ethereum-cryptography: 0.1.3 + level: ^8.0.0 + lru-cache: ^5.1.1 + memory-level: ^1.0.0 + checksum: b7e440dcd73e32aa72d13bfd28cb472773c9c60ea808a884131bf7eb3f42286ad594a0864215f599332d800f3fe1f772fff4b138d2dcaa8f41e4d8389bff33e7 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-common@npm:4.0.2": + version: 4.0.2 + resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.2" + dependencies: + "@nomicfoundation/ethereumjs-util": 9.0.2 + crc-32: ^1.2.0 + checksum: f0d84704d6254d374299c19884312bd5666974b4b6f342d3f10bc76e549de78d20e45a53d25fbdc146268a52335497127e4f069126da7c60ac933a158e704887 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-ethash@npm:3.0.2": + version: 3.0.2 + resolution: "@nomicfoundation/ethereumjs-ethash@npm:3.0.2" + dependencies: + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + abstract-level: ^1.0.3 + bigint-crypto-utils: ^3.0.23 + ethereum-cryptography: 0.1.3 + checksum: e4011e4019dd9b92f7eeebfc1e6c9a9685c52d8fd0ee4f28f03e50048a23b600c714490827f59fdce497b3afb503b3fd2ebf6815ff307e9949c3efeff1403278 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-evm@npm:2.0.2": + version: 2.0.2 + resolution: "@nomicfoundation/ethereumjs-evm@npm:2.0.2" + dependencies: + "@ethersproject/providers": ^5.7.1 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + debug: ^4.3.3 + ethereum-cryptography: 0.1.3 + mcl-wasm: ^0.7.1 + rustbn.js: ~0.2.0 + checksum: a23cf570836ddc147606b02df568069de946108e640f902358fef67e589f6b371d856056ee44299d9b4e3497f8ae25faa45e6b18fefd90e9b222dc6a761d85f0 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-rlp@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.2" + bin: + rlp: bin/rlp + checksum: a74434cadefca9aa8754607cc1ad7bb4bbea4ee61c6214918e60a5bbee83206850346eb64e39fd1fe97f854c7ec0163e01148c0c881dda23881938f0645a0ef2 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-statemanager@npm:2.0.2": + version: 2.0.2 + resolution: "@nomicfoundation/ethereumjs-statemanager@npm:2.0.2" + dependencies: + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + debug: ^4.3.3 + ethereum-cryptography: 0.1.3 + ethers: ^5.7.1 + js-sdsl: ^4.1.4 + checksum: 3ab6578e252e53609afd98d8ba42a99f182dcf80252f23ed9a5e0471023ffb2502130f85fc47fa7c94cd149f9be799ed9a0942ca52a143405be9267f4ad94e64 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-trie@npm:6.0.2": + version: 6.0.2 + resolution: "@nomicfoundation/ethereumjs-trie@npm:6.0.2" + dependencies: + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + "@types/readable-stream": ^2.3.13 + ethereum-cryptography: 0.1.3 + readable-stream: ^3.6.0 + checksum: d4da918d333851b9f2cce7dbd25ab5753e0accd43d562d98fd991b168b6a08d1794528f0ade40fe5617c84900378376fe6256cdbe52c8d66bf4c53293bbc7c40 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-tx@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.2" + dependencies: + "@chainsafe/ssz": ^0.9.2 + "@ethersproject/providers": ^5.7.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + ethereum-cryptography: 0.1.3 + checksum: 0bbcea75786b2ccb559afe2ecc9866fb4566a9f157b6ffba4f50960d14f4b3da2e86e273f6fadda9b860e67cfcabf589970fb951b328cb5f900a585cd21842a2 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-util@npm:9.0.2": + version: 9.0.2 + resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.2" + dependencies: + "@chainsafe/ssz": ^0.10.0 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + ethereum-cryptography: 0.1.3 + checksum: 3a08f7b88079ef9f53b43da9bdcb8195498fd3d3911c2feee2571f4d1204656053f058b2f650471c86f7d2d0ba2f814768c7cfb0f266eede41c848356afc4900 + languageName: node + linkType: hard + +"@nomicfoundation/ethereumjs-vm@npm:7.0.2": + version: 7.0.2 + resolution: "@nomicfoundation/ethereumjs-vm@npm:7.0.2" + dependencies: + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-blockchain": 7.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-evm": 2.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-statemanager": 2.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + debug: ^4.3.3 + ethereum-cryptography: 0.1.3 + mcl-wasm: ^0.7.1 + rustbn.js: ~0.2.0 + checksum: 1c25ba4d0644cadb8a2b0241a4bb02e578bfd7f70e3492b855c2ab5c120cb159cb8f7486f84dc1597884bd1697feedbfb5feb66e91352afb51f3694fd8e4a043 + languageName: node + linkType: hard + +"@nomicfoundation/hardhat-chai-matchers@npm:^2.0.0": + version: 2.0.2 + resolution: "@nomicfoundation/hardhat-chai-matchers@npm:2.0.2" + dependencies: + "@types/chai-as-promised": ^7.1.3 + chai-as-promised: ^7.1.1 + deep-eql: ^4.0.1 + ordinal: ^1.0.3 + peerDependencies: + "@nomicfoundation/hardhat-ethers": ^3.0.0 + chai: ^4.2.0 + ethers: ^6.1.0 + hardhat: ^2.9.4 + checksum: 62d7d69f6b34a06bc43fe0dab8adc9e3b6f907f1b68bb5cf47feb78a4c7ef057b9a4aa713611abeca38df9d8fe166bbd9bbf98e42c4edbdf7aece477b3f9485a + languageName: node + linkType: hard + +"@nomicfoundation/hardhat-ethers@npm:^3.0.0": + version: 3.0.4 + resolution: "@nomicfoundation/hardhat-ethers@npm:3.0.4" + dependencies: + debug: ^4.1.1 + lodash.isequal: ^4.5.0 + peerDependencies: + ethers: ^6.1.0 + hardhat: ^2.0.0 + checksum: 57cbb13682cf0e14cf5bb17b47a2004f69765358fffba7d660ab277a6aff38583216637aa3c5c68410a649a9cd41f774a8df2cb89098f6f616f6108c0f6e5d7a + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-darwin-arm64@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-darwin-arm64@npm:0.1.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-darwin-x64@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-darwin-x64@npm:0.1.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-freebsd-x64@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-freebsd-x64@npm:0.1.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-linux-arm64-gnu@npm:0.1.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-linux-arm64-musl@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-linux-arm64-musl@npm:0.1.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-linux-x64-gnu@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-linux-x64-gnu@npm:0.1.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-linux-x64-musl@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-linux-x64-musl@npm:0.1.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-win32-arm64-msvc@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-win32-arm64-msvc@npm:0.1.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-win32-ia32-msvc@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-win32-ia32-msvc@npm:0.1.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer-win32-x64-msvc@npm:0.1.1": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer-win32-x64-msvc@npm:0.1.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@nomicfoundation/solidity-analyzer@npm:^0.1.0": + version: 0.1.1 + resolution: "@nomicfoundation/solidity-analyzer@npm:0.1.1" + dependencies: + "@nomicfoundation/solidity-analyzer-darwin-arm64": 0.1.1 + "@nomicfoundation/solidity-analyzer-darwin-x64": 0.1.1 + "@nomicfoundation/solidity-analyzer-freebsd-x64": 0.1.1 + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": 0.1.1 + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": 0.1.1 + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": 0.1.1 + "@nomicfoundation/solidity-analyzer-linux-x64-musl": 0.1.1 + "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": 0.1.1 + "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": 0.1.1 + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": 0.1.1 + dependenciesMeta: + "@nomicfoundation/solidity-analyzer-darwin-arm64": + optional: true + "@nomicfoundation/solidity-analyzer-darwin-x64": + optional: true + "@nomicfoundation/solidity-analyzer-freebsd-x64": + optional: true + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": + optional: true + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": + optional: true + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": + optional: true + "@nomicfoundation/solidity-analyzer-linux-x64-musl": + optional: true + "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": + optional: true + "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": + optional: true + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": + optional: true + checksum: 038cffafd5769e25256b5b8bef88d95cc1c021274a65c020cf84aceb3237752a3b51645fdb0687f5516a2bdfebf166fcf50b08ab64857925100213e0654b266b + languageName: node + linkType: hard + +"@npmcli/fs@npm:^3.1.0": + version: 3.1.0 + resolution: "@npmcli/fs@npm:3.1.0" + dependencies: + semver: ^7.3.5 + checksum: a50a6818de5fc557d0b0e6f50ec780a7a02ab8ad07e5ac8b16bf519e0ad60a144ac64f97d05c443c3367235d337182e1d012bbac0eb8dbae8dc7b40b193efd0e + languageName: node + linkType: hard + +"@pkgjs/parseargs@npm:^0.11.0": + version: 0.11.0 + resolution: "@pkgjs/parseargs@npm:0.11.0" + checksum: 6ad6a00fc4f2f2cfc6bff76fb1d88b8ee20bc0601e18ebb01b6d4be583733a860239a521a7fbca73b612e66705078809483549d2b18f370eb346c5155c8e4a0f + languageName: node + linkType: hard + +"@pkgr/utils@npm:^2.3.1": + version: 2.4.2 + resolution: "@pkgr/utils@npm:2.4.2" + dependencies: + cross-spawn: ^7.0.3 + fast-glob: ^3.3.0 + is-glob: ^4.0.3 + open: ^9.1.0 + picocolors: ^1.0.0 + tslib: ^2.6.0 + checksum: 24e04c121269317d259614cd32beea3af38277151c4002df5883c4be920b8e3490bb897748e844f9d46bf68230f86dabd4e8f093773130e7e60529a769a132fc + languageName: node + linkType: hard + +"@polka/url@npm:^1.0.0-next.20": + version: 1.0.0-next.23 + resolution: "@polka/url@npm:1.0.0-next.23" + checksum: 4b0330de1ceecd1002c7e7449094d0c41f2ed0e21765f4835ccc7b003f2f024ac557d503b9ffdf0918cf50b80d5b8c99dfc5a91927e7b3c468b09c6bb42a3c41 + languageName: node + linkType: hard + +"@puppeteer/browsers@npm:0.5.0": + version: 0.5.0 + resolution: "@puppeteer/browsers@npm:0.5.0" + dependencies: + debug: 4.3.4 + extract-zip: 2.0.1 + https-proxy-agent: 5.0.1 + progress: 2.0.3 + proxy-from-env: 1.1.0 + tar-fs: 2.1.1 + unbzip2-stream: 1.4.3 + yargs: 17.7.1 + peerDependencies: + typescript: ">= 4.7.4" + peerDependenciesMeta: + typescript: + optional: true + bin: + browsers: lib/cjs/main-cli.js + checksum: d75fde03be4be106ca907834739251c2bb0b33a09fa23315c5dbe8b8b4cfed2f1b26af62e1dbe5fccc227e9bc87b51da0815461b982477eb01439bfdd6e7b01a + languageName: node + linkType: hard + +"@rollup/plugin-node-resolve@npm:^13.0.4": + version: 13.3.0 + resolution: "@rollup/plugin-node-resolve@npm:13.3.0" + dependencies: + "@rollup/pluginutils": ^3.1.0 + "@types/resolve": 1.17.1 + deepmerge: ^4.2.2 + is-builtin-module: ^3.1.0 + is-module: ^1.0.0 + resolve: ^1.19.0 + peerDependencies: + rollup: ^2.42.0 + checksum: ec5418e6b3c23a9e30683056b3010e9d325316dcfae93fbc673ae64dad8e56a2ce761c15c48f5e2dcfe0c822fdc4a4905ee6346e3dcf90603ba2260afef5a5e6 + languageName: node + linkType: hard + +"@rollup/pluginutils@npm:^3.1.0": + version: 3.1.0 + resolution: "@rollup/pluginutils@npm:3.1.0" + dependencies: + "@types/estree": 0.0.39 + estree-walker: ^1.0.1 + picomatch: ^2.2.2 + peerDependencies: + rollup: ^1.20.0||^2.0.0 + checksum: 8be16e27863c219edbb25a4e6ec2fe0e1e451d9e917b6a43cf2ae5bc025a6b8faaa40f82a6e53b66d0de37b58ff472c6c3d57a83037ae635041f8df959d6d9aa + languageName: node + linkType: hard + +"@scure/base@npm:~1.1.0": + version: 1.1.3 + resolution: "@scure/base@npm:1.1.3" + checksum: 1606ab8a4db898cb3a1ada16c15437c3bce4e25854fadc8eb03ae93cbbbac1ed90655af4b0be3da37e12056fef11c0374499f69b9e658c9e5b7b3e06353c630c + languageName: node + linkType: hard + +"@scure/bip32@npm:1.1.5": + version: 1.1.5 + resolution: "@scure/bip32@npm:1.1.5" + dependencies: + "@noble/hashes": ~1.2.0 + "@noble/secp256k1": ~1.7.0 + "@scure/base": ~1.1.0 + checksum: b08494ab0d2b1efee7226d1b5100db5157ebea22a78bb87126982a76a186cb3048413e8be0ba2622d00d048a20acbba527af730de86c132a77de616eb9907a3b + languageName: node + linkType: hard + +"@scure/bip39@npm:1.1.1": + version: 1.1.1 + resolution: "@scure/bip39@npm:1.1.1" + dependencies: + "@noble/hashes": ~1.2.0 + "@scure/base": ~1.1.0 + checksum: fbb594c50696fa9c14e891d872f382e50a3f919b6c96c55ef2fb10c7102c546dafb8f099a62bd114c12a00525b595dcf7381846f383f0ddcedeaa6e210747d2f + languageName: node + linkType: hard + +"@sentry/core@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/core@npm:5.30.0" + dependencies: + "@sentry/hub": 5.30.0 + "@sentry/minimal": 5.30.0 + "@sentry/types": 5.30.0 + "@sentry/utils": 5.30.0 + tslib: ^1.9.3 + checksum: 8a2b22687e70d76fa4381bce215d770b6c08561c5ff5d6afe39c8c3c509c18ee7384ad0be3aee18d3a858a3c88e1d2821cf10eb5e05646376a33200903b56da2 + languageName: node + linkType: hard + +"@sentry/hub@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/hub@npm:5.30.0" + dependencies: + "@sentry/types": 5.30.0 + "@sentry/utils": 5.30.0 + tslib: ^1.9.3 + checksum: 09f778cc78765213f1e35a3ee6da3a8e02a706e8a7e5b7f84614707f4b665c7297b700a1849ab2ca1f02ede5884fd9ae893e58dc65f04f35ccdfee17e99ee93d + languageName: node + linkType: hard + +"@sentry/minimal@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/minimal@npm:5.30.0" + dependencies: + "@sentry/hub": 5.30.0 + "@sentry/types": 5.30.0 + tslib: ^1.9.3 + checksum: 934650f6989ce51f425c7c4b4d4d9bfecface8162a36d21df8a241f780ab1716dd47b81e2170e4cc624797ed1eebe10f71e4876c1e25b787860daaef75ca7a0c + languageName: node + linkType: hard + +"@sentry/node@npm:^5.18.1": + version: 5.30.0 + resolution: "@sentry/node@npm:5.30.0" + dependencies: + "@sentry/core": 5.30.0 + "@sentry/hub": 5.30.0 + "@sentry/tracing": 5.30.0 + "@sentry/types": 5.30.0 + "@sentry/utils": 5.30.0 + cookie: ^0.4.1 + https-proxy-agent: ^5.0.0 + lru_map: ^0.3.3 + tslib: ^1.9.3 + checksum: 5f0367cc52f9d716c64ba727e2a5c8592364494c8fdadfb3df2d0ee9d7956b886fb3ec674370292d2a7b7e1d9a8e1b84c69c06e8a4a064be8d4687698df0090c + languageName: node + linkType: hard + +"@sentry/tracing@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/tracing@npm:5.30.0" + dependencies: + "@sentry/hub": 5.30.0 + "@sentry/minimal": 5.30.0 + "@sentry/types": 5.30.0 + "@sentry/utils": 5.30.0 + tslib: ^1.9.3 + checksum: 720c07b111e8128e70a939ab4e9f9cfd13dc23303b27575afddabab08d08f9b94499017c76a9ffe253bf3ca40833e8f9262cf6dc546ba24da6eb74fedae5f92b + languageName: node + linkType: hard + +"@sentry/types@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/types@npm:5.30.0" + checksum: de7df777824c8e311f143c6fd7de220b24f25b5018312fe8f67d93bebf0f3cdd32bbca9f155846f5c31441d940eebe27c8338000321559a743264c7e41dda560 + languageName: node + linkType: hard + +"@sentry/utils@npm:5.30.0": + version: 5.30.0 + resolution: "@sentry/utils@npm:5.30.0" + dependencies: + "@sentry/types": 5.30.0 + tslib: ^1.9.3 + checksum: 27b259a136c664427641dd32ee3dc490553f3b5e92986accfa829d14063ebc69b191e92209ac9c40fbc367f74cfa17dc93b4c40981d666711fd57b4d51a82062 + languageName: node + linkType: hard + +"@sideway/address@npm:^4.1.3": + version: 4.1.4 + resolution: "@sideway/address@npm:4.1.4" + dependencies: + "@hapi/hoek": ^9.0.0 + checksum: b9fca2a93ac2c975ba12e0a6d97853832fb1f4fb02393015e012b47fa916a75ca95102d77214b2a29a2784740df2407951af8c5dde054824c65577fd293c4cdb + languageName: node + linkType: hard + +"@sideway/formula@npm:^3.0.1": + version: 3.0.1 + resolution: "@sideway/formula@npm:3.0.1" + checksum: e4beeebc9dbe2ff4ef0def15cec0165e00d1612e3d7cea0bc9ce5175c3263fc2c818b679bd558957f49400ee7be9d4e5ac90487e1625b4932e15c4aa7919c57a + languageName: node + linkType: hard + +"@sideway/pinpoint@npm:^2.0.0": + version: 2.0.0 + resolution: "@sideway/pinpoint@npm:2.0.0" + checksum: 0f4491e5897fcf5bf02c46f5c359c56a314e90ba243f42f0c100437935daa2488f20482f0f77186bd6bf43345095a95d8143ecf8b1f4d876a7bc0806aba9c3d2 + languageName: node + linkType: hard + +"@sinclair/typebox@npm:^0.27.8": + version: 0.27.8 + resolution: "@sinclair/typebox@npm:0.27.8" + checksum: 00bd7362a3439021aa1ea51b0e0d0a0e8ca1351a3d54c606b115fdcc49b51b16db6e5f43b4fe7a28c38688523e22a94d49dd31168868b655f0d4d50f032d07a1 + languageName: node + linkType: hard + +"@sindresorhus/is@npm:^0.14.0": + version: 0.14.0 + resolution: "@sindresorhus/is@npm:0.14.0" + checksum: 971e0441dd44ba3909b467219a5e242da0fc584048db5324cfb8048148fa8dcc9d44d71e3948972c4f6121d24e5da402ef191420d1266a95f713bb6d6e59c98a + languageName: node + linkType: hard + +"@slorber/static-site-generator-webpack-plugin@npm:^4.0.7": + version: 4.0.7 + resolution: "@slorber/static-site-generator-webpack-plugin@npm:4.0.7" + dependencies: + eval: ^0.1.8 + p-map: ^4.0.0 + webpack-sources: ^3.2.2 + checksum: a1e1d8b22dd51059524993f3fdd6861db10eb950debc389e5dd650702287fa2004eace03e6bc8f25b977bd7bc01d76a50aa271cbb73c58a8ec558945d728f307 + languageName: node + linkType: hard + +"@svgr/babel-plugin-add-jsx-attribute@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-add-jsx-attribute@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: cab83832830a57735329ed68f67c03b57ca21fa037b0134847b0c5c0ef4beca89956d7dacfbf7b2a10fd901e7009e877512086db2ee918b8c69aee7742ae32c0 + languageName: node + linkType: hard + +"@svgr/babel-plugin-remove-jsx-attribute@npm:*": + version: 8.0.0 + resolution: "@svgr/babel-plugin-remove-jsx-attribute@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: ff992893c6c4ac802713ba3a97c13be34e62e6d981c813af40daabcd676df68a72a61bd1e692bb1eda3587f1b1d700ea462222ae2153bb0f46886632d4f88d08 + languageName: node + linkType: hard + +"@svgr/babel-plugin-remove-jsx-empty-expression@npm:*": + version: 8.0.0 + resolution: "@svgr/babel-plugin-remove-jsx-empty-expression@npm:8.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0fb691b63a21bac00da3aa2dccec50d0d5a5b347ff408d60803b84410d8af168f2656e4ba1ee1f24dab0ae4e4af77901f2928752bb0434c1f6788133ec599ec8 + languageName: node + linkType: hard + +"@svgr/babel-plugin-replace-jsx-attribute-value@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-replace-jsx-attribute-value@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: b7d2125758e766e1ebd14b92216b800bdc976959bc696dbfa1e28682919147c1df4bb8b1b5fd037d7a83026e27e681fea3b8d3741af8d3cf4c9dfa3d412125df + languageName: node + linkType: hard + +"@svgr/babel-plugin-svg-dynamic-title@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-svg-dynamic-title@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 0fd42ebf127ae9163ef341e84972daa99bdcb9e6ed3f83aabd95ee173fddc43e40e02fa847fbc0a1058cf5549f72b7960a2c5e22c3e4ac18f7e3ac81277852ae + languageName: node + linkType: hard + +"@svgr/babel-plugin-svg-em-dimensions@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-svg-em-dimensions@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: c1550ee9f548526fa66fd171e3ffb5696bfc4e4cd108a631d39db492c7410dc10bba4eb5a190e9df824bf806130ccc586ae7d2e43c547e6a4f93bbb29a18f344 + languageName: node + linkType: hard + +"@svgr/babel-plugin-transform-react-native-svg@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-transform-react-native-svg@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 4c924af22b948b812629e80efb90ad1ec8faae26a232d8ca8a06b46b53e966a2c415a57806a3ff0ea806a622612e546422719b69ec6839717a7755dac19171d9 + languageName: node + linkType: hard + +"@svgr/babel-plugin-transform-svg-component@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-plugin-transform-svg-component@npm:6.5.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: e496bb5ee871feb6bcab250b6e067322da7dd5c9c2b530b41e5586fe090f86611339b49d0a909c334d9b24cbca0fa755c949a2526c6ad03c6b5885666874cf5f + languageName: node + linkType: hard + +"@svgr/babel-preset@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/babel-preset@npm:6.5.1" + dependencies: + "@svgr/babel-plugin-add-jsx-attribute": ^6.5.1 + "@svgr/babel-plugin-remove-jsx-attribute": "*" + "@svgr/babel-plugin-remove-jsx-empty-expression": "*" + "@svgr/babel-plugin-replace-jsx-attribute-value": ^6.5.1 + "@svgr/babel-plugin-svg-dynamic-title": ^6.5.1 + "@svgr/babel-plugin-svg-em-dimensions": ^6.5.1 + "@svgr/babel-plugin-transform-react-native-svg": ^6.5.1 + "@svgr/babel-plugin-transform-svg-component": ^6.5.1 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 9f124be39a8e64f909162f925b3a63ddaa5a342a5e24fc0b7f7d9d4d7f7e3b916596c754fb557dc259928399cad5366a27cb231627a0d2dcc4b13ac521cf05af + languageName: node + linkType: hard + +"@svgr/core@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/core@npm:6.5.1" + dependencies: + "@babel/core": ^7.19.6 + "@svgr/babel-preset": ^6.5.1 + "@svgr/plugin-jsx": ^6.5.1 + camelcase: ^6.2.0 + cosmiconfig: ^7.0.1 + checksum: fd6d6d5da5aeb956703310480b626c1fb3e3973ad9fe8025efc1dcf3d895f857b70d100c63cf32cebb20eb83c9607bafa464c9436e18fe6fe4fafdc73ed6b1a5 + languageName: node + linkType: hard + +"@svgr/hast-util-to-babel-ast@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/hast-util-to-babel-ast@npm:6.5.1" + dependencies: + "@babel/types": ^7.20.0 + entities: ^4.4.0 + checksum: 37923cce1b3f4e2039077b0c570b6edbabe37d1cf1a6ee35e71e0fe00f9cffac450eec45e9720b1010418131a999cb0047331ba1b6d1d2c69af1b92ac785aacf + languageName: node + linkType: hard + +"@svgr/plugin-jsx@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/plugin-jsx@npm:6.5.1" + dependencies: + "@babel/core": ^7.19.6 + "@svgr/babel-preset": ^6.5.1 + "@svgr/hast-util-to-babel-ast": ^6.5.1 + svg-parser: ^2.0.4 + peerDependencies: + "@svgr/core": ^6.0.0 + checksum: 42f22847a6bdf930514d7bedd3c5e1fd8d53eb3594779f9db16cb94c762425907c375cd8ec789114e100a4d38068aca6c7ab5efea4c612fba63f0630c44cc859 + languageName: node + linkType: hard + +"@svgr/plugin-svgo@npm:^6.5.1": + version: 6.5.1 + resolution: "@svgr/plugin-svgo@npm:6.5.1" + dependencies: + cosmiconfig: ^7.0.1 + deepmerge: ^4.2.2 + svgo: ^2.8.0 + peerDependencies: + "@svgr/core": "*" + checksum: cd2833530ac0485221adc2146fd992ab20d79f4b12eebcd45fa859721dd779483158e11dfd9a534858fe468416b9412416e25cbe07ac7932c44ed5fa2021c72e + languageName: node + linkType: hard + +"@svgr/webpack@npm:^6.2.1": + version: 6.5.1 + resolution: "@svgr/webpack@npm:6.5.1" + dependencies: + "@babel/core": ^7.19.6 + "@babel/plugin-transform-react-constant-elements": ^7.18.12 + "@babel/preset-env": ^7.19.4 + "@babel/preset-react": ^7.18.6 + "@babel/preset-typescript": ^7.18.6 + "@svgr/core": ^6.5.1 + "@svgr/plugin-jsx": ^6.5.1 + "@svgr/plugin-svgo": ^6.5.1 + checksum: d10582eb4fa82a5b6d314cb49f2c640af4fd3a60f5b76095d2b14e383ef6a43a6f4674b68774a21787dbde69dec0a251cfcfc3f9a96c82754ba5d5c6daf785f0 + languageName: node + linkType: hard + +"@szmarczak/http-timer@npm:^1.1.2": + version: 1.1.2 + resolution: "@szmarczak/http-timer@npm:1.1.2" + dependencies: + defer-to-connect: ^1.0.1 + checksum: 4d9158061c5f397c57b4988cde33a163244e4f02df16364f103971957a32886beb104d6180902cbe8b38cb940e234d9f98a4e486200deca621923f62f50a06fe + languageName: node + linkType: hard + +"@tootallnate/once@npm:2": + version: 2.0.0 + resolution: "@tootallnate/once@npm:2.0.0" + checksum: ad87447820dd3f24825d2d947ebc03072b20a42bfc96cbafec16bff8bbda6c1a81fcb0be56d5b21968560c5359a0af4038a68ba150c3e1694fe4c109a063bed8 + languageName: node + linkType: hard + +"@trysound/sax@npm:0.2.0": + version: 0.2.0 + resolution: "@trysound/sax@npm:0.2.0" + checksum: 11226c39b52b391719a2a92e10183e4260d9651f86edced166da1d95f39a0a1eaa470e44d14ac685ccd6d3df7e2002433782872c0feeb260d61e80f21250e65c + languageName: node + linkType: hard + +"@tsconfig/node10@npm:^1.0.7": + version: 1.0.9 + resolution: "@tsconfig/node10@npm:1.0.9" + checksum: a33ae4dc2a621c0678ac8ac4bceb8e512ae75dac65417a2ad9b022d9b5411e863c4c198b6ba9ef659e14b9fb609bbec680841a2e84c1172df7a5ffcf076539df + languageName: node + linkType: hard + +"@tsconfig/node12@npm:^1.0.7": + version: 1.0.11 + resolution: "@tsconfig/node12@npm:1.0.11" + checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a + languageName: node + linkType: hard + +"@tsconfig/node14@npm:^1.0.0": + version: 1.0.3 + resolution: "@tsconfig/node14@npm:1.0.3" + checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d + languageName: node + linkType: hard + +"@tsconfig/node16@npm:^1.0.2": + version: 1.0.4 + resolution: "@tsconfig/node16@npm:1.0.4" + checksum: 202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff + languageName: node + linkType: hard + +"@types/accepts@npm:*": + version: 1.3.5 + resolution: "@types/accepts@npm:1.3.5" + dependencies: + "@types/node": "*" + checksum: 590b7580570534a640510c071e09074cf63b5958b237a728f94322567350aea4d239f8a9d897a12b15c856b992ee4d7907e9812bb079886af2c00714e7fb3f60 + languageName: node + linkType: hard + +"@types/babel__code-frame@npm:^7.0.2": + version: 7.0.4 + resolution: "@types/babel__code-frame@npm:7.0.4" + checksum: eb4adb0a79c5cbf2d88ad087b2694a1e38749dc0056693e6125c17a3967fc8d4cc1eb33eab26d3dcaaa8995236cba4a088965cc3a115967545f2a01ee430c87f + languageName: node + linkType: hard + +"@types/bn.js@npm:^4.11.3": + version: 4.11.6 + resolution: "@types/bn.js@npm:4.11.6" + dependencies: + "@types/node": "*" + checksum: 7f66f2c7b7b9303b3205a57184261974b114495736b77853af5b18d857c0b33e82ce7146911e86e87a87837de8acae28986716fd381ac7c301fd6e8d8b6c811f + languageName: node + linkType: hard + +"@types/bn.js@npm:^5.1.0": + version: 5.1.2 + resolution: "@types/bn.js@npm:5.1.2" + dependencies: + "@types/node": "*" + checksum: 8d9fdb43836646c2ecd445041de03e057f9b459885be57faee64104160487a63730b9f371e8ad7d33f360b3cc6dc0e323543962fc5fa296b92b322b946732be0 + languageName: node + linkType: hard + +"@types/body-parser@npm:*": + version: 1.19.3 + resolution: "@types/body-parser@npm:1.19.3" + dependencies: + "@types/connect": "*" + "@types/node": "*" + checksum: 932fa71437c275023799123680ef26ffd90efd37f51a1abe405e6ae6e5b4ad9511b7a3a8f5a12877ed1444a02b6286c0a137a98e914b3c61932390c83643cc2c + languageName: node + linkType: hard + +"@types/bonjour@npm:^3.5.9": + version: 3.5.11 + resolution: "@types/bonjour@npm:3.5.11" + dependencies: + "@types/node": "*" + checksum: 12fb86a1bb4a610f16ef6d7d68f85e7c31070029f02b6622073794a271e75abcf58230ed205a2ae23c53be2c08b9e507d3b91fa0dc9dfe76c4b1f5e19e9370cb + languageName: node + linkType: hard + +"@types/chai-as-promised@npm:^7.1.3": + version: 7.1.6 + resolution: "@types/chai-as-promised@npm:7.1.6" + dependencies: + "@types/chai": "*" + checksum: f765dd249ae9384540f8e6402bd3a9f5e87b97f9078ef58f4b5ec15f7c3673e1f10f0089f819eceb20e00b3df40b7aae1bd44d2b8f4edbbedfcb33ce296f6791 + languageName: node + linkType: hard + +"@types/chai@npm:*, @types/chai@npm:^4, @types/chai@npm:^4.2.12": + version: 4.3.6 + resolution: "@types/chai@npm:4.3.6" + checksum: 32a6c18bf53fb3dbd89d1bfcadb1c6fd45cc0007c34e436393cc37a0a5a556f9e6a21d1e8dd71674c40cc36589d2f30bf4d9369d7787021e54d6e997b0d7300a + languageName: node + linkType: hard + +"@types/co-body@npm:^6.1.0": + version: 6.1.1 + resolution: "@types/co-body@npm:6.1.1" + dependencies: + "@types/node": "*" + "@types/qs": "*" + checksum: 38a5198c712bfb40f36c7c5fd85964cabfdac0d0aa4d703993c205ccafa113995b67846e59d5d05415dcba230e21126060e04c1287d8073fc2dc71257cb2ea0c + languageName: node + linkType: hard + +"@types/command-line-args@npm:^5.0.0": + version: 5.2.1 + resolution: "@types/command-line-args@npm:5.2.1" + checksum: a5df8562a7a0eb7c4da218661360ff8369a63c0fd783310d1940f0ece55826d5173eeb3732bab48dbfb60b1614d61989a9d87c6cdbee04353c4df6f45387d417 + languageName: node + linkType: hard + +"@types/connect-history-api-fallback@npm:^1.3.5": + version: 1.5.1 + resolution: "@types/connect-history-api-fallback@npm:1.5.1" + dependencies: + "@types/express-serve-static-core": "*" + "@types/node": "*" + checksum: bc5e46663300eba56eaf8ef242156256e2bdadc52bb7d6543f4b37f2945b6a810901c245711f8321fce7d94c7b588b308a86519f3e1f87a80eb87841d808dbdc + languageName: node + linkType: hard + +"@types/connect@npm:*": + version: 3.4.36 + resolution: "@types/connect@npm:3.4.36" + dependencies: + "@types/node": "*" + checksum: 4dee3d966fb527b98f0cbbdcf6977c9193fc3204ed539b7522fe5e64dfa45f9017bdda4ffb1f760062262fce7701a0ee1c2f6ce2e50af36c74d4e37052303172 + languageName: node + linkType: hard + +"@types/content-disposition@npm:*": + version: 0.5.6 + resolution: "@types/content-disposition@npm:0.5.6" + checksum: da07798d52cc8fc46a8843d768b48d54c70f1a44c861dc2c73c4c25a1e08af859709629ab0e4d23d5198107b8926bb48c593df436ba68123d87191f5e25fe4bc + languageName: node + linkType: hard + +"@types/convert-source-map@npm:^2.0.0": + version: 2.0.1 + resolution: "@types/convert-source-map@npm:2.0.1" + checksum: 200b2792b37748e89e4363ef07686b074f64e21a26f27381d51bc336222a85503cfa1266e29d3b9c9121c8156e0a3973f3adbe2f4be59516fa255c080b4ca976 + languageName: node + linkType: hard + +"@types/cookies@npm:*": + version: 0.7.8 + resolution: "@types/cookies@npm:0.7.8" + dependencies: + "@types/connect": "*" + "@types/express": "*" + "@types/keygrip": "*" + "@types/node": "*" + checksum: 7945b0cfe370bf1f05a1f328c9eba55333dac1bb9d7efa3148b107c260ab924263546351f9fd168daa72948d195464d395319a24477995f9f887a3a99fbcb5b5 + languageName: node + linkType: hard + +"@types/debounce@npm:^1.2.0": + version: 1.2.1 + resolution: "@types/debounce@npm:1.2.1" + checksum: bea6d414acefbee50adfe87cee10f8a855d033e4778567ab03bdc3cb2648b6bf9237ca53f4ee76fe4be75f77f86d4688411499626fe409bc870f53631d24231f + languageName: node + linkType: hard + +"@types/eslint-scope@npm:^3.7.3": + version: 3.7.5 + resolution: "@types/eslint-scope@npm:3.7.5" + dependencies: + "@types/eslint": "*" + "@types/estree": "*" + checksum: e91ce335c3791c2cf6084caa0073f90d5b7ae3fcf27785ade8422b7d896159fa14a5a3f1efd31ef03e9ebc1ff04983288280dfe8c9a5579a958539f59df8cc9f + languageName: node + linkType: hard + +"@types/eslint@npm:*": + version: 8.44.4 + resolution: "@types/eslint@npm:8.44.4" + dependencies: + "@types/estree": "*" + "@types/json-schema": "*" + checksum: 15bafdaba800e2995f38d3a2a929d8e9303035315e8d3535523a21cd719b6769a45884afa955f0b845ffa545a4150429b0178e2c44feeedf59ebb285eeae9825 + languageName: node + linkType: hard + +"@types/estree@npm:*, @types/estree@npm:^1.0.0": + version: 1.0.2 + resolution: "@types/estree@npm:1.0.2" + checksum: aeedb1b2fe20cbe06f44b99b562bf9703e360bfcdf5bb3d61d248182ee1dd63500f2474e12f098ffe1f5ac3202b43b3e18ec99902d9328d5374f5512fa077e45 + languageName: node + linkType: hard + +"@types/estree@npm:0.0.39": + version: 0.0.39 + resolution: "@types/estree@npm:0.0.39" + checksum: 412fb5b9868f2c418126451821833414189b75cc6bf84361156feed733e3d92ec220b9d74a89e52722e03d5e241b2932732711b7497374a404fad49087adc248 + languageName: node + linkType: hard + +"@types/express-serve-static-core@npm:*": + version: 4.17.37 + resolution: "@types/express-serve-static-core@npm:4.17.37" + dependencies: + "@types/node": "*" + "@types/qs": "*" + "@types/range-parser": "*" + "@types/send": "*" + checksum: 2dab1380e45eb44e56ecc1be1c42c4b897364d2f2a08e03ca28fbcb1e6866e390217385435813711c046f9acd684424d088855dc32825d5cbecf72c60ecd037f + languageName: node + linkType: hard + +"@types/express-serve-static-core@npm:^4.17.33": + version: 4.17.36 + resolution: "@types/express-serve-static-core@npm:4.17.36" + dependencies: + "@types/node": "*" + "@types/qs": "*" + "@types/range-parser": "*" + "@types/send": "*" + checksum: 410b13cbd663f18c0f8729e7f2ff54d960d96de76ebbae7cadb612972f85cc66c54051e00d32f11aa230c0a683d81a6d6fc7f7e4e383a95c0801494c517f36e1 + languageName: node + linkType: hard + +"@types/express@npm:*": + version: 4.17.17 + resolution: "@types/express@npm:4.17.17" + dependencies: + "@types/body-parser": "*" + "@types/express-serve-static-core": ^4.17.33 + "@types/qs": "*" + "@types/serve-static": "*" + checksum: 0196dacc275ac3ce89d7364885cb08e7fb61f53ca101f65886dbf1daf9b7eb05c0943e2e4bbd01b0cc5e50f37e0eea7e4cbe97d0304094411ac73e1b7998f4da + languageName: node + linkType: hard + +"@types/express@npm:^4.17.13": + version: 4.17.19 + resolution: "@types/express@npm:4.17.19" + dependencies: + "@types/body-parser": "*" + "@types/express-serve-static-core": ^4.17.33 + "@types/qs": "*" + "@types/serve-static": "*" + checksum: 3d39d0655eb0825d96fec100985a38737767ddd6da2dbda1e330a3adf36c98a9b7cd8d9539db32876d1fbb47a09343cad7b38c30c8dd7c291271fcb9b85cb21b + languageName: node + linkType: hard + +"@types/fs-extra@npm:^9.0.13": + version: 9.0.13 + resolution: "@types/fs-extra@npm:9.0.13" + dependencies: + "@types/node": "*" + checksum: add79e212acd5ac76b97b9045834e03a7996aef60a814185e0459088fd290519a3c1620865d588fa36c4498bf614210d2a703af5cf80aa1dbc125db78f6edac3 + languageName: node + linkType: hard + +"@types/hast@npm:^2.0.0": + version: 2.3.6 + resolution: "@types/hast@npm:2.3.6" + dependencies: + "@types/unist": ^2 + checksum: c004372f6ab919ec92a2de43e4380707e27b76fe371c7d06ab26547c1e851dfba2a7c740c544218df8c7e0a94443458793c43730ad563a39e3fdc1a48904d7f5 + languageName: node + linkType: hard + +"@types/history@npm:^4.7.11": + version: 4.7.11 + resolution: "@types/history@npm:4.7.11" + checksum: c92e2ba407dcab0581a9afdf98f533aa41b61a71133420a6d92b1ca9839f741ab1f9395b17454ba5b88cb86020b70b22d74a1950ccfbdfd9beeaa5459fdc3464 + languageName: node + linkType: hard + +"@types/html-minifier-terser@npm:^6.0.0": + version: 6.1.0 + resolution: "@types/html-minifier-terser@npm:6.1.0" + checksum: eb843f6a8d662d44fb18ec61041117734c6aae77aa38df1be3b4712e8e50ffaa35f1e1c92fdd0fde14a5675fecf457abcd0d15a01fae7506c91926176967f452 + languageName: node + linkType: hard + +"@types/http-assert@npm:*": + version: 1.5.3 + resolution: "@types/http-assert@npm:1.5.3" + checksum: 9553e5a0b8bcfdac4b51d3fa3b89a91b5450171861a667a5b4c47204e0f4a1ca865d97396e6ceaf220e87b64d06b7a8bad7bfba15ef97acb41a87507c9940dbc + languageName: node + linkType: hard + +"@types/http-errors@npm:*": + version: 2.0.2 + resolution: "@types/http-errors@npm:2.0.2" + checksum: d7f14045240ac4b563725130942b8e5c8080bfabc724c8ff3f166ea928ff7ae02c5194763bc8f6aaf21897e8a44049b0492493b9de3e058247e58fdfe0f86692 + languageName: node + linkType: hard + +"@types/http-proxy@npm:^1.17.8": + version: 1.17.12 + resolution: "@types/http-proxy@npm:1.17.12" + dependencies: + "@types/node": "*" + checksum: 89700c8e3c8f2c59c87c8db8e7a070c97a3b30a4a38223aca6b8b817e6f2ca931f5a500e16ecadc1ebcfed2676cc60e073d8f887e621d84420298728ec6fd000 + languageName: node + linkType: hard + +"@types/istanbul-lib-coverage@npm:*, @types/istanbul-lib-coverage@npm:^2.0.0, @types/istanbul-lib-coverage@npm:^2.0.1, @types/istanbul-lib-coverage@npm:^2.0.3": + version: 2.0.4 + resolution: "@types/istanbul-lib-coverage@npm:2.0.4" + checksum: a25d7589ee65c94d31464c16b72a9dc81dfa0bea9d3e105ae03882d616e2a0712a9c101a599ec482d297c3591e16336962878cb3eb1a0a62d5b76d277a890ce7 + languageName: node + linkType: hard + +"@types/istanbul-lib-report@npm:*": + version: 3.0.0 + resolution: "@types/istanbul-lib-report@npm:3.0.0" + dependencies: + "@types/istanbul-lib-coverage": "*" + checksum: 656398b62dc288e1b5226f8880af98087233cdb90100655c989a09f3052b5775bf98ba58a16c5ae642fb66c61aba402e07a9f2bff1d1569e3b306026c59f3f36 + languageName: node + linkType: hard + +"@types/istanbul-reports@npm:^3.0.0": + version: 3.0.1 + resolution: "@types/istanbul-reports@npm:3.0.1" + dependencies: + "@types/istanbul-lib-report": "*" + checksum: f1ad54bc68f37f60b30c7915886b92f86b847033e597f9b34f2415acdbe5ed742fa559a0a40050d74cdba3b6a63c342cac1f3a64dba5b68b66a6941f4abd7903 + languageName: node + linkType: hard + +"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": + version: 7.0.13 + resolution: "@types/json-schema@npm:7.0.13" + checksum: 345df21a678fa72fb389f35f33de77833d09d4a142bb2bcb27c18690efa4cf70fc2876e43843cefb3fbdb9fcb12cd3e970a90936df30f53bbee899865ff605ab + languageName: node + linkType: hard + +"@types/katex@npm:^0.11.0": + version: 0.11.1 + resolution: "@types/katex@npm:0.11.1" + checksum: 1e51988b4b386a1b6fa8e22826ab4705bf3e6c9fb03461f2c91d28cb31095232bdeff491069ac9bc74bc4c26110be6a11a41e12ca77a2e4169f3afd8cd349355 + languageName: node + linkType: hard + +"@types/keygrip@npm:*": + version: 1.0.3 + resolution: "@types/keygrip@npm:1.0.3" + checksum: adee9a3efda3db9c64466af1c7c91a6d049420ee50589500cfd36e3e38d6abefdd858da88e6da63ed186e588127af3e862c1dc64fb0ad45c91870e6c35fe3be0 + languageName: node + linkType: hard + +"@types/keyv@npm:^3.1.1": + version: 3.1.4 + resolution: "@types/keyv@npm:3.1.4" + dependencies: + "@types/node": "*" + checksum: e009a2bfb50e90ca9b7c6e8f648f8464067271fd99116f881073fa6fa76dc8d0133181dd65e6614d5fb1220d671d67b0124aef7d97dc02d7e342ab143a47779d + languageName: node + linkType: hard + +"@types/koa-compose@npm:*": + version: 3.2.6 + resolution: "@types/koa-compose@npm:3.2.6" + dependencies: + "@types/koa": "*" + checksum: 1204c5bfa4c69448b692aba29c566ef6bedbdbe5842fa180450267a23d3606faa13ef209876fd0c989edb5bc381812a66610fcfeac196ce4e76364354756ba1f + languageName: node + linkType: hard + +"@types/koa@npm:*, @types/koa@npm:^2.11.6": + version: 2.13.9 + resolution: "@types/koa@npm:2.13.9" + dependencies: + "@types/accepts": "*" + "@types/content-disposition": "*" + "@types/cookies": "*" + "@types/http-assert": "*" + "@types/http-errors": "*" + "@types/keygrip": "*" + "@types/koa-compose": "*" + "@types/node": "*" + checksum: af9cd599c8e17e2ae0f4168a61d964e343f713d002b65fd995658d7addc6551ccadecfd32b3405cf44e4d360178ee4f972d6881533548261ae1f636a655d24b1 + languageName: node + linkType: hard + +"@types/lodash@npm:^4": + version: 4.14.200 + resolution: "@types/lodash@npm:4.14.200" + checksum: 6471f8bb5da692a6ecf03a8da4935bfbc341e67ee9bcb4f5730bfacff0c367232548f0a01e8ac5ea18c6fe78fb085d502494e33ccb47a7ee87cbdee03b47d00d + languageName: node + linkType: hard + +"@types/lru-cache@npm:^5.1.0": + version: 5.1.1 + resolution: "@types/lru-cache@npm:5.1.1" + checksum: e1d6c0085f61b16ec5b3073ec76ad1be4844ea036561c3f145fc19f71f084b58a6eb600b14128aa95809d057d28f1d147c910186ae51219f58366ffd2ff2e118 + languageName: node + linkType: hard + +"@types/mdast@npm:^3.0.0": + version: 3.0.13 + resolution: "@types/mdast@npm:3.0.13" + dependencies: + "@types/unist": ^2 + checksum: f13fa17a2931ed1492a2f0012a3abd6de3a2d1128145981321909e03fedba80162668f284a4af92aca3732b27e933c5f4772336d96b9ae660bfde696d07abbe6 + languageName: node + linkType: hard + +"@types/mime@npm:*": + version: 3.0.1 + resolution: "@types/mime@npm:3.0.1" + checksum: 4040fac73fd0cea2460e29b348c1a6173da747f3a87da0dbce80dd7a9355a3d0e51d6d9a401654f3e5550620e3718b5a899b2ec1debf18424e298a2c605346e7 + languageName: node + linkType: hard + +"@types/mime@npm:^1": + version: 1.3.2 + resolution: "@types/mime@npm:1.3.2" + checksum: 0493368244cced1a69cb791b485a260a422e6fcc857782e1178d1e6f219f1b161793e9f87f5fae1b219af0f50bee24fcbe733a18b4be8fdd07a38a8fb91146fd + languageName: node + linkType: hard + +"@types/minimist@npm:^1.2.2": + version: 1.2.2 + resolution: "@types/minimist@npm:1.2.2" + checksum: b8da83c66eb4aac0440e64674b19564d9d86c80ae273144db9681e5eeff66f238ade9515f5006ffbfa955ceff8b89ad2bd8ec577d7caee74ba101431fb07045d + languageName: node + linkType: hard + +"@types/mocha@npm:^10.0.1": + version: 10.0.1 + resolution: "@types/mocha@npm:10.0.1" + checksum: 224ea9fce7b1734ccdb9aa99a622d902a538ce1847bca7fd22c5fb38adcf3ed536f50f48f587085db988a4bb3c2eb68f4b98e1cd6a38bc5547bd3bbbedc54495 + languageName: node + linkType: hard + +"@types/mocha@npm:^8.2.0": + version: 8.2.3 + resolution: "@types/mocha@npm:8.2.3" + checksum: b43ed1b642a2ee62bf10792a07d5d21d66ab8b4d2cf5d822c8a7643e77b90009aecc000eefab5f6ddc9eb69004192f84119a6f97a8499e1a13ea082e7a5e71bf + languageName: node + linkType: hard + +"@types/node@npm:*, @types/node@npm:^20.5.7, @types/node@npm:^20.6.2": + version: 20.6.3 + resolution: "@types/node@npm:20.6.3" + checksum: 444a6f1f41cfa8d3e20ce0108e6e43960fb2ae0e481f233bb1c14d6252aa63a92e021de561cd317d9fdb411688f871065f40175a1f18763282dee2613a08f8a3 + languageName: node + linkType: hard + +"@types/node@npm:18.15.13": + version: 18.15.13 + resolution: "@types/node@npm:18.15.13" + checksum: 79cc5a2b5f98e8973061a4260a781425efd39161a0e117a69cd089603964816c1a14025e1387b4590c8e82d05133b7b4154fa53a7dffb3877890a66145e76515 + languageName: node + linkType: hard + +"@types/node@npm:^17.0.5": + version: 17.0.45 + resolution: "@types/node@npm:17.0.45" + checksum: aa04366b9103b7d6cfd6b2ef64182e0eaa7d4462c3f817618486ea0422984c51fc69fd0d436eae6c9e696ddfdbec9ccaa27a917f7c2e8c75c5d57827fe3d95e8 + languageName: node + linkType: hard + +"@types/node@npm:^18.7.20": + version: 18.17.18 + resolution: "@types/node@npm:18.17.18" + checksum: 59cbd906363d37017fe9ba0c08c1446e440d4d977459609c5f90b8fb7eb41f273ce8af30c5a5b5d599d7de934c1b3702bc9fc27caf8d2270e5cdb659c5232991 + languageName: node + linkType: hard + +"@types/parse-json@npm:^4.0.0": + version: 4.0.0 + resolution: "@types/parse-json@npm:4.0.0" + checksum: fd6bce2b674b6efc3db4c7c3d336bd70c90838e8439de639b909ce22f3720d21344f52427f1d9e57b265fcb7f6c018699b99e5e0c208a1a4823014269a6bf35b + languageName: node + linkType: hard + +"@types/parse5@npm:^5.0.0": + version: 5.0.3 + resolution: "@types/parse5@npm:5.0.3" + checksum: d6b7495cb1850f9f2e9c5e103ede9f2d30a5320669707b105c403868adc9e4bf8d3a7ff314cc23f67826bbbbbc0e6147346ce9062ab429f099dba7a01f463919 + languageName: node + linkType: hard + +"@types/parse5@npm:^6.0.1": + version: 6.0.3 + resolution: "@types/parse5@npm:6.0.3" + checksum: ddb59ee4144af5dfcc508a8dcf32f37879d11e12559561e65788756b95b33e6f03ea027d88e1f5408f9b7bfb656bf630ace31a2169edf44151daaf8dd58df1b7 + languageName: node + linkType: hard + +"@types/pbkdf2@npm:^3.0.0": + version: 3.1.0 + resolution: "@types/pbkdf2@npm:3.1.0" + dependencies: + "@types/node": "*" + checksum: d15024b1957c21cf3b8887329d9bd8dfde754cf13a09d76ae25f1391cfc62bb8b8d7b760773c5dbaa748172fba8b3e0c3dbe962af6ccbd69b76df12a48dfba40 + languageName: node + linkType: hard + +"@types/prettier@npm:^3": + version: 3.0.0 + resolution: "@types/prettier@npm:3.0.0" + dependencies: + prettier: "*" + checksum: a2a512d304e5bcf78f38089dc88ad19215e6ab871d435a17aef3ce538a63b07c0e359c18db23989dc1ed9fff96d99eee1f680416080184df5c7e0e3bf767e165 + languageName: node + linkType: hard + +"@types/prop-types@npm:*": + version: 15.7.8 + resolution: "@types/prop-types@npm:15.7.8" + checksum: 61dfad79da8b1081c450bab83b77935df487ae1cdd4660ec7df6be8e74725c15fa45cf486ce057addc956ca4ae78300b97091e2a25061133d1b9a1440bc896ae + languageName: node + linkType: hard + +"@types/ps-tree@npm:^1.1.2": + version: 1.1.2 + resolution: "@types/ps-tree@npm:1.1.2" + checksum: 575c3b2b83ea8935ab296ac9e17f6a2c1a5bb155f9e30663bb7a7c741a8ca4641f0df9748866230f1d6c3f87ed4ffa3fa91f1df444ef9979a3df31114534bf25 + languageName: node + linkType: hard + +"@types/qs@npm:*": + version: 6.9.8 + resolution: "@types/qs@npm:6.9.8" + checksum: c28e07d00d07970e5134c6eed184a0189b8a4649e28fdf36d9117fe671c067a44820890de6bdecef18217647a95e9c6aebdaaae69f5fe4b0bec9345db885f77e + languageName: node + linkType: hard + +"@types/range-parser@npm:*": + version: 1.2.4 + resolution: "@types/range-parser@npm:1.2.4" + checksum: b7c0dfd5080a989d6c8bb0b6750fc0933d9acabeb476da6fe71d8bdf1ab65e37c136169d84148034802f48378ab94e3c37bb4ef7656b2bec2cb9c0f8d4146a95 + languageName: node + linkType: hard + +"@types/react-router-config@npm:*, @types/react-router-config@npm:^5.0.6": + version: 5.0.8 + resolution: "@types/react-router-config@npm:5.0.8" + dependencies: + "@types/history": ^4.7.11 + "@types/react": "*" + "@types/react-router": ^5.1.0 + checksum: afbd96e526fcdd19a3c8604912496a5a7ecfdcd848632a003ef8af69701ca74f14451e4fac93d265b678ca07c82ec4a103126f64c040a4aefa1a8172619be2bd + languageName: node + linkType: hard + +"@types/react-router-dom@npm:*": + version: 5.3.3 + resolution: "@types/react-router-dom@npm:5.3.3" + dependencies: + "@types/history": ^4.7.11 + "@types/react": "*" + "@types/react-router": "*" + checksum: 28c4ea48909803c414bf5a08502acbb8ba414669b4b43bb51297c05fe5addc4df0b8fd00e0a9d1e3535ec4073ef38aaafac2c4a2b95b787167d113bc059beff3 + languageName: node + linkType: hard + +"@types/react-router@npm:*, @types/react-router@npm:^5.1.0": + version: 5.1.20 + resolution: "@types/react-router@npm:5.1.20" + dependencies: + "@types/history": ^4.7.11 + "@types/react": "*" + checksum: 128764143473a5e9457ddc715436b5d49814b1c214dde48939b9bef23f0e77f52ffcdfa97eb8d3cc27e2c229869c0cdd90f637d887b62f2c9f065a87d6425419 + languageName: node + linkType: hard + +"@types/react@npm:*": + version: 18.2.28 + resolution: "@types/react@npm:18.2.28" + dependencies: + "@types/prop-types": "*" + "@types/scheduler": "*" + csstype: ^3.0.2 + checksum: 81381bedeba83278f4c9febb0b83e0bd3f42a25897a50b9cb36ef53651d34b3d50f87ebf11211ea57ea575131f85d31e93e496ce46478a00b0f9bf7b26b5917a + languageName: node + linkType: hard + +"@types/readable-stream@npm:^2.3.13": + version: 2.3.15 + resolution: "@types/readable-stream@npm:2.3.15" + dependencies: + "@types/node": "*" + safe-buffer: ~5.1.1 + checksum: ec36f525cad09b6c65a1dafcb5ad99b9e2ed824ec49b7aa23180ac427e5d35b8a0706193ecd79ab4253a283ad485ba03d5917a98daaaa144f0ea34f4823e9d82 + languageName: node + linkType: hard + +"@types/resolve@npm:1.17.1": + version: 1.17.1 + resolution: "@types/resolve@npm:1.17.1" + dependencies: + "@types/node": "*" + checksum: dc6a6df507656004e242dcb02c784479deca516d5f4b58a1707e708022b269ae147e1da0521f3e8ad0d63638869d87e0adc023f0bd5454aa6f72ac66c7525cf5 + languageName: node + linkType: hard + +"@types/responselike@npm:^1.0.0": + version: 1.0.1 + resolution: "@types/responselike@npm:1.0.1" + dependencies: + "@types/node": "*" + checksum: ae8c36c9354aaedfa462dab655aa17613529d545a418acc54ba0214145fc1d0454be2ae107031a1b2c24768f19f2af7e4096a85d1e604010becd0bec2355cb0e + languageName: node + linkType: hard + +"@types/retry@npm:0.12.0": + version: 0.12.0 + resolution: "@types/retry@npm:0.12.0" + checksum: 61a072c7639f6e8126588bf1eb1ce8835f2cb9c2aba795c4491cf6310e013267b0c8488039857c261c387e9728c1b43205099223f160bb6a76b4374f741b5603 + languageName: node + linkType: hard + +"@types/sax@npm:^1.2.1": + version: 1.2.5 + resolution: "@types/sax@npm:1.2.5" + dependencies: + "@types/node": "*" + checksum: a4bf27d7eb1b99030e75dea01fab2fa3959554f5c463b4f577dbbc9d8ed88a5b26b83ac84d045ae5a53e350057f120574db6e1c4e8507c011299dd023e4fa4f2 + languageName: node + linkType: hard + +"@types/scheduler@npm:*": + version: 0.16.4 + resolution: "@types/scheduler@npm:0.16.4" + checksum: a57b0f10da1b021e6bd5eeef8a1917dd3b08a8715bd8029e2ded2096d8f091bb1bb1fef2d66e139588a983c4bfbad29b59e48011141725fa83c76e986e1257d7 + languageName: node + linkType: hard + +"@types/secp256k1@npm:^4.0.1": + version: 4.0.4 + resolution: "@types/secp256k1@npm:4.0.4" + dependencies: + "@types/node": "*" + checksum: 6f521a08486a98e71c8529f5c3119f99e610196a47243cc6052c6160b216dff2c85dc50a8f3208ed47028dbb470bbb6fdee47a3fdc064687e46021d5a712767c + languageName: node + linkType: hard + +"@types/semver@npm:^7.5.0": + version: 7.5.3 + resolution: "@types/semver@npm:7.5.3" + checksum: 349fdd1ab6c213bac5c991bac766bd07b8b12e63762462bb058740dcd2eb09c8193d068bb226f134661275f2022976214c0e727a4e5eb83ec1b131127c980d3e + languageName: node + linkType: hard + +"@types/send@npm:*": + version: 0.17.1 + resolution: "@types/send@npm:0.17.1" + dependencies: + "@types/mime": ^1 + "@types/node": "*" + checksum: 10b620a5960058ef009afbc17686f680d6486277c62f640845381ec4baa0ea683fdd77c3afea4803daf5fcddd3fb2972c8aa32e078939f1d4e96f83195c89793 + languageName: node + linkType: hard + +"@types/serve-index@npm:^1.9.1": + version: 1.9.2 + resolution: "@types/serve-index@npm:1.9.2" + dependencies: + "@types/express": "*" + checksum: 4fd0a8fcdd6e2b2d7704a539b7c1e0d143e9e00be4c3992394fe2ef7e9b67283d74b43db3f92b0e0717d779aa51184168bbae617d30456357cb95ec58aa59ea8 + languageName: node + linkType: hard + +"@types/serve-static@npm:*": + version: 1.15.2 + resolution: "@types/serve-static@npm:1.15.2" + dependencies: + "@types/http-errors": "*" + "@types/mime": "*" + "@types/node": "*" + checksum: 15c261dbfc57890f7cc17c04d5b22b418dfa0330c912b46c5d8ae2064da5d6f844ef7f41b63c7f4bbf07675e97ebe6ac804b032635ec742ae45d6f1274259b3e + languageName: node + linkType: hard + +"@types/serve-static@npm:^1.13.10": + version: 1.15.3 + resolution: "@types/serve-static@npm:1.15.3" + dependencies: + "@types/http-errors": "*" + "@types/mime": "*" + "@types/node": "*" + checksum: afa52252f0ba94cdb5391e80f23e17fd629bdf2a31be8876e2c4490312ed6b0570822dd7de7cea04c9002049e207709563568b7f4ee10bb9f456321db1e83e40 + languageName: node + linkType: hard + +"@types/sockjs@npm:^0.3.33": + version: 0.3.34 + resolution: "@types/sockjs@npm:0.3.34" + dependencies: + "@types/node": "*" + checksum: 1d38b1976a97f5895a6be00cead1b2a59d842f023b6e35450b7eec8a3131c860c447aba3f7ea3c880c066d8277b0c76fae9d080be1aad475811b568ed6079d49 + languageName: node + linkType: hard + +"@types/unist@npm:^2, @types/unist@npm:^2.0.0, @types/unist@npm:^2.0.2, @types/unist@npm:^2.0.3": + version: 2.0.8 + resolution: "@types/unist@npm:2.0.8" + checksum: f4852d10a6752dc70df363917ef74453e5d2fd42824c0f6d09d19d530618e1402193977b1207366af4415aaec81d4e262c64d00345402020c4ca179216e553c7 + languageName: node + linkType: hard + +"@types/which@npm:^2.0.1": + version: 2.0.2 + resolution: "@types/which@npm:2.0.2" + checksum: 8626a3c2f6db676c449142e1082e33ea0c9d88b8a2bd796366b944891e6da0088b2aa83d3fa9c79e6696f7381a851fc76d43bd353eb6c4d98a7775b4ae0a96a5 + languageName: node + linkType: hard + +"@types/ws@npm:^7.4.0": + version: 7.4.7 + resolution: "@types/ws@npm:7.4.7" + dependencies: + "@types/node": "*" + checksum: b4c9b8ad209620c9b21e78314ce4ff07515c0cadab9af101c1651e7bfb992d7fd933bd8b9c99d110738fd6db523ed15f82f29f50b45510288da72e964dedb1a3 + languageName: node + linkType: hard + +"@types/ws@npm:^8.5.5": + version: 8.5.7 + resolution: "@types/ws@npm:8.5.7" + dependencies: + "@types/node": "*" + checksum: 4502085c0f7ae6b36d5419c0fc6ce4b9002ee5e997a8708d6ed10b393e97091e1b986e8038ec604945c194f14aac150e74d6596629a2775628d122f552009c35 + languageName: node + linkType: hard + +"@types/yargs-parser@npm:*": + version: 21.0.1 + resolution: "@types/yargs-parser@npm:21.0.1" + checksum: 64e6316c2045e2d460c4fb79572f872f9d2f98fddc6d9d3949c71f0b6ad0ef8a2706cf49db26dfb02a9cb81433abb8f340f015e1d20a9692279abe9477b72c8e + languageName: node + linkType: hard + +"@types/yargs@npm:^17.0.8": + version: 17.0.28 + resolution: "@types/yargs@npm:17.0.28" + dependencies: + "@types/yargs-parser": "*" + checksum: f78c5e5c29903933c0557b4ffcd1d0b8564d66859c8ca4aa51da3714e49109ed7c2644334a1918d033df19028f4cecc91fd2e502651bb8e8451f246c371da847 + languageName: node + linkType: hard + +"@types/yauzl@npm:^2.9.1": + version: 2.10.0 + resolution: "@types/yauzl@npm:2.10.0" + dependencies: + "@types/node": "*" + checksum: 55d27ae5d346ea260e40121675c24e112ef0247649073848e5d4e03182713ae4ec8142b98f61a1c6cbe7d3b72fa99bbadb65d8b01873e5e605cdc30f1ff70ef2 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/eslint-plugin@npm:6.7.3" + dependencies: + "@eslint-community/regexpp": ^4.5.1 + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/type-utils": 6.7.3 + "@typescript-eslint/utils": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 + debug: ^4.3.4 + graphemer: ^1.4.0 + ignore: ^5.2.4 + natural-compare: ^1.4.0 + semver: ^7.5.4 + ts-api-utils: ^1.0.1 + peerDependencies: + "@typescript-eslint/parser": ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: ac2790882199047abc59c0407a862f3339645623d03ea0aae5a73fd4bac6abfb753afcf9f23fd51cd1d5aa73f132ef94e2850774c4b2a3d99ebb83030b09429c + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:^6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/parser@npm:6.7.3" + dependencies: + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/typescript-estree": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 + debug: ^4.3.4 + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 658f3294b281db06ebb46884b92172d45eb402ec25c7d4a09cc2461eee359266029af7a49eb9006ee7c3e0003ba53a06f4bee84aa2e99d2d9a3507b9c84ff775 + languageName: node + linkType: hard + +"@typescript-eslint/scope-manager@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/scope-manager@npm:6.7.3" + dependencies: + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 + checksum: 08215444b7c70af5c45e185ba3c31c550a0a671ab464a67058cbee680c94aa9d1a062958976d8b09f7bcabf2f63114cdc7be2e4e32e2dfdcb2d7cc79961b7b32 + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/type-utils@npm:6.7.3" + dependencies: + "@typescript-eslint/typescript-estree": 6.7.3 + "@typescript-eslint/utils": 6.7.3 + debug: ^4.3.4 + ts-api-utils: ^1.0.1 + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: f30a5ab4f88f76457810d72e3ada79fefd94dbbb456069ac004bd7601c9b7f15689b906b66cd849c230f30ae65f6f7039fb169609177ab545b34bacab64f015e + languageName: node + linkType: hard + +"@typescript-eslint/types@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/types@npm:6.7.3" + checksum: 4adb6177ec710e7438610fee553839a7abecc498dbb36d0170786bab66c5e5415cd720ac06419fd905458ad88c39b661603af5f013adc299137ccb4c51c4c879 + languageName: node + linkType: hard + +"@typescript-eslint/typescript-estree@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/typescript-estree@npm:6.7.3" + dependencies: + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/visitor-keys": 6.7.3 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.5.4 + ts-api-utils: ^1.0.1 + peerDependenciesMeta: + typescript: + optional: true + checksum: eaba1feb0e6882b0bad292172c118aac43ba683d1f04b940b542a20035468d030b062b036ea49eca36aa21782e9b1019e87717003b3c3db7d12dc707466b7eb7 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/utils@npm:6.7.3" + dependencies: + "@eslint-community/eslint-utils": ^4.4.0 + "@types/json-schema": ^7.0.12 + "@types/semver": ^7.5.0 + "@typescript-eslint/scope-manager": 6.7.3 + "@typescript-eslint/types": 6.7.3 + "@typescript-eslint/typescript-estree": 6.7.3 + semver: ^7.5.4 + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + checksum: 685b7c9fa95ad085f30e26431dc41b3059a42a16925defe2a94b32fb46974bfc168000de7d4d9ad4a1d0568a983f9d3c01ea6bc6cfa9a798e482719af9e9165b + languageName: node + linkType: hard + +"@typescript-eslint/visitor-keys@npm:6.7.3": + version: 6.7.3 + resolution: "@typescript-eslint/visitor-keys@npm:6.7.3" + dependencies: + "@typescript-eslint/types": 6.7.3 + eslint-visitor-keys: ^3.4.1 + checksum: cef64173a919107f420703e204d97d0afef0d9bd7a67570df5bdb39ac9464211c5a7b3af735d8f41e8004b443ab83e88b1d6fb951886aed4d3fe9d4778667199 + languageName: node + linkType: hard + +"@web/browser-logs@npm:^0.2.6": + version: 0.2.6 + resolution: "@web/browser-logs@npm:0.2.6" + dependencies: + errorstacks: ^2.2.0 + checksum: 82693e37a7e5a3c3df255e1e4feef6e6c2f2b7f5f883e1a9fd233d09a22c4f3e9e3dfd2ec809d7a02f0894156f26b89f1759bf4e9317640ee3630e9a3d9ec2a8 + languageName: node + linkType: hard + +"@web/browser-logs@npm:^0.3.2": + version: 0.3.3 + resolution: "@web/browser-logs@npm:0.3.3" + dependencies: + errorstacks: ^2.2.0 + checksum: 08db1332f7151e8e0fb1ed61e6e10f736e44f5c9675423f3af0c24f3a764560ea115e956cf3a4d9cd7a0826c0126accf966ebdb0bfa25a72c7e79da47b2cee3b + languageName: node + linkType: hard + +"@web/config-loader@npm:^0.1.3": + version: 0.1.3 + resolution: "@web/config-loader@npm:0.1.3" + dependencies: + semver: ^7.3.4 + checksum: 278554bd00b757eaf296ba904a224c61d4698df1a5d6c04931c40bc6bb308e81e767055cbf283b763cc530aae6b200bb950aa19eb41aa8979a3a2b29e5f0ac7a + languageName: node + linkType: hard + +"@web/dev-server-core@npm:^0.4.1": + version: 0.4.1 + resolution: "@web/dev-server-core@npm:0.4.1" + dependencies: + "@types/koa": ^2.11.6 + "@types/ws": ^7.4.0 + "@web/parse5-utils": ^1.3.1 + chokidar: ^3.4.3 + clone: ^2.1.2 + es-module-lexer: ^1.0.0 + get-stream: ^6.0.0 + is-stream: ^2.0.0 + isbinaryfile: ^5.0.0 + koa: ^2.13.0 + koa-etag: ^4.0.0 + koa-send: ^5.0.1 + koa-static: ^5.0.0 + lru-cache: ^6.0.0 + mime-types: ^2.1.27 + parse5: ^6.0.1 + picomatch: ^2.2.2 + ws: ^7.4.2 + checksum: 4cf728ac781c7831c9c59ffaa1bd2dca1f1e8a6553bedd0d80e47d946ea427067eb1d07b028fc8296a36930c1dd5631e0bc1ccf8f0f4b9203da362c958c1833e + languageName: node + linkType: hard + +"@web/dev-server-core@npm:^0.5.1": + version: 0.5.2 + resolution: "@web/dev-server-core@npm:0.5.2" + dependencies: + "@types/koa": ^2.11.6 + "@types/ws": ^7.4.0 + "@web/parse5-utils": ^2.0.0 + chokidar: ^3.4.3 + clone: ^2.1.2 + es-module-lexer: ^1.0.0 + get-stream: ^6.0.0 + is-stream: ^2.0.0 + isbinaryfile: ^5.0.0 + koa: ^2.13.0 + koa-etag: ^4.0.0 + koa-send: ^5.0.1 + koa-static: ^5.0.0 + lru-cache: ^8.0.4 + mime-types: ^2.1.27 + parse5: ^6.0.1 + picomatch: ^2.2.2 + ws: ^7.4.2 + checksum: 1a42f71a3d7eafd41bdb33a8cf9d37bb7e205704f3bcde9e32bd0aa639759d7a6e4448efe448be127042c46816931dd7585575e0f30a15c1b22576d578ccaacc + languageName: node + linkType: hard + +"@web/dev-server-esbuild@npm:^0.3.6": + version: 0.3.6 + resolution: "@web/dev-server-esbuild@npm:0.3.6" + dependencies: + "@mdn/browser-compat-data": ^4.0.0 + "@web/dev-server-core": ^0.4.1 + esbuild: ^0.16 || ^0.17 + parse5: ^6.0.1 + ua-parser-js: ^1.0.33 + checksum: ed29357d8a832c695f129de62bd658744b46b1e17a5aab24ad6d7cd09a90f27714d83fc6ece2471c35bff55f4f09435a18af65b37d65709019bfe09c10f4f9eb + languageName: node + linkType: hard + +"@web/dev-server-rollup@npm:^0.4.1": + version: 0.4.1 + resolution: "@web/dev-server-rollup@npm:0.4.1" + dependencies: + "@rollup/plugin-node-resolve": ^13.0.4 + "@web/dev-server-core": ^0.4.1 + nanocolors: ^0.2.1 + parse5: ^6.0.1 + rollup: ^2.67.0 + whatwg-url: ^11.0.0 + checksum: a0c3566f67b5a5ead3822431302ddcaa9d043b18fdcf1190056a4e0539e5d5b545ebfecaf6021412eb4b5b6e074c2b1eff35c71e859195623c7c07e065f9df58 + languageName: node + linkType: hard + +"@web/dev-server@npm:^0.1.38": + version: 0.1.38 + resolution: "@web/dev-server@npm:0.1.38" + dependencies: + "@babel/code-frame": ^7.12.11 + "@types/command-line-args": ^5.0.0 + "@web/config-loader": ^0.1.3 + "@web/dev-server-core": ^0.4.1 + "@web/dev-server-rollup": ^0.4.1 + camelcase: ^6.2.0 + command-line-args: ^5.1.1 + command-line-usage: ^7.0.1 + debounce: ^1.2.0 + deepmerge: ^4.2.2 + ip: ^1.1.5 + nanocolors: ^0.2.1 + open: ^8.0.2 + portfinder: ^1.0.32 + bin: + wds: dist/bin.js + web-dev-server: dist/bin.js + checksum: eeaf34f8744f58cfb9493155ad8548a87cae4e445a2fa894610b070f66cb303614d247bb609e378b9df342935ad980a259630317c444d19f9796abfcfb20bb13 + languageName: node + linkType: hard + +"@web/parse5-utils@npm:^1.3.1": + version: 1.3.1 + resolution: "@web/parse5-utils@npm:1.3.1" + dependencies: + "@types/parse5": ^6.0.1 + parse5: ^6.0.1 + checksum: 3320b2c4ea1e6a2ff1e57086b0c697a71dac7a6e54da86b2fb8e6c1d5a673bf9b911a743a10daa8cd62a571719edf3e66c9b17e87d79cc982f234bf141e2e178 + languageName: node + linkType: hard + +"@web/parse5-utils@npm:^2.0.0": + version: 2.0.1 + resolution: "@web/parse5-utils@npm:2.0.1" + dependencies: + "@types/parse5": ^6.0.1 + parse5: ^6.0.1 + checksum: d3993b0dee350e040bf5b13749283df88c97a48b063f8938fb21623422cd5f03b641393ca03bc724936e9f17d8bfd7939f501de6eb1c33ad82f6ac5112bf6cff + languageName: node + linkType: hard + +"@web/test-runner-chrome@npm:^0.12.1": + version: 0.12.1 + resolution: "@web/test-runner-chrome@npm:0.12.1" + dependencies: + "@web/test-runner-core": ^0.10.29 + "@web/test-runner-coverage-v8": ^0.5.0 + chrome-launcher: ^0.15.0 + puppeteer-core: ^19.8.1 + checksum: 08964e4c22c286231a6bdc003393316a7e0c7878560a9394d8bb9212c3c2e37799bc0aaf4732921213647c3dc89169146f65746d381feaa9c281c0373bf9da59 + languageName: node + linkType: hard + +"@web/test-runner-commands@npm:^0.6.6": + version: 0.6.6 + resolution: "@web/test-runner-commands@npm:0.6.6" + dependencies: + "@web/test-runner-core": ^0.10.29 + mkdirp: ^1.0.4 + checksum: b25533edd9ec59aeec28756a52ae4c6730388c336fa94e0c21eedf208012efd9aedf96c47ebad9a98cce9d87c4ee539b318a571e1e2bfb1bf8e5f1f6889c98e4 + languageName: node + linkType: hard + +"@web/test-runner-core@npm:^0.10.20, @web/test-runner-core@npm:^0.10.29": + version: 0.10.29 + resolution: "@web/test-runner-core@npm:0.10.29" + dependencies: + "@babel/code-frame": ^7.12.11 + "@types/babel__code-frame": ^7.0.2 + "@types/co-body": ^6.1.0 + "@types/convert-source-map": ^2.0.0 + "@types/debounce": ^1.2.0 + "@types/istanbul-lib-coverage": ^2.0.3 + "@types/istanbul-reports": ^3.0.0 + "@web/browser-logs": ^0.2.6 + "@web/dev-server-core": ^0.4.1 + chokidar: ^3.4.3 + cli-cursor: ^3.1.0 + co-body: ^6.1.0 + convert-source-map: ^2.0.0 + debounce: ^1.2.0 + dependency-graph: ^0.11.0 + globby: ^11.0.1 + ip: ^1.1.5 + istanbul-lib-coverage: ^3.0.0 + istanbul-lib-report: ^3.0.0 + istanbul-reports: ^3.0.2 + log-update: ^4.0.0 + nanocolors: ^0.2.1 + nanoid: ^3.1.25 + open: ^8.0.2 + picomatch: ^2.2.2 + source-map: ^0.7.3 + checksum: 635a510442bea3bce97596a2aed1c58a6154b4b83a44bf3e9c9497a751f42426cae5f67555916c4fd63064a4e91a5e26755e3090887ebac38ec0ab2691e1fe6c + languageName: node + linkType: hard + +"@web/test-runner-core@npm:^0.11.0": + version: 0.11.4 + resolution: "@web/test-runner-core@npm:0.11.4" + dependencies: + "@babel/code-frame": ^7.12.11 + "@types/babel__code-frame": ^7.0.2 + "@types/co-body": ^6.1.0 + "@types/convert-source-map": ^2.0.0 + "@types/debounce": ^1.2.0 + "@types/istanbul-lib-coverage": ^2.0.3 + "@types/istanbul-reports": ^3.0.0 + "@web/browser-logs": ^0.3.2 + "@web/dev-server-core": ^0.5.1 + chokidar: ^3.4.3 + cli-cursor: ^3.1.0 + co-body: ^6.1.0 + convert-source-map: ^2.0.0 + debounce: ^1.2.0 + dependency-graph: ^0.11.0 + globby: ^11.0.1 + ip: ^1.1.5 + istanbul-lib-coverage: ^3.0.0 + istanbul-lib-report: ^3.0.1 + istanbul-reports: ^3.0.2 + log-update: ^4.0.0 + nanocolors: ^0.2.1 + nanoid: ^3.1.25 + open: ^8.0.2 + picomatch: ^2.2.2 + source-map: ^0.7.3 + checksum: 45aea23ae1b0d112e2d331c15e1e581b5d208c278e6ecab746cffba81d0d11a8fd7b3fb0da488dd3c3c01e49debf7f3e8261031c2b86a7c8716fb3cc3e1a172c + languageName: node + linkType: hard + +"@web/test-runner-coverage-v8@npm:^0.5.0": + version: 0.5.0 + resolution: "@web/test-runner-coverage-v8@npm:0.5.0" + dependencies: + "@web/test-runner-core": ^0.10.20 + istanbul-lib-coverage: ^3.0.0 + picomatch: ^2.2.2 + v8-to-istanbul: ^9.0.1 + checksum: e69dc6379cff24f28bd21cc37a661945fbf7f3fd532da813e74f4042efe17fc191cdb7c09f1e1ea276167952b0116478ba0fe7af0966fa4867278c3a2cd772df + languageName: node + linkType: hard + +"@web/test-runner-coverage-v8@npm:^0.7.0": + version: 0.7.1 + resolution: "@web/test-runner-coverage-v8@npm:0.7.1" + dependencies: + "@web/test-runner-core": ^0.11.0 + istanbul-lib-coverage: ^3.0.0 + lru-cache: ^8.0.4 + picomatch: ^2.2.2 + v8-to-istanbul: ^9.0.1 + checksum: 317b11502b1378097598458a54054353fdb94d3bf9e0954daa9a3b1dcc1f0664032cd18f48292e763b890a132a980f5a5ead6555c33e9fb064d0ca960a884292 + languageName: node + linkType: hard + +"@web/test-runner-mocha@npm:^0.7.5": + version: 0.7.5 + resolution: "@web/test-runner-mocha@npm:0.7.5" + dependencies: + "@types/mocha": ^8.2.0 + "@web/test-runner-core": ^0.10.20 + checksum: 12f87299945d230815bb783de2953ac4239306c1a67145ef5b78cfb0b361ae7f659e5d3e5150af2cedc6f2c55adf10652b761f016430a7ac2d7f77b91ecb9cd1 + languageName: node + linkType: hard + +"@web/test-runner-playwright@npm:^0.10.0": + version: 0.10.1 + resolution: "@web/test-runner-playwright@npm:0.10.1" + dependencies: + "@web/test-runner-core": ^0.11.0 + "@web/test-runner-coverage-v8": ^0.7.0 + playwright: ^1.22.2 + checksum: d2aebc54c0444fb434671dc0d3a3912f76570eae4a909b7912cf46b9535232c7f7829729554e8629f546abce48433f9f5b21d583011582753fbb40e288c28e80 + languageName: node + linkType: hard + +"@web/test-runner@npm:^0.15.3": + version: 0.15.3 + resolution: "@web/test-runner@npm:0.15.3" + dependencies: + "@web/browser-logs": ^0.2.6 + "@web/config-loader": ^0.1.3 + "@web/dev-server": ^0.1.38 + "@web/test-runner-chrome": ^0.12.1 + "@web/test-runner-commands": ^0.6.6 + "@web/test-runner-core": ^0.10.29 + "@web/test-runner-mocha": ^0.7.5 + camelcase: ^6.2.0 + command-line-args: ^5.1.1 + command-line-usage: ^7.0.1 + convert-source-map: ^2.0.0 + diff: ^5.0.0 + globby: ^11.0.1 + nanocolors: ^0.2.1 + portfinder: ^1.0.32 + source-map: ^0.7.3 + bin: + web-test-runner: dist/bin.js + wtr: dist/bin.js + checksum: 75d00d4f15f9977ff4e8fca84e1c7f9d834073688df06d9e4b62bf43cad65a36b2ae21b9ebab5706e4d3b07fc639bb90758b1be1df036c8b80137ec3407a8f08 + languageName: node + linkType: hard + +"@webassemblyjs/ast@npm:1.11.6, @webassemblyjs/ast@npm:^1.11.5": + version: 1.11.6 + resolution: "@webassemblyjs/ast@npm:1.11.6" + dependencies: + "@webassemblyjs/helper-numbers": 1.11.6 + "@webassemblyjs/helper-wasm-bytecode": 1.11.6 + checksum: 38ef1b526ca47c210f30975b06df2faf1a8170b1636ce239fc5738fc231ce28389dd61ecedd1bacfc03cbe95b16d1af848c805652080cb60982836eb4ed2c6cf + languageName: node + linkType: hard + +"@webassemblyjs/floating-point-hex-parser@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/floating-point-hex-parser@npm:1.11.6" + checksum: 29b08758841fd8b299c7152eda36b9eb4921e9c584eb4594437b5cd90ed6b920523606eae7316175f89c20628da14326801090167cc7fbffc77af448ac84b7e2 + languageName: node + linkType: hard + +"@webassemblyjs/helper-api-error@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/helper-api-error@npm:1.11.6" + checksum: e8563df85161096343008f9161adb138a6e8f3c2cc338d6a36011aa55eabb32f2fd138ffe63bc278d009ada001cc41d263dadd1c0be01be6c2ed99076103689f + languageName: node + linkType: hard + +"@webassemblyjs/helper-buffer@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/helper-buffer@npm:1.11.6" + checksum: b14d0573bf680d22b2522e8a341ec451fddd645d1f9c6bd9012ccb7e587a2973b86ab7b89fe91e1c79939ba96095f503af04369a3b356c8023c13a5893221644 + languageName: node + linkType: hard + +"@webassemblyjs/helper-numbers@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/helper-numbers@npm:1.11.6" + dependencies: + "@webassemblyjs/floating-point-hex-parser": 1.11.6 + "@webassemblyjs/helper-api-error": 1.11.6 + "@xtuc/long": 4.2.2 + checksum: f4b562fa219f84368528339e0f8d273ad44e047a07641ffcaaec6f93e5b76fd86490a009aa91a294584e1436d74b0a01fa9fde45e333a4c657b58168b04da424 + languageName: node + linkType: hard + +"@webassemblyjs/helper-wasm-bytecode@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/helper-wasm-bytecode@npm:1.11.6" + checksum: 3535ef4f1fba38de3475e383b3980f4bbf3de72bbb631c2b6584c7df45be4eccd62c6ff48b5edd3f1bcff275cfd605a37679ec199fc91fd0a7705d7f1e3972dc + languageName: node + linkType: hard + +"@webassemblyjs/helper-wasm-section@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/helper-wasm-section@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@webassemblyjs/helper-buffer": 1.11.6 + "@webassemblyjs/helper-wasm-bytecode": 1.11.6 + "@webassemblyjs/wasm-gen": 1.11.6 + checksum: b2cf751bf4552b5b9999d27bbb7692d0aca75260140195cb58ea6374d7b9c2dc69b61e10b211a0e773f66209c3ddd612137ed66097e3684d7816f854997682e9 + languageName: node + linkType: hard + +"@webassemblyjs/ieee754@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/ieee754@npm:1.11.6" + dependencies: + "@xtuc/ieee754": ^1.2.0 + checksum: 13574b8e41f6ca39b700e292d7edf102577db5650fe8add7066a320aa4b7a7c09a5056feccac7a74eb68c10dea9546d4461412af351f13f6b24b5f32379b49de + languageName: node + linkType: hard + +"@webassemblyjs/leb128@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/leb128@npm:1.11.6" + dependencies: + "@xtuc/long": 4.2.2 + checksum: 7ea942dc9777d4b18a5ebfa3a937b30ae9e1d2ce1fee637583ed7f376334dd1d4274f813d2e250056cca803e0952def4b954913f1a3c9068bcd4ab4ee5143bf0 + languageName: node + linkType: hard + +"@webassemblyjs/utf8@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/utf8@npm:1.11.6" + checksum: 807fe5b5ce10c390cfdd93e0fb92abda8aebabb5199980681e7c3743ee3306a75729bcd1e56a3903980e96c885ee53ef901fcbaac8efdfa480f9c0dae1d08713 + languageName: node + linkType: hard + +"@webassemblyjs/wasm-edit@npm:^1.11.5": + version: 1.11.6 + resolution: "@webassemblyjs/wasm-edit@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@webassemblyjs/helper-buffer": 1.11.6 + "@webassemblyjs/helper-wasm-bytecode": 1.11.6 + "@webassemblyjs/helper-wasm-section": 1.11.6 + "@webassemblyjs/wasm-gen": 1.11.6 + "@webassemblyjs/wasm-opt": 1.11.6 + "@webassemblyjs/wasm-parser": 1.11.6 + "@webassemblyjs/wast-printer": 1.11.6 + checksum: 29ce75870496d6fad864d815ebb072395a8a3a04dc9c3f4e1ffdc63fc5fa58b1f34304a1117296d8240054cfdbc38aca88e71fb51483cf29ffab0a61ef27b481 + languageName: node + linkType: hard + +"@webassemblyjs/wasm-gen@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/wasm-gen@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@webassemblyjs/helper-wasm-bytecode": 1.11.6 + "@webassemblyjs/ieee754": 1.11.6 + "@webassemblyjs/leb128": 1.11.6 + "@webassemblyjs/utf8": 1.11.6 + checksum: a645a2eecbea24833c3260a249704a7f554ef4a94c6000984728e94bb2bc9140a68dfd6fd21d5e0bbb09f6dfc98e083a45760a83ae0417b41a0196ff6d45a23a + languageName: node + linkType: hard + +"@webassemblyjs/wasm-opt@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/wasm-opt@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@webassemblyjs/helper-buffer": 1.11.6 + "@webassemblyjs/wasm-gen": 1.11.6 + "@webassemblyjs/wasm-parser": 1.11.6 + checksum: b4557f195487f8e97336ddf79f7bef40d788239169aac707f6eaa2fa5fe243557c2d74e550a8e57f2788e70c7ae4e7d32f7be16101afe183d597b747a3bdd528 + languageName: node + linkType: hard + +"@webassemblyjs/wasm-parser@npm:1.11.6, @webassemblyjs/wasm-parser@npm:^1.11.5": + version: 1.11.6 + resolution: "@webassemblyjs/wasm-parser@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@webassemblyjs/helper-api-error": 1.11.6 + "@webassemblyjs/helper-wasm-bytecode": 1.11.6 + "@webassemblyjs/ieee754": 1.11.6 + "@webassemblyjs/leb128": 1.11.6 + "@webassemblyjs/utf8": 1.11.6 + checksum: 8200a8d77c15621724a23fdabe58d5571415cda98a7058f542e670ea965dd75499f5e34a48675184947c66f3df23adf55df060312e6d72d57908e3f049620d8a + languageName: node + linkType: hard + +"@webassemblyjs/wast-printer@npm:1.11.6": + version: 1.11.6 + resolution: "@webassemblyjs/wast-printer@npm:1.11.6" + dependencies: + "@webassemblyjs/ast": 1.11.6 + "@xtuc/long": 4.2.2 + checksum: d2fa6a4c427325ec81463e9c809aa6572af6d47f619f3091bf4c4a6fc34f1da3df7caddaac50b8e7a457f8784c62cd58c6311b6cb69b0162ccd8d4c072f79cf8 + languageName: node + linkType: hard + +"@xtuc/ieee754@npm:^1.2.0": + version: 1.2.0 + resolution: "@xtuc/ieee754@npm:1.2.0" + checksum: ac56d4ca6e17790f1b1677f978c0c6808b1900a5b138885d3da21732f62e30e8f0d9120fcf8f6edfff5100ca902b46f8dd7c1e3f903728634523981e80e2885a + languageName: node + linkType: hard + +"@xtuc/long@npm:4.2.2": + version: 4.2.2 + resolution: "@xtuc/long@npm:4.2.2" + checksum: 8ed0d477ce3bc9c6fe2bf6a6a2cc316bb9c4127c5a7827bae947fa8ec34c7092395c5a283cc300c05b5fa01cbbfa1f938f410a7bf75db7c7846fea41949989ec + languageName: node + linkType: hard + +"abbrev@npm:^1.0.0": + version: 1.1.1 + resolution: "abbrev@npm:1.1.1" + checksum: a4a97ec07d7ea112c517036882b2ac22f3109b7b19077dc656316d07d308438aac28e4d9746dc4d84bf6b1e75b4a7b0a5f3cb30592419f128ca9a8cee3bcfa17 + languageName: node + linkType: hard + +"abstract-level@npm:^1.0.0, abstract-level@npm:^1.0.2, abstract-level@npm:^1.0.3": + version: 1.0.3 + resolution: "abstract-level@npm:1.0.3" + dependencies: + buffer: ^6.0.3 + catering: ^2.1.0 + is-buffer: ^2.0.5 + level-supports: ^4.0.0 + level-transcoder: ^1.0.1 + module-error: ^1.0.1 + queue-microtask: ^1.2.3 + checksum: 70d61a3924526ebc257b138992052f9ff571a6cee5a7660836e37a1cc7081273c3acf465dd2f5e1897b38dc743a6fd9dba14a5d8a2a9d39e5787cd3da99f301d + languageName: node + linkType: hard + +"accepts@npm:^1.3.5, accepts@npm:~1.3.4, accepts@npm:~1.3.5, accepts@npm:~1.3.8": + version: 1.3.8 + resolution: "accepts@npm:1.3.8" + dependencies: + mime-types: ~2.1.34 + negotiator: 0.6.3 + checksum: 50c43d32e7b50285ebe84b613ee4a3aa426715a7d131b65b786e2ead0fd76b6b60091b9916d3478a75f11f162628a2139991b6c03ab3f1d9ab7c86075dc8eab4 + languageName: node + linkType: hard + +"acorn-import-assertions@npm:^1.9.0": + version: 1.9.0 + resolution: "acorn-import-assertions@npm:1.9.0" + peerDependencies: + acorn: ^8 + checksum: 944fb2659d0845c467066bdcda2e20c05abe3aaf11972116df457ce2627628a81764d800dd55031ba19de513ee0d43bb771bc679cc0eda66dc8b4fade143bc0c + languageName: node + linkType: hard + +"acorn-jsx@npm:^5.3.2": + version: 5.3.2 + resolution: "acorn-jsx@npm:5.3.2" + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: c3d3b2a89c9a056b205b69530a37b972b404ee46ec8e5b341666f9513d3163e2a4f214a71f4dfc7370f5a9c07472d2fd1c11c91c3f03d093e37637d95da98950 + languageName: node + linkType: hard + +"acorn-walk@npm:^8.0.0, acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.2.0": + version: 8.2.0 + resolution: "acorn-walk@npm:8.2.0" + checksum: 1715e76c01dd7b2d4ca472f9c58968516a4899378a63ad5b6c2d668bba8da21a71976c14ec5f5b75f887b6317c4ae0b897ab141c831d741dc76024d8745f1ad1 + languageName: node + linkType: hard + +"acorn@npm:^8.0.4, acorn@npm:^8.4.1, acorn@npm:^8.7.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": + version: 8.10.0 + resolution: "acorn@npm:8.10.0" + bin: + acorn: bin/acorn + checksum: 538ba38af0cc9e5ef983aee196c4b8b4d87c0c94532334fa7e065b2c8a1f85863467bb774231aae91613fcda5e68740c15d97b1967ae3394d20faddddd8af61d + languageName: node + linkType: hard + +"address@npm:^1.0.1, address@npm:^1.1.2": + version: 1.2.2 + resolution: "address@npm:1.2.2" + checksum: ace439960c1e3564d8f523aff23a841904bf33a2a7c2e064f7f60a064194075758b9690e65bd9785692a4ef698a998c57eb74d145881a1cecab8ba658ddb1607 + languageName: node + linkType: hard + +"adm-zip@npm:^0.4.16": + version: 0.4.16 + resolution: "adm-zip@npm:0.4.16" + checksum: 5ea46664d8b3b073fffeb7f934705fea288708745e708cffc1dd732ce3d2672cecd476b243f9d051892fd12952db2b6bd061975e1ff40057246f6d0cb6534a50 + languageName: node + linkType: hard + +"aes-js@npm:3.0.0": + version: 3.0.0 + resolution: "aes-js@npm:3.0.0" + checksum: 251e26d533cd1a915b44896b17d5ed68c24a02484cfdd2e74ec700a309267db96651ea4eb657bf20aac32a3baa61f6e34edf8e2fec2de440a655da9942d334b8 + languageName: node + linkType: hard + +"aes-js@npm:4.0.0-beta.5": + version: 4.0.0-beta.5 + resolution: "aes-js@npm:4.0.0-beta.5" + checksum: cc2ea969d77df939c32057f7e361b6530aa6cb93cb10617a17a45cd164e6d761002f031ff6330af3e67e58b1f0a3a8fd0b63a720afd591a653b02f649470e15b + languageName: node + linkType: hard + +"agent-base@npm:6, agent-base@npm:^6.0.2": + version: 6.0.2 + resolution: "agent-base@npm:6.0.2" + dependencies: + debug: 4 + checksum: f52b6872cc96fd5f622071b71ef200e01c7c4c454ee68bc9accca90c98cfb39f2810e3e9aa330435835eedc8c23f4f8a15267f67c6e245d2b33757575bdac49d + languageName: node + linkType: hard + +"agentkeepalive@npm:^4.2.1": + version: 4.5.0 + resolution: "agentkeepalive@npm:4.5.0" + dependencies: + humanize-ms: ^1.2.1 + checksum: 13278cd5b125e51eddd5079f04d6fe0914ac1b8b91c1f3db2c1822f99ac1a7457869068997784342fe455d59daaff22e14fb7b8c3da4e741896e7e31faf92481 + languageName: node + linkType: hard + +"aggregate-error@npm:^3.0.0": + version: 3.1.0 + resolution: "aggregate-error@npm:3.1.0" + dependencies: + clean-stack: ^2.0.0 + indent-string: ^4.0.0 + checksum: 1101a33f21baa27a2fa8e04b698271e64616b886795fd43c31068c07533c7b3facfcaf4e9e0cab3624bd88f729a592f1c901a1a229c9e490eafce411a8644b79 + languageName: node + linkType: hard + +"aggregate-error@npm:^4.0.0": + version: 4.0.1 + resolution: "aggregate-error@npm:4.0.1" + dependencies: + clean-stack: ^4.0.0 + indent-string: ^5.0.0 + checksum: bb3ffdfd13447800fff237c2cba752c59868ee669104bb995dfbbe0b8320e967d679e683dabb640feb32e4882d60258165cde0baafc4cd467cc7d275a13ad6b5 + languageName: node + linkType: hard + +"ajv-formats@npm:^2.1.1": + version: 2.1.1 + resolution: "ajv-formats@npm:2.1.1" + dependencies: + ajv: ^8.0.0 + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + checksum: 4a287d937f1ebaad4683249a4c40c0fa3beed30d9ddc0adba04859026a622da0d317851316ea64b3680dc60f5c3c708105ddd5d5db8fe595d9d0207fd19f90b7 + languageName: node + linkType: hard + +"ajv-keywords@npm:^3.4.1, ajv-keywords@npm:^3.5.2": + version: 3.5.2 + resolution: "ajv-keywords@npm:3.5.2" + peerDependencies: + ajv: ^6.9.1 + checksum: 7dc5e5931677a680589050f79dcbe1fefbb8fea38a955af03724229139175b433c63c68f7ae5f86cf8f65d55eb7c25f75a046723e2e58296707617ca690feae9 + languageName: node + linkType: hard + +"ajv-keywords@npm:^5.1.0": + version: 5.1.0 + resolution: "ajv-keywords@npm:5.1.0" + dependencies: + fast-deep-equal: ^3.1.3 + peerDependencies: + ajv: ^8.8.2 + checksum: c35193940b853119242c6757787f09ecf89a2c19bcd36d03ed1a615e710d19d450cb448bfda407b939aba54b002368c8bff30529cc50a0536a8e10bcce300421 + languageName: node + linkType: hard + +"ajv@npm:^6.12.2, ajv@npm:^6.12.4, ajv@npm:^6.12.5": + version: 6.12.6 + resolution: "ajv@npm:6.12.6" + dependencies: + fast-deep-equal: ^3.1.1 + fast-json-stable-stringify: ^2.0.0 + json-schema-traverse: ^0.4.1 + uri-js: ^4.2.2 + checksum: 874972efe5c4202ab0a68379481fbd3d1b5d0a7bd6d3cc21d40d3536ebff3352a2a1fabb632d4fd2cc7fe4cbdcd5ed6782084c9bbf7f32a1536d18f9da5007d4 + languageName: node + linkType: hard + +"ajv@npm:^8.0.0, ajv@npm:^8.9.0": + version: 8.12.0 + resolution: "ajv@npm:8.12.0" + dependencies: + fast-deep-equal: ^3.1.1 + json-schema-traverse: ^1.0.0 + require-from-string: ^2.0.2 + uri-js: ^4.2.2 + checksum: 4dc13714e316e67537c8b31bc063f99a1d9d9a497eb4bbd55191ac0dcd5e4985bbb71570352ad6f1e76684fb6d790928f96ba3b2d4fd6e10024be9612fe3f001 + languageName: node + linkType: hard + +"algoliasearch-helper@npm:^3.10.0": + version: 3.14.2 + resolution: "algoliasearch-helper@npm:3.14.2" + dependencies: + "@algolia/events": ^4.0.1 + peerDependencies: + algoliasearch: ">= 3.1 < 6" + checksum: d66444b25fe8ee64675bb660ff1980870751818cb4a29c57bda6ca410372f2bfa031a455dcd5981941736db89d8294187c5b3bc1ce2a2567c6e43657ccd208b8 + languageName: node + linkType: hard + +"algoliasearch@npm:^4.13.1, algoliasearch@npm:^4.19.1": + version: 4.20.0 + resolution: "algoliasearch@npm:4.20.0" + dependencies: + "@algolia/cache-browser-local-storage": 4.20.0 + "@algolia/cache-common": 4.20.0 + "@algolia/cache-in-memory": 4.20.0 + "@algolia/client-account": 4.20.0 + "@algolia/client-analytics": 4.20.0 + "@algolia/client-common": 4.20.0 + "@algolia/client-personalization": 4.20.0 + "@algolia/client-search": 4.20.0 + "@algolia/logger-common": 4.20.0 + "@algolia/logger-console": 4.20.0 + "@algolia/requester-browser-xhr": 4.20.0 + "@algolia/requester-common": 4.20.0 + "@algolia/requester-node-http": 4.20.0 + "@algolia/transporter": 4.20.0 + checksum: 078954944452f57d2e3b47c6ed4905caf797814324a4d5068a8b6685d434a885977a3e607714c5fb6eb29c7c3e717b3ee9cb01c8b2320e2c7bd73bcd8d42e70f + languageName: node + linkType: hard + +"ansi-align@npm:^3.0.0, ansi-align@npm:^3.0.1": + version: 3.0.1 + resolution: "ansi-align@npm:3.0.1" + dependencies: + string-width: ^4.1.0 + checksum: 6abfa08f2141d231c257162b15292467081fa49a208593e055c866aa0455b57f3a86b5a678c190c618faa79b4c59e254493099cb700dd9cf2293c6be2c8f5d8d + languageName: node + linkType: hard + +"ansi-colors@npm:4.1.1": + version: 4.1.1 + resolution: "ansi-colors@npm:4.1.1" + checksum: 138d04a51076cb085da0a7e2d000c5c0bb09f6e772ed5c65c53cb118d37f6c5f1637506d7155fb5f330f0abcf6f12fa2e489ac3f8cdab9da393bf1bb4f9a32b0 + languageName: node + linkType: hard + +"ansi-colors@npm:^4.1.1": + version: 4.1.3 + resolution: "ansi-colors@npm:4.1.3" + checksum: a9c2ec842038a1fabc7db9ece7d3177e2fe1c5dc6f0c51ecfbf5f39911427b89c00b5dc6b8bd95f82a26e9b16aaae2e83d45f060e98070ce4d1333038edceb0e + languageName: node + linkType: hard + +"ansi-escapes@npm:^4.3.0": + version: 4.3.2 + resolution: "ansi-escapes@npm:4.3.2" + dependencies: + type-fest: ^0.21.3 + checksum: 93111c42189c0a6bed9cdb4d7f2829548e943827ee8479c74d6e0b22ee127b2a21d3f8b5ca57723b8ef78ce011fbfc2784350eb2bde3ccfccf2f575fa8489815 + languageName: node + linkType: hard + +"ansi-html-community@npm:^0.0.8": + version: 0.0.8 + resolution: "ansi-html-community@npm:0.0.8" + bin: + ansi-html: bin/ansi-html + checksum: 04c568e8348a636963f915e48eaa3e01218322e1169acafdd79c384f22e5558c003f79bbc480c1563865497482817c7eed025f0653ebc17642fededa5cb42089 + languageName: node + linkType: hard + +"ansi-regex@npm:^5.0.1": + version: 5.0.1 + resolution: "ansi-regex@npm:5.0.1" + checksum: 2aa4bb54caf2d622f1afdad09441695af2a83aa3fe8b8afa581d205e57ed4261c183c4d3877cee25794443fde5876417d859c108078ab788d6af7e4fe52eb66b + languageName: node + linkType: hard + +"ansi-regex@npm:^6.0.1": + version: 6.0.1 + resolution: "ansi-regex@npm:6.0.1" + checksum: 1ff8b7667cded1de4fa2c9ae283e979fc87036864317da86a2e546725f96406746411d0d85e87a2d12fa5abd715d90006de7fa4fa0477c92321ad3b4c7d4e169 + languageName: node + linkType: hard + +"ansi-sequence-parser@npm:^1.1.0": + version: 1.1.1 + resolution: "ansi-sequence-parser@npm:1.1.1" + checksum: ead5b15c596e8e85ca02951a844366c6776769dcc9fd1bd3a0db11bb21364554822c6a439877fb599e7e1ffa0b5f039f1e5501423950457f3dcb2f480c30b188 + languageName: node + linkType: hard + +"ansi-styles@npm:^3.2.1": + version: 3.2.1 + resolution: "ansi-styles@npm:3.2.1" + dependencies: + color-convert: ^1.9.0 + checksum: d85ade01c10e5dd77b6c89f34ed7531da5830d2cb5882c645f330079975b716438cd7ebb81d0d6e6b4f9c577f19ae41ab55f07f19786b02f9dfd9e0377395665 + languageName: node + linkType: hard + +"ansi-styles@npm:^4.0.0, ansi-styles@npm:^4.1.0": + version: 4.3.0 + resolution: "ansi-styles@npm:4.3.0" + dependencies: + color-convert: ^2.0.1 + checksum: 513b44c3b2105dd14cc42a19271e80f386466c4be574bccf60b627432f9198571ebf4ab1e4c3ba17347658f4ee1711c163d574248c0c1cdc2d5917a0ad582ec4 + languageName: node + linkType: hard + +"ansi-styles@npm:^6.0.0, ansi-styles@npm:^6.1.0, ansi-styles@npm:^6.2.1": + version: 6.2.1 + resolution: "ansi-styles@npm:6.2.1" + checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 + languageName: node + linkType: hard + +"anymatch@npm:~3.1.2": + version: 3.1.3 + resolution: "anymatch@npm:3.1.3" + dependencies: + normalize-path: ^3.0.0 + picomatch: ^2.0.4 + checksum: 3e044fd6d1d26545f235a9fe4d7a534e2029d8e59fa7fd9f2a6eb21230f6b5380ea1eaf55136e60cbf8e613544b3b766e7a6fa2102e2a3a117505466e3025dc2 + languageName: node + linkType: hard + +"aproba@npm:^1.0.3 || ^2.0.0": + version: 2.0.0 + resolution: "aproba@npm:2.0.0" + checksum: 5615cadcfb45289eea63f8afd064ab656006361020e1735112e346593856f87435e02d8dcc7ff0d11928bc7d425f27bc7c2a84f6c0b35ab0ff659c814c138a24 + languageName: node + linkType: hard + +"are-we-there-yet@npm:^3.0.0": + version: 3.0.1 + resolution: "are-we-there-yet@npm:3.0.1" + dependencies: + delegates: ^1.0.0 + readable-stream: ^3.6.0 + checksum: 52590c24860fa7173bedeb69a4c05fb573473e860197f618b9a28432ee4379049336727ae3a1f9c4cb083114601c1140cee578376164d0e651217a9843f9fe83 + languageName: node + linkType: hard + +"arg@npm:^4.1.0": + version: 4.1.3 + resolution: "arg@npm:4.1.3" + checksum: 544af8dd3f60546d3e4aff084d451b96961d2267d668670199692f8d054f0415d86fc5497d0e641e91546f0aa920e7c29e5250e99fc89f5552a34b5d93b77f43 + languageName: node + linkType: hard + +"arg@npm:^5.0.0": + version: 5.0.2 + resolution: "arg@npm:5.0.2" + checksum: 6c69ada1a9943d332d9e5382393e897c500908d91d5cb735a01120d5f71daf1b339b7b8980cbeaba8fd1afc68e658a739746179e4315a26e8a28951ff9930078 + languageName: node + linkType: hard + +"argparse@npm:^1.0.7": + version: 1.0.10 + resolution: "argparse@npm:1.0.10" + dependencies: + sprintf-js: ~1.0.2 + checksum: 7ca6e45583a28de7258e39e13d81e925cfa25d7d4aacbf806a382d3c02fcb13403a07fb8aeef949f10a7cfe4a62da0e2e807b348a5980554cc28ee573ef95945 + languageName: node + linkType: hard + +"argparse@npm:^2.0.1": + version: 2.0.1 + resolution: "argparse@npm:2.0.1" + checksum: 83644b56493e89a254bae05702abf3a1101b4fa4d0ca31df1c9985275a5a5bd47b3c27b7fa0b71098d41114d8ca000e6ed90cad764b306f8a503665e4d517ced + languageName: node + linkType: hard + +"array-back@npm:^3.0.1, array-back@npm:^3.1.0": + version: 3.1.0 + resolution: "array-back@npm:3.1.0" + checksum: 7205004fcd0f9edd926db921af901b083094608d5b265738d0290092f9822f73accb468e677db74c7c94ef432d39e5ed75a7b1786701e182efb25bbba9734209 + languageName: node + linkType: hard + +"array-back@npm:^4.0.1, array-back@npm:^4.0.2": + version: 4.0.2 + resolution: "array-back@npm:4.0.2" + checksum: f30603270771eeb54e5aad5f54604c62b3577a18b6db212a7272b2b6c32049121b49431f656654790ed1469411e45f387e7627c0de8fd0515995cc40df9b9294 + languageName: node + linkType: hard + +"array-back@npm:^6.2.2": + version: 6.2.2 + resolution: "array-back@npm:6.2.2" + checksum: baae1e3a1687300a307d3bdf09715f6415e1099b5729d3d8e397309fb1e43d90b939d694602892172aaca7e0aeed38da89d04aa4951637d31c2a21350809e003 + languageName: node + linkType: hard + +"array-find-index@npm:^1.0.1": + version: 1.0.2 + resolution: "array-find-index@npm:1.0.2" + checksum: aac128bf369e1ac6c06ff0bb330788371c0e256f71279fb92d745e26fb4b9db8920e485b4ec25e841c93146bf71a34dcdbcefa115e7e0f96927a214d237b7081 + languageName: node + linkType: hard + +"array-flatten@npm:1.1.1": + version: 1.1.1 + resolution: "array-flatten@npm:1.1.1" + checksum: a9925bf3512d9dce202112965de90c222cd59a4fbfce68a0951d25d965cf44642931f40aac72309c41f12df19afa010ecadceb07cfff9ccc1621e99d89ab5f3b + languageName: node + linkType: hard + +"array-flatten@npm:^2.1.2": + version: 2.1.2 + resolution: "array-flatten@npm:2.1.2" + checksum: e8988aac1fbfcdaae343d08c9a06a6fddd2c6141721eeeea45c3cf523bf4431d29a46602929455ed548c7a3e0769928cdc630405427297e7081bd118fdec9262 + languageName: node + linkType: hard + +"array-union@npm:^2.1.0": + version: 2.1.0 + resolution: "array-union@npm:2.1.0" + checksum: 5bee12395cba82da674931df6d0fea23c4aa4660cb3b338ced9f828782a65caa232573e6bf3968f23e0c5eb301764a382cef2f128b170a9dc59de0e36c39f98d + languageName: node + linkType: hard + +"arrgv@npm:^1.0.2": + version: 1.0.2 + resolution: "arrgv@npm:1.0.2" + checksum: 470bbb406ea3b34810dd8b03c0b33282617a42d9fce0ab45d58596efefd042fc548eda49161fa8e3f607cbe9df90e7a67003a09043ab9081eff70f97c63dd0e2 + languageName: node + linkType: hard + +"arrify@npm:^3.0.0": + version: 3.0.0 + resolution: "arrify@npm:3.0.0" + checksum: d6c6f3dad9571234f320e130d57fddb2cc283c87f2ac7df6c7005dffc5161b7bb9376f4be655ed257050330336e84afc4f3020d77696ad231ff580a94ae5aba6 + languageName: node + linkType: hard + +"asap@npm:~2.0.3": + version: 2.0.6 + resolution: "asap@npm:2.0.6" + checksum: b296c92c4b969e973260e47523207cd5769abd27c245a68c26dc7a0fe8053c55bb04360237cb51cab1df52be939da77150ace99ad331fb7fb13b3423ed73ff3d + languageName: node + linkType: hard + +"assertion-error@npm:^1.1.0": + version: 1.1.0 + resolution: "assertion-error@npm:1.1.0" + checksum: fd9429d3a3d4fd61782eb3962ae76b6d08aa7383123fca0596020013b3ebd6647891a85b05ce821c47d1471ed1271f00b0545cf6a4326cf2fc91efcc3b0fbecf + languageName: node + linkType: hard + +"astral-regex@npm:^2.0.0": + version: 2.0.0 + resolution: "astral-regex@npm:2.0.0" + checksum: 876231688c66400473ba505731df37ea436e574dd524520294cc3bbc54ea40334865e01fa0d074d74d036ee874ee7e62f486ea38bc421ee8e6a871c06f011766 + languageName: node + linkType: hard + +"async@npm:^2.6.4": + version: 2.6.4 + resolution: "async@npm:2.6.4" + dependencies: + lodash: ^4.17.14 + checksum: a52083fb32e1ebe1d63e5c5624038bb30be68ff07a6c8d7dfe35e47c93fc144bd8652cbec869e0ac07d57dde387aa5f1386be3559cdee799cb1f789678d88e19 + languageName: node + linkType: hard + +"asynckit@npm:^0.4.0": + version: 0.4.0 + resolution: "asynckit@npm:0.4.0" + checksum: 7b78c451df768adba04e2d02e63e2d0bf3b07adcd6e42b4cf665cb7ce899bedd344c69a1dcbce355b5f972d597b25aaa1c1742b52cffd9caccb22f348114f6be + languageName: node + linkType: hard + +"at-least-node@npm:^1.0.0": + version: 1.0.0 + resolution: "at-least-node@npm:1.0.0" + checksum: 463e2f8e43384f1afb54bc68485c436d7622acec08b6fad269b421cb1d29cebb5af751426793d0961ed243146fe4dc983402f6d5a51b720b277818dbf6f2e49e + languageName: node + linkType: hard + +"autoprefixer@npm:^10.4.12, autoprefixer@npm:^10.4.7": + version: 10.4.16 + resolution: "autoprefixer@npm:10.4.16" + dependencies: + browserslist: ^4.21.10 + caniuse-lite: ^1.0.30001538 + fraction.js: ^4.3.6 + normalize-range: ^0.1.2 + picocolors: ^1.0.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.1.0 + bin: + autoprefixer: bin/autoprefixer + checksum: 45fad7086495048dacb14bb7b00313e70e135b5d8e8751dcc60548889400763705ab16fc2d99ea628b44c3472698fb0e39598f595ba28409c965ab159035afde + languageName: node + linkType: hard + +"ava@npm:^5.2.0": + version: 5.3.1 + resolution: "ava@npm:5.3.1" + dependencies: + acorn: ^8.8.2 + acorn-walk: ^8.2.0 + ansi-styles: ^6.2.1 + arrgv: ^1.0.2 + arrify: ^3.0.0 + callsites: ^4.0.0 + cbor: ^8.1.0 + chalk: ^5.2.0 + chokidar: ^3.5.3 + chunkd: ^2.0.1 + ci-info: ^3.8.0 + ci-parallel-vars: ^1.0.1 + clean-yaml-object: ^0.1.0 + cli-truncate: ^3.1.0 + code-excerpt: ^4.0.0 + common-path-prefix: ^3.0.0 + concordance: ^5.0.4 + currently-unhandled: ^0.4.1 + debug: ^4.3.4 + emittery: ^1.0.1 + figures: ^5.0.0 + globby: ^13.1.4 + ignore-by-default: ^2.1.0 + indent-string: ^5.0.0 + is-error: ^2.2.2 + is-plain-object: ^5.0.0 + is-promise: ^4.0.0 + matcher: ^5.0.0 + mem: ^9.0.2 + ms: ^2.1.3 + p-event: ^5.0.1 + p-map: ^5.5.0 + picomatch: ^2.3.1 + pkg-conf: ^4.0.0 + plur: ^5.1.0 + pretty-ms: ^8.0.0 + resolve-cwd: ^3.0.0 + stack-utils: ^2.0.6 + strip-ansi: ^7.0.1 + supertap: ^3.0.1 + temp-dir: ^3.0.0 + write-file-atomic: ^5.0.1 + yargs: ^17.7.2 + peerDependencies: + "@ava/typescript": "*" + peerDependenciesMeta: + "@ava/typescript": + optional: true + bin: + ava: entrypoints/cli.mjs + checksum: 126a5932baef74eccd8bec992bd522e25c05b6ee4985dde87c20cece76c2377f0bf9448f242f3f9cd2abbf7a5ac932fe4e4abde2a23792d6271a6088e5a1984e + languageName: node + linkType: hard + +"axios@npm:^0.25.0": + version: 0.25.0 + resolution: "axios@npm:0.25.0" + dependencies: + follow-redirects: ^1.14.7 + checksum: 2a8a3787c05f2a0c9c3878f49782357e2a9f38945b93018fb0c4fd788171c43dceefbb577988628e09fea53952744d1ecebde234b561f1e703aa43e0a598a3ad + languageName: node + linkType: hard + +"axios@npm:^1.4.0": + version: 1.5.1 + resolution: "axios@npm:1.5.1" + dependencies: + follow-redirects: ^1.15.0 + form-data: ^4.0.0 + proxy-from-env: ^1.1.0 + checksum: 4444f06601f4ede154183767863d2b8e472b4a6bfc5253597ed6d21899887e1fd0ee2b3de792ac4f8459fe2e359d2aa07c216e45fd8b9e4e0688a6ebf48a5a8d + languageName: node + linkType: hard + +"babel-loader@npm:^8.2.5": + version: 8.3.0 + resolution: "babel-loader@npm:8.3.0" + dependencies: + find-cache-dir: ^3.3.1 + loader-utils: ^2.0.0 + make-dir: ^3.1.0 + schema-utils: ^2.6.5 + peerDependencies: + "@babel/core": ^7.0.0 + webpack: ">=2" + checksum: d48bcf9e030e598656ad3ff5fb85967db2eaaf38af5b4a4b99d25618a2057f9f100e6b231af2a46c1913206db506115ca7a8cbdf52c9c73d767070dae4352ab5 + languageName: node + linkType: hard + +"babel-plugin-apply-mdx-type-prop@npm:1.6.22": + version: 1.6.22 + resolution: "babel-plugin-apply-mdx-type-prop@npm:1.6.22" + dependencies: + "@babel/helper-plugin-utils": 7.10.4 + "@mdx-js/util": 1.6.22 + peerDependencies: + "@babel/core": ^7.11.6 + checksum: 43e2100164a8f3e46fddd76afcbfb1f02cbebd5612cfe63f3d344a740b0afbdc4d2bf5659cffe9323dd2554c7b86b23ebedae9dadcec353b6594f4292a1a28e2 + languageName: node + linkType: hard + +"babel-plugin-dynamic-import-node@npm:^2.3.3": + version: 2.3.3 + resolution: "babel-plugin-dynamic-import-node@npm:2.3.3" + dependencies: + object.assign: ^4.1.0 + checksum: c9d24415bcc608d0db7d4c8540d8002ac2f94e2573d2eadced137a29d9eab7e25d2cbb4bc6b9db65cf6ee7430f7dd011d19c911a9a778f0533b4a05ce8292c9b + languageName: node + linkType: hard + +"babel-plugin-extract-import-names@npm:1.6.22": + version: 1.6.22 + resolution: "babel-plugin-extract-import-names@npm:1.6.22" + dependencies: + "@babel/helper-plugin-utils": 7.10.4 + checksum: 145ccf09c96d36411d340e78086555f8d4d5924ea39fcb0eca461c066cfa98bc4344982bb35eb85d054ef88f8d4dfc0205ba27370c1d8fcc78191b02908d044d + languageName: node + linkType: hard + +"babel-plugin-polyfill-corejs2@npm:^0.4.6": + version: 0.4.6 + resolution: "babel-plugin-polyfill-corejs2@npm:0.4.6" + dependencies: + "@babel/compat-data": ^7.22.6 + "@babel/helper-define-polyfill-provider": ^0.4.3 + semver: ^6.3.1 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 08896811df31530be6a9bcdd630cb9fd4b5ae5181039d18db3796efbc54e38d57a42af460845c10a04434e1bc45c0d47743c7e6c860383cc6b141083cde22030 + languageName: node + linkType: hard + +"babel-plugin-polyfill-corejs3@npm:^0.8.5": + version: 0.8.5 + resolution: "babel-plugin-polyfill-corejs3@npm:0.8.5" + dependencies: + "@babel/helper-define-polyfill-provider": ^0.4.3 + core-js-compat: ^3.32.2 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 54ff3956c4f88e483d38b27ceec6199b9e73fceac10ebf969469d215e6a62929384e4433f85335c9a6ba809329636e27f9bdae2f54075f833e7a745341c07d84 + languageName: node + linkType: hard + +"babel-plugin-polyfill-regenerator@npm:^0.5.3": + version: 0.5.3 + resolution: "babel-plugin-polyfill-regenerator@npm:0.5.3" + dependencies: + "@babel/helper-define-polyfill-provider": ^0.4.3 + peerDependencies: + "@babel/core": ^7.4.0 || ^8.0.0-0 <8.0.0 + checksum: 2bb546582cda1870d19e646a7183baeb2cccd56e0ef3e4eaeabd28e120daf17cb87399194a9ccdcf32506bcaa68d23e73440fc8ab990a7a0f8c5a77c12d5d4bc + languageName: node + linkType: hard + +"bail@npm:^1.0.0": + version: 1.0.5 + resolution: "bail@npm:1.0.5" + checksum: 6c334940d7eaa4e656a12fb12407b6555649b6deb6df04270fa806e0da82684ebe4a4e47815b271c794b40f8d6fa286e0c248b14ddbabb324a917fab09b7301a + languageName: node + linkType: hard + +"balanced-match@npm:^1.0.0": + version: 1.0.2 + resolution: "balanced-match@npm:1.0.2" + checksum: 9706c088a283058a8a99e0bf91b0a2f75497f185980d9ffa8b304de1d9e58ebda7c72c07ebf01dadedaac5b2907b2c6f566f660d62bd336c3468e960403b9d65 + languageName: node + linkType: hard + +"base-x@npm:^3.0.2": + version: 3.0.9 + resolution: "base-x@npm:3.0.9" + dependencies: + safe-buffer: ^5.0.1 + checksum: 957101d6fd09e1903e846fd8f69fd7e5e3e50254383e61ab667c725866bec54e5ece5ba49ce385128ae48f9ec93a26567d1d5ebb91f4d56ef4a9cc0d5a5481e8 + languageName: node + linkType: hard + +"base16@npm:^1.0.0": + version: 1.0.0 + resolution: "base16@npm:1.0.0" + checksum: 0cd449a2db0f0f957e4b6b57e33bc43c9e20d4f1dd744065db94b5da35e8e71fa4dc4bc7a901e59a84d5f8b6936e3c520e2471787f667fc155fb0f50d8540f5d + languageName: node + linkType: hard + +"base64-js@npm:^1.3.1": + version: 1.5.1 + resolution: "base64-js@npm:1.5.1" + checksum: 669632eb3745404c2f822a18fc3a0122d2f9a7a13f7fb8b5823ee19d1d2ff9ee5b52c53367176ea4ad093c332fd5ab4bd0ebae5a8e27917a4105a4cfc86b1005 + languageName: node + linkType: hard + +"batch@npm:0.6.1": + version: 0.6.1 + resolution: "batch@npm:0.6.1" + checksum: 61f9934c7378a51dce61b915586191078ef7f1c3eca707fdd58b96ff2ff56d9e0af2bdab66b1462301a73c73374239e6542d9821c0af787f3209a23365d07e7f + languageName: node + linkType: hard + +"bech32@npm:1.1.4": + version: 1.1.4 + resolution: "bech32@npm:1.1.4" + checksum: 0e98db619191548390d6f09ff68b0253ba7ae6a55db93dfdbb070ba234c1fd3308c0606fbcc95fad50437227b10011e2698b89f0181f6e7f845c499bd14d0f4b + languageName: node + linkType: hard + +"big-integer@npm:^1.6.44": + version: 1.6.51 + resolution: "big-integer@npm:1.6.51" + checksum: 3d444173d1b2e20747e2c175568bedeebd8315b0637ea95d75fd27830d3b8e8ba36c6af40374f36bdaea7b5de376dcada1b07587cb2a79a928fccdb6e6e3c518 + languageName: node + linkType: hard + +"big.js@npm:^5.2.2": + version: 5.2.2 + resolution: "big.js@npm:5.2.2" + checksum: b89b6e8419b097a8fb4ed2399a1931a68c612bce3cfd5ca8c214b2d017531191070f990598de2fc6f3f993d91c0f08aa82697717f6b3b8732c9731866d233c9e + languageName: node + linkType: hard + +"bigint-crypto-utils@npm:^3.0.23": + version: 3.3.0 + resolution: "bigint-crypto-utils@npm:3.3.0" + checksum: 9598ce57b23f776c8936d44114c9f051e62b5fa654915b664784cbcbacc5aa0485f4479571c51ff58008abb1210c0d6a234853742f07cf84bda890f2a1e01000 + languageName: node + linkType: hard + +"binary-extensions@npm:^2.0.0": + version: 2.2.0 + resolution: "binary-extensions@npm:2.2.0" + checksum: ccd267956c58d2315f5d3ea6757cf09863c5fc703e50fbeb13a7dc849b812ef76e3cf9ca8f35a0c48498776a7478d7b4a0418e1e2b8cb9cb9731f2922aaad7f8 + languageName: node + linkType: hard + +"bl@npm:^4.0.3": + version: 4.1.0 + resolution: "bl@npm:4.1.0" + dependencies: + buffer: ^5.5.0 + inherits: ^2.0.4 + readable-stream: ^3.4.0 + checksum: 9e8521fa7e83aa9427c6f8ccdcba6e8167ef30cc9a22df26effcc5ab682ef91d2cbc23a239f945d099289e4bbcfae7a192e9c28c84c6202e710a0dfec3722662 + languageName: node + linkType: hard + +"blakejs@npm:^1.1.0": + version: 1.2.1 + resolution: "blakejs@npm:1.2.1" + checksum: d699ba116cfa21d0b01d12014a03e484dd76d483133e6dc9eb415aa70a119f08beb3bcefb8c71840106a00b542cba77383f8be60cd1f0d4589cb8afb922eefbe + languageName: node + linkType: hard + +"blueimp-md5@npm:^2.10.0": + version: 2.19.0 + resolution: "blueimp-md5@npm:2.19.0" + checksum: 28095dcbd2c67152a2938006e8d7c74c3406ba6556071298f872505432feb2c13241b0476644160ee0a5220383ba94cb8ccdac0053b51f68d168728f9c382530 + languageName: node + linkType: hard + +"bn.js@npm:^4.11.0, bn.js@npm:^4.11.8, bn.js@npm:^4.11.9": + version: 4.12.0 + resolution: "bn.js@npm:4.12.0" + checksum: 39afb4f15f4ea537b55eaf1446c896af28ac948fdcf47171961475724d1bb65118cca49fa6e3d67706e4790955ec0e74de584e45c8f1ef89f46c812bee5b5a12 + languageName: node + linkType: hard + +"bn.js@npm:^5.2.0, bn.js@npm:^5.2.1": + version: 5.2.1 + resolution: "bn.js@npm:5.2.1" + checksum: 3dd8c8d38055fedfa95c1d5fc3c99f8dd547b36287b37768db0abab3c239711f88ff58d18d155dd8ad902b0b0cee973747b7ae20ea12a09473272b0201c9edd3 + languageName: node + linkType: hard + +"body-parser@npm:1.20.1": + version: 1.20.1 + resolution: "body-parser@npm:1.20.1" + dependencies: + bytes: 3.1.2 + content-type: ~1.0.4 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.11.0 + raw-body: 2.5.1 + type-is: ~1.6.18 + unpipe: 1.0.0 + checksum: f1050dbac3bede6a78f0b87947a8d548ce43f91ccc718a50dd774f3c81f2d8b04693e52acf62659fad23101827dd318da1fb1363444ff9a8482b886a3e4a5266 + languageName: node + linkType: hard + +"bonjour-service@npm:^1.0.11": + version: 1.1.1 + resolution: "bonjour-service@npm:1.1.1" + dependencies: + array-flatten: ^2.1.2 + dns-equal: ^1.0.0 + fast-deep-equal: ^3.1.3 + multicast-dns: ^7.2.5 + checksum: 832d0cf78b91368fac8bb11fd7a714e46f4c4fb1bb14d7283bce614a6fb3aae2f3fe209aba5b4fa051811c1cab6921d073a83db8432fb23292f27dd4161fb0f1 + languageName: node + linkType: hard + +"boolbase@npm:^1.0.0": + version: 1.0.0 + resolution: "boolbase@npm:1.0.0" + checksum: 3e25c80ef626c3a3487c73dbfc70ac322ec830666c9ad915d11b701142fab25ec1e63eff2c450c74347acfd2de854ccde865cd79ef4db1683f7c7b046ea43bb0 + languageName: node + linkType: hard + +"boxen@npm:^5.0.0": + version: 5.1.2 + resolution: "boxen@npm:5.1.2" + dependencies: + ansi-align: ^3.0.0 + camelcase: ^6.2.0 + chalk: ^4.1.0 + cli-boxes: ^2.2.1 + string-width: ^4.2.2 + type-fest: ^0.20.2 + widest-line: ^3.1.0 + wrap-ansi: ^7.0.0 + checksum: 82d03e42a72576ff235123f17b7c505372fe05c83f75f61e7d4fa4bcb393897ec95ce766fecb8f26b915f0f7a7227d66e5ec7cef43f5b2bd9d3aeed47ec55877 + languageName: node + linkType: hard + +"boxen@npm:^6.2.1": + version: 6.2.1 + resolution: "boxen@npm:6.2.1" + dependencies: + ansi-align: ^3.0.1 + camelcase: ^6.2.0 + chalk: ^4.1.2 + cli-boxes: ^3.0.0 + string-width: ^5.0.1 + type-fest: ^2.5.0 + widest-line: ^4.0.1 + wrap-ansi: ^8.0.1 + checksum: 2b3226092f1ff8e149c02979098c976552afa15f9e0231c9ed2dfcaaf84604494d16a6f13b647f718439f64d3140a088e822d47c7db00d2266e9ffc8d7321774 + languageName: node + linkType: hard + +"bplist-parser@npm:^0.2.0": + version: 0.2.0 + resolution: "bplist-parser@npm:0.2.0" + dependencies: + big-integer: ^1.6.44 + checksum: d5339dd16afc51de6c88f88f58a45b72ed6a06aa31f5557d09877575f220b7c1d3fbe375da0b62e6a10d4b8ed80523567e351f24014f5bc886ad523758142cdd + languageName: node + linkType: hard + +"brace-expansion@npm:^1.1.7": + version: 1.1.11 + resolution: "brace-expansion@npm:1.1.11" + dependencies: + balanced-match: ^1.0.0 + concat-map: 0.0.1 + checksum: faf34a7bb0c3fcf4b59c7808bc5d2a96a40988addf2e7e09dfbb67a2251800e0d14cd2bfc1aa79174f2f5095c54ff27f46fb1289fe2d77dac755b5eb3434cc07 + languageName: node + linkType: hard + +"brace-expansion@npm:^2.0.1": + version: 2.0.1 + resolution: "brace-expansion@npm:2.0.1" + dependencies: + balanced-match: ^1.0.0 + checksum: a61e7cd2e8a8505e9f0036b3b6108ba5e926b4b55089eeb5550cd04a471fe216c96d4fe7e4c7f995c728c554ae20ddfc4244cad10aef255e72b62930afd233d1 + languageName: node + linkType: hard + +"braces@npm:^3.0.2, braces@npm:~3.0.2": + version: 3.0.2 + resolution: "braces@npm:3.0.2" + dependencies: + fill-range: ^7.0.1 + checksum: e2a8e769a863f3d4ee887b5fe21f63193a891c68b612ddb4b68d82d1b5f3ff9073af066c343e9867a393fe4c2555dcb33e89b937195feb9c1613d259edfcd459 + languageName: node + linkType: hard + +"brorand@npm:^1.1.0": + version: 1.1.0 + resolution: "brorand@npm:1.1.0" + checksum: 8a05c9f3c4b46572dec6ef71012b1946db6cae8c7bb60ccd4b7dd5a84655db49fe043ecc6272e7ef1f69dc53d6730b9e2a3a03a8310509a3d797a618cbee52be + languageName: node + linkType: hard + +"browser-level@npm:^1.0.1": + version: 1.0.1 + resolution: "browser-level@npm:1.0.1" + dependencies: + abstract-level: ^1.0.2 + catering: ^2.1.1 + module-error: ^1.0.2 + run-parallel-limit: ^1.1.0 + checksum: 67fbc77ce832940bfa25073eccff279f512ad56f545deb996a5b23b02316f5e76f4a79d381acc27eda983f5c9a2566aaf9c97e4fdd0748288c4407307537a29b + languageName: node + linkType: hard + +"browser-stdout@npm:1.3.1": + version: 1.3.1 + resolution: "browser-stdout@npm:1.3.1" + checksum: b717b19b25952dd6af483e368f9bcd6b14b87740c3d226c2977a65e84666ffd67000bddea7d911f111a9b6ddc822b234de42d52ab6507bce4119a4cc003ef7b3 + languageName: node + linkType: hard + +"browserify-aes@npm:^1.2.0": + version: 1.2.0 + resolution: "browserify-aes@npm:1.2.0" + dependencies: + buffer-xor: ^1.0.3 + cipher-base: ^1.0.0 + create-hash: ^1.1.0 + evp_bytestokey: ^1.0.3 + inherits: ^2.0.1 + safe-buffer: ^5.0.1 + checksum: 4a17c3eb55a2aa61c934c286f34921933086bf6d67f02d4adb09fcc6f2fc93977b47d9d884c25619144fccd47b3b3a399e1ad8b3ff5a346be47270114bcf7104 + languageName: node + linkType: hard + +"browserslist@npm:^4.0.0, browserslist@npm:^4.14.5, browserslist@npm:^4.18.1, browserslist@npm:^4.21.10, browserslist@npm:^4.21.4, browserslist@npm:^4.21.9, browserslist@npm:^4.22.1": + version: 4.22.1 + resolution: "browserslist@npm:4.22.1" + dependencies: + caniuse-lite: ^1.0.30001541 + electron-to-chromium: ^1.4.535 + node-releases: ^2.0.13 + update-browserslist-db: ^1.0.13 + bin: + browserslist: cli.js + checksum: 7e6b10c53f7dd5d83fd2b95b00518889096382539fed6403829d447e05df4744088de46a571071afb447046abc3c66ad06fbc790e70234ec2517452e32ffd862 + languageName: node + linkType: hard + +"bs58@npm:^4.0.0": + version: 4.0.1 + resolution: "bs58@npm:4.0.1" + dependencies: + base-x: ^3.0.2 + checksum: b3c5365bb9e0c561e1a82f1a2d809a1a692059fae016be233a6127ad2f50a6b986467c3a50669ce4c18929dcccb297c5909314dd347a25a68c21b68eb3e95ac2 + languageName: node + linkType: hard + +"bs58check@npm:^2.1.2": + version: 2.1.2 + resolution: "bs58check@npm:2.1.2" + dependencies: + bs58: ^4.0.0 + create-hash: ^1.1.0 + safe-buffer: ^5.1.2 + checksum: 43bdf08a5dd04581b78f040bc4169480e17008da482ffe2a6507327bbc4fc5c28de0501f7faf22901cfe57fbca79cbb202ca529003fedb4cb8dccd265b38e54d + languageName: node + linkType: hard + +"buffer-crc32@npm:~0.2.3": + version: 0.2.13 + resolution: "buffer-crc32@npm:0.2.13" + checksum: 06252347ae6daca3453b94e4b2f1d3754a3b146a111d81c68924c22d91889a40623264e95e67955b1cb4a68cbedf317abeabb5140a9766ed248973096db5ce1c + languageName: node + linkType: hard + +"buffer-from@npm:^1.0.0": + version: 1.1.2 + resolution: "buffer-from@npm:1.1.2" + checksum: 0448524a562b37d4d7ed9efd91685a5b77a50672c556ea254ac9a6d30e3403a517d8981f10e565db24e8339413b43c97ca2951f10e399c6125a0d8911f5679bb + languageName: node + linkType: hard + +"buffer-xor@npm:^1.0.3": + version: 1.0.3 + resolution: "buffer-xor@npm:1.0.3" + checksum: 10c520df29d62fa6e785e2800e586a20fc4f6dfad84bcdbd12e1e8a83856de1cb75c7ebd7abe6d036bbfab738a6cf18a3ae9c8e5a2e2eb3167ca7399ce65373a + languageName: node + linkType: hard + +"buffer@npm:^5.2.1, buffer@npm:^5.5.0": + version: 5.7.1 + resolution: "buffer@npm:5.7.1" + dependencies: + base64-js: ^1.3.1 + ieee754: ^1.1.13 + checksum: e2cf8429e1c4c7b8cbd30834ac09bd61da46ce35f5c22a78e6c2f04497d6d25541b16881e30a019c6fd3154150650ccee27a308eff3e26229d788bbdeb08ab84 + languageName: node + linkType: hard + +"buffer@npm:^6.0.3": + version: 6.0.3 + resolution: "buffer@npm:6.0.3" + dependencies: + base64-js: ^1.3.1 + ieee754: ^1.2.1 + checksum: 5ad23293d9a731e4318e420025800b42bf0d264004c0286c8cc010af7a270c7a0f6522e84f54b9ad65cbd6db20b8badbfd8d2ebf4f80fa03dab093b89e68c3f9 + languageName: node + linkType: hard + +"builtin-modules@npm:^3.3.0": + version: 3.3.0 + resolution: "builtin-modules@npm:3.3.0" + checksum: db021755d7ed8be048f25668fe2117620861ef6703ea2c65ed2779c9e3636d5c3b82325bd912244293959ff3ae303afa3471f6a15bf5060c103e4cc3a839749d + languageName: node + linkType: hard + +"bundle-name@npm:^3.0.0": + version: 3.0.0 + resolution: "bundle-name@npm:3.0.0" + dependencies: + run-applescript: ^5.0.0 + checksum: edf2b1fbe6096ed32e7566947ace2ea937ee427391744d7510a2880c4b9a5b3543d3f6c551236a29e5c87d3195f8e2912516290e638c15bcbede7b37cc375615 + languageName: node + linkType: hard + +"bytes@npm:3.0.0": + version: 3.0.0 + resolution: "bytes@npm:3.0.0" + checksum: a2b386dd8188849a5325f58eef69c3b73c51801c08ffc6963eddc9be244089ba32d19347caf6d145c86f315ae1b1fc7061a32b0c1aa6379e6a719090287ed101 + languageName: node + linkType: hard + +"bytes@npm:3.1.2": + version: 3.1.2 + resolution: "bytes@npm:3.1.2" + checksum: e4bcd3948d289c5127591fbedf10c0b639ccbf00243504e4e127374a15c3bc8eed0d28d4aaab08ff6f1cf2abc0cce6ba3085ed32f4f90e82a5683ce0014e1b6e + languageName: node + linkType: hard + +"cacache@npm:^17.0.0": + version: 17.1.4 + resolution: "cacache@npm:17.1.4" + dependencies: + "@npmcli/fs": ^3.1.0 + fs-minipass: ^3.0.0 + glob: ^10.2.2 + lru-cache: ^7.7.1 + minipass: ^7.0.3 + minipass-collect: ^1.0.2 + minipass-flush: ^1.0.5 + minipass-pipeline: ^1.2.4 + p-map: ^4.0.0 + ssri: ^10.0.0 + tar: ^6.1.11 + unique-filename: ^3.0.0 + checksum: b7751df756656954a51201335addced8f63fc53266fa56392c9f5ae83c8d27debffb4458ac2d168a744a4517ec3f2163af05c20097f93d17bdc2dc8a385e14a6 + languageName: node + linkType: hard + +"cache-content-type@npm:^1.0.0": + version: 1.0.1 + resolution: "cache-content-type@npm:1.0.1" + dependencies: + mime-types: ^2.1.18 + ylru: ^1.2.0 + checksum: 18db4d59452669ccbfd7146a1510a37eb28e9eccf18ca7a4eb603dff2edc5cccdca7498fc3042a2978f76f11151fba486eb9eb69d9afa3fb124957870aef4fd3 + languageName: node + linkType: hard + +"cacheable-request@npm:^6.0.0": + version: 6.1.0 + resolution: "cacheable-request@npm:6.1.0" + dependencies: + clone-response: ^1.0.2 + get-stream: ^5.1.0 + http-cache-semantics: ^4.0.0 + keyv: ^3.0.0 + lowercase-keys: ^2.0.0 + normalize-url: ^4.1.0 + responselike: ^1.0.2 + checksum: b510b237b18d17e89942e9ee2d2a077cb38db03f12167fd100932dfa8fc963424bfae0bfa1598df4ae16c944a5484e43e03df8f32105b04395ee9495e9e4e9f1 + languageName: node + linkType: hard + +"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2": + version: 1.0.2 + resolution: "call-bind@npm:1.0.2" + dependencies: + function-bind: ^1.1.1 + get-intrinsic: ^1.0.2 + checksum: f8e31de9d19988a4b80f3e704788c4a2d6b6f3d17cfec4f57dc29ced450c53a49270dc66bf0fbd693329ee948dd33e6c90a329519aef17474a4d961e8d6426b0 + languageName: node + linkType: hard + +"callsites@npm:^3.0.0": + version: 3.1.0 + resolution: "callsites@npm:3.1.0" + checksum: 072d17b6abb459c2ba96598918b55868af677154bec7e73d222ef95a8fdb9bbf7dae96a8421085cdad8cd190d86653b5b6dc55a4484f2e5b2e27d5e0c3fc15b3 + languageName: node + linkType: hard + +"callsites@npm:^4.0.0": + version: 4.1.0 + resolution: "callsites@npm:4.1.0" + checksum: 4ad31de7b7615fa25bdab9c2373865209d2d5190f895cdf2e2f518bd1dafa7ebcda2e6e9cc9640f2dfde6b3893d82fa4359a78ffc27baad2503227553c6882fa + languageName: node + linkType: hard + +"camel-case@npm:^4.1.2": + version: 4.1.2 + resolution: "camel-case@npm:4.1.2" + dependencies: + pascal-case: ^3.1.2 + tslib: ^2.0.3 + checksum: bcbd25cd253b3cbc69be3f535750137dbf2beb70f093bdc575f73f800acc8443d34fd52ab8f0a2413c34f1e8203139ffc88428d8863e4dfe530cfb257a379ad6 + languageName: node + linkType: hard + +"camelcase-css@npm:2.0.1": + version: 2.0.1 + resolution: "camelcase-css@npm:2.0.1" + checksum: 1cec2b3b3dcb5026688a470b00299a8db7d904c4802845c353dbd12d9d248d3346949a814d83bfd988d4d2e5b9904c07efe76fecd195a1d4f05b543e7c0b56b1 + languageName: node + linkType: hard + +"camelcase@npm:^6.0.0, camelcase@npm:^6.2.0": + version: 6.3.0 + resolution: "camelcase@npm:6.3.0" + checksum: 8c96818a9076434998511251dcb2761a94817ea17dbdc37f47ac080bd088fc62c7369429a19e2178b993497132c8cbcf5cc1f44ba963e76782ba469c0474938d + languageName: node + linkType: hard + +"caniuse-api@npm:^3.0.0": + version: 3.0.0 + resolution: "caniuse-api@npm:3.0.0" + dependencies: + browserslist: ^4.0.0 + caniuse-lite: ^1.0.0 + lodash.memoize: ^4.1.2 + lodash.uniq: ^4.5.0 + checksum: db2a229383b20d0529b6b589dde99d7b6cb56ba371366f58cbbfa2929c9f42c01f873e2b6ef641d4eda9f0b4118de77dbb2805814670bdad4234bf08e720b0b4 + languageName: node + linkType: hard + +"caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001538, caniuse-lite@npm:^1.0.30001541": + version: 1.0.30001549 + resolution: "caniuse-lite@npm:1.0.30001549" + checksum: 7f2abeedc8cf8b92cc0613855d71b995ce436068c0bcdd798c5af7d297ccf9f52496b00181beda42d82d25079dd4b6e389c67486156d40d8854e5707a25cb054 + languageName: node + linkType: hard + +"case@npm:^1.6.3": + version: 1.6.3 + resolution: "case@npm:1.6.3" + checksum: febe73278f910b0d28aab7efd6f51c235f9aa9e296148edb56dfb83fd58faa88308c30ce9a0122b6e53e0362c44f4407105bd5ef89c46860fc2b184e540fd68d + languageName: node + linkType: hard + +"catering@npm:^2.1.0, catering@npm:^2.1.1": + version: 2.1.1 + resolution: "catering@npm:2.1.1" + checksum: 205daefa69c935b0c19f3d8f2e0a520dd69aebe9bda55902958003f7c9cff8f967dfb90071b421bd6eb618576f657a89d2bc0986872c9bc04bbd66655e9d4bd6 + languageName: node + linkType: hard + +"cbor@npm:^8.1.0": + version: 8.1.0 + resolution: "cbor@npm:8.1.0" + dependencies: + nofilter: ^3.1.0 + checksum: a90338435dc7b45cc01461af979e3bb6ddd4f2a08584c437586039cd5f2235014c06e49d664295debbfb3514d87b2f06728092ab6aa6175e2e85e9cd7dc0c1fd + languageName: node + linkType: hard + +"ccount@npm:^1.0.0": + version: 1.1.0 + resolution: "ccount@npm:1.1.0" + checksum: b335a79d0aa4308919cf7507babcfa04ac63d389ebed49dbf26990d4607c8a4713cde93cc83e707d84571ddfe1e7615dad248be9bc422ae4c188210f71b08b78 + languageName: node + linkType: hard + +"chai-as-promised@npm:^7.1.1": + version: 7.1.1 + resolution: "chai-as-promised@npm:7.1.1" + dependencies: + check-error: ^1.0.2 + peerDependencies: + chai: ">= 2.1.2 < 5" + checksum: 7262868a5b51a12af4e432838ddf97a893109266a505808e1868ba63a12de7ee1166e9d43b5c501a190c377c1b11ecb9ff8e093c89f097ad96c397e8ec0f8d6a + languageName: node + linkType: hard + +"chai@npm:^4.3.7, chai@npm:^4.3.8": + version: 4.3.8 + resolution: "chai@npm:4.3.8" + dependencies: + assertion-error: ^1.1.0 + check-error: ^1.0.2 + deep-eql: ^4.1.2 + get-func-name: ^2.0.0 + loupe: ^2.3.1 + pathval: ^1.1.1 + type-detect: ^4.0.5 + checksum: 29e0984ed13308319cadc35437c8ef0a3e271544d226c991bf7e3b6d771bf89707321669e11d05e362bc0ad0bd26585079b989d1032f3c106e3bb95d7f079cce + languageName: node + linkType: hard + +"chalk-template@npm:^0.4.0": + version: 0.4.0 + resolution: "chalk-template@npm:0.4.0" + dependencies: + chalk: ^4.1.2 + checksum: 6c706802a79a7963cbce18f022b046fe86e438a67843151868852f80ea7346e975a6a9749991601e7e5d3b6a6c4852a04c53dc966a9a3d04031bd0e0ed53c819 + languageName: node + linkType: hard + +"chalk@npm:^2.4.2": + version: 2.4.2 + resolution: "chalk@npm:2.4.2" + dependencies: + ansi-styles: ^3.2.1 + escape-string-regexp: ^1.0.5 + supports-color: ^5.3.0 + checksum: ec3661d38fe77f681200f878edbd9448821924e0f93a9cefc0e26a33b145f1027a2084bf19967160d11e1f03bfe4eaffcabf5493b89098b2782c3fe0b03d80c2 + languageName: node + linkType: hard + +"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2": + version: 4.1.2 + resolution: "chalk@npm:4.1.2" + dependencies: + ansi-styles: ^4.1.0 + supports-color: ^7.1.0 + checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc + languageName: node + linkType: hard + +"chalk@npm:^5.0.1, chalk@npm:^5.2.0": + version: 5.3.0 + resolution: "chalk@npm:5.3.0" + checksum: 623922e077b7d1e9dedaea6f8b9e9352921f8ae3afe739132e0e00c275971bdd331268183b2628cf4ab1727c45ea1f28d7e24ac23ce1db1eb653c414ca8a5a80 + languageName: node + linkType: hard + +"character-entities-legacy@npm:^1.0.0": + version: 1.1.4 + resolution: "character-entities-legacy@npm:1.1.4" + checksum: fe03a82c154414da3a0c8ab3188e4237ec68006cbcd681cf23c7cfb9502a0e76cd30ab69a2e50857ca10d984d57de3b307680fff5328ccd427f400e559c3a811 + languageName: node + linkType: hard + +"character-entities@npm:^1.0.0": + version: 1.2.4 + resolution: "character-entities@npm:1.2.4" + checksum: e1545716571ead57beac008433c1ff69517cd8ca5b336889321c5b8ff4a99c29b65589a701e9c086cda8a5e346a67295e2684f6c7ea96819fe85cbf49bf8686d + languageName: node + linkType: hard + +"character-reference-invalid@npm:^1.0.0": + version: 1.1.4 + resolution: "character-reference-invalid@npm:1.1.4" + checksum: 20274574c70e05e2f81135f3b93285536bc8ff70f37f0809b0d17791a832838f1e49938382899ed4cb444e5bbd4314ca1415231344ba29f4222ce2ccf24fea0b + languageName: node + linkType: hard + +"check-error@npm:^1.0.2": + version: 1.0.2 + resolution: "check-error@npm:1.0.2" + checksum: d9d106504404b8addd1ee3f63f8c0eaa7cd962a1a28eb9c519b1c4a1dc7098be38007fc0060f045ee00f075fbb7a2a4f42abcf61d68323677e11ab98dc16042e + languageName: node + linkType: hard + +"cheerio-select@npm:^2.1.0": + version: 2.1.0 + resolution: "cheerio-select@npm:2.1.0" + dependencies: + boolbase: ^1.0.0 + css-select: ^5.1.0 + css-what: ^6.1.0 + domelementtype: ^2.3.0 + domhandler: ^5.0.3 + domutils: ^3.0.1 + checksum: 843d6d479922f28a6c5342c935aff1347491156814de63c585a6eb73baf7bb4185c1b4383a1195dca0f12e3946d737c7763bcef0b9544c515d905c5c44c5308b + languageName: node + linkType: hard + +"cheerio@npm:^1.0.0-rc.12, cheerio@npm:^1.0.0-rc.3": + version: 1.0.0-rc.12 + resolution: "cheerio@npm:1.0.0-rc.12" + dependencies: + cheerio-select: ^2.1.0 + dom-serializer: ^2.0.0 + domhandler: ^5.0.3 + domutils: ^3.0.1 + htmlparser2: ^8.0.1 + parse5: ^7.0.0 + parse5-htmlparser2-tree-adapter: ^7.0.0 + checksum: 5d4c1b7a53cf22d3a2eddc0aff70cf23cbb30d01a4c79013e703a012475c02461aa1fcd99127e8d83a02216386ed6942b2c8103845fd0812300dd199e6e7e054 + languageName: node + linkType: hard + +"chokidar@npm:3.5.3, chokidar@npm:^3.4.0, chokidar@npm:^3.4.2, chokidar@npm:^3.4.3, chokidar@npm:^3.5.3": + version: 3.5.3 + resolution: "chokidar@npm:3.5.3" + dependencies: + anymatch: ~3.1.2 + braces: ~3.0.2 + fsevents: ~2.3.2 + glob-parent: ~5.1.2 + is-binary-path: ~2.1.0 + is-glob: ~4.0.1 + normalize-path: ~3.0.0 + readdirp: ~3.6.0 + dependenciesMeta: + fsevents: + optional: true + checksum: b49fcde40176ba007ff361b198a2d35df60d9bb2a5aab228279eb810feae9294a6b4649ab15981304447afe1e6ffbf4788ad5db77235dc770ab777c6e771980c + languageName: node + linkType: hard + +"chownr@npm:^1.1.1": + version: 1.1.4 + resolution: "chownr@npm:1.1.4" + checksum: 115648f8eb38bac5e41c3857f3e663f9c39ed6480d1349977c4d96c95a47266fcacc5a5aabf3cb6c481e22d72f41992827db47301851766c4fd77ac21a4f081d + languageName: node + linkType: hard + +"chownr@npm:^2.0.0": + version: 2.0.0 + resolution: "chownr@npm:2.0.0" + checksum: c57cf9dd0791e2f18a5ee9c1a299ae6e801ff58fee96dc8bfd0dcb4738a6ce58dd252a3605b1c93c6418fe4f9d5093b28ffbf4d66648cb2a9c67eaef9679be2f + languageName: node + linkType: hard + +"chrome-launcher@npm:^0.15.0": + version: 0.15.2 + resolution: "chrome-launcher@npm:0.15.2" + dependencies: + "@types/node": "*" + escape-string-regexp: ^4.0.0 + is-wsl: ^2.2.0 + lighthouse-logger: ^1.0.0 + bin: + print-chrome-path: bin/print-chrome-path.js + checksum: e1f8131b9f7bd931248ea85f413c6cdb93a0d41440ff5bf0987f36afb081d2b2c7b60ba6062ee7ae2dd9b052143f6b275b38c9eb115d11b49c3ea8829bad7db0 + languageName: node + linkType: hard + +"chrome-trace-event@npm:^1.0.2": + version: 1.0.3 + resolution: "chrome-trace-event@npm:1.0.3" + checksum: cb8b1fc7e881aaef973bd0c4a43cd353c2ad8323fb471a041e64f7c2dd849cde4aad15f8b753331a32dda45c973f032c8a03b8177fc85d60eaa75e91e08bfb97 + languageName: node + linkType: hard + +"chromium-bidi@npm:0.4.7": + version: 0.4.7 + resolution: "chromium-bidi@npm:0.4.7" + dependencies: + mitt: 3.0.0 + peerDependencies: + devtools-protocol: "*" + checksum: eec7581e2eddd2c95014c6edc5aae0b036c79bbeadee05166436b16139b6932c902c5ce21d95ed919a592f58d3a47c5469dc5f3de2a300700b2748ab119ad65e + languageName: node + linkType: hard + +"chunkd@npm:^2.0.1": + version: 2.0.1 + resolution: "chunkd@npm:2.0.1" + checksum: bab8cc08c752a3648984385dc6f61d751e89dbeef648d22a3b661e1d470eaa0f5182f0b4303710f13ae83d2f85144f8eb2dde7a975861d9021b5c56b881f457b + languageName: node + linkType: hard + +"ci-info@npm:^2.0.0": + version: 2.0.0 + resolution: "ci-info@npm:2.0.0" + checksum: 3b374666a85ea3ca43fa49aa3a048d21c9b475c96eb13c133505d2324e7ae5efd6a454f41efe46a152269e9b6a00c9edbe63ec7fa1921957165aae16625acd67 + languageName: node + linkType: hard + +"ci-info@npm:^3.2.0": + version: 3.9.0 + resolution: "ci-info@npm:3.9.0" + checksum: 6b19dc9b2966d1f8c2041a838217299718f15d6c4b63ae36e4674edd2bee48f780e94761286a56aa59eb305a85fbea4ddffb7630ec063e7ec7e7e5ad42549a87 + languageName: node + linkType: hard + +"ci-info@npm:^3.8.0": + version: 3.8.0 + resolution: "ci-info@npm:3.8.0" + checksum: d0a4d3160497cae54294974a7246202244fff031b0a6ea20dd57b10ec510aa17399c41a1b0982142c105f3255aff2173e5c0dd7302ee1b2f28ba3debda375098 + languageName: node + linkType: hard + +"ci-parallel-vars@npm:^1.0.1": + version: 1.0.1 + resolution: "ci-parallel-vars@npm:1.0.1" + checksum: ae859831f7e8e3585db731b8306c336616e37bd709dad1d7775ea4c0731aefd94741dabb48201edc6827d000008fd7fb72cb977967614ee2d99d6b499f0c35fe + languageName: node + linkType: hard + +"cipher-base@npm:^1.0.0, cipher-base@npm:^1.0.1, cipher-base@npm:^1.0.3": + version: 1.0.4 + resolution: "cipher-base@npm:1.0.4" + dependencies: + inherits: ^2.0.1 + safe-buffer: ^5.0.1 + checksum: 47d3568dbc17431a339bad1fe7dff83ac0891be8206911ace3d3b818fc695f376df809bea406e759cdea07fff4b454fa25f1013e648851bec790c1d75763032e + languageName: node + linkType: hard + +"classic-level@npm:^1.2.0": + version: 1.3.0 + resolution: "classic-level@npm:1.3.0" + dependencies: + abstract-level: ^1.0.2 + catering: ^2.1.0 + module-error: ^1.0.1 + napi-macros: ^2.2.2 + node-gyp: latest + node-gyp-build: ^4.3.0 + checksum: 773da48aef52a041115d413fee8340b357a4da2eb505764f327183b155edd7cc9d24819eb4f707c83dbdae8588024f5dddeb322125567c59d5d1f6f16334cdb9 + languageName: node + linkType: hard + +"clean-css@npm:^5.2.2, clean-css@npm:^5.3.0": + version: 5.3.2 + resolution: "clean-css@npm:5.3.2" + dependencies: + source-map: ~0.6.0 + checksum: 8787b281acc9878f309b5f835d410085deedfd4e126472666773040a6a8a72f472a1d24185947d23b87b1c419bf2c5ed429395d5c5ff8279c98b05d8011e9758 + languageName: node + linkType: hard + +"clean-stack@npm:^2.0.0": + version: 2.2.0 + resolution: "clean-stack@npm:2.2.0" + checksum: 2ac8cd2b2f5ec986a3c743935ec85b07bc174d5421a5efc8017e1f146a1cf5f781ae962618f416352103b32c9cd7e203276e8c28241bbe946160cab16149fb68 + languageName: node + linkType: hard + +"clean-stack@npm:^4.0.0": + version: 4.2.0 + resolution: "clean-stack@npm:4.2.0" + dependencies: + escape-string-regexp: 5.0.0 + checksum: 373f656a31face5c615c0839213b9b542a0a48057abfb1df66900eab4dc2a5c6097628e4a0b5aa559cdfc4e66f8a14ea47be9681773165a44470ef5fb8ccc172 + languageName: node + linkType: hard + +"clean-yaml-object@npm:^0.1.0": + version: 0.1.0 + resolution: "clean-yaml-object@npm:0.1.0" + checksum: 0374ad2f1fbd4984ecf56ebc62200092f6372b9ccf1b7971bb979c328fb12fe76e759fb1e8adc491c80b7b1861f9f00c7f19813dd2a0f49c88231422c70451f4 + languageName: node + linkType: hard + +"cli-boxes@npm:^2.2.1": + version: 2.2.1 + resolution: "cli-boxes@npm:2.2.1" + checksum: be79f8ec23a558b49e01311b39a1ea01243ecee30539c880cf14bf518a12e223ef40c57ead0cb44f509bffdffc5c129c746cd50d863ab879385370112af4f585 + languageName: node + linkType: hard + +"cli-boxes@npm:^3.0.0": + version: 3.0.0 + resolution: "cli-boxes@npm:3.0.0" + checksum: 637d84419d293a9eac40a1c8c96a2859e7d98b24a1a317788e13c8f441be052fc899480c6acab3acc82eaf1bccda6b7542d7cdcf5c9c3cc39227175dc098d5b2 + languageName: node + linkType: hard + +"cli-cursor@npm:^3.1.0": + version: 3.1.0 + resolution: "cli-cursor@npm:3.1.0" + dependencies: + restore-cursor: ^3.1.0 + checksum: 2692784c6cd2fd85cfdbd11f53aea73a463a6d64a77c3e098b2b4697a20443f430c220629e1ca3b195ea5ac4a97a74c2ee411f3807abf6df2b66211fec0c0a29 + languageName: node + linkType: hard + +"cli-table3@npm:^0.6.2": + version: 0.6.3 + resolution: "cli-table3@npm:0.6.3" + dependencies: + "@colors/colors": 1.5.0 + string-width: ^4.2.0 + dependenciesMeta: + "@colors/colors": + optional: true + checksum: 09897f68467973f827c04e7eaadf13b55f8aec49ecd6647cc276386ea660059322e2dd8020a8b6b84d422dbdd619597046fa89cbbbdc95b2cea149a2df7c096c + languageName: node + linkType: hard + +"cli-truncate@npm:^3.1.0": + version: 3.1.0 + resolution: "cli-truncate@npm:3.1.0" + dependencies: + slice-ansi: ^5.0.0 + string-width: ^5.0.0 + checksum: c3243e41974445691c63f8b405df1d5a24049dc33d324fe448dc572e561a7b772ae982692900b1a5960901cc4fc7def25a629b9c69a4208ee89d12ab3332617a + languageName: node + linkType: hard + +"cliui@npm:^7.0.2": + version: 7.0.4 + resolution: "cliui@npm:7.0.4" + dependencies: + string-width: ^4.2.0 + strip-ansi: ^6.0.0 + wrap-ansi: ^7.0.0 + checksum: ce2e8f578a4813806788ac399b9e866297740eecd4ad1823c27fd344d78b22c5f8597d548adbcc46f0573e43e21e751f39446c5a5e804a12aace402b7a315d7f + languageName: node + linkType: hard + +"cliui@npm:^8.0.1": + version: 8.0.1 + resolution: "cliui@npm:8.0.1" + dependencies: + string-width: ^4.2.0 + strip-ansi: ^6.0.1 + wrap-ansi: ^7.0.0 + checksum: 79648b3b0045f2e285b76fb2e24e207c6db44323581e421c3acbd0e86454cba1b37aea976ab50195a49e7384b871e6dfb2247ad7dec53c02454ac6497394cb56 + languageName: node + linkType: hard + +"clone-deep@npm:^4.0.1": + version: 4.0.1 + resolution: "clone-deep@npm:4.0.1" + dependencies: + is-plain-object: ^2.0.4 + kind-of: ^6.0.2 + shallow-clone: ^3.0.0 + checksum: 770f912fe4e6f21873c8e8fbb1e99134db3b93da32df271d00589ea4a29dbe83a9808a322c93f3bcaf8584b8b4fa6fc269fc8032efbaa6728e0c9886c74467d2 + languageName: node + linkType: hard + +"clone-response@npm:^1.0.2": + version: 1.0.3 + resolution: "clone-response@npm:1.0.3" + dependencies: + mimic-response: ^1.0.0 + checksum: 4e671cac39b11c60aa8ba0a450657194a5d6504df51bca3fac5b3bd0145c4f8e8464898f87c8406b83232e3bc5cca555f51c1f9c8ac023969ebfbf7f6bdabb2e + languageName: node + linkType: hard + +"clone@npm:^2.1.2": + version: 2.1.2 + resolution: "clone@npm:2.1.2" + checksum: aaf106e9bc025b21333e2f4c12da539b568db4925c0501a1bf4070836c9e848c892fa22c35548ce0d1132b08bbbfa17a00144fe58fccdab6fa900fec4250f67d + languageName: node + linkType: hard + +"clsx@npm:^1.1.1, clsx@npm:^1.2.1": + version: 1.2.1 + resolution: "clsx@npm:1.2.1" + checksum: 30befca8019b2eb7dbad38cff6266cf543091dae2825c856a62a8ccf2c3ab9c2907c4d12b288b73101196767f66812365400a227581484a05f968b0307cfaf12 + languageName: node + linkType: hard + +"co-body@npm:^6.1.0": + version: 6.1.0 + resolution: "co-body@npm:6.1.0" + dependencies: + inflation: ^2.0.0 + qs: ^6.5.2 + raw-body: ^2.3.3 + type-is: ^1.6.16 + checksum: d0a78831a6651f2085fce16b0ecdc49f45fb5baf4f94148c2f499e7ec89d188205362548b9c500eae15a819360cfda208079e68a72c204cf66ca3ffa2fc0f57e + languageName: node + linkType: hard + +"co@npm:^4.6.0": + version: 4.6.0 + resolution: "co@npm:4.6.0" + checksum: 5210d9223010eb95b29df06a91116f2cf7c8e0748a9013ed853b53f362ea0e822f1e5bb054fb3cefc645239a4cf966af1f6133a3b43f40d591f3b68ed6cf0510 + languageName: node + linkType: hard + +"code-excerpt@npm:^4.0.0": + version: 4.0.0 + resolution: "code-excerpt@npm:4.0.0" + dependencies: + convert-to-spaces: ^2.0.1 + checksum: d57137d8f4825879283a828cc02a1115b56858dc54ed06c625c8f67d6685d1becd2fbaa7f0ab19ecca1f5cca03f8c97bbc1f013cab40261e4d3275032e65efe9 + languageName: node + linkType: hard + +"collapse-white-space@npm:^1.0.2": + version: 1.0.6 + resolution: "collapse-white-space@npm:1.0.6" + checksum: 9673fb797952c5c888341435596c69388b22cd5560c8cd3f40edb72734a9c820f56a7c9525166bcb7068b5d5805372e6fd0c4b9f2869782ad070cb5d3faf26e7 + languageName: node + linkType: hard + +"color-convert@npm:^1.9.0": + version: 1.9.3 + resolution: "color-convert@npm:1.9.3" + dependencies: + color-name: 1.1.3 + checksum: fd7a64a17cde98fb923b1dd05c5f2e6f7aefda1b60d67e8d449f9328b4e53b228a428fd38bfeaeb2db2ff6b6503a776a996150b80cdf224062af08a5c8a3a203 + languageName: node + linkType: hard + +"color-convert@npm:^2.0.1": + version: 2.0.1 + resolution: "color-convert@npm:2.0.1" + dependencies: + color-name: ~1.1.4 + checksum: 79e6bdb9fd479a205c71d89574fccfb22bd9053bd98c6c4d870d65c132e5e904e6034978e55b43d69fcaa7433af2016ee203ce76eeba9cfa554b373e7f7db336 + languageName: node + linkType: hard + +"color-name@npm:1.1.3": + version: 1.1.3 + resolution: "color-name@npm:1.1.3" + checksum: 09c5d3e33d2105850153b14466501f2bfb30324a2f76568a408763a3b7433b0e50e5b4ab1947868e65cb101bb7cb75029553f2c333b6d4b8138a73fcc133d69d + languageName: node + linkType: hard + +"color-name@npm:~1.1.4": + version: 1.1.4 + resolution: "color-name@npm:1.1.4" + checksum: b0445859521eb4021cd0fb0cc1a75cecf67fceecae89b63f62b201cca8d345baf8b952c966862a9d9a2632987d4f6581f0ec8d957dfacece86f0a7919316f610 + languageName: node + linkType: hard + +"color-support@npm:^1.1.3": + version: 1.1.3 + resolution: "color-support@npm:1.1.3" + bin: + color-support: bin.js + checksum: 9b7356817670b9a13a26ca5af1c21615463b500783b739b7634a0c2047c16cef4b2865d7576875c31c3cddf9dd621fa19285e628f20198b233a5cfdda6d0793b + languageName: node + linkType: hard + +"colord@npm:^2.9.1": + version: 2.9.3 + resolution: "colord@npm:2.9.3" + checksum: 95d909bfbcfd8d5605cbb5af56f2d1ce2b323990258fd7c0d2eb0e6d3bb177254d7fb8213758db56bb4ede708964f78c6b992b326615f81a18a6aaf11d64c650 + languageName: node + linkType: hard + +"colorette@npm:^2.0.10": + version: 2.0.20 + resolution: "colorette@npm:2.0.20" + checksum: 0c016fea2b91b733eb9f4bcdb580018f52c0bc0979443dad930e5037a968237ac53d9beb98e218d2e9235834f8eebce7f8e080422d6194e957454255bde71d3d + languageName: node + linkType: hard + +"combine-promises@npm:^1.1.0": + version: 1.2.0 + resolution: "combine-promises@npm:1.2.0" + checksum: ddce91436e24da03d5dc360c59cd55abfc9da5e949a26255aa42761925c574797c43138f0aabfc364e184e738e5e218a94ac6e88ebc459045bcf048ac7fe5f07 + languageName: node + linkType: hard + +"combined-stream@npm:^1.0.8": + version: 1.0.8 + resolution: "combined-stream@npm:1.0.8" + dependencies: + delayed-stream: ~1.0.0 + checksum: 49fa4aeb4916567e33ea81d088f6584749fc90c7abec76fd516bf1c5aa5c79f3584b5ba3de6b86d26ddd64bae5329c4c7479343250cfe71c75bb366eae53bb7c + languageName: node + linkType: hard + +"comlink@npm:^4.4.1": + version: 4.4.1 + resolution: "comlink@npm:4.4.1" + checksum: 16d58a8f590087fc45432e31d6c138308dfd4b75b89aec0b7f7bb97ad33d810381bd2b1e608a1fb2cf05979af9cbfcdcaf1715996d5fcf77aeb013b6da3260af + languageName: node + linkType: hard + +"comma-separated-tokens@npm:^1.0.0": + version: 1.0.8 + resolution: "comma-separated-tokens@npm:1.0.8" + checksum: 0adcb07174fa4d08cf0f5c8e3aec40a36b5ff0c2c720e5e23f50fe02e6789d1d00a67036c80e0c1e1539f41d3e7f0101b074039dd833b4e4a59031b659d6ca0d + languageName: node + linkType: hard + +"command-exists@npm:^1.2.8": + version: 1.2.9 + resolution: "command-exists@npm:1.2.9" + checksum: 729ae3d88a2058c93c58840f30341b7f82688a573019535d198b57a4d8cb0135ced0ad7f52b591e5b28a90feb2c675080ce916e56254a0f7c15cb2395277cac3 + languageName: node + linkType: hard + +"command-line-args@npm:^5.1.1, command-line-args@npm:^5.2.1": + version: 5.2.1 + resolution: "command-line-args@npm:5.2.1" + dependencies: + array-back: ^3.1.0 + find-replace: ^3.0.0 + lodash.camelcase: ^4.3.0 + typical: ^4.0.0 + checksum: e759519087be3cf2e86af8b9a97d3058b4910cd11ee852495be881a067b72891f6a32718fb685ee6d41531ab76b2b7bfb6602f79f882cd4b7587ff1e827982c7 + languageName: node + linkType: hard + +"command-line-usage@npm:^6.1.0": + version: 6.1.3 + resolution: "command-line-usage@npm:6.1.3" + dependencies: + array-back: ^4.0.2 + chalk: ^2.4.2 + table-layout: ^1.0.2 + typical: ^5.2.0 + checksum: 8261d4e5536eb0bcddee0ec5e89c05bb2abd18e5760785c8078ede5020bc1c612cbe28eb6586f5ed4a3660689748e5aaad4a72f21566f4ef39393694e2fa1a0b + languageName: node + linkType: hard + +"command-line-usage@npm:^7.0.0, command-line-usage@npm:^7.0.1": + version: 7.0.1 + resolution: "command-line-usage@npm:7.0.1" + dependencies: + array-back: ^6.2.2 + chalk-template: ^0.4.0 + table-layout: ^3.0.0 + typical: ^7.1.1 + checksum: ac78ad6b83b9622bb111ae8e82205bde1d2da74df237fdd0bd7d98eda3592c8933ec600818b0b028b2313ddca638b1b60f0780dd9457ad4a0384b17156641f79 + languageName: node + linkType: hard + +"commander@npm:3.0.2": + version: 3.0.2 + resolution: "commander@npm:3.0.2" + checksum: 6d14ad030d1904428139487ed31febcb04c1604db2b8d9fae711f60ee6718828dc0e11602249e91c8a97b0e721e9c6d53edbc166bad3cde1596851d59a8f824d + languageName: node + linkType: hard + +"commander@npm:^10.0.1": + version: 10.0.1 + resolution: "commander@npm:10.0.1" + checksum: 436901d64a818295803c1996cd856621a74f30b9f9e28a588e726b2b1670665bccd7c1a77007ebf328729f0139838a88a19265858a0fa7a8728c4656796db948 + languageName: node + linkType: hard + +"commander@npm:^2.20.0": + version: 2.20.3 + resolution: "commander@npm:2.20.3" + checksum: ab8c07884e42c3a8dbc5dd9592c606176c7eb5c1ca5ff274bcf907039b2c41de3626f684ea75ccf4d361ba004bbaff1f577d5384c155f3871e456bdf27becf9e + languageName: node + linkType: hard + +"commander@npm:^5.1.0": + version: 5.1.0 + resolution: "commander@npm:5.1.0" + checksum: 0b7fec1712fbcc6230fcb161d8d73b4730fa91a21dc089515489402ad78810547683f058e2a9835929c212fead1d6a6ade70db28bbb03edbc2829a9ab7d69447 + languageName: node + linkType: hard + +"commander@npm:^7.2.0": + version: 7.2.0 + resolution: "commander@npm:7.2.0" + checksum: 53501cbeee61d5157546c0bef0fedb6cdfc763a882136284bed9a07225f09a14b82d2a84e7637edfd1a679fb35ed9502fd58ef1d091e6287f60d790147f68ddc + languageName: node + linkType: hard + +"commander@npm:^8.0.0, commander@npm:^8.3.0": + version: 8.3.0 + resolution: "commander@npm:8.3.0" + checksum: 0f82321821fc27b83bd409510bb9deeebcfa799ff0bf5d102128b500b7af22872c0c92cb6a0ebc5a4cf19c6b550fba9cedfa7329d18c6442a625f851377bacf0 + languageName: node + linkType: hard + +"common-path-prefix@npm:^3.0.0": + version: 3.0.0 + resolution: "common-path-prefix@npm:3.0.0" + checksum: fdb3c4f54e51e70d417ccd950c07f757582de800c0678ca388aedefefc84982039f346f9fd9a1252d08d2da9e9ef4019f580a1d1d3a10da031e4bb3c924c5818 + languageName: node + linkType: hard + +"commondir@npm:^1.0.1": + version: 1.0.1 + resolution: "commondir@npm:1.0.1" + checksum: 59715f2fc456a73f68826285718503340b9f0dd89bfffc42749906c5cf3d4277ef11ef1cca0350d0e79204f00f1f6d83851ececc9095dc88512a697ac0b9bdcb + languageName: node + linkType: hard + +"compressible@npm:~2.0.16": + version: 2.0.18 + resolution: "compressible@npm:2.0.18" + dependencies: + mime-db: ">= 1.43.0 < 2" + checksum: 58321a85b375d39230405654721353f709d0c1442129e9a17081771b816302a012471a9b8f4864c7dbe02eef7f2aaac3c614795197092262e94b409c9be108f0 + languageName: node + linkType: hard + +"compression@npm:^1.7.4": + version: 1.7.4 + resolution: "compression@npm:1.7.4" + dependencies: + accepts: ~1.3.5 + bytes: 3.0.0 + compressible: ~2.0.16 + debug: 2.6.9 + on-headers: ~1.0.2 + safe-buffer: 5.1.2 + vary: ~1.1.2 + checksum: 35c0f2eb1f28418978615dc1bc02075b34b1568f7f56c62d60f4214d4b7cc00d0f6d282b5f8a954f59872396bd770b6b15ffd8aa94c67d4bce9b8887b906999b + languageName: node + linkType: hard + +"concat-map@npm:0.0.1": + version: 0.0.1 + resolution: "concat-map@npm:0.0.1" + checksum: 902a9f5d8967a3e2faf138d5cb784b9979bad2e6db5357c5b21c568df4ebe62bcb15108af1b2253744844eb964fc023fbd9afbbbb6ddd0bcc204c6fb5b7bf3af + languageName: node + linkType: hard + +"concordance@npm:^5.0.4": + version: 5.0.4 + resolution: "concordance@npm:5.0.4" + dependencies: + date-time: ^3.1.0 + esutils: ^2.0.3 + fast-diff: ^1.2.0 + js-string-escape: ^1.0.1 + lodash: ^4.17.15 + md5-hex: ^3.0.1 + semver: ^7.3.2 + well-known-symbols: ^2.0.0 + checksum: 749153ba711492feb7c3d2f5bb04c107157440b3e39509bd5dd19ee7b3ac751d1e4cd75796d9f702e0a713312dbc661421c68aa4a2c34d5f6d91f47e3a1c64a6 + languageName: node + linkType: hard + +"configstore@npm:^5.0.1": + version: 5.0.1 + resolution: "configstore@npm:5.0.1" + dependencies: + dot-prop: ^5.2.0 + graceful-fs: ^4.1.2 + make-dir: ^3.0.0 + unique-string: ^2.0.0 + write-file-atomic: ^3.0.0 + xdg-basedir: ^4.0.0 + checksum: 60ef65d493b63f96e14b11ba7ec072fdbf3d40110a94fb7199d1c287761bdea5c5244e76b2596325f30c1b652213aa75de96ea20afd4a5f82065e61ea090988e + languageName: node + linkType: hard + +"connect-history-api-fallback@npm:^2.0.0": + version: 2.0.0 + resolution: "connect-history-api-fallback@npm:2.0.0" + checksum: dc5368690f4a5c413889792f8df70d5941ca9da44523cde3f87af0745faee5ee16afb8195434550f0504726642734f2683d6c07f8b460f828a12c45fbd4c9a68 + languageName: node + linkType: hard + +"consola@npm:^2.15.3": + version: 2.15.3 + resolution: "consola@npm:2.15.3" + checksum: 8ef7a09b703ec67ac5c389a372a33b6dc97eda6c9876443a60d76a3076eea0259e7f67a4e54fd5a52f97df73690822d090cf8b7e102b5761348afef7c6d03e28 + languageName: node + linkType: hard + +"console-control-strings@npm:^1.1.0": + version: 1.1.0 + resolution: "console-control-strings@npm:1.1.0" + checksum: 8755d76787f94e6cf79ce4666f0c5519906d7f5b02d4b884cf41e11dcd759ed69c57da0670afd9236d229a46e0f9cf519db0cd829c6dca820bb5a5c3def584ed + languageName: node + linkType: hard + +"content-disposition@npm:0.5.2": + version: 0.5.2 + resolution: "content-disposition@npm:0.5.2" + checksum: 298d7da63255a38f7858ee19c7b6aae32b167e911293174b4c1349955e97e78e1d0b0d06c10e229405987275b417cf36ff65cbd4821a98bc9df4e41e9372cde7 + languageName: node + linkType: hard + +"content-disposition@npm:0.5.4, content-disposition@npm:~0.5.2": + version: 0.5.4 + resolution: "content-disposition@npm:0.5.4" + dependencies: + safe-buffer: 5.2.1 + checksum: afb9d545e296a5171d7574fcad634b2fdf698875f4006a9dd04a3e1333880c5c0c98d47b560d01216fb6505a54a2ba6a843ee3a02ec86d7e911e8315255f56c3 + languageName: node + linkType: hard + +"content-type@npm:^1.0.4, content-type@npm:~1.0.4": + version: 1.0.5 + resolution: "content-type@npm:1.0.5" + checksum: 566271e0a251642254cde0f845f9dd4f9856e52d988f4eb0d0dcffbb7a1f8ec98de7a5215fc628f3bce30fe2fb6fd2bc064b562d721658c59b544e2d34ea2766 + languageName: node + linkType: hard + +"convert-source-map@npm:^1.6.0, convert-source-map@npm:^1.7.0": + version: 1.9.0 + resolution: "convert-source-map@npm:1.9.0" + checksum: dc55a1f28ddd0e9485ef13565f8f756b342f9a46c4ae18b843fe3c30c675d058d6a4823eff86d472f187b176f0adf51ea7b69ea38be34be4a63cbbf91b0593c8 + languageName: node + linkType: hard + +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 63ae9933be5a2b8d4509daca5124e20c14d023c820258e484e32dc324d34c2754e71297c94a05784064ad27615037ef677e3f0c00469fb55f409d2bb21261035 + languageName: node + linkType: hard + +"convert-to-spaces@npm:^2.0.1": + version: 2.0.1 + resolution: "convert-to-spaces@npm:2.0.1" + checksum: bbb324e5916fe9866f65c0ff5f9c1ea933764d0bdb09fccaf59542e40545ed483db6b2339c6d9eb56a11965a58f1a6038f3174f0e2fb7601343c7107ca5e2751 + languageName: node + linkType: hard + +"cookie-signature@npm:1.0.6": + version: 1.0.6 + resolution: "cookie-signature@npm:1.0.6" + checksum: f4e1b0a98a27a0e6e66fd7ea4e4e9d8e038f624058371bf4499cfcd8f3980be9a121486995202ba3fca74fbed93a407d6d54d43a43f96fd28d0bd7a06761591a + languageName: node + linkType: hard + +"cookie@npm:0.5.0": + version: 0.5.0 + resolution: "cookie@npm:0.5.0" + checksum: 1f4bd2ca5765f8c9689a7e8954183f5332139eb72b6ff783d8947032ec1fdf43109852c178e21a953a30c0dd42257828185be01b49d1eb1a67fd054ca588a180 + languageName: node + linkType: hard + +"cookie@npm:^0.4.1": + version: 0.4.2 + resolution: "cookie@npm:0.4.2" + checksum: a00833c998bedf8e787b4c342defe5fa419abd96b32f4464f718b91022586b8f1bafbddd499288e75c037642493c83083da426c6a9080d309e3bd90fd11baa9b + languageName: node + linkType: hard + +"cookies@npm:~0.8.0": + version: 0.8.0 + resolution: "cookies@npm:0.8.0" + dependencies: + depd: ~2.0.0 + keygrip: ~1.1.0 + checksum: 806055a44f128705265b1bc6a853058da18bf80dea3654ad99be20985b1fa1b14f86c1eef73644aab8071241f8a78acd57202b54c4c5c70769fc694fbb9c4edc + languageName: node + linkType: hard + +"copy-text-to-clipboard@npm:^3.0.1": + version: 3.2.0 + resolution: "copy-text-to-clipboard@npm:3.2.0" + checksum: df7115c197a166d51f59e4e20ab2a68a855ae8746d25ff149b5465c694d9a405c7e6684b73a9f87ba8d653070164e229c15dfdb9fd77c30be1ff0da569661060 + languageName: node + linkType: hard + +"copy-webpack-plugin@npm:^11.0.0": + version: 11.0.0 + resolution: "copy-webpack-plugin@npm:11.0.0" + dependencies: + fast-glob: ^3.2.11 + glob-parent: ^6.0.1 + globby: ^13.1.1 + normalize-path: ^3.0.0 + schema-utils: ^4.0.0 + serialize-javascript: ^6.0.0 + peerDependencies: + webpack: ^5.1.0 + checksum: df4f8743f003a29ee7dd3d9b1789998a3a99051c92afb2ba2203d3dacfa696f4e757b275560fafb8f206e520a0aa78af34b990324a0e36c2326cefdeef3ca82e + languageName: node + linkType: hard + +"core-js-compat@npm:^3.31.0, core-js-compat@npm:^3.32.2": + version: 3.33.0 + resolution: "core-js-compat@npm:3.33.0" + dependencies: + browserslist: ^4.22.1 + checksum: 83ae54008c09b8e0ae3c59457039866c342c7e28b0d30eebb638a5b51c01432e63fe97695c90645cbc6a8b073a4f9a8b0e75f0818bbf8b4b054e01f4c17d3181 + languageName: node + linkType: hard + +"core-js-pure@npm:^3.30.2": + version: 3.33.0 + resolution: "core-js-pure@npm:3.33.0" + checksum: d47084a4de9a0cef9779eccd3ac9f435cf9fd7aa71794150cd4c6b305036bcc392d94766d4a7b6456bdd08faba7752d55c2ec40185bda161c3563081c9fa1e17 + languageName: node + linkType: hard + +"core-js@npm:^3.23.3": + version: 3.33.0 + resolution: "core-js@npm:3.33.0" + checksum: dd62217935ac281faf6f833bb306fb891162919fcf9c1f0c975b1b91e82ac09a940f5deb5950bbb582739ceef716e8bd7e4f9eab8328932fb029d3bc2ecb2881 + languageName: node + linkType: hard + +"core-util-is@npm:~1.0.0": + version: 1.0.3 + resolution: "core-util-is@npm:1.0.3" + checksum: 9de8597363a8e9b9952491ebe18167e3b36e7707569eed0ebf14f8bba773611376466ae34575bca8cfe3c767890c859c74056084738f09d4e4a6f902b2ad7d99 + languageName: node + linkType: hard + +"cosmiconfig@npm:^6.0.0": + version: 6.0.0 + resolution: "cosmiconfig@npm:6.0.0" + dependencies: + "@types/parse-json": ^4.0.0 + import-fresh: ^3.1.0 + parse-json: ^5.0.0 + path-type: ^4.0.0 + yaml: ^1.7.2 + checksum: 8eed7c854b91643ecb820767d0deb038b50780ecc3d53b0b19e03ed8aabed4ae77271198d1ae3d49c3b110867edf679f5faad924820a8d1774144a87cb6f98fc + languageName: node + linkType: hard + +"cosmiconfig@npm:^7.0.1": + version: 7.1.0 + resolution: "cosmiconfig@npm:7.1.0" + dependencies: + "@types/parse-json": ^4.0.0 + import-fresh: ^3.2.1 + parse-json: ^5.0.0 + path-type: ^4.0.0 + yaml: ^1.10.0 + checksum: c53bf7befc1591b2651a22414a5e786cd5f2eeaa87f3678a3d49d6069835a9d8d1aef223728e98aa8fec9a95bf831120d245096db12abe019fecb51f5696c96f + languageName: node + linkType: hard + +"cosmiconfig@npm:^8.2.0": + version: 8.3.6 + resolution: "cosmiconfig@npm:8.3.6" + dependencies: + import-fresh: ^3.3.0 + js-yaml: ^4.1.0 + parse-json: ^5.2.0 + path-type: ^4.0.0 + peerDependencies: + typescript: ">=4.9.5" + peerDependenciesMeta: + typescript: + optional: true + checksum: dc339ebea427898c9e03bf01b56ba7afbac07fc7d2a2d5a15d6e9c14de98275a9565da949375aee1809591c152c0a3877bb86dbeaf74d5bd5aaa79955ad9e7a0 + languageName: node + linkType: hard + +"crc-32@npm:^1.2.0": + version: 1.2.2 + resolution: "crc-32@npm:1.2.2" + bin: + crc32: bin/crc32.njs + checksum: ad2d0ad0cbd465b75dcaeeff0600f8195b686816ab5f3ba4c6e052a07f728c3e70df2e3ca9fd3d4484dc4ba70586e161ca5a2334ec8bf5a41bf022a6103ff243 + languageName: node + linkType: hard + +"create-hash@npm:^1.1.0, create-hash@npm:^1.1.2, create-hash@npm:^1.2.0": + version: 1.2.0 + resolution: "create-hash@npm:1.2.0" + dependencies: + cipher-base: ^1.0.1 + inherits: ^2.0.1 + md5.js: ^1.3.4 + ripemd160: ^2.0.1 + sha.js: ^2.4.0 + checksum: 02a6ae3bb9cd4afee3fabd846c1d8426a0e6b495560a977ba46120c473cb283be6aa1cace76b5f927cf4e499c6146fb798253e48e83d522feba807d6b722eaa9 + languageName: node + linkType: hard + +"create-hmac@npm:^1.1.4, create-hmac@npm:^1.1.7": + version: 1.1.7 + resolution: "create-hmac@npm:1.1.7" + dependencies: + cipher-base: ^1.0.3 + create-hash: ^1.1.0 + inherits: ^2.0.1 + ripemd160: ^2.0.0 + safe-buffer: ^5.0.1 + sha.js: ^2.4.8 + checksum: ba12bb2257b585a0396108c72830e85f882ab659c3320c83584b1037f8ab72415095167ced80dc4ce8e446a8ecc4b2acf36d87befe0707d73b26cf9dc77440ed + languageName: node + linkType: hard + +"create-require@npm:^1.1.0": + version: 1.1.1 + resolution: "create-require@npm:1.1.1" + checksum: a9a1503d4390d8b59ad86f4607de7870b39cad43d929813599a23714831e81c520bddf61bcdd1f8e30f05fd3a2b71ae8538e946eb2786dc65c2bbc520f692eff + languageName: node + linkType: hard + +"cross-fetch@npm:3.1.5": + version: 3.1.5 + resolution: "cross-fetch@npm:3.1.5" + dependencies: + node-fetch: 2.6.7 + checksum: f6b8c6ee3ef993ace6277fd789c71b6acf1b504fd5f5c7128df4ef2f125a429e29cd62dc8c127523f04a5f2fa4771ed80e3f3d9695617f441425045f505cf3bb + languageName: node + linkType: hard + +"cross-fetch@npm:^3.1.5": + version: 3.1.8 + resolution: "cross-fetch@npm:3.1.8" + dependencies: + node-fetch: ^2.6.12 + checksum: 78f993fa099eaaa041122ab037fe9503ecbbcb9daef234d1d2e0b9230a983f64d645d088c464e21a247b825a08dc444a6e7064adfa93536d3a9454b4745b3632 + languageName: node + linkType: hard + +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": + version: 7.0.3 + resolution: "cross-spawn@npm:7.0.3" + dependencies: + path-key: ^3.1.0 + shebang-command: ^2.0.0 + which: ^2.0.1 + checksum: 671cc7c7288c3a8406f3c69a3ae2fc85555c04169e9d611def9a675635472614f1c0ed0ef80955d5b6d4e724f6ced67f0ad1bb006c2ea643488fcfef994d7f52 + languageName: node + linkType: hard + +"crypto-random-string@npm:^2.0.0": + version: 2.0.0 + resolution: "crypto-random-string@npm:2.0.0" + checksum: 0283879f55e7c16fdceacc181f87a0a65c53bc16ffe1d58b9d19a6277adcd71900d02bb2c4843dd55e78c51e30e89b0fec618a7f170ebcc95b33182c28f05fd6 + languageName: node + linkType: hard + +"css-declaration-sorter@npm:^6.3.1": + version: 6.4.1 + resolution: "css-declaration-sorter@npm:6.4.1" + peerDependencies: + postcss: ^8.0.9 + checksum: cbdc9e0d481011b1a28fd5b60d4eb55fe204391d31a0b1b490b2cecf4baa85810f9b8c48adab4df644f4718104ed3ed72c64a9745e3216173767bf4aeca7f9b8 + languageName: node + linkType: hard + +"css-loader@npm:^6.7.1": + version: 6.8.1 + resolution: "css-loader@npm:6.8.1" + dependencies: + icss-utils: ^5.1.0 + postcss: ^8.4.21 + postcss-modules-extract-imports: ^3.0.0 + postcss-modules-local-by-default: ^4.0.3 + postcss-modules-scope: ^3.0.0 + postcss-modules-values: ^4.0.0 + postcss-value-parser: ^4.2.0 + semver: ^7.3.8 + peerDependencies: + webpack: ^5.0.0 + checksum: 7c1784247bdbe76dc5c55fb1ac84f1d4177a74c47259942c9cfdb7a8e6baef11967a0bc85ac285f26bd26d5059decb848af8154a03fdb4f4894f41212f45eef3 + languageName: node + linkType: hard + +"css-minimizer-webpack-plugin@npm:^4.0.0": + version: 4.2.2 + resolution: "css-minimizer-webpack-plugin@npm:4.2.2" + dependencies: + cssnano: ^5.1.8 + jest-worker: ^29.1.2 + postcss: ^8.4.17 + schema-utils: ^4.0.0 + serialize-javascript: ^6.0.0 + source-map: ^0.6.1 + peerDependencies: + webpack: ^5.0.0 + peerDependenciesMeta: + "@parcel/css": + optional: true + "@swc/css": + optional: true + clean-css: + optional: true + csso: + optional: true + esbuild: + optional: true + lightningcss: + optional: true + checksum: 5417e76a445f35832aa96807c835b8e92834a6cd285b1b788dfe3ca0fa90fec7eb2dd6efa9d3649f9d8244b99b7da2d065951603b94918e8f6a366a5049cacdd + languageName: node + linkType: hard + +"css-select@npm:^4.1.3": + version: 4.3.0 + resolution: "css-select@npm:4.3.0" + dependencies: + boolbase: ^1.0.0 + css-what: ^6.0.1 + domhandler: ^4.3.1 + domutils: ^2.8.0 + nth-check: ^2.0.1 + checksum: d6202736839194dd7f910320032e7cfc40372f025e4bf21ca5bf6eb0a33264f322f50ba9c0adc35dadd342d3d6fae5ca244779a4873afbfa76561e343f2058e0 + languageName: node + linkType: hard + +"css-select@npm:^5.1.0": + version: 5.1.0 + resolution: "css-select@npm:5.1.0" + dependencies: + boolbase: ^1.0.0 + css-what: ^6.1.0 + domhandler: ^5.0.2 + domutils: ^3.0.1 + nth-check: ^2.0.1 + checksum: 2772c049b188d3b8a8159907192e926e11824aea525b8282981f72ba3f349cf9ecd523fdf7734875ee2cb772246c22117fc062da105b6d59afe8dcd5c99c9bda + languageName: node + linkType: hard + +"css-tree@npm:^1.1.2, css-tree@npm:^1.1.3": + version: 1.1.3 + resolution: "css-tree@npm:1.1.3" + dependencies: + mdn-data: 2.0.14 + source-map: ^0.6.1 + checksum: 79f9b81803991b6977b7fcb1588799270438274d89066ce08f117f5cdb5e20019b446d766c61506dd772c839df84caa16042d6076f20c97187f5abe3b50e7d1f + languageName: node + linkType: hard + +"css-what@npm:^6.0.1, css-what@npm:^6.1.0": + version: 6.1.0 + resolution: "css-what@npm:6.1.0" + checksum: b975e547e1e90b79625918f84e67db5d33d896e6de846c9b584094e529f0c63e2ab85ee33b9daffd05bff3a146a1916bec664e18bb76dd5f66cbff9fc13b2bbe + languageName: node + linkType: hard + +"cssesc@npm:^3.0.0": + version: 3.0.0 + resolution: "cssesc@npm:3.0.0" + bin: + cssesc: bin/cssesc + checksum: f8c4ababffbc5e2ddf2fa9957dda1ee4af6048e22aeda1869d0d00843223c1b13ad3f5d88b51caa46c994225eacb636b764eb807a8883e2fb6f99b4f4e8c48b2 + languageName: node + linkType: hard + +"cssnano-preset-advanced@npm:^5.3.8": + version: 5.3.10 + resolution: "cssnano-preset-advanced@npm:5.3.10" + dependencies: + autoprefixer: ^10.4.12 + cssnano-preset-default: ^5.2.14 + postcss-discard-unused: ^5.1.0 + postcss-merge-idents: ^5.1.1 + postcss-reduce-idents: ^5.2.0 + postcss-zindex: ^5.1.0 + peerDependencies: + postcss: ^8.2.15 + checksum: d21cb382aea2f35c9eaa50686280bbd5158260edf73020731364b03bae0d887292da51ed0b20b369f51d2573ee8c02c695f604647b839a9ca746be8a44c3bb5b + languageName: node + linkType: hard + +"cssnano-preset-default@npm:^5.2.14": + version: 5.2.14 + resolution: "cssnano-preset-default@npm:5.2.14" + dependencies: + css-declaration-sorter: ^6.3.1 + cssnano-utils: ^3.1.0 + postcss-calc: ^8.2.3 + postcss-colormin: ^5.3.1 + postcss-convert-values: ^5.1.3 + postcss-discard-comments: ^5.1.2 + postcss-discard-duplicates: ^5.1.0 + postcss-discard-empty: ^5.1.1 + postcss-discard-overridden: ^5.1.0 + postcss-merge-longhand: ^5.1.7 + postcss-merge-rules: ^5.1.4 + postcss-minify-font-values: ^5.1.0 + postcss-minify-gradients: ^5.1.1 + postcss-minify-params: ^5.1.4 + postcss-minify-selectors: ^5.2.1 + postcss-normalize-charset: ^5.1.0 + postcss-normalize-display-values: ^5.1.0 + postcss-normalize-positions: ^5.1.1 + postcss-normalize-repeat-style: ^5.1.1 + postcss-normalize-string: ^5.1.0 + postcss-normalize-timing-functions: ^5.1.0 + postcss-normalize-unicode: ^5.1.1 + postcss-normalize-url: ^5.1.0 + postcss-normalize-whitespace: ^5.1.1 + postcss-ordered-values: ^5.1.3 + postcss-reduce-initial: ^5.1.2 + postcss-reduce-transforms: ^5.1.0 + postcss-svgo: ^5.1.0 + postcss-unique-selectors: ^5.1.1 + peerDependencies: + postcss: ^8.2.15 + checksum: d3bbbe3d50c6174afb28d0bdb65b511fdab33952ec84810aef58b87189f3891c34aaa8b6a6101acd5314f8acded839b43513e39a75f91a698ddc985a1b1d9e95 + languageName: node + linkType: hard + +"cssnano-utils@npm:^3.1.0": + version: 3.1.0 + resolution: "cssnano-utils@npm:3.1.0" + peerDependencies: + postcss: ^8.2.15 + checksum: 975c84ce9174cf23bb1da1e9faed8421954607e9ea76440cd3bb0c1bea7e17e490d800fca5ae2812d1d9e9d5524eef23ede0a3f52497d7ccc628e5d7321536f2 + languageName: node + linkType: hard + +"cssnano@npm:^5.1.12, cssnano@npm:^5.1.8": + version: 5.1.15 + resolution: "cssnano@npm:5.1.15" + dependencies: + cssnano-preset-default: ^5.2.14 + lilconfig: ^2.0.3 + yaml: ^1.10.2 + peerDependencies: + postcss: ^8.2.15 + checksum: ca9e1922178617c66c2f1548824b2c7af2ecf69cc3a187fc96bf8d29251c2e84d9e4966c69cf64a2a6a057a37dff7d6d057bc8a2a0957e6ea382e452ae9d0bbb + languageName: node + linkType: hard + +"csso@npm:^4.2.0": + version: 4.2.0 + resolution: "csso@npm:4.2.0" + dependencies: + css-tree: ^1.1.2 + checksum: 380ba9663da3bcea58dee358a0d8c4468bb6539be3c439dc266ac41c047217f52fd698fb7e4b6b6ccdfb8cf53ef4ceed8cc8ceccb8dfca2aa628319826b5b998 + languageName: node + linkType: hard + +"csstype@npm:^3.0.2": + version: 3.1.2 + resolution: "csstype@npm:3.1.2" + checksum: e1a52e6c25c1314d6beef5168da704ab29c5186b877c07d822bd0806717d9a265e8493a2e35ca7e68d0f5d472d43fac1cdce70fd79fd0853dff81f3028d857b5 + languageName: node + linkType: hard + +"currently-unhandled@npm:^0.4.1": + version: 0.4.1 + resolution: "currently-unhandled@npm:0.4.1" + dependencies: + array-find-index: ^1.0.1 + checksum: 1f59fe10b5339b54b1a1eee110022f663f3495cf7cf2f480686e89edc7fa8bfe42dbab4b54f85034bc8b092a76cc7becbc2dad4f9adad332ab5831bec39ad540 + languageName: node + linkType: hard + +"data-uri-to-buffer@npm:^4.0.0": + version: 4.0.1 + resolution: "data-uri-to-buffer@npm:4.0.1" + checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c + languageName: node + linkType: hard + +"date-time@npm:^3.1.0": + version: 3.1.0 + resolution: "date-time@npm:3.1.0" + dependencies: + time-zone: ^1.0.0 + checksum: f9cfcd1b15dfeabab15c0b9d18eb9e4e2d9d4371713564178d46a8f91ad577a290b5178b80050718d02d9c0cf646f8a875011e12d1ed05871e9f72c72c8a8fe6 + languageName: node + linkType: hard + +"debounce@npm:^1.2.0": + version: 1.2.1 + resolution: "debounce@npm:1.2.1" + checksum: 682a89506d9e54fb109526f4da255c5546102fbb8e3ae75eef3b04effaf5d4853756aee97475cd4650641869794e44f410eeb20ace2b18ea592287ab2038519e + languageName: node + linkType: hard + +"debug@npm:2.6.9, debug@npm:^2.6.0, debug@npm:^2.6.9": + version: 2.6.9 + resolution: "debug@npm:2.6.9" + dependencies: + ms: 2.0.0 + checksum: d2f51589ca66df60bf36e1fa6e4386b318c3f1e06772280eea5b1ae9fd3d05e9c2b7fd8a7d862457d00853c75b00451aa2d7459b924629ee385287a650f58fe6 + languageName: node + linkType: hard + +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": + version: 4.3.4 + resolution: "debug@npm:4.3.4" + dependencies: + ms: 2.1.2 + peerDependenciesMeta: + supports-color: + optional: true + checksum: 3dbad3f94ea64f34431a9cbf0bafb61853eda57bff2880036153438f50fb5a84f27683ba0d8e5426bf41a8c6ff03879488120cf5b3a761e77953169c0600a708 + languageName: node + linkType: hard + +"debug@npm:^3.1.0, debug@npm:^3.2.7": + version: 3.2.7 + resolution: "debug@npm:3.2.7" + dependencies: + ms: ^2.1.1 + checksum: b3d8c5940799914d30314b7c3304a43305fd0715581a919dacb8b3176d024a782062368405b47491516d2091d6462d4d11f2f4974a405048094f8bfebfa3071c + languageName: node + linkType: hard + +"decamelize@npm:^4.0.0": + version: 4.0.0 + resolution: "decamelize@npm:4.0.0" + checksum: b7d09b82652c39eead4d6678bb578e3bebd848add894b76d0f6b395bc45b2d692fb88d977e7cfb93c4ed6c119b05a1347cef261174916c2e75c0a8ca57da1809 + languageName: node + linkType: hard + +"decompress-response@npm:^3.3.0": + version: 3.3.0 + resolution: "decompress-response@npm:3.3.0" + dependencies: + mimic-response: ^1.0.0 + checksum: 952552ac3bd7de2fc18015086b09468645c9638d98a551305e485230ada278c039c91116e946d07894b39ee53c0f0d5b6473f25a224029344354513b412d7380 + languageName: node + linkType: hard + +"deep-eql@npm:^4.0.1, deep-eql@npm:^4.1.2": + version: 4.1.3 + resolution: "deep-eql@npm:4.1.3" + dependencies: + type-detect: ^4.0.0 + checksum: 7f6d30cb41c713973dc07eaadded848b2ab0b835e518a88b91bea72f34e08c4c71d167a722a6f302d3a6108f05afd8e6d7650689a84d5d29ec7fe6220420397f + languageName: node + linkType: hard + +"deep-equal@npm:~1.0.1": + version: 1.0.1 + resolution: "deep-equal@npm:1.0.1" + checksum: 5af8cbfcebf190491878a498caccc7dc9592f8ebd1685b976eacc3825619d222b5e929923163b92c4f414494e2b884f7ebf00c022e8198e8292deb70dd9785f4 + languageName: node + linkType: hard + +"deep-extend@npm:^0.6.0, deep-extend@npm:~0.6.0": + version: 0.6.0 + resolution: "deep-extend@npm:0.6.0" + checksum: 7be7e5a8d468d6b10e6a67c3de828f55001b6eb515d014f7aeb9066ce36bd5717161eb47d6a0f7bed8a9083935b465bc163ee2581c8b128d29bf61092fdf57a7 + languageName: node + linkType: hard + +"deep-is@npm:^0.1.3": + version: 0.1.4 + resolution: "deep-is@npm:0.1.4" + checksum: edb65dd0d7d1b9c40b2f50219aef30e116cedd6fc79290e740972c132c09106d2e80aa0bc8826673dd5a00222d4179c84b36a790eef63a4c4bca75a37ef90804 + languageName: node + linkType: hard + +"deepmerge@npm:^4.2.2": + version: 4.3.1 + resolution: "deepmerge@npm:4.3.1" + checksum: 2024c6a980a1b7128084170c4cf56b0fd58a63f2da1660dcfe977415f27b17dbe5888668b59d0b063753f3220719d5e400b7f113609489c90160bb9a5518d052 + languageName: node + linkType: hard + +"default-browser-id@npm:^3.0.0": + version: 3.0.0 + resolution: "default-browser-id@npm:3.0.0" + dependencies: + bplist-parser: ^0.2.0 + untildify: ^4.0.0 + checksum: 279c7ad492542e5556336b6c254a4eaf31b2c63a5433265655ae6e47301197b6cfb15c595a6fdc6463b2ff8e1a1a1ed3cba56038a60e1527ba4ab1628c6b9941 + languageName: node + linkType: hard + +"default-browser@npm:^4.0.0": + version: 4.0.0 + resolution: "default-browser@npm:4.0.0" + dependencies: + bundle-name: ^3.0.0 + default-browser-id: ^3.0.0 + execa: ^7.1.1 + titleize: ^3.0.0 + checksum: 40c5af984799042b140300be5639c9742599bda76dc9eba5ac9ad5943c83dd36cebc4471eafcfddf8e0ec817166d5ba89d56f08e66a126c7c7908a179cead1a7 + languageName: node + linkType: hard + +"default-gateway@npm:^6.0.3": + version: 6.0.3 + resolution: "default-gateway@npm:6.0.3" + dependencies: + execa: ^5.0.0 + checksum: 126f8273ecac8ee9ff91ea778e8784f6cd732d77c3157e8c5bdd6ed03651b5291f71446d05bc02d04073b1e67583604db5394ea3cf992ede0088c70ea15b7378 + languageName: node + linkType: hard + +"defer-to-connect@npm:^1.0.1": + version: 1.1.3 + resolution: "defer-to-connect@npm:1.1.3" + checksum: 9491b301dcfa04956f989481ba7a43c2231044206269eb4ab64a52d6639ee15b1252262a789eb4239fb46ab63e44d4e408641bae8e0793d640aee55398cb3930 + languageName: node + linkType: hard + +"define-data-property@npm:^1.0.1": + version: 1.1.1 + resolution: "define-data-property@npm:1.1.1" + dependencies: + get-intrinsic: ^1.2.1 + gopd: ^1.0.1 + has-property-descriptors: ^1.0.0 + checksum: a29855ad3f0630ea82e3c5012c812efa6ca3078d5c2aa8df06b5f597c1cde6f7254692df41945851d903e05a1668607b6d34e778f402b9ff9ffb38111f1a3f0d + languageName: node + linkType: hard + +"define-lazy-prop@npm:^2.0.0": + version: 2.0.0 + resolution: "define-lazy-prop@npm:2.0.0" + checksum: 0115fdb065e0490918ba271d7339c42453d209d4cb619dfe635870d906731eff3e1ade8028bb461ea27ce8264ec5e22c6980612d332895977e89c1bbc80fcee2 + languageName: node + linkType: hard + +"define-lazy-prop@npm:^3.0.0": + version: 3.0.0 + resolution: "define-lazy-prop@npm:3.0.0" + checksum: 54884f94caac0791bf6395a3ec530ce901cf71c47b0196b8754f3fd17edb6c0e80149c1214429d851873bb0d689dbe08dcedbb2306dc45c8534a5934723851b6 + languageName: node + linkType: hard + +"define-properties@npm:^1.1.4": + version: 1.2.1 + resolution: "define-properties@npm:1.2.1" + dependencies: + define-data-property: ^1.0.1 + has-property-descriptors: ^1.0.0 + object-keys: ^1.1.1 + checksum: b4ccd00597dd46cb2d4a379398f5b19fca84a16f3374e2249201992f36b30f6835949a9429669ee6b41b6e837205a163eadd745e472069e70dfc10f03e5fcc12 + languageName: node + linkType: hard + +"del@npm:^6.1.1": + version: 6.1.1 + resolution: "del@npm:6.1.1" + dependencies: + globby: ^11.0.1 + graceful-fs: ^4.2.4 + is-glob: ^4.0.1 + is-path-cwd: ^2.2.0 + is-path-inside: ^3.0.2 + p-map: ^4.0.0 + rimraf: ^3.0.2 + slash: ^3.0.0 + checksum: 563288b73b8b19a7261c47fd21a330eeab6e2acd7c6208c49790dfd369127120dd7836cdf0c1eca216b77c94782a81507eac6b4734252d3bef2795cb366996b6 + languageName: node + linkType: hard + +"delayed-stream@npm:~1.0.0": + version: 1.0.0 + resolution: "delayed-stream@npm:1.0.0" + checksum: 46fe6e83e2cb1d85ba50bd52803c68be9bd953282fa7096f51fc29edd5d67ff84ff753c51966061e5ba7cb5e47ef6d36a91924eddb7f3f3483b1c560f77a0020 + languageName: node + linkType: hard + +"delegates@npm:^1.0.0": + version: 1.0.0 + resolution: "delegates@npm:1.0.0" + checksum: a51744d9b53c164ba9c0492471a1a2ffa0b6727451bdc89e31627fdf4adda9d51277cfcbfb20f0a6f08ccb3c436f341df3e92631a3440226d93a8971724771fd + languageName: node + linkType: hard + +"depd@npm:2.0.0, depd@npm:^2.0.0, depd@npm:~2.0.0": + version: 2.0.0 + resolution: "depd@npm:2.0.0" + checksum: abbe19c768c97ee2eed6282d8ce3031126662252c58d711f646921c9623f9052e3e1906443066beec1095832f534e57c523b7333f8e7e0d93051ab6baef5ab3a + languageName: node + linkType: hard + +"depd@npm:~1.1.2": + version: 1.1.2 + resolution: "depd@npm:1.1.2" + checksum: 6b406620d269619852885ce15965272b829df6f409724415e0002c8632ab6a8c0a08ec1f0bd2add05dc7bd7507606f7e2cc034fa24224ab829580040b835ecd9 + languageName: node + linkType: hard + +"dependency-graph@npm:^0.11.0": + version: 0.11.0 + resolution: "dependency-graph@npm:0.11.0" + checksum: 477204beaa9be69e642bc31ffe7a8c383d0cf48fa27acbc91c5df01431ab913e65c154213d2ef83d034c98d77280743ec85e5da018a97a18dd43d3c0b78b28cd + languageName: node + linkType: hard + +"dequal@npm:^2.0.0": + version: 2.0.3 + resolution: "dequal@npm:2.0.3" + checksum: 8679b850e1a3d0ebbc46ee780d5df7b478c23f335887464023a631d1b9af051ad4a6595a44220f9ff8ff95a8ddccf019b5ad778a976fd7bbf77383d36f412f90 + languageName: node + linkType: hard + +"destroy@npm:1.2.0, destroy@npm:^1.0.4": + version: 1.2.0 + resolution: "destroy@npm:1.2.0" + checksum: 0acb300b7478a08b92d810ab229d5afe0d2f4399272045ab22affa0d99dbaf12637659411530a6fcd597a9bdac718fc94373a61a95b4651bbc7b83684a565e38 + languageName: node + linkType: hard + +"detab@npm:2.0.4": + version: 2.0.4 + resolution: "detab@npm:2.0.4" + dependencies: + repeat-string: ^1.5.4 + checksum: 34b077521ecd4c6357d32ff7923be644d34aa6f6b7d717d40ec4a9168243eefaea2b512a75a460a6f70c31b0bbc31ff90f820a891803b4ddaf99e9d04d0d389d + languageName: node + linkType: hard + +"detect-node@npm:^2.0.4": + version: 2.1.0 + resolution: "detect-node@npm:2.1.0" + checksum: 832184ec458353e41533ac9c622f16c19f7c02d8b10c303dfd3a756f56be93e903616c0bb2d4226183c9351c15fc0b3dba41a17a2308262afabcfa3776e6ae6e + languageName: node + linkType: hard + +"detect-port-alt@npm:^1.1.6": + version: 1.1.6 + resolution: "detect-port-alt@npm:1.1.6" + dependencies: + address: ^1.0.1 + debug: ^2.6.0 + bin: + detect: ./bin/detect-port + detect-port: ./bin/detect-port + checksum: 9dc37b1fa4a9dd6d4889e1045849b8d841232b598d1ca888bf712f4035b07a17cf6d537465a0d7323250048d3a5a0540e3b7cf89457efc222f96f77e2c40d16a + languageName: node + linkType: hard + +"detect-port@npm:^1.3.0": + version: 1.5.1 + resolution: "detect-port@npm:1.5.1" + dependencies: + address: ^1.0.1 + debug: 4 + bin: + detect: bin/detect-port.js + detect-port: bin/detect-port.js + checksum: b48da9340481742547263d5d985e65d078592557863402ecf538511735e83575867e94f91fe74405ea19b61351feb99efccae7e55de9a151d5654e3417cea05b + languageName: node + linkType: hard + +"devtools-protocol@npm:0.0.1107588": + version: 0.0.1107588 + resolution: "devtools-protocol@npm:0.0.1107588" + checksum: 9064fd643f39ae0adabb8f425b746899ff24371d89a5047d38752653259e6afcb6bcb2d9759ff727eb5885cfc0f9ba8eb384850a2af00694135622e88080e3e5 + languageName: node + linkType: hard + +"diff@npm:5.0.0": + version: 5.0.0 + resolution: "diff@npm:5.0.0" + checksum: f19fe29284b633afdb2725c2a8bb7d25761ea54d321d8e67987ac851c5294be4afeab532bd84531e02583a3fe7f4014aa314a3eda84f5590e7a9e6b371ef3b46 + languageName: node + linkType: hard + +"diff@npm:^4.0.1": + version: 4.0.2 + resolution: "diff@npm:4.0.2" + checksum: f2c09b0ce4e6b301c221addd83bf3f454c0bc00caa3dd837cf6c127d6edf7223aa2bbe3b688feea110b7f262adbfc845b757c44c8a9f8c0c5b15d8fa9ce9d20d + languageName: node + linkType: hard + +"diff@npm:^5.0.0": + version: 5.1.0 + resolution: "diff@npm:5.1.0" + checksum: c7bf0df7c9bfbe1cf8a678fd1b2137c4fb11be117a67bc18a0e03ae75105e8533dbfb1cda6b46beb3586ef5aed22143ef9d70713977d5fb1f9114e21455fba90 + languageName: node + linkType: hard + +"dir-glob@npm:^3.0.1": + version: 3.0.1 + resolution: "dir-glob@npm:3.0.1" + dependencies: + path-type: ^4.0.0 + checksum: fa05e18324510d7283f55862f3161c6759a3f2f8dbce491a2fc14c8324c498286c54282c1f0e933cb930da8419b30679389499b919122952a4f8592362ef4615 + languageName: node + linkType: hard + +"dns-equal@npm:^1.0.0": + version: 1.0.0 + resolution: "dns-equal@npm:1.0.0" + checksum: a8471ac849c7c13824f053babea1bc26e2f359394dd5a460f8340d8abd13434be01e3327a5c59d212f8c8997817450efd3f3ac77bec709b21979cf0235644524 + languageName: node + linkType: hard + +"dns-packet@npm:^5.2.2": + version: 5.6.1 + resolution: "dns-packet@npm:5.6.1" + dependencies: + "@leichtgewicht/ip-codec": ^2.0.1 + checksum: 64c06457f0c6e143f7a0946e0aeb8de1c5f752217cfa143ef527467c00a6d78db1835cfdb6bb68333d9f9a4963cf23f410439b5262a8935cce1236f45e344b81 + languageName: node + linkType: hard + +"docs@workspace:docs": + version: 0.0.0-use.local + resolution: "docs@workspace:docs" + dependencies: + "@docusaurus/core": ^2.4.0 + "@docusaurus/module-type-aliases": ^2.4.0 + "@docusaurus/plugin-google-gtag": ^2.4.0 + "@docusaurus/preset-classic": ^2.4.0 + "@easyops-cn/docusaurus-search-local": ^0.35.0 + "@mdx-js/react": ^1.6.22 + axios: ^1.4.0 + clsx: ^1.2.1 + docusaurus-plugin-typedoc: 1.0.0-next.18 + hast-util-is-element: ^1.1.0 + prism-react-renderer: ^1.3.5 + react: ^17.0.2 + react-dom: ^17.0.2 + rehype-katex: ^5.0.0 + remark-math: ^3.0.1 + typedoc: ^0.25.0 + typedoc-plugin-frontmatter: ^0.0.2 + typedoc-plugin-markdown: 4.0.0-next.25 + typedoc-plugin-merge-modules: ^5.1.0 + typescript: ^5.2.2 + languageName: unknown + linkType: soft + +"doctrine@npm:^3.0.0": + version: 3.0.0 + resolution: "doctrine@npm:3.0.0" + dependencies: + esutils: ^2.0.2 + checksum: fd7673ca77fe26cd5cba38d816bc72d641f500f1f9b25b83e8ce28827fe2da7ad583a8da26ab6af85f834138cf8dae9f69b0cd6ab925f52ddab1754db44d99ce + languageName: node + linkType: hard + +"docusaurus-plugin-typedoc@npm:1.0.0-next.18": + version: 1.0.0-next.18 + resolution: "docusaurus-plugin-typedoc@npm:1.0.0-next.18" + dependencies: + "@docusaurus/types": ^2.4.1 + peerDependencies: + typedoc-plugin-markdown: ">=4.0.0-next.24" + checksum: a501e3bd1cc5b33d215a1b71b018a34d4aa5bd98f39580ab114a127d3f555078443d6b690119c0adb17fb8867ba4131382ad5d14dbaa7919715020cdfaf6b9c4 + languageName: node + linkType: hard + +"dom-converter@npm:^0.2.0": + version: 0.2.0 + resolution: "dom-converter@npm:0.2.0" + dependencies: + utila: ~0.4 + checksum: ea52fe303f5392e48dea563abef0e6fb3a478b8dbe3c599e99bb5d53981c6c38fc4944e56bb92a8ead6bb989d10b7914722ae11febbd2fd0910e33b9fc4aaa77 + languageName: node + linkType: hard + +"dom-serializer@npm:^1.0.1": + version: 1.4.1 + resolution: "dom-serializer@npm:1.4.1" + dependencies: + domelementtype: ^2.0.1 + domhandler: ^4.2.0 + entities: ^2.0.0 + checksum: fbb0b01f87a8a2d18e6e5a388ad0f7ec4a5c05c06d219377da1abc7bb0f674d804f4a8a94e3f71ff15f6cb7dcfc75704a54b261db672b9b3ab03da6b758b0b22 + languageName: node + linkType: hard + +"dom-serializer@npm:^2.0.0": + version: 2.0.0 + resolution: "dom-serializer@npm:2.0.0" + dependencies: + domelementtype: ^2.3.0 + domhandler: ^5.0.2 + entities: ^4.2.0 + checksum: cd1810544fd8cdfbd51fa2c0c1128ec3a13ba92f14e61b7650b5de421b88205fd2e3f0cc6ace82f13334114addb90ed1c2f23074a51770a8e9c1273acbc7f3e6 + languageName: node + linkType: hard + +"domelementtype@npm:^2.0.1, domelementtype@npm:^2.2.0, domelementtype@npm:^2.3.0": + version: 2.3.0 + resolution: "domelementtype@npm:2.3.0" + checksum: ee837a318ff702622f383409d1f5b25dd1024b692ef64d3096ff702e26339f8e345820f29a68bcdcea8cfee3531776b3382651232fbeae95612d6f0a75efb4f6 + languageName: node + linkType: hard + +"domhandler@npm:^4.0.0, domhandler@npm:^4.2.0, domhandler@npm:^4.3.1": + version: 4.3.1 + resolution: "domhandler@npm:4.3.1" + dependencies: + domelementtype: ^2.2.0 + checksum: 4c665ceed016e1911bf7d1dadc09dc888090b64dee7851cccd2fcf5442747ec39c647bb1cb8c8919f8bbdd0f0c625a6bafeeed4b2d656bbecdbae893f43ffaaa + languageName: node + linkType: hard + +"domhandler@npm:^5.0.2, domhandler@npm:^5.0.3": + version: 5.0.3 + resolution: "domhandler@npm:5.0.3" + dependencies: + domelementtype: ^2.3.0 + checksum: 0f58f4a6af63e6f3a4320aa446d28b5790a009018707bce2859dcb1d21144c7876482b5188395a188dfa974238c019e0a1e610d2fc269a12b2c192ea2b0b131c + languageName: node + linkType: hard + +"domutils@npm:^2.5.2, domutils@npm:^2.8.0": + version: 2.8.0 + resolution: "domutils@npm:2.8.0" + dependencies: + dom-serializer: ^1.0.1 + domelementtype: ^2.2.0 + domhandler: ^4.2.0 + checksum: abf7434315283e9aadc2a24bac0e00eab07ae4313b40cc239f89d84d7315ebdfd2fb1b5bf750a96bc1b4403d7237c7b2ebf60459be394d625ead4ca89b934391 + languageName: node + linkType: hard + +"domutils@npm:^3.0.1": + version: 3.1.0 + resolution: "domutils@npm:3.1.0" + dependencies: + dom-serializer: ^2.0.0 + domelementtype: ^2.3.0 + domhandler: ^5.0.3 + checksum: e5757456ddd173caa411cfc02c2bb64133c65546d2c4081381a3bafc8a57411a41eed70494551aa58030be9e58574fcc489828bebd673863d39924fb4878f416 + languageName: node + linkType: hard + +"dot-case@npm:^3.0.4": + version: 3.0.4 + resolution: "dot-case@npm:3.0.4" + dependencies: + no-case: ^3.0.4 + tslib: ^2.0.3 + checksum: a65e3519414856df0228b9f645332f974f2bf5433370f544a681122eab59e66038fc3349b4be1cdc47152779dac71a5864f1ccda2f745e767c46e9c6543b1169 + languageName: node + linkType: hard + +"dot-prop@npm:^5.2.0": + version: 5.3.0 + resolution: "dot-prop@npm:5.3.0" + dependencies: + is-obj: ^2.0.0 + checksum: d5775790093c234ef4bfd5fbe40884ff7e6c87573e5339432870616331189f7f5d86575c5b5af2dcf0f61172990f4f734d07844b1f23482fff09e3c4bead05ea + languageName: node + linkType: hard + +"duplexer3@npm:^0.1.4": + version: 0.1.5 + resolution: "duplexer3@npm:0.1.5" + checksum: e677cb4c48f031ca728601d6a20bf6aed4c629d69ef9643cb89c67583d673c4ec9317cc6427501f38bd8c368d3a18f173987cc02bd99d8cf8fe3d94259a22a20 + languageName: node + linkType: hard + +"duplexer@npm:^0.1.2, duplexer@npm:~0.1.1": + version: 0.1.2 + resolution: "duplexer@npm:0.1.2" + checksum: 62ba61a830c56801db28ff6305c7d289b6dc9f859054e8c982abd8ee0b0a14d2e9a8e7d086ffee12e868d43e2bbe8a964be55ddbd8c8957714c87373c7a4f9b0 + languageName: node + linkType: hard + +"eastasianwidth@npm:^0.2.0": + version: 0.2.0 + resolution: "eastasianwidth@npm:0.2.0" + checksum: 7d00d7cd8e49b9afa762a813faac332dee781932d6f2c848dc348939c4253f1d4564341b7af1d041853bc3f32c2ef141b58e0a4d9862c17a7f08f68df1e0f1ed + languageName: node + linkType: hard + +"ee-first@npm:1.1.1": + version: 1.1.1 + resolution: "ee-first@npm:1.1.1" + checksum: 1b4cac778d64ce3b582a7e26b218afe07e207a0f9bfe13cc7395a6d307849cfe361e65033c3251e00c27dd060cab43014c2d6b2647676135e18b77d2d05b3f4f + languageName: node + linkType: hard + +"electron-to-chromium@npm:^1.4.535": + version: 1.4.554 + resolution: "electron-to-chromium@npm:1.4.554" + checksum: cbac43c50b43777327f4a7bf149ee3088c1da8b91bbcd80f78d2cc77bc52763f6d0941574499239d9caefd3430d3093f865e5f1093371418f7d6b70301eeae9b + languageName: node + linkType: hard + +"elliptic@npm:6.5.4, elliptic@npm:^6.5.2, elliptic@npm:^6.5.4": + version: 6.5.4 + resolution: "elliptic@npm:6.5.4" + dependencies: + bn.js: ^4.11.9 + brorand: ^1.1.0 + hash.js: ^1.0.0 + hmac-drbg: ^1.0.1 + inherits: ^2.0.4 + minimalistic-assert: ^1.0.1 + minimalistic-crypto-utils: ^1.0.1 + checksum: d56d21fd04e97869f7ffcc92e18903b9f67f2d4637a23c860492fbbff5a3155fd9ca0184ce0c865dd6eb2487d234ce9551335c021c376cd2d3b7cb749c7d10f4 + languageName: node + linkType: hard + +"emittery@npm:^1.0.1": + version: 1.0.1 + resolution: "emittery@npm:1.0.1" + checksum: d95faee6ffb2e023cadaa6804265fea5298c53d079f170112af8dfae3e141761363ea4510966128259346418e3ec7639310fd75059ecce2423bf8afd07004226 + languageName: node + linkType: hard + +"emoji-regex@npm:^8.0.0": + version: 8.0.0 + resolution: "emoji-regex@npm:8.0.0" + checksum: d4c5c39d5a9868b5fa152f00cada8a936868fd3367f33f71be515ecee4c803132d11b31a6222b2571b1e5f7e13890156a94880345594d0ce7e3c9895f560f192 + languageName: node + linkType: hard + +"emoji-regex@npm:^9.2.2": + version: 9.2.2 + resolution: "emoji-regex@npm:9.2.2" + checksum: 8487182da74aabd810ac6d6f1994111dfc0e331b01271ae01ec1eb0ad7b5ecc2bbbbd2f053c05cb55a1ac30449527d819bbfbf0e3de1023db308cbcb47f86601 + languageName: node + linkType: hard + +"emojis-list@npm:^3.0.0": + version: 3.0.0 + resolution: "emojis-list@npm:3.0.0" + checksum: ddaaa02542e1e9436c03970eeed445f4ed29a5337dfba0fe0c38dfdd2af5da2429c2a0821304e8a8d1cadf27fdd5b22ff793571fa803ae16852a6975c65e8e70 + languageName: node + linkType: hard + +"emoticon@npm:^3.2.0": + version: 3.2.0 + resolution: "emoticon@npm:3.2.0" + checksum: f30649d18b672ab3139e95cb04f77b2442feb95c99dc59372ff80fbfd639b2bf4018bc68ab0b549bd765aecf8230d7899c43f86cfcc7b6370c06c3232783e24f + languageName: node + linkType: hard + +"encodeurl@npm:^1.0.2, encodeurl@npm:~1.0.2": + version: 1.0.2 + resolution: "encodeurl@npm:1.0.2" + checksum: e50e3d508cdd9c4565ba72d2012e65038e5d71bdc9198cb125beb6237b5b1ade6c0d343998da9e170fb2eae52c1bed37d4d6d98a46ea423a0cddbed5ac3f780c + languageName: node + linkType: hard + +"encoding@npm:^0.1.13": + version: 0.1.13 + resolution: "encoding@npm:0.1.13" + dependencies: + iconv-lite: ^0.6.2 + checksum: bb98632f8ffa823996e508ce6a58ffcf5856330fde839ae42c9e1f436cc3b5cc651d4aeae72222916545428e54fd0f6aa8862fd8d25bdbcc4589f1e3f3715e7f + languageName: node + linkType: hard + +"end-of-stream@npm:^1.1.0, end-of-stream@npm:^1.4.1": + version: 1.4.4 + resolution: "end-of-stream@npm:1.4.4" + dependencies: + once: ^1.4.0 + checksum: 530a5a5a1e517e962854a31693dbb5c0b2fc40b46dad2a56a2deec656ca040631124f4795823acc68238147805f8b021abbe221f4afed5ef3c8e8efc2024908b + languageName: node + linkType: hard + +"enhanced-resolve@npm:^5.15.0": + version: 5.15.0 + resolution: "enhanced-resolve@npm:5.15.0" + dependencies: + graceful-fs: ^4.2.4 + tapable: ^2.2.0 + checksum: fbd8cdc9263be71cc737aa8a7d6c57b43d6aa38f6cc75dde6fcd3598a130cc465f979d2f4d01bb3bf475acb43817749c79f8eef9be048683602ca91ab52e4f11 + languageName: node + linkType: hard + +"enquirer@npm:^2.3.0": + version: 2.4.1 + resolution: "enquirer@npm:2.4.1" + dependencies: + ansi-colors: ^4.1.1 + strip-ansi: ^6.0.1 + checksum: f080f11a74209647dbf347a7c6a83c8a47ae1ebf1e75073a808bc1088eb780aa54075bfecd1bcdb3e3c724520edb8e6ee05da031529436b421b71066fcc48cb5 + languageName: node + linkType: hard + +"entities@npm:^2.0.0": + version: 2.2.0 + resolution: "entities@npm:2.2.0" + checksum: 19010dacaf0912c895ea262b4f6128574f9ccf8d4b3b65c7e8334ad0079b3706376360e28d8843ff50a78aabcb8f08f0a32dbfacdc77e47ed77ca08b713669b3 + languageName: node + linkType: hard + +"entities@npm:^4.2.0, entities@npm:^4.4.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 853f8ebd5b425d350bffa97dd6958143179a5938352ccae092c62d1267c4e392a039be1bae7d51b6e4ffad25f51f9617531fedf5237f15df302ccfb452cbf2d7 + languageName: node + linkType: hard + +"env-paths@npm:^2.2.0": + version: 2.2.1 + resolution: "env-paths@npm:2.2.1" + checksum: 65b5df55a8bab92229ab2b40dad3b387fad24613263d103a97f91c9fe43ceb21965cd3392b1ccb5d77088021e525c4e0481adb309625d0cb94ade1d1fb8dc17e + languageName: node + linkType: hard + +"err-code@npm:^2.0.2": + version: 2.0.3 + resolution: "err-code@npm:2.0.3" + checksum: 8b7b1be20d2de12d2255c0bc2ca638b7af5171142693299416e6a9339bd7d88fc8d7707d913d78e0993176005405a236b066b45666b27b797252c771156ace54 + languageName: node + linkType: hard + +"error-ex@npm:^1.3.1": + version: 1.3.2 + resolution: "error-ex@npm:1.3.2" + dependencies: + is-arrayish: ^0.2.1 + checksum: c1c2b8b65f9c91b0f9d75f0debaa7ec5b35c266c2cac5de412c1a6de86d4cbae04ae44e510378cb14d032d0645a36925d0186f8bb7367bcc629db256b743a001 + languageName: node + linkType: hard + +"errorstacks@npm:^2.2.0": + version: 2.4.0 + resolution: "errorstacks@npm:2.4.0" + checksum: 59186ccd26d8b782682a17aa8c96a71c5b977e7e073ec1648a5b59d11acb02348000921751c28a1a8a5bea37481369b2dab27e6330c5b8ddf3ae9b610dfc02bf + languageName: node + linkType: hard + +"es-module-lexer@npm:^1.0.0, es-module-lexer@npm:^1.2.1": + version: 1.3.1 + resolution: "es-module-lexer@npm:1.3.1" + checksum: 3beafa7e171eb1e8cc45695edf8d51638488dddf65294d7911f8d6a96249da6a9838c87529262cc6ea53988d8272cec0f4bff93f476ed031a54ba3afb51a0ed3 + languageName: node + linkType: hard + +"esbuild@npm:^0.16 || ^0.17": + version: 0.17.19 + resolution: "esbuild@npm:0.17.19" + dependencies: + "@esbuild/android-arm": 0.17.19 + "@esbuild/android-arm64": 0.17.19 + "@esbuild/android-x64": 0.17.19 + "@esbuild/darwin-arm64": 0.17.19 + "@esbuild/darwin-x64": 0.17.19 + "@esbuild/freebsd-arm64": 0.17.19 + "@esbuild/freebsd-x64": 0.17.19 + "@esbuild/linux-arm": 0.17.19 + "@esbuild/linux-arm64": 0.17.19 + "@esbuild/linux-ia32": 0.17.19 + "@esbuild/linux-loong64": 0.17.19 + "@esbuild/linux-mips64el": 0.17.19 + "@esbuild/linux-ppc64": 0.17.19 + "@esbuild/linux-riscv64": 0.17.19 + "@esbuild/linux-s390x": 0.17.19 + "@esbuild/linux-x64": 0.17.19 + "@esbuild/netbsd-x64": 0.17.19 + "@esbuild/openbsd-x64": 0.17.19 + "@esbuild/sunos-x64": 0.17.19 + "@esbuild/win32-arm64": 0.17.19 + "@esbuild/win32-ia32": 0.17.19 + "@esbuild/win32-x64": 0.17.19 + dependenciesMeta: + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: ac11b1a5a6008e4e37ccffbd6c2c054746fc58d0ed4a2f9ee643bd030cfcea9a33a235087bc777def8420f2eaafb3486e76adb7bdb7241a9143b43a69a10afd8 + languageName: node + linkType: hard + +"escalade@npm:^3.1.1": + version: 3.1.1 + resolution: "escalade@npm:3.1.1" + checksum: a3e2a99f07acb74b3ad4989c48ca0c3140f69f923e56d0cba0526240ee470b91010f9d39001f2a4a313841d237ede70a729e92125191ba5d21e74b106800b133 + languageName: node + linkType: hard + +"escape-goat@npm:^2.0.0": + version: 2.1.1 + resolution: "escape-goat@npm:2.1.1" + checksum: ce05c70c20dd7007b60d2d644b625da5412325fdb57acf671ba06cb2ab3cd6789e2087026921a05b665b0a03fadee2955e7fc0b9a67da15a6551a980b260eba7 + languageName: node + linkType: hard + +"escape-html@npm:^1.0.3, escape-html@npm:~1.0.3": + version: 1.0.3 + resolution: "escape-html@npm:1.0.3" + checksum: 6213ca9ae00d0ab8bccb6d8d4e0a98e76237b2410302cf7df70aaa6591d509a2a37ce8998008cbecae8fc8ffaadf3fb0229535e6a145f3ce0b211d060decbb24 + languageName: node + linkType: hard + +"escape-string-regexp@npm:4.0.0, escape-string-regexp@npm:^4.0.0": + version: 4.0.0 + resolution: "escape-string-regexp@npm:4.0.0" + checksum: 98b48897d93060f2322108bf29db0feba7dd774be96cd069458d1453347b25ce8682ecc39859d4bca2203cc0ab19c237bcc71755eff49a0f8d90beadeeba5cc5 + languageName: node + linkType: hard + +"escape-string-regexp@npm:5.0.0, escape-string-regexp@npm:^5.0.0": + version: 5.0.0 + resolution: "escape-string-regexp@npm:5.0.0" + checksum: 20daabe197f3cb198ec28546deebcf24b3dbb1a5a269184381b3116d12f0532e06007f4bc8da25669d6a7f8efb68db0758df4cd981f57bc5b57f521a3e12c59e + languageName: node + linkType: hard + +"escape-string-regexp@npm:^1.0.5": + version: 1.0.5 + resolution: "escape-string-regexp@npm:1.0.5" + checksum: 6092fda75c63b110c706b6a9bfde8a612ad595b628f0bd2147eea1d3406723020810e591effc7db1da91d80a71a737a313567c5abb3813e8d9c71f4aa595b410 + languageName: node + linkType: hard + +"escape-string-regexp@npm:^2.0.0": + version: 2.0.0 + resolution: "escape-string-regexp@npm:2.0.0" + checksum: 9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395 + languageName: node + linkType: hard + +"eslint-plugin-prettier@npm:^5.0.0": + version: 5.0.0 + resolution: "eslint-plugin-prettier@npm:5.0.0" + dependencies: + prettier-linter-helpers: ^1.0.0 + synckit: ^0.8.5 + peerDependencies: + "@types/eslint": ">=8.0.0" + eslint: ">=8.0.0" + prettier: ">=3.0.0" + peerDependenciesMeta: + "@types/eslint": + optional: true + eslint-config-prettier: + optional: true + checksum: 84e88744b9050f2d5ef31b94e85294dda16f3a53c2449f9d33eac8ae6264889b459bf35a68e438fb6b329c2a1d6491aac4bfa00d86317e7009de3dad0311bec6 + languageName: node + linkType: hard + +"eslint-scope@npm:5.1.1": + version: 5.1.1 + resolution: "eslint-scope@npm:5.1.1" + dependencies: + esrecurse: ^4.3.0 + estraverse: ^4.1.1 + checksum: 47e4b6a3f0cc29c7feedee6c67b225a2da7e155802c6ea13bbef4ac6b9e10c66cd2dcb987867ef176292bf4e64eccc680a49e35e9e9c669f4a02bac17e86abdb + languageName: node + linkType: hard + +"eslint-scope@npm:^7.2.2": + version: 7.2.2 + resolution: "eslint-scope@npm:7.2.2" + dependencies: + esrecurse: ^4.3.0 + estraverse: ^5.2.0 + checksum: ec97dbf5fb04b94e8f4c5a91a7f0a6dd3c55e46bfc7bbcd0e3138c3a76977570e02ed89a1810c778dcd72072ff0e9621ba1379b4babe53921d71e2e4486fda3e + languageName: node + linkType: hard + +"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 36e9ef87fca698b6fd7ca5ca35d7b2b6eeaaf106572e2f7fd31c12d3bfdaccdb587bba6d3621067e5aece31c8c3a348b93922ab8f7b2cbc6aaab5e1d89040c60 + languageName: node + linkType: hard + +"eslint@npm:^8.50.0": + version: 8.50.0 + resolution: "eslint@npm:8.50.0" + dependencies: + "@eslint-community/eslint-utils": ^4.2.0 + "@eslint-community/regexpp": ^4.6.1 + "@eslint/eslintrc": ^2.1.2 + "@eslint/js": 8.50.0 + "@humanwhocodes/config-array": ^0.11.11 + "@humanwhocodes/module-importer": ^1.0.1 + "@nodelib/fs.walk": ^1.2.8 + ajv: ^6.12.4 + chalk: ^4.0.0 + cross-spawn: ^7.0.2 + debug: ^4.3.2 + doctrine: ^3.0.0 + escape-string-regexp: ^4.0.0 + eslint-scope: ^7.2.2 + eslint-visitor-keys: ^3.4.3 + espree: ^9.6.1 + esquery: ^1.4.2 + esutils: ^2.0.2 + fast-deep-equal: ^3.1.3 + file-entry-cache: ^6.0.1 + find-up: ^5.0.0 + glob-parent: ^6.0.2 + globals: ^13.19.0 + graphemer: ^1.4.0 + ignore: ^5.2.0 + imurmurhash: ^0.1.4 + is-glob: ^4.0.0 + is-path-inside: ^3.0.3 + js-yaml: ^4.1.0 + json-stable-stringify-without-jsonify: ^1.0.1 + levn: ^0.4.1 + lodash.merge: ^4.6.2 + minimatch: ^3.1.2 + natural-compare: ^1.4.0 + optionator: ^0.9.3 + strip-ansi: ^6.0.1 + text-table: ^0.2.0 + bin: + eslint: bin/eslint.js + checksum: 9ebfe5615dc84700000d218e32ddfdcfc227ca600f65f18e5541ec34f8902a00356a9a8804d9468fd6c8637a5ef6a3897291dad91ba6579d5b32ffeae5e31768 + languageName: node + linkType: hard + +"espree@npm:^9.6.0, espree@npm:^9.6.1": + version: 9.6.1 + resolution: "espree@npm:9.6.1" + dependencies: + acorn: ^8.9.0 + acorn-jsx: ^5.3.2 + eslint-visitor-keys: ^3.4.1 + checksum: eb8c149c7a2a77b3f33a5af80c10875c3abd65450f60b8af6db1bfcfa8f101e21c1e56a561c6dc13b848e18148d43469e7cd208506238554fb5395a9ea5a1ab9 + languageName: node + linkType: hard + +"esprima@npm:^4.0.0": + version: 4.0.1 + resolution: "esprima@npm:4.0.1" + bin: + esparse: ./bin/esparse.js + esvalidate: ./bin/esvalidate.js + checksum: b45bc805a613dbea2835278c306b91aff6173c8d034223fa81498c77dcbce3b2931bf6006db816f62eacd9fd4ea975dfd85a5b7f3c6402cfd050d4ca3c13a628 + languageName: node + linkType: hard + +"esquery@npm:^1.4.2": + version: 1.5.0 + resolution: "esquery@npm:1.5.0" + dependencies: + estraverse: ^5.1.0 + checksum: aefb0d2596c230118656cd4ec7532d447333a410a48834d80ea648b1e7b5c9bc9ed8b5e33a89cb04e487b60d622f44cf5713bf4abed7c97343edefdc84a35900 + languageName: node + linkType: hard + +"esrecurse@npm:^4.3.0": + version: 4.3.0 + resolution: "esrecurse@npm:4.3.0" + dependencies: + estraverse: ^5.2.0 + checksum: ebc17b1a33c51cef46fdc28b958994b1dc43cd2e86237515cbc3b4e5d2be6a811b2315d0a1a4d9d340b6d2308b15322f5c8291059521cc5f4802f65e7ec32837 + languageName: node + linkType: hard + +"estraverse@npm:^4.1.1": + version: 4.3.0 + resolution: "estraverse@npm:4.3.0" + checksum: a6299491f9940bb246124a8d44b7b7a413a8336f5436f9837aaa9330209bd9ee8af7e91a654a3545aee9c54b3308e78ee360cef1d777d37cfef77d2fa33b5827 + languageName: node + linkType: hard + +"estraverse@npm:^5.1.0, estraverse@npm:^5.2.0": + version: 5.3.0 + resolution: "estraverse@npm:5.3.0" + checksum: 072780882dc8416ad144f8fe199628d2b3e7bbc9989d9ed43795d2c90309a2047e6bc5979d7e2322a341163d22cfad9e21f4110597fe487519697389497e4e2b + languageName: node + linkType: hard + +"estree-walker@npm:^1.0.1": + version: 1.0.1 + resolution: "estree-walker@npm:1.0.1" + checksum: 7e70da539691f6db03a08e7ce94f394ce2eef4180e136d251af299d41f92fb2d28ebcd9a6e393e3728d7970aeb5358705ddf7209d52fbcb2dd4693f95dcf925f + languageName: node + linkType: hard + +"esutils@npm:^2.0.2, esutils@npm:^2.0.3": + version: 2.0.3 + resolution: "esutils@npm:2.0.3" + checksum: 22b5b08f74737379a840b8ed2036a5fb35826c709ab000683b092d9054e5c2a82c27818f12604bfc2a9a76b90b6834ef081edbc1c7ae30d1627012e067c6ec87 + languageName: node + linkType: hard + +"eta@npm:^2.0.0": + version: 2.2.0 + resolution: "eta@npm:2.2.0" + checksum: 6a09631481d4f26a9662a1eb736a65cc1cbc48e24935e6ff5d83a83b0cb509ea56d588d66d7c087d590601dc59bdabdac2356936b1b789d020eb0cf2d8304d54 + languageName: node + linkType: hard + +"etag@npm:^1.8.1, etag@npm:~1.8.1": + version: 1.8.1 + resolution: "etag@npm:1.8.1" + checksum: 571aeb3dbe0f2bbd4e4fadbdb44f325fc75335cd5f6f6b6a091e6a06a9f25ed5392f0863c5442acb0646787446e816f13cbfc6edce5b07658541dff573cab1ff + languageName: node + linkType: hard + +"ethereum-cryptography@npm:0.1.3, ethereum-cryptography@npm:^0.1.3": + version: 0.1.3 + resolution: "ethereum-cryptography@npm:0.1.3" + dependencies: + "@types/pbkdf2": ^3.0.0 + "@types/secp256k1": ^4.0.1 + blakejs: ^1.1.0 + browserify-aes: ^1.2.0 + bs58check: ^2.1.2 + create-hash: ^1.2.0 + create-hmac: ^1.1.7 + hash.js: ^1.1.7 + keccak: ^3.0.0 + pbkdf2: ^3.0.17 + randombytes: ^2.1.0 + safe-buffer: ^5.1.2 + scrypt-js: ^3.0.0 + secp256k1: ^4.0.1 + setimmediate: ^1.0.5 + checksum: 54bae7a4a96bd81398cdc35c91cfcc74339f71a95ed1b5b694663782e69e8e3afd21357de3b8bac9ff4877fd6f043601e200a7ad9133d94be6fd7d898ee0a449 + languageName: node + linkType: hard + +"ethereum-cryptography@npm:^1.0.3": + version: 1.2.0 + resolution: "ethereum-cryptography@npm:1.2.0" + dependencies: + "@noble/hashes": 1.2.0 + "@noble/secp256k1": 1.7.1 + "@scure/bip32": 1.1.5 + "@scure/bip39": 1.1.1 + checksum: 97e8e8253cb9f5a9271bd0201c37609c451c890eb85883b9c564f14743c3d7c673287406c93bf5604307593ee298ad9a03983388b85c11ca61461b9fc1a4f2c7 + languageName: node + linkType: hard + +"ethereumjs-abi@npm:^0.6.8": + version: 0.6.8 + resolution: "ethereumjs-abi@npm:0.6.8" + dependencies: + bn.js: ^4.11.8 + ethereumjs-util: ^6.0.0 + checksum: cede2a8ae7c7e04eeaec079c2f925601a25b2ef75cf9230e7c5da63b4ea27883b35447365a47e35c1e831af520973a2252af89022c292c18a09a4607821a366b + languageName: node + linkType: hard + +"ethereumjs-util@npm:^6.0.0, ethereumjs-util@npm:^6.2.1": + version: 6.2.1 + resolution: "ethereumjs-util@npm:6.2.1" + dependencies: + "@types/bn.js": ^4.11.3 + bn.js: ^4.11.0 + create-hash: ^1.1.2 + elliptic: ^6.5.2 + ethereum-cryptography: ^0.1.3 + ethjs-util: 0.1.6 + rlp: ^2.2.3 + checksum: e3cb4a2c034a2529281fdfc21a2126fe032fdc3038863f5720352daa65ddcc50fc8c67dbedf381a882dc3802e05d979287126d7ecf781504bde1fd8218693bde + languageName: node + linkType: hard + +"ethers@npm:^5.7.1": + version: 5.7.2 + resolution: "ethers@npm:5.7.2" + dependencies: + "@ethersproject/abi": 5.7.0 + "@ethersproject/abstract-provider": 5.7.0 + "@ethersproject/abstract-signer": 5.7.0 + "@ethersproject/address": 5.7.0 + "@ethersproject/base64": 5.7.0 + "@ethersproject/basex": 5.7.0 + "@ethersproject/bignumber": 5.7.0 + "@ethersproject/bytes": 5.7.0 + "@ethersproject/constants": 5.7.0 + "@ethersproject/contracts": 5.7.0 + "@ethersproject/hash": 5.7.0 + "@ethersproject/hdnode": 5.7.0 + "@ethersproject/json-wallets": 5.7.0 + "@ethersproject/keccak256": 5.7.0 + "@ethersproject/logger": 5.7.0 + "@ethersproject/networks": 5.7.1 + "@ethersproject/pbkdf2": 5.7.0 + "@ethersproject/properties": 5.7.0 + "@ethersproject/providers": 5.7.2 + "@ethersproject/random": 5.7.0 + "@ethersproject/rlp": 5.7.0 + "@ethersproject/sha2": 5.7.0 + "@ethersproject/signing-key": 5.7.0 + "@ethersproject/solidity": 5.7.0 + "@ethersproject/strings": 5.7.0 + "@ethersproject/transactions": 5.7.0 + "@ethersproject/units": 5.7.0 + "@ethersproject/wallet": 5.7.0 + "@ethersproject/web": 5.7.1 + "@ethersproject/wordlists": 5.7.0 + checksum: b7c08cf3e257185a7946117dbbf764433b7ba0e77c27298dec6088b3bc871aff711462b0621930c56880ff0a7ceb8b1d3a361ffa259f93377b48e34107f62553 + languageName: node + linkType: hard + +"ethers@npm:^6.7.1": + version: 6.7.1 + resolution: "ethers@npm:6.7.1" + dependencies: + "@adraffy/ens-normalize": 1.9.2 + "@noble/hashes": 1.1.2 + "@noble/secp256k1": 1.7.1 + "@types/node": 18.15.13 + aes-js: 4.0.0-beta.5 + tslib: 2.4.0 + ws: 8.5.0 + checksum: 07833692e3f53b18e28c4cba9f53f3d5ebff8360de02ad57b2584c00c52b88f5b790373f9b9f6b4f6b52ffa2074530a6101192b30c3260f7cdeff929d34bb88b + languageName: node + linkType: hard + +"ethjs-util@npm:0.1.6, ethjs-util@npm:^0.1.6": + version: 0.1.6 + resolution: "ethjs-util@npm:0.1.6" + dependencies: + is-hex-prefixed: 1.0.0 + strip-hex-prefix: 1.0.0 + checksum: 1f42959e78ec6f49889c49c8a98639e06f52a15966387dd39faf2930db48663d026efb7db2702dcffe7f2a99c4a0144b7ce784efdbf733f4077aae95de76d65f + languageName: node + linkType: hard + +"eval@npm:^0.1.8": + version: 0.1.8 + resolution: "eval@npm:0.1.8" + dependencies: + "@types/node": "*" + require-like: ">= 0.1.1" + checksum: d005567f394cfbe60948e34982e4637d2665030f9aa7dcac581ea6f9ec6eceb87133ed3dc0ae21764aa362485c242a731dbb6371f1f1a86807c58676431e9d1a + languageName: node + linkType: hard + +"event-stream@npm:=3.3.4": + version: 3.3.4 + resolution: "event-stream@npm:3.3.4" + dependencies: + duplexer: ~0.1.1 + from: ~0 + map-stream: ~0.1.0 + pause-stream: 0.0.11 + split: 0.3 + stream-combiner: ~0.0.4 + through: ~2.3.1 + checksum: 80b467820b6daf824d9fb4345d2daf115a056e5c104463f2e98534e92d196a27f2df5ea2aa085624db26f4c45698905499e881d13bc7c01f7a13eac85be72a22 + languageName: node + linkType: hard + +"eventemitter3@npm:^4.0.0": + version: 4.0.7 + resolution: "eventemitter3@npm:4.0.7" + checksum: 1875311c42fcfe9c707b2712c32664a245629b42bb0a5a84439762dd0fd637fc54d078155ea83c2af9e0323c9ac13687e03cfba79b03af9f40c89b4960099374 + languageName: node + linkType: hard + +"events@npm:^3.2.0": + version: 3.3.0 + resolution: "events@npm:3.3.0" + checksum: f6f487ad2198aa41d878fa31452f1a3c00958f46e9019286ff4787c84aac329332ab45c9cdc8c445928fc6d7ded294b9e005a7fce9426488518017831b272780 + languageName: node + linkType: hard + +"evp_bytestokey@npm:^1.0.3": + version: 1.0.3 + resolution: "evp_bytestokey@npm:1.0.3" + dependencies: + md5.js: ^1.3.4 + node-gyp: latest + safe-buffer: ^5.1.1 + checksum: ad4e1577f1a6b721c7800dcc7c733fe01f6c310732bb5bf2240245c2a5b45a38518b91d8be2c610611623160b9d1c0e91f1ce96d639f8b53e8894625cf20fa45 + languageName: node + linkType: hard + +"execa@npm:^5.0.0": + version: 5.1.1 + resolution: "execa@npm:5.1.1" + dependencies: + cross-spawn: ^7.0.3 + get-stream: ^6.0.0 + human-signals: ^2.1.0 + is-stream: ^2.0.0 + merge-stream: ^2.0.0 + npm-run-path: ^4.0.1 + onetime: ^5.1.2 + signal-exit: ^3.0.3 + strip-final-newline: ^2.0.0 + checksum: fba9022c8c8c15ed862847e94c252b3d946036d7547af310e344a527e59021fd8b6bb0723883ea87044dc4f0201f949046993124a42ccb0855cae5bf8c786343 + languageName: node + linkType: hard + +"execa@npm:^7.1.1": + version: 7.2.0 + resolution: "execa@npm:7.2.0" + dependencies: + cross-spawn: ^7.0.3 + get-stream: ^6.0.1 + human-signals: ^4.3.0 + is-stream: ^3.0.0 + merge-stream: ^2.0.0 + npm-run-path: ^5.1.0 + onetime: ^6.0.0 + signal-exit: ^3.0.7 + strip-final-newline: ^3.0.0 + checksum: 14fd17ba0ca8c87b277584d93b1d9fc24f2a65e5152b31d5eb159a3b814854283eaae5f51efa9525e304447e2f757c691877f7adff8fde5746aae67eb1edd1cc + languageName: node + linkType: hard + +"exponential-backoff@npm:^3.1.1": + version: 3.1.1 + resolution: "exponential-backoff@npm:3.1.1" + checksum: 3d21519a4f8207c99f7457287291316306255a328770d320b401114ec8481986e4e467e854cb9914dd965e0a1ca810a23ccb559c642c88f4c7f55c55778a9b48 + languageName: node + linkType: hard + +"express@npm:^4.17.3": + version: 4.18.2 + resolution: "express@npm:4.18.2" + dependencies: + accepts: ~1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.1 + content-disposition: 0.5.4 + content-type: ~1.0.4 + cookie: 0.5.0 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: ~1.0.2 + escape-html: ~1.0.3 + etag: ~1.8.1 + finalhandler: 1.2.0 + fresh: 0.5.2 + http-errors: 2.0.0 + merge-descriptors: 1.0.1 + methods: ~1.1.2 + on-finished: 2.4.1 + parseurl: ~1.3.3 + path-to-regexp: 0.1.7 + proxy-addr: ~2.0.7 + qs: 6.11.0 + range-parser: ~1.2.1 + safe-buffer: 5.2.1 + send: 0.18.0 + serve-static: 1.15.0 + setprototypeof: 1.2.0 + statuses: 2.0.1 + type-is: ~1.6.18 + utils-merge: 1.0.1 + vary: ~1.1.2 + checksum: 3c4b9b076879442f6b968fe53d85d9f1eeacbb4f4c41e5f16cc36d77ce39a2b0d81b3f250514982110d815b2f7173f5561367f9110fcc541f9371948e8c8b037 + languageName: node + linkType: hard + +"extend-shallow@npm:^2.0.1": + version: 2.0.1 + resolution: "extend-shallow@npm:2.0.1" + dependencies: + is-extendable: ^0.1.0 + checksum: 8fb58d9d7a511f4baf78d383e637bd7d2e80843bd9cd0853649108ea835208fb614da502a553acc30208e1325240bb7cc4a68473021612496bb89725483656d8 + languageName: node + linkType: hard + +"extend@npm:^3.0.0": + version: 3.0.2 + resolution: "extend@npm:3.0.2" + checksum: a50a8309ca65ea5d426382ff09f33586527882cf532931cb08ca786ea3146c0553310bda688710ff61d7668eba9f96b923fe1420cdf56a2c3eaf30fcab87b515 + languageName: node + linkType: hard + +"extract-zip@npm:2.0.1": + version: 2.0.1 + resolution: "extract-zip@npm:2.0.1" + dependencies: + "@types/yauzl": ^2.9.1 + debug: ^4.1.1 + get-stream: ^5.1.0 + yauzl: ^2.10.0 + dependenciesMeta: + "@types/yauzl": + optional: true + bin: + extract-zip: cli.js + checksum: 8cbda9debdd6d6980819cc69734d874ddd71051c9fe5bde1ef307ebcedfe949ba57b004894b585f758b7c9eeeea0e3d87f2dda89b7d25320459c2c9643ebb635 + languageName: node + linkType: hard + +"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": + version: 3.1.3 + resolution: "fast-deep-equal@npm:3.1.3" + checksum: e21a9d8d84f53493b6aa15efc9cfd53dd5b714a1f23f67fb5dc8f574af80df889b3bce25dc081887c6d25457cce704e636395333abad896ccdec03abaf1f3f9d + languageName: node + linkType: hard + +"fast-diff@npm:^1.1.2, fast-diff@npm:^1.2.0": + version: 1.3.0 + resolution: "fast-diff@npm:1.3.0" + checksum: d22d371b994fdc8cce9ff510d7b8dc4da70ac327bcba20df607dd5b9cae9f908f4d1028f5fe467650f058d1e7270235ae0b8230809a262b4df587a3b3aa216c3 + languageName: node + linkType: hard + +"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.12, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0": + version: 3.3.1 + resolution: "fast-glob@npm:3.3.1" + dependencies: + "@nodelib/fs.stat": ^2.0.2 + "@nodelib/fs.walk": ^1.2.3 + glob-parent: ^5.1.2 + merge2: ^1.3.0 + micromatch: ^4.0.4 + checksum: b6f3add6403e02cf3a798bfbb1183d0f6da2afd368f27456010c0bc1f9640aea308243d4cb2c0ab142f618276e65ecb8be1661d7c62a7b4e5ba774b9ce5432e5 + languageName: node + linkType: hard + +"fast-json-stable-stringify@npm:^2.0.0": + version: 2.1.0 + resolution: "fast-json-stable-stringify@npm:2.1.0" + checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb + languageName: node + linkType: hard + +"fast-levenshtein@npm:^2.0.6": + version: 2.0.6 + resolution: "fast-levenshtein@npm:2.0.6" + checksum: 92cfec0a8dfafd9c7a15fba8f2cc29cd0b62b85f056d99ce448bbcd9f708e18ab2764bda4dd5158364f4145a7c72788538994f0d1787b956ef0d1062b0f7c24c + languageName: node + linkType: hard + +"fast-url-parser@npm:1.1.3": + version: 1.1.3 + resolution: "fast-url-parser@npm:1.1.3" + dependencies: + punycode: ^1.3.2 + checksum: 5043d0c4a8d775ff58504d56c096563c11b113e4cb8a2668c6f824a1cd4fb3812e2fdf76537eb24a7ce4ae7def6bd9747da630c617cf2a4b6ce0c42514e4f21c + languageName: node + linkType: hard + +"fastq@npm:^1.6.0": + version: 1.15.0 + resolution: "fastq@npm:1.15.0" + dependencies: + reusify: ^1.0.4 + checksum: 0170e6bfcd5d57a70412440b8ef600da6de3b2a6c5966aeaf0a852d542daff506a0ee92d6de7679d1de82e644bce69d7a574a6c93f0b03964b5337eed75ada1a + languageName: node + linkType: hard + +"faye-websocket@npm:^0.11.3": + version: 0.11.4 + resolution: "faye-websocket@npm:0.11.4" + dependencies: + websocket-driver: ">=0.5.1" + checksum: d49a62caf027f871149fc2b3f3c7104dc6d62744277eb6f9f36e2d5714e847d846b9f7f0d0b7169b25a012e24a594cde11a93034b30732e4c683f20b8a5019fa + languageName: node + linkType: hard + +"fbemitter@npm:^3.0.0": + version: 3.0.0 + resolution: "fbemitter@npm:3.0.0" + dependencies: + fbjs: ^3.0.0 + checksum: 069690b8cdff3521ade3c9beb92ba0a38d818a86ef36dff8690e66749aef58809db4ac0d6938eb1cacea2dbef5f2a508952d455669590264cdc146bbe839f605 + languageName: node + linkType: hard + +"fbjs-css-vars@npm:^1.0.0": + version: 1.0.2 + resolution: "fbjs-css-vars@npm:1.0.2" + checksum: 72baf6d22c45b75109118b4daecb6c8016d4c83c8c0f23f683f22e9d7c21f32fff6201d288df46eb561e3c7d4bb4489b8ad140b7f56444c453ba407e8bd28511 + languageName: node + linkType: hard + +"fbjs@npm:^3.0.0, fbjs@npm:^3.0.1": + version: 3.0.5 + resolution: "fbjs@npm:3.0.5" + dependencies: + cross-fetch: ^3.1.5 + fbjs-css-vars: ^1.0.0 + loose-envify: ^1.0.0 + object-assign: ^4.1.0 + promise: ^7.1.1 + setimmediate: ^1.0.5 + ua-parser-js: ^1.0.35 + checksum: e609b5b64686bc96495a5c67728ed9b2710b9b3d695c5759c5f5e47c9483d1c323543ac777a86459e3694efc5712c6ce7212e944feb19752867d699568bb0e54 + languageName: node + linkType: hard + +"fd-slicer@npm:~1.1.0": + version: 1.1.0 + resolution: "fd-slicer@npm:1.1.0" + dependencies: + pend: ~1.2.0 + checksum: c8585fd5713f4476eb8261150900d2cb7f6ff2d87f8feb306ccc8a1122efd152f1783bdb2b8dc891395744583436bfd8081d8e63ece0ec8687eeefea394d4ff2 + languageName: node + linkType: hard + +"feed@npm:^4.2.2": + version: 4.2.2 + resolution: "feed@npm:4.2.2" + dependencies: + xml-js: ^1.6.11 + checksum: 2e6992a675a049511eef7bda8ca6c08cb9540cd10e8b275ec4c95d166228ec445a335fa8de990358759f248a92861e51decdcd32bf1c54737d5b7aed7c7ffe97 + languageName: node + linkType: hard + +"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": + version: 3.2.0 + resolution: "fetch-blob@npm:3.2.0" + dependencies: + node-domexception: ^1.0.0 + web-streams-polyfill: ^3.0.3 + checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf + languageName: node + linkType: hard + +"fflate@npm:^0.8.0": + version: 0.8.1 + resolution: "fflate@npm:0.8.1" + checksum: 7207e2d333243724485d2488095256b776184bd4545aa9967b655feaee5dc18e9525ed9b6d75f94cfd71d98fb285336f4902641683472f1d0c19a99137084cec + languageName: node + linkType: hard + +"figures@npm:^5.0.0": + version: 5.0.0 + resolution: "figures@npm:5.0.0" + dependencies: + escape-string-regexp: ^5.0.0 + is-unicode-supported: ^1.2.0 + checksum: e6e8b6d1df2f554d4effae4a5ceff5d796f9449f6d4e912d74dab7d5f25916ecda6c305b9084833157d56485a0c78b37164430ddc5675bcee1330e346710669e + languageName: node + linkType: hard + +"file-entry-cache@npm:^6.0.1": + version: 6.0.1 + resolution: "file-entry-cache@npm:6.0.1" + dependencies: + flat-cache: ^3.0.4 + checksum: f49701feaa6314c8127c3c2f6173cfefff17612f5ed2daaafc6da13b5c91fd43e3b2a58fd0d63f9f94478a501b167615931e7200e31485e320f74a33885a9c74 + languageName: node + linkType: hard + +"file-loader@npm:^6.2.0": + version: 6.2.0 + resolution: "file-loader@npm:6.2.0" + dependencies: + loader-utils: ^2.0.0 + schema-utils: ^3.0.0 + peerDependencies: + webpack: ^4.0.0 || ^5.0.0 + checksum: faf43eecf233f4897b0150aaa874eeeac214e4f9de49738a9e0ef734a30b5260059e85b7edadf852b98e415f875bd5f12587768a93fd52aaf2e479ecf95fab20 + languageName: node + linkType: hard + +"filesize@npm:^8.0.6": + version: 8.0.7 + resolution: "filesize@npm:8.0.7" + checksum: 8603d27c5287b984cb100733640645e078f5f5ad65c6d913173e01fb99e09b0747828498fd86647685ccecb69be31f3587b9739ab1e50732116b2374aff4cbf9 + languageName: node + linkType: hard + +"fill-range@npm:^7.0.1": + version: 7.0.1 + resolution: "fill-range@npm:7.0.1" + dependencies: + to-regex-range: ^5.0.1 + checksum: cc283f4e65b504259e64fd969bcf4def4eb08d85565e906b7d36516e87819db52029a76b6363d0f02d0d532f0033c9603b9e2d943d56ee3b0d4f7ad3328ff917 + languageName: node + linkType: hard + +"finalhandler@npm:1.2.0": + version: 1.2.0 + resolution: "finalhandler@npm:1.2.0" + dependencies: + debug: 2.6.9 + encodeurl: ~1.0.2 + escape-html: ~1.0.3 + on-finished: 2.4.1 + parseurl: ~1.3.3 + statuses: 2.0.1 + unpipe: ~1.0.0 + checksum: 92effbfd32e22a7dff2994acedbd9bcc3aa646a3e919ea6a53238090e87097f8ef07cced90aa2cc421abdf993aefbdd5b00104d55c7c5479a8d00ed105b45716 + languageName: node + linkType: hard + +"find-cache-dir@npm:^3.3.1": + version: 3.3.2 + resolution: "find-cache-dir@npm:3.3.2" + dependencies: + commondir: ^1.0.1 + make-dir: ^3.0.2 + pkg-dir: ^4.1.0 + checksum: 1e61c2e64f5c0b1c535bd85939ae73b0e5773142713273818cc0b393ee3555fb0fd44e1a5b161b8b6c3e03e98c2fcc9c227d784850a13a90a8ab576869576817 + languageName: node + linkType: hard + +"find-replace@npm:^3.0.0": + version: 3.0.0 + resolution: "find-replace@npm:3.0.0" + dependencies: + array-back: ^3.0.1 + checksum: 6b04bcfd79027f5b84aa1dfe100e3295da989bdac4b4de6b277f4d063e78f5c9e92ebc8a1fec6dd3b448c924ba404ee051cc759e14a3ee3e825fa1361025df08 + languageName: node + linkType: hard + +"find-up@npm:5.0.0, find-up@npm:^5.0.0": + version: 5.0.0 + resolution: "find-up@npm:5.0.0" + dependencies: + locate-path: ^6.0.0 + path-exists: ^4.0.0 + checksum: 07955e357348f34660bde7920783204ff5a26ac2cafcaa28bace494027158a97b9f56faaf2d89a6106211a8174db650dd9f503f9c0d526b1202d5554a00b9095 + languageName: node + linkType: hard + +"find-up@npm:^2.1.0": + version: 2.1.0 + resolution: "find-up@npm:2.1.0" + dependencies: + locate-path: ^2.0.0 + checksum: 43284fe4da09f89011f08e3c32cd38401e786b19226ea440b75386c1b12a4cb738c94969808d53a84f564ede22f732c8409e3cfc3f7fb5b5c32378ad0bbf28bd + languageName: node + linkType: hard + +"find-up@npm:^3.0.0": + version: 3.0.0 + resolution: "find-up@npm:3.0.0" + dependencies: + locate-path: ^3.0.0 + checksum: 38eba3fe7a66e4bc7f0f5a1366dc25508b7cfc349f852640e3678d26ad9a6d7e2c43eff0a472287de4a9753ef58f066a0ea892a256fa3636ad51b3fe1e17fae9 + languageName: node + linkType: hard + +"find-up@npm:^4.0.0": + version: 4.1.0 + resolution: "find-up@npm:4.1.0" + dependencies: + locate-path: ^5.0.0 + path-exists: ^4.0.0 + checksum: 4c172680e8f8c1f78839486e14a43ef82e9decd0e74145f40707cc42e7420506d5ec92d9a11c22bd2c48fb0c384ea05dd30e10dd152fefeec6f2f75282a8b844 + languageName: node + linkType: hard + +"find-up@npm:^6.0.0": + version: 6.3.0 + resolution: "find-up@npm:6.3.0" + dependencies: + locate-path: ^7.1.0 + path-exists: ^5.0.0 + checksum: 9a21b7f9244a420e54c6df95b4f6fc3941efd3c3e5476f8274eb452f6a85706e7a6a90de71353ee4f091fcb4593271a6f92810a324ec542650398f928783c280 + languageName: node + linkType: hard + +"flat-cache@npm:^3.0.4": + version: 3.1.0 + resolution: "flat-cache@npm:3.1.0" + dependencies: + flatted: ^3.2.7 + keyv: ^4.5.3 + rimraf: ^3.0.2 + checksum: 99312601d5b90f44aef403f17f056dc09be7e437703740b166cdc9386d99e681f74e6b6e8bd7d010bda66904ea643c9527276b1b80308a2119741d94108a4d8f + languageName: node + linkType: hard + +"flat@npm:^5.0.2": + version: 5.0.2 + resolution: "flat@npm:5.0.2" + bin: + flat: cli.js + checksum: 12a1536ac746db74881316a181499a78ef953632ddd28050b7a3a43c62ef5462e3357c8c29d76072bb635f147f7a9a1f0c02efef6b4be28f8db62ceb3d5c7f5d + languageName: node + linkType: hard + +"flatted@npm:^3.2.7": + version: 3.2.9 + resolution: "flatted@npm:3.2.9" + checksum: f14167fbe26a9d20f6fca8d998e8f1f41df72c8e81f9f2c9d61ed2bea058248f5e1cbd05e7f88c0e5087a6a0b822a1e5e2b446e879f3cfbe0b07ba2d7f80b026 + languageName: node + linkType: hard + +"flux@npm:^4.0.1": + version: 4.0.4 + resolution: "flux@npm:4.0.4" + dependencies: + fbemitter: ^3.0.0 + fbjs: ^3.0.1 + peerDependencies: + react: ^15.0.2 || ^16.0.0 || ^17.0.0 + checksum: 8fa5c2f9322258de3e331f67c6f1078a7f91c4dec9dbe8a54c4b8a80eed19a4f91889028b768668af4a796e8f2ee75e461e1571b8615432a3920ae95cc4ff794 + languageName: node + linkType: hard + +"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.12.1, follow-redirects@npm:^1.14.7, follow-redirects@npm:^1.15.0": + version: 1.15.3 + resolution: "follow-redirects@npm:1.15.3" + peerDependenciesMeta: + debug: + optional: true + checksum: 584da22ec5420c837bd096559ebfb8fe69d82512d5585004e36a3b4a6ef6d5905780e0c74508c7b72f907d1fa2b7bd339e613859e9c304d0dc96af2027fd0231 + languageName: node + linkType: hard + +"foreground-child@npm:^3.1.0": + version: 3.1.1 + resolution: "foreground-child@npm:3.1.1" + dependencies: + cross-spawn: ^7.0.0 + signal-exit: ^4.0.1 + checksum: 139d270bc82dc9e6f8bc045fe2aae4001dc2472157044fdfad376d0a3457f77857fa883c1c8b21b491c6caade9a926a4bed3d3d2e8d3c9202b151a4cbbd0bcd5 + languageName: node + linkType: hard + +"fork-ts-checker-webpack-plugin@npm:^6.5.0": + version: 6.5.3 + resolution: "fork-ts-checker-webpack-plugin@npm:6.5.3" + dependencies: + "@babel/code-frame": ^7.8.3 + "@types/json-schema": ^7.0.5 + chalk: ^4.1.0 + chokidar: ^3.4.2 + cosmiconfig: ^6.0.0 + deepmerge: ^4.2.2 + fs-extra: ^9.0.0 + glob: ^7.1.6 + memfs: ^3.1.2 + minimatch: ^3.0.4 + schema-utils: 2.7.0 + semver: ^7.3.2 + tapable: ^1.0.0 + peerDependencies: + eslint: ">= 6" + typescript: ">= 2.7" + vue-template-compiler: "*" + webpack: ">= 4" + peerDependenciesMeta: + eslint: + optional: true + vue-template-compiler: + optional: true + checksum: 9732a49bfeed8fc23e6e8a59795fa7c238edeba91040a9b520db54b4d316dda27f9f1893d360e296fd0ad8930627d364417d28a8c7007fba60cc730ebfce4956 + languageName: node + linkType: hard + +"form-data@npm:^4.0.0": + version: 4.0.0 + resolution: "form-data@npm:4.0.0" + dependencies: + asynckit: ^0.4.0 + combined-stream: ^1.0.8 + mime-types: ^2.1.12 + checksum: 01135bf8675f9d5c61ff18e2e2932f719ca4de964e3be90ef4c36aacfc7b9cb2fceb5eca0b7e0190e3383fe51c5b37f4cb80b62ca06a99aaabfcfd6ac7c9328c + languageName: node + linkType: hard + +"formdata-polyfill@npm:^4.0.10": + version: 4.0.10 + resolution: "formdata-polyfill@npm:4.0.10" + dependencies: + fetch-blob: ^3.1.2 + checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db + languageName: node + linkType: hard + +"forwarded@npm:0.2.0": + version: 0.2.0 + resolution: "forwarded@npm:0.2.0" + checksum: fd27e2394d8887ebd16a66ffc889dc983fbbd797d5d3f01087c020283c0f019a7d05ee85669383d8e0d216b116d720fc0cef2f6e9b7eb9f4c90c6e0bc7fd28e6 + languageName: node + linkType: hard + +"fp-ts@npm:1.19.3": + version: 1.19.3 + resolution: "fp-ts@npm:1.19.3" + checksum: eb0d4766ad561e9c5c01bfdd3d0ae589af135556921c733d26cf5289aad9f400110defdd93e6ac1d71f626697bb44d9d95ed2879c53dfd868f7cac3cf5c5553c + languageName: node + linkType: hard + +"fp-ts@npm:^1.0.0": + version: 1.19.5 + resolution: "fp-ts@npm:1.19.5" + checksum: 67d2d9c3855d211ca2592b1ef805f98b618157e7681791a776d9d0f7f3e52fcca2122ebf5bc215908c9099fad69756d40e37210cf46cb4075dae1b61efe69e40 + languageName: node + linkType: hard + +"fraction.js@npm:^4.3.6": + version: 4.3.7 + resolution: "fraction.js@npm:4.3.7" + checksum: e1553ae3f08e3ba0e8c06e43a3ab20b319966dfb7ddb96fd9b5d0ee11a66571af7f993229c88ebbb0d4a816eb813a24ed48207b140d442a8f76f33763b8d1f3f + languageName: node + linkType: hard + +"fresh@npm:0.5.2, fresh@npm:~0.5.2": + version: 0.5.2 + resolution: "fresh@npm:0.5.2" + checksum: 13ea8b08f91e669a64e3ba3a20eb79d7ca5379a81f1ff7f4310d54e2320645503cc0c78daedc93dfb6191287295f6479544a649c64d8e41a1c0fb0c221552346 + languageName: node + linkType: hard + +"from@npm:~0": + version: 0.1.7 + resolution: "from@npm:0.1.7" + checksum: b85125b7890489656eb2e4f208f7654a93ec26e3aefaf3bbbcc0d496fc1941e4405834fcc9fe7333192aa2187905510ace70417bbf9ac6f6f4784a731d986939 + languageName: node + linkType: hard + +"fs-constants@npm:^1.0.0": + version: 1.0.0 + resolution: "fs-constants@npm:1.0.0" + checksum: 18f5b718371816155849475ac36c7d0b24d39a11d91348cfcb308b4494824413e03572c403c86d3a260e049465518c4f0d5bd00f0371cdfcad6d4f30a85b350d + languageName: node + linkType: hard + +"fs-extra@npm:^0.30.0": + version: 0.30.0 + resolution: "fs-extra@npm:0.30.0" + dependencies: + graceful-fs: ^4.1.2 + jsonfile: ^2.1.0 + klaw: ^1.0.0 + path-is-absolute: ^1.0.0 + rimraf: ^2.2.8 + checksum: 6edfd65fc813baa27f1603778c0f5ec11f8c5006a20b920437813ee2023eba18aeec8bef1c89b2e6c84f9fc90fdc7c916f4a700466c8c69d22a35d018f2570f0 + languageName: node + linkType: hard + +"fs-extra@npm:^10.0.0, fs-extra@npm:^10.1.0": + version: 10.1.0 + resolution: "fs-extra@npm:10.1.0" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^6.0.1 + universalify: ^2.0.0 + checksum: dc94ab37096f813cc3ca12f0f1b5ad6744dfed9ed21e953d72530d103cea193c2f81584a39e9dee1bea36de5ee66805678c0dddc048e8af1427ac19c00fffc50 + languageName: node + linkType: hard + +"fs-extra@npm:^7.0.1": + version: 7.0.1 + resolution: "fs-extra@npm:7.0.1" + dependencies: + graceful-fs: ^4.1.2 + jsonfile: ^4.0.0 + universalify: ^0.1.0 + checksum: 141b9dccb23b66a66cefdd81f4cda959ff89282b1d721b98cea19ba08db3dcbe6f862f28841f3cf24bb299e0b7e6c42303908f65093cb7e201708e86ea5a8dcf + languageName: node + linkType: hard + +"fs-extra@npm:^9.0.0": + version: 9.1.0 + resolution: "fs-extra@npm:9.1.0" + dependencies: + at-least-node: ^1.0.0 + graceful-fs: ^4.2.0 + jsonfile: ^6.0.1 + universalify: ^2.0.0 + checksum: ba71ba32e0faa74ab931b7a0031d1523c66a73e225de7426e275e238e312d07313d2da2d33e34a52aa406c8763ade5712eb3ec9ba4d9edce652bcacdc29e6b20 + languageName: node + linkType: hard + +"fs-minipass@npm:^2.0.0": + version: 2.1.0 + resolution: "fs-minipass@npm:2.1.0" + dependencies: + minipass: ^3.0.0 + checksum: 1b8d128dae2ac6cc94230cc5ead341ba3e0efaef82dab46a33d171c044caaa6ca001364178d42069b2809c35a1c3c35079a32107c770e9ffab3901b59af8c8b1 + languageName: node + linkType: hard + +"fs-minipass@npm:^3.0.0": + version: 3.0.3 + resolution: "fs-minipass@npm:3.0.3" + dependencies: + minipass: ^7.0.3 + checksum: 8722a41109130851d979222d3ec88aabaceeaaf8f57b2a8f744ef8bd2d1ce95453b04a61daa0078822bc5cd21e008814f06fe6586f56fef511e71b8d2394d802 + languageName: node + linkType: hard + +"fs-monkey@npm:^1.0.4": + version: 1.0.5 + resolution: "fs-monkey@npm:1.0.5" + checksum: 424b67f65b37fe66117ae2bb061f790fe6d4b609e1d160487c74b3d69fbf42f262c665ccfba32e8b5f113f96f92e9a58fcdebe42d5f6649bdfc72918093a3119 + languageName: node + linkType: hard + +"fs.realpath@npm:^1.0.0": + version: 1.0.0 + resolution: "fs.realpath@npm:1.0.0" + checksum: 99ddea01a7e75aa276c250a04eedeffe5662bce66c65c07164ad6264f9de18fb21be9433ead460e54cff20e31721c811f4fb5d70591799df5f85dce6d6746fd0 + languageName: node + linkType: hard + +"fsevents@npm:2.3.2": + version: 2.3.2 + resolution: "fsevents@npm:2.3.2" + dependencies: + node-gyp: latest + checksum: 97ade64e75091afee5265e6956cb72ba34db7819b4c3e94c431d4be2b19b8bb7a2d4116da417950c3425f17c8fe693d25e20212cac583ac1521ad066b77ae31f + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@npm:~2.3.2": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: latest + checksum: 11e6ea6fea15e42461fc55b4b0e4a0a3c654faa567f1877dbd353f39156f69def97a69936d1746619d656c4b93de2238bf731f6085a03a50cabf287c9d024317 + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@2.3.2#~builtin": + version: 2.3.2 + resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=df0bf1" + dependencies: + node-gyp: latest + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@~2.3.2#~builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#~builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: latest + conditions: os=darwin + languageName: node + linkType: hard + +"function-bind@npm:^1.1.1": + version: 1.1.1 + resolution: "function-bind@npm:1.1.1" + checksum: b32fbaebb3f8ec4969f033073b43f5c8befbb58f1a79e12f1d7490358150359ebd92f49e72ff0144f65f2c48ea2a605bff2d07965f548f6474fd8efd95bf361a + languageName: node + linkType: hard + +"functional-red-black-tree@npm:^1.0.1": + version: 1.0.1 + resolution: "functional-red-black-tree@npm:1.0.1" + checksum: ca6c170f37640e2d94297da8bb4bf27a1d12bea3e00e6a3e007fd7aa32e37e000f5772acf941b4e4f3cf1c95c3752033d0c509af157ad8f526e7f00723b9eb9f + languageName: node + linkType: hard + +"gauge@npm:^4.0.3": + version: 4.0.4 + resolution: "gauge@npm:4.0.4" + dependencies: + aproba: ^1.0.3 || ^2.0.0 + color-support: ^1.1.3 + console-control-strings: ^1.1.0 + has-unicode: ^2.0.1 + signal-exit: ^3.0.7 + string-width: ^4.2.3 + strip-ansi: ^6.0.1 + wide-align: ^1.1.5 + checksum: 788b6bfe52f1dd8e263cda800c26ac0ca2ff6de0b6eee2fe0d9e3abf15e149b651bd27bf5226be10e6e3edb5c4e5d5985a5a1a98137e7a892f75eff76467ad2d + languageName: node + linkType: hard + +"gensync@npm:^1.0.0-beta.1, gensync@npm:^1.0.0-beta.2": + version: 1.0.0-beta.2 + resolution: "gensync@npm:1.0.0-beta.2" + checksum: a7437e58c6be12aa6c90f7730eac7fa9833dc78872b4ad2963d2031b00a3367a93f98aec75f9aaac7220848e4026d67a8655e870b24f20a543d103c0d65952ec + languageName: node + linkType: hard + +"get-caller-file@npm:^2.0.5": + version: 2.0.5 + resolution: "get-caller-file@npm:2.0.5" + checksum: b9769a836d2a98c3ee734a88ba712e62703f1df31b94b784762c433c27a386dd6029ff55c2a920c392e33657d80191edbf18c61487e198844844516f843496b9 + languageName: node + linkType: hard + +"get-func-name@npm:^2.0.0": + version: 2.0.0 + resolution: "get-func-name@npm:2.0.0" + checksum: 8d82e69f3e7fab9e27c547945dfe5cc0c57fc0adf08ce135dddb01081d75684a03e7a0487466f478872b341d52ac763ae49e660d01ab83741f74932085f693c3 + languageName: node + linkType: hard + +"get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1": + version: 1.2.1 + resolution: "get-intrinsic@npm:1.2.1" + dependencies: + function-bind: ^1.1.1 + has: ^1.0.3 + has-proto: ^1.0.1 + has-symbols: ^1.0.3 + checksum: 5b61d88552c24b0cf6fa2d1b3bc5459d7306f699de060d76442cce49a4721f52b8c560a33ab392cf5575b7810277d54ded9d4d39a1ea61855619ebc005aa7e5f + languageName: node + linkType: hard + +"get-own-enumerable-property-symbols@npm:^3.0.0": + version: 3.0.2 + resolution: "get-own-enumerable-property-symbols@npm:3.0.2" + checksum: 8f0331f14159f939830884799f937343c8c0a2c330506094bc12cbee3665d88337fe97a4ea35c002cc2bdba0f5d9975ad7ec3abb925015cdf2a93e76d4759ede + languageName: node + linkType: hard + +"get-stdin@npm:^8.0.0": + version: 8.0.0 + resolution: "get-stdin@npm:8.0.0" + checksum: 40128b6cd25781ddbd233344f1a1e4006d4284906191ed0a7d55ec2c1a3e44d650f280b2c9eeab79c03ac3037da80257476c0e4e5af38ddfb902d6ff06282d77 + languageName: node + linkType: hard + +"get-stream@npm:^4.1.0": + version: 4.1.0 + resolution: "get-stream@npm:4.1.0" + dependencies: + pump: ^3.0.0 + checksum: 443e1914170c15bd52ff8ea6eff6dfc6d712b031303e36302d2778e3de2506af9ee964d6124010f7818736dcfde05c04ba7ca6cc26883106e084357a17ae7d73 + languageName: node + linkType: hard + +"get-stream@npm:^5.1.0": + version: 5.2.0 + resolution: "get-stream@npm:5.2.0" + dependencies: + pump: ^3.0.0 + checksum: 8bc1a23174a06b2b4ce600df38d6c98d2ef6d84e020c1ddad632ad75bac4e092eeb40e4c09e0761c35fc2dbc5e7fff5dab5e763a383582c4a167dd69a905bd12 + languageName: node + linkType: hard + +"get-stream@npm:^6.0.0, get-stream@npm:^6.0.1": + version: 6.0.1 + resolution: "get-stream@npm:6.0.1" + checksum: e04ecece32c92eebf5b8c940f51468cd53554dcbb0ea725b2748be583c9523d00128137966afce410b9b051eb2ef16d657cd2b120ca8edafcf5a65e81af63cad + languageName: node + linkType: hard + +"github-slugger@npm:^1.4.0": + version: 1.5.0 + resolution: "github-slugger@npm:1.5.0" + checksum: c70988224578b3bdaa25df65973ffc8c24594a77a28550c3636e495e49d17aef5cdb04c04fa3f1744babef98c61eecc6a43299a13ea7f3cc33d680bf9053ffbe + languageName: node + linkType: hard + +"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": + version: 5.1.2 + resolution: "glob-parent@npm:5.1.2" + dependencies: + is-glob: ^4.0.1 + checksum: f4f2bfe2425296e8a47e36864e4f42be38a996db40420fe434565e4480e3322f18eb37589617a98640c5dc8fdec1a387007ee18dbb1f3f5553409c34d17f425e + languageName: node + linkType: hard + +"glob-parent@npm:^6.0.1, glob-parent@npm:^6.0.2": + version: 6.0.2 + resolution: "glob-parent@npm:6.0.2" + dependencies: + is-glob: ^4.0.3 + checksum: c13ee97978bef4f55106b71e66428eb1512e71a7466ba49025fc2aec59a5bfb0954d5abd58fc5ee6c9b076eef4e1f6d3375c2e964b88466ca390da4419a786a8 + languageName: node + linkType: hard + +"glob-to-regexp@npm:^0.4.1": + version: 0.4.1 + resolution: "glob-to-regexp@npm:0.4.1" + checksum: e795f4e8f06d2a15e86f76e4d92751cf8bbfcf0157cea5c2f0f35678a8195a750b34096b1256e436f0cebc1883b5ff0888c47348443e69546a5a87f9e1eb1167 + languageName: node + linkType: hard + +"glob@npm:7.2.0": + version: 7.2.0 + resolution: "glob@npm:7.2.0" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^3.0.4 + once: ^1.3.0 + path-is-absolute: ^1.0.0 + checksum: 78a8ea942331f08ed2e055cb5b9e40fe6f46f579d7fd3d694f3412fe5db23223d29b7fee1575440202e9a7ff9a72ab106a39fee39934c7bedafe5e5f8ae20134 + languageName: node + linkType: hard + +"glob@npm:^10.2.2": + version: 10.3.5 + resolution: "glob@npm:10.3.5" + dependencies: + foreground-child: ^3.1.0 + jackspeak: ^2.0.3 + minimatch: ^9.0.1 + minipass: ^5.0.0 || ^6.0.2 || ^7.0.0 + path-scurry: ^1.10.1 + bin: + glob: dist/cjs/src/bin.js + checksum: 564f4799cae48c0bcc841c88a20b539b5701c27ed5596f8623f588b3c523262d3fc20eb1ea89cab9c75b0912faf40ca5501fc835f982225d0d0599282b09e97a + languageName: node + linkType: hard + +"glob@npm:^10.3.10": + version: 10.3.10 + resolution: "glob@npm:10.3.10" + dependencies: + foreground-child: ^3.1.0 + jackspeak: ^2.3.5 + minimatch: ^9.0.1 + minipass: ^5.0.0 || ^6.0.2 || ^7.0.0 + path-scurry: ^1.10.1 + bin: + glob: dist/esm/bin.mjs + checksum: 4f2fe2511e157b5a3f525a54092169a5f92405f24d2aed3142f4411df328baca13059f4182f1db1bf933e2c69c0bd89e57ae87edd8950cba8c7ccbe84f721cf3 + languageName: node + linkType: hard + +"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6": + version: 7.2.3 + resolution: "glob@npm:7.2.3" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^3.1.1 + once: ^1.3.0 + path-is-absolute: ^1.0.0 + checksum: 29452e97b38fa704dabb1d1045350fb2467cf0277e155aa9ff7077e90ad81d1ea9d53d3ee63bd37c05b09a065e90f16aec4a65f5b8de401d1dac40bc5605d133 + languageName: node + linkType: hard + +"global-dirs@npm:^3.0.0": + version: 3.0.1 + resolution: "global-dirs@npm:3.0.1" + dependencies: + ini: 2.0.0 + checksum: 70147b80261601fd40ac02a104581432325c1c47329706acd773f3a6ce99bb36d1d996038c85ccacd482ad22258ec233c586b6a91535b1a116b89663d49d6438 + languageName: node + linkType: hard + +"global-modules@npm:^2.0.0": + version: 2.0.0 + resolution: "global-modules@npm:2.0.0" + dependencies: + global-prefix: ^3.0.0 + checksum: d6197f25856c878c2fb5f038899f2dca7cbb2f7b7cf8999660c0104972d5cfa5c68b5a0a77fa8206bb536c3903a4615665acb9709b4d80846e1bb47eaef65430 + languageName: node + linkType: hard + +"global-prefix@npm:^3.0.0": + version: 3.0.0 + resolution: "global-prefix@npm:3.0.0" + dependencies: + ini: ^1.3.5 + kind-of: ^6.0.2 + which: ^1.3.1 + checksum: 8a82fc1d6f22c45484a4e34656cc91bf021a03e03213b0035098d605bfc612d7141f1e14a21097e8a0413b4884afd5b260df0b6a25605ce9d722e11f1df2881d + languageName: node + linkType: hard + +"globals@npm:^11.1.0": + version: 11.12.0 + resolution: "globals@npm:11.12.0" + checksum: 67051a45eca3db904aee189dfc7cd53c20c7d881679c93f6146ddd4c9f4ab2268e68a919df740d39c71f4445d2b38ee360fc234428baea1dbdfe68bbcb46979e + languageName: node + linkType: hard + +"globals@npm:^13.19.0": + version: 13.22.0 + resolution: "globals@npm:13.22.0" + dependencies: + type-fest: ^0.20.2 + checksum: 64af5a09565341432770444085f7aa98b54331c3b69732e0de411003921fa2dd060222ae7b50bec0b98f29c4d00b4f49bf434049ba9f7c36ca4ee1773f60458c + languageName: node + linkType: hard + +"globby@npm:^11.0.1, globby@npm:^11.0.4, globby@npm:^11.1.0": + version: 11.1.0 + resolution: "globby@npm:11.1.0" + dependencies: + array-union: ^2.1.0 + dir-glob: ^3.0.1 + fast-glob: ^3.2.9 + ignore: ^5.2.0 + merge2: ^1.4.1 + slash: ^3.0.0 + checksum: b4be8885e0cfa018fc783792942d53926c35c50b3aefd3fdcfb9d22c627639dc26bd2327a40a0b74b074100ce95bb7187bfeae2f236856aa3de183af7a02aea6 + languageName: node + linkType: hard + +"globby@npm:^13.1.1, globby@npm:^13.1.2, globby@npm:^13.1.4": + version: 13.2.2 + resolution: "globby@npm:13.2.2" + dependencies: + dir-glob: ^3.0.1 + fast-glob: ^3.3.0 + ignore: ^5.2.4 + merge2: ^1.4.1 + slash: ^4.0.0 + checksum: f3d84ced58a901b4fcc29c846983108c426631fe47e94872868b65565495f7bee7b3defd68923bd480582771fd4bbe819217803a164a618ad76f1d22f666f41e + languageName: node + linkType: hard + +"gopd@npm:^1.0.1": + version: 1.0.1 + resolution: "gopd@npm:1.0.1" + dependencies: + get-intrinsic: ^1.1.3 + checksum: a5ccfb8806e0917a94e0b3de2af2ea4979c1da920bc381667c260e00e7cafdbe844e2cb9c5bcfef4e5412e8bf73bab837285bc35c7ba73aaaf0134d4583393a6 + languageName: node + linkType: hard + +"got@npm:^9.6.0": + version: 9.6.0 + resolution: "got@npm:9.6.0" + dependencies: + "@sindresorhus/is": ^0.14.0 + "@szmarczak/http-timer": ^1.1.2 + cacheable-request: ^6.0.0 + decompress-response: ^3.3.0 + duplexer3: ^0.1.4 + get-stream: ^4.1.0 + lowercase-keys: ^1.0.1 + mimic-response: ^1.0.1 + p-cancelable: ^1.0.0 + to-readable-stream: ^1.0.0 + url-parse-lax: ^3.0.0 + checksum: 941807bd9704bacf5eb401f0cc1212ffa1f67c6642f2d028fd75900471c221b1da2b8527f4553d2558f3faeda62ea1cf31665f8b002c6137f5de8732f07370b0 + languageName: node + linkType: hard + +"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: ac85f94da92d8eb6b7f5a8b20ce65e43d66761c55ce85ac96df6865308390da45a8d3f0296dd3a663de65d30ba497bd46c696cc1e248c72b13d6d567138a4fc7 + languageName: node + linkType: hard + +"graphemer@npm:^1.4.0": + version: 1.4.0 + resolution: "graphemer@npm:1.4.0" + checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673 + languageName: node + linkType: hard + +"gray-matter@npm:^4.0.3": + version: 4.0.3 + resolution: "gray-matter@npm:4.0.3" + dependencies: + js-yaml: ^3.13.1 + kind-of: ^6.0.2 + section-matter: ^1.0.0 + strip-bom-string: ^1.0.0 + checksum: 37717bd424344487d655392251ce8d8878a1275ee087003e61208fba3bfd59cbb73a85b2159abf742ae95e23db04964813fdc33ae18b074208428b2528205222 + languageName: node + linkType: hard + +"gzip-size@npm:^6.0.0": + version: 6.0.0 + resolution: "gzip-size@npm:6.0.0" + dependencies: + duplexer: ^0.1.2 + checksum: 2df97f359696ad154fc171dcb55bc883fe6e833bca7a65e457b9358f3cb6312405ed70a8da24a77c1baac0639906cd52358dc0ce2ec1a937eaa631b934c94194 + languageName: node + linkType: hard + +"handle-thing@npm:^2.0.0": + version: 2.0.1 + resolution: "handle-thing@npm:2.0.1" + checksum: 68071f313062315cd9dce55710e9496873945f1dd425107007058fc1629f93002a7649fcc3e464281ce02c7e809a35f5925504ab8105d972cf649f1f47cb7d6c + languageName: node + linkType: hard + +"hardhat@npm:^2.17.4": + version: 2.17.4 + resolution: "hardhat@npm:2.17.4" + dependencies: + "@ethersproject/abi": ^5.1.2 + "@metamask/eth-sig-util": ^4.0.0 + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-blockchain": 7.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-evm": 2.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-statemanager": 2.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + "@nomicfoundation/ethereumjs-vm": 7.0.2 + "@nomicfoundation/solidity-analyzer": ^0.1.0 + "@sentry/node": ^5.18.1 + "@types/bn.js": ^5.1.0 + "@types/lru-cache": ^5.1.0 + adm-zip: ^0.4.16 + aggregate-error: ^3.0.0 + ansi-escapes: ^4.3.0 + chalk: ^2.4.2 + chokidar: ^3.4.0 + ci-info: ^2.0.0 + debug: ^4.1.1 + enquirer: ^2.3.0 + env-paths: ^2.2.0 + ethereum-cryptography: ^1.0.3 + ethereumjs-abi: ^0.6.8 + find-up: ^2.1.0 + fp-ts: 1.19.3 + fs-extra: ^7.0.1 + glob: 7.2.0 + immutable: ^4.0.0-rc.12 + io-ts: 1.10.4 + keccak: ^3.0.2 + lodash: ^4.17.11 + mnemonist: ^0.38.0 + mocha: ^10.0.0 + p-map: ^4.0.0 + raw-body: ^2.4.1 + resolve: 1.17.0 + semver: ^6.3.0 + solc: 0.7.3 + source-map-support: ^0.5.13 + stacktrace-parser: ^0.1.10 + tsort: 0.0.1 + undici: ^5.14.0 + uuid: ^8.3.2 + ws: ^7.4.6 + peerDependencies: + ts-node: "*" + typescript: "*" + peerDependenciesMeta: + ts-node: + optional: true + typescript: + optional: true + bin: + hardhat: internal/cli/bootstrap.js + checksum: da8762f29ac08b6178edaedf1bf4641e8bcf44759c944906af644519fa9d0d3fb6c30e87add3904d8899f9cebfbde47a8422e219ad0bb24226c6636f2d3ef7c2 + languageName: node + linkType: hard + +"has-flag@npm:^3.0.0": + version: 3.0.0 + resolution: "has-flag@npm:3.0.0" + checksum: 4a15638b454bf086c8148979aae044dd6e39d63904cd452d970374fa6a87623423da485dfb814e7be882e05c096a7ccf1ebd48e7e7501d0208d8384ff4dea73b + languageName: node + linkType: hard + +"has-flag@npm:^4.0.0": + version: 4.0.0 + resolution: "has-flag@npm:4.0.0" + checksum: 261a1357037ead75e338156b1f9452c016a37dcd3283a972a30d9e4a87441ba372c8b81f818cd0fbcd9c0354b4ae7e18b9e1afa1971164aef6d18c2b6095a8ad + languageName: node + linkType: hard + +"has-property-descriptors@npm:^1.0.0": + version: 1.0.0 + resolution: "has-property-descriptors@npm:1.0.0" + dependencies: + get-intrinsic: ^1.1.1 + checksum: a6d3f0a266d0294d972e354782e872e2fe1b6495b321e6ef678c9b7a06a40408a6891817350c62e752adced73a94ac903c54734fee05bf65b1905ee1368194bb + languageName: node + linkType: hard + +"has-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "has-proto@npm:1.0.1" + checksum: febc5b5b531de8022806ad7407935e2135f1cc9e64636c3916c6842bd7995994ca3b29871ecd7954bd35f9e2986c17b3b227880484d22259e2f8e6ce63fd383e + languageName: node + linkType: hard + +"has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": + version: 1.0.3 + resolution: "has-symbols@npm:1.0.3" + checksum: a054c40c631c0d5741a8285010a0777ea0c068f99ed43e5d6eb12972da223f8af553a455132fdb0801bdcfa0e0f443c0c03a68d8555aa529b3144b446c3f2410 + languageName: node + linkType: hard + +"has-tostringtag@npm:^1.0.0": + version: 1.0.0 + resolution: "has-tostringtag@npm:1.0.0" + dependencies: + has-symbols: ^1.0.2 + checksum: cc12eb28cb6ae22369ebaad3a8ab0799ed61270991be88f208d508076a1e99abe4198c965935ce85ea90b60c94ddda73693b0920b58e7ead048b4a391b502c1c + languageName: node + linkType: hard + +"has-unicode@npm:^2.0.1": + version: 2.0.1 + resolution: "has-unicode@npm:2.0.1" + checksum: 1eab07a7436512db0be40a710b29b5dc21fa04880b7f63c9980b706683127e3c1b57cb80ea96d47991bdae2dfe479604f6a1ba410106ee1046a41d1bd0814400 + languageName: node + linkType: hard + +"has-yarn@npm:^2.1.0": + version: 2.1.0 + resolution: "has-yarn@npm:2.1.0" + checksum: 5eb1d0bb8518103d7da24532bdbc7124ffc6d367b5d3c10840b508116f2f1bcbcf10fd3ba843ff6e2e991bdf9969fd862d42b2ed58aade88343326c950b7e7f7 + languageName: node + linkType: hard + +"has@npm:^1.0.3": + version: 1.0.3 + resolution: "has@npm:1.0.3" + dependencies: + function-bind: ^1.1.1 + checksum: b9ad53d53be4af90ce5d1c38331e712522417d017d5ef1ebd0507e07c2fbad8686fffb8e12ddecd4c39ca9b9b47431afbb975b8abf7f3c3b82c98e9aad052792 + languageName: node + linkType: hard + +"hash-base@npm:^3.0.0": + version: 3.1.0 + resolution: "hash-base@npm:3.1.0" + dependencies: + inherits: ^2.0.4 + readable-stream: ^3.6.0 + safe-buffer: ^5.2.0 + checksum: 26b7e97ac3de13cb23fc3145e7e3450b0530274a9562144fc2bf5c1e2983afd0e09ed7cc3b20974ba66039fad316db463da80eb452e7373e780cbee9a0d2f2dc + languageName: node + linkType: hard + +"hash.js@npm:1.1.7, hash.js@npm:^1.0.0, hash.js@npm:^1.0.3, hash.js@npm:^1.1.7": + version: 1.1.7 + resolution: "hash.js@npm:1.1.7" + dependencies: + inherits: ^2.0.3 + minimalistic-assert: ^1.0.1 + checksum: e350096e659c62422b85fa508e4b3669017311aa4c49b74f19f8e1bc7f3a54a584fdfd45326d4964d6011f2b2d882e38bea775a96046f2a61b7779a979629d8f + languageName: node + linkType: hard + +"hast-to-hyperscript@npm:^9.0.0": + version: 9.0.1 + resolution: "hast-to-hyperscript@npm:9.0.1" + dependencies: + "@types/unist": ^2.0.3 + comma-separated-tokens: ^1.0.0 + property-information: ^5.3.0 + space-separated-tokens: ^1.0.0 + style-to-object: ^0.3.0 + unist-util-is: ^4.0.0 + web-namespaces: ^1.0.0 + checksum: de570d789853018fff2fd38fc096549b9814e366b298f60c90c159a57018230eefc44d46a246027b0e2426ed9e99f2e270050bc183d5bdfe4c9487c320b392cd + languageName: node + linkType: hard + +"hast-util-from-parse5@npm:^6.0.0": + version: 6.0.1 + resolution: "hast-util-from-parse5@npm:6.0.1" + dependencies: + "@types/parse5": ^5.0.0 + hastscript: ^6.0.0 + property-information: ^5.0.0 + vfile: ^4.0.0 + vfile-location: ^3.2.0 + web-namespaces: ^1.0.0 + checksum: 4daa78201468af7779161e7caa2513c329830778e0528481ab16b3e1bcef4b831f6285b526aacdddbee802f3bd9d64df55f80f010591ea1916da535e3a923b83 + languageName: node + linkType: hard + +"hast-util-is-element@npm:^1.0.0, hast-util-is-element@npm:^1.1.0": + version: 1.1.0 + resolution: "hast-util-is-element@npm:1.1.0" + checksum: 30fad3f65e7ab2f0efd5db9e7344d0820b70971988dfe79f62d8447598b2a1ce8a59cd4bfc05ae0d9a1c451b9b53cbe1023743d7eac764d64720b6b73475f62f + languageName: node + linkType: hard + +"hast-util-parse-selector@npm:^2.0.0": + version: 2.2.5 + resolution: "hast-util-parse-selector@npm:2.2.5" + checksum: 22ee4afbd11754562144cb3c4f3ec52524dafba4d90ee52512902d17cf11066d83b38f7bdf6ca571bbc2541f07ba30db0d234657b6ecb8ca4631587466459605 + languageName: node + linkType: hard + +"hast-util-raw@npm:6.0.1": + version: 6.0.1 + resolution: "hast-util-raw@npm:6.0.1" + dependencies: + "@types/hast": ^2.0.0 + hast-util-from-parse5: ^6.0.0 + hast-util-to-parse5: ^6.0.0 + html-void-elements: ^1.0.0 + parse5: ^6.0.0 + unist-util-position: ^3.0.0 + vfile: ^4.0.0 + web-namespaces: ^1.0.0 + xtend: ^4.0.0 + zwitch: ^1.0.0 + checksum: f6d960644f9fbbe0b92d0227b20a24d659cce021d5f9fd218e077154931b4524ee920217b7fd5a45ec2736ec1dee53de9209fe449f6f89454c01d225ff0e7851 + languageName: node + linkType: hard + +"hast-util-to-parse5@npm:^6.0.0": + version: 6.0.0 + resolution: "hast-util-to-parse5@npm:6.0.0" + dependencies: + hast-to-hyperscript: ^9.0.0 + property-information: ^5.0.0 + web-namespaces: ^1.0.0 + xtend: ^4.0.0 + zwitch: ^1.0.0 + checksum: 91a36244e37df1d63c8b7e865ab0c0a25bb7396155602be005cf71d95c348e709568f80e0f891681a3711d733ad896e70642dc41a05b574eddf2e07d285408a8 + languageName: node + linkType: hard + +"hast-util-to-text@npm:^2.0.0": + version: 2.0.1 + resolution: "hast-util-to-text@npm:2.0.1" + dependencies: + hast-util-is-element: ^1.0.0 + repeat-string: ^1.0.0 + unist-util-find-after: ^3.0.0 + checksum: 4e7960b414b7a6b2f0180e4af416cd8ae3c7ba1531d7eaec7e6dc9509daf88308784bbf5b94885384dccc42abcb74cc6cc26755c76914d646f32aa6bc32ea34b + languageName: node + linkType: hard + +"hastscript@npm:^6.0.0": + version: 6.0.0 + resolution: "hastscript@npm:6.0.0" + dependencies: + "@types/hast": ^2.0.0 + comma-separated-tokens: ^1.0.0 + hast-util-parse-selector: ^2.0.0 + property-information: ^5.0.0 + space-separated-tokens: ^1.0.0 + checksum: 5e50b85af0d2cb7c17979cb1ddca75d6b96b53019dd999b39e7833192c9004201c3cee6445065620ea05d0087d9ae147a4844e582d64868be5bc6b0232dfe52d + languageName: node + linkType: hard + +"he@npm:1.2.0, he@npm:^1.2.0": + version: 1.2.0 + resolution: "he@npm:1.2.0" + bin: + he: bin/he + checksum: 3d4d6babccccd79c5c5a3f929a68af33360d6445587d628087f39a965079d84f18ce9c3d3f917ee1e3978916fc833bb8b29377c3b403f919426f91bc6965e7a7 + languageName: node + linkType: hard + +"history@npm:^4.9.0": + version: 4.10.1 + resolution: "history@npm:4.10.1" + dependencies: + "@babel/runtime": ^7.1.2 + loose-envify: ^1.2.0 + resolve-pathname: ^3.0.0 + tiny-invariant: ^1.0.2 + tiny-warning: ^1.0.0 + value-equal: ^1.0.1 + checksum: addd84bc4683929bae4400419b5af132ff4e4e9b311a0d4e224579ea8e184a6b80d7f72c55927e4fa117f69076a9e47ce082d8d0b422f1a9ddac7991490ca1d0 + languageName: node + linkType: hard + +"hmac-drbg@npm:^1.0.1": + version: 1.0.1 + resolution: "hmac-drbg@npm:1.0.1" + dependencies: + hash.js: ^1.0.3 + minimalistic-assert: ^1.0.0 + minimalistic-crypto-utils: ^1.0.1 + checksum: bd30b6a68d7f22d63f10e1888aee497d7c2c5c0bb469e66bbdac99f143904d1dfe95f8131f95b3e86c86dd239963c9d972fcbe147e7cffa00e55d18585c43fe0 + languageName: node + linkType: hard + +"hoist-non-react-statics@npm:^3.1.0": + version: 3.3.2 + resolution: "hoist-non-react-statics@npm:3.3.2" + dependencies: + react-is: ^16.7.0 + checksum: b1538270429b13901ee586aa44f4cc3ecd8831c061d06cb8322e50ea17b3f5ce4d0e2e66394761e6c8e152cd8c34fb3b4b690116c6ce2bd45b18c746516cb9e8 + languageName: node + linkType: hard + +"hpack.js@npm:^2.1.6": + version: 2.1.6 + resolution: "hpack.js@npm:2.1.6" + dependencies: + inherits: ^2.0.1 + obuf: ^1.0.0 + readable-stream: ^2.0.1 + wbuf: ^1.1.0 + checksum: 2de144115197967ad6eeee33faf41096c6ba87078703c5cb011632dcfbffeb45784569e0cf02c317bd79c48375597c8ec88c30fff5bb0b023e8f654fb6e9c06e + languageName: node + linkType: hard + +"html-entities@npm:^2.3.2": + version: 2.4.0 + resolution: "html-entities@npm:2.4.0" + checksum: 25bea32642ce9ebd0eedc4d24381883ecb0335ccb8ac26379a0958b9b16652fdbaa725d70207ce54a51db24103436a698a8e454397d3ba8ad81460224751f1dc + languageName: node + linkType: hard + +"html-escaper@npm:^2.0.0": + version: 2.0.2 + resolution: "html-escaper@npm:2.0.2" + checksum: d2df2da3ad40ca9ee3a39c5cc6475ef67c8f83c234475f24d8e9ce0dc80a2c82df8e1d6fa78ddd1e9022a586ea1bd247a615e80a5cd9273d90111ddda7d9e974 + languageName: node + linkType: hard + +"html-minifier-terser@npm:^6.0.2, html-minifier-terser@npm:^6.1.0": + version: 6.1.0 + resolution: "html-minifier-terser@npm:6.1.0" + dependencies: + camel-case: ^4.1.2 + clean-css: ^5.2.2 + commander: ^8.3.0 + he: ^1.2.0 + param-case: ^3.0.4 + relateurl: ^0.2.7 + terser: ^5.10.0 + bin: + html-minifier-terser: cli.js + checksum: ac52c14006476f773204c198b64838477859dc2879490040efab8979c0207424da55d59df7348153f412efa45a0840a1ca3c757bf14767d23a15e3e389d37a93 + languageName: node + linkType: hard + +"html-tags@npm:^3.2.0": + version: 3.3.1 + resolution: "html-tags@npm:3.3.1" + checksum: b4ef1d5a76b678e43cce46e3783d563607b1d550cab30b4f511211564574770aa8c658a400b100e588bc60b8234e59b35ff72c7851cc28f3b5403b13a2c6cbce + languageName: node + linkType: hard + +"html-void-elements@npm:^1.0.0": + version: 1.0.5 + resolution: "html-void-elements@npm:1.0.5" + checksum: 1a56f4f6cfbeb994c21701ff72b4b7f556fe784a70e5e554d1566ff775af83b91ea93f10664f039a67802d9f7b40d4a7f1ed20312bab47bd88d89bd792ea84ca + languageName: node + linkType: hard + +"html-webpack-plugin@npm:^5.5.0": + version: 5.5.3 + resolution: "html-webpack-plugin@npm:5.5.3" + dependencies: + "@types/html-minifier-terser": ^6.0.0 + html-minifier-terser: ^6.0.2 + lodash: ^4.17.21 + pretty-error: ^4.0.0 + tapable: ^2.0.0 + peerDependencies: + webpack: ^5.20.0 + checksum: ccf685195739c372ad641bbd0c9100a847904f34eedc7aff3ece7856cd6c78fd3746d2d615af1bb71e5727993fe711b89e9b744f033ed3fde646540bf5d5e954 + languageName: node + linkType: hard + +"htmlparser2@npm:^6.1.0": + version: 6.1.0 + resolution: "htmlparser2@npm:6.1.0" + dependencies: + domelementtype: ^2.0.1 + domhandler: ^4.0.0 + domutils: ^2.5.2 + entities: ^2.0.0 + checksum: 81a7b3d9c3bb9acb568a02fc9b1b81ffbfa55eae7f1c41ae0bf840006d1dbf54cb3aa245b2553e2c94db674840a9f0fdad7027c9a9d01a062065314039058c4e + languageName: node + linkType: hard + +"htmlparser2@npm:^8.0.1": + version: 8.0.2 + resolution: "htmlparser2@npm:8.0.2" + dependencies: + domelementtype: ^2.3.0 + domhandler: ^5.0.3 + domutils: ^3.0.1 + entities: ^4.4.0 + checksum: 29167a0f9282f181da8a6d0311b76820c8a59bc9e3c87009e21968264c2987d2723d6fde5a964d4b7b6cba663fca96ffb373c06d8223a85f52a6089ced942700 + languageName: node + linkType: hard + +"http-assert@npm:^1.3.0": + version: 1.5.0 + resolution: "http-assert@npm:1.5.0" + dependencies: + deep-equal: ~1.0.1 + http-errors: ~1.8.0 + checksum: 69c9b3c14cf8b2822916360a365089ce936c883c49068f91c365eccba5c141a9964d19fdda589150a480013bf503bf37d8936c732e9635819339e730ab0e7527 + languageName: node + linkType: hard + +"http-cache-semantics@npm:^4.0.0, http-cache-semantics@npm:^4.1.1": + version: 4.1.1 + resolution: "http-cache-semantics@npm:4.1.1" + checksum: 83ac0bc60b17a3a36f9953e7be55e5c8f41acc61b22583060e8dedc9dd5e3607c823a88d0926f9150e571f90946835c7fe150732801010845c72cd8bbff1a236 + languageName: node + linkType: hard + +"http-deceiver@npm:^1.2.7": + version: 1.2.7 + resolution: "http-deceiver@npm:1.2.7" + checksum: 64d7d1ae3a6933eb0e9a94e6f27be4af45a53a96c3c34e84ff57113787105a89fff9d1c3df263ef63add823df019b0e8f52f7121e32393bb5ce9a713bf100b41 + languageName: node + linkType: hard + +"http-errors@npm:2.0.0": + version: 2.0.0 + resolution: "http-errors@npm:2.0.0" + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.1 + toidentifier: 1.0.1 + checksum: 9b0a3782665c52ce9dc658a0d1560bcb0214ba5699e4ea15aefb2a496e2ca83db03ebc42e1cce4ac1f413e4e0d2d736a3fd755772c556a9a06853ba2a0b7d920 + languageName: node + linkType: hard + +"http-errors@npm:^1.6.3, http-errors@npm:^1.7.3, http-errors@npm:~1.8.0": + version: 1.8.1 + resolution: "http-errors@npm:1.8.1" + dependencies: + depd: ~1.1.2 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: ">= 1.5.0 < 2" + toidentifier: 1.0.1 + checksum: d3c7e7e776fd51c0a812baff570bdf06fe49a5dc448b700ab6171b1250e4cf7db8b8f4c0b133e4bfe2451022a5790c1ca6c2cae4094dedd6ac8304a1267f91d2 + languageName: node + linkType: hard + +"http-errors@npm:~1.6.2": + version: 1.6.3 + resolution: "http-errors@npm:1.6.3" + dependencies: + depd: ~1.1.2 + inherits: 2.0.3 + setprototypeof: 1.1.0 + statuses: ">= 1.4.0 < 2" + checksum: a9654ee027e3d5de305a56db1d1461f25709ac23267c6dc28cdab8323e3f96caa58a9a6a5e93ac15d7285cee0c2f019378c3ada9026e7fe19c872d695f27de7c + languageName: node + linkType: hard + +"http-parser-js@npm:>=0.5.1": + version: 0.5.8 + resolution: "http-parser-js@npm:0.5.8" + checksum: 6bbdf2429858e8cf13c62375b0bfb6dc3955ca0f32e58237488bc86cd2378f31d31785fd3ac4ce93f1c74e0189cf8823c91f5cb061696214fd368d2452dc871d + languageName: node + linkType: hard + +"http-proxy-agent@npm:^5.0.0": + version: 5.0.0 + resolution: "http-proxy-agent@npm:5.0.0" + dependencies: + "@tootallnate/once": 2 + agent-base: 6 + debug: 4 + checksum: e2ee1ff1656a131953839b2a19cd1f3a52d97c25ba87bd2559af6ae87114abf60971e498021f9b73f9fd78aea8876d1fb0d4656aac8a03c6caa9fc175f22b786 + languageName: node + linkType: hard + +"http-proxy-middleware@npm:^2.0.3": + version: 2.0.6 + resolution: "http-proxy-middleware@npm:2.0.6" + dependencies: + "@types/http-proxy": ^1.17.8 + http-proxy: ^1.18.1 + is-glob: ^4.0.1 + is-plain-obj: ^3.0.0 + micromatch: ^4.0.2 + peerDependencies: + "@types/express": ^4.17.13 + peerDependenciesMeta: + "@types/express": + optional: true + checksum: 2ee85bc878afa6cbf34491e972ece0f5be0a3e5c98a60850cf40d2a9a5356e1fc57aab6cff33c1fc37691b0121c3a42602d2b1956c52577e87a5b77b62ae1c3a + languageName: node + linkType: hard + +"http-proxy@npm:^1.18.1": + version: 1.18.1 + resolution: "http-proxy@npm:1.18.1" + dependencies: + eventemitter3: ^4.0.0 + follow-redirects: ^1.0.0 + requires-port: ^1.0.0 + checksum: f5bd96bf83e0b1e4226633dbb51f8b056c3e6321917df402deacec31dd7fe433914fc7a2c1831cf7ae21e69c90b3a669b8f434723e9e8b71fd68afe30737b6a5 + languageName: node + linkType: hard + +"https-proxy-agent@npm:5.0.1, https-proxy-agent@npm:^5.0.0": + version: 5.0.1 + resolution: "https-proxy-agent@npm:5.0.1" + dependencies: + agent-base: 6 + debug: 4 + checksum: 571fccdf38184f05943e12d37d6ce38197becdd69e58d03f43637f7fa1269cf303a7d228aa27e5b27bbd3af8f09fd938e1c91dcfefff2df7ba77c20ed8dfc765 + languageName: node + linkType: hard + +"human-signals@npm:^2.1.0": + version: 2.1.0 + resolution: "human-signals@npm:2.1.0" + checksum: b87fd89fce72391625271454e70f67fe405277415b48bcc0117ca73d31fa23a4241787afdc8d67f5a116cf37258c052f59ea82daffa72364d61351423848e3b8 + languageName: node + linkType: hard + +"human-signals@npm:^4.3.0": + version: 4.3.1 + resolution: "human-signals@npm:4.3.1" + checksum: 6f12958df3f21b6fdaf02d90896c271df00636a31e2bbea05bddf817a35c66b38a6fdac5863e2df85bd52f34958997f1f50350ff97249e1dff8452865d5235d1 + languageName: node + linkType: hard + +"humanize-ms@npm:^1.2.1": + version: 1.2.1 + resolution: "humanize-ms@npm:1.2.1" + dependencies: + ms: ^2.0.0 + checksum: 9c7a74a2827f9294c009266c82031030eae811ca87b0da3dceb8d6071b9bde22c9f3daef0469c3c533cc67a97d8a167cd9fc0389350e5f415f61a79b171ded16 + languageName: node + linkType: hard + +"iconv-lite@npm:0.4.24": + version: 0.4.24 + resolution: "iconv-lite@npm:0.4.24" + dependencies: + safer-buffer: ">= 2.1.2 < 3" + checksum: bd9f120f5a5b306f0bc0b9ae1edeb1577161503f5f8252a20f1a9e56ef8775c9959fd01c55f2d3a39d9a8abaf3e30c1abeb1895f367dcbbe0a8fd1c9ca01c4f6 + languageName: node + linkType: hard + +"iconv-lite@npm:^0.6.2": + version: 0.6.3 + resolution: "iconv-lite@npm:0.6.3" + dependencies: + safer-buffer: ">= 2.1.2 < 3.0.0" + checksum: 3f60d47a5c8fc3313317edfd29a00a692cc87a19cac0159e2ce711d0ebc9019064108323b5e493625e25594f11c6236647d8e256fbe7a58f4a3b33b89e6d30bf + languageName: node + linkType: hard + +"icss-utils@npm:^5.0.0, icss-utils@npm:^5.1.0": + version: 5.1.0 + resolution: "icss-utils@npm:5.1.0" + peerDependencies: + postcss: ^8.1.0 + checksum: 5c324d283552b1269cfc13a503aaaa172a280f914e5b81544f3803bc6f06a3b585fb79f66f7c771a2c052db7982c18bf92d001e3b47282e3abbbb4c4cc488d68 + languageName: node + linkType: hard + +"ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": + version: 1.2.1 + resolution: "ieee754@npm:1.2.1" + checksum: 5144c0c9815e54ada181d80a0b810221a253562422e7c6c3a60b1901154184f49326ec239d618c416c1c5945a2e197107aee8d986a3dd836b53dffefd99b5e7e + languageName: node + linkType: hard + +"ignore-by-default@npm:^2.1.0": + version: 2.1.0 + resolution: "ignore-by-default@npm:2.1.0" + checksum: 2b2df4622b6a07a3e91893987be8f060dc553f7736b67e72aa2312041c450a6fa8371733d03c42f45a02e47ec824e961c2fba63a3d94fc59cbd669220a5b0d7a + languageName: node + linkType: hard + +"ignore@npm:^5.2.0, ignore@npm:^5.2.4": + version: 5.2.4 + resolution: "ignore@npm:5.2.4" + checksum: 3d4c309c6006e2621659311783eaea7ebcd41fe4ca1d78c91c473157ad6666a57a2df790fe0d07a12300d9aac2888204d7be8d59f9aaf665b1c7fcdb432517ef + languageName: node + linkType: hard + +"image-size@npm:^1.0.1": + version: 1.0.2 + resolution: "image-size@npm:1.0.2" + dependencies: + queue: 6.0.2 + bin: + image-size: bin/image-size.js + checksum: 01745fdb47f87cecf538e69c63f9adc5bfab30a345345c2de91105f3afbd1bfcfba1256af02bf3323077b33b0004469a837e077bf0cbb9c907e9c1e9e7547585 + languageName: node + linkType: hard + +"immediate@npm:^3.2.3": + version: 3.3.0 + resolution: "immediate@npm:3.3.0" + checksum: 634b4305101e2452eba6c07d485bf3e415995e533c94b9c3ffbc37026fa1be34def6e4f2276b0dc2162a3f91628564a4bfb26280278b89d3ee54624e854d2f5f + languageName: node + linkType: hard + +"immer@npm:^9.0.7": + version: 9.0.21 + resolution: "immer@npm:9.0.21" + checksum: 70e3c274165995352f6936695f0ef4723c52c92c92dd0e9afdfe008175af39fa28e76aafb3a2ca9d57d1fb8f796efc4dd1e1cc36f18d33fa5b74f3dfb0375432 + languageName: node + linkType: hard + +"immutable@npm:^4.0.0-rc.12": + version: 4.3.4 + resolution: "immutable@npm:4.3.4" + checksum: de3edd964c394bab83432429d3fb0b4816b42f56050f2ca913ba520bd3068ec3e504230d0800332d3abc478616e8f55d3787424a90d0952e6aba864524f1afc3 + languageName: node + linkType: hard + +"import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": + version: 3.3.0 + resolution: "import-fresh@npm:3.3.0" + dependencies: + parent-module: ^1.0.0 + resolve-from: ^4.0.0 + checksum: 2cacfad06e652b1edc50be650f7ec3be08c5e5a6f6d12d035c440a42a8cc028e60a5b99ca08a77ab4d6b1346da7d971915828f33cdab730d3d42f08242d09baa + languageName: node + linkType: hard + +"import-lazy@npm:^2.1.0": + version: 2.1.0 + resolution: "import-lazy@npm:2.1.0" + checksum: 05294f3b9dd4971d3a996f0d2f176410fb6745d491d6e73376429189f5c1c3d290548116b2960a7cf3e89c20cdf11431739d1d2d8c54b84061980795010e803a + languageName: node + linkType: hard + +"imurmurhash@npm:^0.1.4": + version: 0.1.4 + resolution: "imurmurhash@npm:0.1.4" + checksum: 7cae75c8cd9a50f57dadd77482359f659eaebac0319dd9368bcd1714f55e65badd6929ca58569da2b6494ef13fdd5598cd700b1eba23f8b79c5f19d195a3ecf7 + languageName: node + linkType: hard + +"indent-string@npm:^4.0.0": + version: 4.0.0 + resolution: "indent-string@npm:4.0.0" + checksum: 824cfb9929d031dabf059bebfe08cf3137365e112019086ed3dcff6a0a7b698cb80cf67ccccde0e25b9e2d7527aa6cc1fed1ac490c752162496caba3e6699612 + languageName: node + linkType: hard + +"indent-string@npm:^5.0.0": + version: 5.0.0 + resolution: "indent-string@npm:5.0.0" + checksum: e466c27b6373440e6d84fbc19e750219ce25865cb82d578e41a6053d727e5520dc5725217d6eb1cc76005a1bb1696a0f106d84ce7ebda3033b963a38583fb3b3 + languageName: node + linkType: hard + +"infima@npm:0.2.0-alpha.43": + version: 0.2.0-alpha.43 + resolution: "infima@npm:0.2.0-alpha.43" + checksum: fc5f79240e940eddd750439511767092ccb4051e5e91d253ec7630a9e7ce691812da3aa0f05e46b4c0a95dbfadeae5714fd0073f8d2df12e5aaff0697a1d6aa2 + languageName: node + linkType: hard + +"inflation@npm:^2.0.0": + version: 2.0.0 + resolution: "inflation@npm:2.0.0" + checksum: a0494871b12275afdef9e2710ee1af1e0fc642b04613a9be69c05ef8b5e9627f3bd7d358a937fa47aa20235ee7313a4f30255048533add0ad4918beb918a586e + languageName: node + linkType: hard + +"inflight@npm:^1.0.4": + version: 1.0.6 + resolution: "inflight@npm:1.0.6" + dependencies: + once: ^1.3.0 + wrappy: 1 + checksum: f4f76aa072ce19fae87ce1ef7d221e709afb59d445e05d47fba710e85470923a75de35bfae47da6de1b18afc3ce83d70facf44cfb0aff89f0a3f45c0a0244dfd + languageName: node + linkType: hard + +"inherits@npm:2, inherits@npm:2.0.4, inherits@npm:^2.0.0, inherits@npm:^2.0.1, inherits@npm:^2.0.3, inherits@npm:^2.0.4, inherits@npm:~2.0.3": + version: 2.0.4 + resolution: "inherits@npm:2.0.4" + checksum: 4a48a733847879d6cf6691860a6b1e3f0f4754176e4d71494c41f3475553768b10f84b5ce1d40fbd0e34e6bfbb864ee35858ad4dd2cf31e02fc4a154b724d7f1 + languageName: node + linkType: hard + +"inherits@npm:2.0.3": + version: 2.0.3 + resolution: "inherits@npm:2.0.3" + checksum: 78cb8d7d850d20a5e9a7f3620db31483aa00ad5f722ce03a55b110e5a723539b3716a3b463e2b96ce3fe286f33afc7c131fa2f91407528ba80cea98a7545d4c0 + languageName: node + linkType: hard + +"ini@npm:2.0.0": + version: 2.0.0 + resolution: "ini@npm:2.0.0" + checksum: e7aadc5fb2e4aefc666d74ee2160c073995a4061556b1b5b4241ecb19ad609243b9cceafe91bae49c219519394bbd31512516cb22a3b1ca6e66d869e0447e84e + languageName: node + linkType: hard + +"ini@npm:^1.3.5, ini@npm:~1.3.0": + version: 1.3.8 + resolution: "ini@npm:1.3.8" + checksum: dfd98b0ca3a4fc1e323e38a6c8eb8936e31a97a918d3b377649ea15bdb15d481207a0dda1021efbd86b464cae29a0d33c1d7dcaf6c5672bee17fa849bc50a1b3 + languageName: node + linkType: hard + +"inline-style-parser@npm:0.1.1": + version: 0.1.1 + resolution: "inline-style-parser@npm:0.1.1" + checksum: 5d545056a3e1f2bf864c928a886a0e1656a3517127d36917b973de581bd54adc91b4bf1febcb0da054f204b4934763f1a4e09308b4d55002327cf1d48ac5d966 + languageName: node + linkType: hard + +"integration-tests@workspace:compiler/integration-tests": + version: 0.0.0-use.local + resolution: "integration-tests@workspace:compiler/integration-tests" + dependencies: + "@noir-lang/backend_barretenberg": "workspace:*" + "@noir-lang/noir_js": "workspace:*" + "@noir-lang/noir_wasm": "workspace:*" + "@noir-lang/source-resolver": "workspace:*" + "@nomicfoundation/hardhat-chai-matchers": ^2.0.0 + "@nomicfoundation/hardhat-ethers": ^3.0.0 + "@web/dev-server-esbuild": ^0.3.6 + "@web/test-runner": ^0.15.3 + "@web/test-runner-playwright": ^0.10.0 + eslint: ^8.50.0 + eslint-plugin-prettier: ^5.0.0 + ethers: ^6.7.1 + hardhat: ^2.17.4 + prettier: 3.0.3 + smol-toml: ^1.1.2 + toml: ^3.0.0 + tslog: ^4.9.2 + languageName: unknown + linkType: soft + +"interpret@npm:^1.0.0": + version: 1.4.0 + resolution: "interpret@npm:1.4.0" + checksum: 2e5f51268b5941e4a17e4ef0575bc91ed0ab5f8515e3cf77486f7c14d13f3010df9c0959f37063dcc96e78d12dc6b0bb1b9e111cdfe69771f4656d2993d36155 + languageName: node + linkType: hard + +"invariant@npm:^2.2.4": + version: 2.2.4 + resolution: "invariant@npm:2.2.4" + dependencies: + loose-envify: ^1.0.0 + checksum: cc3182d793aad82a8d1f0af697b462939cb46066ec48bbf1707c150ad5fad6406137e91a262022c269702e01621f35ef60269f6c0d7fd178487959809acdfb14 + languageName: node + linkType: hard + +"io-ts@npm:1.10.4": + version: 1.10.4 + resolution: "io-ts@npm:1.10.4" + dependencies: + fp-ts: ^1.0.0 + checksum: 619134006778f7ca42693716ade7fc1a383079e7848bbeabc67a0e4ac9139cda6b2a88a052d539ab7d554033ee2ffe4dab5cb96b958c83fee2dff73d23f03e88 + languageName: node + linkType: hard + +"ip@npm:^1.1.5": + version: 1.1.8 + resolution: "ip@npm:1.1.8" + checksum: a2ade53eb339fb0cbe9e69a44caab10d6e3784662285eb5d2677117ee4facc33a64679051c35e0dfdb1a3983a51ce2f5d2cb36446d52e10d01881789b76e28fb + languageName: node + linkType: hard + +"ip@npm:^2.0.0": + version: 2.0.0 + resolution: "ip@npm:2.0.0" + checksum: cfcfac6b873b701996d71ec82a7dd27ba92450afdb421e356f44044ed688df04567344c36cbacea7d01b1c39a4c732dc012570ebe9bebfb06f27314bca625349 + languageName: node + linkType: hard + +"ipaddr.js@npm:1.9.1": + version: 1.9.1 + resolution: "ipaddr.js@npm:1.9.1" + checksum: f88d3825981486f5a1942414c8d77dd6674dd71c065adcfa46f578d677edcb99fda25af42675cb59db492fdf427b34a5abfcde3982da11a8fd83a500b41cfe77 + languageName: node + linkType: hard + +"ipaddr.js@npm:^2.0.1": + version: 2.1.0 + resolution: "ipaddr.js@npm:2.1.0" + checksum: 807a054f2bd720c4d97ee479d6c9e865c233bea21f139fb8dabd5a35c4226d2621c42e07b4ad94ff3f82add926a607d8d9d37c625ad0319f0e08f9f2bd1968e2 + languageName: node + linkType: hard + +"irregular-plurals@npm:^3.3.0": + version: 3.5.0 + resolution: "irregular-plurals@npm:3.5.0" + checksum: 5b663091dc89155df7b2e9d053e8fb11941a0c4be95c4b6549ed3ea020489fdf4f75ea586c915b5b543704252679a5a6e8c6c3587da5ac3fc57b12da90a9aee7 + languageName: node + linkType: hard + +"is-alphabetical@npm:1.0.4, is-alphabetical@npm:^1.0.0": + version: 1.0.4 + resolution: "is-alphabetical@npm:1.0.4" + checksum: 6508cce44fd348f06705d377b260974f4ce68c74000e7da4045f0d919e568226dc3ce9685c5a2af272195384df6930f748ce9213fc9f399b5d31b362c66312cb + languageName: node + linkType: hard + +"is-alphanumerical@npm:^1.0.0": + version: 1.0.4 + resolution: "is-alphanumerical@npm:1.0.4" + dependencies: + is-alphabetical: ^1.0.0 + is-decimal: ^1.0.0 + checksum: e2e491acc16fcf5b363f7c726f666a9538dba0a043665740feb45bba1652457a73441e7c5179c6768a638ed396db3437e9905f403644ec7c468fb41f4813d03f + languageName: node + linkType: hard + +"is-arrayish@npm:^0.2.1": + version: 0.2.1 + resolution: "is-arrayish@npm:0.2.1" + checksum: eef4417e3c10e60e2c810b6084942b3ead455af16c4509959a27e490e7aee87cfb3f38e01bbde92220b528a0ee1a18d52b787e1458ee86174d8c7f0e58cd488f + languageName: node + linkType: hard + +"is-binary-path@npm:~2.1.0": + version: 2.1.0 + resolution: "is-binary-path@npm:2.1.0" + dependencies: + binary-extensions: ^2.0.0 + checksum: 84192eb88cff70d320426f35ecd63c3d6d495da9d805b19bc65b518984b7c0760280e57dbf119b7e9be6b161784a5a673ab2c6abe83abb5198a432232ad5b35c + languageName: node + linkType: hard + +"is-buffer@npm:^2.0.0, is-buffer@npm:^2.0.5": + version: 2.0.5 + resolution: "is-buffer@npm:2.0.5" + checksum: 764c9ad8b523a9f5a32af29bdf772b08eb48c04d2ad0a7240916ac2688c983bf5f8504bf25b35e66240edeb9d9085461f9b5dae1f3d2861c6b06a65fe983de42 + languageName: node + linkType: hard + +"is-builtin-module@npm:^3.1.0": + version: 3.2.1 + resolution: "is-builtin-module@npm:3.2.1" + dependencies: + builtin-modules: ^3.3.0 + checksum: e8f0ffc19a98240bda9c7ada84d846486365af88d14616e737d280d378695c8c448a621dcafc8332dbf0fcd0a17b0763b845400709963fa9151ddffece90ae88 + languageName: node + linkType: hard + +"is-ci@npm:^2.0.0": + version: 2.0.0 + resolution: "is-ci@npm:2.0.0" + dependencies: + ci-info: ^2.0.0 + bin: + is-ci: bin.js + checksum: 77b869057510f3efa439bbb36e9be429d53b3f51abd4776eeea79ab3b221337fe1753d1e50058a9e2c650d38246108beffb15ccfd443929d77748d8c0cc90144 + languageName: node + linkType: hard + +"is-core-module@npm:^2.13.0": + version: 2.13.0 + resolution: "is-core-module@npm:2.13.0" + dependencies: + has: ^1.0.3 + checksum: 053ab101fb390bfeb2333360fd131387bed54e476b26860dc7f5a700bbf34a0ec4454f7c8c4d43e8a0030957e4b3db6e16d35e1890ea6fb654c833095e040355 + languageName: node + linkType: hard + +"is-decimal@npm:^1.0.0": + version: 1.0.4 + resolution: "is-decimal@npm:1.0.4" + checksum: ed483a387517856dc395c68403a10201fddcc1b63dc56513fbe2fe86ab38766120090ecdbfed89223d84ca8b1cd28b0641b93cb6597b6e8f4c097a7c24e3fb96 + languageName: node + linkType: hard + +"is-docker@npm:^2.0.0, is-docker@npm:^2.1.1": + version: 2.2.1 + resolution: "is-docker@npm:2.2.1" + bin: + is-docker: cli.js + checksum: 3fef7ddbf0be25958e8991ad941901bf5922ab2753c46980b60b05c1bf9c9c2402d35e6dc32e4380b980ef5e1970a5d9d5e5aa2e02d77727c3b6b5e918474c56 + languageName: node + linkType: hard + +"is-docker@npm:^3.0.0": + version: 3.0.0 + resolution: "is-docker@npm:3.0.0" + bin: + is-docker: cli.js + checksum: b698118f04feb7eaf3338922bd79cba064ea54a1c3db6ec8c0c8d8ee7613e7e5854d802d3ef646812a8a3ace81182a085dfa0a71cc68b06f3fa794b9783b3c90 + languageName: node + linkType: hard + +"is-error@npm:^2.2.2": + version: 2.2.2 + resolution: "is-error@npm:2.2.2" + checksum: a97b39587150f0d38f9f93f64699807fe3020fe5edbd63548f234dc2ba96fd7c776d66c062bf031dfeb93c7f48db563ff6bde588418ca041da37c659a416f055 + languageName: node + linkType: hard + +"is-extendable@npm:^0.1.0": + version: 0.1.1 + resolution: "is-extendable@npm:0.1.1" + checksum: 3875571d20a7563772ecc7a5f36cb03167e9be31ad259041b4a8f73f33f885441f778cee1f1fe0085eb4bc71679b9d8c923690003a36a6a5fdf8023e6e3f0672 + languageName: node + linkType: hard + +"is-extglob@npm:^2.1.1": + version: 2.1.1 + resolution: "is-extglob@npm:2.1.1" + checksum: df033653d06d0eb567461e58a7a8c9f940bd8c22274b94bf7671ab36df5719791aae15eef6d83bbb5e23283967f2f984b8914559d4449efda578c775c4be6f85 + languageName: node + linkType: hard + +"is-fullwidth-code-point@npm:^3.0.0": + version: 3.0.0 + resolution: "is-fullwidth-code-point@npm:3.0.0" + checksum: 44a30c29457c7fb8f00297bce733f0a64cd22eca270f83e58c105e0d015e45c019491a4ab2faef91ab51d4738c670daff901c799f6a700e27f7314029e99e348 + languageName: node + linkType: hard + +"is-fullwidth-code-point@npm:^4.0.0": + version: 4.0.0 + resolution: "is-fullwidth-code-point@npm:4.0.0" + checksum: 8ae89bf5057bdf4f57b346fb6c55e9c3dd2549983d54191d722d5c739397a903012cc41a04ee3403fd872e811243ef91a7c5196da7b5841dc6b6aae31a264a8d + languageName: node + linkType: hard + +"is-generator-function@npm:^1.0.7": + version: 1.0.10 + resolution: "is-generator-function@npm:1.0.10" + dependencies: + has-tostringtag: ^1.0.0 + checksum: d54644e7dbaccef15ceb1e5d91d680eb5068c9ee9f9eb0a9e04173eb5542c9b51b5ab52c5537f5703e48d5fddfd376817c1ca07a84a407b7115b769d4bdde72b + languageName: node + linkType: hard + +"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": + version: 4.0.3 + resolution: "is-glob@npm:4.0.3" + dependencies: + is-extglob: ^2.1.1 + checksum: d381c1319fcb69d341cc6e6c7cd588e17cd94722d9a32dbd60660b993c4fb7d0f19438674e68dfec686d09b7c73139c9166b47597f846af387450224a8101ab4 + languageName: node + linkType: hard + +"is-hex-prefixed@npm:1.0.0": + version: 1.0.0 + resolution: "is-hex-prefixed@npm:1.0.0" + checksum: 5ac58e6e528fb029cc43140f6eeb380fad23d0041cc23154b87f7c9a1b728bcf05909974e47248fd0b7fcc11ba33cf7e58d64804883056fabd23e2b898be41de + languageName: node + linkType: hard + +"is-hexadecimal@npm:^1.0.0": + version: 1.0.4 + resolution: "is-hexadecimal@npm:1.0.4" + checksum: a452e047587b6069332d83130f54d30da4faf2f2ebaa2ce6d073c27b5703d030d58ed9e0b729c8e4e5b52c6f1dab26781bb77b7bc6c7805f14f320e328ff8cd5 + languageName: node + linkType: hard + +"is-inside-container@npm:^1.0.0": + version: 1.0.0 + resolution: "is-inside-container@npm:1.0.0" + dependencies: + is-docker: ^3.0.0 + bin: + is-inside-container: cli.js + checksum: c50b75a2ab66ab3e8b92b3bc534e1ea72ca25766832c0623ac22d134116a98bcf012197d1caabe1d1c4bd5f84363d4aa5c36bb4b585fbcaf57be172cd10a1a03 + languageName: node + linkType: hard + +"is-installed-globally@npm:^0.4.0": + version: 0.4.0 + resolution: "is-installed-globally@npm:0.4.0" + dependencies: + global-dirs: ^3.0.0 + is-path-inside: ^3.0.2 + checksum: 3359840d5982d22e9b350034237b2cda2a12bac1b48a721912e1ab8e0631dd07d45a2797a120b7b87552759a65ba03e819f1bd63f2d7ab8657ec0b44ee0bf399 + languageName: node + linkType: hard + +"is-lambda@npm:^1.0.1": + version: 1.0.1 + resolution: "is-lambda@npm:1.0.1" + checksum: 93a32f01940220532e5948538699ad610d5924ac86093fcee83022252b363eb0cc99ba53ab084a04e4fb62bf7b5731f55496257a4c38adf87af9c4d352c71c35 + languageName: node + linkType: hard + +"is-module@npm:^1.0.0": + version: 1.0.0 + resolution: "is-module@npm:1.0.0" + checksum: 8cd5390730c7976fb4e8546dd0b38865ee6f7bacfa08dfbb2cc07219606755f0b01709d9361e01f13009bbbd8099fa2927a8ed665118a6105d66e40f1b838c3f + languageName: node + linkType: hard + +"is-npm@npm:^5.0.0": + version: 5.0.0 + resolution: "is-npm@npm:5.0.0" + checksum: 9baff02b0c69a3d3c79b162cb2f9e67fb40ef6d172c16601b2e2471c21e9a4fa1fc9885a308d7bc6f3a3cd2a324c27fa0bf284c133c3349bb22571ab70d041cc + languageName: node + linkType: hard + +"is-number@npm:^7.0.0": + version: 7.0.0 + resolution: "is-number@npm:7.0.0" + checksum: 456ac6f8e0f3111ed34668a624e45315201dff921e5ac181f8ec24923b99e9f32ca1a194912dc79d539c97d33dba17dc635202ff0b2cf98326f608323276d27a + languageName: node + linkType: hard + +"is-obj@npm:^1.0.1": + version: 1.0.1 + resolution: "is-obj@npm:1.0.1" + checksum: 3ccf0efdea12951e0b9c784e2b00e77e87b2f8bd30b42a498548a8afcc11b3287342a2030c308e473e93a7a19c9ea7854c99a8832a476591c727df2a9c79796c + languageName: node + linkType: hard + +"is-obj@npm:^2.0.0": + version: 2.0.0 + resolution: "is-obj@npm:2.0.0" + checksum: c9916ac8f4621962a42f5e80e7ffdb1d79a3fab7456ceaeea394cd9e0858d04f985a9ace45be44433bf605673c8be8810540fe4cc7f4266fc7526ced95af5a08 + languageName: node + linkType: hard + +"is-path-cwd@npm:^2.2.0": + version: 2.2.0 + resolution: "is-path-cwd@npm:2.2.0" + checksum: 46a840921bb8cc0dc7b5b423a14220e7db338072a4495743a8230533ce78812dc152548c86f4b828411fe98c5451959f07cf841c6a19f611e46600bd699e8048 + languageName: node + linkType: hard + +"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3": + version: 3.0.3 + resolution: "is-path-inside@npm:3.0.3" + checksum: abd50f06186a052b349c15e55b182326f1936c89a78bf6c8f2b707412517c097ce04bc49a0ca221787bc44e1049f51f09a2ffb63d22899051988d3a618ba13e9 + languageName: node + linkType: hard + +"is-plain-obj@npm:^2.0.0, is-plain-obj@npm:^2.1.0": + version: 2.1.0 + resolution: "is-plain-obj@npm:2.1.0" + checksum: cec9100678b0a9fe0248a81743041ed990c2d4c99f893d935545cfbc42876cbe86d207f3b895700c690ad2fa520e568c44afc1605044b535a7820c1d40e38daa + languageName: node + linkType: hard + +"is-plain-obj@npm:^3.0.0": + version: 3.0.0 + resolution: "is-plain-obj@npm:3.0.0" + checksum: a6ebdf8e12ab73f33530641972a72a4b8aed6df04f762070d823808303e4f76d87d5ea5bd76f96a7bbe83d93f04ac7764429c29413bd9049853a69cb630fb21c + languageName: node + linkType: hard + +"is-plain-object@npm:^2.0.4": + version: 2.0.4 + resolution: "is-plain-object@npm:2.0.4" + dependencies: + isobject: ^3.0.1 + checksum: 2a401140cfd86cabe25214956ae2cfee6fbd8186809555cd0e84574f88de7b17abacb2e477a6a658fa54c6083ecbda1e6ae404c7720244cd198903848fca70ca + languageName: node + linkType: hard + +"is-plain-object@npm:^5.0.0": + version: 5.0.0 + resolution: "is-plain-object@npm:5.0.0" + checksum: e32d27061eef62c0847d303125440a38660517e586f2f3db7c9d179ae5b6674ab0f469d519b2e25c147a1a3bc87156d0d5f4d8821e0ce4a9ee7fe1fcf11ce45c + languageName: node + linkType: hard + +"is-promise@npm:^4.0.0": + version: 4.0.0 + resolution: "is-promise@npm:4.0.0" + checksum: 0b46517ad47b00b6358fd6553c83ec1f6ba9acd7ffb3d30a0bf519c5c69e7147c132430452351b8a9fc198f8dd6c4f76f8e6f5a7f100f8c77d57d9e0f4261a8a + languageName: node + linkType: hard + +"is-regexp@npm:^1.0.0": + version: 1.0.0 + resolution: "is-regexp@npm:1.0.0" + checksum: be692828e24cba479ec33644326fa98959ec68ba77965e0291088c1a741feaea4919d79f8031708f85fd25e39de002b4520622b55460660b9c369e6f7187faef + languageName: node + linkType: hard + +"is-root@npm:^2.1.0": + version: 2.1.0 + resolution: "is-root@npm:2.1.0" + checksum: 37eea0822a2a9123feb58a9d101558ba276771a6d830f87005683349a9acff15958a9ca590a44e778c6b335660b83e85c744789080d734f6081a935a4880aee2 + languageName: node + linkType: hard + +"is-stream@npm:^2.0.0": + version: 2.0.1 + resolution: "is-stream@npm:2.0.1" + checksum: b8e05ccdf96ac330ea83c12450304d4a591f9958c11fd17bed240af8d5ffe08aedafa4c0f4cfccd4d28dc9d4d129daca1023633d5c11601a6cbc77521f6fae66 + languageName: node + linkType: hard + +"is-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "is-stream@npm:3.0.0" + checksum: 172093fe99119ffd07611ab6d1bcccfe8bc4aa80d864b15f43e63e54b7abc71e779acd69afdb854c4e2a67fdc16ae710e370eda40088d1cfc956a50ed82d8f16 + languageName: node + linkType: hard + +"is-typedarray@npm:^1.0.0": + version: 1.0.0 + resolution: "is-typedarray@npm:1.0.0" + checksum: 3508c6cd0a9ee2e0df2fa2e9baabcdc89e911c7bd5cf64604586697212feec525aa21050e48affb5ffc3df20f0f5d2e2cf79b08caa64e1ccc9578e251763aef7 + languageName: node + linkType: hard + +"is-unicode-supported@npm:^0.1.0": + version: 0.1.0 + resolution: "is-unicode-supported@npm:0.1.0" + checksum: a2aab86ee7712f5c2f999180daaba5f361bdad1efadc9610ff5b8ab5495b86e4f627839d085c6530363c6d6d4ecbde340fb8e54bdb83da4ba8e0865ed5513c52 + languageName: node + linkType: hard + +"is-unicode-supported@npm:^1.2.0": + version: 1.3.0 + resolution: "is-unicode-supported@npm:1.3.0" + checksum: 20a1fc161afafaf49243551a5ac33b6c4cf0bbcce369fcd8f2951fbdd000c30698ce320de3ee6830497310a8f41880f8066d440aa3eb0a853e2aa4836dd89abc + languageName: node + linkType: hard + +"is-whitespace-character@npm:^1.0.0": + version: 1.0.4 + resolution: "is-whitespace-character@npm:1.0.4" + checksum: adab8ad9847ccfcb6f1b7000b8f622881b5ba2a09ce8be2794a6d2b10c3af325b469fc562c9fb889f468eed27be06e227ac609d0aa1e3a59b4dbcc88e2b0418e + languageName: node + linkType: hard + +"is-word-character@npm:^1.0.0": + version: 1.0.4 + resolution: "is-word-character@npm:1.0.4" + checksum: 1821d6c6abe5bc0b3abe3fdc565d66d7c8a74ea4e93bc77b4a47d26e2e2a306d6ab7d92b353b0d2b182869e3ecaa8f4a346c62d0e31d38ebc0ceaf7cae182c3f + languageName: node + linkType: hard + +"is-wsl@npm:^2.2.0": + version: 2.2.0 + resolution: "is-wsl@npm:2.2.0" + dependencies: + is-docker: ^2.0.0 + checksum: 20849846ae414997d290b75e16868e5261e86ff5047f104027026fd61d8b5a9b0b3ade16239f35e1a067b3c7cc02f70183cb661010ed16f4b6c7c93dad1b19d8 + languageName: node + linkType: hard + +"is-yarn-global@npm:^0.3.0": + version: 0.3.0 + resolution: "is-yarn-global@npm:0.3.0" + checksum: bca013d65fee2862024c9fbb3ba13720ffca2fe750095174c1c80922fdda16402b5c233f5ac9e265bc12ecb5446e7b7f519a32d9541788f01d4d44e24d2bf481 + languageName: node + linkType: hard + +"isarray@npm:0.0.1": + version: 0.0.1 + resolution: "isarray@npm:0.0.1" + checksum: 49191f1425681df4a18c2f0f93db3adb85573bcdd6a4482539d98eac9e705d8961317b01175627e860516a2fc45f8f9302db26e5a380a97a520e272e2a40a8d4 + languageName: node + linkType: hard + +"isarray@npm:~1.0.0": + version: 1.0.0 + resolution: "isarray@npm:1.0.0" + checksum: f032df8e02dce8ec565cf2eb605ea939bdccea528dbcf565cdf92bfa2da9110461159d86a537388ef1acef8815a330642d7885b29010e8f7eac967c9993b65ab + languageName: node + linkType: hard + +"isbinaryfile@npm:^5.0.0": + version: 5.0.0 + resolution: "isbinaryfile@npm:5.0.0" + checksum: 25cc27388d51b8322c103f5894f9e72ec04e017734e57c4b70be2666501ec7e7f6cbb4a5fcfd15260a7cac979bd1ddb7f5231f5a3098c0695c4e7c049513dfaf + languageName: node + linkType: hard + +"isexe@npm:^2.0.0": + version: 2.0.0 + resolution: "isexe@npm:2.0.0" + checksum: 26bf6c5480dda5161c820c5b5c751ae1e766c587b1f951ea3fcfc973bafb7831ae5b54a31a69bd670220e42e99ec154475025a468eae58ea262f813fdc8d1c62 + languageName: node + linkType: hard + +"isobject@npm:^3.0.1": + version: 3.0.1 + resolution: "isobject@npm:3.0.1" + checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703 + languageName: node + linkType: hard + +"istanbul-lib-coverage@npm:^3.0.0": + version: 3.2.0 + resolution: "istanbul-lib-coverage@npm:3.2.0" + checksum: a2a545033b9d56da04a8571ed05c8120bf10e9bce01cf8633a3a2b0d1d83dff4ac4fe78d6d5673c27fc29b7f21a41d75f83a36be09f82a61c367b56aa73c1ff9 + languageName: node + linkType: hard + +"istanbul-lib-report@npm:^3.0.0, istanbul-lib-report@npm:^3.0.1": + version: 3.0.1 + resolution: "istanbul-lib-report@npm:3.0.1" + dependencies: + istanbul-lib-coverage: ^3.0.0 + make-dir: ^4.0.0 + supports-color: ^7.1.0 + checksum: fd17a1b879e7faf9bb1dc8f80b2a16e9f5b7b8498fe6ed580a618c34df0bfe53d2abd35bf8a0a00e628fb7405462576427c7df20bbe4148d19c14b431c974b21 + languageName: node + linkType: hard + +"istanbul-reports@npm:^3.0.2": + version: 3.1.6 + resolution: "istanbul-reports@npm:3.1.6" + dependencies: + html-escaper: ^2.0.0 + istanbul-lib-report: ^3.0.0 + checksum: 44c4c0582f287f02341e9720997f9e82c071627e1e862895745d5f52ec72c9b9f38e1d12370015d2a71dcead794f34c7732aaef3fab80a24bc617a21c3d911d6 + languageName: node + linkType: hard + +"jackspeak@npm:^2.0.3": + version: 2.3.3 + resolution: "jackspeak@npm:2.3.3" + dependencies: + "@isaacs/cliui": ^8.0.2 + "@pkgjs/parseargs": ^0.11.0 + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 4313a7c0cc44c7753c4cb9869935f0b06f4cf96827515f63f58ff46b3d2f6e29aba6b3b5151778397c3f5ae67ef8bfc48871967bd10343c27e90cff198ec7808 + languageName: node + linkType: hard + +"jackspeak@npm:^2.3.5": + version: 2.3.6 + resolution: "jackspeak@npm:2.3.6" + dependencies: + "@isaacs/cliui": ^8.0.2 + "@pkgjs/parseargs": ^0.11.0 + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 57d43ad11eadc98cdfe7496612f6bbb5255ea69fe51ea431162db302c2a11011642f50cfad57288bd0aea78384a0612b16e131944ad8ecd09d619041c8531b54 + languageName: node + linkType: hard + +"jest-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-util@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + ci-info: ^3.2.0 + graceful-fs: ^4.2.9 + picomatch: ^2.2.3 + checksum: 042ab4980f4ccd4d50226e01e5c7376a8556b472442ca6091a8f102488c0f22e6e8b89ea874111d2328a2080083bf3225c86f3788c52af0bd0345a00eb57a3ca + languageName: node + linkType: hard + +"jest-worker@npm:^27.4.5": + version: 27.5.1 + resolution: "jest-worker@npm:27.5.1" + dependencies: + "@types/node": "*" + merge-stream: ^2.0.0 + supports-color: ^8.0.0 + checksum: 98cd68b696781caed61c983a3ee30bf880b5bd021c01d98f47b143d4362b85d0737f8523761e2713d45e18b4f9a2b98af1eaee77afade4111bb65c77d6f7c980 + languageName: node + linkType: hard + +"jest-worker@npm:^29.1.2": + version: 29.7.0 + resolution: "jest-worker@npm:29.7.0" + dependencies: + "@types/node": "*" + jest-util: ^29.7.0 + merge-stream: ^2.0.0 + supports-color: ^8.0.0 + checksum: 30fff60af49675273644d408b650fc2eb4b5dcafc5a0a455f238322a8f9d8a98d847baca9d51ff197b6747f54c7901daa2287799230b856a0f48287d131f8c13 + languageName: node + linkType: hard + +"jiti@npm:^1.18.2": + version: 1.20.0 + resolution: "jiti@npm:1.20.0" + bin: + jiti: bin/jiti.js + checksum: 7924062b5675142e3e272a27735be84b7bfc0a0eb73217fc2dcafa034f37c4f7b4b9ffc07dd98bcff0f739a8811ce1544db205ae7e97b1c86f0df92c65ce3c72 + languageName: node + linkType: hard + +"joi@npm:^17.6.0": + version: 17.11.0 + resolution: "joi@npm:17.11.0" + dependencies: + "@hapi/hoek": ^9.0.0 + "@hapi/topo": ^5.0.0 + "@sideway/address": ^4.1.3 + "@sideway/formula": ^3.0.1 + "@sideway/pinpoint": ^2.0.0 + checksum: 3a4e9ecba345cdafe585e7ed8270a44b39718e11dff3749aa27e0001a63d578b75100c062be28e6f48f960b594864034e7a13833f33fbd7ad56d5ce6b617f9bf + languageName: node + linkType: hard + +"js-sdsl@npm:^4.1.4": + version: 4.4.2 + resolution: "js-sdsl@npm:4.4.2" + checksum: ba705adc1788bf3c6f6c8e5077824f2bb4f0acab5a984420ce5cc492c7fff3daddc26335ad2c9a67d4f5e3241ec790f9e5b72a625adcf20cf321d2fd85e62b8b + languageName: node + linkType: hard + +"js-sha3@npm:0.8.0": + version: 0.8.0 + resolution: "js-sha3@npm:0.8.0" + checksum: 75df77c1fc266973f06cce8309ce010e9e9f07ec35ab12022ed29b7f0d9c8757f5a73e1b35aa24840dced0dea7059085aa143d817aea9e188e2a80d569d9adce + languageName: node + linkType: hard + +"js-string-escape@npm:^1.0.1": + version: 1.0.1 + resolution: "js-string-escape@npm:1.0.1" + checksum: f11e0991bf57e0c183b55c547acec85bd2445f043efc9ea5aa68b41bd2a3e7d3ce94636cb233ae0d84064ba4c1a505d32e969813c5b13f81e7d4be12c59256fe + languageName: node + linkType: hard + +"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": + version: 4.0.0 + resolution: "js-tokens@npm:4.0.0" + checksum: 8a95213a5a77deb6cbe94d86340e8d9ace2b93bc367790b260101d2f36a2eaf4e4e22d9fa9cf459b38af3a32fb4190e638024cf82ec95ef708680e405ea7cc78 + languageName: node + linkType: hard + +"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": + version: 4.1.0 + resolution: "js-yaml@npm:4.1.0" + dependencies: + argparse: ^2.0.1 + bin: + js-yaml: bin/js-yaml.js + checksum: c7830dfd456c3ef2c6e355cc5a92e6700ceafa1d14bba54497b34a99f0376cecbb3e9ac14d3e5849b426d5a5140709a66237a8c991c675431271c4ce5504151a + languageName: node + linkType: hard + +"js-yaml@npm:^3.13.1, js-yaml@npm:^3.14.1": + version: 3.14.1 + resolution: "js-yaml@npm:3.14.1" + dependencies: + argparse: ^1.0.7 + esprima: ^4.0.0 + bin: + js-yaml: bin/js-yaml.js + checksum: bef146085f472d44dee30ec34e5cf36bf89164f5d585435a3d3da89e52622dff0b188a580e4ad091c3341889e14cb88cac6e4deb16dc5b1e9623bb0601fc255c + languageName: node + linkType: hard + +"jsesc@npm:^2.5.1": + version: 2.5.2 + resolution: "jsesc@npm:2.5.2" + bin: + jsesc: bin/jsesc + checksum: 4dc190771129e12023f729ce20e1e0bfceac84d73a85bc3119f7f938843fe25a4aeccb54b6494dce26fcf263d815f5f31acdefac7cc9329efb8422a4f4d9fa9d + languageName: node + linkType: hard + +"jsesc@npm:~0.5.0": + version: 0.5.0 + resolution: "jsesc@npm:0.5.0" + bin: + jsesc: bin/jsesc + checksum: b8b44cbfc92f198ad972fba706ee6a1dfa7485321ee8c0b25f5cedd538dcb20cde3197de16a7265430fce8277a12db066219369e3d51055038946039f6e20e17 + languageName: node + linkType: hard + +"json-buffer@npm:3.0.0": + version: 3.0.0 + resolution: "json-buffer@npm:3.0.0" + checksum: 0cecacb8025370686a916069a2ff81f7d55167421b6aa7270ee74e244012650dd6bce22b0852202ea7ff8624fce50ff0ec1bdf95914ccb4553426e290d5a63fa + languageName: node + linkType: hard + +"json-buffer@npm:3.0.1": + version: 3.0.1 + resolution: "json-buffer@npm:3.0.1" + checksum: 9026b03edc2847eefa2e37646c579300a1f3a4586cfb62bf857832b60c852042d0d6ae55d1afb8926163fa54c2b01d83ae24705f34990348bdac6273a29d4581 + languageName: node + linkType: hard + +"json-parse-even-better-errors@npm:^2.3.0, json-parse-even-better-errors@npm:^2.3.1": + version: 2.3.1 + resolution: "json-parse-even-better-errors@npm:2.3.1" + checksum: 798ed4cf3354a2d9ccd78e86d2169515a0097a5c133337807cdf7f1fc32e1391d207ccfc276518cc1d7d8d4db93288b8a50ba4293d212ad1336e52a8ec0a941f + languageName: node + linkType: hard + +"json-schema-traverse@npm:^0.4.1": + version: 0.4.1 + resolution: "json-schema-traverse@npm:0.4.1" + checksum: 7486074d3ba247769fda17d5181b345c9fb7d12e0da98b22d1d71a5db9698d8b4bd900a3ec1a4ffdd60846fc2556274a5c894d0c48795f14cb03aeae7b55260b + languageName: node + linkType: hard + +"json-schema-traverse@npm:^1.0.0": + version: 1.0.0 + resolution: "json-schema-traverse@npm:1.0.0" + checksum: 02f2f466cdb0362558b2f1fd5e15cce82ef55d60cd7f8fa828cf35ba74330f8d767fcae5c5c2adb7851fa811766c694b9405810879bc4e1ddd78a7c0e03658ad + languageName: node + linkType: hard + +"json-stable-stringify-without-jsonify@npm:^1.0.1": + version: 1.0.1 + resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" + checksum: cff44156ddce9c67c44386ad5cddf91925fe06b1d217f2da9c4910d01f358c6e3989c4d5a02683c7a5667f9727ff05831f7aa8ae66c8ff691c556f0884d49215 + languageName: node + linkType: hard + +"json5@npm:^2.1.2, json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 2a7436a93393830bce797d4626275152e37e877b265e94ca69c99e3d20c2b9dab021279146a39cdb700e71b2dd32a4cebd1514cd57cee102b1af906ce5040349 + languageName: node + linkType: hard + +"jsonc-parser@npm:^3.2.0": + version: 3.2.0 + resolution: "jsonc-parser@npm:3.2.0" + checksum: 946dd9a5f326b745aa326d48a7257e3f4a4b62c5e98ec8e49fa2bdd8d96cef7e6febf1399f5c7016114fd1f68a1c62c6138826d5d90bc650448e3cf0951c53c7 + languageName: node + linkType: hard + +"jsonfile@npm:^2.1.0": + version: 2.4.0 + resolution: "jsonfile@npm:2.4.0" + dependencies: + graceful-fs: ^4.1.6 + dependenciesMeta: + graceful-fs: + optional: true + checksum: f5064aabbc9e35530dc471d8b203ae1f40dbe949ddde4391c6f6a6d310619a15f0efdae5587df594d1d70c555193aaeee9d2ed4aec9ffd5767bd5e4e62d49c3d + languageName: node + linkType: hard + +"jsonfile@npm:^4.0.0": + version: 4.0.0 + resolution: "jsonfile@npm:4.0.0" + dependencies: + graceful-fs: ^4.1.6 + dependenciesMeta: + graceful-fs: + optional: true + checksum: 6447d6224f0d31623eef9b51185af03ac328a7553efcee30fa423d98a9e276ca08db87d71e17f2310b0263fd3ffa6c2a90a6308367f661dc21580f9469897c9e + languageName: node + linkType: hard + +"jsonfile@npm:^6.0.1": + version: 6.1.0 + resolution: "jsonfile@npm:6.1.0" + dependencies: + graceful-fs: ^4.1.6 + universalify: ^2.0.0 + dependenciesMeta: + graceful-fs: + optional: true + checksum: 7af3b8e1ac8fe7f1eccc6263c6ca14e1966fcbc74b618d3c78a0a2075579487547b94f72b7a1114e844a1e15bb00d440e5d1720bfc4612d790a6f285d5ea8354 + languageName: node + linkType: hard + +"katex@npm:^0.13.0": + version: 0.13.24 + resolution: "katex@npm:0.13.24" + dependencies: + commander: ^8.0.0 + bin: + katex: cli.js + checksum: 1b7c8295867073d0db4f6fb41ef1c0e3418b8e23924ff61b446b36134cb74cdadc7242dfbfb922d9c32f0b15eda6160a08cd30948c4e78141966ca2991a1726b + languageName: node + linkType: hard + +"keccak@npm:^3.0.0, keccak@npm:^3.0.2": + version: 3.0.4 + resolution: "keccak@npm:3.0.4" + dependencies: + node-addon-api: ^2.0.0 + node-gyp: latest + node-gyp-build: ^4.2.0 + readable-stream: ^3.6.0 + checksum: 2bf27b97b2f24225b1b44027de62be547f5c7326d87d249605665abd0c8c599d774671c35504c62c9b922cae02758504c6f76a73a84234d23af8a2211afaaa11 + languageName: node + linkType: hard + +"keygrip@npm:~1.1.0": + version: 1.1.0 + resolution: "keygrip@npm:1.1.0" + dependencies: + tsscmp: 1.0.6 + checksum: 078cd16a463d187121f0a27c1c9c95c52ad392b620f823431689f345a0501132cee60f6e96914b07d570105af470b96960402accd6c48a0b1f3cd8fac4fa2cae + languageName: node + linkType: hard + +"keyv@npm:^3.0.0": + version: 3.1.0 + resolution: "keyv@npm:3.1.0" + dependencies: + json-buffer: 3.0.0 + checksum: bb7e8f3acffdbafbc2dd5b63f377fe6ec4c0e2c44fc82720449ef8ab54f4a7ce3802671ed94c0f475ae0a8549703353a2124561fcf3317010c141b32ca1ce903 + languageName: node + linkType: hard + +"keyv@npm:^4.5.3": + version: 4.5.3 + resolution: "keyv@npm:4.5.3" + dependencies: + json-buffer: 3.0.1 + checksum: 3ffb4d5b72b6b4b4af443bbb75ca2526b23c750fccb5ac4c267c6116888b4b65681015c2833cb20d26cf3e6e32dac6b988c77f7f022e1a571b7d90f1442257da + languageName: node + linkType: hard + +"kind-of@npm:^6.0.0, kind-of@npm:^6.0.2": + version: 6.0.3 + resolution: "kind-of@npm:6.0.3" + checksum: 3ab01e7b1d440b22fe4c31f23d8d38b4d9b91d9f291df683476576493d5dfd2e03848a8b05813dd0c3f0e835bc63f433007ddeceb71f05cb25c45ae1b19c6d3b + languageName: node + linkType: hard + +"klaw-sync@npm:^6.0.0": + version: 6.0.0 + resolution: "klaw-sync@npm:6.0.0" + dependencies: + graceful-fs: ^4.1.11 + checksum: 0da397f8961313c3ef8f79fb63af9002cde5a8fb2aeb1a37351feff0dd6006129c790400c3f5c3b4e757bedcabb13d21ec0a5eaef5a593d59515d4f2c291e475 + languageName: node + linkType: hard + +"klaw@npm:^1.0.0": + version: 1.3.1 + resolution: "klaw@npm:1.3.1" + dependencies: + graceful-fs: ^4.1.9 + dependenciesMeta: + graceful-fs: + optional: true + checksum: 8f69e4797c26e7c3f2426bfa85f38a3da3c2cb1b4c6bd850d2377aed440d41ce9d806f2885c2e2e224372c56af4b1d43b8a499adecf9a05e7373dc6b8b7c52e4 + languageName: node + linkType: hard + +"kleur@npm:^3.0.3": + version: 3.0.3 + resolution: "kleur@npm:3.0.3" + checksum: df82cd1e172f957bae9c536286265a5cdbd5eeca487cb0a3b2a7b41ef959fc61f8e7c0e9aeea9c114ccf2c166b6a8dd45a46fd619c1c569d210ecd2765ad5169 + languageName: node + linkType: hard + +"kleur@npm:^4.0.3": + version: 4.1.5 + resolution: "kleur@npm:4.1.5" + checksum: 1dc476e32741acf0b1b5b0627ffd0d722e342c1b0da14de3e8ae97821327ca08f9fb944542fb3c126d90ac5f27f9d804edbe7c585bf7d12ef495d115e0f22c12 + languageName: node + linkType: hard + +"koa-compose@npm:^4.1.0": + version: 4.1.0 + resolution: "koa-compose@npm:4.1.0" + checksum: 46cb16792d96425e977c2ae4e5cb04930280740e907242ec9c25e3fb8b4a1d7b54451d7432bc24f40ec62255edea71894d2ceeb8238501842b4e48014f2e83db + languageName: node + linkType: hard + +"koa-convert@npm:^2.0.0": + version: 2.0.0 + resolution: "koa-convert@npm:2.0.0" + dependencies: + co: ^4.6.0 + koa-compose: ^4.1.0 + checksum: 7385b3391995f59c1312142e110d5dff677f9850dbfbcf387cd36a7b0af03b5d26e82b811eb9bb008b4f3e661cdab1f8817596e46b1929da2cf6e97a2f7456ed + languageName: node + linkType: hard + +"koa-etag@npm:^4.0.0": + version: 4.0.0 + resolution: "koa-etag@npm:4.0.0" + dependencies: + etag: ^1.8.1 + checksum: b5f413574e1edbd60fbbd0d31720e66565d51bfcb407d1bc3f48d9dd5b45fa5a9e4f69a60e749fad7397348e90de23e943307578d007a69da30faaae432deaf6 + languageName: node + linkType: hard + +"koa-send@npm:^5.0.0, koa-send@npm:^5.0.1": + version: 5.0.1 + resolution: "koa-send@npm:5.0.1" + dependencies: + debug: ^4.1.1 + http-errors: ^1.7.3 + resolve-path: ^1.4.0 + checksum: a9fbaadbe0f50efd157a733df4a1cc2b3b79b0cdf12e67c718641e6038d1792c0bebe40913e6d4ceb707d970301155be3859b98d1ef08b0fd1766f7326b82853 + languageName: node + linkType: hard + +"koa-static@npm:^5.0.0": + version: 5.0.0 + resolution: "koa-static@npm:5.0.0" + dependencies: + debug: ^3.1.0 + koa-send: ^5.0.0 + checksum: 8d9b9c4d2b3b13e8818e804245d784099c4b353b55ddd7dbeeb90f27a2e9f5b6f86bd16a4909e337cb89db4d332d9002e6c0f5056caf75749cab62f93c1f0cc5 + languageName: node + linkType: hard + +"koa@npm:^2.13.0": + version: 2.14.2 + resolution: "koa@npm:2.14.2" + dependencies: + accepts: ^1.3.5 + cache-content-type: ^1.0.0 + content-disposition: ~0.5.2 + content-type: ^1.0.4 + cookies: ~0.8.0 + debug: ^4.3.2 + delegates: ^1.0.0 + depd: ^2.0.0 + destroy: ^1.0.4 + encodeurl: ^1.0.2 + escape-html: ^1.0.3 + fresh: ~0.5.2 + http-assert: ^1.3.0 + http-errors: ^1.6.3 + is-generator-function: ^1.0.7 + koa-compose: ^4.1.0 + koa-convert: ^2.0.0 + on-finished: ^2.3.0 + only: ~0.0.2 + parseurl: ^1.3.2 + statuses: ^1.5.0 + type-is: ^1.6.16 + vary: ^1.1.2 + checksum: 17fe3b8f5e0b4759004a942cc6ba2a9507299943a697dff9766b85f41f45caed4077ca2645ac9ad254d3359fffedfc4c9ebdd7a70493e5df8cdfac159a8ee835 + languageName: node + linkType: hard + +"latest-version@npm:^5.1.0": + version: 5.1.0 + resolution: "latest-version@npm:5.1.0" + dependencies: + package-json: ^6.3.0 + checksum: fbc72b071eb66c40f652441fd783a9cca62f08bf42433651937f078cd9ef94bf728ec7743992777826e4e89305aef24f234b515e6030503a2cbee7fc9bdc2c0f + languageName: node + linkType: hard + +"launch-editor@npm:^2.6.0": + version: 2.6.1 + resolution: "launch-editor@npm:2.6.1" + dependencies: + picocolors: ^1.0.0 + shell-quote: ^1.8.1 + checksum: e06d193075ac09f7f8109f10cabe464a211bf7ed4cbe75f83348d6f67bf4d9f162f06e7a1ab3e1cd7fc250b5342c3b57080618aff2e646dc34248fe499227601 + languageName: node + linkType: hard + +"level-supports@npm:^4.0.0": + version: 4.0.1 + resolution: "level-supports@npm:4.0.1" + checksum: d4552b42bb8cdeada07b0f6356c7a90fefe76279147331f291aceae26e3e56d5f927b09ce921647c0230bfe03ddfbdcef332be921e5c2194421ae2bfa3cf6368 + languageName: node + linkType: hard + +"level-transcoder@npm:^1.0.1": + version: 1.0.1 + resolution: "level-transcoder@npm:1.0.1" + dependencies: + buffer: ^6.0.3 + module-error: ^1.0.1 + checksum: 304f08d802faf3491a533b6d87ad8be3cabfd27f2713bbe9d4c633bf50fcb9460eab5a6776bf015e101ead7ba1c1853e05e7f341112f17a9d0cb37ee5a421a25 + languageName: node + linkType: hard + +"level@npm:^8.0.0": + version: 8.0.0 + resolution: "level@npm:8.0.0" + dependencies: + browser-level: ^1.0.1 + classic-level: ^1.2.0 + checksum: 13eb25bd71bfdca6cd714d1233adf9da97de9a8a4bf9f28d62a390b5c96d0250abaf983eb90eb8c4e89c7a985bb330750683d106f12670e5ea8fba1d7e608a1f + languageName: node + linkType: hard + +"leven@npm:^3.1.0": + version: 3.1.0 + resolution: "leven@npm:3.1.0" + checksum: 638401d534585261b6003db9d99afd244dfe82d75ddb6db5c0df412842d5ab30b2ef18de471aaec70fe69a46f17b4ae3c7f01d8a4e6580ef7adb9f4273ad1e55 + languageName: node + linkType: hard + +"levn@npm:^0.4.1": + version: 0.4.1 + resolution: "levn@npm:0.4.1" + dependencies: + prelude-ls: ^1.2.1 + type-check: ~0.4.0 + checksum: 12c5021c859bd0f5248561bf139121f0358285ec545ebf48bb3d346820d5c61a4309535c7f387ed7d84361cf821e124ce346c6b7cef8ee09a67c1473b46d0fc4 + languageName: node + linkType: hard + +"lighthouse-logger@npm:^1.0.0": + version: 1.4.2 + resolution: "lighthouse-logger@npm:1.4.2" + dependencies: + debug: ^2.6.9 + marky: ^1.2.2 + checksum: ba6b73d93424318fab58b4e07c9ed246e3e969a3313f26b69515ed4c06457dd9a0b11bc706948398fdaef26aa4ba5e65cb848c37ce59f470d3c6c450b9b79a33 + languageName: node + linkType: hard + +"lilconfig@npm:^2.0.3": + version: 2.1.0 + resolution: "lilconfig@npm:2.1.0" + checksum: 8549bb352b8192375fed4a74694cd61ad293904eee33f9d4866c2192865c44c4eb35d10782966242634e0cbc1e91fe62b1247f148dc5514918e3a966da7ea117 + languageName: node + linkType: hard + +"lines-and-columns@npm:^1.1.6": + version: 1.2.4 + resolution: "lines-and-columns@npm:1.2.4" + checksum: 0c37f9f7fa212b38912b7145e1cd16a5f3cd34d782441c3e6ca653485d326f58b3caccda66efce1c5812bde4961bbde3374fae4b0d11bf1226152337f3894aa5 + languageName: node + linkType: hard + +"load-json-file@npm:^7.0.0": + version: 7.0.1 + resolution: "load-json-file@npm:7.0.1" + checksum: a560288da6891778321ef993e4bdbdf05374a4f3a3aeedd5ba6b64672798c830d748cfc59a2ec9891a3db30e78b3d04172e0dcb0d4828168289a393147ca0e74 + languageName: node + linkType: hard + +"loader-runner@npm:^4.2.0": + version: 4.3.0 + resolution: "loader-runner@npm:4.3.0" + checksum: a90e00dee9a16be118ea43fec3192d0b491fe03a32ed48a4132eb61d498f5536a03a1315531c19d284392a8726a4ecad71d82044c28d7f22ef62e029bf761569 + languageName: node + linkType: hard + +"loader-utils@npm:^2.0.0": + version: 2.0.4 + resolution: "loader-utils@npm:2.0.4" + dependencies: + big.js: ^5.2.2 + emojis-list: ^3.0.0 + json5: ^2.1.2 + checksum: a5281f5fff1eaa310ad5e1164095689443630f3411e927f95031ab4fb83b4a98f388185bb1fe949e8ab8d4247004336a625e9255c22122b815bb9a4c5d8fc3b7 + languageName: node + linkType: hard + +"loader-utils@npm:^3.2.0": + version: 3.2.1 + resolution: "loader-utils@npm:3.2.1" + checksum: 4e3ea054cdc8be1ab1f1238f49f42fdf0483039eff920fb1d442039f3f0ad4ebd11fb8e584ccdf2cb7e3c56b3d40c1832416e6408a55651b843da288960cc792 + languageName: node + linkType: hard + +"locate-path@npm:^2.0.0": + version: 2.0.0 + resolution: "locate-path@npm:2.0.0" + dependencies: + p-locate: ^2.0.0 + path-exists: ^3.0.0 + checksum: 02d581edbbbb0fa292e28d96b7de36b5b62c2fa8b5a7e82638ebb33afa74284acf022d3b1e9ae10e3ffb7658fbc49163fcd5e76e7d1baaa7801c3e05a81da755 + languageName: node + linkType: hard + +"locate-path@npm:^3.0.0": + version: 3.0.0 + resolution: "locate-path@npm:3.0.0" + dependencies: + p-locate: ^3.0.0 + path-exists: ^3.0.0 + checksum: 53db3996672f21f8b0bf2a2c645ae2c13ffdae1eeecfcd399a583bce8516c0b88dcb4222ca6efbbbeb6949df7e46860895be2c02e8d3219abd373ace3bfb4e11 + languageName: node + linkType: hard + +"locate-path@npm:^5.0.0": + version: 5.0.0 + resolution: "locate-path@npm:5.0.0" + dependencies: + p-locate: ^4.1.0 + checksum: 83e51725e67517287d73e1ded92b28602e3ae5580b301fe54bfb76c0c723e3f285b19252e375712316774cf52006cb236aed5704692c32db0d5d089b69696e30 + languageName: node + linkType: hard + +"locate-path@npm:^6.0.0": + version: 6.0.0 + resolution: "locate-path@npm:6.0.0" + dependencies: + p-locate: ^5.0.0 + checksum: 72eb661788a0368c099a184c59d2fee760b3831c9c1c33955e8a19ae4a21b4116e53fa736dc086cdeb9fce9f7cc508f2f92d2d3aae516f133e16a2bb59a39f5a + languageName: node + linkType: hard + +"locate-path@npm:^7.1.0": + version: 7.2.0 + resolution: "locate-path@npm:7.2.0" + dependencies: + p-locate: ^6.0.0 + checksum: c1b653bdf29beaecb3d307dfb7c44d98a2a98a02ebe353c9ad055d1ac45d6ed4e1142563d222df9b9efebc2bcb7d4c792b507fad9e7150a04c29530b7db570f8 + languageName: node + linkType: hard + +"lodash.assignwith@npm:^4.2.0": + version: 4.2.0 + resolution: "lodash.assignwith@npm:4.2.0" + checksum: 014a88e398802ca4eaae314afb67f32eb2cab6f01e61490dbbb74694263f79715341ab8ddf4b344093a2253b506d347f67731f0499e457d9c0128be1d2caf6dd + languageName: node + linkType: hard + +"lodash.camelcase@npm:^4.3.0": + version: 4.3.0 + resolution: "lodash.camelcase@npm:4.3.0" + checksum: cb9227612f71b83e42de93eccf1232feeb25e705bdb19ba26c04f91e885bfd3dd5c517c4a97137658190581d3493ea3973072ca010aab7e301046d90740393d1 + languageName: node + linkType: hard + +"lodash.curry@npm:^4.0.1": + version: 4.1.1 + resolution: "lodash.curry@npm:4.1.1" + checksum: 9192b70fe7df4d1ff780c0260bee271afa9168c93fe4fa24bc861900240531b59781b5fdaadf4644fea8f4fbcd96f0700539ab294b579ffc1022c6c15dcc462a + languageName: node + linkType: hard + +"lodash.debounce@npm:^4.0.8": + version: 4.0.8 + resolution: "lodash.debounce@npm:4.0.8" + checksum: a3f527d22c548f43ae31c861ada88b2637eb48ac6aa3eb56e82d44917971b8aa96fbb37aa60efea674dc4ee8c42074f90f7b1f772e9db375435f6c83a19b3bc6 + languageName: node + linkType: hard + +"lodash.escape@npm:^4.0.1": + version: 4.0.1 + resolution: "lodash.escape@npm:4.0.1" + checksum: fcb54f457497256964d619d5cccbd80a961916fca60df3fe0fa3e7f052715c2944c0ed5aefb4f9e047d127d44aa2d55555f3350cb42c6549e9e293fb30b41e7f + languageName: node + linkType: hard + +"lodash.flatten@npm:^4.4.0": + version: 4.4.0 + resolution: "lodash.flatten@npm:4.4.0" + checksum: 0ac34a393d4b795d4b7421153d27c13ae67e08786c9cbb60ff5b732210d46f833598eee3fb3844bb10070e8488efe390ea53bb567377e0cb47e9e630bf0811cb + languageName: node + linkType: hard + +"lodash.flow@npm:^3.3.0": + version: 3.5.0 + resolution: "lodash.flow@npm:3.5.0" + checksum: a9a62ad344e3c5a1f42bc121da20f64dd855aaafecee24b1db640f29b88bd165d81c37ff7e380a7191de6f70b26f5918abcebbee8396624f78f3618a0b18634c + languageName: node + linkType: hard + +"lodash.invokemap@npm:^4.6.0": + version: 4.6.0 + resolution: "lodash.invokemap@npm:4.6.0" + checksum: 646ceebbefbcb6da301f8c2868254680fd0bcdc6ada470495d9ae49c9c32938829c1b38a38c95d0258409a9655f85db404b16e648381c7450b7ed3d9c52d8808 + languageName: node + linkType: hard + +"lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: da27515dc5230eb1140ba65ff8de3613649620e8656b19a6270afe4866b7bd461d9ba2ac8a48dcc57f7adac4ee80e1de9f965d89d4d81a0ad52bb3eec2609644 + languageName: node + linkType: hard + +"lodash.memoize@npm:^4.1.2": + version: 4.1.2 + resolution: "lodash.memoize@npm:4.1.2" + checksum: 9ff3942feeccffa4f1fafa88d32f0d24fdc62fd15ded5a74a5f950ff5f0c6f61916157246744c620173dddf38d37095a92327d5fd3861e2063e736a5c207d089 + languageName: node + linkType: hard + +"lodash.merge@npm:^4.6.2": + version: 4.6.2 + resolution: "lodash.merge@npm:4.6.2" + checksum: ad580b4bdbb7ca1f7abf7e1bce63a9a0b98e370cf40194b03380a46b4ed799c9573029599caebc1b14e3f24b111aef72b96674a56cfa105e0f5ac70546cdc005 + languageName: node + linkType: hard + +"lodash.pullall@npm:^4.2.0": + version: 4.2.0 + resolution: "lodash.pullall@npm:4.2.0" + checksum: 7a5fbaedf186ec197ce1e0b9ba1d88a89773ebaf6a8291c7d273838cac59cb3b339cf36ef00e94172862ee84d2304c38face161846f08f5581d0553dcbdcd090 + languageName: node + linkType: hard + +"lodash.uniq@npm:4.5.0, lodash.uniq@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.uniq@npm:4.5.0" + checksum: a4779b57a8d0f3c441af13d9afe7ecff22dd1b8ce1129849f71d9bbc8e8ee4e46dfb4b7c28f7ad3d67481edd6e51126e4e2a6ee276e25906d10f7140187c392d + languageName: node + linkType: hard + +"lodash.uniqby@npm:^4.7.0": + version: 4.7.0 + resolution: "lodash.uniqby@npm:4.7.0" + checksum: 659264545a95726d1493123345aad8cbf56e17810fa9a0b029852c6d42bc80517696af09d99b23bef1845d10d95e01b8b4a1da578f22aeba7a30d3e0022a4938 + languageName: node + linkType: hard + +"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": + version: 4.17.21 + resolution: "lodash@npm:4.17.21" + checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 + languageName: node + linkType: hard + +"log-symbols@npm:4.1.0": + version: 4.1.0 + resolution: "log-symbols@npm:4.1.0" + dependencies: + chalk: ^4.1.0 + is-unicode-supported: ^0.1.0 + checksum: fce1497b3135a0198803f9f07464165e9eb83ed02ceb2273930a6f8a508951178d8cf4f0378e9d28300a2ed2bc49050995d2bd5f53ab716bb15ac84d58c6ef74 + languageName: node + linkType: hard + +"log-update@npm:^4.0.0": + version: 4.0.0 + resolution: "log-update@npm:4.0.0" + dependencies: + ansi-escapes: ^4.3.0 + cli-cursor: ^3.1.0 + slice-ansi: ^4.0.0 + wrap-ansi: ^6.2.0 + checksum: ae2f85bbabc1906034154fb7d4c4477c79b3e703d22d78adee8b3862fa913942772e7fa11713e3d96fb46de4e3cabefbf5d0a544344f03b58d3c4bff52aa9eb2 + languageName: node + linkType: hard + +"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.2.0, loose-envify@npm:^1.3.1, loose-envify@npm:^1.4.0": + version: 1.4.0 + resolution: "loose-envify@npm:1.4.0" + dependencies: + js-tokens: ^3.0.0 || ^4.0.0 + bin: + loose-envify: cli.js + checksum: 6517e24e0cad87ec9888f500c5b5947032cdfe6ef65e1c1936a0c48a524b81e65542c9c3edc91c97d5bddc806ee2a985dbc79be89215d613b1de5db6d1cfe6f4 + languageName: node + linkType: hard + +"loupe@npm:^2.3.1": + version: 2.3.6 + resolution: "loupe@npm:2.3.6" + dependencies: + get-func-name: ^2.0.0 + checksum: cc83f1b124a1df7384601d72d8d1f5fe95fd7a8185469fec48bb2e4027e45243949e7a013e8d91051a138451ff0552310c32aa9786e60b6a30d1e801bdc2163f + languageName: node + linkType: hard + +"lower-case@npm:^2.0.2": + version: 2.0.2 + resolution: "lower-case@npm:2.0.2" + dependencies: + tslib: ^2.0.3 + checksum: 83a0a5f159ad7614bee8bf976b96275f3954335a84fad2696927f609ddae902802c4f3312d86668722e668bef41400254807e1d3a7f2e8c3eede79691aa1f010 + languageName: node + linkType: hard + +"lowercase-keys@npm:^1.0.0, lowercase-keys@npm:^1.0.1": + version: 1.0.1 + resolution: "lowercase-keys@npm:1.0.1" + checksum: 4d045026595936e09953e3867722e309415ff2c80d7701d067546d75ef698dac218a4f53c6d1d0e7368b47e45fd7529df47e6cb56fbb90523ba599f898b3d147 + languageName: node + linkType: hard + +"lowercase-keys@npm:^2.0.0": + version: 2.0.0 + resolution: "lowercase-keys@npm:2.0.0" + checksum: 24d7ebd56ccdf15ff529ca9e08863f3c54b0b9d1edb97a3ae1af34940ae666c01a1e6d200707bce730a8ef76cb57cc10e65f245ecaaf7e6bc8639f2fb460ac23 + languageName: node + linkType: hard + +"lru-cache@npm:^5.1.1": + version: 5.1.1 + resolution: "lru-cache@npm:5.1.1" + dependencies: + yallist: ^3.0.2 + checksum: c154ae1cbb0c2206d1501a0e94df349653c92c8cbb25236d7e85190bcaf4567a03ac6eb43166fabfa36fd35623694da7233e88d9601fbf411a9a481d85dbd2cb + languageName: node + linkType: hard + +"lru-cache@npm:^6.0.0": + version: 6.0.0 + resolution: "lru-cache@npm:6.0.0" + dependencies: + yallist: ^4.0.0 + checksum: f97f499f898f23e4585742138a22f22526254fdba6d75d41a1c2526b3b6cc5747ef59c5612ba7375f42aca4f8461950e925ba08c991ead0651b4918b7c978297 + languageName: node + linkType: hard + +"lru-cache@npm:^7.7.1": + version: 7.18.3 + resolution: "lru-cache@npm:7.18.3" + checksum: e550d772384709deea3f141af34b6d4fa392e2e418c1498c078de0ee63670f1f46f5eee746e8ef7e69e1c895af0d4224e62ee33e66a543a14763b0f2e74c1356 + languageName: node + linkType: hard + +"lru-cache@npm:^8.0.4": + version: 8.0.5 + resolution: "lru-cache@npm:8.0.5" + checksum: 87d72196d8f46e8299c4ab576ed2ec8a07e3cbef517dc9874399c0b2470bd9bf62aacec3b67f84ed6d74aaa1ef31636d048edf996f76248fd17db72bfb631609 + languageName: node + linkType: hard + +"lru-cache@npm:^9.1.1 || ^10.0.0": + version: 10.0.1 + resolution: "lru-cache@npm:10.0.1" + checksum: 06f8d0e1ceabd76bb6f644a26dbb0b4c471b79c7b514c13c6856113879b3bf369eb7b497dad4ff2b7e2636db202412394865b33c332100876d838ad1372f0181 + languageName: node + linkType: hard + +"lru_map@npm:^0.3.3": + version: 0.3.3 + resolution: "lru_map@npm:0.3.3" + checksum: ca9dd43c65ed7a4f117c548028101c5b6855e10923ea9d1f635af53ad20c5868ff428c364d454a7b57fe391b89c704982275410c3c5099cca5aeee00d76e169a + languageName: node + linkType: hard + +"lunr-languages@npm:^1.4.0": + version: 1.14.0 + resolution: "lunr-languages@npm:1.14.0" + checksum: 05dd6338af6897932f64f9cb735d5b48f9905d892499b22a3f3abc279b2ac71a6bce0fdfe59c01464c6ad3f8e44e2956ba0637f092535239793bbadf4540e72d + languageName: node + linkType: hard + +"lunr@npm:^2.3.9": + version: 2.3.9 + resolution: "lunr@npm:2.3.9" + checksum: 176719e24fcce7d3cf1baccce9dd5633cd8bdc1f41ebe6a180112e5ee99d80373fe2454f5d4624d437e5a8319698ca6837b9950566e15d2cae5f2a543a3db4b8 + languageName: node + linkType: hard + +"make-dir@npm:^3.0.0, make-dir@npm:^3.0.2, make-dir@npm:^3.1.0": + version: 3.1.0 + resolution: "make-dir@npm:3.1.0" + dependencies: + semver: ^6.0.0 + checksum: 484200020ab5a1fdf12f393fe5f385fc8e4378824c940fba1729dcd198ae4ff24867bc7a5646331e50cead8abff5d9270c456314386e629acec6dff4b8016b78 + languageName: node + linkType: hard + +"make-dir@npm:^4.0.0": + version: 4.0.0 + resolution: "make-dir@npm:4.0.0" + dependencies: + semver: ^7.5.3 + checksum: bf0731a2dd3aab4db6f3de1585cea0b746bb73eb5a02e3d8d72757e376e64e6ada190b1eddcde5b2f24a81b688a9897efd5018737d05e02e2a671dda9cff8a8a + languageName: node + linkType: hard + +"make-error@npm:^1.1.1": + version: 1.3.6 + resolution: "make-error@npm:1.3.6" + checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 + languageName: node + linkType: hard + +"make-fetch-happen@npm:^11.0.3": + version: 11.1.1 + resolution: "make-fetch-happen@npm:11.1.1" + dependencies: + agentkeepalive: ^4.2.1 + cacache: ^17.0.0 + http-cache-semantics: ^4.1.1 + http-proxy-agent: ^5.0.0 + https-proxy-agent: ^5.0.0 + is-lambda: ^1.0.1 + lru-cache: ^7.7.1 + minipass: ^5.0.0 + minipass-fetch: ^3.0.0 + minipass-flush: ^1.0.5 + minipass-pipeline: ^1.2.4 + negotiator: ^0.6.3 + promise-retry: ^2.0.1 + socks-proxy-agent: ^7.0.0 + ssri: ^10.0.0 + checksum: 7268bf274a0f6dcf0343829489a4506603ff34bd0649c12058753900b0eb29191dce5dba12680719a5d0a983d3e57810f594a12f3c18494e93a1fbc6348a4540 + languageName: node + linkType: hard + +"map-age-cleaner@npm:^0.1.3": + version: 0.1.3 + resolution: "map-age-cleaner@npm:0.1.3" + dependencies: + p-defer: ^1.0.0 + checksum: cb2804a5bcb3cbdfe4b59066ea6d19f5e7c8c196cd55795ea4c28f792b192e4c442426ae52524e5e1acbccf393d3bddacefc3d41f803e66453f6c4eda3650bc1 + languageName: node + linkType: hard + +"map-stream@npm:~0.1.0": + version: 0.1.0 + resolution: "map-stream@npm:0.1.0" + checksum: 38abbe4eb883888031e6b2fc0630bc583c99396be16b8ace5794b937b682a8a081f03e8b15bfd4914d1bc88318f0e9ac73ba3512ae65955cd449f63256ddb31d + languageName: node + linkType: hard + +"mark.js@npm:^8.11.1": + version: 8.11.1 + resolution: "mark.js@npm:8.11.1" + checksum: aa6b9ae1c67245348d5b7abd253ef2acd6bb05c6be358d7d192416d964e42665fc10e0e865591c6f93ab9b57e8da1f23c23216e8ebddb580905ea7a0c0df15d4 + languageName: node + linkType: hard + +"markdown-escapes@npm:^1.0.0": + version: 1.0.4 + resolution: "markdown-escapes@npm:1.0.4" + checksum: 6833a93d72d3f70a500658872312c6fa8015c20cc835a85ae6901fa232683fbc6ed7118ebe920fea7c80039a560f339c026597d96eee0e9de602a36921804997 + languageName: node + linkType: hard + +"marked@npm:^4.3.0": + version: 4.3.0 + resolution: "marked@npm:4.3.0" + bin: + marked: bin/marked.js + checksum: 0db6817893952c3ec710eb9ceafb8468bf5ae38cb0f92b7b083baa13d70b19774674be04db5b817681fa7c5c6a088f61300815e4dd75a59696f4716ad69f6260 + languageName: node + linkType: hard + +"marky@npm:^1.2.2": + version: 1.2.5 + resolution: "marky@npm:1.2.5" + checksum: 823b946677749551cdfc3b5221685478b5d1b9cc0dc03eff977c6f9a615fb05c67559f9556cb3c0fcb941a9ea0e195e37befd83026443396ccee8b724f54f4c5 + languageName: node + linkType: hard + +"matcher@npm:^5.0.0": + version: 5.0.0 + resolution: "matcher@npm:5.0.0" + dependencies: + escape-string-regexp: ^5.0.0 + checksum: 28f191c2d23fee0f6f32fd0181d9fe173b0ab815a919edba55605438a2f9fa40372e002574a1b17add981b0a8669c75bc6194318d065ed2dceffd8b160c38118 + languageName: node + linkType: hard + +"mcl-wasm@npm:^0.7.1": + version: 0.7.9 + resolution: "mcl-wasm@npm:0.7.9" + checksum: 6b6ed5084156b98b2db70b223e1ba2c01953970b48a2e0c4ea3eeb9296610e6b3bfb2a2cce9e92e2d7ad61778b5f5a630e705e663835e915ba188c174a0a37fa + languageName: node + linkType: hard + +"md5-hex@npm:^3.0.1": + version: 3.0.1 + resolution: "md5-hex@npm:3.0.1" + dependencies: + blueimp-md5: ^2.10.0 + checksum: 6799a19e8bdd3e0c2861b94c1d4d858a89220488d7885c1fa236797e367d0c2e5f2b789e05309307083503f85be3603a9686a5915568a473137d6b4117419cc2 + languageName: node + linkType: hard + +"md5.js@npm:^1.3.4": + version: 1.3.5 + resolution: "md5.js@npm:1.3.5" + dependencies: + hash-base: ^3.0.0 + inherits: ^2.0.1 + safe-buffer: ^5.1.2 + checksum: 098494d885684bcc4f92294b18ba61b7bd353c23147fbc4688c75b45cb8590f5a95fd4584d742415dcc52487f7a1ef6ea611cfa1543b0dc4492fe026357f3f0c + languageName: node + linkType: hard + +"mdast-squeeze-paragraphs@npm:^4.0.0": + version: 4.0.0 + resolution: "mdast-squeeze-paragraphs@npm:4.0.0" + dependencies: + unist-util-remove: ^2.0.0 + checksum: dfe8ec8e8a62171f020e82b088cc35cb9da787736dc133a3b45ce8811782a93e69bf06d147072e281079f09fac67be8a36153ffffd9bfbf89ed284e4c4f56f75 + languageName: node + linkType: hard + +"mdast-util-definitions@npm:^4.0.0": + version: 4.0.0 + resolution: "mdast-util-definitions@npm:4.0.0" + dependencies: + unist-util-visit: ^2.0.0 + checksum: 2325f20b82b3fb8cb5fda77038ee0bbdd44f82cfca7c48a854724b58bc1fe5919630a3ce7c45e210726df59d46c881d020b2da7a493bfd1ee36eb2bbfef5d78e + languageName: node + linkType: hard + +"mdast-util-to-hast@npm:10.0.1": + version: 10.0.1 + resolution: "mdast-util-to-hast@npm:10.0.1" + dependencies: + "@types/mdast": ^3.0.0 + "@types/unist": ^2.0.0 + mdast-util-definitions: ^4.0.0 + mdurl: ^1.0.0 + unist-builder: ^2.0.0 + unist-util-generated: ^1.0.0 + unist-util-position: ^3.0.0 + unist-util-visit: ^2.0.0 + checksum: e5f385757df7e9b37db4d6f326bf7b4fc1b40f9ad01fc335686578f44abe0ba46d3e60af4d5e5b763556d02e65069ef9a09c49db049b52659203a43e7fa9084d + languageName: node + linkType: hard + +"mdast-util-to-string@npm:^2.0.0": + version: 2.0.0 + resolution: "mdast-util-to-string@npm:2.0.0" + checksum: 0b2113ada10e002fbccb014170506dabe2f2ddacaacbe4bc1045c33f986652c5a162732a2c057c5335cdb58419e2ad23e368e5be226855d4d4e280b81c4e9ec2 + languageName: node + linkType: hard + +"mdn-data@npm:2.0.14": + version: 2.0.14 + resolution: "mdn-data@npm:2.0.14" + checksum: 9d0128ed425a89f4cba8f787dca27ad9408b5cb1b220af2d938e2a0629d17d879a34d2cb19318bdb26c3f14c77dd5dfbae67211f5caaf07b61b1f2c5c8c7dc16 + languageName: node + linkType: hard + +"mdurl@npm:^1.0.0": + version: 1.0.1 + resolution: "mdurl@npm:1.0.1" + checksum: 71731ecba943926bfbf9f9b51e28b5945f9411c4eda80894221b47cc105afa43ba2da820732b436f0798fd3edbbffcd1fc1415843c41a87fea08a41cc1e3d02b + languageName: node + linkType: hard + +"media-typer@npm:0.3.0": + version: 0.3.0 + resolution: "media-typer@npm:0.3.0" + checksum: af1b38516c28ec95d6b0826f6c8f276c58aec391f76be42aa07646b4e39d317723e869700933ca6995b056db4b09a78c92d5440dc23657e6764be5d28874bba1 + languageName: node + linkType: hard + +"mem@npm:^9.0.2": + version: 9.0.2 + resolution: "mem@npm:9.0.2" + dependencies: + map-age-cleaner: ^0.1.3 + mimic-fn: ^4.0.0 + checksum: 07829bb182af0e3ecf748dc2edb1c3b10a256ef10458f7e24d06561a2adc2b3ef34d14abe81678bbcedb46faa477e7370223f118b1a5e1252da5fe43496f3967 + languageName: node + linkType: hard + +"memfs@npm:^3.1.2, memfs@npm:^3.4.3": + version: 3.5.3 + resolution: "memfs@npm:3.5.3" + dependencies: + fs-monkey: ^1.0.4 + checksum: 18dfdeacad7c8047b976a6ccd58bc98ba76e122ad3ca0e50a21837fe2075fc0d9aafc58ab9cf2576c2b6889da1dd2503083f2364191b695273f40969db2ecc44 + languageName: node + linkType: hard + +"memory-level@npm:^1.0.0": + version: 1.0.0 + resolution: "memory-level@npm:1.0.0" + dependencies: + abstract-level: ^1.0.0 + functional-red-black-tree: ^1.0.1 + module-error: ^1.0.1 + checksum: 80b1b7aedaf936e754adbcd7b9303018c3684fb32f9992fd967c448f145d177f16c724fbba9ed3c3590a9475fd563151eae664d69b83d2ad48714852e9fc5c72 + languageName: node + linkType: hard + +"memorystream@npm:^0.3.1": + version: 0.3.1 + resolution: "memorystream@npm:0.3.1" + checksum: f18b42440d24d09516d01466c06adf797df7873f0d40aa7db02e5fb9ed83074e5e65412d0720901d7069363465f82dc4f8bcb44f0cde271567a61426ce6ca2e9 + languageName: node + linkType: hard + +"merge-descriptors@npm:1.0.1": + version: 1.0.1 + resolution: "merge-descriptors@npm:1.0.1" + checksum: 5abc259d2ae25bb06d19ce2b94a21632583c74e2a9109ee1ba7fd147aa7362b380d971e0251069f8b3eb7d48c21ac839e21fa177b335e82c76ec172e30c31a26 + languageName: node + linkType: hard + +"merge-stream@npm:^2.0.0": + version: 2.0.0 + resolution: "merge-stream@npm:2.0.0" + checksum: 6fa4dcc8d86629705cea944a4b88ef4cb0e07656ebf223fa287443256414283dd25d91c1cd84c77987f2aec5927af1a9db6085757cb43d90eb170ebf4b47f4f4 + languageName: node + linkType: hard + +"merge2@npm:^1.3.0, merge2@npm:^1.4.1": + version: 1.4.1 + resolution: "merge2@npm:1.4.1" + checksum: 7268db63ed5169466540b6fb947aec313200bcf6d40c5ab722c22e242f651994619bcd85601602972d3c85bd2cc45a358a4c61937e9f11a061919a1da569b0c2 + languageName: node + linkType: hard + +"methods@npm:~1.1.2": + version: 1.1.2 + resolution: "methods@npm:1.1.2" + checksum: 0917ff4041fa8e2f2fda5425a955fe16ca411591fbd123c0d722fcf02b73971ed6f764d85f0a6f547ce49ee0221ce2c19a5fa692157931cecb422984f1dcd13a + languageName: node + linkType: hard + +"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5": + version: 4.0.5 + resolution: "micromatch@npm:4.0.5" + dependencies: + braces: ^3.0.2 + picomatch: ^2.3.1 + checksum: 02a17b671c06e8fefeeb6ef996119c1e597c942e632a21ef589154f23898c9c6a9858526246abb14f8bca6e77734aa9dcf65476fca47cedfb80d9577d52843fc + languageName: node + linkType: hard + +"mime-db@npm:1.52.0, mime-db@npm:>= 1.43.0 < 2": + version: 1.52.0 + resolution: "mime-db@npm:1.52.0" + checksum: 0d99a03585f8b39d68182803b12ac601d9c01abfa28ec56204fa330bc9f3d1c5e14beb049bafadb3dbdf646dfb94b87e24d4ec7b31b7279ef906a8ea9b6a513f + languageName: node + linkType: hard + +"mime-db@npm:~1.33.0": + version: 1.33.0 + resolution: "mime-db@npm:1.33.0" + checksum: 281a0772187c9b8f6096976cb193ac639c6007ac85acdbb8dc1617ed7b0f4777fa001d1b4f1b634532815e60717c84b2f280201d55677fb850c9d45015b50084 + languageName: node + linkType: hard + +"mime-types@npm:2.1.18": + version: 2.1.18 + resolution: "mime-types@npm:2.1.18" + dependencies: + mime-db: ~1.33.0 + checksum: 729265eff1e5a0e87cb7f869da742a610679585167d2f2ec997a7387fc6aedf8e5cad078e99b0164a927bdf3ace34fca27430d6487456ad090cba5594441ba43 + languageName: node + linkType: hard + +"mime-types@npm:^2.1.12, mime-types@npm:^2.1.18, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:~2.1.17, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": + version: 2.1.35 + resolution: "mime-types@npm:2.1.35" + dependencies: + mime-db: 1.52.0 + checksum: 89a5b7f1def9f3af5dad6496c5ed50191ae4331cc5389d7c521c8ad28d5fdad2d06fd81baf38fed813dc4e46bb55c8145bb0ff406330818c9cf712fb2e9b3836 + languageName: node + linkType: hard + +"mime@npm:1.6.0": + version: 1.6.0 + resolution: "mime@npm:1.6.0" + bin: + mime: cli.js + checksum: fef25e39263e6d207580bdc629f8872a3f9772c923c7f8c7e793175cee22777bbe8bba95e5d509a40aaa292d8974514ce634ae35769faa45f22d17edda5e8557 + languageName: node + linkType: hard + +"mimic-fn@npm:^2.1.0": + version: 2.1.0 + resolution: "mimic-fn@npm:2.1.0" + checksum: d2421a3444848ce7f84bd49115ddacff29c15745db73f54041edc906c14b131a38d05298dae3081667627a59b2eb1ca4b436ff2e1b80f69679522410418b478a + languageName: node + linkType: hard + +"mimic-fn@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-fn@npm:4.0.0" + checksum: 995dcece15ee29aa16e188de6633d43a3db4611bcf93620e7e62109ec41c79c0f34277165b8ce5e361205049766e371851264c21ac64ca35499acb5421c2ba56 + languageName: node + linkType: hard + +"mimic-response@npm:^1.0.0, mimic-response@npm:^1.0.1": + version: 1.0.1 + resolution: "mimic-response@npm:1.0.1" + checksum: 034c78753b0e622bc03c983663b1cdf66d03861050e0c8606563d149bc2b02d63f62ce4d32be4ab50d0553ae0ffe647fc34d1f5281184c6e1e8cf4d85e8d9823 + languageName: node + linkType: hard + +"mini-css-extract-plugin@npm:^2.6.1": + version: 2.7.6 + resolution: "mini-css-extract-plugin@npm:2.7.6" + dependencies: + schema-utils: ^4.0.0 + peerDependencies: + webpack: ^5.0.0 + checksum: be6f7cefc6275168eb0a6b8fe977083a18c743c9612c9f00e6c1a62c3393ca7960e93fba1a7ebb09b75f36a0204ad087d772c1ef574bc29c90c0e8175a3c0b83 + languageName: node + linkType: hard + +"minimalistic-assert@npm:^1.0.0, minimalistic-assert@npm:^1.0.1": + version: 1.0.1 + resolution: "minimalistic-assert@npm:1.0.1" + checksum: cc7974a9268fbf130fb055aff76700d7e2d8be5f761fb5c60318d0ed010d839ab3661a533ad29a5d37653133385204c503bfac995aaa4236f4e847461ea32ba7 + languageName: node + linkType: hard + +"minimalistic-crypto-utils@npm:^1.0.1": + version: 1.0.1 + resolution: "minimalistic-crypto-utils@npm:1.0.1" + checksum: 6e8a0422b30039406efd4c440829ea8f988845db02a3299f372fceba56ffa94994a9c0f2fd70c17f9969eedfbd72f34b5070ead9656a34d3f71c0bd72583a0ed + languageName: node + linkType: hard + +"minimatch@npm:3.1.2, minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": + version: 3.1.2 + resolution: "minimatch@npm:3.1.2" + dependencies: + brace-expansion: ^1.1.7 + checksum: c154e566406683e7bcb746e000b84d74465b3a832c45d59912b9b55cd50dee66e5c4b1e5566dba26154040e51672f9aa450a9aef0c97cfc7336b78b7afb9540a + languageName: node + linkType: hard + +"minimatch@npm:5.0.1": + version: 5.0.1 + resolution: "minimatch@npm:5.0.1" + dependencies: + brace-expansion: ^2.0.1 + checksum: b34b98463da4754bc526b244d680c69d4d6089451ebe512edaf6dd9eeed0279399cfa3edb19233513b8f830bf4bfcad911dddcdf125e75074100d52f724774f0 + languageName: node + linkType: hard + +"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": + version: 9.0.3 + resolution: "minimatch@npm:9.0.3" + dependencies: + brace-expansion: ^2.0.1 + checksum: 253487976bf485b612f16bf57463520a14f512662e592e95c571afdab1442a6a6864b6c88f248ce6fc4ff0b6de04ac7aa6c8bb51e868e99d1d65eb0658a708b5 + languageName: node + linkType: hard + +"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6": + version: 1.2.8 + resolution: "minimist@npm:1.2.8" + checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0 + languageName: node + linkType: hard + +"minipass-collect@npm:^1.0.2": + version: 1.0.2 + resolution: "minipass-collect@npm:1.0.2" + dependencies: + minipass: ^3.0.0 + checksum: 14df761028f3e47293aee72888f2657695ec66bd7d09cae7ad558da30415fdc4752bbfee66287dcc6fd5e6a2fa3466d6c484dc1cbd986525d9393b9523d97f10 + languageName: node + linkType: hard + +"minipass-fetch@npm:^3.0.0": + version: 3.0.4 + resolution: "minipass-fetch@npm:3.0.4" + dependencies: + encoding: ^0.1.13 + minipass: ^7.0.3 + minipass-sized: ^1.0.3 + minizlib: ^2.1.2 + dependenciesMeta: + encoding: + optional: true + checksum: af7aad15d5c128ab1ebe52e043bdf7d62c3c6f0cecb9285b40d7b395e1375b45dcdfd40e63e93d26a0e8249c9efd5c325c65575aceee192883970ff8cb11364a + languageName: node + linkType: hard + +"minipass-flush@npm:^1.0.5": + version: 1.0.5 + resolution: "minipass-flush@npm:1.0.5" + dependencies: + minipass: ^3.0.0 + checksum: 56269a0b22bad756a08a94b1ffc36b7c9c5de0735a4dd1ab2b06c066d795cfd1f0ac44a0fcae13eece5589b908ecddc867f04c745c7009be0b566421ea0944cf + languageName: node + linkType: hard + +"minipass-pipeline@npm:^1.2.4": + version: 1.2.4 + resolution: "minipass-pipeline@npm:1.2.4" + dependencies: + minipass: ^3.0.0 + checksum: b14240dac0d29823c3d5911c286069e36d0b81173d7bdf07a7e4a91ecdef92cdff4baaf31ea3746f1c61e0957f652e641223970870e2353593f382112257971b + languageName: node + linkType: hard + +"minipass-sized@npm:^1.0.3": + version: 1.0.3 + resolution: "minipass-sized@npm:1.0.3" + dependencies: + minipass: ^3.0.0 + checksum: 79076749fcacf21b5d16dd596d32c3b6bf4d6e62abb43868fac21674078505c8b15eaca4e47ed844985a4514854f917d78f588fcd029693709417d8f98b2bd60 + languageName: node + linkType: hard + +"minipass@npm:^3.0.0": + version: 3.3.6 + resolution: "minipass@npm:3.3.6" + dependencies: + yallist: ^4.0.0 + checksum: a30d083c8054cee83cdcdc97f97e4641a3f58ae743970457b1489ce38ee1167b3aaf7d815cd39ec7a99b9c40397fd4f686e83750e73e652b21cb516f6d845e48 + languageName: node + linkType: hard + +"minipass@npm:^5.0.0": + version: 5.0.0 + resolution: "minipass@npm:5.0.0" + checksum: 425dab288738853fded43da3314a0b5c035844d6f3097a8e3b5b29b328da8f3c1af6fc70618b32c29ff906284cf6406b6841376f21caaadd0793c1d5a6a620ea + languageName: node + linkType: hard + +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.3": + version: 7.0.3 + resolution: "minipass@npm:7.0.3" + checksum: 6f1614f5b5b55568a46bca5fec0e7c46dac027691db27d0e1923a8192866903144cd962ac772c0e9f89b608ea818b702709c042bce98e190d258847d85461531 + languageName: node + linkType: hard + +"minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": + version: 2.1.2 + resolution: "minizlib@npm:2.1.2" + dependencies: + minipass: ^3.0.0 + yallist: ^4.0.0 + checksum: f1fdeac0b07cf8f30fcf12f4b586795b97be856edea22b5e9072707be51fc95d41487faec3f265b42973a304fe3a64acd91a44a3826a963e37b37bafde0212c3 + languageName: node + linkType: hard + +"mitt@npm:3.0.0": + version: 3.0.0 + resolution: "mitt@npm:3.0.0" + checksum: f7be5049d27d18b1dbe9408452d66376fa60ae4a79fe9319869d1b90ae8cbaedadc7e9dab30b32d781411256d468be5538996bb7368941c09009ef6bbfa6bfc7 + languageName: node + linkType: hard + +"mkdirp-classic@npm:^0.5.2": + version: 0.5.3 + resolution: "mkdirp-classic@npm:0.5.3" + checksum: 3f4e088208270bbcc148d53b73e9a5bd9eef05ad2cbf3b3d0ff8795278d50dd1d11a8ef1875ff5aea3fa888931f95bfcb2ad5b7c1061cfefd6284d199e6776ac + languageName: node + linkType: hard + +"mkdirp@npm:^0.5.6": + version: 0.5.6 + resolution: "mkdirp@npm:0.5.6" + dependencies: + minimist: ^1.2.6 + bin: + mkdirp: bin/cmd.js + checksum: 0c91b721bb12c3f9af4b77ebf73604baf350e64d80df91754dc509491ae93bf238581e59c7188360cec7cb62fc4100959245a42cfe01834efedc5e9d068376c2 + languageName: node + linkType: hard + +"mkdirp@npm:^1.0.3, mkdirp@npm:^1.0.4": + version: 1.0.4 + resolution: "mkdirp@npm:1.0.4" + bin: + mkdirp: bin/cmd.js + checksum: a96865108c6c3b1b8e1d5e9f11843de1e077e57737602de1b82030815f311be11f96f09cce59bd5b903d0b29834733e5313f9301e3ed6d6f6fba2eae0df4298f + languageName: node + linkType: hard + +"mnemonist@npm:^0.38.0": + version: 0.38.5 + resolution: "mnemonist@npm:0.38.5" + dependencies: + obliterator: ^2.0.0 + checksum: 66080afc1616866beb164e230c432964d6eed467cf37ad00e9c10161b8267928124ca8f1d0ecfea86c85568acfa62d54faaf646a86968d1135189a0fdfdd6b78 + languageName: node + linkType: hard + +"mocha@npm:^10.0.0, mocha@npm:^10.2.0": + version: 10.2.0 + resolution: "mocha@npm:10.2.0" + dependencies: + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4 + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + nanoid: 3.3.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + bin: + _mocha: bin/_mocha + mocha: bin/mocha.js + checksum: 406c45eab122ffd6ea2003c2f108b2bc35ba036225eee78e0c784b6fa2c7f34e2b13f1dbacef55a4fdf523255d76e4f22d1b5aacda2394bd11666febec17c719 + languageName: node + linkType: hard + +"module-error@npm:^1.0.1, module-error@npm:^1.0.2": + version: 1.0.2 + resolution: "module-error@npm:1.0.2" + checksum: 5d653e35bd55b3e95f8aee2cdac108082ea892e71b8f651be92cde43e4ee86abee4fa8bd7fc3fe5e68b63926d42f63c54cd17b87a560c31f18739295575a3962 + languageName: node + linkType: hard + +"mri@npm:^1.1.0": + version: 1.2.0 + resolution: "mri@npm:1.2.0" + checksum: 83f515abbcff60150873e424894a2f65d68037e5a7fcde8a9e2b285ee9c13ac581b63cfc1e6826c4732de3aeb84902f7c1e16b7aff46cd3f897a0f757a894e85 + languageName: node + linkType: hard + +"mrmime@npm:^1.0.0": + version: 1.0.1 + resolution: "mrmime@npm:1.0.1" + checksum: cc979da44bbbffebaa8eaf7a45117e851f2d4cb46a3ada6ceb78130466a04c15a0de9a9ce1c8b8ba6f6e1b8618866b1352992bf1757d241c0ddca558b9f28a77 + languageName: node + linkType: hard + +"ms@npm:2.0.0": + version: 2.0.0 + resolution: "ms@npm:2.0.0" + checksum: 0e6a22b8b746d2e0b65a430519934fefd41b6db0682e3477c10f60c76e947c4c0ad06f63ffdf1d78d335f83edee8c0aa928aa66a36c7cd95b69b26f468d527f4 + languageName: node + linkType: hard + +"ms@npm:2.1.2": + version: 2.1.2 + resolution: "ms@npm:2.1.2" + checksum: 673cdb2c3133eb050c745908d8ce632ed2c02d85640e2edb3ace856a2266a813b30c613569bf3354fdf4ea7d1a1494add3bfa95e2713baa27d0c2c71fc44f58f + languageName: node + linkType: hard + +"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1, ms@npm:^2.1.3": + version: 2.1.3 + resolution: "ms@npm:2.1.3" + checksum: aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d + languageName: node + linkType: hard + +"multicast-dns@npm:^7.2.5": + version: 7.2.5 + resolution: "multicast-dns@npm:7.2.5" + dependencies: + dns-packet: ^5.2.2 + thunky: ^1.0.2 + bin: + multicast-dns: cli.js + checksum: 00b8a57df152d4cd0297946320a94b7c3cdf75a46a2247f32f958a8927dea42958177f9b7fdae69fab2e4e033fb3416881af1f5e9055a3e1542888767139e2fb + languageName: node + linkType: hard + +"nanocolors@npm:^0.2.1": + version: 0.2.13 + resolution: "nanocolors@npm:0.2.13" + checksum: 01ac5aab77295c66cef83ea5f595e22f5f91518f19fae12f93ca2cba98703f971e32611fea2983f333eb7e60604043005690f61d9759e7c0a32314942fe6ddb8 + languageName: node + linkType: hard + +"nanoid@npm:3.3.3": + version: 3.3.3 + resolution: "nanoid@npm:3.3.3" + bin: + nanoid: bin/nanoid.cjs + checksum: ada019402a07464a694553c61d2dca8a4353645a7d92f2830f0d487fedff403678a0bee5323a46522752b2eab95a0bc3da98b6cccaa7c0c55cd9975130e6d6f0 + languageName: node + linkType: hard + +"nanoid@npm:^3.1.25, nanoid@npm:^3.3.6": + version: 3.3.6 + resolution: "nanoid@npm:3.3.6" + bin: + nanoid: bin/nanoid.cjs + checksum: 7d0eda657002738aa5206107bd0580aead6c95c460ef1bdd0b1a87a9c7ae6277ac2e9b945306aaa5b32c6dcb7feaf462d0f552e7f8b5718abfc6ead5c94a71b3 + languageName: node + linkType: hard + +"napi-macros@npm:^2.2.2": + version: 2.2.2 + resolution: "napi-macros@npm:2.2.2" + checksum: c6f9bd71cdbbc37ddc3535aa5be481238641d89585b8a3f4d301cb89abf459e2d294810432bb7d12056d1f9350b1a0899a5afcf460237a3da6c398cf0fec7629 + languageName: node + linkType: hard + +"natural-compare@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare@npm:1.4.0" + checksum: 23ad088b08f898fc9b53011d7bb78ec48e79de7627e01ab5518e806033861bef68d5b0cd0e2205c2f36690ac9571ff6bcb05eb777ced2eeda8d4ac5b44592c3d + languageName: node + linkType: hard + +"negotiator@npm:0.6.3, negotiator@npm:^0.6.3": + version: 0.6.3 + resolution: "negotiator@npm:0.6.3" + checksum: b8ffeb1e262eff7968fc90a2b6767b04cfd9842582a9d0ece0af7049537266e7b2506dfb1d107a32f06dd849ab2aea834d5830f7f4d0e5cb7d36e1ae55d021d9 + languageName: node + linkType: hard + +"neo-async@npm:^2.6.2": + version: 2.6.2 + resolution: "neo-async@npm:2.6.2" + checksum: deac9f8d00eda7b2e5cd1b2549e26e10a0faa70adaa6fdadca701cc55f49ee9018e427f424bac0c790b7c7e2d3068db97f3093f1093975f2acb8f8818b936ed9 + languageName: node + linkType: hard + +"no-case@npm:^3.0.4": + version: 3.0.4 + resolution: "no-case@npm:3.0.4" + dependencies: + lower-case: ^2.0.2 + tslib: ^2.0.3 + checksum: 0b2ebc113dfcf737d48dde49cfebf3ad2d82a8c3188e7100c6f375e30eafbef9e9124aadc3becef237b042fd5eb0aad2fd78669c20972d045bbe7fea8ba0be5c + languageName: node + linkType: hard + +"node-addon-api@npm:^2.0.0": + version: 2.0.2 + resolution: "node-addon-api@npm:2.0.2" + dependencies: + node-gyp: latest + checksum: 31fb22d674648204f8dd94167eb5aac896c841b84a9210d614bf5d97c74ef059cc6326389cf0c54d2086e35312938401d4cc82e5fcd679202503eb8ac84814f8 + languageName: node + linkType: hard + +"node-domexception@npm:^1.0.0": + version: 1.0.0 + resolution: "node-domexception@npm:1.0.0" + checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f + languageName: node + linkType: hard + +"node-emoji@npm:^1.10.0": + version: 1.11.0 + resolution: "node-emoji@npm:1.11.0" + dependencies: + lodash: ^4.17.21 + checksum: e8c856c04a1645062112a72e59a98b203505ed5111ff84a3a5f40611afa229b578c7d50f1e6a7f17aa62baeea4a640d2e2f61f63afc05423aa267af10977fb2b + languageName: node + linkType: hard + +"node-fetch@npm:2.6.7": + version: 2.6.7 + resolution: "node-fetch@npm:2.6.7" + dependencies: + whatwg-url: ^5.0.0 + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: 8d816ffd1ee22cab8301c7756ef04f3437f18dace86a1dae22cf81db8ef29c0bf6655f3215cb0cdb22b420b6fe141e64b26905e7f33f9377a7fa59135ea3e10b + languageName: node + linkType: hard + +"node-fetch@npm:3.2.10": + version: 3.2.10 + resolution: "node-fetch@npm:3.2.10" + dependencies: + data-uri-to-buffer: ^4.0.0 + fetch-blob: ^3.1.4 + formdata-polyfill: ^4.0.10 + checksum: e65322431f4897ded04197aa5923eaec63a8d53e00432de4e70a4f7006625c8dc32629c5c35f4fe8ee719a4825544d07bf53f6e146a7265914262f493e8deac1 + languageName: node + linkType: hard + +"node-fetch@npm:^2.6.12": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" + dependencies: + whatwg-url: ^5.0.0 + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: d76d2f5edb451a3f05b15115ec89fc6be39de37c6089f1b6368df03b91e1633fd379a7e01b7ab05089a25034b2023d959b47e59759cb38d88341b2459e89d6e5 + languageName: node + linkType: hard + +"node-forge@npm:^1": + version: 1.3.1 + resolution: "node-forge@npm:1.3.1" + checksum: 08fb072d3d670599c89a1704b3e9c649ff1b998256737f0e06fbd1a5bf41cae4457ccaee32d95052d80bbafd9ffe01284e078c8071f0267dc9744e51c5ed42a9 + languageName: node + linkType: hard + +"node-gyp-build@npm:^4.2.0, node-gyp-build@npm:^4.3.0": + version: 4.6.1 + resolution: "node-gyp-build@npm:4.6.1" + bin: + node-gyp-build: bin.js + node-gyp-build-optional: optional.js + node-gyp-build-test: build-test.js + checksum: c3676d337b36803bc7792e35bf7fdcda7cdcb7e289b8f9855a5535702a82498eb976842fefcf487258c58005ca32ce3d537fbed91280b04409161dcd7232a882 + languageName: node + linkType: hard + +"node-gyp@npm:latest": + version: 9.4.0 + resolution: "node-gyp@npm:9.4.0" + dependencies: + env-paths: ^2.2.0 + exponential-backoff: ^3.1.1 + glob: ^7.1.4 + graceful-fs: ^4.2.6 + make-fetch-happen: ^11.0.3 + nopt: ^6.0.0 + npmlog: ^6.0.0 + rimraf: ^3.0.2 + semver: ^7.3.5 + tar: ^6.1.2 + which: ^2.0.2 + bin: + node-gyp: bin/node-gyp.js + checksum: 78b404e2e0639d64e145845f7f5a3cb20c0520cdaf6dda2f6e025e9b644077202ea7de1232396ba5bde3fee84cdc79604feebe6ba3ec84d464c85d407bb5da99 + languageName: node + linkType: hard + +"node-releases@npm:^2.0.13": + version: 2.0.13 + resolution: "node-releases@npm:2.0.13" + checksum: 17ec8f315dba62710cae71a8dad3cd0288ba943d2ece43504b3b1aa8625bf138637798ab470b1d9035b0545996f63000a8a926e0f6d35d0996424f8b6d36dda3 + languageName: node + linkType: hard + +"nofilter@npm:^3.1.0": + version: 3.1.0 + resolution: "nofilter@npm:3.1.0" + checksum: 58aa85a5b4b35cbb6e42de8a8591c5e338061edc9f3e7286f2c335e9e9b9b8fa7c335ae45daa8a1f3433164dc0b9a3d187fa96f9516e04a17a1f9ce722becc4f + languageName: node + linkType: hard + +"nopt@npm:^6.0.0": + version: 6.0.0 + resolution: "nopt@npm:6.0.0" + dependencies: + abbrev: ^1.0.0 + bin: + nopt: bin/nopt.js + checksum: 82149371f8be0c4b9ec2f863cc6509a7fd0fa729929c009f3a58e4eb0c9e4cae9920e8f1f8eb46e7d032fec8fb01bede7f0f41a67eb3553b7b8e14fa53de1dac + languageName: node + linkType: hard + +"normalize-path@npm:^3.0.0, normalize-path@npm:~3.0.0": + version: 3.0.0 + resolution: "normalize-path@npm:3.0.0" + checksum: 88eeb4da891e10b1318c4b2476b6e2ecbeb5ff97d946815ffea7794c31a89017c70d7f34b3c2ebf23ef4e9fc9fb99f7dffe36da22011b5b5c6ffa34f4873ec20 + languageName: node + linkType: hard + +"normalize-range@npm:^0.1.2": + version: 0.1.2 + resolution: "normalize-range@npm:0.1.2" + checksum: 9b2f14f093593f367a7a0834267c24f3cb3e887a2d9809c77d8a7e5fd08738bcd15af46f0ab01cc3a3d660386f015816b5c922cea8bf2ee79777f40874063184 + languageName: node + linkType: hard + +"normalize-url@npm:^4.1.0": + version: 4.5.1 + resolution: "normalize-url@npm:4.5.1" + checksum: 9a9dee01df02ad23e171171893e56e22d752f7cff86fb96aafeae074819b572ea655b60f8302e2d85dbb834dc885c972cc1c573892fea24df46b2765065dd05a + languageName: node + linkType: hard + +"normalize-url@npm:^6.0.1": + version: 6.1.0 + resolution: "normalize-url@npm:6.1.0" + checksum: 4a4944631173e7d521d6b80e4c85ccaeceb2870f315584fa30121f505a6dfd86439c5e3fdd8cd9e0e291290c41d0c3599f0cb12ab356722ed242584c30348e50 + languageName: node + linkType: hard + +"npm-run-path@npm:^4.0.1": + version: 4.0.1 + resolution: "npm-run-path@npm:4.0.1" + dependencies: + path-key: ^3.0.0 + checksum: 5374c0cea4b0bbfdfae62da7bbdf1e1558d338335f4cacf2515c282ff358ff27b2ecb91ffa5330a8b14390ac66a1e146e10700440c1ab868208430f56b5f4d23 + languageName: node + linkType: hard + +"npm-run-path@npm:^5.1.0": + version: 5.1.0 + resolution: "npm-run-path@npm:5.1.0" + dependencies: + path-key: ^4.0.0 + checksum: dc184eb5ec239d6a2b990b43236845332ef12f4e0beaa9701de724aa797fe40b6bbd0157fb7639d24d3ab13f5d5cf22d223a19c6300846b8126f335f788bee66 + languageName: node + linkType: hard + +"npmlog@npm:^6.0.0": + version: 6.0.2 + resolution: "npmlog@npm:6.0.2" + dependencies: + are-we-there-yet: ^3.0.0 + console-control-strings: ^1.1.0 + gauge: ^4.0.3 + set-blocking: ^2.0.0 + checksum: ae238cd264a1c3f22091cdd9e2b106f684297d3c184f1146984ecbe18aaa86343953f26b9520dedd1b1372bc0316905b736c1932d778dbeb1fcf5a1001390e2a + languageName: node + linkType: hard + +"nprogress@npm:^0.2.0": + version: 0.2.0 + resolution: "nprogress@npm:0.2.0" + checksum: 66b7bec5d563ecf2d1c3d2815e6d5eb74ed815eee8563e0afa63d3f185ab1b9cf2ddd97e1ded263b9995c5019d26d600320e849e50f3747984daa033744619dc + languageName: node + linkType: hard + +"nth-check@npm:^2.0.1": + version: 2.1.1 + resolution: "nth-check@npm:2.1.1" + dependencies: + boolbase: ^1.0.0 + checksum: 5afc3dafcd1573b08877ca8e6148c52abd565f1d06b1eb08caf982e3fa289a82f2cae697ffb55b5021e146d60443f1590a5d6b944844e944714a5b549675bcd3 + languageName: node + linkType: hard + +"object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": + version: 4.1.1 + resolution: "object-assign@npm:4.1.1" + checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f + languageName: node + linkType: hard + +"object-inspect@npm:^1.9.0": + version: 1.12.3 + resolution: "object-inspect@npm:1.12.3" + checksum: dabfd824d97a5f407e6d5d24810d888859f6be394d8b733a77442b277e0808860555176719c5905e765e3743a7cada6b8b0a3b85e5331c530fd418cc8ae991db + languageName: node + linkType: hard + +"object-keys@npm:^1.1.1": + version: 1.1.1 + resolution: "object-keys@npm:1.1.1" + checksum: b363c5e7644b1e1b04aa507e88dcb8e3a2f52b6ffd0ea801e4c7a62d5aa559affe21c55a07fd4b1fd55fc03a33c610d73426664b20032405d7b92a1414c34d6a + languageName: node + linkType: hard + +"object.assign@npm:^4.1.0": + version: 4.1.4 + resolution: "object.assign@npm:4.1.4" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + has-symbols: ^1.0.3 + object-keys: ^1.1.1 + checksum: 76cab513a5999acbfe0ff355f15a6a125e71805fcf53de4e9d4e082e1989bdb81d1e329291e1e4e0ae7719f0e4ef80e88fb2d367ae60500d79d25a6224ac8864 + languageName: node + linkType: hard + +"obliterator@npm:^2.0.0": + version: 2.0.4 + resolution: "obliterator@npm:2.0.4" + checksum: f28ad35b6d812089315f375dc3e6e5f9bebf958ebe4b10ccd471c7115cbcf595e74bdac4783ae758e5b1f47e3096427fdb37cfa7bed566b132df92ff317b9a7c + languageName: node + linkType: hard + +"obuf@npm:^1.0.0, obuf@npm:^1.1.2": + version: 1.1.2 + resolution: "obuf@npm:1.1.2" + checksum: 41a2ba310e7b6f6c3b905af82c275bf8854896e2e4c5752966d64cbcd2f599cfffd5932006bcf3b8b419dfdacebb3a3912d5d94e10f1d0acab59876c8757f27f + languageName: node + linkType: hard + +"on-finished@npm:2.4.1, on-finished@npm:^2.3.0": + version: 2.4.1 + resolution: "on-finished@npm:2.4.1" + dependencies: + ee-first: 1.1.1 + checksum: d20929a25e7f0bb62f937a425b5edeb4e4cde0540d77ba146ec9357f00b0d497cdb3b9b05b9c8e46222407d1548d08166bff69cc56dfa55ba0e4469228920ff0 + languageName: node + linkType: hard + +"on-headers@npm:~1.0.2": + version: 1.0.2 + resolution: "on-headers@npm:1.0.2" + checksum: 2bf13467215d1e540a62a75021e8b318a6cfc5d4fc53af8e8f84ad98dbcea02d506c6d24180cd62e1d769c44721ba542f3154effc1f7579a8288c9f7873ed8e5 + languageName: node + linkType: hard + +"once@npm:^1.3.0, once@npm:^1.3.1, once@npm:^1.4.0": + version: 1.4.0 + resolution: "once@npm:1.4.0" + dependencies: + wrappy: 1 + checksum: cd0a88501333edd640d95f0d2700fbde6bff20b3d4d9bdc521bdd31af0656b5706570d6c6afe532045a20bb8dc0849f8332d6f2a416e0ba6d3d3b98806c7db68 + languageName: node + linkType: hard + +"onetime@npm:^5.1.0, onetime@npm:^5.1.2": + version: 5.1.2 + resolution: "onetime@npm:5.1.2" + dependencies: + mimic-fn: ^2.1.0 + checksum: 2478859ef817fc5d4e9c2f9e5728512ddd1dbc9fb7829ad263765bb6d3b91ce699d6e2332eef6b7dff183c2f490bd3349f1666427eaba4469fba0ac38dfd0d34 + languageName: node + linkType: hard + +"onetime@npm:^6.0.0": + version: 6.0.0 + resolution: "onetime@npm:6.0.0" + dependencies: + mimic-fn: ^4.0.0 + checksum: 0846ce78e440841335d4e9182ef69d5762e9f38aa7499b19f42ea1c4cd40f0b4446094c455c713f9adac3f4ae86f613bb5e30c99e52652764d06a89f709b3788 + languageName: node + linkType: hard + +"only@npm:~0.0.2": + version: 0.0.2 + resolution: "only@npm:0.0.2" + checksum: d399710db867a1ef436dd3ce74499c87ece794aa81ab0370b5d153968766ee4aed2f98d3f92fc87c963e45b7a74d400d6f463ef651a5e7cfb861b15e88e9efe6 + languageName: node + linkType: hard + +"open@npm:^8.0.2, open@npm:^8.0.9, open@npm:^8.4.0": + version: 8.4.2 + resolution: "open@npm:8.4.2" + dependencies: + define-lazy-prop: ^2.0.0 + is-docker: ^2.1.1 + is-wsl: ^2.2.0 + checksum: 6388bfff21b40cb9bd8f913f9130d107f2ed4724ea81a8fd29798ee322b361ca31fa2cdfb491a5c31e43a3996cfe9566741238c7a741ada8d7af1cb78d85cf26 + languageName: node + linkType: hard + +"open@npm:^9.1.0": + version: 9.1.0 + resolution: "open@npm:9.1.0" + dependencies: + default-browser: ^4.0.0 + define-lazy-prop: ^3.0.0 + is-inside-container: ^1.0.0 + is-wsl: ^2.2.0 + checksum: 3993c0f61d51fed8ac290e99c9c3cf45d3b6cfb3e2aa2b74cafd312c3486c22fd81df16ac8f3ab91dd8a4e3e729a16fc2480cfc406c4833416cf908acf1ae7c9 + languageName: node + linkType: hard + +"opener@npm:^1.5.2": + version: 1.5.2 + resolution: "opener@npm:1.5.2" + bin: + opener: bin/opener-bin.js + checksum: 33b620c0d53d5b883f2abc6687dd1c5fd394d270dbe33a6356f2d71e0a2ec85b100d5bac94694198ccf5c30d592da863b2292c5539009c715a9c80c697b4f6cc + languageName: node + linkType: hard + +"optionator@npm:^0.9.3": + version: 0.9.3 + resolution: "optionator@npm:0.9.3" + dependencies: + "@aashutoshrathi/word-wrap": ^1.2.3 + deep-is: ^0.1.3 + fast-levenshtein: ^2.0.6 + levn: ^0.4.1 + prelude-ls: ^1.2.1 + type-check: ^0.4.0 + checksum: 09281999441f2fe9c33a5eeab76700795365a061563d66b098923eb719251a42bdbe432790d35064d0816ead9296dbeb1ad51a733edf4167c96bd5d0882e428a + languageName: node + linkType: hard + +"ordinal@npm:^1.0.3": + version: 1.0.3 + resolution: "ordinal@npm:1.0.3" + checksum: 6761c5b7606b6c4b0c22b4097dab4fe7ffcddacc49238eedf9c0ced877f5d4e4ad3f4fd43fefa1cc3f167cc54c7149267441b2ae85b81ccf13f45cf4b7947164 + languageName: node + linkType: hard + +"os-tmpdir@npm:~1.0.2": + version: 1.0.2 + resolution: "os-tmpdir@npm:1.0.2" + checksum: 5666560f7b9f10182548bf7013883265be33620b1c1b4a4d405c25be2636f970c5488ff3e6c48de75b55d02bde037249fe5dbfbb4c0fb7714953d56aed062e6d + languageName: node + linkType: hard + +"p-all@npm:^3.0.0": + version: 3.0.0 + resolution: "p-all@npm:3.0.0" + dependencies: + p-map: ^4.0.0 + checksum: 267a620c2330b14246b92008f4be8758debe74e1454c8fb5808544f51fd038ac4597dbeeaa1542f237794e613cd42e4f1a58c01e5a0a6a6b21340fef616257df + languageName: node + linkType: hard + +"p-cancelable@npm:^1.0.0": + version: 1.1.0 + resolution: "p-cancelable@npm:1.1.0" + checksum: 2db3814fef6d9025787f30afaee4496a8857a28be3c5706432cbad76c688a6db1874308f48e364a42f5317f5e41e8e7b4f2ff5c8ff2256dbb6264bc361704ece + languageName: node + linkType: hard + +"p-defer@npm:^1.0.0": + version: 1.0.0 + resolution: "p-defer@npm:1.0.0" + checksum: 4271b935c27987e7b6f229e5de4cdd335d808465604644cb7b4c4c95bef266735859a93b16415af8a41fd663ee9e3b97a1a2023ca9def613dba1bad2a0da0c7b + languageName: node + linkType: hard + +"p-event@npm:^5.0.1": + version: 5.0.1 + resolution: "p-event@npm:5.0.1" + dependencies: + p-timeout: ^5.0.2 + checksum: 3bdd8df6092e6b149f25e9c2eb1c0843b3b4279b07be2a2c72c02b65b267a8908c2040fefd606f2497b0f2bcefcd214f8ca5a74f0c883515d400ccf1d88d5683 + languageName: node + linkType: hard + +"p-limit@npm:^1.1.0": + version: 1.3.0 + resolution: "p-limit@npm:1.3.0" + dependencies: + p-try: ^1.0.0 + checksum: 281c1c0b8c82e1ac9f81acd72a2e35d402bf572e09721ce5520164e9de07d8274451378a3470707179ad13240535558f4b277f02405ad752e08c7d5b0d54fbfd + languageName: node + linkType: hard + +"p-limit@npm:^2.0.0, p-limit@npm:^2.2.0": + version: 2.3.0 + resolution: "p-limit@npm:2.3.0" + dependencies: + p-try: ^2.0.0 + checksum: 84ff17f1a38126c3314e91ecfe56aecbf36430940e2873dadaa773ffe072dc23b7af8e46d4b6485d302a11673fe94c6b67ca2cfbb60c989848b02100d0594ac1 + languageName: node + linkType: hard + +"p-limit@npm:^3.0.2": + version: 3.1.0 + resolution: "p-limit@npm:3.1.0" + dependencies: + yocto-queue: ^0.1.0 + checksum: 7c3690c4dbf62ef625671e20b7bdf1cbc9534e83352a2780f165b0d3ceba21907e77ad63401708145ca4e25bfc51636588d89a8c0aeb715e6c37d1c066430360 + languageName: node + linkType: hard + +"p-limit@npm:^4.0.0": + version: 4.0.0 + resolution: "p-limit@npm:4.0.0" + dependencies: + yocto-queue: ^1.0.0 + checksum: 01d9d70695187788f984226e16c903475ec6a947ee7b21948d6f597bed788e3112cc7ec2e171c1d37125057a5f45f3da21d8653e04a3a793589e12e9e80e756b + languageName: node + linkType: hard + +"p-locate@npm:^2.0.0": + version: 2.0.0 + resolution: "p-locate@npm:2.0.0" + dependencies: + p-limit: ^1.1.0 + checksum: e2dceb9b49b96d5513d90f715780f6f4972f46987dc32a0e18bc6c3fc74a1a5d73ec5f81b1398af5e58b99ea1ad03fd41e9181c01fa81b4af2833958696e3081 + languageName: node + linkType: hard + +"p-locate@npm:^3.0.0": + version: 3.0.0 + resolution: "p-locate@npm:3.0.0" + dependencies: + p-limit: ^2.0.0 + checksum: 83991734a9854a05fe9dbb29f707ea8a0599391f52daac32b86f08e21415e857ffa60f0e120bfe7ce0cc4faf9274a50239c7895fc0d0579d08411e513b83a4ae + languageName: node + linkType: hard + +"p-locate@npm:^4.1.0": + version: 4.1.0 + resolution: "p-locate@npm:4.1.0" + dependencies: + p-limit: ^2.2.0 + checksum: 513bd14a455f5da4ebfcb819ef706c54adb09097703de6aeaa5d26fe5ea16df92b48d1ac45e01e3944ce1e6aa2a66f7f8894742b8c9d6e276e16cd2049a2b870 + languageName: node + linkType: hard + +"p-locate@npm:^5.0.0": + version: 5.0.0 + resolution: "p-locate@npm:5.0.0" + dependencies: + p-limit: ^3.0.2 + checksum: 1623088f36cf1cbca58e9b61c4e62bf0c60a07af5ae1ca99a720837356b5b6c5ba3eb1b2127e47a06865fee59dd0453cad7cc844cda9d5a62ac1a5a51b7c86d3 + languageName: node + linkType: hard + +"p-locate@npm:^6.0.0": + version: 6.0.0 + resolution: "p-locate@npm:6.0.0" + dependencies: + p-limit: ^4.0.0 + checksum: 2bfe5234efa5e7a4e74b30a5479a193fdd9236f8f6b4d2f3f69e3d286d9a7d7ab0c118a2a50142efcf4e41625def635bd9332d6cbf9cc65d85eb0718c579ab38 + languageName: node + linkType: hard + +"p-map@npm:^4.0.0": + version: 4.0.0 + resolution: "p-map@npm:4.0.0" + dependencies: + aggregate-error: ^3.0.0 + checksum: cb0ab21ec0f32ddffd31dfc250e3afa61e103ef43d957cc45497afe37513634589316de4eb88abdfd969fe6410c22c0b93ab24328833b8eb1ccc087fc0442a1c + languageName: node + linkType: hard + +"p-map@npm:^5.5.0": + version: 5.5.0 + resolution: "p-map@npm:5.5.0" + dependencies: + aggregate-error: ^4.0.0 + checksum: 065cb6fca6b78afbd070dd9224ff160dc23eea96e57863c09a0c8ea7ce921043f76854be7ee0abc295cff1ac9adcf700e79a1fbe3b80b625081087be58e7effb + languageName: node + linkType: hard + +"p-retry@npm:^4.5.0": + version: 4.6.2 + resolution: "p-retry@npm:4.6.2" + dependencies: + "@types/retry": 0.12.0 + retry: ^0.13.1 + checksum: 45c270bfddaffb4a895cea16cb760dcc72bdecb6cb45fef1971fa6ea2e91ddeafddefe01e444ac73e33b1b3d5d29fb0dd18a7effb294262437221ddc03ce0f2e + languageName: node + linkType: hard + +"p-timeout@npm:^5.0.2": + version: 5.1.0 + resolution: "p-timeout@npm:5.1.0" + checksum: f5cd4e17301ff1ff1d8dbf2817df0ad88c6bba99349fc24d8d181827176ad4f8aca649190b8a5b1a428dfd6ddc091af4606835d3e0cb0656e04045da5c9e270c + languageName: node + linkType: hard + +"p-try@npm:^1.0.0": + version: 1.0.0 + resolution: "p-try@npm:1.0.0" + checksum: 3b5303f77eb7722144154288bfd96f799f8ff3e2b2b39330efe38db5dd359e4fb27012464cd85cb0a76e9b7edd1b443568cb3192c22e7cffc34989df0bafd605 + languageName: node + linkType: hard + +"p-try@npm:^2.0.0": + version: 2.2.0 + resolution: "p-try@npm:2.2.0" + checksum: f8a8e9a7693659383f06aec604ad5ead237c7a261c18048a6e1b5b85a5f8a067e469aa24f5bc009b991ea3b058a87f5065ef4176793a200d4917349881216cae + languageName: node + linkType: hard + +"package-json@npm:^6.3.0": + version: 6.5.0 + resolution: "package-json@npm:6.5.0" + dependencies: + got: ^9.6.0 + registry-auth-token: ^4.0.0 + registry-url: ^5.0.0 + semver: ^6.2.0 + checksum: cc9f890d3667d7610e6184decf543278b87f657d1ace0deb4a9c9155feca738ef88f660c82200763d3348010f4e42e9c7adc91e96ab0f86a770955995b5351e2 + languageName: node + linkType: hard + +"param-case@npm:^3.0.4": + version: 3.0.4 + resolution: "param-case@npm:3.0.4" + dependencies: + dot-case: ^3.0.4 + tslib: ^2.0.3 + checksum: b34227fd0f794e078776eb3aa6247442056cb47761e9cd2c4c881c86d84c64205f6a56ef0d70b41ee7d77da02c3f4ed2f88e3896a8fefe08bdfb4deca037c687 + languageName: node + linkType: hard + +"parent-module@npm:^1.0.0": + version: 1.0.1 + resolution: "parent-module@npm:1.0.1" + dependencies: + callsites: ^3.0.0 + checksum: 6ba8b255145cae9470cf5551eb74be2d22281587af787a2626683a6c20fbb464978784661478dd2a3f1dad74d1e802d403e1b03c1a31fab310259eec8ac560ff + languageName: node + linkType: hard + +"parse-entities@npm:^2.0.0": + version: 2.0.0 + resolution: "parse-entities@npm:2.0.0" + dependencies: + character-entities: ^1.0.0 + character-entities-legacy: ^1.0.0 + character-reference-invalid: ^1.0.0 + is-alphanumerical: ^1.0.0 + is-decimal: ^1.0.0 + is-hexadecimal: ^1.0.0 + checksum: 7addfd3e7d747521afac33c8121a5f23043c6973809756920d37e806639b4898385d386fcf4b3c8e2ecf1bc28aac5ae97df0b112d5042034efbe80f44081ebce + languageName: node + linkType: hard + +"parse-json@npm:^5.0.0, parse-json@npm:^5.2.0": + version: 5.2.0 + resolution: "parse-json@npm:5.2.0" + dependencies: + "@babel/code-frame": ^7.0.0 + error-ex: ^1.3.1 + json-parse-even-better-errors: ^2.3.0 + lines-and-columns: ^1.1.6 + checksum: 62085b17d64da57f40f6afc2ac1f4d95def18c4323577e1eced571db75d9ab59b297d1d10582920f84b15985cbfc6b6d450ccbf317644cfa176f3ed982ad87e2 + languageName: node + linkType: hard + +"parse-ms@npm:^3.0.0": + version: 3.0.0 + resolution: "parse-ms@npm:3.0.0" + checksum: fc602bba093835562321a67a9d6c8c9687ca4f26a09459a77e07ebd7efddd1a5766725ec60eb0c83a2abe67f7a23808f7deb1c1226727776eaf7f9607ae09db2 + languageName: node + linkType: hard + +"parse-numeric-range@npm:^1.3.0": + version: 1.3.0 + resolution: "parse-numeric-range@npm:1.3.0" + checksum: 289ca126d5b8ace7325b199218de198014f58ea6895ccc88a5247491d07f0143bf047f80b4a31784f1ca8911762278d7d6ecb90a31dfae31da91cc1a2524c8ce + languageName: node + linkType: hard + +"parse5-htmlparser2-tree-adapter@npm:^7.0.0": + version: 7.0.0 + resolution: "parse5-htmlparser2-tree-adapter@npm:7.0.0" + dependencies: + domhandler: ^5.0.2 + parse5: ^7.0.0 + checksum: fc5d01e07733142a1baf81de5c2a9c41426c04b7ab29dd218acb80cd34a63177c90aff4a4aee66cf9f1d0aeecff1389adb7452ad6f8af0a5888e3e9ad6ef733d + languageName: node + linkType: hard + +"parse5@npm:^6.0.0, parse5@npm:^6.0.1": + version: 6.0.1 + resolution: "parse5@npm:6.0.1" + checksum: 7d569a176c5460897f7c8f3377eff640d54132b9be51ae8a8fa4979af940830b2b0c296ce75e5bd8f4041520aadde13170dbdec44889975f906098ea0002f4bd + languageName: node + linkType: hard + +"parse5@npm:^7.0.0": + version: 7.1.2 + resolution: "parse5@npm:7.1.2" + dependencies: + entities: ^4.4.0 + checksum: 59465dd05eb4c5ec87b76173d1c596e152a10e290b7abcda1aecf0f33be49646ea74840c69af975d7887543ea45564801736356c568d6b5e71792fd0f4055713 + languageName: node + linkType: hard + +"parseurl@npm:^1.3.2, parseurl@npm:~1.3.2, parseurl@npm:~1.3.3": + version: 1.3.3 + resolution: "parseurl@npm:1.3.3" + checksum: 407cee8e0a3a4c5cd472559bca8b6a45b82c124e9a4703302326e9ab60fc1081442ada4e02628efef1eb16197ddc7f8822f5a91fd7d7c86b51f530aedb17dfa2 + languageName: node + linkType: hard + +"pascal-case@npm:^3.1.2": + version: 3.1.2 + resolution: "pascal-case@npm:3.1.2" + dependencies: + no-case: ^3.0.4 + tslib: ^2.0.3 + checksum: ba98bfd595fc91ef3d30f4243b1aee2f6ec41c53b4546bfa3039487c367abaa182471dcfc830a1f9e1a0df00c14a370514fa2b3a1aacc68b15a460c31116873e + languageName: node + linkType: hard + +"path-exists@npm:^3.0.0": + version: 3.0.0 + resolution: "path-exists@npm:3.0.0" + checksum: 96e92643aa34b4b28d0de1cd2eba52a1c5313a90c6542d03f62750d82480e20bfa62bc865d5cfc6165f5fcd5aeb0851043c40a39be5989646f223300021bae0a + languageName: node + linkType: hard + +"path-exists@npm:^4.0.0": + version: 4.0.0 + resolution: "path-exists@npm:4.0.0" + checksum: 505807199dfb7c50737b057dd8d351b82c033029ab94cb10a657609e00c1bc53b951cfdbccab8de04c5584d5eff31128ce6afd3db79281874a5ef2adbba55ed1 + languageName: node + linkType: hard + +"path-exists@npm:^5.0.0": + version: 5.0.0 + resolution: "path-exists@npm:5.0.0" + checksum: 8ca842868cab09423994596eb2c5ec2a971c17d1a3cb36dbf060592c730c725cd524b9067d7d2a1e031fef9ba7bd2ac6dc5ec9fb92aa693265f7be3987045254 + languageName: node + linkType: hard + +"path-is-absolute@npm:1.0.1, path-is-absolute@npm:^1.0.0": + version: 1.0.1 + resolution: "path-is-absolute@npm:1.0.1" + checksum: 060840f92cf8effa293bcc1bea81281bd7d363731d214cbe5c227df207c34cd727430f70c6037b5159c8a870b9157cba65e775446b0ab06fd5ecc7e54615a3b8 + languageName: node + linkType: hard + +"path-is-inside@npm:1.0.2": + version: 1.0.2 + resolution: "path-is-inside@npm:1.0.2" + checksum: 0b5b6c92d3018b82afb1f74fe6de6338c4c654de4a96123cb343f2b747d5606590ac0c890f956ed38220a4ab59baddfd7b713d78a62d240b20b14ab801fa02cb + languageName: node + linkType: hard + +"path-key@npm:^3.0.0, path-key@npm:^3.1.0": + version: 3.1.1 + resolution: "path-key@npm:3.1.1" + checksum: 55cd7a9dd4b343412a8386a743f9c746ef196e57c823d90ca3ab917f90ab9f13dd0ded27252ba49dbdfcab2b091d998bc446f6220cd3cea65db407502a740020 + languageName: node + linkType: hard + +"path-key@npm:^4.0.0": + version: 4.0.0 + resolution: "path-key@npm:4.0.0" + checksum: 8e6c314ae6d16b83e93032c61020129f6f4484590a777eed709c4a01b50e498822b00f76ceaf94bc64dbd90b327df56ceadce27da3d83393790f1219e07721d7 + languageName: node + linkType: hard + +"path-parse@npm:^1.0.6, path-parse@npm:^1.0.7": + version: 1.0.7 + resolution: "path-parse@npm:1.0.7" + checksum: 49abf3d81115642938a8700ec580da6e830dde670be21893c62f4e10bd7dd4c3742ddc603fe24f898cba7eb0c6bc1777f8d9ac14185d34540c6d4d80cd9cae8a + languageName: node + linkType: hard + +"path-scurry@npm:^1.10.1": + version: 1.10.1 + resolution: "path-scurry@npm:1.10.1" + dependencies: + lru-cache: ^9.1.1 || ^10.0.0 + minipass: ^5.0.0 || ^6.0.2 || ^7.0.0 + checksum: e2557cff3a8fb8bc07afdd6ab163a92587884f9969b05bbbaf6fe7379348bfb09af9ed292af12ed32398b15fb443e81692047b786d1eeb6d898a51eb17ed7d90 + languageName: node + linkType: hard + +"path-to-regexp@npm:0.1.7": + version: 0.1.7 + resolution: "path-to-regexp@npm:0.1.7" + checksum: 69a14ea24db543e8b0f4353305c5eac6907917031340e5a8b37df688e52accd09e3cebfe1660b70d76b6bd89152f52183f28c74813dbf454ba1a01c82a38abce + languageName: node + linkType: hard + +"path-to-regexp@npm:2.2.1": + version: 2.2.1 + resolution: "path-to-regexp@npm:2.2.1" + checksum: b921a74e7576e25b06ad1635abf7e8125a29220d2efc2b71d74b9591f24a27e6f09078fa9a1b27516a097ea0637b7cab79d19b83d7f36a8ef3ef5422770e89d9 + languageName: node + linkType: hard + +"path-to-regexp@npm:^1.7.0": + version: 1.8.0 + resolution: "path-to-regexp@npm:1.8.0" + dependencies: + isarray: 0.0.1 + checksum: 709f6f083c0552514ef4780cb2e7e4cf49b0cc89a97439f2b7cc69a608982b7690fb5d1720a7473a59806508fc2dae0be751ba49f495ecf89fd8fbc62abccbcd + languageName: node + linkType: hard + +"path-type@npm:^4.0.0": + version: 4.0.0 + resolution: "path-type@npm:4.0.0" + checksum: 5b1e2daa247062061325b8fdbfd1fb56dde0a448fb1455453276ea18c60685bdad23a445dc148cf87bc216be1573357509b7d4060494a6fd768c7efad833ee45 + languageName: node + linkType: hard + +"pathval@npm:^1.1.1": + version: 1.1.1 + resolution: "pathval@npm:1.1.1" + checksum: 090e3147716647fb7fb5b4b8c8e5b55e5d0a6086d085b6cd23f3d3c01fcf0ff56fd3cc22f2f4a033bd2e46ed55d61ed8379e123b42afe7d531a2a5fc8bb556d6 + languageName: node + linkType: hard + +"pause-stream@npm:0.0.11": + version: 0.0.11 + resolution: "pause-stream@npm:0.0.11" + dependencies: + through: ~2.3 + checksum: 3c4a14052a638b92e0c96eb00c0d7977df7f79ea28395250c525d197f1fc02d34ce1165d5362e2e6ebbb251524b94a76f3f0d4abc39ab8b016d97449fe15583c + languageName: node + linkType: hard + +"pbkdf2@npm:^3.0.17": + version: 3.1.2 + resolution: "pbkdf2@npm:3.1.2" + dependencies: + create-hash: ^1.1.2 + create-hmac: ^1.1.4 + ripemd160: ^2.0.1 + safe-buffer: ^5.0.1 + sha.js: ^2.4.8 + checksum: 2c950a100b1da72123449208e231afc188d980177d021d7121e96a2de7f2abbc96ead2b87d03d8fe5c318face097f203270d7e27908af9f471c165a4e8e69c92 + languageName: node + linkType: hard + +"pend@npm:~1.2.0": + version: 1.2.0 + resolution: "pend@npm:1.2.0" + checksum: 6c72f5243303d9c60bd98e6446ba7d30ae29e3d56fdb6fae8767e8ba6386f33ee284c97efe3230a0d0217e2b1723b8ab490b1bbf34fcbb2180dbc8a9de47850d + languageName: node + linkType: hard + +"picocolors@npm:^1.0.0": + version: 1.0.0 + resolution: "picocolors@npm:1.0.0" + checksum: a2e8092dd86c8396bdba9f2b5481032848525b3dc295ce9b57896f931e63fc16f79805144321f72976383fc249584672a75cc18d6777c6b757603f372f745981 + languageName: node + linkType: hard + +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.2, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": + version: 2.3.1 + resolution: "picomatch@npm:2.3.1" + checksum: 050c865ce81119c4822c45d3c84f1ced46f93a0126febae20737bd05ca20589c564d6e9226977df859ed5e03dc73f02584a2b0faad36e896936238238b0446cf + languageName: node + linkType: hard + +"pkg-conf@npm:^4.0.0": + version: 4.0.0 + resolution: "pkg-conf@npm:4.0.0" + dependencies: + find-up: ^6.0.0 + load-json-file: ^7.0.0 + checksum: 6da0c064a74f6c7ae80d7d68c5853e14f7e762a2a80c6ca9e0aa827002b90b69c86fefe3bac830b10a6f1739e7f96a1f728637f2a141e50b0fdafe92a2c3eab6 + languageName: node + linkType: hard + +"pkg-dir@npm:^4.1.0": + version: 4.2.0 + resolution: "pkg-dir@npm:4.2.0" + dependencies: + find-up: ^4.0.0 + checksum: 9863e3f35132bf99ae1636d31ff1e1e3501251d480336edb1c211133c8d58906bed80f154a1d723652df1fda91e01c7442c2eeaf9dc83157c7ae89087e43c8d6 + languageName: node + linkType: hard + +"pkg-up@npm:^3.1.0": + version: 3.1.0 + resolution: "pkg-up@npm:3.1.0" + dependencies: + find-up: ^3.0.0 + checksum: 5bac346b7c7c903613c057ae3ab722f320716199d753f4a7d053d38f2b5955460f3e6ab73b4762c62fd3e947f58e04f1343e92089e7bb6091c90877406fcd8c8 + languageName: node + linkType: hard + +"playwright-core@npm:1.38.0": + version: 1.38.0 + resolution: "playwright-core@npm:1.38.0" + bin: + playwright-core: cli.js + checksum: 9eb43fc6c3cb392d5f35b0fd0b7291b38a8cbdc3cbb944a8261f744f30d09196dfa3b5d84aa02ffc09af87d08d31b385b007b6af20d0b6cd50a29344f3b0db8d + languageName: node + linkType: hard + +"playwright@npm:^1.22.2": + version: 1.38.0 + resolution: "playwright@npm:1.38.0" + dependencies: + fsevents: 2.3.2 + playwright-core: 1.38.0 + dependenciesMeta: + fsevents: + optional: true + bin: + playwright: cli.js + checksum: c5356690a391d5dd41f814d4e2694b93ba9e79381ce63de752da1c6c59b1f9c69bc6be853d973d0542d73a44a6b15f7c0081a164a64cd27b6b31207710c0ab34 + languageName: node + linkType: hard + +"plur@npm:^5.1.0": + version: 5.1.0 + resolution: "plur@npm:5.1.0" + dependencies: + irregular-plurals: ^3.3.0 + checksum: 57e400dc4b926768fb0abab7f8688fe17e85673712134546e7beaaee188bae7e0504976e847d7e41d0d6103ff2fd61204095f03c2a45de19a8bad15aecb45cc1 + languageName: node + linkType: hard + +"portfinder@npm:^1.0.32": + version: 1.0.32 + resolution: "portfinder@npm:1.0.32" + dependencies: + async: ^2.6.4 + debug: ^3.2.7 + mkdirp: ^0.5.6 + checksum: 116b4aed1b9e16f6d5503823d966d9ffd41b1c2339e27f54c06cd2f3015a9d8ef53e2a53b57bc0a25af0885977b692007353aa28f9a0a98a44335cb50487240d + languageName: node + linkType: hard + +"postcss-calc@npm:^8.2.3": + version: 8.2.4 + resolution: "postcss-calc@npm:8.2.4" + dependencies: + postcss-selector-parser: ^6.0.9 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.2 + checksum: 314b4cebb0c4ed0cf8356b4bce71eca78f5a7842e6a3942a3bba49db168d5296b2bd93c3f735ae1c616f2651d94719ade33becc03c73d2d79c7394fb7f73eabb + languageName: node + linkType: hard + +"postcss-colormin@npm:^5.3.1": + version: 5.3.1 + resolution: "postcss-colormin@npm:5.3.1" + dependencies: + browserslist: ^4.21.4 + caniuse-api: ^3.0.0 + colord: ^2.9.1 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: e5778baab30877cd1f51e7dc9d2242a162aeca6360a52956acd7f668c5bc235c2ccb7e4df0370a804d65ebe00c5642366f061db53aa823f9ed99972cebd16024 + languageName: node + linkType: hard + +"postcss-convert-values@npm:^5.1.3": + version: 5.1.3 + resolution: "postcss-convert-values@npm:5.1.3" + dependencies: + browserslist: ^4.21.4 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: df48cdaffabf9737f9cfdc58a3dc2841cf282506a7a944f6c70236cff295d3a69f63de6e0935eeb8a9d3f504324e5b4e240abc29e21df9e35a02585d3060aeb5 + languageName: node + linkType: hard + +"postcss-discard-comments@npm:^5.1.2": + version: 5.1.2 + resolution: "postcss-discard-comments@npm:5.1.2" + peerDependencies: + postcss: ^8.2.15 + checksum: abfd064ebc27aeaf5037643dd51ffaff74d1fa4db56b0523d073ace4248cbb64ffd9787bd6924b0983a9d0bd0e9bf9f10d73b120e50391dc236e0d26c812fa2a + languageName: node + linkType: hard + +"postcss-discard-duplicates@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-discard-duplicates@npm:5.1.0" + peerDependencies: + postcss: ^8.2.15 + checksum: 88d6964201b1f4ed6bf7a32cefe68e86258bb6e42316ca01d9b32bdb18e7887d02594f89f4a2711d01b51ea6e3fcca8c54be18a59770fe5f4521c61d3eb6ca35 + languageName: node + linkType: hard + +"postcss-discard-empty@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-discard-empty@npm:5.1.1" + peerDependencies: + postcss: ^8.2.15 + checksum: 970adb12fae5c214c0768236ad9a821552626e77dedbf24a8213d19cc2c4a531a757cd3b8cdd3fc22fb1742471b8692a1db5efe436a71236dec12b1318ee8ff4 + languageName: node + linkType: hard + +"postcss-discard-overridden@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-discard-overridden@npm:5.1.0" + peerDependencies: + postcss: ^8.2.15 + checksum: d64d4a545aa2c81b22542895cfcddc787d24119f294d35d29b0599a1c818b3cc51f4ee80b80f5a0a09db282453dd5ac49f104c2117cc09112d0ac9b40b499a41 + languageName: node + linkType: hard + +"postcss-discard-unused@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-discard-unused@npm:5.1.0" + dependencies: + postcss-selector-parser: ^6.0.5 + peerDependencies: + postcss: ^8.2.15 + checksum: 5c09403a342a065033f5f22cefe6b402c76c2dc0aac31a736a2062d82c2a09f0ff2525b3df3a0c6f4e0ffc7a0392efd44bfe7f9d018e4cae30d15b818b216622 + languageName: node + linkType: hard + +"postcss-loader@npm:^7.0.0": + version: 7.3.3 + resolution: "postcss-loader@npm:7.3.3" + dependencies: + cosmiconfig: ^8.2.0 + jiti: ^1.18.2 + semver: ^7.3.8 + peerDependencies: + postcss: ^7.0.0 || ^8.0.1 + webpack: ^5.0.0 + checksum: c724044d6ae56334535c26bb4efc9c151431d44d60bc8300157c760747281a242757d8dab32db72738434531175b38a408cb0b270bb96207c07584dcfcd899ff + languageName: node + linkType: hard + +"postcss-merge-idents@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-merge-idents@npm:5.1.1" + dependencies: + cssnano-utils: ^3.1.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: ed8a673617ea6ae3e15d69558063cb1a5eeee01732f78cdc0196ab910324abc30828724ab8dfc4cda27e8c0077542e25688470f829819a2604625a673387ec72 + languageName: node + linkType: hard + +"postcss-merge-longhand@npm:^5.1.7": + version: 5.1.7 + resolution: "postcss-merge-longhand@npm:5.1.7" + dependencies: + postcss-value-parser: ^4.2.0 + stylehacks: ^5.1.1 + peerDependencies: + postcss: ^8.2.15 + checksum: 81c3fc809f001b9b71a940148e242bdd6e2d77713d1bfffa15eb25c1f06f6648d5e57cb21645746d020a2a55ff31e1740d2b27900442913a9d53d8a01fb37e1b + languageName: node + linkType: hard + +"postcss-merge-rules@npm:^5.1.4": + version: 5.1.4 + resolution: "postcss-merge-rules@npm:5.1.4" + dependencies: + browserslist: ^4.21.4 + caniuse-api: ^3.0.0 + cssnano-utils: ^3.1.0 + postcss-selector-parser: ^6.0.5 + peerDependencies: + postcss: ^8.2.15 + checksum: 8ab6a569babe6cb412d6612adee74f053cea7edb91fa013398515ab36754b1fec830d68782ed8cdfb44cffdc6b78c79eab157bff650f428aa4460d3f3857447e + languageName: node + linkType: hard + +"postcss-minify-font-values@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-minify-font-values@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 35e858fa41efa05acdeb28f1c76579c409fdc7eabb1744c3bd76e895bb9fea341a016746362a67609688ab2471f587202b9a3e14ea28ad677754d663a2777ece + languageName: node + linkType: hard + +"postcss-minify-gradients@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-minify-gradients@npm:5.1.1" + dependencies: + colord: ^2.9.1 + cssnano-utils: ^3.1.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 27354072a07c5e6dab36731103b94ca2354d4ed3c5bc6aacfdf2ede5a55fa324679d8fee5450800bc50888dbb5e9ed67569c0012040c2be128143d0cebb36d67 + languageName: node + linkType: hard + +"postcss-minify-params@npm:^5.1.4": + version: 5.1.4 + resolution: "postcss-minify-params@npm:5.1.4" + dependencies: + browserslist: ^4.21.4 + cssnano-utils: ^3.1.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: bd63e2cc89edcf357bb5c2a16035f6d02ef676b8cede4213b2bddd42626b3d428403849188f95576fc9f03e43ebd73a29bf61d33a581be9a510b13b7f7f100d5 + languageName: node + linkType: hard + +"postcss-minify-selectors@npm:^5.2.1": + version: 5.2.1 + resolution: "postcss-minify-selectors@npm:5.2.1" + dependencies: + postcss-selector-parser: ^6.0.5 + peerDependencies: + postcss: ^8.2.15 + checksum: 6fdbc84f99a60d56b43df8930707da397775e4c36062a106aea2fd2ac81b5e24e584a1892f4baa4469fa495cb87d1422560eaa8f6c9d500f9f0b691a5f95bab5 + languageName: node + linkType: hard + +"postcss-modules-extract-imports@npm:^3.0.0": + version: 3.0.0 + resolution: "postcss-modules-extract-imports@npm:3.0.0" + peerDependencies: + postcss: ^8.1.0 + checksum: 4b65f2f1382d89c4bc3c0a1bdc5942f52f3cb19c110c57bd591ffab3a5fee03fcf831604168205b0c1b631a3dce2255c70b61aaae3ef39d69cd7eb450c2552d2 + languageName: node + linkType: hard + +"postcss-modules-local-by-default@npm:^4.0.3": + version: 4.0.3 + resolution: "postcss-modules-local-by-default@npm:4.0.3" + dependencies: + icss-utils: ^5.0.0 + postcss-selector-parser: ^6.0.2 + postcss-value-parser: ^4.1.0 + peerDependencies: + postcss: ^8.1.0 + checksum: 2f8083687f3d6067885f8863dd32dbbb4f779cfcc7e52c17abede9311d84faf6d3ed8760e7c54c6380281732ae1f78e5e56a28baf3c271b33f450a11c9e30485 + languageName: node + linkType: hard + +"postcss-modules-scope@npm:^3.0.0": + version: 3.0.0 + resolution: "postcss-modules-scope@npm:3.0.0" + dependencies: + postcss-selector-parser: ^6.0.4 + peerDependencies: + postcss: ^8.1.0 + checksum: 330b9398dbd44c992c92b0dc612c0626135e2cc840fee41841eb61247a6cfed95af2bd6f67ead9dd9d0bb41f5b0367129d93c6e434fa3e9c58ade391d9a5a138 + languageName: node + linkType: hard + +"postcss-modules-values@npm:^4.0.0": + version: 4.0.0 + resolution: "postcss-modules-values@npm:4.0.0" + dependencies: + icss-utils: ^5.0.0 + peerDependencies: + postcss: ^8.1.0 + checksum: f7f2cdf14a575b60e919ad5ea52fed48da46fe80db2733318d71d523fc87db66c835814940d7d05b5746b0426e44661c707f09bdb83592c16aea06e859409db6 + languageName: node + linkType: hard + +"postcss-normalize-charset@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-normalize-charset@npm:5.1.0" + peerDependencies: + postcss: ^8.2.15 + checksum: e79d92971fc05b8b3c9b72f3535a574e077d13c69bef68156a0965f397fdf157de670da72b797f57b0e3bac8f38155b5dd1735ecab143b9cc4032d72138193b4 + languageName: node + linkType: hard + +"postcss-normalize-display-values@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-normalize-display-values@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: b6eb7b9b02c3bdd62bbc54e01e2b59733d73a1c156905d238e178762962efe0c6f5104544da39f32cade8a4fb40f10ff54b63a8ebfbdff51e8780afb9fbdcf86 + languageName: node + linkType: hard + +"postcss-normalize-positions@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-normalize-positions@npm:5.1.1" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: d9afc233729c496463c7b1cdd06732469f401deb387484c3a2422125b46ec10b4af794c101f8c023af56f01970b72b535e88373b9058ecccbbf88db81662b3c4 + languageName: node + linkType: hard + +"postcss-normalize-repeat-style@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-normalize-repeat-style@npm:5.1.1" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 2c6ad2b0ae10a1fda156b948c34f78c8f1e185513593de4d7e2480973586675520edfec427645fa168c337b0a6b3ceca26f92b96149741ca98a9806dad30d534 + languageName: node + linkType: hard + +"postcss-normalize-string@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-normalize-string@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 6e549c6e5b2831e34c7bdd46d8419e2278f6af1d5eef6d26884a37c162844e60339340c57e5e06058cdbe32f27fc6258eef233e811ed2f71168ef2229c236ada + languageName: node + linkType: hard + +"postcss-normalize-timing-functions@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-normalize-timing-functions@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: da550f50e90b0b23e17b67449a7d1efd1aa68288e66d4aa7614ca6f5cc012896be1972b7168eee673d27da36504faccf7b9f835c0f7e81243f966a42c8c030aa + languageName: node + linkType: hard + +"postcss-normalize-unicode@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-normalize-unicode@npm:5.1.1" + dependencies: + browserslist: ^4.21.4 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 4c24d26cc9f4b19a9397db4e71dd600dab690f1de8e14a3809e2aa1452dbc3791c208c38a6316bbc142f29e934fdf02858e68c94038c06174d78a4937e0f273c + languageName: node + linkType: hard + +"postcss-normalize-url@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-normalize-url@npm:5.1.0" + dependencies: + normalize-url: ^6.0.1 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 3bd4b3246d6600230bc827d1760b24cb3101827ec97570e3016cbe04dc0dd28f4dbe763245d1b9d476e182c843008fbea80823061f1d2219b96f0d5c724a24c0 + languageName: node + linkType: hard + +"postcss-normalize-whitespace@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-normalize-whitespace@npm:5.1.1" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 12d8fb6d1c1cba208cc08c1830959b7d7ad447c3f5581873f7e185f99a9a4230c43d3af21ca12c818e4690a5085a95b01635b762ad4a7bef69d642609b4c0e19 + languageName: node + linkType: hard + +"postcss-ordered-values@npm:^5.1.3": + version: 5.1.3 + resolution: "postcss-ordered-values@npm:5.1.3" + dependencies: + cssnano-utils: ^3.1.0 + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 6f3ca85b6ceffc68aadaf319d9ee4c5ac16d93195bf8cba2d1559b631555ad61941461cda6d3909faab86e52389846b2b36345cff8f0c3f4eb345b1b8efadcf9 + languageName: node + linkType: hard + +"postcss-reduce-idents@npm:^5.2.0": + version: 5.2.0 + resolution: "postcss-reduce-idents@npm:5.2.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: f0d644c86e160dd36ee4dd924ab7d6feacac867c87702e2f98f96b409430a62de4fec2dfc3c8731bda4e14196e29a752b4558942f0af2a3e6cd7f1f4b173db8e + languageName: node + linkType: hard + +"postcss-reduce-initial@npm:^5.1.2": + version: 5.1.2 + resolution: "postcss-reduce-initial@npm:5.1.2" + dependencies: + browserslist: ^4.21.4 + caniuse-api: ^3.0.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 55db697f85231a81f1969d54c894e4773912d9ddb914f9b03d2e73abc4030f2e3bef4d7465756d0c1acfcc2c2d69974bfb50a972ab27546a7d68b5a4fc90282b + languageName: node + linkType: hard + +"postcss-reduce-transforms@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-reduce-transforms@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + peerDependencies: + postcss: ^8.2.15 + checksum: 0c6af2cba20e3ff63eb9ad045e634ddfb9c3e5c0e614c020db2a02f3aa20632318c4ede9e0c995f9225d9a101e673de91c0a6e10bb2fa5da6d6c75d15a55882f + languageName: node + linkType: hard + +"postcss-selector-parser@npm:^6.0.2, postcss-selector-parser@npm:^6.0.4, postcss-selector-parser@npm:^6.0.5, postcss-selector-parser@npm:^6.0.9": + version: 6.0.13 + resolution: "postcss-selector-parser@npm:6.0.13" + dependencies: + cssesc: ^3.0.0 + util-deprecate: ^1.0.2 + checksum: f89163338a1ce3b8ece8e9055cd5a3165e79a15e1c408e18de5ad8f87796b61ec2d48a2902d179ae0c4b5de10fccd3a325a4e660596549b040bc5ad1b465f096 + languageName: node + linkType: hard + +"postcss-sort-media-queries@npm:^4.2.1": + version: 4.4.1 + resolution: "postcss-sort-media-queries@npm:4.4.1" + dependencies: + sort-css-media-queries: 2.1.0 + peerDependencies: + postcss: ^8.4.16 + checksum: 70b42e479bb1d15d8628678eefefd547d309e33e64262fe437630fe62d8e4b3adcae7f2b48ef8da9d3173576d4af109a9ffa9514573db1281deef324f5ea166f + languageName: node + linkType: hard + +"postcss-svgo@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-svgo@npm:5.1.0" + dependencies: + postcss-value-parser: ^4.2.0 + svgo: ^2.7.0 + peerDependencies: + postcss: ^8.2.15 + checksum: d86eb5213d9f700cf5efe3073799b485fb7cacae0c731db3d7749c9c2b1c9bc85e95e0baeca439d699ff32ea24815fc916c4071b08f67ed8219df229ce1129bd + languageName: node + linkType: hard + +"postcss-unique-selectors@npm:^5.1.1": + version: 5.1.1 + resolution: "postcss-unique-selectors@npm:5.1.1" + dependencies: + postcss-selector-parser: ^6.0.5 + peerDependencies: + postcss: ^8.2.15 + checksum: 637e7b786e8558265775c30400c54b6b3b24d4748923f4a39f16a65fd0e394f564ccc9f0a1d3c0e770618a7637a7502ea1d0d79f731d429cb202255253c23278 + languageName: node + linkType: hard + +"postcss-value-parser@npm:^4.1.0, postcss-value-parser@npm:^4.2.0": + version: 4.2.0 + resolution: "postcss-value-parser@npm:4.2.0" + checksum: 819ffab0c9d51cf0acbabf8996dffbfafbafa57afc0e4c98db88b67f2094cb44488758f06e5da95d7036f19556a4a732525e84289a425f4f6fd8e412a9d7442f + languageName: node + linkType: hard + +"postcss-zindex@npm:^5.1.0": + version: 5.1.0 + resolution: "postcss-zindex@npm:5.1.0" + peerDependencies: + postcss: ^8.2.15 + checksum: 8581e0ee552622489dcb9fb9609a3ccc261a67a229ba91a70bd138fe102a2d04cedb14642b82b673d4cac7b559ef32574f2dafde2ff7816eecac024d231c5ead + languageName: node + linkType: hard + +"postcss@npm:^8.3.11, postcss@npm:^8.4.14, postcss@npm:^8.4.17, postcss@npm:^8.4.21": + version: 8.4.31 + resolution: "postcss@npm:8.4.31" + dependencies: + nanoid: ^3.3.6 + picocolors: ^1.0.0 + source-map-js: ^1.0.2 + checksum: 1d8611341b073143ad90486fcdfeab49edd243377b1f51834dc4f6d028e82ce5190e4f11bb2633276864503654fb7cab28e67abdc0fbf9d1f88cad4a0ff0beea + languageName: node + linkType: hard + +"prelude-ls@npm:^1.2.1": + version: 1.2.1 + resolution: "prelude-ls@npm:1.2.1" + checksum: cd192ec0d0a8e4c6da3bb80e4f62afe336df3f76271ac6deb0e6a36187133b6073a19e9727a1ff108cd8b9982e4768850d413baa71214dd80c7979617dca827a + languageName: node + linkType: hard + +"prepend-http@npm:^2.0.0": + version: 2.0.0 + resolution: "prepend-http@npm:2.0.0" + checksum: 7694a9525405447662c1ffd352fcb41b6410c705b739b6f4e3a3e21cf5fdede8377890088e8934436b8b17ba55365a615f153960f30877bf0d0392f9e93503ea + languageName: node + linkType: hard + +"prettier-linter-helpers@npm:^1.0.0": + version: 1.0.0 + resolution: "prettier-linter-helpers@npm:1.0.0" + dependencies: + fast-diff: ^1.1.2 + checksum: 00ce8011cf6430158d27f9c92cfea0a7699405633f7f1d4a45f07e21bf78e99895911cbcdc3853db3a824201a7c745bd49bfea8abd5fb9883e765a90f74f8392 + languageName: node + linkType: hard + +"prettier@npm:*, prettier@npm:3.0.3": + version: 3.0.3 + resolution: "prettier@npm:3.0.3" + bin: + prettier: bin/prettier.cjs + checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0 + languageName: node + linkType: hard + +"pretty-error@npm:^4.0.0": + version: 4.0.0 + resolution: "pretty-error@npm:4.0.0" + dependencies: + lodash: ^4.17.20 + renderkid: ^3.0.0 + checksum: a5b9137365690104ded6947dca2e33360bf55e62a4acd91b1b0d7baa3970e43754c628cc9e16eafbdd4e8f8bcb260a5865475d4fc17c3106ff2d61db4e72cdf3 + languageName: node + linkType: hard + +"pretty-ms@npm:^8.0.0": + version: 8.0.0 + resolution: "pretty-ms@npm:8.0.0" + dependencies: + parse-ms: ^3.0.0 + checksum: b7d2a8182887af0e5ab93f9df331f10db9b8eda86855e2de115eb01a6c501bde5631a8813b1b0abdd7d045e79b08ae875369a8fd279a3dacd6d9e572bdd3bfa6 + languageName: node + linkType: hard + +"pretty-time@npm:^1.1.0": + version: 1.1.0 + resolution: "pretty-time@npm:1.1.0" + checksum: a319e7009aadbc6cfedbd8b66861327d3a0c68bd3e8794bf5b86f62b40b01b9479c5a70c76bb368ad454acce52a1216daee460cc825766e2442c04f3a84a02c9 + languageName: node + linkType: hard + +"prism-react-renderer@npm:^1.3.5": + version: 1.3.5 + resolution: "prism-react-renderer@npm:1.3.5" + peerDependencies: + react: ">=0.14.9" + checksum: c18806dcbc4c0b4fd6fd15bd06b4f7c0a6da98d93af235c3e970854994eb9b59e23315abb6cfc29e69da26d36709a47e25da85ab27fed81b6812f0a52caf6dfa + languageName: node + linkType: hard + +"prismjs@npm:^1.28.0": + version: 1.29.0 + resolution: "prismjs@npm:1.29.0" + checksum: 007a8869d4456ff8049dc59404e32d5666a07d99c3b0e30a18bd3b7676dfa07d1daae9d0f407f20983865fd8da56de91d09cb08e6aa61f5bc420a27c0beeaf93 + languageName: node + linkType: hard + +"process-nextick-args@npm:~2.0.0": + version: 2.0.1 + resolution: "process-nextick-args@npm:2.0.1" + checksum: 1d38588e520dab7cea67cbbe2efdd86a10cc7a074c09657635e34f035277b59fbb57d09d8638346bf7090f8e8ebc070c96fa5fd183b777fff4f5edff5e9466cf + languageName: node + linkType: hard + +"progress@npm:2.0.3": + version: 2.0.3 + resolution: "progress@npm:2.0.3" + checksum: f67403fe7b34912148d9252cb7481266a354bd99ce82c835f79070643bb3c6583d10dbcfda4d41e04bbc1d8437e9af0fb1e1f2135727878f5308682a579429b7 + languageName: node + linkType: hard + +"promise-retry@npm:^2.0.1": + version: 2.0.1 + resolution: "promise-retry@npm:2.0.1" + dependencies: + err-code: ^2.0.2 + retry: ^0.12.0 + checksum: f96a3f6d90b92b568a26f71e966cbbc0f63ab85ea6ff6c81284dc869b41510e6cdef99b6b65f9030f0db422bf7c96652a3fff9f2e8fb4a0f069d8f4430359429 + languageName: node + linkType: hard + +"promise@npm:^7.1.1": + version: 7.3.1 + resolution: "promise@npm:7.3.1" + dependencies: + asap: ~2.0.3 + checksum: 475bb069130179fbd27ed2ab45f26d8862376a137a57314cf53310bdd85cc986a826fd585829be97ebc0aaf10e9d8e68be1bfe5a4a0364144b1f9eedfa940cf1 + languageName: node + linkType: hard + +"prompts@npm:^2.4.2": + version: 2.4.2 + resolution: "prompts@npm:2.4.2" + dependencies: + kleur: ^3.0.3 + sisteransi: ^1.0.5 + checksum: d8fd1fe63820be2412c13bfc5d0a01909acc1f0367e32396962e737cb2fc52d004f3302475d5ce7d18a1e8a79985f93ff04ee03007d091029c3f9104bffc007d + languageName: node + linkType: hard + +"prop-types@npm:^15.6.2, prop-types@npm:^15.7.2": + version: 15.8.1 + resolution: "prop-types@npm:15.8.1" + dependencies: + loose-envify: ^1.4.0 + object-assign: ^4.1.1 + react-is: ^16.13.1 + checksum: c056d3f1c057cb7ff8344c645450e14f088a915d078dcda795041765047fa080d38e5d626560ccaac94a4e16e3aa15f3557c1a9a8d1174530955e992c675e459 + languageName: node + linkType: hard + +"property-information@npm:^5.0.0, property-information@npm:^5.3.0": + version: 5.6.0 + resolution: "property-information@npm:5.6.0" + dependencies: + xtend: ^4.0.0 + checksum: fcf87c6542e59a8bbe31ca0b3255a4a63ac1059b01b04469680288998bcfa97f341ca989566adbb63975f4d85339030b82320c324a511532d390910d1c583893 + languageName: node + linkType: hard + +"proxy-addr@npm:~2.0.7": + version: 2.0.7 + resolution: "proxy-addr@npm:2.0.7" + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + checksum: 29c6990ce9364648255454842f06f8c46fcd124d3e6d7c5066df44662de63cdc0bad032e9bf5a3d653ff72141cc7b6019873d685708ac8210c30458ad99f2b74 + languageName: node + linkType: hard + +"proxy-from-env@npm:1.1.0, proxy-from-env@npm:^1.1.0": + version: 1.1.0 + resolution: "proxy-from-env@npm:1.1.0" + checksum: ed7fcc2ba0a33404958e34d95d18638249a68c430e30fcb6c478497d72739ba64ce9810a24f53a7d921d0c065e5b78e3822759800698167256b04659366ca4d4 + languageName: node + linkType: hard + +"ps-tree@npm:^1.2.0": + version: 1.2.0 + resolution: "ps-tree@npm:1.2.0" + dependencies: + event-stream: =3.3.4 + bin: + ps-tree: ./bin/ps-tree.js + checksum: e635dd00f53d30d31696cf5f95b3a8dbdf9b1aeb36d4391578ce8e8cd22949b7c5536c73b0dc18c78615ea3ddd4be96101166be59ca2e3e3cb1e2f79ba3c7f98 + languageName: node + linkType: hard + +"pump@npm:^3.0.0": + version: 3.0.0 + resolution: "pump@npm:3.0.0" + dependencies: + end-of-stream: ^1.1.0 + once: ^1.3.1 + checksum: e42e9229fba14732593a718b04cb5e1cfef8254544870997e0ecd9732b189a48e1256e4e5478148ecb47c8511dca2b09eae56b4d0aad8009e6fac8072923cfc9 + languageName: node + linkType: hard + +"punycode@npm:^1.3.2": + version: 1.4.1 + resolution: "punycode@npm:1.4.1" + checksum: fa6e698cb53db45e4628559e557ddaf554103d2a96a1d62892c8f4032cd3bc8871796cae9eabc1bc700e2b6677611521ce5bb1d9a27700086039965d0cf34518 + languageName: node + linkType: hard + +"punycode@npm:^2.1.0, punycode@npm:^2.1.1": + version: 2.3.0 + resolution: "punycode@npm:2.3.0" + checksum: 39f760e09a2a3bbfe8f5287cf733ecdad69d6af2fe6f97ca95f24b8921858b91e9ea3c9eeec6e08cede96181b3bb33f95c6ffd8c77e63986508aa2e8159fa200 + languageName: node + linkType: hard + +"pupa@npm:^2.1.1": + version: 2.1.1 + resolution: "pupa@npm:2.1.1" + dependencies: + escape-goat: ^2.0.0 + checksum: 49529e50372ffdb0cccf0efa0f3b3cb0a2c77805d0d9cc2725bd2a0f6bb414631e61c93a38561b26be1259550b7bb6c2cb92315aa09c8bf93f3bdcb49f2b2fb7 + languageName: node + linkType: hard + +"puppeteer-core@npm:^19.8.1": + version: 19.11.1 + resolution: "puppeteer-core@npm:19.11.1" + dependencies: + "@puppeteer/browsers": 0.5.0 + chromium-bidi: 0.4.7 + cross-fetch: 3.1.5 + debug: 4.3.4 + devtools-protocol: 0.0.1107588 + extract-zip: 2.0.1 + https-proxy-agent: 5.0.1 + proxy-from-env: 1.1.0 + tar-fs: 2.1.1 + unbzip2-stream: 1.4.3 + ws: 8.13.0 + peerDependencies: + typescript: ">= 4.7.4" + peerDependenciesMeta: + typescript: + optional: true + checksum: 06126e478b8b653e83b98b51cec35dceef8ab576abd1369afd45360c5bac3711443e58ebe3b852d40801a118e4cb7ddf5d3154518b5a9294ee93f7a42d9f22d4 + languageName: node + linkType: hard + +"pure-color@npm:^1.2.0": + version: 1.3.0 + resolution: "pure-color@npm:1.3.0" + checksum: 646d8bed6e6eab89affdd5e2c11f607a85b631a7fb03c061dfa658eb4dc4806881a15feed2ac5fd8c0bad8c00c632c640d5b1cb8b9a972e6e947393a1329371b + languageName: node + linkType: hard + +"qs@npm:6.11.0": + version: 6.11.0 + resolution: "qs@npm:6.11.0" + dependencies: + side-channel: ^1.0.4 + checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297 + languageName: node + linkType: hard + +"qs@npm:^6.5.2": + version: 6.11.2 + resolution: "qs@npm:6.11.2" + dependencies: + side-channel: ^1.0.4 + checksum: e812f3c590b2262548647d62f1637b6989cc56656dc960b893fe2098d96e1bd633f36576f4cd7564dfbff9db42e17775884db96d846bebe4f37420d073ecdc0b + languageName: node + linkType: hard + +"queue-microtask@npm:^1.2.2, queue-microtask@npm:^1.2.3": + version: 1.2.3 + resolution: "queue-microtask@npm:1.2.3" + checksum: b676f8c040cdc5b12723ad2f91414d267605b26419d5c821ff03befa817ddd10e238d22b25d604920340fd73efd8ba795465a0377c4adf45a4a41e4234e42dc4 + languageName: node + linkType: hard + +"queue@npm:6.0.2": + version: 6.0.2 + resolution: "queue@npm:6.0.2" + dependencies: + inherits: ~2.0.3 + checksum: ebc23639248e4fe40a789f713c20548e513e053b3dc4924b6cb0ad741e3f264dcff948225c8737834dd4f9ec286dbc06a1a7c13858ea382d9379f4303bcc0916 + languageName: node + linkType: hard + +"randombytes@npm:^2.1.0": + version: 2.1.0 + resolution: "randombytes@npm:2.1.0" + dependencies: + safe-buffer: ^5.1.0 + checksum: d779499376bd4cbb435ef3ab9a957006c8682f343f14089ed5f27764e4645114196e75b7f6abf1cbd84fd247c0cb0651698444df8c9bf30e62120fbbc52269d6 + languageName: node + linkType: hard + +"range-parser@npm:1.2.0": + version: 1.2.0 + resolution: "range-parser@npm:1.2.0" + checksum: bdf397f43fedc15c559d3be69c01dedf38444ca7a1610f5bf5955e3f3da6057a892f34691e7ebdd8c7e1698ce18ef6c4d4811f70e658dda3ff230ef741f8423a + languageName: node + linkType: hard + +"range-parser@npm:^1.2.1, range-parser@npm:~1.2.1": + version: 1.2.1 + resolution: "range-parser@npm:1.2.1" + checksum: 0a268d4fea508661cf5743dfe3d5f47ce214fd6b7dec1de0da4d669dd4ef3d2144468ebe4179049eff253d9d27e719c88dae55be64f954e80135a0cada804ec9 + languageName: node + linkType: hard + +"raw-body@npm:2.5.1": + version: 2.5.1 + resolution: "raw-body@npm:2.5.1" + dependencies: + bytes: 3.1.2 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + checksum: 5362adff1575d691bb3f75998803a0ffed8c64eabeaa06e54b4ada25a0cd1b2ae7f4f5ec46565d1bec337e08b5ac90c76eaa0758de6f72a633f025d754dec29e + languageName: node + linkType: hard + +"raw-body@npm:^2.3.3, raw-body@npm:^2.4.1": + version: 2.5.2 + resolution: "raw-body@npm:2.5.2" + dependencies: + bytes: 3.1.2 + http-errors: 2.0.0 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + checksum: ba1583c8d8a48e8fbb7a873fdbb2df66ea4ff83775421bfe21ee120140949ab048200668c47d9ae3880012f6e217052690628cf679ddfbd82c9fc9358d574676 + languageName: node + linkType: hard + +"rc@npm:1.2.8, rc@npm:^1.2.8": + version: 1.2.8 + resolution: "rc@npm:1.2.8" + dependencies: + deep-extend: ^0.6.0 + ini: ~1.3.0 + minimist: ^1.2.0 + strip-json-comments: ~2.0.1 + bin: + rc: ./cli.js + checksum: 2e26e052f8be2abd64e6d1dabfbd7be03f80ec18ccbc49562d31f617d0015fbdbcf0f9eed30346ea6ab789e0fdfe4337f033f8016efdbee0df5354751842080e + languageName: node + linkType: hard + +"react-base16-styling@npm:^0.6.0": + version: 0.6.0 + resolution: "react-base16-styling@npm:0.6.0" + dependencies: + base16: ^1.0.0 + lodash.curry: ^4.0.1 + lodash.flow: ^3.3.0 + pure-color: ^1.2.0 + checksum: 00a12dddafc8a9025cca933b0dcb65fca41c81fa176d1fc3a6a9d0242127042e2c0a604f4c724a3254dd2c6aeb5ef55095522ff22f5462e419641c1341a658e4 + languageName: node + linkType: hard + +"react-dev-utils@npm:^12.0.1": + version: 12.0.1 + resolution: "react-dev-utils@npm:12.0.1" + dependencies: + "@babel/code-frame": ^7.16.0 + address: ^1.1.2 + browserslist: ^4.18.1 + chalk: ^4.1.2 + cross-spawn: ^7.0.3 + detect-port-alt: ^1.1.6 + escape-string-regexp: ^4.0.0 + filesize: ^8.0.6 + find-up: ^5.0.0 + fork-ts-checker-webpack-plugin: ^6.5.0 + global-modules: ^2.0.0 + globby: ^11.0.4 + gzip-size: ^6.0.0 + immer: ^9.0.7 + is-root: ^2.1.0 + loader-utils: ^3.2.0 + open: ^8.4.0 + pkg-up: ^3.1.0 + prompts: ^2.4.2 + react-error-overlay: ^6.0.11 + recursive-readdir: ^2.2.2 + shell-quote: ^1.7.3 + strip-ansi: ^6.0.1 + text-table: ^0.2.0 + checksum: 2c6917e47f03d9595044770b0f883a61c6b660fcaa97b8ba459a1d57c9cca9aa374cd51296b22d461ff5e432105dbe6f04732dab128e52729c79239e1c23ab56 + languageName: node + linkType: hard + +"react-dom@npm:^17.0.2": + version: 17.0.2 + resolution: "react-dom@npm:17.0.2" + dependencies: + loose-envify: ^1.1.0 + object-assign: ^4.1.1 + scheduler: ^0.20.2 + peerDependencies: + react: 17.0.2 + checksum: 1c1eaa3bca7c7228d24b70932e3d7c99e70d1d04e13bb0843bbf321582bc25d7961d6b8a6978a58a598af2af496d1cedcfb1bf65f6b0960a0a8161cb8dab743c + languageName: node + linkType: hard + +"react-error-overlay@npm:^6.0.11": + version: 6.0.11 + resolution: "react-error-overlay@npm:6.0.11" + checksum: ce7b44c38fadba9cedd7c095cf39192e632daeccf1d0747292ed524f17dcb056d16bc197ddee5723f9dd888f0b9b19c3b486c430319e30504289b9296f2d2c42 + languageName: node + linkType: hard + +"react-fast-compare@npm:^3.2.0": + version: 3.2.2 + resolution: "react-fast-compare@npm:3.2.2" + checksum: 2071415b4f76a3e6b55c84611c4d24dcb12ffc85811a2840b5a3f1ff2d1a99be1020d9437ee7c6e024c9f4cbb84ceb35e48cf84f28fcb00265ad2dfdd3947704 + languageName: node + linkType: hard + +"react-helmet-async@npm:*, react-helmet-async@npm:^1.3.0": + version: 1.3.0 + resolution: "react-helmet-async@npm:1.3.0" + dependencies: + "@babel/runtime": ^7.12.5 + invariant: ^2.2.4 + prop-types: ^15.7.2 + react-fast-compare: ^3.2.0 + shallowequal: ^1.1.0 + peerDependencies: + react: ^16.6.0 || ^17.0.0 || ^18.0.0 + react-dom: ^16.6.0 || ^17.0.0 || ^18.0.0 + checksum: 7ca7e47f8af14ea186688b512a87ab912bf6041312b297f92516341b140b3f0f8aedf5a44d226d99e69ed067b0cc106e38aeb9c9b738ffcc63d10721c844db90 + languageName: node + linkType: hard + +"react-is@npm:^16.13.1, react-is@npm:^16.6.0, react-is@npm:^16.7.0": + version: 16.13.1 + resolution: "react-is@npm:16.13.1" + checksum: f7a19ac3496de32ca9ae12aa030f00f14a3d45374f1ceca0af707c831b2a6098ef0d6bdae51bd437b0a306d7f01d4677fcc8de7c0d331eb47ad0f46130e53c5f + languageName: node + linkType: hard + +"react-json-view@npm:^1.21.3": + version: 1.21.3 + resolution: "react-json-view@npm:1.21.3" + dependencies: + flux: ^4.0.1 + react-base16-styling: ^0.6.0 + react-lifecycles-compat: ^3.0.4 + react-textarea-autosize: ^8.3.2 + peerDependencies: + react: ^17.0.0 || ^16.3.0 || ^15.5.4 + react-dom: ^17.0.0 || ^16.3.0 || ^15.5.4 + checksum: 5718bcd9210ad5b06eb9469cf8b9b44be9498845a7702e621343618e8251f26357e6e1c865532cf170db6165df1cb30202787e057309d8848c220bc600ec0d1a + languageName: node + linkType: hard + +"react-lifecycles-compat@npm:^3.0.4": + version: 3.0.4 + resolution: "react-lifecycles-compat@npm:3.0.4" + checksum: a904b0fc0a8eeb15a148c9feb7bc17cec7ef96e71188280061fc340043fd6d8ee3ff233381f0e8f95c1cf926210b2c4a31f38182c8f35ac55057e453d6df204f + languageName: node + linkType: hard + +"react-loadable-ssr-addon-v5-slorber@npm:^1.0.1": + version: 1.0.1 + resolution: "react-loadable-ssr-addon-v5-slorber@npm:1.0.1" + dependencies: + "@babel/runtime": ^7.10.3 + peerDependencies: + react-loadable: "*" + webpack: ">=4.41.1 || 5.x" + checksum: 1cf7ceb488d329a5be15f891dae16727fb7ade08ef57826addd21e2c3d485e2440259ef8be94f4d54e9afb4bcbd2fcc22c3c5bad92160c9c06ae6ba7b5562497 + languageName: node + linkType: hard + +"react-router-config@npm:^5.1.1": + version: 5.1.1 + resolution: "react-router-config@npm:5.1.1" + dependencies: + "@babel/runtime": ^7.1.2 + peerDependencies: + react: ">=15" + react-router: ">=5" + checksum: bde7ee79444454bf7c3737fd9c5c268021012c8cc37bc19116b2e7daa28c4231598c275816c7f32c16f9f974dc707b91de279291a5e39efce2e1b1569355b87a + languageName: node + linkType: hard + +"react-router-dom@npm:^5.3.3": + version: 5.3.4 + resolution: "react-router-dom@npm:5.3.4" + dependencies: + "@babel/runtime": ^7.12.13 + history: ^4.9.0 + loose-envify: ^1.3.1 + prop-types: ^15.6.2 + react-router: 5.3.4 + tiny-invariant: ^1.0.2 + tiny-warning: ^1.0.0 + peerDependencies: + react: ">=15" + checksum: b86a6f2f5222f041e38adf4e4b32c7643d6735a1a915ef25855b2db285fd059d72ba8d62e5bcd5d822b8ef9520a80453209e55077f5a90d0f72e908979b8f535 + languageName: node + linkType: hard + +"react-router@npm:5.3.4, react-router@npm:^5.3.3": + version: 5.3.4 + resolution: "react-router@npm:5.3.4" + dependencies: + "@babel/runtime": ^7.12.13 + history: ^4.9.0 + hoist-non-react-statics: ^3.1.0 + loose-envify: ^1.3.1 + path-to-regexp: ^1.7.0 + prop-types: ^15.6.2 + react-is: ^16.6.0 + tiny-invariant: ^1.0.2 + tiny-warning: ^1.0.0 + peerDependencies: + react: ">=15" + checksum: 892d4e274a23bf4f39abc2efca54472fb646d3aed4b584020cf49654d2f50d09a2bacebe7c92b4ec7cb8925077376dfcd0664bad6442a73604397cefec9f01f9 + languageName: node + linkType: hard + +"react-textarea-autosize@npm:^8.3.2": + version: 8.5.3 + resolution: "react-textarea-autosize@npm:8.5.3" + dependencies: + "@babel/runtime": ^7.20.13 + use-composed-ref: ^1.3.0 + use-latest: ^1.2.1 + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + checksum: b317c3763f37a89621bbafd0e6e2d068e7876790a5ae77f497adfd6ba9334ceea138c8a0b7d907bae0f79c765cb24e8b2ca2b8033b4144c0bce28571a3658921 + languageName: node + linkType: hard + +"react@npm:^17.0.2": + version: 17.0.2 + resolution: "react@npm:17.0.2" + dependencies: + loose-envify: ^1.1.0 + object-assign: ^4.1.1 + checksum: b254cc17ce3011788330f7bbf383ab653c6848902d7936a87b09d835d091e3f295f7e9dd1597c6daac5dc80f90e778c8230218ba8ad599f74adcc11e33b9d61b + languageName: node + linkType: hard + +"readable-stream@npm:^2.0.1": + version: 2.3.8 + resolution: "readable-stream@npm:2.3.8" + dependencies: + core-util-is: ~1.0.0 + inherits: ~2.0.3 + isarray: ~1.0.0 + process-nextick-args: ~2.0.0 + safe-buffer: ~5.1.1 + string_decoder: ~1.1.1 + util-deprecate: ~1.0.1 + checksum: 65645467038704f0c8aaf026a72fbb588a9e2ef7a75cd57a01702ee9db1c4a1e4b03aaad36861a6a0926546a74d174149c8c207527963e0c2d3eee2f37678a42 + languageName: node + linkType: hard + +"readable-stream@npm:^3.0.6, readable-stream@npm:^3.1.1, readable-stream@npm:^3.4.0, readable-stream@npm:^3.6.0": + version: 3.6.2 + resolution: "readable-stream@npm:3.6.2" + dependencies: + inherits: ^2.0.3 + string_decoder: ^1.1.1 + util-deprecate: ^1.0.1 + checksum: bdcbe6c22e846b6af075e32cf8f4751c2576238c5043169a1c221c92ee2878458a816a4ea33f4c67623c0b6827c8a400409bfb3cf0bf3381392d0b1dfb52ac8d + languageName: node + linkType: hard + +"readdirp@npm:~3.6.0": + version: 3.6.0 + resolution: "readdirp@npm:3.6.0" + dependencies: + picomatch: ^2.2.1 + checksum: 1ced032e6e45670b6d7352d71d21ce7edf7b9b928494dcaba6f11fba63180d9da6cd7061ebc34175ffda6ff529f481818c962952004d273178acd70f7059b320 + languageName: node + linkType: hard + +"reading-time@npm:^1.5.0": + version: 1.5.0 + resolution: "reading-time@npm:1.5.0" + checksum: e27bc5a70ba0f4ac337896b18531b914d38f4bee67cbad48029d0c11dd0a7a847b2a6bba895ab7ce2ad3e7ecb86912bdc477d8fa2d48405a3deda964be54d09b + languageName: node + linkType: hard + +"rechoir@npm:^0.6.2": + version: 0.6.2 + resolution: "rechoir@npm:0.6.2" + dependencies: + resolve: ^1.1.6 + checksum: fe76bf9c21875ac16e235defedd7cbd34f333c02a92546142b7911a0f7c7059d2e16f441fe6fb9ae203f459c05a31b2bcf26202896d89e390eda7514d5d2702b + languageName: node + linkType: hard + +"recursive-readdir@npm:^2.2.2": + version: 2.2.3 + resolution: "recursive-readdir@npm:2.2.3" + dependencies: + minimatch: ^3.0.5 + checksum: 88ec96e276237290607edc0872b4f9842837b95cfde0cdbb1e00ba9623dfdf3514d44cdd14496ab60a0c2dd180a6ef8a3f1c34599e6cf2273afac9b72a6fb2b5 + languageName: node + linkType: hard + +"reduce-flatten@npm:^2.0.0": + version: 2.0.0 + resolution: "reduce-flatten@npm:2.0.0" + checksum: 64393ef99a16b20692acfd60982d7fdbd7ff8d9f8f185c6023466444c6dd2abb929d67717a83cec7f7f8fb5f46a25d515b3b2bf2238fdbfcdbfd01d2a9e73cb8 + languageName: node + linkType: hard + +"regenerate-unicode-properties@npm:^10.1.0": + version: 10.1.1 + resolution: "regenerate-unicode-properties@npm:10.1.1" + dependencies: + regenerate: ^1.4.2 + checksum: b80958ef40f125275824c2c47d5081dfaefebd80bff26c76761e9236767c748a4a95a69c053fe29d2df881177f2ca85df4a71fe70a82360388b31159ef19adcf + languageName: node + linkType: hard + +"regenerate@npm:^1.4.2": + version: 1.4.2 + resolution: "regenerate@npm:1.4.2" + checksum: 3317a09b2f802da8db09aa276e469b57a6c0dd818347e05b8862959c6193408242f150db5de83c12c3fa99091ad95fb42a6db2c3329bfaa12a0ea4cbbeb30cb0 + languageName: node + linkType: hard + +"regenerator-runtime@npm:^0.14.0": + version: 0.14.0 + resolution: "regenerator-runtime@npm:0.14.0" + checksum: 1c977ad82a82a4412e4f639d65d22be376d3ebdd30da2c003eeafdaaacd03fc00c2320f18120007ee700900979284fc78a9f00da7fb593f6e6eeebc673fba9a3 + languageName: node + linkType: hard + +"regenerator-transform@npm:^0.15.2": + version: 0.15.2 + resolution: "regenerator-transform@npm:0.15.2" + dependencies: + "@babel/runtime": ^7.8.4 + checksum: 20b6f9377d65954980fe044cfdd160de98df415b4bff38fbade67b3337efaf078308c4fed943067cd759827cc8cfeca9cb28ccda1f08333b85d6a2acbd022c27 + languageName: node + linkType: hard + +"regexpu-core@npm:^5.3.1": + version: 5.3.2 + resolution: "regexpu-core@npm:5.3.2" + dependencies: + "@babel/regjsgen": ^0.8.0 + regenerate: ^1.4.2 + regenerate-unicode-properties: ^10.1.0 + regjsparser: ^0.9.1 + unicode-match-property-ecmascript: ^2.0.0 + unicode-match-property-value-ecmascript: ^2.1.0 + checksum: 95bb97088419f5396e07769b7de96f995f58137ad75fac5811fb5fe53737766dfff35d66a0ee66babb1eb55386ef981feaef392f9df6d671f3c124812ba24da2 + languageName: node + linkType: hard + +"registry-auth-token@npm:^4.0.0": + version: 4.2.2 + resolution: "registry-auth-token@npm:4.2.2" + dependencies: + rc: 1.2.8 + checksum: c5030198546ecfdcbcb0722cbc3e260c4f5f174d8d07bdfedd4620e79bfdf17a2db735aa230d600bd388fce6edd26c0a9ed2eb7e9b4641ec15213a28a806688b + languageName: node + linkType: hard + +"registry-url@npm:^5.0.0": + version: 5.1.0 + resolution: "registry-url@npm:5.1.0" + dependencies: + rc: ^1.2.8 + checksum: bcea86c84a0dbb66467b53187fadebfea79017cddfb4a45cf27530d7275e49082fe9f44301976eb0164c438e395684bcf3dae4819b36ff9d1640d8cc60c73df9 + languageName: node + linkType: hard + +"regjsparser@npm:^0.9.1": + version: 0.9.1 + resolution: "regjsparser@npm:0.9.1" + dependencies: + jsesc: ~0.5.0 + bin: + regjsparser: bin/parser + checksum: 5e1b76afe8f1d03c3beaf9e0d935dd467589c3625f6d65fb8ffa14f224d783a0fed4bf49c2c1b8211043ef92b6117313419edf055a098ed8342e340586741afc + languageName: node + linkType: hard + +"rehype-katex@npm:^5.0.0": + version: 5.0.0 + resolution: "rehype-katex@npm:5.0.0" + dependencies: + "@types/katex": ^0.11.0 + hast-util-to-text: ^2.0.0 + katex: ^0.13.0 + rehype-parse: ^7.0.0 + unified: ^9.0.0 + unist-util-visit: ^2.0.0 + checksum: b20e24c5326a718581619761057a30d03615519eccd0693ada2c7c710064dceaf08f038ae3a1131550f1f7c47ca54a254ba8e45547da384867e956ceca73f6bf + languageName: node + linkType: hard + +"rehype-parse@npm:^7.0.0": + version: 7.0.1 + resolution: "rehype-parse@npm:7.0.1" + dependencies: + hast-util-from-parse5: ^6.0.0 + parse5: ^6.0.0 + checksum: c3c914aa9281853290eff6b09e0bed6843934e788b957e25219e91f0bf244a183d2f5e042c7d21543276571f9b49a6bae90f4640b8f885f2773392ffa57baf4b + languageName: node + linkType: hard + +"relateurl@npm:^0.2.7": + version: 0.2.7 + resolution: "relateurl@npm:0.2.7" + checksum: 5891e792eae1dfc3da91c6fda76d6c3de0333a60aa5ad848982ebb6dccaa06e86385fb1235a1582c680a3d445d31be01c6bfc0804ebbcab5aaf53fa856fde6b6 + languageName: node + linkType: hard + +"release-tests@workspace:release-tests": + version: 0.0.0-use.local + resolution: "release-tests@workspace:release-tests" + dependencies: + uvu: 0.5.6 + zx: 7.1.1 + languageName: unknown + linkType: soft + +"remark-emoji@npm:^2.2.0": + version: 2.2.0 + resolution: "remark-emoji@npm:2.2.0" + dependencies: + emoticon: ^3.2.0 + node-emoji: ^1.10.0 + unist-util-visit: ^2.0.3 + checksum: 638d4be72eb4110a447f389d4b8c454921f188c0acabf1b6579f3ddaa301ee91010173d6eebd975ea622ae3de7ed4531c0315a4ffd4f9653d80c599ef9ec21a8 + languageName: node + linkType: hard + +"remark-footnotes@npm:2.0.0": + version: 2.0.0 + resolution: "remark-footnotes@npm:2.0.0" + checksum: f2f87ffd6fe25892373c7164d6584a7cb03ab0ea4f186af493a73df519e24b72998a556e7f16cb996f18426cdb80556b95ff252769e252cf3ccba0fd2ca20621 + languageName: node + linkType: hard + +"remark-math@npm:^3.0.1": + version: 3.0.1 + resolution: "remark-math@npm:3.0.1" + checksum: 690256f27f2b42dadcf41806fec443056e09592454622ae77f03b1a8474e8c83cc7610e694be7e17de92c96cc272c61209e59a6e7a24e3af6ede47d48b185ccd + languageName: node + linkType: hard + +"remark-mdx@npm:1.6.22": + version: 1.6.22 + resolution: "remark-mdx@npm:1.6.22" + dependencies: + "@babel/core": 7.12.9 + "@babel/helper-plugin-utils": 7.10.4 + "@babel/plugin-proposal-object-rest-spread": 7.12.1 + "@babel/plugin-syntax-jsx": 7.12.1 + "@mdx-js/util": 1.6.22 + is-alphabetical: 1.0.4 + remark-parse: 8.0.3 + unified: 9.2.0 + checksum: 45e62f8a821c37261f94448d54f295de1c5c393f762ff96cd4d4b730715037fafeb6c89ef94adf6a10a09edfa72104afe1431b93b5ae5e40ce2a7677e133c3d9 + languageName: node + linkType: hard + +"remark-parse@npm:8.0.3": + version: 8.0.3 + resolution: "remark-parse@npm:8.0.3" + dependencies: + ccount: ^1.0.0 + collapse-white-space: ^1.0.2 + is-alphabetical: ^1.0.0 + is-decimal: ^1.0.0 + is-whitespace-character: ^1.0.0 + is-word-character: ^1.0.0 + markdown-escapes: ^1.0.0 + parse-entities: ^2.0.0 + repeat-string: ^1.5.4 + state-toggle: ^1.0.0 + trim: 0.0.1 + trim-trailing-lines: ^1.0.0 + unherit: ^1.0.4 + unist-util-remove-position: ^2.0.0 + vfile-location: ^3.0.0 + xtend: ^4.0.1 + checksum: 2dfea250e7606ddfc9e223b9f41e0b115c5c701be4bd35181beaadd46ee59816bc00aadc6085a420f8df00b991ada73b590ea7fd34ace14557de4a0a41805be5 + languageName: node + linkType: hard + +"remark-squeeze-paragraphs@npm:4.0.0": + version: 4.0.0 + resolution: "remark-squeeze-paragraphs@npm:4.0.0" + dependencies: + mdast-squeeze-paragraphs: ^4.0.0 + checksum: 2071eb74d0ecfefb152c4932690a9fd950c3f9f798a676f1378a16db051da68fb20bf288688cc153ba5019dded35408ff45a31dfe9686eaa7a9f1df9edbb6c81 + languageName: node + linkType: hard + +"renderkid@npm:^3.0.0": + version: 3.0.0 + resolution: "renderkid@npm:3.0.0" + dependencies: + css-select: ^4.1.3 + dom-converter: ^0.2.0 + htmlparser2: ^6.1.0 + lodash: ^4.17.21 + strip-ansi: ^6.0.1 + checksum: 77162b62d6f33ab81f337c39efce0439ff0d1f6d441e29c35183151f83041c7850774fb904da163d6c844264d440d10557714e6daa0b19e4561a5cd4ef305d41 + languageName: node + linkType: hard + +"repeat-string@npm:^1.0.0, repeat-string@npm:^1.5.4": + version: 1.6.1 + resolution: "repeat-string@npm:1.6.1" + checksum: 1b809fc6db97decdc68f5b12c4d1a671c8e3f65ec4a40c238bc5200e44e85bcc52a54f78268ab9c29fcf5fe4f1343e805420056d1f30fa9a9ee4c2d93e3cc6c0 + languageName: node + linkType: hard + +"require-directory@npm:^2.1.1": + version: 2.1.1 + resolution: "require-directory@npm:2.1.1" + checksum: fb47e70bf0001fdeabdc0429d431863e9475e7e43ea5f94ad86503d918423c1543361cc5166d713eaa7029dd7a3d34775af04764bebff99ef413111a5af18c80 + languageName: node + linkType: hard + +"require-from-string@npm:^2.0.0, require-from-string@npm:^2.0.2": + version: 2.0.2 + resolution: "require-from-string@npm:2.0.2" + checksum: a03ef6895445f33a4015300c426699bc66b2b044ba7b670aa238610381b56d3f07c686251740d575e22f4c87531ba662d06937508f0f3c0f1ddc04db3130560b + languageName: node + linkType: hard + +"require-like@npm:>= 0.1.1": + version: 0.1.2 + resolution: "require-like@npm:0.1.2" + checksum: edb8331f05fd807381a75b76f6cca9f0ce8acaa2e910b7e116541799aa970bfbc64fde5fd6adb3a6917dba346f8386ebbddb81614c24e8dad1b4290c7af9535e + languageName: node + linkType: hard + +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: eee0e303adffb69be55d1a214e415cf42b7441ae858c76dfc5353148644f6fd6e698926fc4643f510d5c126d12a705e7c8ed7e38061113bdf37547ab356797ff + languageName: node + linkType: hard + +"resolve-cwd@npm:^3.0.0": + version: 3.0.0 + resolution: "resolve-cwd@npm:3.0.0" + dependencies: + resolve-from: ^5.0.0 + checksum: 546e0816012d65778e580ad62b29e975a642989108d9a3c5beabfb2304192fa3c9f9146fbdfe213563c6ff51975ae41bac1d3c6e047dd9572c94863a057b4d81 + languageName: node + linkType: hard + +"resolve-from@npm:^4.0.0": + version: 4.0.0 + resolution: "resolve-from@npm:4.0.0" + checksum: f4ba0b8494846a5066328ad33ef8ac173801a51739eb4d63408c847da9a2e1c1de1e6cbbf72699211f3d13f8fc1325648b169bd15eb7da35688e30a5fb0e4a7f + languageName: node + linkType: hard + +"resolve-from@npm:^5.0.0": + version: 5.0.0 + resolution: "resolve-from@npm:5.0.0" + checksum: 4ceeb9113e1b1372d0cd969f3468fa042daa1dd9527b1b6bb88acb6ab55d8b9cd65dbf18819f9f9ddf0db804990901dcdaade80a215e7b2c23daae38e64f5bdf + languageName: node + linkType: hard + +"resolve-path@npm:^1.4.0": + version: 1.4.0 + resolution: "resolve-path@npm:1.4.0" + dependencies: + http-errors: ~1.6.2 + path-is-absolute: 1.0.1 + checksum: 1a39f569ee54dd5f8ee8576ef8671c9724bea65d9f9982fbb5352af9fb4e500e1e459c1bfb1ae3ebfd8d43a709c3a01dfa4f46cf5b831e45e2caed4f1a208300 + languageName: node + linkType: hard + +"resolve-pathname@npm:^3.0.0": + version: 3.0.0 + resolution: "resolve-pathname@npm:3.0.0" + checksum: 6147241ba42c423dbe83cb067a2b4af4f60908c3af57e1ea567729cc71416c089737fe2a73e9e79e7a60f00f66c91e4b45ad0d37cd4be2d43fec44963ef14368 + languageName: node + linkType: hard + +"resolve@npm:1.17.0": + version: 1.17.0 + resolution: "resolve@npm:1.17.0" + dependencies: + path-parse: ^1.0.6 + checksum: 9ceaf83b3429f2d7ff5d0281b8d8f18a1f05b6ca86efea7633e76b8f76547f33800799dfdd24434942dec4fbd9e651ed3aef577d9a6b5ec87ad89c1060e24759 + languageName: node + linkType: hard + +"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.3.2": + version: 1.22.8 + resolution: "resolve@npm:1.22.8" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: f8a26958aa572c9b064562750b52131a37c29d072478ea32e129063e2da7f83e31f7f11e7087a18225a8561cfe8d2f0df9dbea7c9d331a897571c0a2527dbb4c + languageName: node + linkType: hard + +"resolve@npm:^1.19.0": + version: 1.22.6 + resolution: "resolve@npm:1.22.6" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: d13bf66d4e2ee30d291491f16f2fa44edd4e0cefb85d53249dd6f93e70b2b8c20ec62f01b18662e3cd40e50a7528f18c4087a99490048992a3bb954cf3201a5b + languageName: node + linkType: hard + +"resolve@patch:resolve@1.17.0#~builtin": + version: 1.17.0 + resolution: "resolve@patch:resolve@npm%3A1.17.0#~builtin::version=1.17.0&hash=c3c19d" + dependencies: + path-parse: ^1.0.6 + checksum: 6fd799f282ddf078c4bc20ce863e3af01fa8cb218f0658d9162c57161a2dbafe092b13015b9a4c58d0e1e801cf7aa7a4f13115fea9db98c3f9a0c43e429bad6f + languageName: node + linkType: hard + +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.3.2#~builtin": + version: 1.22.8 + resolution: "resolve@patch:resolve@npm%3A1.22.8#~builtin::version=1.22.8&hash=c3c19d" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: 5479b7d431cacd5185f8db64bfcb7286ae5e31eb299f4c4f404ad8aa6098b77599563ac4257cb2c37a42f59dfc06a1bec2bcf283bb448f319e37f0feb9a09847 + languageName: node + linkType: hard + +"resolve@patch:resolve@^1.19.0#~builtin": + version: 1.22.6 + resolution: "resolve@patch:resolve@npm%3A1.22.6#~builtin::version=1.22.6&hash=c3c19d" + dependencies: + is-core-module: ^2.13.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: 9d3b3c67aefd12cecbe5f10ca4d1f51ea190891096497c43f301b086883b426466918c3a64f1bbf1788fabb52b579d58809614006c5d0b49186702b3b8fb746a + languageName: node + linkType: hard + +"responselike@npm:^1.0.2": + version: 1.0.2 + resolution: "responselike@npm:1.0.2" + dependencies: + lowercase-keys: ^1.0.0 + checksum: 2e9e70f1dcca3da621a80ce71f2f9a9cad12c047145c6ece20df22f0743f051cf7c73505e109814915f23f9e34fb0d358e22827723ee3d56b623533cab8eafcd + languageName: node + linkType: hard + +"restore-cursor@npm:^3.1.0": + version: 3.1.0 + resolution: "restore-cursor@npm:3.1.0" + dependencies: + onetime: ^5.1.0 + signal-exit: ^3.0.2 + checksum: f877dd8741796b909f2a82454ec111afb84eb45890eb49ac947d87991379406b3b83ff9673a46012fca0d7844bb989f45cc5b788254cf1a39b6b5a9659de0630 + languageName: node + linkType: hard + +"retry@npm:^0.12.0": + version: 0.12.0 + resolution: "retry@npm:0.12.0" + checksum: 623bd7d2e5119467ba66202d733ec3c2e2e26568074923bc0585b6b99db14f357e79bdedb63cab56cec47491c4a0da7e6021a7465ca6dc4f481d3898fdd3158c + languageName: node + linkType: hard + +"retry@npm:^0.13.1": + version: 0.13.1 + resolution: "retry@npm:0.13.1" + checksum: 47c4d5be674f7c13eee4cfe927345023972197dbbdfba5d3af7e461d13b44de1bfd663bfc80d2f601f8ef3fc8164c16dd99655a221921954a65d044a2fc1233b + languageName: node + linkType: hard + +"reusify@npm:^1.0.4": + version: 1.0.4 + resolution: "reusify@npm:1.0.4" + checksum: c3076ebcc22a6bc252cb0b9c77561795256c22b757f40c0d8110b1300723f15ec0fc8685e8d4ea6d7666f36c79ccc793b1939c748bf36f18f542744a4e379fcc + languageName: node + linkType: hard + +"rimraf@npm:^2.2.8": + version: 2.7.1 + resolution: "rimraf@npm:2.7.1" + dependencies: + glob: ^7.1.3 + bin: + rimraf: ./bin.js + checksum: cdc7f6eacb17927f2a075117a823e1c5951792c6498ebcce81ca8203454a811d4cf8900314154d3259bb8f0b42ab17f67396a8694a54cae3283326e57ad250cd + languageName: node + linkType: hard + +"rimraf@npm:^3.0.2": + version: 3.0.2 + resolution: "rimraf@npm:3.0.2" + dependencies: + glob: ^7.1.3 + bin: + rimraf: bin.js + checksum: 87f4164e396f0171b0a3386cc1877a817f572148ee13a7e113b238e48e8a9f2f31d009a92ec38a591ff1567d9662c6b67fd8818a2dbbaed74bc26a87a2a4a9a0 + languageName: node + linkType: hard + +"ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1": + version: 2.0.2 + resolution: "ripemd160@npm:2.0.2" + dependencies: + hash-base: ^3.0.0 + inherits: ^2.0.1 + checksum: 006accc40578ee2beae382757c4ce2908a826b27e2b079efdcd2959ee544ddf210b7b5d7d5e80467807604244e7388427330f5c6d4cd61e6edaddc5773ccc393 + languageName: node + linkType: hard + +"rlp@npm:^2.2.3": + version: 2.2.7 + resolution: "rlp@npm:2.2.7" + dependencies: + bn.js: ^5.2.0 + bin: + rlp: bin/rlp + checksum: 3db4dfe5c793f40ac7e0be689a1f75d05e6f2ca0c66189aeb62adab8c436b857ab4420a419251ee60370d41d957a55698fc5e23ab1e1b41715f33217bc4bb558 + languageName: node + linkType: hard + +"rollup@npm:^2.67.0": + version: 2.79.1 + resolution: "rollup@npm:2.79.1" + dependencies: + fsevents: ~2.3.2 + dependenciesMeta: + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 6a2bf167b3587d4df709b37d149ad0300692cc5deb510f89ac7bdc77c8738c9546ae3de9322b0968e1ed2b0e984571f5f55aae28fa7de4cfcb1bc5402a4e2be6 + languageName: node + linkType: hard + +"rtl-detect@npm:^1.0.4": + version: 1.0.4 + resolution: "rtl-detect@npm:1.0.4" + checksum: d562535baa0db62f57f0a1d4676297bff72fd6b94e88f0f0900d5c3e810ab512c5c4cadffd3e05fbe8d9c74310c919afa3ea8c1001c244e5555e8eef12d02d6f + languageName: node + linkType: hard + +"rtlcss@npm:^3.5.0": + version: 3.5.0 + resolution: "rtlcss@npm:3.5.0" + dependencies: + find-up: ^5.0.0 + picocolors: ^1.0.0 + postcss: ^8.3.11 + strip-json-comments: ^3.1.1 + bin: + rtlcss: bin/rtlcss.js + checksum: a3763cad2cb58ce1b950de155097c3c294e7aefc8bf328b58d0cc8d5efb88bf800865edc158a78ace6d1f7f99fea6fd66fb4a354d859b172dadd3dab3e0027b3 + languageName: node + linkType: hard + +"run-applescript@npm:^5.0.0": + version: 5.0.0 + resolution: "run-applescript@npm:5.0.0" + dependencies: + execa: ^5.0.0 + checksum: d00c2dbfa5b2d774de7451194b8b125f40f65fc183de7d9dcae97f57f59433586d3c39b9001e111c38bfa24c3436c99df1bb4066a2a0c90d39a8c4cd6889af77 + languageName: node + linkType: hard + +"run-parallel-limit@npm:^1.1.0": + version: 1.1.0 + resolution: "run-parallel-limit@npm:1.1.0" + dependencies: + queue-microtask: ^1.2.2 + checksum: 672c3b87e7f939c684b9965222b361421db0930223ed1e43ebf0e7e48ccc1a022ea4de080bef4d5468434e2577c33b7681e3f03b7593fdc49ad250a55381123c + languageName: node + linkType: hard + +"run-parallel@npm:^1.1.9": + version: 1.2.0 + resolution: "run-parallel@npm:1.2.0" + dependencies: + queue-microtask: ^1.2.2 + checksum: cb4f97ad25a75ebc11a8ef4e33bb962f8af8516bb2001082ceabd8902e15b98f4b84b4f8a9b222e5d57fc3bd1379c483886ed4619367a7680dad65316993021d + languageName: node + linkType: hard + +"rustbn.js@npm:~0.2.0": + version: 0.2.0 + resolution: "rustbn.js@npm:0.2.0" + checksum: 2148e7ba34e70682907ee29df4784639e6eb025481b2c91249403b7ec57181980161868d9aa24822a5075dd1bb5a180dfedc77309e5f0d27b6301f9b563af99a + languageName: node + linkType: hard + +"rxjs@npm:^7.5.4": + version: 7.8.1 + resolution: "rxjs@npm:7.8.1" + dependencies: + tslib: ^2.1.0 + checksum: de4b53db1063e618ec2eca0f7965d9137cabe98cf6be9272efe6c86b47c17b987383df8574861bcced18ebd590764125a901d5506082be84a8b8e364bf05f119 + languageName: node + linkType: hard + +"sade@npm:^1.7.3": + version: 1.8.1 + resolution: "sade@npm:1.8.1" + dependencies: + mri: ^1.1.0 + checksum: 0756e5b04c51ccdc8221ebffd1548d0ce5a783a44a0fa9017a026659b97d632913e78f7dca59f2496aa996a0be0b0c322afd87ca72ccd909406f49dbffa0f45d + languageName: node + linkType: hard + +"safe-buffer@npm:5.1.2, safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1": + version: 5.1.2 + resolution: "safe-buffer@npm:5.1.2" + checksum: f2f1f7943ca44a594893a852894055cf619c1fbcb611237fc39e461ae751187e7baf4dc391a72125e0ac4fb2d8c5c0b3c71529622e6a58f46b960211e704903c + languageName: node + linkType: hard + +"safe-buffer@npm:5.2.1, safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:^5.2.0, safe-buffer@npm:~5.2.0": + version: 5.2.1 + resolution: "safe-buffer@npm:5.2.1" + checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491 + languageName: node + linkType: hard + +"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0": + version: 2.1.2 + resolution: "safer-buffer@npm:2.1.2" + checksum: cab8f25ae6f1434abee8d80023d7e72b598cf1327164ddab31003c51215526801e40b66c5e65d658a0af1e9d6478cadcb4c745f4bd6751f97d8644786c0978b0 + languageName: node + linkType: hard + +"sax@npm:^1.2.4": + version: 1.3.0 + resolution: "sax@npm:1.3.0" + checksum: 238ab3a9ba8c8f8aaf1c5ea9120386391f6ee0af52f1a6a40bbb6df78241dd05d782f2359d614ac6aae08c4c4125208b456548a6cf68625aa4fe178486e63ecd + languageName: node + linkType: hard + +"scheduler@npm:^0.20.2": + version: 0.20.2 + resolution: "scheduler@npm:0.20.2" + dependencies: + loose-envify: ^1.1.0 + object-assign: ^4.1.1 + checksum: c4b35cf967c8f0d3e65753252d0f260271f81a81e427241295c5a7b783abf4ea9e905f22f815ab66676f5313be0a25f47be582254db8f9241b259213e999b8fc + languageName: node + linkType: hard + +"schema-utils@npm:2.7.0": + version: 2.7.0 + resolution: "schema-utils@npm:2.7.0" + dependencies: + "@types/json-schema": ^7.0.4 + ajv: ^6.12.2 + ajv-keywords: ^3.4.1 + checksum: 8889325b0ee1ae6a8f5d6aaa855c71e136ebbb7fd731b01a9d3ec8225dcb245f644c47c50104db4c741983b528cdff8558570021257d4d397ec6aaecd9172a8e + languageName: node + linkType: hard + +"schema-utils@npm:^2.6.5": + version: 2.7.1 + resolution: "schema-utils@npm:2.7.1" + dependencies: + "@types/json-schema": ^7.0.5 + ajv: ^6.12.4 + ajv-keywords: ^3.5.2 + checksum: 32c62fc9e28edd101e1bd83453a4216eb9bd875cc4d3775e4452b541908fa8f61a7bbac8ffde57484f01d7096279d3ba0337078e85a918ecbeb72872fb09fb2b + languageName: node + linkType: hard + +"schema-utils@npm:^3.0.0, schema-utils@npm:^3.1.1, schema-utils@npm:^3.2.0": + version: 3.3.0 + resolution: "schema-utils@npm:3.3.0" + dependencies: + "@types/json-schema": ^7.0.8 + ajv: ^6.12.5 + ajv-keywords: ^3.5.2 + checksum: ea56971926fac2487f0757da939a871388891bc87c6a82220d125d587b388f1704788f3706e7f63a7b70e49fc2db974c41343528caea60444afd5ce0fe4b85c0 + languageName: node + linkType: hard + +"schema-utils@npm:^4.0.0": + version: 4.2.0 + resolution: "schema-utils@npm:4.2.0" + dependencies: + "@types/json-schema": ^7.0.9 + ajv: ^8.9.0 + ajv-formats: ^2.1.1 + ajv-keywords: ^5.1.0 + checksum: 26a0463d47683258106e6652e9aeb0823bf0b85843039e068b57da1892f7ae6b6b1094d48e9ed5ba5cbe9f7166469d880858b9d91abe8bd249421eb813850cde + languageName: node + linkType: hard + +"scrypt-js@npm:3.0.1, scrypt-js@npm:^3.0.0": + version: 3.0.1 + resolution: "scrypt-js@npm:3.0.1" + checksum: b7c7d1a68d6ca946f2fbb0778e0c4ec63c65501b54023b2af7d7e9f48fdb6c6580d6f7675cd53bda5944c5ebc057560d5a6365079752546865defb3b79dea454 + languageName: node + linkType: hard + +"secp256k1@npm:^4.0.1": + version: 4.0.3 + resolution: "secp256k1@npm:4.0.3" + dependencies: + elliptic: ^6.5.4 + node-addon-api: ^2.0.0 + node-gyp: latest + node-gyp-build: ^4.2.0 + checksum: 21e219adc0024fbd75021001358780a3cc6ac21273c3fcaef46943af73969729709b03f1df7c012a0baab0830fb9a06ccc6b42f8d50050c665cb98078eab477b + languageName: node + linkType: hard + +"section-matter@npm:^1.0.0": + version: 1.0.0 + resolution: "section-matter@npm:1.0.0" + dependencies: + extend-shallow: ^2.0.1 + kind-of: ^6.0.0 + checksum: 3cc4131705493b2955729b075dcf562359bba66183debb0332752dc9cad35616f6da7a23e42b6cab45cd2e4bb5cda113e9e84c8f05aee77adb6b0289a0229101 + languageName: node + linkType: hard + +"select-hose@npm:^2.0.0": + version: 2.0.0 + resolution: "select-hose@npm:2.0.0" + checksum: d7e5fcc695a4804209d232a1b18624a5134be334d4e1114b0721f7a5e72bd73da483dcf41528c1af4f4f4892ad7cfd6a1e55c8ffb83f9c9fe723b738db609dbb + languageName: node + linkType: hard + +"selfsigned@npm:^2.1.1": + version: 2.1.1 + resolution: "selfsigned@npm:2.1.1" + dependencies: + node-forge: ^1 + checksum: aa9ce2150a54838978d5c0aee54d7ebe77649a32e4e690eb91775f71fdff773874a4fbafd0ac73d8ec3b702ff8a395c604df4f8e8868528f36fd6c15076fb43a + languageName: node + linkType: hard + +"semver-diff@npm:^3.1.1": + version: 3.1.1 + resolution: "semver-diff@npm:3.1.1" + dependencies: + semver: ^6.3.0 + checksum: 8bbe5a5d7add2d5e51b72314a9215cd294d71f41cdc2bf6bd59ee76411f3610b576172896f1d191d0d7294cb9f2f847438d2ee158adacc0c224dca79052812fe + languageName: node + linkType: hard + +"semver@npm:^5.4.1, semver@npm:^5.5.0": + version: 5.7.2 + resolution: "semver@npm:5.7.2" + bin: + semver: bin/semver + checksum: fb4ab5e0dd1c22ce0c937ea390b4a822147a9c53dbd2a9a0132f12fe382902beef4fbf12cf51bb955248d8d15874ce8cd89532569756384f994309825f10b686 + languageName: node + linkType: hard + +"semver@npm:^6.0.0, semver@npm:^6.2.0, semver@npm:^6.3.0, semver@npm:^6.3.1": + version: 6.3.1 + resolution: "semver@npm:6.3.1" + bin: + semver: bin/semver.js + checksum: ae47d06de28836adb9d3e25f22a92943477371292d9b665fb023fae278d345d508ca1958232af086d85e0155aee22e313e100971898bbb8d5d89b8b1d4054ca2 + languageName: node + linkType: hard + +"semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.3, semver@npm:^7.5.4": + version: 7.5.4 + resolution: "semver@npm:7.5.4" + dependencies: + lru-cache: ^6.0.0 + bin: + semver: bin/semver.js + checksum: 12d8ad952fa353b0995bf180cdac205a4068b759a140e5d3c608317098b3575ac2f1e09182206bf2eb26120e1c0ed8fb92c48c592f6099680de56bb071423ca3 + languageName: node + linkType: hard + +"send@npm:0.18.0": + version: 0.18.0 + resolution: "send@npm:0.18.0" + dependencies: + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + encodeurl: ~1.0.2 + escape-html: ~1.0.3 + etag: ~1.8.1 + fresh: 0.5.2 + http-errors: 2.0.0 + mime: 1.6.0 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: ~1.2.1 + statuses: 2.0.1 + checksum: 74fc07ebb58566b87b078ec63e5a3e41ecd987e4272ba67b7467e86c6ad51bc6b0b0154133b6d8b08a2ddda360464f71382f7ef864700f34844a76c8027817a8 + languageName: node + linkType: hard + +"serialize-error@npm:^7.0.1": + version: 7.0.1 + resolution: "serialize-error@npm:7.0.1" + dependencies: + type-fest: ^0.13.1 + checksum: e0aba4dca2fc9fe74ae1baf38dbd99190e1945445a241ba646290f2176cdb2032281a76443b02ccf0caf30da5657d510746506368889a593b9835a497fc0732e + languageName: node + linkType: hard + +"serialize-javascript@npm:6.0.0": + version: 6.0.0 + resolution: "serialize-javascript@npm:6.0.0" + dependencies: + randombytes: ^2.1.0 + checksum: 56f90b562a1bdc92e55afb3e657c6397c01a902c588c0fe3d4c490efdcc97dcd2a3074ba12df9e94630f33a5ce5b76a74784a7041294628a6f4306e0ec84bf93 + languageName: node + linkType: hard + +"serialize-javascript@npm:^6.0.0, serialize-javascript@npm:^6.0.1": + version: 6.0.1 + resolution: "serialize-javascript@npm:6.0.1" + dependencies: + randombytes: ^2.1.0 + checksum: 3c4f4cb61d0893b988415bdb67243637333f3f574e9e9cc9a006a2ced0b390b0b3b44aef8d51c951272a9002ec50885eefdc0298891bc27eb2fe7510ea87dc4f + languageName: node + linkType: hard + +"serve-handler@npm:^6.1.3": + version: 6.1.5 + resolution: "serve-handler@npm:6.1.5" + dependencies: + bytes: 3.0.0 + content-disposition: 0.5.2 + fast-url-parser: 1.1.3 + mime-types: 2.1.18 + minimatch: 3.1.2 + path-is-inside: 1.0.2 + path-to-regexp: 2.2.1 + range-parser: 1.2.0 + checksum: 7a98ca9cbf8692583b6cde4deb3941cff900fa38bf16adbfccccd8430209bab781e21d9a1f61c9c03e226f9f67689893bbce25941368f3ddaf985fc3858b49dc + languageName: node + linkType: hard + +"serve-index@npm:^1.9.1": + version: 1.9.1 + resolution: "serve-index@npm:1.9.1" + dependencies: + accepts: ~1.3.4 + batch: 0.6.1 + debug: 2.6.9 + escape-html: ~1.0.3 + http-errors: ~1.6.2 + mime-types: ~2.1.17 + parseurl: ~1.3.2 + checksum: e2647ce13379485b98a53ba2ea3fbad4d44b57540d00663b02b976e426e6194d62ac465c0d862cb7057f65e0de8ab8a684aa095427a4b8612412eca0d300d22f + languageName: node + linkType: hard + +"serve-static@npm:1.15.0": + version: 1.15.0 + resolution: "serve-static@npm:1.15.0" + dependencies: + encodeurl: ~1.0.2 + escape-html: ~1.0.3 + parseurl: ~1.3.3 + send: 0.18.0 + checksum: af57fc13be40d90a12562e98c0b7855cf6e8bd4c107fe9a45c212bf023058d54a1871b1c89511c3958f70626fff47faeb795f5d83f8cf88514dbaeb2b724464d + languageName: node + linkType: hard + +"set-blocking@npm:^2.0.0": + version: 2.0.0 + resolution: "set-blocking@npm:2.0.0" + checksum: 6e65a05f7cf7ebdf8b7c75b101e18c0b7e3dff4940d480efed8aad3a36a4005140b660fa1d804cb8bce911cac290441dc728084a30504d3516ac2ff7ad607b02 + languageName: node + linkType: hard + +"setimmediate@npm:^1.0.5": + version: 1.0.5 + resolution: "setimmediate@npm:1.0.5" + checksum: c9a6f2c5b51a2dabdc0247db9c46460152ffc62ee139f3157440bd48e7c59425093f42719ac1d7931f054f153e2d26cf37dfeb8da17a794a58198a2705e527fd + languageName: node + linkType: hard + +"setprototypeof@npm:1.1.0": + version: 1.1.0 + resolution: "setprototypeof@npm:1.1.0" + checksum: 27cb44304d6c9e1a23bc6c706af4acaae1a7aa1054d4ec13c05f01a99fd4887109a83a8042b67ad90dbfcd100d43efc171ee036eb080667172079213242ca36e + languageName: node + linkType: hard + +"setprototypeof@npm:1.2.0": + version: 1.2.0 + resolution: "setprototypeof@npm:1.2.0" + checksum: be18cbbf70e7d8097c97f713a2e76edf84e87299b40d085c6bf8b65314e994cc15e2e317727342fa6996e38e1f52c59720b53fe621e2eb593a6847bf0356db89 + languageName: node + linkType: hard + +"sha.js@npm:^2.4.0, sha.js@npm:^2.4.8": + version: 2.4.11 + resolution: "sha.js@npm:2.4.11" + dependencies: + inherits: ^2.0.1 + safe-buffer: ^5.0.1 + bin: + sha.js: ./bin.js + checksum: ebd3f59d4b799000699097dadb831c8e3da3eb579144fd7eb7a19484cbcbb7aca3c68ba2bb362242eb09e33217de3b4ea56e4678184c334323eca24a58e3ad07 + languageName: node + linkType: hard + +"shallow-clone@npm:^3.0.0": + version: 3.0.1 + resolution: "shallow-clone@npm:3.0.1" + dependencies: + kind-of: ^6.0.2 + checksum: 39b3dd9630a774aba288a680e7d2901f5c0eae7b8387fc5c8ea559918b29b3da144b7bdb990d7ccd9e11be05508ac9e459ce51d01fd65e583282f6ffafcba2e7 + languageName: node + linkType: hard + +"shallowequal@npm:^1.1.0": + version: 1.1.0 + resolution: "shallowequal@npm:1.1.0" + checksum: f4c1de0837f106d2dbbfd5d0720a5d059d1c66b42b580965c8f06bb1db684be8783538b684092648c981294bf817869f743a066538771dbecb293df78f765e00 + languageName: node + linkType: hard + +"shebang-command@npm:^2.0.0": + version: 2.0.0 + resolution: "shebang-command@npm:2.0.0" + dependencies: + shebang-regex: ^3.0.0 + checksum: 6b52fe87271c12968f6a054e60f6bde5f0f3d2db483a1e5c3e12d657c488a15474121a1d55cd958f6df026a54374ec38a4a963988c213b7570e1d51575cea7fa + languageName: node + linkType: hard + +"shebang-regex@npm:^3.0.0": + version: 3.0.0 + resolution: "shebang-regex@npm:3.0.0" + checksum: 1a2bcae50de99034fcd92ad4212d8e01eedf52c7ec7830eedcf886622804fe36884278f2be8be0ea5fde3fd1c23911643a4e0f726c8685b61871c8908af01222 + languageName: node + linkType: hard + +"shell-quote@npm:^1.7.3, shell-quote@npm:^1.8.1": + version: 1.8.1 + resolution: "shell-quote@npm:1.8.1" + checksum: 5f01201f4ef504d4c6a9d0d283fa17075f6770bfbe4c5850b074974c68062f37929ca61700d95ad2ac8822e14e8c4b990ca0e6e9272e64befd74ce5e19f0736b + languageName: node + linkType: hard + +"shelljs@npm:^0.8.5": + version: 0.8.5 + resolution: "shelljs@npm:0.8.5" + dependencies: + glob: ^7.0.0 + interpret: ^1.0.0 + rechoir: ^0.6.2 + bin: + shjs: bin/shjs + checksum: 7babc46f732a98f4c054ec1f048b55b9149b98aa2da32f6cf9844c434b43c6251efebd6eec120937bd0999e13811ebd45efe17410edb3ca938f82f9381302748 + languageName: node + linkType: hard + +"shiki@npm:^0.14.1": + version: 0.14.5 + resolution: "shiki@npm:0.14.5" + dependencies: + ansi-sequence-parser: ^1.1.0 + jsonc-parser: ^3.2.0 + vscode-oniguruma: ^1.7.0 + vscode-textmate: ^8.0.0 + checksum: 41d847817cfc9bb6d8bf190316896698d250303656546446659cc02caed8dcc171b10cd113bb5da82425b51d0032e87aafcdc36c3dd61dadc123170b438da736 + languageName: node + linkType: hard + +"side-channel@npm:^1.0.4": + version: 1.0.4 + resolution: "side-channel@npm:1.0.4" + dependencies: + call-bind: ^1.0.0 + get-intrinsic: ^1.0.2 + object-inspect: ^1.9.0 + checksum: 351e41b947079c10bd0858364f32bb3a7379514c399edb64ab3dce683933483fc63fb5e4efe0a15a2e8a7e3c436b6a91736ddb8d8c6591b0460a24bb4a1ee245 + languageName: node + linkType: hard + +"signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": + version: 3.0.7 + resolution: "signal-exit@npm:3.0.7" + checksum: a2f098f247adc367dffc27845853e9959b9e88b01cb301658cfe4194352d8d2bb32e18467c786a7fe15f1d44b233ea35633d076d5e737870b7139949d1ab6318 + languageName: node + linkType: hard + +"signal-exit@npm:^4.0.1": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 64c757b498cb8629ffa5f75485340594d2f8189e9b08700e69199069c8e3070fb3e255f7ab873c05dc0b3cec412aea7402e10a5990cb6a050bd33ba062a6c549 + languageName: node + linkType: hard + +"sirv@npm:^2.0.3": + version: 2.0.3 + resolution: "sirv@npm:2.0.3" + dependencies: + "@polka/url": ^1.0.0-next.20 + mrmime: ^1.0.0 + totalist: ^3.0.0 + checksum: e2dfd4c97735a6ad6d842d0eec2cd9e3919ff0e46f0d228248c5753ad4b70b832711e77e1259c031c439cdb08303cc54d923685c92b0e890145cc733af7c5568 + languageName: node + linkType: hard + +"sisteransi@npm:^1.0.5": + version: 1.0.5 + resolution: "sisteransi@npm:1.0.5" + checksum: aba6438f46d2bfcef94cf112c835ab395172c75f67453fe05c340c770d3c402363018ae1ab4172a1026a90c47eaccf3af7b6ff6fa749a680c2929bd7fa2b37a4 + languageName: node + linkType: hard + +"sitemap@npm:^7.1.1": + version: 7.1.1 + resolution: "sitemap@npm:7.1.1" + dependencies: + "@types/node": ^17.0.5 + "@types/sax": ^1.2.1 + arg: ^5.0.0 + sax: ^1.2.4 + bin: + sitemap: dist/cli.js + checksum: 87a6d21b0d4a33b8c611d3bb8543d02b813c0ebfce014213ef31849b5c1439005644f19ad1593ec89815f6101355f468c9a02c251d09aa03f6fddd17e23c4be4 + languageName: node + linkType: hard + +"slash@npm:^3.0.0": + version: 3.0.0 + resolution: "slash@npm:3.0.0" + checksum: 94a93fff615f25a999ad4b83c9d5e257a7280c90a32a7cb8b4a87996e4babf322e469c42b7f649fd5796edd8687652f3fb452a86dc97a816f01113183393f11c + languageName: node + linkType: hard + +"slash@npm:^4.0.0": + version: 4.0.0 + resolution: "slash@npm:4.0.0" + checksum: da8e4af73712253acd21b7853b7e0dbba776b786e82b010a5bfc8b5051a1db38ed8aba8e1e8f400dd2c9f373be91eb1c42b66e91abb407ff42b10feece5e1d2d + languageName: node + linkType: hard + +"slice-ansi@npm:^4.0.0": + version: 4.0.0 + resolution: "slice-ansi@npm:4.0.0" + dependencies: + ansi-styles: ^4.0.0 + astral-regex: ^2.0.0 + is-fullwidth-code-point: ^3.0.0 + checksum: 4a82d7f085b0e1b070e004941ada3c40d3818563ac44766cca4ceadd2080427d337554f9f99a13aaeb3b4a94d9964d9466c807b3d7b7541d1ec37ee32d308756 + languageName: node + linkType: hard + +"slice-ansi@npm:^5.0.0": + version: 5.0.0 + resolution: "slice-ansi@npm:5.0.0" + dependencies: + ansi-styles: ^6.0.0 + is-fullwidth-code-point: ^4.0.0 + checksum: 7e600a2a55e333a21ef5214b987c8358fe28bfb03c2867ff2cbf919d62143d1812ac27b4297a077fdaf27a03da3678e49551c93e35f9498a3d90221908a1180e + languageName: node + linkType: hard + +"smart-buffer@npm:^4.2.0": + version: 4.2.0 + resolution: "smart-buffer@npm:4.2.0" + checksum: b5167a7142c1da704c0e3af85c402002b597081dd9575031a90b4f229ca5678e9a36e8a374f1814c8156a725d17008ae3bde63b92f9cfd132526379e580bec8b + languageName: node + linkType: hard + +"smol-toml@npm:^1.1.2": + version: 1.1.2 + resolution: "smol-toml@npm:1.1.2" + checksum: aa984b8d7aadb9c7db601533f81bcc0e7b6773fe56b69e87fb06224ac0c22702900b927becf0f5af0250b29746648344b57ecbcc203e82d667d46a19e1a61d77 + languageName: node + linkType: hard + +"sockjs@npm:^0.3.24": + version: 0.3.24 + resolution: "sockjs@npm:0.3.24" + dependencies: + faye-websocket: ^0.11.3 + uuid: ^8.3.2 + websocket-driver: ^0.7.4 + checksum: 355309b48d2c4e9755349daa29cea1c0d9ee23e49b983841c6bf7a20276b00d3c02343f9f33f26d2ee8b261a5a02961b52a25c8da88b2538c5b68d3071b4934c + languageName: node + linkType: hard + +"socks-proxy-agent@npm:^7.0.0": + version: 7.0.0 + resolution: "socks-proxy-agent@npm:7.0.0" + dependencies: + agent-base: ^6.0.2 + debug: ^4.3.3 + socks: ^2.6.2 + checksum: 720554370154cbc979e2e9ce6a6ec6ced205d02757d8f5d93fe95adae454fc187a5cbfc6b022afab850a5ce9b4c7d73e0f98e381879cf45f66317a4895953846 + languageName: node + linkType: hard + +"socks@npm:^2.6.2": + version: 2.7.1 + resolution: "socks@npm:2.7.1" + dependencies: + ip: ^2.0.0 + smart-buffer: ^4.2.0 + checksum: 259d9e3e8e1c9809a7f5c32238c3d4d2a36b39b83851d0f573bfde5f21c4b1288417ce1af06af1452569cd1eb0841169afd4998f0e04ba04656f6b7f0e46d748 + languageName: node + linkType: hard + +"solc@npm:0.7.3": + version: 0.7.3 + resolution: "solc@npm:0.7.3" + dependencies: + command-exists: ^1.2.8 + commander: 3.0.2 + follow-redirects: ^1.12.1 + fs-extra: ^0.30.0 + js-sha3: 0.8.0 + memorystream: ^0.3.1 + require-from-string: ^2.0.0 + semver: ^5.5.0 + tmp: 0.0.33 + bin: + solcjs: solcjs + checksum: 2d8eb16c6d8f648213c94dc8d977cffe5099cba7d41c82d92d769ef71ae8320a985065ce3d6c306440a85f8e8d2b27fb30bdd3ac38f69e5c1fa0ab8a3fb2f217 + languageName: node + linkType: hard + +"sort-css-media-queries@npm:2.1.0": + version: 2.1.0 + resolution: "sort-css-media-queries@npm:2.1.0" + checksum: 25cb8f08b148a2ed83d0bc1cf20ddb888d3dee2a3c986896099a21b28b999d5cca3e46a9ef64381bb36fca0fc820471713f2e8af2729ecc6e108ab2b3b315ea9 + languageName: node + linkType: hard + +"source-map-js@npm:^1.0.2": + version: 1.0.2 + resolution: "source-map-js@npm:1.0.2" + checksum: c049a7fc4deb9a7e9b481ae3d424cc793cb4845daa690bc5a05d428bf41bf231ced49b4cf0c9e77f9d42fdb3d20d6187619fc586605f5eabe995a316da8d377c + languageName: node + linkType: hard + +"source-map-support@npm:^0.5.13, source-map-support@npm:~0.5.20": + version: 0.5.21 + resolution: "source-map-support@npm:0.5.21" + dependencies: + buffer-from: ^1.0.0 + source-map: ^0.6.0 + checksum: 43e98d700d79af1d36f859bdb7318e601dfc918c7ba2e98456118ebc4c4872b327773e5a1df09b0524e9e5063bb18f0934538eace60cca2710d1fa687645d137 + languageName: node + linkType: hard + +"source-map@npm:^0.5.0": + version: 0.5.7 + resolution: "source-map@npm:0.5.7" + checksum: 5dc2043b93d2f194142c7f38f74a24670cd7a0063acdaf4bf01d2964b402257ae843c2a8fa822ad5b71013b5fcafa55af7421383da919752f22ff488bc553f4d + languageName: node + linkType: hard + +"source-map@npm:^0.6.0, source-map@npm:^0.6.1, source-map@npm:~0.6.0": + version: 0.6.1 + resolution: "source-map@npm:0.6.1" + checksum: 59ce8640cf3f3124f64ac289012c2b8bd377c238e316fb323ea22fbfe83da07d81e000071d7242cad7a23cd91c7de98e4df8830ec3f133cb6133a5f6e9f67bc2 + languageName: node + linkType: hard + +"source-map@npm:^0.7.3": + version: 0.7.4 + resolution: "source-map@npm:0.7.4" + checksum: 01cc5a74b1f0e1d626a58d36ad6898ea820567e87f18dfc9d24a9843a351aaa2ec09b87422589906d6ff1deed29693e176194dc88bcae7c9a852dc74b311dbf5 + languageName: node + linkType: hard + +"space-separated-tokens@npm:^1.0.0": + version: 1.1.5 + resolution: "space-separated-tokens@npm:1.1.5" + checksum: 8ef68f1cfa8ccad316b7f8d0df0919d0f1f6d32101e8faeee34ea3a923ce8509c1ad562f57388585ee4951e92d27afa211ed0a077d3d5995b5ba9180331be708 + languageName: node + linkType: hard + +"spdy-transport@npm:^3.0.0": + version: 3.0.0 + resolution: "spdy-transport@npm:3.0.0" + dependencies: + debug: ^4.1.0 + detect-node: ^2.0.4 + hpack.js: ^2.1.6 + obuf: ^1.1.2 + readable-stream: ^3.0.6 + wbuf: ^1.7.3 + checksum: 0fcaad3b836fb1ec0bdd39fa7008b9a7a84a553f12be6b736a2512613b323207ffc924b9551cef0378f7233c85916cff1118652e03a730bdb97c0e042243d56c + languageName: node + linkType: hard + +"spdy@npm:^4.0.2": + version: 4.0.2 + resolution: "spdy@npm:4.0.2" + dependencies: + debug: ^4.1.0 + handle-thing: ^2.0.0 + http-deceiver: ^1.2.7 + select-hose: ^2.0.0 + spdy-transport: ^3.0.0 + checksum: 2c739d0ff6f56ad36d2d754d0261d5ec358457bea7cbf77b1b05b0c6464f2ce65b85f196305f50b7bd9120723eb94bae9933466f28e67e5cd8cde4e27f1d75f8 + languageName: node + linkType: hard + +"split@npm:0.3": + version: 0.3.3 + resolution: "split@npm:0.3.3" + dependencies: + through: 2 + checksum: 2e076634c9637cfdc54ab4387b6a243b8c33b360874a25adf6f327a5647f07cb3bf1c755d515248eb3afee4e382278d01f62c62d87263c118f28065b86f74f02 + languageName: node + linkType: hard + +"sprintf-js@npm:~1.0.2": + version: 1.0.3 + resolution: "sprintf-js@npm:1.0.3" + checksum: 19d79aec211f09b99ec3099b5b2ae2f6e9cdefe50bc91ac4c69144b6d3928a640bb6ae5b3def70c2e85a2c3d9f5ec2719921e3a59d3ca3ef4b2fd1a4656a0df3 + languageName: node + linkType: hard + +"ssri@npm:^10.0.0": + version: 10.0.5 + resolution: "ssri@npm:10.0.5" + dependencies: + minipass: ^7.0.3 + checksum: 0a31b65f21872dea1ed3f7c200d7bc1c1b91c15e419deca14f282508ba917cbb342c08a6814c7f68ca4ca4116dd1a85da2bbf39227480e50125a1ceffeecb750 + languageName: node + linkType: hard + +"stable@npm:^0.1.8": + version: 0.1.8 + resolution: "stable@npm:0.1.8" + checksum: 2ff482bb100285d16dd75cd8f7c60ab652570e8952c0bfa91828a2b5f646a0ff533f14596ea4eabd48bb7f4aeea408dce8f8515812b975d958a4cc4fa6b9dfeb + languageName: node + linkType: hard + +"stack-utils@npm:^2.0.6": + version: 2.0.6 + resolution: "stack-utils@npm:2.0.6" + dependencies: + escape-string-regexp: ^2.0.0 + checksum: 052bf4d25bbf5f78e06c1d5e67de2e088b06871fa04107ca8d3f0e9d9263326e2942c8bedee3545795fc77d787d443a538345eef74db2f8e35db3558c6f91ff7 + languageName: node + linkType: hard + +"stacktrace-parser@npm:^0.1.10": + version: 0.1.10 + resolution: "stacktrace-parser@npm:0.1.10" + dependencies: + type-fest: ^0.7.1 + checksum: f4fbddfc09121d91e587b60de4beb4941108e967d71ad3a171812dc839b010ca374d064ad0a296295fed13acd103609d99a4224a25b4e67de13cae131f1901ee + languageName: node + linkType: hard + +"state-toggle@npm:^1.0.0": + version: 1.0.3 + resolution: "state-toggle@npm:1.0.3" + checksum: 17398af928413e8d8b866cf0c81fd1b1348bb7d65d8983126ff6ff2317a80d6ee023484fba0c54d8169f5aa544f125434a650ae3a71eddc935cae307d4692b4f + languageName: node + linkType: hard + +"statuses@npm:2.0.1": + version: 2.0.1 + resolution: "statuses@npm:2.0.1" + checksum: 18c7623fdb8f646fb213ca4051be4df7efb3484d4ab662937ca6fbef7ced9b9e12842709872eb3020cc3504b93bde88935c9f6417489627a7786f24f8031cbcb + languageName: node + linkType: hard + +"statuses@npm:>= 1.4.0 < 2, statuses@npm:>= 1.5.0 < 2, statuses@npm:^1.5.0": + version: 1.5.0 + resolution: "statuses@npm:1.5.0" + checksum: c469b9519de16a4bb19600205cffb39ee471a5f17b82589757ca7bd40a8d92ebb6ed9f98b5a540c5d302ccbc78f15dc03cc0280dd6e00df1335568a5d5758a5c + languageName: node + linkType: hard + +"std-env@npm:^3.0.1": + version: 3.4.3 + resolution: "std-env@npm:3.4.3" + checksum: bef186fb2baddda31911234b1e58fa18f181eb6930616aaec3b54f6d5db65f2da5daaa5f3b326b98445a7d50ca81d6fe8809ab4ebab85ecbe4a802f1b40921bf + languageName: node + linkType: hard + +"stream-combiner@npm:~0.0.4": + version: 0.0.4 + resolution: "stream-combiner@npm:0.0.4" + dependencies: + duplexer: ~0.1.1 + checksum: 844b622cfe8b9de45a6007404f613b60aaf85200ab9862299066204242f89a7c8033b1c356c998aa6cfc630f6cd9eba119ec1c6dc1f93e245982be4a847aee7d + languageName: node + linkType: hard + +"stream-read-all@npm:^3.0.1": + version: 3.0.1 + resolution: "stream-read-all@npm:3.0.1" + checksum: 40d3c286837f1b1ae7e8105959804ad42fda00f2c087722d981cb1c9fbbea892b8a0a7ca1cf6a016c96770151a6201a3da5c8b66fe35e35106b52a5e9ab90e3e + languageName: node + linkType: hard + +"string-format@npm:^2.0.0": + version: 2.0.0 + resolution: "string-format@npm:2.0.0" + checksum: dada2ef95f6d36c66562c673d95315f80457fa7dce2f3609a2e75d1190b98c88319028cf0a5b6c043d01c18d581b2641579f79480584ba030d6ac6fceb30bc55 + languageName: node + linkType: hard + +"string-to-stream@npm:^3.0.1": + version: 3.0.1 + resolution: "string-to-stream@npm:3.0.1" + dependencies: + readable-stream: ^3.4.0 + checksum: e8ac7f7497f8f101196e39dd529e98bb97165c532cc4cae5003083a420db62f46ffd67ddff7112b45f9f8d0f9ff1cc6cda9b06362236d43fa6b1685e8b0d446e + languageName: node + linkType: hard + +"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.2, string-width@npm:^4.2.3": + version: 4.2.3 + resolution: "string-width@npm:4.2.3" + dependencies: + emoji-regex: ^8.0.0 + is-fullwidth-code-point: ^3.0.0 + strip-ansi: ^6.0.1 + checksum: e52c10dc3fbfcd6c3a15f159f54a90024241d0f149cf8aed2982a2d801d2e64df0bf1dc351cf8e95c3319323f9f220c16e740b06faecd53e2462df1d2b5443fb + languageName: node + linkType: hard + +"string-width@npm:^5.0.0, string-width@npm:^5.0.1, string-width@npm:^5.1.2": + version: 5.1.2 + resolution: "string-width@npm:5.1.2" + dependencies: + eastasianwidth: ^0.2.0 + emoji-regex: ^9.2.2 + strip-ansi: ^7.0.1 + checksum: 7369deaa29f21dda9a438686154b62c2c5f661f8dda60449088f9f980196f7908fc39fdd1803e3e01541970287cf5deae336798337e9319a7055af89dafa7193 + languageName: node + linkType: hard + +"string_decoder@npm:^1.1.1": + version: 1.3.0 + resolution: "string_decoder@npm:1.3.0" + dependencies: + safe-buffer: ~5.2.0 + checksum: 8417646695a66e73aefc4420eb3b84cc9ffd89572861fe004e6aeb13c7bc00e2f616247505d2dbbef24247c372f70268f594af7126f43548565c68c117bdeb56 + languageName: node + linkType: hard + +"string_decoder@npm:~1.1.1": + version: 1.1.1 + resolution: "string_decoder@npm:1.1.1" + dependencies: + safe-buffer: ~5.1.0 + checksum: 9ab7e56f9d60a28f2be697419917c50cac19f3e8e6c28ef26ed5f4852289fe0de5d6997d29becf59028556f2c62983790c1d9ba1e2a3cc401768ca12d5183a5b + languageName: node + linkType: hard + +"stringify-object@npm:^3.3.0": + version: 3.3.0 + resolution: "stringify-object@npm:3.3.0" + dependencies: + get-own-enumerable-property-symbols: ^3.0.0 + is-obj: ^1.0.1 + is-regexp: ^1.0.0 + checksum: 6827a3f35975cfa8572e8cd3ed4f7b262def260af18655c6fde549334acdac49ddba69f3c861ea5a6e9c5a4990fe4ae870b9c0e6c31019430504c94a83b7a154 + languageName: node + linkType: hard + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1, strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": + version: 6.0.1 + resolution: "strip-ansi@npm:6.0.1" + dependencies: + ansi-regex: ^5.0.1 + checksum: f3cd25890aef3ba6e1a74e20896c21a46f482e93df4a06567cebf2b57edabb15133f1f94e57434e0a958d61186087b1008e89c94875d019910a213181a14fc8c + languageName: node + linkType: hard + +"strip-ansi@npm:^7.0.1": + version: 7.1.0 + resolution: "strip-ansi@npm:7.1.0" + dependencies: + ansi-regex: ^6.0.1 + checksum: 859c73fcf27869c22a4e4d8c6acfe690064659e84bef9458aa6d13719d09ca88dcfd40cbf31fd0be63518ea1a643fe070b4827d353e09533a5b0b9fd4553d64d + languageName: node + linkType: hard + +"strip-bom-string@npm:^1.0.0": + version: 1.0.0 + resolution: "strip-bom-string@npm:1.0.0" + checksum: 5635a3656d8512a2c194d6c8d5dee7ef0dde6802f7be9413b91e201981ad4132506656d9cf14137f019fd50f0269390d91c7f6a2601b1bee039a4859cfce4934 + languageName: node + linkType: hard + +"strip-final-newline@npm:^2.0.0": + version: 2.0.0 + resolution: "strip-final-newline@npm:2.0.0" + checksum: 69412b5e25731e1938184b5d489c32e340605bb611d6140344abc3421b7f3c6f9984b21dff296dfcf056681b82caa3bb4cc996a965ce37bcfad663e92eae9c64 + languageName: node + linkType: hard + +"strip-final-newline@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-final-newline@npm:3.0.0" + checksum: 23ee263adfa2070cd0f23d1ac14e2ed2f000c9b44229aec9c799f1367ec001478469560abefd00c5c99ee6f0b31c137d53ec6029c53e9f32a93804e18c201050 + languageName: node + linkType: hard + +"strip-hex-prefix@npm:1.0.0": + version: 1.0.0 + resolution: "strip-hex-prefix@npm:1.0.0" + dependencies: + is-hex-prefixed: 1.0.0 + checksum: 4cafe7caee1d281d3694d14920fd5d3c11adf09371cef7e2ccedd5b83efd9e9bd2219b5d6ce6e809df6e0f437dc9d30db1192116580875698aad164a6d6b285b + languageName: node + linkType: hard + +"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.1": + version: 3.1.1 + resolution: "strip-json-comments@npm:3.1.1" + checksum: 492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443 + languageName: node + linkType: hard + +"strip-json-comments@npm:~2.0.1": + version: 2.0.1 + resolution: "strip-json-comments@npm:2.0.1" + checksum: 1074ccb63270d32ca28edfb0a281c96b94dc679077828135141f27d52a5a398ef5e78bcf22809d23cadc2b81dfbe345eb5fd8699b385c8b1128907dec4a7d1e1 + languageName: node + linkType: hard + +"style-to-object@npm:0.3.0, style-to-object@npm:^0.3.0": + version: 0.3.0 + resolution: "style-to-object@npm:0.3.0" + dependencies: + inline-style-parser: 0.1.1 + checksum: 4d7084015207f2a606dfc10c29cb5ba569f2fe8005551df7396110dd694d6ff650f2debafa95bd5d147dfb4ca50f57868e2a7f91bf5d11ef734fe7ccbd7abf59 + languageName: node + linkType: hard + +"stylehacks@npm:^5.1.1": + version: 5.1.1 + resolution: "stylehacks@npm:5.1.1" + dependencies: + browserslist: ^4.21.4 + postcss-selector-parser: ^6.0.4 + peerDependencies: + postcss: ^8.2.15 + checksum: 11175366ef52de65bf06cefba0ddc9db286dc3a1451fd2989e74c6ea47091a02329a4bf6ce10b1a36950056927b6bbbe47c5ab3a1f4c7032df932d010fbde5a2 + languageName: node + linkType: hard + +"superstruct@npm:^1.0.3": + version: 1.0.3 + resolution: "superstruct@npm:1.0.3" + checksum: 761790bb111e6e21ddd608299c252f3be35df543263a7ebbc004e840d01fcf8046794c274bcb351bdf3eae4600f79d317d085cdbb19ca05803a4361840cc9bb1 + languageName: node + linkType: hard + +"supertap@npm:^3.0.1": + version: 3.0.1 + resolution: "supertap@npm:3.0.1" + dependencies: + indent-string: ^5.0.0 + js-yaml: ^3.14.1 + serialize-error: ^7.0.1 + strip-ansi: ^7.0.1 + checksum: ee3d71c1d25f7f15d4a849e72b0c5f430df7cd8f702cf082fdbec5642a9546be6557766745655fa3a3e9c88f7c7eed849f2d74457b5b72cb9d94a779c0c8a948 + languageName: node + linkType: hard + +"supports-color@npm:8.1.1, supports-color@npm:^8.0.0": + version: 8.1.1 + resolution: "supports-color@npm:8.1.1" + dependencies: + has-flag: ^4.0.0 + checksum: c052193a7e43c6cdc741eb7f378df605636e01ad434badf7324f17fb60c69a880d8d8fcdcb562cf94c2350e57b937d7425ab5b8326c67c2adc48f7c87c1db406 + languageName: node + linkType: hard + +"supports-color@npm:^5.3.0": + version: 5.5.0 + resolution: "supports-color@npm:5.5.0" + dependencies: + has-flag: ^3.0.0 + checksum: 95f6f4ba5afdf92f495b5a912d4abee8dcba766ae719b975c56c084f5004845f6f5a5f7769f52d53f40e21952a6d87411bafe34af4a01e65f9926002e38e1dac + languageName: node + linkType: hard + +"supports-color@npm:^7.1.0": + version: 7.2.0 + resolution: "supports-color@npm:7.2.0" + dependencies: + has-flag: ^4.0.0 + checksum: 3dda818de06ebbe5b9653e07842d9479f3555ebc77e9a0280caf5a14fb877ffee9ed57007c3b78f5a6324b8dbeec648d9e97a24e2ed9fdb81ddc69ea07100f4a + languageName: node + linkType: hard + +"supports-preserve-symlinks-flag@npm:^1.0.0": + version: 1.0.0 + resolution: "supports-preserve-symlinks-flag@npm:1.0.0" + checksum: 53b1e247e68e05db7b3808b99b892bd36fb096e6fba213a06da7fab22045e97597db425c724f2bbd6c99a3c295e1e73f3e4de78592289f38431049e1277ca0ae + languageName: node + linkType: hard + +"svg-parser@npm:^2.0.4": + version: 2.0.4 + resolution: "svg-parser@npm:2.0.4" + checksum: b3de6653048212f2ae7afe4a423e04a76ec6d2d06e1bf7eacc618a7c5f7df7faa5105561c57b94579ec831fbbdbf5f190ba56a9205ff39ed13eabdf8ab086ddf + languageName: node + linkType: hard + +"svgo@npm:^2.7.0, svgo@npm:^2.8.0": + version: 2.8.0 + resolution: "svgo@npm:2.8.0" + dependencies: + "@trysound/sax": 0.2.0 + commander: ^7.2.0 + css-select: ^4.1.3 + css-tree: ^1.1.3 + csso: ^4.2.0 + picocolors: ^1.0.0 + stable: ^0.1.8 + bin: + svgo: bin/svgo + checksum: b92f71a8541468ffd0b81b8cdb36b1e242eea320bf3c1a9b2c8809945853e9d8c80c19744267eb91cabf06ae9d5fff3592d677df85a31be4ed59ff78534fa420 + languageName: node + linkType: hard + +"synckit@npm:^0.8.5": + version: 0.8.5 + resolution: "synckit@npm:0.8.5" + dependencies: + "@pkgr/utils": ^2.3.1 + tslib: ^2.5.0 + checksum: 8a9560e5d8f3d94dc3cf5f7b9c83490ffa30d320093560a37b88f59483040771fd1750e76b9939abfbb1b5a23fd6dfbae77f6b338abffe7cae7329cd9b9bb86b + languageName: node + linkType: hard + +"table-layout@npm:^1.0.2": + version: 1.0.2 + resolution: "table-layout@npm:1.0.2" + dependencies: + array-back: ^4.0.1 + deep-extend: ~0.6.0 + typical: ^5.2.0 + wordwrapjs: ^4.0.0 + checksum: 8f41b5671f101a5195747ec1727b1d35ea2cd5bf85addda11cc2f4b36892db9696ce3c2c7334b5b8a122505b34d19135fede50e25678df71b0439e0704fd953f + languageName: node + linkType: hard + +"table-layout@npm:^3.0.0": + version: 3.0.2 + resolution: "table-layout@npm:3.0.2" + dependencies: + "@75lb/deep-merge": ^1.1.1 + array-back: ^6.2.2 + command-line-args: ^5.2.1 + command-line-usage: ^7.0.0 + stream-read-all: ^3.0.1 + typical: ^7.1.1 + wordwrapjs: ^5.1.0 + bin: + table-layout: bin/cli.js + checksum: 2d4c538f224e64321d35788dbf78305cc1d138a3508e1a29f33e4f6b00bd082990a45dc85fd92948213f48ed8c0b3599155c2a05de412661ff020635e0db3762 + languageName: node + linkType: hard + +"tapable@npm:^1.0.0": + version: 1.1.3 + resolution: "tapable@npm:1.1.3" + checksum: 53ff4e7c3900051c38cc4faab428ebfd7e6ad0841af5a7ac6d5f3045c5b50e88497bfa8295b4b3fbcadd94993c9e358868b78b9fb249a76cb8b018ac8dccafd7 + languageName: node + linkType: hard + +"tapable@npm:^2.0.0, tapable@npm:^2.1.1, tapable@npm:^2.2.0": + version: 2.2.1 + resolution: "tapable@npm:2.2.1" + checksum: 3b7a1b4d86fa940aad46d9e73d1e8739335efd4c48322cb37d073eb6f80f5281889bf0320c6d8ffcfa1a0dd5bfdbd0f9d037e252ef972aca595330538aac4d51 + languageName: node + linkType: hard + +"tar-fs@npm:2.1.1": + version: 2.1.1 + resolution: "tar-fs@npm:2.1.1" + dependencies: + chownr: ^1.1.1 + mkdirp-classic: ^0.5.2 + pump: ^3.0.0 + tar-stream: ^2.1.4 + checksum: f5b9a70059f5b2969e65f037b4e4da2daf0fa762d3d232ffd96e819e3f94665dbbbe62f76f084f1acb4dbdcce16c6e4dac08d12ffc6d24b8d76720f4d9cf032d + languageName: node + linkType: hard + +"tar-stream@npm:^2.1.4": + version: 2.2.0 + resolution: "tar-stream@npm:2.2.0" + dependencies: + bl: ^4.0.3 + end-of-stream: ^1.4.1 + fs-constants: ^1.0.0 + inherits: ^2.0.3 + readable-stream: ^3.1.1 + checksum: 699831a8b97666ef50021c767f84924cfee21c142c2eb0e79c63254e140e6408d6d55a065a2992548e72b06de39237ef2b802b99e3ece93ca3904a37622a66f3 + languageName: node + linkType: hard + +"tar@npm:^6.1.11, tar@npm:^6.1.2": + version: 6.2.0 + resolution: "tar@npm:6.2.0" + dependencies: + chownr: ^2.0.0 + fs-minipass: ^2.0.0 + minipass: ^5.0.0 + minizlib: ^2.1.1 + mkdirp: ^1.0.3 + yallist: ^4.0.0 + checksum: db4d9fe74a2082c3a5016630092c54c8375ff3b280186938cfd104f2e089c4fd9bad58688ef6be9cf186a889671bf355c7cda38f09bbf60604b281715ca57f5c + languageName: node + linkType: hard + +"temp-dir@npm:^3.0.0": + version: 3.0.0 + resolution: "temp-dir@npm:3.0.0" + checksum: 577211e995d1d584dd60f1469351d45e8a5b4524e4a9e42d3bdd12cfde1d0bb8f5898311bef24e02aaafb69514c1feb58c7b4c33dcec7129da3b0861a4ca935b + languageName: node + linkType: hard + +"terser-webpack-plugin@npm:^5.3.3, terser-webpack-plugin@npm:^5.3.7": + version: 5.3.9 + resolution: "terser-webpack-plugin@npm:5.3.9" + dependencies: + "@jridgewell/trace-mapping": ^0.3.17 + jest-worker: ^27.4.5 + schema-utils: ^3.1.1 + serialize-javascript: ^6.0.1 + terser: ^5.16.8 + peerDependencies: + webpack: ^5.1.0 + peerDependenciesMeta: + "@swc/core": + optional: true + esbuild: + optional: true + uglify-js: + optional: true + checksum: 41705713d6f9cb83287936b21e27c658891c78c4392159f5148b5623f0e8c48559869779619b058382a4c9758e7820ea034695e57dc7c474b4962b79f553bc5f + languageName: node + linkType: hard + +"terser@npm:^5.10.0, terser@npm:^5.16.8": + version: 5.21.0 + resolution: "terser@npm:5.21.0" + dependencies: + "@jridgewell/source-map": ^0.3.3 + acorn: ^8.8.2 + commander: ^2.20.0 + source-map-support: ~0.5.20 + bin: + terser: bin/terser + checksum: 130f1567af1ffa4ddb067651bb284a01b45b5c83e82b3a072a5ff94b0b00ac35090f89c8714631a4a45972f65187bc149fc7144380611f437e1e3d9e174b136b + languageName: node + linkType: hard + +"text-table@npm:^0.2.0": + version: 0.2.0 + resolution: "text-table@npm:0.2.0" + checksum: b6937a38c80c7f84d9c11dd75e49d5c44f71d95e810a3250bd1f1797fc7117c57698204adf676b71497acc205d769d65c16ae8fa10afad832ae1322630aef10a + languageName: node + linkType: hard + +"through@npm:2, through@npm:^2.3.8, through@npm:~2.3, through@npm:~2.3.1": + version: 2.3.8 + resolution: "through@npm:2.3.8" + checksum: a38c3e059853c494af95d50c072b83f8b676a9ba2818dcc5b108ef252230735c54e0185437618596c790bbba8fcdaef5b290405981ffa09dce67b1f1bf190cbd + languageName: node + linkType: hard + +"thunky@npm:^1.0.2": + version: 1.1.0 + resolution: "thunky@npm:1.1.0" + checksum: 993096c472b6b8f30e29dc777a8d17720e4cab448375041f20c0cb802a09a7fb2217f2a3e8cdc11851faa71c957e2db309357367fc9d7af3cb7a4d00f4b66034 + languageName: node + linkType: hard + +"time-zone@npm:^1.0.0": + version: 1.0.0 + resolution: "time-zone@npm:1.0.0" + checksum: e46f5a69b8c236dcd8e91e29d40d4e7a3495ed4f59888c3f84ce1d9678e20461421a6ba41233509d47dd94bc18f1a4377764838b21b584663f942b3426dcbce8 + languageName: node + linkType: hard + +"tiny-invariant@npm:^1.0.2": + version: 1.3.1 + resolution: "tiny-invariant@npm:1.3.1" + checksum: 872dbd1ff20a21303a2fd20ce3a15602cfa7fcf9b228bd694a52e2938224313b5385a1078cb667ed7375d1612194feaca81c4ecbe93121ca1baebe344de4f84c + languageName: node + linkType: hard + +"tiny-warning@npm:^1.0.0": + version: 1.0.3 + resolution: "tiny-warning@npm:1.0.3" + checksum: da62c4acac565902f0624b123eed6dd3509bc9a8d30c06e017104bedcf5d35810da8ff72864400ad19c5c7806fc0a8323c68baf3e326af7cb7d969f846100d71 + languageName: node + linkType: hard + +"titleize@npm:^3.0.0": + version: 3.0.0 + resolution: "titleize@npm:3.0.0" + checksum: 71fbbeabbfb36ccd840559f67f21e356e1d03da2915b32d2ae1a60ddcc13a124be2739f696d2feb884983441d159a18649e8d956648d591bdad35c430a6b6d28 + languageName: node + linkType: hard + +"tmp@npm:0.0.33": + version: 0.0.33 + resolution: "tmp@npm:0.0.33" + dependencies: + os-tmpdir: ~1.0.2 + checksum: 902d7aceb74453ea02abbf58c203f4a8fc1cead89b60b31e354f74ed5b3fb09ea817f94fb310f884a5d16987dd9fa5a735412a7c2dd088dd3d415aa819ae3a28 + languageName: node + linkType: hard + +"to-fast-properties@npm:^2.0.0": + version: 2.0.0 + resolution: "to-fast-properties@npm:2.0.0" + checksum: be2de62fe58ead94e3e592680052683b1ec986c72d589e7b21e5697f8744cdbf48c266fa72f6c15932894c10187b5f54573a3bcf7da0bfd964d5caf23d436168 + languageName: node + linkType: hard + +"to-readable-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "to-readable-stream@npm:1.0.0" + checksum: 2bd7778490b6214a2c40276065dd88949f4cf7037ce3964c76838b8cb212893aeb9cceaaf4352a4c486e3336214c350270f3263e1ce7a0c38863a715a4d9aeb5 + languageName: node + linkType: hard + +"to-regex-range@npm:^5.0.1": + version: 5.0.1 + resolution: "to-regex-range@npm:5.0.1" + dependencies: + is-number: ^7.0.0 + checksum: f76fa01b3d5be85db6a2a143e24df9f60dd047d151062d0ba3df62953f2f697b16fe5dad9b0ac6191c7efc7b1d9dcaa4b768174b7b29da89d4428e64bc0a20ed + languageName: node + linkType: hard + +"toidentifier@npm:1.0.1": + version: 1.0.1 + resolution: "toidentifier@npm:1.0.1" + checksum: 952c29e2a85d7123239b5cfdd889a0dde47ab0497f0913d70588f19c53f7e0b5327c95f4651e413c74b785147f9637b17410ac8c846d5d4a20a5a33eb6dc3a45 + languageName: node + linkType: hard + +"toml@npm:^3.0.0": + version: 3.0.0 + resolution: "toml@npm:3.0.0" + checksum: 5d7f1d8413ad7780e9bdecce8ea4c3f5130dd53b0a4f2e90b93340979a137739879d7b9ce2ce05c938b8cc828897fe9e95085197342a1377dd8850bf5125f15f + languageName: node + linkType: hard + +"totalist@npm:^3.0.0": + version: 3.0.1 + resolution: "totalist@npm:3.0.1" + checksum: 5132d562cf88ff93fd710770a92f31dbe67cc19b5c6ccae2efc0da327f0954d211bbfd9456389655d726c624f284b4a23112f56d1da931ca7cfabbe1f45e778a + languageName: node + linkType: hard + +"tr46@npm:^3.0.0": + version: 3.0.0 + resolution: "tr46@npm:3.0.0" + dependencies: + punycode: ^2.1.1 + checksum: 44c3cc6767fb800490e6e9fd64fd49041aa4e49e1f6a012b34a75de739cc9ed3a6405296072c1df8b6389ae139c5e7c6496f659cfe13a04a4bff3a1422981270 + languageName: node + linkType: hard + +"tr46@npm:~0.0.3": + version: 0.0.3 + resolution: "tr46@npm:0.0.3" + checksum: 726321c5eaf41b5002e17ffbd1fb7245999a073e8979085dacd47c4b4e8068ff5777142fc6726d6ca1fd2ff16921b48788b87225cbc57c72636f6efa8efbffe3 + languageName: node + linkType: hard + +"trim-trailing-lines@npm:^1.0.0": + version: 1.1.4 + resolution: "trim-trailing-lines@npm:1.1.4" + checksum: 5d39d21c0d4b258667012fcd784f73129e148ea1c213b1851d8904f80499fc91df6710c94c7dd49a486a32da2b9cb86020dda79f285a9a2586cfa622f80490c2 + languageName: node + linkType: hard + +"trim@npm:0.0.1": + version: 0.0.1 + resolution: "trim@npm:0.0.1" + checksum: 2b4646dff99a222e8e1526edd4e3a43bbd925af0b8e837c340455d250157e7deefaa4da49bb891ab841e5c27b1afc5e9e32d4b57afb875d2dfcabf4e319b8f7f + languageName: node + linkType: hard + +"trough@npm:^1.0.0": + version: 1.0.5 + resolution: "trough@npm:1.0.5" + checksum: d6c8564903ed00e5258bab92134b020724dbbe83148dc72e4bf6306c03ed8843efa1bcc773fa62410dd89161ecb067432dd5916501793508a9506cacbc408e25 + languageName: node + linkType: hard + +"ts-api-utils@npm:^1.0.1": + version: 1.0.3 + resolution: "ts-api-utils@npm:1.0.3" + peerDependencies: + typescript: ">=4.2.0" + checksum: 441cc4489d65fd515ae6b0f4eb8690057add6f3b6a63a36073753547fb6ce0c9ea0e0530220a0b282b0eec535f52c4dfc315d35f8a4c9a91c0def0707a714ca6 + languageName: node + linkType: hard + +"ts-command-line-args@npm:^2.5.1": + version: 2.5.1 + resolution: "ts-command-line-args@npm:2.5.1" + dependencies: + chalk: ^4.1.0 + command-line-args: ^5.1.1 + command-line-usage: ^6.1.0 + string-format: ^2.0.0 + bin: + write-markdown: dist/write-markdown.js + checksum: 7c0a7582e94f1d2160e3dd379851ec4f1758bc673ccd71bae07f839f83051b6b83e0ae14325c2d04ea728e5bde7b7eacfd2ab060b8fd4b8ab29e0bbf77f6c51e + languageName: node + linkType: hard + +"ts-node@npm:^10.9.1": + version: 10.9.1 + resolution: "ts-node@npm:10.9.1" + dependencies: + "@cspotcode/source-map-support": ^0.8.0 + "@tsconfig/node10": ^1.0.7 + "@tsconfig/node12": ^1.0.7 + "@tsconfig/node14": ^1.0.0 + "@tsconfig/node16": ^1.0.2 + acorn: ^8.4.1 + acorn-walk: ^8.1.1 + arg: ^4.1.0 + create-require: ^1.1.0 + diff: ^4.0.1 + make-error: ^1.1.1 + v8-compile-cache-lib: ^3.0.1 + yn: 3.1.1 + peerDependencies: + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" + peerDependenciesMeta: + "@swc/core": + optional: true + "@swc/wasm": + optional: true + bin: + ts-node: dist/bin.js + ts-node-cwd: dist/bin-cwd.js + ts-node-esm: dist/bin-esm.js + ts-node-script: dist/bin-script.js + ts-node-transpile-only: dist/bin-transpile.js + ts-script: dist/bin-script-deprecated.js + checksum: 090adff1302ab20bd3486e6b4799e90f97726ed39e02b39e566f8ab674fd5bd5f727f43615debbfc580d33c6d9d1c6b1b3ce7d8e3cca3e20530a145ffa232c35 + languageName: node + linkType: hard + +"tsc-multi@npm:^1.1.0": + version: 1.1.0 + resolution: "tsc-multi@npm:1.1.0" + dependencies: + debug: ^4.3.4 + fast-glob: ^3.2.12 + get-stdin: ^8.0.0 + p-all: ^3.0.0 + picocolors: ^1.0.0 + signal-exit: ^3.0.7 + string-to-stream: ^3.0.1 + superstruct: ^1.0.3 + tslib: ^2.5.0 + yargs: ^17.7.1 + peerDependencies: + typescript: ">=4.3.0" + bin: + tsc-multi: bin/tsc-multi.js + checksum: a82c0358611ac15667aa148ade33b6ad64cc0a94299fb9afc01e3e6224a994dff8812960a43643f25e4c0dac8419707027c3096d0e60bff3522591c06d5f4eeb + languageName: node + linkType: hard + +"tslib@npm:2.4.0": + version: 2.4.0 + resolution: "tslib@npm:2.4.0" + checksum: 8c4aa6a3c5a754bf76aefc38026134180c053b7bd2f81338cb5e5ebf96fefa0f417bff221592bf801077f5bf990562f6264fecbc42cd3309b33872cb6fc3b113 + languageName: node + linkType: hard + +"tslib@npm:^1.9.3": + version: 1.14.1 + resolution: "tslib@npm:1.14.1" + checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd + languageName: node + linkType: hard + +"tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.4.0, tslib@npm:^2.5.0, tslib@npm:^2.6.0": + version: 2.6.2 + resolution: "tslib@npm:2.6.2" + checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad + languageName: node + linkType: hard + +"tslog@npm:^4.9.2": + version: 4.9.2 + resolution: "tslog@npm:4.9.2" + checksum: 702e45647a68b127d63c5eb63a0f322af8d01f17b689127d32238d6ca2ef76889648a00b88c040430e3126acedef070022b20ebd81823879ba3766cf5188c868 + languageName: node + linkType: hard + +"tsort@npm:0.0.1": + version: 0.0.1 + resolution: "tsort@npm:0.0.1" + checksum: 581566c248690b9ea7e431e1545affb3d2cab0f5dcd0e45ddef815dfaec4864cb5f0cfd8072924dedbc0de9585ff07e3e65db60f14fab4123737b9bb6e72eacc + languageName: node + linkType: hard + +"tsscmp@npm:1.0.6": + version: 1.0.6 + resolution: "tsscmp@npm:1.0.6" + checksum: 1512384def36bccc9125cabbd4c3b0e68608d7ee08127ceaa0b84a71797263f1a01c7f82fa69be8a3bd3c1396e2965d2f7b52d581d3a5eeaf3967fbc52e3b3bf + languageName: node + linkType: hard + +"tweetnacl-util@npm:^0.15.1": + version: 0.15.1 + resolution: "tweetnacl-util@npm:0.15.1" + checksum: ae6aa8a52cdd21a95103a4cc10657d6a2040b36c7a6da7b9d3ab811c6750a2d5db77e8c36969e75fdee11f511aa2b91c552496c6e8e989b6e490e54aca2864fc + languageName: node + linkType: hard + +"tweetnacl@npm:^1.0.3": + version: 1.0.3 + resolution: "tweetnacl@npm:1.0.3" + checksum: e4a57cac188f0c53f24c7a33279e223618a2bfb5fea426231991652a13247bea06b081fd745d71291fcae0f4428d29beba1b984b1f1ce6f66b06a6d1ab90645c + languageName: node + linkType: hard + +"type-check@npm:^0.4.0, type-check@npm:~0.4.0": + version: 0.4.0 + resolution: "type-check@npm:0.4.0" + dependencies: + prelude-ls: ^1.2.1 + checksum: ec688ebfc9c45d0c30412e41ca9c0cdbd704580eb3a9ccf07b9b576094d7b86a012baebc95681999dd38f4f444afd28504cb3a89f2ef16b31d4ab61a0739025a + languageName: node + linkType: hard + +"type-detect@npm:^4.0.0, type-detect@npm:^4.0.5": + version: 4.0.8 + resolution: "type-detect@npm:4.0.8" + checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 + languageName: node + linkType: hard + +"type-fest@npm:^0.13.1": + version: 0.13.1 + resolution: "type-fest@npm:0.13.1" + checksum: e6bf2e3c449f27d4ef5d56faf8b86feafbc3aec3025fc9a5fbe2db0a2587c44714521f9c30d8516a833c8c506d6263f5cc11267522b10c6ccdb6cc55b0a9d1c4 + languageName: node + linkType: hard + +"type-fest@npm:^0.20.2": + version: 0.20.2 + resolution: "type-fest@npm:0.20.2" + checksum: 4fb3272df21ad1c552486f8a2f8e115c09a521ad7a8db3d56d53718d0c907b62c6e9141ba5f584af3f6830d0872c521357e512381f24f7c44acae583ad517d73 + languageName: node + linkType: hard + +"type-fest@npm:^0.21.3": + version: 0.21.3 + resolution: "type-fest@npm:0.21.3" + checksum: e6b32a3b3877f04339bae01c193b273c62ba7bfc9e325b8703c4ee1b32dc8fe4ef5dfa54bf78265e069f7667d058e360ae0f37be5af9f153b22382cd55a9afe0 + languageName: node + linkType: hard + +"type-fest@npm:^0.7.1": + version: 0.7.1 + resolution: "type-fest@npm:0.7.1" + checksum: 5b1b113529d59949d97b76977d545989ddc11b81bb0c766b6d2ccc65473cb4b4a5c7d24f5be2c2bb2de302a5d7a13c1732ea1d34c8c59b7e0ec1f890cf7fc424 + languageName: node + linkType: hard + +"type-fest@npm:^2.5.0": + version: 2.19.0 + resolution: "type-fest@npm:2.19.0" + checksum: a4ef07ece297c9fba78fc1bd6d85dff4472fe043ede98bd4710d2615d15776902b595abf62bd78339ed6278f021235fb28a96361f8be86ed754f778973a0d278 + languageName: node + linkType: hard + +"type-is@npm:^1.6.16, type-is@npm:~1.6.18": + version: 1.6.18 + resolution: "type-is@npm:1.6.18" + dependencies: + media-typer: 0.3.0 + mime-types: ~2.1.24 + checksum: 2c8e47675d55f8b4e404bcf529abdf5036c537a04c2b20177bcf78c9e3c1da69da3942b1346e6edb09e823228c0ee656ef0e033765ec39a70d496ef601a0c657 + languageName: node + linkType: hard + +"typedarray-to-buffer@npm:^3.1.5": + version: 3.1.5 + resolution: "typedarray-to-buffer@npm:3.1.5" + dependencies: + is-typedarray: ^1.0.0 + checksum: 99c11aaa8f45189fcfba6b8a4825fd684a321caa9bd7a76a27cf0c7732c174d198b99f449c52c3818107430b5f41c0ccbbfb75cb2ee3ca4a9451710986d61a60 + languageName: node + linkType: hard + +"typedoc-plugin-frontmatter@npm:^0.0.2": + version: 0.0.2 + resolution: "typedoc-plugin-frontmatter@npm:0.0.2" + dependencies: + yaml: ^2.2.2 + checksum: 44cbdb82e3fd8f4eb89cdf54783b5b07b03a57edc7bda85a48280edba73f401a2f5439cbba97426dd79e9584c410244af5dd20d5d7281c27d67d61675fa7aaef + languageName: node + linkType: hard + +"typedoc-plugin-markdown@npm:4.0.0-next.25": + version: 4.0.0-next.25 + resolution: "typedoc-plugin-markdown@npm:4.0.0-next.25" + peerDependencies: + typedoc: ">=0.25.0" + checksum: 284e2ce44446faf8db5fc54dfa84e7cd819cfc60bbed12ffb781cb24a166ba6b3a220c542990a3eb14aefff33f1d7c8322378297551f55476155cf532fbbb807 + languageName: node + linkType: hard + +"typedoc-plugin-merge-modules@npm:^5.1.0": + version: 5.1.0 + resolution: "typedoc-plugin-merge-modules@npm:5.1.0" + peerDependencies: + typedoc: 0.24.x || 0.25.x + checksum: f01d825a1c6b73c29faaf515e76076931b16bcc5762c8e9b56d18a7eca6d450bd3691012e96bc3a09ce05f29aef90744e93e187171c561ef0a3c2c1fe116803f + languageName: node + linkType: hard + +"typedoc@npm:^0.25.0": + version: 0.25.2 + resolution: "typedoc@npm:0.25.2" + dependencies: + lunr: ^2.3.9 + marked: ^4.3.0 + minimatch: ^9.0.3 + shiki: ^0.14.1 + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x + bin: + typedoc: bin/typedoc + checksum: 5b6e24bae7498bb542aaba495378ed5a3e13c76eb04a1ae95b506f76bda4d517847101fb05a7eab3f6b79357d1e2ac6f4747d39792395329b72e463f7effda65 + languageName: node + linkType: hard + +"typescript@npm:4.9.4": + version: 4.9.4 + resolution: "typescript@npm:4.9.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: e782fb9e0031cb258a80000f6c13530288c6d63f1177ed43f770533fdc15740d271554cdae86701c1dd2c83b082cea808b07e97fd68b38a172a83dbf9e0d0ef9 + languageName: node + linkType: hard + +"typescript@npm:5.1.5": + version: 5.1.5 + resolution: "typescript@npm:5.1.5" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 0eef8699e05ae767096924dbed633c340b4d36e953bb8ed87fb12e9dd9dcea5055ceac7182c614a556dbd346a8a82df799d330e1e286ae66e17c84e1710f6a6f + languageName: node + linkType: hard + +"typescript@npm:^5.0.4, typescript@npm:^5.2.2": + version: 5.2.2 + resolution: "typescript@npm:5.2.2" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 7912821dac4d962d315c36800fe387cdc0a6298dba7ec171b350b4a6e988b51d7b8f051317786db1094bd7431d526b648aba7da8236607febb26cf5b871d2d3c + languageName: node + linkType: hard + +"typescript@patch:typescript@4.9.4#~builtin": + version: 4.9.4 + resolution: "typescript@patch:typescript@npm%3A4.9.4#~builtin::version=4.9.4&hash=289587" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 2160f7ad975c59b2f5816817d3916be1d156c5688a7517602b3b640c5015e740f4ba933996ac85371d68f7bbdd41602150fb8b68334122ac637fdb5418085e7a + languageName: node + linkType: hard + +"typescript@patch:typescript@5.1.5#~builtin": + version: 5.1.5 + resolution: "typescript@patch:typescript@npm%3A5.1.5#~builtin::version=5.1.5&hash=5da071" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 12ff5d14888805f24479e54bc8a3f83647107a6345f6c29dffcd429fb345be55f584a37e262cca58a0105203e41d4cb4e31b1b9096c9abeca0e2ace8eb00935e + languageName: node + linkType: hard + +"typescript@patch:typescript@^5.0.4#~builtin, typescript@patch:typescript@^5.2.2#~builtin": + version: 5.2.2 + resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=f3b441" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 0f4da2f15e6f1245e49db15801dbee52f2bbfb267e1c39225afdab5afee1a72839cd86000e65ee9d7e4dfaff12239d28beaf5ee431357fcced15fb08583d72ca + languageName: node + linkType: hard + +"typical@npm:^4.0.0": + version: 4.0.0 + resolution: "typical@npm:4.0.0" + checksum: a242081956825328f535e6195a924240b34daf6e7fdb573a1809a42b9f37fb8114fa99c7ab89a695e0cdb419d4149d067f6723e4b95855ffd39c6c4ca378efb3 + languageName: node + linkType: hard + +"typical@npm:^5.2.0": + version: 5.2.0 + resolution: "typical@npm:5.2.0" + checksum: ccaeb151a9a556291b495571ca44c4660f736fb49c29314bbf773c90fad92e9485d3cc2b074c933866c1595abbbc962f2b8bfc6e0f52a8c6b0cdd205442036ac + languageName: node + linkType: hard + +"typical@npm:^7.1.1": + version: 7.1.1 + resolution: "typical@npm:7.1.1" + checksum: 292c64a2e3d2296fd1b7a92bbe3a9ad683f643f3faa8c9b45f6911105da54246817a3e2a4f0fdd01bb4c49d2b940618ad30b6771ac1c94bf690a40c706f657fa + languageName: node + linkType: hard + +"ua-parser-js@npm:^1.0.33, ua-parser-js@npm:^1.0.35": + version: 1.0.36 + resolution: "ua-parser-js@npm:1.0.36" + checksum: 5b2c8a5e3443dfbba7624421805de946457c26ae167cb2275781a2729d1518f7067c9d5c74c3b0acac4b9ff3278cae4eace08ca6eecb63848bc3b2f6a63cc975 + languageName: node + linkType: hard + +"unbzip2-stream@npm:1.4.3": + version: 1.4.3 + resolution: "unbzip2-stream@npm:1.4.3" + dependencies: + buffer: ^5.2.1 + through: ^2.3.8 + checksum: 0e67c4a91f4fa0fc7b4045f8b914d3498c2fc2e8c39c359977708ec85ac6d6029840e97f508675fdbdf21fcb8d276ca502043406f3682b70f075e69aae626d1d + languageName: node + linkType: hard + +"undici@npm:^5.14.0": + version: 5.25.3 + resolution: "undici@npm:5.25.3" + dependencies: + "@fastify/busboy": ^2.0.0 + checksum: 65b814b7d8b06dab2d41c250d123663fe94edb78cf1a891cf3476569ea66dc425c7d4ba52b91d6f8ed6eba24613dd28e4a5070c372063532c3b997cd343ccc96 + languageName: node + linkType: hard + +"unherit@npm:^1.0.4": + version: 1.1.3 + resolution: "unherit@npm:1.1.3" + dependencies: + inherits: ^2.0.0 + xtend: ^4.0.0 + checksum: fd7922f84fc0bfb7c4df6d1f5a50b5b94a0218e3cda98a54dbbd209226ddd4072d742d3df44d0e295ab08d5ccfd304a1e193dfe31a86d2a91b7cb9fdac093194 + languageName: node + linkType: hard + +"unicode-canonical-property-names-ecmascript@npm:^2.0.0": + version: 2.0.0 + resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" + checksum: 39be078afd014c14dcd957a7a46a60061bc37c4508ba146517f85f60361acf4c7539552645ece25de840e17e293baa5556268d091ca6762747fdd0c705001a45 + languageName: node + linkType: hard + +"unicode-match-property-ecmascript@npm:^2.0.0": + version: 2.0.0 + resolution: "unicode-match-property-ecmascript@npm:2.0.0" + dependencies: + unicode-canonical-property-names-ecmascript: ^2.0.0 + unicode-property-aliases-ecmascript: ^2.0.0 + checksum: 1f34a7434a23df4885b5890ac36c5b2161a809887000be560f56ad4b11126d433c0c1c39baf1016bdabed4ec54829a6190ee37aa24919aa116dc1a5a8a62965a + languageName: node + linkType: hard + +"unicode-match-property-value-ecmascript@npm:^2.1.0": + version: 2.1.0 + resolution: "unicode-match-property-value-ecmascript@npm:2.1.0" + checksum: 8d6f5f586b9ce1ed0e84a37df6b42fdba1317a05b5df0c249962bd5da89528771e2d149837cad11aa26bcb84c35355cb9f58a10c3d41fa3b899181ece6c85220 + languageName: node + linkType: hard + +"unicode-property-aliases-ecmascript@npm:^2.0.0": + version: 2.1.0 + resolution: "unicode-property-aliases-ecmascript@npm:2.1.0" + checksum: 243524431893649b62cc674d877bd64ef292d6071dd2fd01ab4d5ad26efbc104ffcd064f93f8a06b7e4ec54c172bf03f6417921a0d8c3a9994161fe1f88f815b + languageName: node + linkType: hard + +"unified@npm:9.2.0": + version: 9.2.0 + resolution: "unified@npm:9.2.0" + dependencies: + bail: ^1.0.0 + extend: ^3.0.0 + is-buffer: ^2.0.0 + is-plain-obj: ^2.0.0 + trough: ^1.0.0 + vfile: ^4.0.0 + checksum: 0cac4ae119893fbd49d309b4db48595e4d4e9f0a2dc1dde4d0074059f9a46012a2905f37c1346715e583f30c970bc8078db8462675411d39ff5036ae18b4fb8a + languageName: node + linkType: hard + +"unified@npm:^9.0.0, unified@npm:^9.2.2": + version: 9.2.2 + resolution: "unified@npm:9.2.2" + dependencies: + bail: ^1.0.0 + extend: ^3.0.0 + is-buffer: ^2.0.0 + is-plain-obj: ^2.0.0 + trough: ^1.0.0 + vfile: ^4.0.0 + checksum: 7c24461be7de4145939739ce50d18227c5fbdf9b3bc5a29dabb1ce26dd3e8bd4a1c385865f6f825f3b49230953ee8b591f23beab3bb3643e3e9dc37aa8a089d5 + languageName: node + linkType: hard + +"unique-filename@npm:^3.0.0": + version: 3.0.0 + resolution: "unique-filename@npm:3.0.0" + dependencies: + unique-slug: ^4.0.0 + checksum: 8e2f59b356cb2e54aab14ff98a51ac6c45781d15ceaab6d4f1c2228b780193dc70fae4463ce9e1df4479cb9d3304d7c2043a3fb905bdeca71cc7e8ce27e063df + languageName: node + linkType: hard + +"unique-slug@npm:^4.0.0": + version: 4.0.0 + resolution: "unique-slug@npm:4.0.0" + dependencies: + imurmurhash: ^0.1.4 + checksum: 0884b58365af59f89739e6f71e3feacb5b1b41f2df2d842d0757933620e6de08eff347d27e9d499b43c40476cbaf7988638d3acb2ffbcb9d35fd035591adfd15 + languageName: node + linkType: hard + +"unique-string@npm:^2.0.0": + version: 2.0.0 + resolution: "unique-string@npm:2.0.0" + dependencies: + crypto-random-string: ^2.0.0 + checksum: ef68f639136bcfe040cf7e3cd7a8dff076a665288122855148a6f7134092e6ed33bf83a7f3a9185e46c98dddc445a0da6ac25612afa1a7c38b8b654d6c02498e + languageName: node + linkType: hard + +"unist-builder@npm:2.0.3, unist-builder@npm:^2.0.0": + version: 2.0.3 + resolution: "unist-builder@npm:2.0.3" + checksum: e946fdf77dbfc320feaece137ce4959ae2da6614abd1623bd39512dc741a9d5f313eb2ba79f8887d941365dccddec7fef4e953827475e392bf49b45336f597f6 + languageName: node + linkType: hard + +"unist-util-find-after@npm:^3.0.0": + version: 3.0.0 + resolution: "unist-util-find-after@npm:3.0.0" + dependencies: + unist-util-is: ^4.0.0 + checksum: daa9a28f6cdf533a72ce7ec4864dbe0f11f0fd3efd337b54c08a8a9a47cdc8d10a299cd984d7f512a57e97af012df052210a51aab7c9afd6b1e24da3b2d0a714 + languageName: node + linkType: hard + +"unist-util-generated@npm:^1.0.0": + version: 1.1.6 + resolution: "unist-util-generated@npm:1.1.6" + checksum: 86239ff88a08800d52198f2f0e15911f05bab2dad17cef95550f7c2728f15ebb0344694fcc3101d05762d88adaf86cb85aa7a3300fedabd0b6d7d00b41cdcb7f + languageName: node + linkType: hard + +"unist-util-is@npm:^4.0.0": + version: 4.1.0 + resolution: "unist-util-is@npm:4.1.0" + checksum: 726484cd2adc9be75a939aeedd48720f88294899c2e4a3143da413ae593f2b28037570730d5cf5fd910ff41f3bc1501e3d636b6814c478d71126581ef695f7ea + languageName: node + linkType: hard + +"unist-util-position@npm:^3.0.0": + version: 3.1.0 + resolution: "unist-util-position@npm:3.1.0" + checksum: 10b3952e32a1ffabbecad41c3946237f7059f5bb6436796da05531a285f50b97e4f37cfc2f7164676d041063f40fe1ad92fbb8ca38d3ae8747328ebe738d738f + languageName: node + linkType: hard + +"unist-util-remove-position@npm:^2.0.0": + version: 2.0.1 + resolution: "unist-util-remove-position@npm:2.0.1" + dependencies: + unist-util-visit: ^2.0.0 + checksum: 4149294969f1a78a367b5d03eb0a138aa8320a39e1b15686647a2bec5945af3df27f2936a1e9752ecbb4a82dc23bd86f7e5a0ee048e5eeaedc2deb9237872795 + languageName: node + linkType: hard + +"unist-util-remove@npm:^2.0.0": + version: 2.1.0 + resolution: "unist-util-remove@npm:2.1.0" + dependencies: + unist-util-is: ^4.0.0 + checksum: 99e54f3ea0523f8cf957579a6e84e5b58427bffab929cc7f6aa5119581f929db683dd4691ea5483df0c272f486dda9dbd04f4ab74dca6cae1f3ebe8e4261a4d9 + languageName: node + linkType: hard + +"unist-util-stringify-position@npm:^2.0.0": + version: 2.0.3 + resolution: "unist-util-stringify-position@npm:2.0.3" + dependencies: + "@types/unist": ^2.0.2 + checksum: f755cadc959f9074fe999578a1a242761296705a7fe87f333a37c00044de74ab4b184b3812989a57d4cd12211f0b14ad397b327c3a594c7af84361b1c25a7f09 + languageName: node + linkType: hard + +"unist-util-visit-parents@npm:^3.0.0": + version: 3.1.1 + resolution: "unist-util-visit-parents@npm:3.1.1" + dependencies: + "@types/unist": ^2.0.0 + unist-util-is: ^4.0.0 + checksum: 1170e397dff88fab01e76d5154981666eb0291019d2462cff7a2961a3e76d3533b42eaa16b5b7e2d41ad42a5ea7d112301458283d255993e660511387bf67bc3 + languageName: node + linkType: hard + +"unist-util-visit@npm:2.0.3, unist-util-visit@npm:^2.0.0, unist-util-visit@npm:^2.0.3": + version: 2.0.3 + resolution: "unist-util-visit@npm:2.0.3" + dependencies: + "@types/unist": ^2.0.0 + unist-util-is: ^4.0.0 + unist-util-visit-parents: ^3.0.0 + checksum: 1fe19d500e212128f96d8c3cfa3312846e586b797748a1fd195fe6479f06bc90a6f6904deb08eefc00dd58e83a1c8a32fb8677252d2273ad7a5e624525b69b8f + languageName: node + linkType: hard + +"universalify@npm:^0.1.0": + version: 0.1.2 + resolution: "universalify@npm:0.1.2" + checksum: 40cdc60f6e61070fe658ca36016a8f4ec216b29bf04a55dce14e3710cc84c7448538ef4dad3728d0bfe29975ccd7bfb5f414c45e7b78883567fb31b246f02dff + languageName: node + linkType: hard + +"universalify@npm:^2.0.0": + version: 2.0.0 + resolution: "universalify@npm:2.0.0" + checksum: 2406a4edf4a8830aa6813278bab1f953a8e40f2f63a37873ffa9a3bc8f9745d06cc8e88f3572cb899b7e509013f7f6fcc3e37e8a6d914167a5381d8440518c44 + languageName: node + linkType: hard + +"unpipe@npm:1.0.0, unpipe@npm:~1.0.0": + version: 1.0.0 + resolution: "unpipe@npm:1.0.0" + checksum: 4fa18d8d8d977c55cb09715385c203197105e10a6d220087ec819f50cb68870f02942244f1017565484237f1f8c5d3cd413631b1ae104d3096f24fdfde1b4aa2 + languageName: node + linkType: hard + +"untildify@npm:^4.0.0": + version: 4.0.0 + resolution: "untildify@npm:4.0.0" + checksum: 39ced9c418a74f73f0a56e1ba4634b4d959422dff61f4c72a8e39f60b99380c1b45ed776fbaa0a4101b157e4310d873ad7d114e8534ca02609b4916bb4187fb9 + languageName: node + linkType: hard + +"update-browserslist-db@npm:^1.0.13": + version: 1.0.13 + resolution: "update-browserslist-db@npm:1.0.13" + dependencies: + escalade: ^3.1.1 + picocolors: ^1.0.0 + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: 1e47d80182ab6e4ad35396ad8b61008ae2a1330221175d0abd37689658bdb61af9b705bfc41057fd16682474d79944fb2d86767c5ed5ae34b6276b9bed353322 + languageName: node + linkType: hard + +"update-notifier@npm:^5.1.0": + version: 5.1.0 + resolution: "update-notifier@npm:5.1.0" + dependencies: + boxen: ^5.0.0 + chalk: ^4.1.0 + configstore: ^5.0.1 + has-yarn: ^2.1.0 + import-lazy: ^2.1.0 + is-ci: ^2.0.0 + is-installed-globally: ^0.4.0 + is-npm: ^5.0.0 + is-yarn-global: ^0.3.0 + latest-version: ^5.1.0 + pupa: ^2.1.1 + semver: ^7.3.4 + semver-diff: ^3.1.1 + xdg-basedir: ^4.0.0 + checksum: 461e5e5b002419296d3868ee2abe0f9ab3e1846d9db642936d0c46f838872ec56069eddfe662c45ce1af0a8d6d5026353728de2e0a95ab2e3546a22ea077caf1 + languageName: node + linkType: hard + +"uri-js@npm:^4.2.2": + version: 4.4.1 + resolution: "uri-js@npm:4.4.1" + dependencies: + punycode: ^2.1.0 + checksum: 7167432de6817fe8e9e0c9684f1d2de2bb688c94388f7569f7dbdb1587c9f4ca2a77962f134ec90be0cc4d004c939ff0d05acc9f34a0db39a3c797dada262633 + languageName: node + linkType: hard + +"url-loader@npm:^4.1.1": + version: 4.1.1 + resolution: "url-loader@npm:4.1.1" + dependencies: + loader-utils: ^2.0.0 + mime-types: ^2.1.27 + schema-utils: ^3.0.0 + peerDependencies: + file-loader: "*" + webpack: ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + file-loader: + optional: true + checksum: c1122a992c6cff70a7e56dfc2b7474534d48eb40b2cc75467cde0c6972e7597faf8e43acb4f45f93c2473645dfd803bcbc20960b57544dd1e4c96e77f72ba6fd + languageName: node + linkType: hard + +"url-parse-lax@npm:^3.0.0": + version: 3.0.0 + resolution: "url-parse-lax@npm:3.0.0" + dependencies: + prepend-http: ^2.0.0 + checksum: 1040e357750451173132228036aff1fd04abbd43eac1fb3e4fca7495a078bcb8d33cb765fe71ad7e473d9c94d98fd67adca63bd2716c815a2da066198dd37217 + languageName: node + linkType: hard + +"use-composed-ref@npm:^1.3.0": + version: 1.3.0 + resolution: "use-composed-ref@npm:1.3.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + checksum: f771cbadfdc91e03b7ab9eb32d0fc0cc647755711801bf507e891ad38c4bbc5f02b2509acadf9c965ec9c5f2f642fd33bdfdfb17b0873c4ad0a9b1f5e5e724bf + languageName: node + linkType: hard + +"use-isomorphic-layout-effect@npm:^1.1.1": + version: 1.1.2 + resolution: "use-isomorphic-layout-effect@npm:1.1.2" + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + peerDependenciesMeta: + "@types/react": + optional: true + checksum: a6532f7fc9ae222c3725ff0308aaf1f1ddbd3c00d685ef9eee6714fd0684de5cb9741b432fbf51e61a784e2955424864f7ea9f99734a02f237b17ad3e18ea5cb + languageName: node + linkType: hard + +"use-latest@npm:^1.2.1": + version: 1.2.1 + resolution: "use-latest@npm:1.2.1" + dependencies: + use-isomorphic-layout-effect: ^1.1.1 + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + peerDependenciesMeta: + "@types/react": + optional: true + checksum: ed3f2ddddf6f21825e2ede4c2e0f0db8dcce5129802b69d1f0575fc1b42380436e8c76a6cd885d4e9aa8e292e60fb8b959c955f33c6a9123b83814a1a1875367 + languageName: node + linkType: hard + +"use-sync-external-store@npm:^1.2.0": + version: 1.2.0 + resolution: "use-sync-external-store@npm:1.2.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 + checksum: 5c639e0f8da3521d605f59ce5be9e094ca772bd44a4ce7322b055a6f58eeed8dda3c94cabd90c7a41fb6fa852210092008afe48f7038792fd47501f33299116a + languageName: node + linkType: hard + +"util-deprecate@npm:^1.0.1, util-deprecate@npm:^1.0.2, util-deprecate@npm:~1.0.1": + version: 1.0.2 + resolution: "util-deprecate@npm:1.0.2" + checksum: 474acf1146cb2701fe3b074892217553dfcf9a031280919ba1b8d651a068c9b15d863b7303cb15bd00a862b498e6cf4ad7b4a08fb134edd5a6f7641681cb54a2 + languageName: node + linkType: hard + +"utila@npm:~0.4": + version: 0.4.0 + resolution: "utila@npm:0.4.0" + checksum: 97ffd3bd2bb80c773429d3fb8396469115cd190dded1e733f190d8b602bd0a1bcd6216b7ce3c4395ee3c79e3c879c19d268dbaae3093564cb169ad1212d436f4 + languageName: node + linkType: hard + +"utility-types@npm:^3.10.0": + version: 3.10.0 + resolution: "utility-types@npm:3.10.0" + checksum: 8f274415c6196ab62883b8bd98c9d2f8829b58016e4269aaa1ebd84184ac5dda7dc2ca45800c0d5e0e0650966ba063bf9a412aaeaea6850ca4440a391283d5c8 + languageName: node + linkType: hard + +"utils-merge@npm:1.0.1": + version: 1.0.1 + resolution: "utils-merge@npm:1.0.1" + checksum: c81095493225ecfc28add49c106ca4f09cdf56bc66731aa8dabc2edbbccb1e1bfe2de6a115e5c6a380d3ea166d1636410b62ef216bb07b3feb1cfde1d95d5080 + languageName: node + linkType: hard + +"uuid@npm:^8.3.2": + version: 8.3.2 + resolution: "uuid@npm:8.3.2" + bin: + uuid: dist/bin/uuid + checksum: 5575a8a75c13120e2f10e6ddc801b2c7ed7d8f3c8ac22c7ed0c7b2ba6383ec0abda88c905085d630e251719e0777045ae3236f04c812184b7c765f63a70e58df + languageName: node + linkType: hard + +"uvu@npm:0.5.6": + version: 0.5.6 + resolution: "uvu@npm:0.5.6" + dependencies: + dequal: ^2.0.0 + diff: ^5.0.0 + kleur: ^4.0.3 + sade: ^1.7.3 + bin: + uvu: bin.js + checksum: 09460a37975627de9fcad396e5078fb844d01aaf64a6399ebfcfd9e55f1c2037539b47611e8631f89be07656962af0cf48c334993db82b9ae9c3d25ce3862168 + languageName: node + linkType: hard + +"v8-compile-cache-lib@npm:^3.0.1": + version: 3.0.1 + resolution: "v8-compile-cache-lib@npm:3.0.1" + checksum: 78089ad549e21bcdbfca10c08850022b22024cdcc2da9b168bcf5a73a6ed7bf01a9cebb9eac28e03cd23a684d81e0502797e88f3ccd27a32aeab1cfc44c39da0 + languageName: node + linkType: hard + +"v8-to-istanbul@npm:^9.0.1": + version: 9.1.0 + resolution: "v8-to-istanbul@npm:9.1.0" + dependencies: + "@jridgewell/trace-mapping": ^0.3.12 + "@types/istanbul-lib-coverage": ^2.0.1 + convert-source-map: ^1.6.0 + checksum: 2069d59ee46cf8d83b4adfd8a5c1a90834caffa9f675e4360f1157ffc8578ef0f763c8f32d128334424159bb6b01f3876acd39cd13297b2769405a9da241f8d1 + languageName: node + linkType: hard + +"value-equal@npm:^1.0.1": + version: 1.0.1 + resolution: "value-equal@npm:1.0.1" + checksum: bb7ae1facc76b5cf8071aeb6c13d284d023fdb370478d10a5d64508e0e6e53bb459c4bbe34258df29d82e6f561f874f0105eba38de0e61fe9edd0bdce07a77a2 + languageName: node + linkType: hard + +"vary@npm:^1.1.2, vary@npm:~1.1.2": + version: 1.1.2 + resolution: "vary@npm:1.1.2" + checksum: ae0123222c6df65b437669d63dfa8c36cee20a504101b2fcd97b8bf76f91259c17f9f2b4d70a1e3c6bbcee7f51b28392833adb6b2770b23b01abec84e369660b + languageName: node + linkType: hard + +"vfile-location@npm:^3.0.0, vfile-location@npm:^3.2.0": + version: 3.2.0 + resolution: "vfile-location@npm:3.2.0" + checksum: 9bb3df6d0be31b5dd2d8da0170c27b7045c64493a8ba7b6ff7af8596c524fc8896924b8dd85ae12d201eead2709217a0fbc44927b7264f4bbf0aa8027a78be9c + languageName: node + linkType: hard + +"vfile-message@npm:^2.0.0": + version: 2.0.4 + resolution: "vfile-message@npm:2.0.4" + dependencies: + "@types/unist": ^2.0.0 + unist-util-stringify-position: ^2.0.0 + checksum: 1bade499790f46ca5aba04bdce07a1e37c2636a8872e05cf32c26becc912826710b7eb063d30c5754fdfaeedc8a7658e78df10b3bc535c844890ec8a184f5643 + languageName: node + linkType: hard + +"vfile@npm:^4.0.0": + version: 4.2.1 + resolution: "vfile@npm:4.2.1" + dependencies: + "@types/unist": ^2.0.0 + is-buffer: ^2.0.0 + unist-util-stringify-position: ^2.0.0 + vfile-message: ^2.0.0 + checksum: ee5726e10d170472cde778fc22e0f7499caa096eb85babea5d0ce0941455b721037ee1c9e6ae506ca2803250acd313d0f464328ead0b55cfe7cb6315f1b462d6 + languageName: node + linkType: hard + +"vscode-oniguruma@npm:^1.7.0": + version: 1.7.0 + resolution: "vscode-oniguruma@npm:1.7.0" + checksum: 53519d91d90593e6fb080260892e87d447e9b200c4964d766772b5053f5699066539d92100f77f1302c91e8fc5d9c772fbe40fe4c90f3d411a96d5a9b1e63f42 + languageName: node + linkType: hard + +"vscode-textmate@npm:^8.0.0": + version: 8.0.0 + resolution: "vscode-textmate@npm:8.0.0" + checksum: 127780dfea89559d70b8326df6ec344cfd701312dd7f3f591a718693812b7852c30b6715e3cfc8b3200a4e2515b4c96f0843c0eacc0a3020969b5de262c2a4bb + languageName: node + linkType: hard + +"wait-on@npm:^6.0.1": + version: 6.0.1 + resolution: "wait-on@npm:6.0.1" + dependencies: + axios: ^0.25.0 + joi: ^17.6.0 + lodash: ^4.17.21 + minimist: ^1.2.5 + rxjs: ^7.5.4 + bin: + wait-on: bin/wait-on + checksum: e4d62aa4145d99fe34747ccf7506d4b4d6e60dd677c0eb18a51e316d38116ace2d194e4b22a9eb7b767b0282f39878ddcc4ae9440dcb0c005c9150668747cf5b + languageName: node + linkType: hard + +"watchpack@npm:^2.4.0": + version: 2.4.0 + resolution: "watchpack@npm:2.4.0" + dependencies: + glob-to-regexp: ^0.4.1 + graceful-fs: ^4.1.2 + checksum: 23d4bc58634dbe13b86093e01c6a68d8096028b664ab7139d58f0c37d962d549a940e98f2f201cecdabd6f9c340338dc73ef8bf094a2249ef582f35183d1a131 + languageName: node + linkType: hard + +"wbuf@npm:^1.1.0, wbuf@npm:^1.7.3": + version: 1.7.3 + resolution: "wbuf@npm:1.7.3" + dependencies: + minimalistic-assert: ^1.0.0 + checksum: 2abc306c96930b757972a1c4650eb6b25b5d99f24088714957f88629e137db569368c5de0e57986c89ea70db2f1df9bba11a87cb6d0c8694b6f53a0159fab3bf + languageName: node + linkType: hard + +"web-namespaces@npm:^1.0.0": + version: 1.1.4 + resolution: "web-namespaces@npm:1.1.4" + checksum: 5149842ccbfbc56fe4f8758957b3f8c8616a281874a5bb84aa1b305e4436a9bad853d21c629a7b8f174902449e1489c7a6c724fccf60965077c5636bd8aed42b + languageName: node + linkType: hard + +"web-streams-polyfill@npm:^3.0.3": + version: 3.2.1 + resolution: "web-streams-polyfill@npm:3.2.1" + checksum: b119c78574b6d65935e35098c2afdcd752b84268e18746606af149e3c424e15621b6f1ff0b42b2676dc012fc4f0d313f964b41a4b5031e525faa03997457da02 + languageName: node + linkType: hard + +"webidl-conversions@npm:^3.0.0": + version: 3.0.1 + resolution: "webidl-conversions@npm:3.0.1" + checksum: c92a0a6ab95314bde9c32e1d0a6dfac83b578f8fa5f21e675bc2706ed6981bc26b7eb7e6a1fab158e5ce4adf9caa4a0aee49a52505d4d13c7be545f15021b17c + languageName: node + linkType: hard + +"webidl-conversions@npm:^7.0.0": + version: 7.0.0 + resolution: "webidl-conversions@npm:7.0.0" + checksum: f05588567a2a76428515333eff87200fae6c83c3948a7482ebb109562971e77ef6dc49749afa58abb993391227c5697b3ecca52018793e0cb4620a48f10bd21b + languageName: node + linkType: hard + +"webpack-bundle-analyzer@npm:^4.5.0": + version: 4.9.1 + resolution: "webpack-bundle-analyzer@npm:4.9.1" + dependencies: + "@discoveryjs/json-ext": 0.5.7 + acorn: ^8.0.4 + acorn-walk: ^8.0.0 + commander: ^7.2.0 + escape-string-regexp: ^4.0.0 + gzip-size: ^6.0.0 + is-plain-object: ^5.0.0 + lodash.debounce: ^4.0.8 + lodash.escape: ^4.0.1 + lodash.flatten: ^4.4.0 + lodash.invokemap: ^4.6.0 + lodash.pullall: ^4.2.0 + lodash.uniqby: ^4.7.0 + opener: ^1.5.2 + picocolors: ^1.0.0 + sirv: ^2.0.3 + ws: ^7.3.1 + bin: + webpack-bundle-analyzer: lib/bin/analyzer.js + checksum: 7e891c28d5a903242893e55ecc714fa01d7ad6bedade143235c07091b235915349812fa048968462781d59187507962f38b6c61ed7d25fb836ba0ac0ee919a39 + languageName: node + linkType: hard + +"webpack-dev-middleware@npm:^5.3.1": + version: 5.3.3 + resolution: "webpack-dev-middleware@npm:5.3.3" + dependencies: + colorette: ^2.0.10 + memfs: ^3.4.3 + mime-types: ^2.1.31 + range-parser: ^1.2.1 + schema-utils: ^4.0.0 + peerDependencies: + webpack: ^4.0.0 || ^5.0.0 + checksum: dd332cc6da61222c43d25e5a2155e23147b777ff32fdf1f1a0a8777020c072fbcef7756360ce2a13939c3f534c06b4992a4d659318c4a7fe2c0530b52a8a6621 + languageName: node + linkType: hard + +"webpack-dev-server@npm:^4.9.3": + version: 4.15.1 + resolution: "webpack-dev-server@npm:4.15.1" + dependencies: + "@types/bonjour": ^3.5.9 + "@types/connect-history-api-fallback": ^1.3.5 + "@types/express": ^4.17.13 + "@types/serve-index": ^1.9.1 + "@types/serve-static": ^1.13.10 + "@types/sockjs": ^0.3.33 + "@types/ws": ^8.5.5 + ansi-html-community: ^0.0.8 + bonjour-service: ^1.0.11 + chokidar: ^3.5.3 + colorette: ^2.0.10 + compression: ^1.7.4 + connect-history-api-fallback: ^2.0.0 + default-gateway: ^6.0.3 + express: ^4.17.3 + graceful-fs: ^4.2.6 + html-entities: ^2.3.2 + http-proxy-middleware: ^2.0.3 + ipaddr.js: ^2.0.1 + launch-editor: ^2.6.0 + open: ^8.0.9 + p-retry: ^4.5.0 + rimraf: ^3.0.2 + schema-utils: ^4.0.0 + selfsigned: ^2.1.1 + serve-index: ^1.9.1 + sockjs: ^0.3.24 + spdy: ^4.0.2 + webpack-dev-middleware: ^5.3.1 + ws: ^8.13.0 + peerDependencies: + webpack: ^4.37.0 || ^5.0.0 + peerDependenciesMeta: + webpack: + optional: true + webpack-cli: + optional: true + bin: + webpack-dev-server: bin/webpack-dev-server.js + checksum: cd0063b068d2b938fd76c412d555374186ac2fa84bbae098265212ed50a5c15d6f03aa12a5a310c544a242943eb58c0bfde4c296d5c36765c182f53799e1bc71 + languageName: node + linkType: hard + +"webpack-merge@npm:^5.8.0": + version: 5.9.0 + resolution: "webpack-merge@npm:5.9.0" + dependencies: + clone-deep: ^4.0.1 + wildcard: ^2.0.0 + checksum: 64fe2c23aacc5f19684452a0e84ec02c46b990423aee6fcc5c18d7d471155bd14e9a6adb02bd3656eb3e0ac2532c8e97d69412ad14c97eeafe32fa6d10050872 + languageName: node + linkType: hard + +"webpack-sources@npm:^3.2.2, webpack-sources@npm:^3.2.3": + version: 3.2.3 + resolution: "webpack-sources@npm:3.2.3" + checksum: 989e401b9fe3536529e2a99dac8c1bdc50e3a0a2c8669cbafad31271eadd994bc9405f88a3039cd2e29db5e6d9d0926ceb7a1a4e7409ece021fe79c37d9c4607 + languageName: node + linkType: hard + +"webpack@npm:^5.73.0": + version: 5.89.0 + resolution: "webpack@npm:5.89.0" + dependencies: + "@types/eslint-scope": ^3.7.3 + "@types/estree": ^1.0.0 + "@webassemblyjs/ast": ^1.11.5 + "@webassemblyjs/wasm-edit": ^1.11.5 + "@webassemblyjs/wasm-parser": ^1.11.5 + acorn: ^8.7.1 + acorn-import-assertions: ^1.9.0 + browserslist: ^4.14.5 + chrome-trace-event: ^1.0.2 + enhanced-resolve: ^5.15.0 + es-module-lexer: ^1.2.1 + eslint-scope: 5.1.1 + events: ^3.2.0 + glob-to-regexp: ^0.4.1 + graceful-fs: ^4.2.9 + json-parse-even-better-errors: ^2.3.1 + loader-runner: ^4.2.0 + mime-types: ^2.1.27 + neo-async: ^2.6.2 + schema-utils: ^3.2.0 + tapable: ^2.1.1 + terser-webpack-plugin: ^5.3.7 + watchpack: ^2.4.0 + webpack-sources: ^3.2.3 + peerDependenciesMeta: + webpack-cli: + optional: true + bin: + webpack: bin/webpack.js + checksum: 43fe0dbc30e168a685ef5a86759d5016a705f6563b39a240aa00826a80637d4a3deeb8062e709d6a4b05c63e796278244c84b04174704dc4a37bedb0f565c5ed + languageName: node + linkType: hard + +"webpackbar@npm:^5.0.2": + version: 5.0.2 + resolution: "webpackbar@npm:5.0.2" + dependencies: + chalk: ^4.1.0 + consola: ^2.15.3 + pretty-time: ^1.1.0 + std-env: ^3.0.1 + peerDependencies: + webpack: 3 || 4 || 5 + checksum: 214a734b1d4d391eb8271ed1b11085f0efe6831e93f641229b292abfd6fea871422dce121612511c17ae8047522be6d65c1a2666cabb396c79549816a3612338 + languageName: node + linkType: hard + +"websocket-driver@npm:>=0.5.1, websocket-driver@npm:^0.7.4": + version: 0.7.4 + resolution: "websocket-driver@npm:0.7.4" + dependencies: + http-parser-js: ">=0.5.1" + safe-buffer: ">=5.1.0" + websocket-extensions: ">=0.1.1" + checksum: fffe5a33fe8eceafd21d2a065661d09e38b93877eae1de6ab5d7d2734c6ed243973beae10ae48c6613cfd675f200e5a058d1e3531bc9e6c5d4f1396ff1f0bfb9 + languageName: node + linkType: hard + +"websocket-extensions@npm:>=0.1.1": + version: 0.1.4 + resolution: "websocket-extensions@npm:0.1.4" + checksum: 5976835e68a86afcd64c7a9762ed85f2f27d48c488c707e67ba85e717b90fa066b98ab33c744d64255c9622d349eedecf728e65a5f921da71b58d0e9591b9038 + languageName: node + linkType: hard + +"well-known-symbols@npm:^2.0.0": + version: 2.0.0 + resolution: "well-known-symbols@npm:2.0.0" + checksum: 4f54bbc3012371cb4d228f436891b8e7536d34ac61a57541890257e96788608e096231e0121ac24d08ef2f908b3eb2dc0adba35023eaeb2a7df655da91415402 + languageName: node + linkType: hard + +"whatwg-url@npm:^11.0.0": + version: 11.0.0 + resolution: "whatwg-url@npm:11.0.0" + dependencies: + tr46: ^3.0.0 + webidl-conversions: ^7.0.0 + checksum: ed4826aaa57e66bb3488a4b25c9cd476c46ba96052747388b5801f137dd740b73fde91ad207d96baf9f17fbcc80fc1a477ad65181b5eb5fa718d27c69501d7af + languageName: node + linkType: hard + +"whatwg-url@npm:^5.0.0": + version: 5.0.0 + resolution: "whatwg-url@npm:5.0.0" + dependencies: + tr46: ~0.0.3 + webidl-conversions: ^3.0.0 + checksum: b8daed4ad3356cc4899048a15b2c143a9aed0dfae1f611ebd55073310c7b910f522ad75d727346ad64203d7e6c79ef25eafd465f4d12775ca44b90fa82ed9e2c + languageName: node + linkType: hard + +"which@npm:^1.3.1": + version: 1.3.1 + resolution: "which@npm:1.3.1" + dependencies: + isexe: ^2.0.0 + bin: + which: ./bin/which + checksum: f2e185c6242244b8426c9df1510e86629192d93c1a986a7d2a591f2c24869e7ffd03d6dac07ca863b2e4c06f59a4cc9916c585b72ee9fa1aa609d0124df15e04 + languageName: node + linkType: hard + +"which@npm:^2.0.1, which@npm:^2.0.2": + version: 2.0.2 + resolution: "which@npm:2.0.2" + dependencies: + isexe: ^2.0.0 + bin: + node-which: ./bin/node-which + checksum: 1a5c563d3c1b52d5f893c8b61afe11abc3bab4afac492e8da5bde69d550de701cf9806235f20a47b5c8fa8a1d6a9135841de2596535e998027a54589000e66d1 + languageName: node + linkType: hard + +"wide-align@npm:^1.1.5": + version: 1.1.5 + resolution: "wide-align@npm:1.1.5" + dependencies: + string-width: ^1.0.2 || 2 || 3 || 4 + checksum: d5fc37cd561f9daee3c80e03b92ed3e84d80dde3365a8767263d03dacfc8fa06b065ffe1df00d8c2a09f731482fcacae745abfbb478d4af36d0a891fad4834d3 + languageName: node + linkType: hard + +"widest-line@npm:^3.1.0": + version: 3.1.0 + resolution: "widest-line@npm:3.1.0" + dependencies: + string-width: ^4.0.0 + checksum: 03db6c9d0af9329c37d74378ff1d91972b12553c7d72a6f4e8525fe61563fa7adb0b9d6e8d546b7e059688712ea874edd5ded475999abdeedf708de9849310e0 + languageName: node + linkType: hard + +"widest-line@npm:^4.0.1": + version: 4.0.1 + resolution: "widest-line@npm:4.0.1" + dependencies: + string-width: ^5.0.1 + checksum: 64c48cf27171221be5f86fc54b94dd29879165bdff1a7aa92dde723d9a8c99fb108312768a5d62c8c2b80b701fa27bbd36a1ddc58367585cd45c0db7920a0cba + languageName: node + linkType: hard + +"wildcard@npm:^2.0.0": + version: 2.0.1 + resolution: "wildcard@npm:2.0.1" + checksum: e0c60a12a219e4b12065d1199802d81c27b841ed6ad6d9d28240980c73ceec6f856771d575af367cbec2982d9ae7838759168b551776577f155044f5a5ba843c + languageName: node + linkType: hard + +"wordwrapjs@npm:^4.0.0": + version: 4.0.1 + resolution: "wordwrapjs@npm:4.0.1" + dependencies: + reduce-flatten: ^2.0.0 + typical: ^5.2.0 + checksum: 3d927f3c95d0ad990968da54c0ad8cde2801d8e91006cd7474c26e6b742cc8557250ce495c9732b2f9db1f903601cb74ec282e0f122ee0d02d7abe81e150eea8 + languageName: node + linkType: hard + +"wordwrapjs@npm:^5.1.0": + version: 5.1.0 + resolution: "wordwrapjs@npm:5.1.0" + checksum: 063c7a5a85b694be1a5fd96f7ae0c0f4d717a087909e5c70cf25edec6eb5df5f2f5561f23e939cf6d7514cf81902610f74f288ef1612a49bf5451de15e0e29db + languageName: node + linkType: hard + +"workerpool@npm:6.2.1": + version: 6.2.1 + resolution: "workerpool@npm:6.2.1" + checksum: c2c6eebbc5225f10f758d599a5c016fa04798bcc44e4c1dffb34050cd361d7be2e97891aa44419e7afe647b1f767b1dc0b85a5e046c409d890163f655028b09d + languageName: node + linkType: hard + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": + version: 7.0.0 + resolution: "wrap-ansi@npm:7.0.0" + dependencies: + ansi-styles: ^4.0.0 + string-width: ^4.1.0 + strip-ansi: ^6.0.0 + checksum: a790b846fd4505de962ba728a21aaeda189b8ee1c7568ca5e817d85930e06ef8d1689d49dbf0e881e8ef84436af3a88bc49115c2e2788d841ff1b8b5b51a608b + languageName: node + linkType: hard + +"wrap-ansi@npm:^6.2.0": + version: 6.2.0 + resolution: "wrap-ansi@npm:6.2.0" + dependencies: + ansi-styles: ^4.0.0 + string-width: ^4.1.0 + strip-ansi: ^6.0.0 + checksum: 6cd96a410161ff617b63581a08376f0cb9162375adeb7956e10c8cd397821f7eb2a6de24eb22a0b28401300bf228c86e50617cd568209b5f6775b93c97d2fe3a + languageName: node + linkType: hard + +"wrap-ansi@npm:^8.0.1, wrap-ansi@npm:^8.1.0": + version: 8.1.0 + resolution: "wrap-ansi@npm:8.1.0" + dependencies: + ansi-styles: ^6.1.0 + string-width: ^5.0.1 + strip-ansi: ^7.0.1 + checksum: 371733296dc2d616900ce15a0049dca0ef67597d6394c57347ba334393599e800bab03c41d4d45221b6bc967b8c453ec3ae4749eff3894202d16800fdfe0e238 + languageName: node + linkType: hard + +"wrappy@npm:1": + version: 1.0.2 + resolution: "wrappy@npm:1.0.2" + checksum: 159da4805f7e84a3d003d8841557196034155008f817172d4e986bd591f74aa82aa7db55929a54222309e01079a65a92a9e6414da5a6aa4b01ee44a511ac3ee5 + languageName: node + linkType: hard + +"write-file-atomic@npm:^3.0.0": + version: 3.0.3 + resolution: "write-file-atomic@npm:3.0.3" + dependencies: + imurmurhash: ^0.1.4 + is-typedarray: ^1.0.0 + signal-exit: ^3.0.2 + typedarray-to-buffer: ^3.1.5 + checksum: c55b24617cc61c3a4379f425fc62a386cc51916a9b9d993f39734d005a09d5a4bb748bc251f1304e7abd71d0a26d339996c275955f527a131b1dcded67878280 + languageName: node + linkType: hard + +"write-file-atomic@npm:^5.0.1": + version: 5.0.1 + resolution: "write-file-atomic@npm:5.0.1" + dependencies: + imurmurhash: ^0.1.4 + signal-exit: ^4.0.1 + checksum: 8dbb0e2512c2f72ccc20ccedab9986c7d02d04039ed6e8780c987dc4940b793339c50172a1008eed7747001bfacc0ca47562668a069a7506c46c77d7ba3926a9 + languageName: node + linkType: hard + +"ws@npm:7.4.6": + version: 7.4.6 + resolution: "ws@npm:7.4.6" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 3a990b32ed08c72070d5e8913e14dfcd831919205be52a3ff0b4cdd998c8d554f167c9df3841605cde8b11d607768cacab3e823c58c96a5c08c987e093eb767a + languageName: node + linkType: hard + +"ws@npm:8.13.0": + version: 8.13.0 + resolution: "ws@npm:8.13.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 53e991bbf928faf5dc6efac9b8eb9ab6497c69feeb94f963d648b7a3530a720b19ec2e0ec037344257e05a4f35bd9ad04d9de6f289615ffb133282031b18c61c + languageName: node + linkType: hard + +"ws@npm:8.5.0": + version: 8.5.0 + resolution: "ws@npm:8.5.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 76f2f90e40344bf18fd544194e7067812fb1372b2a37865678d8f12afe4b478ff2ebc0c7c0aff82cd5e6b66fc43d889eec0f1865c2365d8f7a66d92da7744a77 + languageName: node + linkType: hard + +"ws@npm:^7.3.1, ws@npm:^7.4.2, ws@npm:^7.4.6": + version: 7.5.9 + resolution: "ws@npm:7.5.9" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: c3c100a181b731f40b7f2fddf004aa023f79d64f489706a28bc23ff88e87f6a64b3c6651fbec3a84a53960b75159574d7a7385709847a62ddb7ad6af76f49138 + languageName: node + linkType: hard + +"ws@npm:^8.13.0": + version: 8.14.2 + resolution: "ws@npm:8.14.2" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 3ca0dad26e8cc6515ff392b622a1467430814c463b3368b0258e33696b1d4bed7510bc7030f7b72838b9fdeb8dbd8839cbf808367d6aae2e1d668ce741d4308b + languageName: node + linkType: hard + +"xdg-basedir@npm:^4.0.0": + version: 4.0.0 + resolution: "xdg-basedir@npm:4.0.0" + checksum: 0073d5b59a37224ed3a5ac0dd2ec1d36f09c49f0afd769008a6e9cd3cd666bd6317bd1c7ce2eab47e1de285a286bad11a9b038196413cd753b79770361855f3c + languageName: node + linkType: hard + +"xml-js@npm:^1.6.11": + version: 1.6.11 + resolution: "xml-js@npm:1.6.11" + dependencies: + sax: ^1.2.4 + bin: + xml-js: ./bin/cli.js + checksum: 24a55479919413687105fc2d8ab05e613ebedb1c1bc12258a108e07cff5ef793779297db854800a4edf0281303ebd1f177bc4a588442f5344e62b3dddda26c2b + languageName: node + linkType: hard + +"xtend@npm:^4.0.0, xtend@npm:^4.0.1": + version: 4.0.2 + resolution: "xtend@npm:4.0.2" + checksum: ac5dfa738b21f6e7f0dd6e65e1b3155036d68104e67e5d5d1bde74892e327d7e5636a076f625599dc394330a731861e87343ff184b0047fef1360a7ec0a5a36a + languageName: node + linkType: hard + +"y18n@npm:^5.0.5": + version: 5.0.8 + resolution: "y18n@npm:5.0.8" + checksum: 54f0fb95621ee60898a38c572c515659e51cc9d9f787fb109cef6fde4befbe1c4602dc999d30110feee37456ad0f1660fa2edcfde6a9a740f86a290999550d30 + languageName: node + linkType: hard + +"yallist@npm:^3.0.2": + version: 3.1.1 + resolution: "yallist@npm:3.1.1" + checksum: 48f7bb00dc19fc635a13a39fe547f527b10c9290e7b3e836b9a8f1ca04d4d342e85714416b3c2ab74949c9c66f9cebb0473e6bc353b79035356103b47641285d + languageName: node + linkType: hard + +"yallist@npm:^4.0.0": + version: 4.0.0 + resolution: "yallist@npm:4.0.0" + checksum: 343617202af32df2a15a3be36a5a8c0c8545208f3d3dfbc6bb7c3e3b7e8c6f8e7485432e4f3b88da3031a6e20afa7c711eded32ddfb122896ac5d914e75848d5 + languageName: node + linkType: hard + +"yaml@npm:^1.10.0, yaml@npm:^1.10.2, yaml@npm:^1.7.2": + version: 1.10.2 + resolution: "yaml@npm:1.10.2" + checksum: ce4ada136e8a78a0b08dc10b4b900936912d15de59905b2bf415b4d33c63df1d555d23acb2a41b23cf9fb5da41c256441afca3d6509de7247daa062fd2c5ea5f + languageName: node + linkType: hard + +"yaml@npm:^2.1.1": + version: 2.3.2 + resolution: "yaml@npm:2.3.2" + checksum: acd80cc24df12c808c6dec8a0176d404ef9e6f08ad8786f746ecc9d8974968c53c6e8a67fdfabcc5f99f3dc59b6bb0994b95646ff03d18e9b1dcd59eccc02146 + languageName: node + linkType: hard + +"yaml@npm:^2.2.2": + version: 2.3.3 + resolution: "yaml@npm:2.3.3" + checksum: cdfd132e7e0259f948929efe8835923df05c013c273c02bb7a2de9b46ac3af53c2778a35b32c7c0f877cc355dc9340ed564018c0242bfbb1278c2a3e53a0e99e + languageName: node + linkType: hard + +"yargs-parser@npm:20.2.4": + version: 20.2.4 + resolution: "yargs-parser@npm:20.2.4" + checksum: d251998a374b2743a20271c2fd752b9fbef24eb881d53a3b99a7caa5e8227fcafd9abf1f345ac5de46435821be25ec12189a11030c12ee6481fef6863ed8b924 + languageName: node + linkType: hard + +"yargs-parser@npm:^20.2.2": + version: 20.2.9 + resolution: "yargs-parser@npm:20.2.9" + checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3 + languageName: node + linkType: hard + +"yargs-parser@npm:^21.1.1": + version: 21.1.1 + resolution: "yargs-parser@npm:21.1.1" + checksum: ed2d96a616a9e3e1cc7d204c62ecc61f7aaab633dcbfab2c6df50f7f87b393993fe6640d017759fe112d0cb1e0119f2b4150a87305cc873fd90831c6a58ccf1c + languageName: node + linkType: hard + +"yargs-unparser@npm:2.0.0": + version: 2.0.0 + resolution: "yargs-unparser@npm:2.0.0" + dependencies: + camelcase: ^6.0.0 + decamelize: ^4.0.0 + flat: ^5.0.2 + is-plain-obj: ^2.1.0 + checksum: 68f9a542c6927c3768c2f16c28f71b19008710abd6b8f8efbac6dcce26bbb68ab6503bed1d5994bdbc2df9a5c87c161110c1dfe04c6a3fe5c6ad1b0e15d9a8a3 + languageName: node + linkType: hard + +"yargs@npm:16.2.0": + version: 16.2.0 + resolution: "yargs@npm:16.2.0" + dependencies: + cliui: ^7.0.2 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.0 + y18n: ^5.0.5 + yargs-parser: ^20.2.2 + checksum: b14afbb51e3251a204d81937c86a7e9d4bdbf9a2bcee38226c900d00f522969ab675703bee2a6f99f8e20103f608382936034e64d921b74df82b63c07c5e8f59 + languageName: node + linkType: hard + +"yargs@npm:17.7.1": + version: 17.7.1 + resolution: "yargs@npm:17.7.1" + dependencies: + cliui: ^8.0.1 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.1.1 + checksum: 3d8a43c336a4942bc68080768664aca85c7bd406f018bad362fd255c41c8f4e650277f42fd65d543fce99e084124ddafee7bbfc1a5c6a8fda4cec78609dcf8d4 + languageName: node + linkType: hard + +"yargs@npm:^17.7.1, yargs@npm:^17.7.2": + version: 17.7.2 + resolution: "yargs@npm:17.7.2" + dependencies: + cliui: ^8.0.1 + escalade: ^3.1.1 + get-caller-file: ^2.0.5 + require-directory: ^2.1.1 + string-width: ^4.2.3 + y18n: ^5.0.5 + yargs-parser: ^21.1.1 + checksum: 73b572e863aa4a8cbef323dd911d79d193b772defd5a51aab0aca2d446655216f5002c42c5306033968193bdbf892a7a4c110b0d77954a7fdf563e653967b56a + languageName: node + linkType: hard + +"yauzl@npm:^2.10.0": + version: 2.10.0 + resolution: "yauzl@npm:2.10.0" + dependencies: + buffer-crc32: ~0.2.3 + fd-slicer: ~1.1.0 + checksum: 7f21fe0bbad6e2cb130044a5d1d0d5a0e5bf3d8d4f8c4e6ee12163ce798fee3de7388d22a7a0907f563ac5f9d40f8699a223d3d5c1718da90b0156da6904022b + languageName: node + linkType: hard + +"ylru@npm:^1.2.0": + version: 1.3.2 + resolution: "ylru@npm:1.3.2" + checksum: b6bb3931144424114f2350c072cfeb180f205add93509c605ae025cbed8059846f8a5767655feeeab890d288b5b4c4b36f5d5d867ee4e6946c16bcc7ec3ddaee + languageName: node + linkType: hard + +"yn@npm:3.1.1": + version: 3.1.1 + resolution: "yn@npm:3.1.1" + checksum: 2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6 + languageName: node + linkType: hard + +"yocto-queue@npm:^0.1.0": + version: 0.1.0 + resolution: "yocto-queue@npm:0.1.0" + checksum: f77b3d8d00310def622123df93d4ee654fc6a0096182af8bd60679ddcdfb3474c56c6c7190817c84a2785648cdee9d721c0154eb45698c62176c322fb46fc700 + languageName: node + linkType: hard + +"yocto-queue@npm:^1.0.0": + version: 1.0.0 + resolution: "yocto-queue@npm:1.0.0" + checksum: 2cac84540f65c64ccc1683c267edce396b26b1e931aa429660aefac8fbe0188167b7aee815a3c22fa59a28a58d898d1a2b1825048f834d8d629f4c2a5d443801 + languageName: node + linkType: hard + +"zwitch@npm:^1.0.0": + version: 1.0.5 + resolution: "zwitch@npm:1.0.5" + checksum: 28a1bebacab3bc60150b6b0a2ba1db2ad033f068e81f05e4892ec0ea13ae63f5d140a1d692062ac0657840c8da076f35b94433b5f1c329d7803b247de80f064a + languageName: node + linkType: hard + +"zx@npm:7.1.1": + version: 7.1.1 + resolution: "zx@npm:7.1.1" + dependencies: + "@types/fs-extra": ^9.0.13 + "@types/minimist": ^1.2.2 + "@types/node": ^18.7.20 + "@types/ps-tree": ^1.1.2 + "@types/which": ^2.0.1 + chalk: ^5.0.1 + fs-extra: ^10.1.0 + globby: ^13.1.2 + minimist: ^1.2.6 + node-fetch: 3.2.10 + ps-tree: ^1.2.0 + which: ^2.0.2 + yaml: ^2.1.1 + bin: + zx: build/cli.js + checksum: 510c56366a62220108247624a83fc088bfc8f393e3f20168d69a67e3c7aff1a4b790c118ee70e58171dcbc91b53ab079bba3074e1c40829f6179a7f48a38be78 + languageName: node + linkType: hard