Skip to content

Commit f07ca3d

Browse files
AronisAt79ntampakasChihChengLiang
authored
Integration tests benchmarks (privacy-scaling-explorations#1615)
### Description Move SC compilation step to a build script. Rewrite deployment function based on SC rust bindings generated with [ethers_contract_abigen::Abigen](https://docs.rs/ethers-contract-abigen/latest/ethers_contract_abigen/) and submit Txs for proof generation benchmarking. ### Issue Link privacy-scaling-explorations#1557 ### Type of change - New feature (non-breaking change which adds functionality) ### Contents - build.rs : Compile smart contracts and generate rust bindings - gen_blockchain_data: - Remove compilation step and rewrite fn deploy. New one uses the bindings generated at build step to deploy SCs and also instantiates SC instances to interact with. - Create a dump TxTrace function [needed for testing future implementations of benchmark contracts - needs attribute allow(dead_code)] - Submit Txs optimized for maximum calls of MLOAD and SDIV up to 300k gas ### How Has This Been Tested? ``` https://github.com/privacy-scaling-explorations/zkevm-circuits/actions/runs/6264433154 ``` ~~https://github.com/privacy-scaling-explorations/zkevm-circuits/actions/runs/6234076847/job/16920593180~~ ~~>> Workflow build step is currently failing~~ --------- Co-authored-by: ntampakas <[email protected]> Co-authored-by: Chih Cheng Liang <[email protected]>
1 parent e48d06f commit f07ca3d

16 files changed

+523
-228
lines changed

.github/workflows/integration.yml

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ jobs:
9393
~/.cargo/git/db/
9494
target/
9595
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
96+
- name: Update git submodule
97+
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
98+
- name: Install openssl
99+
run: sudo apt-get install -y pkg-config libssl-dev
96100
# Run an initial build in a separate step to split the build time from execution time
97101
- name: Build bins
98102
run: cargo build --bin gen_blockchain_data

.github/workflows/lints.yml

+10
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ jobs:
5959
target/
6060
key: lint-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
6161

62+
- name: Install solc
63+
run: |
64+
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
65+
sudo chmod +x /usr/bin/solc
66+
- name: Update ERC20 git submodule
67+
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
68+
- name: Cargo build
69+
uses: actions-rs/cargo@v1
70+
with:
71+
command: build
6272
- name: Check code format
6373
uses: actions-rs/cargo@v1
6474
with:

.github/workflows/main-tests.yml

+18
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ jobs:
6969
~/.cargo/git/db/
7070
target/
7171
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
72+
- name: Install solc
73+
run: |
74+
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
75+
sudo chmod +x /usr/bin/solc
76+
- name: Update ERC20 git submodule
77+
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
7278
- name: Run light tests # light tests are run in parallel
7379
uses: actions-rs/cargo@v1
7480
with:
@@ -121,6 +127,12 @@ jobs:
121127
~/.cargo/git/db/
122128
target/
123129
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
130+
- name: Install solc
131+
run: |
132+
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
133+
sudo chmod +x /usr/bin/solc
134+
- name: Update ERC20 git submodule
135+
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
124136
- name: Run heavy tests # heavy tests are run serially to avoid OOM
125137
uses: actions-rs/cargo@v1
126138
with:
@@ -163,6 +175,12 @@ jobs:
163175
~/.cargo/git/db/
164176
target/
165177
key: build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
178+
- name: Install solc
179+
run: |
180+
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
181+
sudo chmod +x /usr/bin/solc
182+
- name: Update ERC20 git submodule
183+
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
166184
- name: cargo build
167185
uses: actions-rs/cargo@v1
168186
with:

Cargo.lock

+55-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
gendata_output.json
2+
src/bindings_benchmarks.rs
3+
src/bindings_greeter.rs
4+
src/bindings_openzeppelinerc20testtoken.rs

integration-tests/Cargo.toml

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ paste = "1.0"
2525
rand_xorshift = "0.3.0"
2626
rand_core = "0.6.4"
2727
mock = { path = "../mock" }
28+
this = "0.3.0"
29+
error = "0.1.9"
2830

2931
[dev-dependencies]
3032
pretty_assertions = "1.0.0"
@@ -35,3 +37,14 @@ rpc = []
3537
circuit_input_builder = []
3638
circuits = []
3739
mock_prover = []
40+
41+
[build-dependencies]
42+
env = "0.0.0"
43+
ethers = "2.0.7"
44+
ethers-contract-abigen = "2.0.8"
45+
glob = "0.3.1"
46+
log = "0.4.14"
47+
serde = "1.0.130"
48+
serde_json = "1.0.66"
49+
uneval = "0.2.4"
50+
thiserror = "1.0.49"

0 commit comments

Comments
 (0)