Skip to content

Commit

Permalink
Merge branch 'feat/cancun' into type2_cancun
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Jul 10, 2024
2 parents 2a901f0 + ddca6be commit 03948cc
Show file tree
Hide file tree
Showing 111 changed files with 5,998 additions and 7,944 deletions.
2 changes: 1 addition & 1 deletion zero_bin/.cargo/config.toml → .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[build]
# https://github.com/rust-lang/rust/pull/124129
# https://github.com/dtolnay/linkme/pull/88
rustflags = ["-Zlinker-features=-lld"]
rustflags = ["-Z", "linker-features=-lld"]
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# this is loosely based on `docker init`'s rust template.

**/.DS_Store
**/.classpath
**/.dockerignore
# **/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/secrets.dev.yaml
**/values.dev.yaml
/bin
/target
LICENSE
README.md
87 changes: 55 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Continuous Integration

on:
push:
branches: [main]
branches: [develop, main]
pull_request:
branches:
- "**"
Expand Down Expand Up @@ -176,46 +176,69 @@ jobs:
CARGO_INCREMENTAL: 1
RUST_BACKTRACE: 1

# TODO: Update artifact files
test_zk_evm_proc_macro:
name: Test zk_evm_proc_macro
runs-on: ubuntu-latest
timeout-minutes: 30
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Set up rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

# simple_proof_regular:
# name: Execute bash script to generate and verify a proof for a small block.
# runs-on: zero-ci
- name: Test in proc_macro subdirectory
run: cargo test --manifest-path proc_macro/Cargo.toml
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0
RUST_LOG: 1
CARGO_INCREMENTAL: 1
RUST_BACKTRACE: 1

# steps:
# - name: Checkout code
# uses: actions/checkout@v3
simple_proof_regular:
name: Execute bash script to generate and verify a proof for a small block.
runs-on: zero-ci

# - name: Run the script
# run: |
# pushd zero_bin/tools
# ./prove_stdio.sh artifacts/witness_b19240705.json
steps:
- name: Checkout code
uses: actions/checkout@v3

# simple_proof_witness_only:
# name: Execute bash script to generate the proof witness for a small block.
# runs-on: zero-ci
- name: Run the script
run: |
pushd zero_bin/tools
./prove_stdio.sh artifacts/witness_b19807080.json
simple_proof_witness_only:
name: Execute bash script to generate the proof witness for a small block.
runs-on: zero-ci

# steps:
# - name: Checkout code
# uses: actions/checkout@v3
steps:
- name: Checkout code
uses: actions/checkout@v3

# - name: Run the script
# run: |
# pushd zero_bin/tools
# ./prove_stdio.sh artifacts/witness_b19240705.json test_only
- name: Run the script
run: |
pushd zero_bin/tools
./prove_stdio.sh artifacts/witness_b19807080.json test_only
# multi_blocks_proof_regular:
# name: Execute bash script to generate and verify a proof for multiple blocks using parallel proving.
# runs-on: zero-ci
multi_blocks_proof_regular:
name: Execute bash script to generate and verify a proof for multiple blocks using parallel proving.
runs-on: zero-ci

# steps:
# - name: Checkout code
# uses: actions/checkout@v3
steps:
- name: Checkout code
uses: actions/checkout@v3

# - name: Run the script
# run: |
# pushd zero_bin/tools
# ./prove_stdio.sh artifacts/witness_b2_b7.json
- name: Run the script
run: |
pushd zero_bin/tools
./prove_stdio.sh artifacts/witness_b3_b6.json
lints:
name: Rustdoc, Formatting and Clippy
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docker Build & Run

on:
push:
branches: [develop, main]
pull_request:
branches:
- "**"
workflow_dispatch:
branches:
- "**"

jobs:
docker:
name: Regression test docker images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- run: |
docker build --progress=plain --build-arg=PROFILE=dev --tag scratch .
docker run --rm --init --entrypoint leader scratch --help
docker run --rm --init --entrypoint worker scratch --help
docker run --rm --init --entrypoint rpc scratch --help
docker run --rm --init --entrypoint verifier scratch --help
55 changes: 55 additions & 0 deletions .github/workflows/docker_build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker Build & Push

on:
push:
branches: [develop, main]
release:
types: [created]

env:
REGISTRY: ghcr.io

jobs:
docker:
name: Build and push leader and worker docker images to GitHub Container Registry
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
push: true
# platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
98 changes: 98 additions & 0 deletions .github/workflows/jerigon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Jerigon Integration

on:
push:
branches: [develop, main]
pull_request:
branches:
- "**"
workflow_dispatch:
branches:
- "**"


env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io

jobs:
test_jerigon_input_proving:
name: Test proof generation with jerigon input
runs-on: zero-ci
timeout-minutes: 40
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Checkout test-jerigon-network sources
uses: actions/checkout@v4
with:
repository: 0xPolygonZero/jerigon-test-network
ref: 'feat/kurtosis-network'
path: jerigon-test-network

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install kurtosis
run: |
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
sudo apt update
sudo apt install kurtosis-cli
#It is much easier to use cast tool in scripts so install foundry
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Run cancun test network
run: |
docker pull ghcr.io/0xpolygonzero/erigon:feat-zero
kurtosis run --enclave cancun-testnet github.com/ethpandaops/[email protected] --args-file jerigon-test-network/network_params.yml
- name: Generate blocks with transactions
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cast rpc eth_blockNumber --rpc-url $ETH_RPC_URL
cd jerigon-test-network && set -a && source .env && set +a
bash ./tests/generate_transactions.sh
- name: Run prove blocks in test_only mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cd zero_bin/tools
ulimit -n 8192
OUTPUT_TO_TERMINAL=true ./prove_rpc.sh 0x1 0xf $ETH_RPC_URL jerigon true 3000 100 test_only
echo "Proving blocks in test_only mode finished"
- name: Run prove blocks in real mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cd zero_bin/tools
rm -rf proofs/* circuits/* ./proofs.json test.out verify.out leader.out
OUTPUT_TO_TERMINAL=true RUN_VERIFICATION=true ./prove_rpc.sh 0x2 0x8 $ETH_RPC_URL jerigon true 3000 100
echo "Proving blocks in real mode finished"
- name: Shut down network
run: |
kurtosis enclave rm -f cancun-testnet
kurtosis engine stop
56 changes: 56 additions & 0 deletions .github/workflows/pr_checking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: PR check

on:
pull_request:
types: [opened, reopened, synchronize]

permissions:
pull-requests: write

jobs:
pr_check:
name: Validate PR
runs-on: ubuntu-latest
steps:
- name: Set up keywords
id: setup_keywords
run: echo "RESTRICTED_KEYWORDS=$(echo '${{ secrets.RESTRICTED_KEYWORDS }}' | jq -r '.[]' | tr '\n' ' ')" >> $GITHUB_ENV

- name: Check for spam PR
id: check
run: |
# Initialize variables to track spam presence
title_is_spam=false
description_is_spam=false
# Check title for spam
for keyword in $RESTRICTED_KEYWORDS; do
if echo "${{ github.event.pull_request.title }}" | grep -i -q "$keyword"; then
title_is_spam=true
break
fi
done
# Check description for spam
for keyword in $RESTRICTED_KEYWORDS; do
if echo "${{ github.event.pull_request.body }}" | grep -i -q "$keyword"; then
description_is_spam=true
break
fi
done
# Set the output based on the presence of spam
if [ "$title_is_spam" = true ] || [ "$description_is_spam" = true ]; then
echo "is_spam=true" >> $GITHUB_ENV
else
echo "is_spam=false" >> $GITHUB_ENV
fi
- name: Checkout repository
uses: actions/checkout@v4

- name: Close PR if spam are found and author is not a contributor or member
if: ${{ env.is_spam == 'true' && github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' }}
run: gh pr close ${{ github.event.pull_request.number }} --comment "Spam detected"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 03948cc

Please sign in to comment.