-
Notifications
You must be signed in to change notification settings - Fork 11
94 lines (75 loc) · 2.79 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: test
on: [workflow_dispatch, push, pull_request]
env:
FOUNDRY_PROFILE: ci
jobs:
integration-tests:
#needs: [unit-tests]
strategy:
fail-fast: true
name: Integration Tests
runs-on: [self-hosted, anvil]
steps:
- name: Setup screen
run: |
sudo apt update -y && sudo apt install -y screen
- name: Starting Anvil node
run: |
screen -d -m anvil --gas-limit 18446744073709551615 --code-size-limit 18446744073709551615 && screen -list
- name: Deploy main contract
run: |
forge script script/Deployment.s.sol:NovaVerifierDeployer --fork-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
- name: Load proof and public parameters
run: |
python loader.py verifier-key.json compressed-snark.json 0x720472c8ce72c2a2d711333e064abd3e6bbeadd3
- name: Check proof verification status
run: |
[[ $(cast call 0x720472c8ce72c2a2d711333e064abd3e6bbeadd3 "verify(uint32,uint256[],uint256[],bool)(bool)" "3" "[1]" "[0]" "false" --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80) == true ]] && exit 0 || exit 1
unit-tests:
strategy:
fail-fast: true
name: Unit Tests
runs-on: [self-hosted, anvil]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Check formatting
run: |
forge fmt --check
id: formatting
- name: Regenerate Contracts
run: |
python src/blocks/poseidon/poseidon-contract-gen.py neptune-constants-U24-pallas.json PoseidonU24Pallas > src/blocks/poseidon/PoseidonNeptuneU24pallas.sol
python src/blocks/poseidon/poseidon-contract-gen.py 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
id: build
- name: Run Forge tests
run: |
forge test -vvv
id: test
- name: Get sizes of compiled contracts
run: |
forge --version
forge build --sizes || true
id: build-with-sizes