diff --git a/.github/actions/setup-foundry/action.yml b/.github/actions/setup-foundry/action.yml new file mode 100644 index 0000000..21ed65d --- /dev/null +++ b/.github/actions/setup-foundry/action.yml @@ -0,0 +1,8 @@ +name: Install Foundry +description: Installs the workspace's foundry + +runs: + using: composite + steps: + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 diff --git a/.github/actions/setup-nargo/action.yml b/.github/actions/setup-nargo/action.yml new file mode 100644 index 0000000..d2d7551 --- /dev/null +++ b/.github/actions/setup-nargo/action.yml @@ -0,0 +1,18 @@ +name: Install Nargo +description: Installs the workspace's nargo +inputs: + version: + description: The version of the project to install dependencies for + required: true + +runs: + using: composite + steps: + - name: Install Nargo + uses: noir-lang/noirup@v0.1.2 + with: + toolchain: ${{ inputs.version }} + + - name: Use Nargo + run: nargo --version + shell: bash diff --git a/.github/actions/setup/action.yml b/.github/actions/setup-yarn/action.yml similarity index 64% rename from .github/actions/setup/action.yml rename to .github/actions/setup-yarn/action.yml index af53672..feb61d7 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup-yarn/action.yml @@ -4,9 +4,6 @@ inputs: project: description: The project to install dependencies for required: true - version: - description: The version of the project to install dependencies for - required: true runs: using: composite @@ -23,12 +20,3 @@ runs: - name: Install run: yarn --immutable shell: bash - - - name: Install Nargo - uses: noir-lang/noirup@v0.1.2 - with: - toolchain: ${{ inputs.version }} - - - name: Use Nargo - run: nargo --version - shell: bash diff --git a/.github/scripts/latest.js b/.github/scripts/latest.js index 3052b74..45b8f58 100644 --- a/.github/scripts/latest.js +++ b/.github/scripts/latest.js @@ -16,11 +16,14 @@ async function main() { release => !release.tag_name.includes('aztec') && !release.tag_name.includes('nightly'), ); - const latestStable = filtered.find(release => !release.prerelease).tag_name; - const latestPreRelease = filtered.find(release => release.prerelease).tag_name; + const latestStable = filtered.find(release => !release.prerelease).tag_name.substring(1); + const latestPreRelease = filtered.find(release => release.prerelease).tag_name.substring(1); // TODO: add the prerelease to this object! - const workflowOutput = JSON.stringify({ stable: latestStable }); + const workflowOutput = JSON.stringify({ + stable: latestStable, + prerelease: latestPreRelease, + }); console.log(workflowOutput); // DON'T REMOVE, GITHUB WILL CAPTURE THIS OUTPUT } diff --git a/.github/workflows/vite_hardhat.yaml b/.github/workflows/vite_hardhat.yaml index 5e2d19b..fcfb5b2 100644 --- a/.github/workflows/vite_hardhat.yaml +++ b/.github/workflows/vite_hardhat.yaml @@ -14,6 +14,25 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get latest version + id: versions_step + run: | + output=$(node ../.github/scripts/latest.js) + echo "Output from Node.js script: $output" + + STABLE=$(echo $output | jq -r '.stable') + echo "::set-output name=stable::$STABLE" + + - name: Set up yarn + uses: ./.github/actions/setup-yarn + with: + project: vite-hardhat + + - name: Set up nargo + uses: ./.github/actions/setup-nargo + with: + version: ${{ steps.versions_step.outputs.stable }} + - name: Enable Corepack before setting up Node run: corepack enable diff --git a/.github/workflows/vite_hardhat_nightly.yaml b/.github/workflows/vite_hardhat_nightly.yaml index 94955f6..bb876e1 100644 --- a/.github/workflows/vite_hardhat_nightly.yaml +++ b/.github/workflows/vite_hardhat_nightly.yaml @@ -8,10 +8,12 @@ on: - cron: '0 2 * * *' jobs: - setup: + vite-hardhat-setup: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + versions: ${{ steps.set-matrix.outputs.versions }} + versions_map: ${{ steps.set-matrix.outputs.versions_map }} + steps: - uses: actions/checkout@v4 @@ -20,40 +22,66 @@ jobs: run: | output=$(node ./.github/scripts/latest.js) echo "Output from Node.js script: $output" - echo "::set-output name=versionArray::$output" + echo "::set-output name=versionsMap::$output" - name: Set Up Matrix id: set-matrix run: | - VERSIONS='${{ steps.versions_step.outputs.versionArray }}' - echo "Versions for Matrix: $VERSIONS" - MATRIX=$(echo "$VERSIONS" | jq -c '{versions: .} | .versions | to_entries | map({key: .key, value: (.value | sub("^v"; ""))})') - echo "::set-output name=matrix::{\"include\":$MATRIX}" + VERSIONS_MAP='${{ steps.versions_step.outputs.versionsMap }}' + echo "Versions out of script: $VERSIONS_MAP" + + VERSIONS=$(echo "$VERSIONS_MAP" | jq -c '[.[]]') + echo "::set-output name=versions::$VERSIONS" + echo "::set-output name=versions_map::$VERSIONS_MAP" - test-drift-vite-hardhat: - needs: setup + vite-hardhat-test-drift: + needs: vite-hardhat-setup runs-on: ubuntu-latest defaults: run: working-directory: vite-hardhat strategy: - matrix: ${{fromJson(needs.setup.outputs.matrix)}} + fail-fast: false + matrix: + version: ${{ fromJson(needs.vite-hardhat-setup.outputs.versions) }} + # if it errors, we still need to know about it! steps: - uses: actions/checkout@v4 - - name: Set up test environment - uses: ./.github/actions/setup + - name: Set up yarn + uses: ./.github/actions/setup-yarn with: project: vite-hardhat - version: ${{ matrix.value }} + + - name: Set up nargo + uses: ./.github/actions/setup-nargo + with: + version: ${{ matrix.version }} + + - name: Get stability + id: get-stability + env: + VERSIONS_MAP: ${{ needs.vite-hardhat-setup.outputs.versions_map }} + run: | + VERSION="${{ matrix.version }}" + echo "Version Number: $VERSION" + + STABLE_VERSION=$(echo "$VERSIONS_MAP" | jq -r --arg VERSION "$VERSION" '.stable') + if [ "$STABLE_VERSION" == "$VERSION" ]; then + IS_STABLE="true" + else + IS_STABLE="false" + fi + echo "Is stable: $IS_STABLE" + echo "::set-output name=is_stable::$IS_STABLE" - name: Install test version run: | yarn add \ - @noir-lang/noir_js@${{ matrix.value }} \ - @noir-lang/backend_barretenberg@${{ matrix.value }} \ - @noir-lang/noir_wasm@${{ matrix.value }} \ - @noir-lang/types@${{ matrix.value }} + @noir-lang/noir_js@${{ matrix.version }} \ + @noir-lang/backend_barretenberg@${{ matrix.version }} \ + @noir-lang/noir_wasm@${{ matrix.version }} \ + @noir-lang/types@${{ matrix.version }} - name: 'Create env file' run: | @@ -70,4 +98,26 @@ jobs: - name: Run test run: yarn test - continue-on-error: ${{ matrix.key == 'prerelease' }} + id: yarn_test + + - name: Send GitHub Action trigger data to Slack workflow - Stable + uses: slackapi/slack-github-action@v1.24.0 + if: ${{ failure() && steps.get-stability.outputs.is_stable == 'true' }} + with: + payload: | + { + "text": "Oooops, seems like latest stable Noir breaks noir-starter! Projects needing updating: vite-hardhat ${{ matrix.version }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + - name: Send GitHub Action trigger data to Slack workflow - Prerelease + uses: slackapi/slack-github-action@v1.24.0 + if: ${{ failure() && steps.get-stability.outputs.is_stable == 'false' }} + with: + payload: | + { + "text": "Heads up DevRel! Once the prerelease becomes stable, the following project will break: vite-hardhat ${{ matrix.version }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/with_foundry.yaml b/.github/workflows/with_foundry.yaml index 355c6af..4a0cb23 100644 --- a/.github/workflows/with_foundry.yaml +++ b/.github/workflows/with_foundry.yaml @@ -14,13 +14,22 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Nargo - uses: noir-lang/noirup@v0.1.2 + - name: Get latest version + id: versions_step + run: | + output=$(node ../.github/scripts/latest.js) + echo "Output from Node.js script: $output" + + STABLE=$(echo $output | jq -r '.stable') + echo "::set-output name=stable::$STABLE" + + - name: Set up nargo + uses: ./.github/actions/setup-nargo with: - toolchain: 0.11.0 + version: ${{ steps.versions_step.outputs.stable }} - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + - name: Set up foundry + uses: ./.github/actions/setup-foundry - name: Generate verifier contract run: | diff --git a/.github/workflows/with_foundry_nightly.yaml b/.github/workflows/with_foundry_nightly.yaml index 2027ce1..496e57b 100644 --- a/.github/workflows/with_foundry_nightly.yaml +++ b/.github/workflows/with_foundry_nightly.yaml @@ -46,11 +46,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up test environment - uses: ./.github/actions/setup + - name: Set up nargo + uses: ./.github/actions/setup-nargo with: version: ${{ matrix.version }} + - name: Set up foundry + uses: ./.github/actions/setup-foundry + - name: Get stability id: get-stability env: @@ -82,6 +85,11 @@ jobs: echo LOCALHOST_PRIVATE_KEY="${{ secrets.LOCALHOST_PRIVATE_KEY }}" >> .env echo ANVIL_RPC="${{ secrets.ANVIL_RPC }}" >> .env + - name: Generate verifier contract + run: | + nargo codegen-verifier + working-directory: with-foundry/circuits + - name: Generate proof run: | nargo prove @@ -91,14 +99,24 @@ jobs: run: | forge test --optimize --optimizer-runs 5000 --evm-version london - - name: Send GitHub Action trigger data to Slack workflow - id: slack + - name: Send GitHub Action trigger data to Slack workflow - Stable + uses: slackapi/slack-github-action@v1.24.0 + if: ${{ failure() && steps.get-stability.outputs.is_stable == 'true' }} + with: + payload: | + { + "text": "Oooops, seems like latest stable Noir breaks noir-starter! Projects needing updating: with-foundry ${{ matrix.version }}" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + - name: Send GitHub Action trigger data to Slack workflow - Prerelease uses: slackapi/slack-github-action@v1.24.0 if: ${{ failure() && steps.get-stability.outputs.is_stable == 'false' }} with: payload: | { - "text": "Once the prerelease becomes stable, projects need updating: with-foundry ${{ matrix.version }}" + "text": "Heads up DevRel! Once the prerelease becomes stable, the following project will break: with-foundry ${{ matrix.version }}" } env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/vite-hardhat/.env.example b/vite-hardhat/.env.example index 8362472..ed34794 100644 --- a/vite-hardhat/.env.example +++ b/vite-hardhat/.env.example @@ -1,7 +1,6 @@ -DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" # hardhat acct #0 key, please update MUMBAI_DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" MUMBAI_ALCHEMY_KEY="" # hardhat acct #0 key, please update SEPOLIA_DEPLOYER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" -SEPOLIA_ALCHEMY_KEY="" \ No newline at end of file +SEPOLIA_ALCHEMY_KEY="" diff --git a/vite-hardhat/circuits/Nargo.toml b/vite-hardhat/circuits/Nargo.toml index 633677c..23365e9 100644 --- a/vite-hardhat/circuits/Nargo.toml +++ b/vite-hardhat/circuits/Nargo.toml @@ -2,6 +2,6 @@ name = "noirstarter" type = "bin" authors = [""] -compiler_version = "0.19.4" +compiler_version = ">0.19.0" [dependencies] diff --git a/with-foundry/.env.example b/with-foundry/.env.example index 26409ff..fc372ad 100644 --- a/with-foundry/.env.example +++ b/with-foundry/.env.example @@ -1,3 +1,3 @@ ANVIL_RPC= -PRIVATE_KEY= -SEPOLIA_RPC=https://rpc2.sepolia.org \ No newline at end of file +LOCALHOST_PRIVATE_KEY= +SEPOLIA_RPC=https://rpc2.sepolia.org diff --git a/with-foundry/README.md b/with-foundry/README.md index 614d16c..f19895e 100644 --- a/with-foundry/README.md +++ b/with-foundry/README.md @@ -94,7 +94,7 @@ Edit your `.env` file to look like: ``` ANVIL_RPC=http://localhost:8545 -PRIVATE_KEY= +LOCALHOST_PRIVATE_KEY= ``` #### (Option 2) Prepare for testnet @@ -106,7 +106,7 @@ Edit your `.env` file to look like: ```env SEPOLIA_RPC=https://rpc2.sepolia.org -PRIVATE_KEY= +LOCALHOST_PRIVATE_KEY= ``` #### Run the deploy script diff --git a/with-foundry/circuits/Nargo.toml b/with-foundry/circuits/Nargo.toml index f3dc166..ad7b0f4 100644 --- a/with-foundry/circuits/Nargo.toml +++ b/with-foundry/circuits/Nargo.toml @@ -2,6 +2,6 @@ name="with_foundry" type="bin" authors = ["critesjosh"] -compiler_version = "~0.11.0" +compiler_version = ">0.19.0" -[dependencies] \ No newline at end of file +[dependencies] diff --git a/with-foundry/script/Starter.s.sol b/with-foundry/script/Starter.s.sol index d29b9bb..9b8e3a1 100644 --- a/with-foundry/script/Starter.s.sol +++ b/with-foundry/script/Starter.s.sol @@ -11,7 +11,7 @@ contract StarterScript is Script { function setUp() public {} function run() public { - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + uint256 deployerPrivateKey = vm.envUint("LOCALHOST_PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); verifier = new UltraVerifier(); diff --git a/with-foundry/script/Verify.s.sol b/with-foundry/script/Verify.s.sol index 3daf6b1..669c7dc 100644 --- a/with-foundry/script/Verify.s.sol +++ b/with-foundry/script/Verify.s.sol @@ -11,7 +11,7 @@ contract VerifyScript is Script { function setUp() public {} function run() public returns (bool) { - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + uint256 deployerPrivateKey = vm.envUint("LOCALHOST_PRIVATE_KEY"); vm.startBroadcast(deployerPrivateKey); verifier = new UltraVerifier();