Skip to content

Commit

Permalink
fix: update README and cleanup (#282)
Browse files Browse the repository at this point in the history
* Fix to use `workspace.dependencies`, and update README.

* Update CI.

* Replace `0.9.0` version with `0.10.0`.
  • Loading branch information
silathdiir authored Oct 7, 2023
1 parent 8e3b21a commit 53dd869
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 109 deletions.
47 changes: 22 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ on:
- main

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CARGO_INCREMENTAL: false
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git

jobs:
skip_check:
Expand All @@ -32,39 +31,37 @@ jobs:
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: fmt
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly-2022-12-10
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt
run: |
cargo build --release
cargo fmt --all -- --check
components: rustfmt
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Cargo check
run: cargo check --all-features
- name: Cargo fmt
run: cargo fmt --all -- --check

clippy:
needs: [skip_check]
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: clippy
name: Clippy
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly-2022-12-10
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
run: |
cargo build --release
cargo clippy --release --features prove_verify -- -D warnings
components: clippy
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all-features --all-targets -- -D warnings
44 changes: 28 additions & 16 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ on:
- main

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CARGO_INCREMENTAL: false
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git

jobs:
skip_check:
Expand All @@ -27,35 +26,48 @@ jobs:
concurrent_skipping: 'same_content_newer'
paths_ignore: '["**/README.md"]'

linux-test:
test:
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: Linux Test on ${{ matrix.rust }}
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64]
rust: [nightly]
container:
image: ${{ matrix.arch }}/rust
env:
# Disable full debug symbol generation to speed up CI build and keep memory down
# "1" means line tables only, which is useful for panic tracebacks.
RUSTFLAGS: "-C debuginfo=1"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- run: git config --system --add safe.directory /__w/scroll-prover/scroll-prover
- uses: actions/setup-go@v3
- uses: dtolnay/rust-toolchain@master
with:
go-version: '>=1.18.0'
- name: Setup Rust toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
toolchain: nightly-2022-12-10
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Setup golang
uses: actions/setup-go@v3
with:
cache: false
go-version: ~1.19
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ matrix.arch }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.arch }}-go-
# https://github.com/actions/cache/issues/810
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
- name: Run tests
run: cargo test
run: cargo test --verbose
34 changes: 18 additions & 16 deletions Cargo.lock

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

27 changes: 27 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ members = [
"integration",
]

[workspace.package]
version = "0.10.0"
edition = "2021"
license = "MIT OR Apache-2.0"

[workspace.dependencies]
anyhow = "1.0"
clap = { version = "3.1", features = ["derive"] }
ethers-providers = "1.0"
glob = "0.3"
itertools = "0.10"
log = "0.4"
log4rs = { version = "1.2", default_features = false, features = ["console_appender", "file_appender"] }
rand = "0.8"
rand_xorshift = "0.3"
reqwest = { version = "0.11", default-features = false, features = [ "json", "rustls-tls" ] }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
tokio = { version = "1.32", features = ["full"] }

halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "develop" }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop", default-features = false, features = ["parallel_syn", "scroll", "shanghai"] }
zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop", default-features = false, features = ["parallel_syn", "scroll", "shanghai"] }

integration = { path = "integration" }

[patch.crates-io]
ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
[patch."https://github.com/privacy-scaling-explorations/halo2.git"]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ build-release: ## Check build in release mode
@cargo build --release

fmt: ## Check whether the code is formatted correctly
@cargo fmt --all -- --check
@cargo check --all-features

clippy: ## Run clippy checks over all workspace members
@cargo check --all-features
@cargo clippy --release --features prove_verify -- -D warnings
@cargo clippy --all-features --all-targets -- -D warnings

test: ## Run tests for all the workspace members
@cargo test --release --all
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,22 @@ make download-setup -e degree=DEGREE params_dir=PARAMS_DIR

`make test-chunk-prove` and `make test-agg-prove` are the main testing entries for multi-level circuit constraint system of scroll-prover. Developers could understand how the system works by reading the codes of these tests.

Besides it, `make test-inner-prove` could be used to test the first-level circuit, and `make test-batch-prove` could be used to test the final two levels.
And there are other tests:
- `make test-inner-prove` could be used to test the first-level circuit.
- `make test-batch-prove` could be used to test the final two levels.
- `make test-batches-with-each-chunk-num-prove` could be used to test batch proving with different chunk numbers.

### Binaries

This repository is designed to be used as a Rust crate, rather than a standalone running process. However, you can still use the following command to run binaries locally.
Could use the following command to run binaries locally.

If you run into linking issues you may need to run
If run into linking issues you may need to run
```shell
cp `find ./target/release/ | grep libzktrie.so` /usr/local/lib/
```
To move the zktrielib into a path where your linker could locate it.

Run zkevm prover to generate chunk proof (the word-dir is `./integration`)
Run zkevm prover to generate chunk proof (work directory is `./integration`)
```shell
cargo build --release --bin zkevm_prove

Expand All @@ -53,10 +56,10 @@ Could specify arguments as
export OUTPUT_DIR="proof_data"

# Params file should be located in `./integration/test_params`.
cargo run --release --bin zkevm_prove -- --params=test_params --trace=tests/traces/erc20/10_transfer.json
cargo run --release --bin zkevm_prove -- --params=test_params --trace=tests/extra_traces/new.json
```

Run zkevm verifier to verify chunk proof (the word-dir is `./integration`)
Run zkevm verifier to verify chunk proof (work directory is `./integration`)
```shell
cargo build --release --bin zkevm_verify

Expand Down
39 changes: 19 additions & 20 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
[package]
name = "bin"
version = "0.9.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
version.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
anyhow = "1.0"
clap = { version = "3.1.3", features = ["derive"] }
dotenv = "0.15.0"
ethers-providers = "1.0"
itertools = "0.10.5"
log = "0.4"
log4rs = { version = "1.2.0", default_features = false, features = ["console_appender", "file_appender"] }
rand = "0.8"
rand_xorshift = "0.3"
reqwest = { version = "0.11", default-features = false, features = [ "json", "rustls-tls" ] }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0.66"
tokio = { version = "1", features = ["full"] }
integration = { path = "../integration" }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop", default-features = false, features = ["parallel_syn", "scroll", "shanghai"] }
anyhow.workspace = true
clap.workspace = true
ethers-providers.workspace = true
itertools.workspace = true
log.workspace = true
log4rs.workspace = true
rand.workspace = true
rand_xorshift.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
tokio.workspace = true

prover.workspace = true
integration.workspace = true

[[bin]]
name = "zkevm_prove"
Expand Down
1 change: 1 addition & 0 deletions bin/src/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn prove_batch(id: &str, chunk_proofs: Vec<ChunkProof>) {

pub fn prove_chunk(id: &str, witness_block: &WitnessBlock) -> Option<ChunkProof> {
let result = catch_unwind(AssertUnwindSafe(|| {
#[cfg(not(feature = "chunk-prove"))]
let proof = None::<ChunkProof>;

#[cfg(feature = "inner-prove")]
Expand Down
Loading

1 comment on commit 53dd869

@axelcazorla
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bravo equipo !

Please sign in to comment.