Skip to content

Commit

Permalink
Merge branch 'dev' into serdar/xxx-fix-mock-prover
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Sep 30, 2024
2 parents 437c803 + 5086f7c commit 7f784aa
Show file tree
Hide file tree
Showing 67 changed files with 782 additions and 420 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ runs:
~/.cargo/git/db/
target/
~/.rustup/
key: rust-1.79.0-${{ hashFiles('**/Cargo.toml') }}
restore-keys: rust-1.79.0-
key: rust-1.81.0-${{ hashFiles('**/Cargo.toml') }}
restore-keys: rust-1.81.0-

- name: Setup toolchain
id: rustc-toolchain
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.79.0 -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.81.0 -y
2 changes: 1 addition & 1 deletion .github/workflows/docker-gnark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ jobs:
SP1_GNARK_IMAGE: sp1-gnark
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release -p sp1-prover -- --exact tests::test_e2e
74 changes: 72 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release -p sp1-sdk --features native-gnark -- test_e2e_prove_plonk --nocapture
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release -p sp1-sdk -- test_e2e_prove_plonk --nocapture
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
Expand Down Expand Up @@ -128,6 +128,42 @@ jobs:
cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
cycle-tracking:
name: Example (Cycle Tracking)
runs-on:
[
runs-on,
runner=64cpu-linux-arm64,
spot=false,
"run-id=${{ github.run_id }}",
]
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup CI
uses: ./.github/actions/setup

- name: Install SP1 toolchain
run: |
curl -L https://sp1.succinct.xyz | bash
~/.sp1/bin/sp1up
~/.sp1/bin/cargo-prove prove --version
- name: Install SP1 CLI
run: |
cd crates/cli
cargo install --force --locked --path .
cd ~
- name: Run script
run: |
cd examples/cycle-tracking/script
cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
tendermint:
name: Example (Tendermint)
runs-on:
Expand Down Expand Up @@ -167,3 +203,37 @@ jobs:
cargo remove sp1-sdk
cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
test-cuda:
name: Test CUDA
runs-on: nvidia-gpu-linux-x64
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: rust-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
~/.rustup/
key: rust-1.81.0-${{ hashFiles('**/Cargo.toml') }}
restore-keys: rust-1.81.0-

- name: Setup toolchain
id: rustc-toolchain
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.81.0 -y
- name: Run script
run: |
. "$HOME/.cargo/env"
curl -L https://sp1.succinct.xyz | bash
/home/runner/.sp1/bin/sp1up
sudo apt install libssl-dev pkg-config
cd examples/fibonacci
RUST_LOG=info cargo run --release --features cuda
89 changes: 82 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
toolchain: 1.79.0
toolchain: 1.81.0
args: --all-targets --all-features

- name: Run cargo test core-v2
uses: actions-rs/cargo@v1
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release --package sp1-recursion-core-v2 --package sp1-recursion-circuit-v2 --features native-gnark
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
Expand Down Expand Up @@ -71,14 +71,14 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
toolchain: 1.79.0
toolchain: 1.81.0
args: --all-targets --all-features

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release --features native-gnark
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
Expand Down Expand Up @@ -108,14 +108,14 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
toolchain: 1.79.0
toolchain: 1.81.0
args: --all-targets --all-features

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
toolchain: 1.79.0
toolchain: 1.81.0
args: --release --features native-gnark
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
Expand Down Expand Up @@ -312,4 +312,79 @@ jobs:
cd ../script
cargo remove sp1-sdk
cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
SP1_DEV=1 RUST_LOG=info cargo run --release
- name: Run cycle tracking script
run: |
cd examples/cycle-tracking/script
cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
toolchain-test:
name: "Test toolchain installation (${{ matrix.name }})"
strategy:
fail-fast: false
matrix:
include:
- name: "Ubuntu 24.04 (x86_64)"
runner: "ubuntu-24.04"
- name: "Ubuntu 22.04 (x86_64)"
runner: "ubuntu-22.04"
- name: "Ubuntu 20.04 (x86_64)"
runner: "ubuntu-20.04"
- name: "macOS Monterey (x86_64)"
runner: "macos-12"
- name: "macOS Ventura (x86_64)"
runner: "macos-13"
- name: "macOS Sonoma (ARM64)"
runner: "macos-14"

runs-on: "${{ matrix.runner }}"
steps:
- name: "Checkout source code"
uses: "actions/checkout@v4"

- name: "Install cargo-prove"
run: |
cargo install --locked --path ./crates/cli
- name: "Install SP1 toolchain"
run: |
cargo prove install-toolchain --token ${{ secrets.GITHUB_TOKEN }}
- name: "Create SP1 project from template"
run: |
cargo prove new hello
- name: "Build SP1 project"
run: |
cd ./hello/program
cargo prove build
toolchain-test-ec2:
name: "Test toolchain installation (${{ matrix.name }})"
strategy:
fail-fast: false
matrix:
include:
# AMI from `us-east-1`
- name: "Debian 12 (x86_64)"
ec2-instance: "c5.2xlarge"
ami: "ami-064519b8c76274859"
volume: "/dev/xvda"
- name: "Debian 12 (ARM64)"
ec2-instance: "c6g.2xlarge"
ami: "ami-0789039e34e739d67"
volume: "/dev/xvda"
uses: "./.github/workflows/toolchain-ec2.yml"
with:
image-id: "${{ matrix.ami }}"
instance-type: "${{ matrix.ec2-instance }}"
root-volume: "${{ matrix.volume }}"
secrets:
AWS_REGION: "${{ secrets.AWS_REGION }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
AWS_SUBNET_ID: "${{ secrets.AWS_SUBNET_ID }}"
AWS_SG_ID: "${{ secrets.AWS_SG_ID }}"
GH_PAT: "${{ secrets.GH_PAT }}"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
id: rustc-toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
toolchain: 1.81.0
profile: minimal
override: true
targets: ${{ matrix.target }}
Expand Down
127 changes: 127 additions & 0 deletions .github/workflows/toolchain-ec2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: "Toolchain installation test with EC2"

on:
workflow_call:
inputs:
image-id:
required: true
type: "string"
instance-type:
required: true
type: "string"
root-volume:
required: false
type: "string"
default: "/dev/sda1"
secrets:
AWS_REGION:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
AWS_SUBNET_ID:
required: true
AWS_SG_ID:
required: true
GH_PAT:
required: true

jobs:
start-runner:
name: "Start self-hosted EC2 runner"
runs-on: "ubuntu-latest"
outputs:
label: "${{ steps.start-ec2-runner.outputs.label }}"
ec2-instance-id: "${{ steps.start-ec2-runner.outputs.ec2-instance-id }}"

steps:
# Use an access key for an IAM user with these permissions:
# - ec2:RunInstances
# - ec2:TerminateInstances
# - ec2:DescribeInstances
# - ec2:DescribeInstanceStatus
- name: "Configure AWS credentials"
uses: "aws-actions/configure-aws-credentials@v1"
with:
aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}"
aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
aws-region: "${{ secrets.AWS_REGION }}"

- name: "Start EC2 runner"
id: "start-ec2-runner"
uses: "xJonathanLEI/ec2-github-runner@main"
with:
mode: "start"
# Must use personal access token here as `GITHUB_TOKEN` does not have access to runners.
# Use a fine-grained token with these permissions to at least this repository:
# - Administration: Read and write
# - Contents: Read and write
# - Metadata: Read-only
# - Workflows: Read and write
github-token: "${{ secrets.GH_PAT }}"
ec2-image-id: "${{ inputs.image-id }}"
ec2-instance-type: "${{ inputs.instance-type }}"
subnet-id: "${{ secrets.AWS_SUBNET_ID }}"
security-group-id: "${{ secrets.AWS_SG_ID }}"
storage-size: 1024
storage-device: "${{ inputs.root-volume }}"

toolchain-test:
name: "Run toolchain test"
runs-on: "${{ needs.start-runner.outputs.label }}"
needs:
- "start-runner"

steps:
# Workaround for EC2 runner missing $HOME
- name: "Set HOME env var"
run: |
if [ -z "$HOME" ]; then
echo "HOME=/home/ubuntu" >> $GITHUB_ENV
fi
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Install Rust"
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: "Install build dependencies"
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev
- name: "Install cargo-prove"
run: |
cargo install --locked --path ./crates/cli
- name: "Install SP1 toolchain"
run: |
cargo prove install-toolchain --token ${{ secrets.GH_PAT }}
stop-runner:
name: "Stop self-hosted EC2 runner"
runs-on: "ubuntu-latest"
needs:
- "start-runner"
- "toolchain-test"
if: ${{ always() }}

steps:
- name: "Configure AWS credentials"
uses: "aws-actions/configure-aws-credentials@v1"
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: "Stop EC2 runner"
uses: "xJonathanLEI/ec2-github-runner@main"
with:
mode: "stop"
github-token: ${{ secrets.GH_PAT }}
label: "${{ needs.start-runner.outputs.label }}"
ec2-instance-id: "${{ needs.start-runner.outputs.ec2-instance-id }}"
Loading

0 comments on commit 7f784aa

Please sign in to comment.