Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…1a3d42f
  • Loading branch information
tolak committed Mar 21, 2024
0 parents commit 35bf034
Showing 35 changed files with 7,946 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
rustflags = ["-Dclippy::all", "-Dwarnings"]

[net]
git-fetch-with-cli = true
143 changes: 143 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: main

on:
push:
branches: [ main ]
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUST_BACKTRACE: "1"
RISC0_CRATE_VERSION: "^0.20"
RISC0_TOOLCHAIN_VERSION: v2024-01-31.1

jobs:
test:
runs-on: ubuntu-latest
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- name: checkout dummy commit (submodule bug workaround)
run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"

- name: clone repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install rust
uses: risc0/risc0/.github/actions/rustup@release-0.20

- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f

- name: Install cargo-install
uses: risc0/cargo-install@v1
with:
crate: cargo-binstall

- name: Cargo binstall cargo-risczero
run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_CRATE_VERSION }}

- name: risczero toolchain install
run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION

- name: build rust guest
run: cargo build

- name: build solidity contracts
run: forge build

- name: run tests
run: cargo test

- name: run foundry tests in dev mode
env:
RISC0_DEV_MODE: true
run: forge test -vvv

bonsai-integration:
name: test bonsai integration
runs-on: ubuntu-latest
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- name: checkout dummy commit (submodule bug workaround)
run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"

- name: clone repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install rust
uses: risc0/risc0/.github/actions/rustup@release-0.19

- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f

- name: Install cargo-install
uses: risc0/cargo-install@v1
with:
crate: cargo-binstall

- name: Cargo binstall cargo-risczero
run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_CRATE_VERSION }}

- name: risczero toolchain install
run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION

- name: build rust guest
run: cargo build

- name: build solidity contracts
run: forge build

- name: run foundry tests with bonsai proving
env:
BONSAI_API_URL: ${{ secrets.BONSAI_API_URL }}
BONSAI_API_KEY: ${{ secrets.BONSAI_API_KEY }}
RISC0_DEV_MODE: false
run: forge test -vvv

lint:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: install rust
uses: risc0/risc0/.github/actions/rustup@release-0.20

- name: install cargo-sort
uses: risc0/cargo-install@v1
with:
crate: cargo-sort
version: "=1.0.7"

- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f

- name: lint rust code
run: cargo fmt --all --check

- name: lint guest rust code
working-directory: methods/guest
run: cargo fmt --all --check

- name: lint cargo files
run: cargo sort --workspace --check

- name: lint guest cargo files
working-directory: methods/guest
run: cargo sort --workspace --check

- name: check solidity code formatting
run: forge fmt --check
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/*/11155111/
/broadcast/**/dry-run/

# Autogenerated contracts
contracts/ImageID.sol
tests/Elf.sol

# Dotenv file
.env

# Cargo
target/

# Misc
.DS_Store
.idea
15 changes: 15 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/murky"]
path = lib/murky
url = https://github.com/dmfxyz/murky
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/solidity-bytes-utils"]
path = lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
[submodule "lib/risc0-ethereum"]
path = lib/risc0-ethereum
url = https://github.com/risc0/risc0-ethereum
3 changes: 3 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "solhint:default"
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.linkedProjects": [
"./apps/Cargo.toml",
"./methods/Cargo.toml",
"./methods/guest/Cargo.toml",
]
}
Loading

0 comments on commit 35bf034

Please sign in to comment.