Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Integration tests benchmarks (#1615)
Browse files Browse the repository at this point in the history
### 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

#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 <nick@gmx.co.uk>
Co-authored-by: Chih Cheng Liang <chihchengliang@gmail.com>
  • Loading branch information
3 people authored Nov 18, 2023
1 parent e48d06f commit f07ca3d
Show file tree
Hide file tree
Showing 16 changed files with 523 additions and 228 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Update git submodule
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
- name: Install openssl
run: sudo apt-get install -y pkg-config libssl-dev
# Run an initial build in a separate step to split the build time from execution time
- name: Build bins
run: cargo build --bin gen_blockchain_data
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ jobs:
target/
key: lint-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install solc
run: |
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo chmod +x /usr/bin/solc
- name: Update ERC20 git submodule
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Check code format
uses: actions-rs/cargo@v1
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/main-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install solc
run: |
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo chmod +x /usr/bin/solc
- name: Update ERC20 git submodule
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
- name: Run light tests # light tests are run in parallel
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -121,6 +127,12 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install solc
run: |
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo chmod +x /usr/bin/solc
- name: Update ERC20 git submodule
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
- name: Run heavy tests # heavy tests are run serially to avoid OOM
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -163,6 +175,12 @@ jobs:
~/.cargo/git/db/
target/
key: build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install solc
run: |
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
sudo chmod +x /usr/bin/solc
- name: Update ERC20 git submodule
run: git submodule update --init --recursive --checkout integration-tests/contracts/vendor/openzeppelin-contracts
- name: cargo build
uses: actions-rs/cargo@v1
with:
Expand Down
59 changes: 55 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions integration-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
gendata_output.json
src/bindings_benchmarks.rs
src/bindings_greeter.rs
src/bindings_openzeppelinerc20testtoken.rs
13 changes: 13 additions & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ paste = "1.0"
rand_xorshift = "0.3.0"
rand_core = "0.6.4"
mock = { path = "../mock" }
this = "0.3.0"
error = "0.1.9"

[dev-dependencies]
pretty_assertions = "1.0.0"
Expand All @@ -35,3 +37,14 @@ rpc = []
circuit_input_builder = []
circuits = []
mock_prover = []

[build-dependencies]
env = "0.0.0"
ethers = "2.0.7"
ethers-contract-abigen = "2.0.8"
glob = "0.3.1"
log = "0.4.14"
serde = "1.0.130"
serde_json = "1.0.66"
uneval = "0.2.4"
thiserror = "1.0.49"
Loading

0 comments on commit f07ca3d

Please sign in to comment.