Add arithmetics over G2 elements #394
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: [workflow_dispatch, push, pull_request] | |
env: | |
ANVIL_PRIVATE_KEY: ${{secrets.ANVIL_PRIVATE_KEY}} | |
ANVIL_URL: ${{secrets.ANVIL_RPC_URL}} | |
jobs: | |
integration-tests-e2e-zeromorph: | |
needs: [ unit-tests ] | |
strategy: | |
fail-fast: true | |
name: E2E verification (Zeromorph) | |
runs-on: [ self-hosted ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Deploy main contract | |
run: | | |
echo "CONTRACT_ADDRESS=$(forge script script/Deployment.s.sol:NovaZeromorphVerifierDeployer --fork-url $ANVIL_URL --private-key $ANVIL_PRIVATE_KEY --broadcast --non-interactive | sed -n 's/.*Contract Address: //p' | tail -1)" >> $GITHUB_OUTPUT | |
id: deployment-zeromorph | |
- name: Load proof and public parameters | |
run: | | |
python loaderZeromorph.py verifier-key-zeromorph.json compressed-snark-zeromorph.json ${{steps.deployment-zeromorph.outputs.CONTRACT_ADDRESS}} $ANVIL_URL $ANVIL_PRIVATE_KEY | |
- name: Check proof verification status | |
run: | | |
[[ $(cast call ${{steps.deployment-zeromorph.outputs.CONTRACT_ADDRESS}} "verify(uint32,uint256[],uint256[],bool)(bool)" "3" "[1]" "[0]" "true" --private-key $ANVIL_PRIVATE_KEY --rpc-url $ANVIL_URL) == true ]] && exit 0 || exit 1 | |
integration-tests-e2e-grumpkin: | |
needs: [ unit-tests ] | |
strategy: | |
fail-fast: true | |
name: E2E verification (Grumpkin) | |
runs-on: [ self-hosted ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Deploy main contract | |
run: | | |
echo "CONTRACT_ADDRESS=$(forge script script/Deployment.s.sol:NovaGrumpkinVerifierDeployer --fork-url $ANVIL_URL --private-key $ANVIL_PRIVATE_KEY --broadcast --non-interactive | sed -n 's/.*Contract Address: //p' | tail -1)" >> $GITHUB_OUTPUT | |
id: deployment-grumpkin | |
- name: Load proof and public parameters | |
run: | | |
python loaderGrumpkin.py verifier-key-grumpkin.json compressed-snark-grumpkin.json ${{steps.deployment-grumpkin.outputs.CONTRACT_ADDRESS}} $ANVIL_URL $ANVIL_PRIVATE_KEY | |
- name: Check proof verification status | |
run: | | |
[[ $(cast call ${{steps.deployment-grumpkin.outputs.CONTRACT_ADDRESS}} "verify(uint32,uint256[],uint256[],bool)(bool)" "3" "[1]" "[0]" "true" --private-key $ANVIL_PRIVATE_KEY --rpc-url $ANVIL_URL) == true ]] && exit 0 || exit 1 | |
integration-tests-e2e-pasta: | |
needs: [unit-tests] | |
strategy: | |
fail-fast: true | |
name: E2E verification (Pasta) | |
runs-on: [self-hosted] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Deploy main contract | |
run: | | |
echo "CONTRACT_ADDRESS=$(forge script script/Deployment.s.sol:NovaPastaVerifierDeployer --fork-url $ANVIL_URL --private-key $ANVIL_PRIVATE_KEY --broadcast --non-interactive | sed -n 's/.*Contract Address: //p' | tail -1)" >> $GITHUB_OUTPUT | |
id: deployment-pasta | |
- name: Load proof and public parameters | |
run: | | |
python loaderPasta.py verifier-key-pasta.json compressed-snark-pasta.json ${{steps.deployment-pasta.outputs.CONTRACT_ADDRESS}} $ANVIL_URL $ANVIL_PRIVATE_KEY | |
- name: Check proof verification status | |
run: | | |
[[ $(cast call ${{steps.deployment-pasta.outputs.CONTRACT_ADDRESS}} "verify(uint32,uint256[],uint256[],bool)(bool)" "3" "[1]" "[0]" "true" --private-key $ANVIL_PRIVATE_KEY --rpc-url $ANVIL_URL) == true ]] && exit 0 || exit 1 | |
unit-tests: | |
strategy: | |
fail-fast: true | |
name: Unit Tests | |
runs-on: [self-hosted] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Check formatting | |
run: | | |
forge fmt --check | |
- name: Regenerate Contracts | |
run: | | |
python src/blocks/poseidon/poseidon-contract-gen.py src/blocks/poseidon/neptune-constants-U24-pallas.json PoseidonU24Pallas > src/blocks/poseidon/PoseidonNeptuneU24pallas.sol | |
python src/blocks/poseidon/poseidon-contract-gen.py src/blocks/poseidon/neptune-constants-U24-vesta.json PoseidonU24Vesta > src/blocks/poseidon/PoseidonNeptuneU24vesta.sol | |
- name: Run forge fmt on re-generated contracts | |
run: | | |
forge fmt | |
- name: Check discrepancies | |
run: | | |
if [[ `git status --porcelain` ]]; then | |
echo "There are discrepancies between the repository and the source. Please ensure the contracts are up to date." | |
exit 1 | |
fi | |
- name: Run Forge build | |
run: | | |
forge --version | |
forge build | |
- name: Run Forge tests | |
run: | | |
forge test -vvv | |
- name: Get sizes of compiled contracts | |
run: | | |
forge --version | |
forge build --sizes || true |