Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More drift testing #66

Merged
merged 24 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bfaefa8
Testing notification
signorecello Dec 20, 2023
6acb319
Merge remote-tracking branch 'origin' into zpedro/ci
signorecello Dec 20, 2023
2d634a5
Adding matrix to support more tests, integrating notification
signorecello Dec 20, 2023
3937265
Trying to use matrix for top-level working directory...
signorecello Dec 20, 2023
f4ec61c
JSON parsing
signorecello Dec 20, 2023
d17d6d0
more JSON parsing
signorecello Dec 20, 2023
5e6cf4e
somehow removed one of the blocks lol
signorecello Dec 20, 2023
47b031f
allowing for matrix failure
signorecello Dec 20, 2023
e78f72c
some invalid json nonsense
signorecello Dec 20, 2023
26152ea
adding foundry test
signorecello Dec 21, 2023
b722965
Merge remote-tracking branch 'origin' into zpedro/ci
signorecello Dec 21, 2023
4955bf9
need to separate yarn from nargo setup because foundry project doesnt…
signorecello Dec 21, 2023
27bdb8b
dumbass doesn't know the difference between \> and \=\>
signorecello Dec 21, 2023
8e6aa2c
adding foundry setup phase, pulling stables for PRs too
signorecello Dec 21, 2023
89c7a5d
idiot forgot gen-contract for foundry nightly
signorecello Dec 21, 2023
7c931f3
Merge branch 'main' into zpedro/ci
signorecello Dec 21, 2023
d7b05a8
weird path issue
signorecello Dec 21, 2023
b52ad75
typo
signorecello Dec 21, 2023
89214cf
moving continue on error to job level
signorecello Dec 21, 2023
4d920df
notify needs its own matrix
signorecello Dec 21, 2023
860723d
matrix is ignored in notify, dunno why
signorecello Dec 21, 2023
4a2d6bf
maybe it doesnt even need continue on error? bah
signorecello Dec 21, 2023
10077f5
making vite-hardhat intentionally fail to see what happens
signorecello Dec 21, 2023
b473998
yuhu, time for some holidays
signorecello Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/actions/setup-foundry/action.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .github/actions/setup-nargo/action.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
toolchain: ${{ inputs.version }}

- name: Use Nargo
run: nargo --version
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,12 +20,3 @@ runs:
- name: Install
run: yarn --immutable
shell: bash

- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: ${{ inputs.version }}

- name: Use Nargo
run: nargo --version
shell: bash
9 changes: 6 additions & 3 deletions .github/scripts/latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/vite_hardhat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
86 changes: 68 additions & 18 deletions .github/workflows/vite_hardhat_nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: |
Expand All @@ -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/[email protected]
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/[email protected]
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 }}
19 changes: 14 additions & 5 deletions .github/workflows/with_foundry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install Nargo
uses: noir-lang/[email protected]
- 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: |
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/with_foundry_nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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/[email protected]
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/[email protected]
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 }}
3 changes: 1 addition & 2 deletions vite-hardhat/.env.example
Original file line number Diff line number Diff line change
@@ -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=""
SEPOLIA_ALCHEMY_KEY=""
2 changes: 1 addition & 1 deletion vite-hardhat/circuits/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "noirstarter"
type = "bin"
authors = [""]
compiler_version = "0.19.4"
compiler_version = ">0.19.0"

[dependencies]
4 changes: 2 additions & 2 deletions with-foundry/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ANVIL_RPC=
PRIVATE_KEY=
SEPOLIA_RPC=https://rpc2.sepolia.org
LOCALHOST_PRIVATE_KEY=
SEPOLIA_RPC=https://rpc2.sepolia.org
4 changes: 2 additions & 2 deletions with-foundry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Edit your `.env` file to look like:

```
ANVIL_RPC=http://localhost:8545
PRIVATE_KEY=<the private key you just got from anvil>
LOCALHOST_PRIVATE_KEY=<the private key you just got from anvil>
```

#### (Option 2) Prepare for testnet
Expand All @@ -106,7 +106,7 @@ Edit your `.env` file to look like:

```env
SEPOLIA_RPC=https://rpc2.sepolia.org
PRIVATE_KEY=<the private key of the account with your coins>
LOCALHOST_PRIVATE_KEY=<the private key of the account with your coins>
```

#### Run the deploy script
Expand Down
4 changes: 2 additions & 2 deletions with-foundry/circuits/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name="with_foundry"
type="bin"
authors = ["critesjosh"]
compiler_version = "~0.11.0"
compiler_version = ">0.19.0"

[dependencies]
[dependencies]
2 changes: 1 addition & 1 deletion with-foundry/script/Starter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion with-foundry/script/Verify.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading