Skip to content

Commit

Permalink
Merge pull request risc0#68 from taikoxyz/improve-ci
Browse files Browse the repository at this point in the history
feat: Driver pattern for generic Guest execution
  • Loading branch information
Brechtpd authored Apr 2, 2024
2 parents 682b31e + de866b8 commit 9ebd97c
Show file tree
Hide file tree
Showing 112 changed files with 4,715 additions and 3,474 deletions.
8 changes: 3 additions & 5 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
!/docker/entrypoint.sh
!/lib
!/primitives
!/raiko-guests
!/raiko-host
!/provers
!/host
!/rust-toolchain
!/ra-tls
!/taiko.toml
!/tests
# Ignore unnecessary files inside allowed directories
# This should go after the allowed directories
**/raiko-host/guests/sgx
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:
uses: cargo-bins/[email protected]
- run: cargo binstall -y --force cargo-risczero
- run: cargo risczero install
- run: cargo build -p risc0-guest
- run: cargo build -p risc0-prover --features enable
- run: cargo test -p risc0-prover --features enable

build-test-sp1:
name: Build and test sp1
Expand All @@ -53,8 +54,8 @@ jobs:
run: |
curl -L https://sp1.succinct.xyz | bash
/home/runner/.config/.sp1/bin/sp1up
cargo build -p raiko-host --features succinct
cargo test -p raiko-host --features succinct
cargo build -p sp1-prover --features enable
cargo test -p sp1-prover --features enable
shell: bash

test-lib:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ rpc_cache.json
.idea
*.json.gz
.vscode/
raiko-host/guests/sgx/raiko-guest
*.elf
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"Cargo.toml",
]
}
106 changes: 81 additions & 25 deletions Cargo.lock

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

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
resolver = "2"
members = [
"lib",
"host",
"primitives",
"raiko-host",
# "tests/*",
"raiko-guests/sgx",
"provers/sp1/prover",
"provers/risc0",
"provers/sgx/prover",
"provers/sgx/guest",
]


# Always optimize; building and running the guest takes much longer without optimization.
[profile.dev]
opt-level = 3
Expand All @@ -30,6 +31,9 @@ revm-primitives = { git = "https://github.com/taikoxyz/revm.git", branch = "unst
revm = { git = "https://github.com/taikoxyz/revm.git", branch = "unstable", default-features = false, features = [
"serde",
] }
sp1-core = { git = "https://github.com/succinctlabs/sp1.git", rev = "cb43fd74b24fad8ed24a4885499159de3680c89f" }
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", rev = "cb43fd74b24fad8ed24a4885499159de3680c89f" }
sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", rev = "cb43fd74b24fad8ed24a4885499159de3680c89f" }

# for eip-4844
c-kzg = "1.0.0"
Expand Down
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN cargo build --release ${BUILD_FLAGS}
RUN ls -la /opt/raiko
RUN ls -la /opt/raiko/target
RUN ls -la /opt/raiko/target/release
RUN ls -la /opt/raiko/target/release/raiko-host
RUN ls -la /opt/raiko/target/release/host


FROM gramineproject/gramine:1.6-jammy as runtime
Expand All @@ -48,30 +48,30 @@ RUN sed -i 's/https:\/\/localhost:8081/https:\/\/pccs:8081/g' /etc/sgx_default_q

RUN mkdir -p \
./bin \
./guests/sgx \
./provers/sgx \
/tmp/sgx \
/var/log/raiko

COPY --from=builder /opt/raiko/docker/entrypoint.sh ./bin/
COPY --from=builder /opt/raiko/raiko-guests/sgx/config/raiko-guest.manifest.template ./guests/sgx/
COPY --from=builder /opt/raiko/raiko-host/config/config.toml /etc/raiko/
COPY --from=builder /opt/raiko/provers/sgx/config/raiko-guest.manifest.template ./provers/sgx/
COPY --from=builder /opt/raiko/host/config/config.toml /etc/raiko/
RUN ls -la /opt/raiko
RUN ls -la /opt/raiko/bin
RUN ls -la /opt/raiko/guests
RUN ls -la /opt/raiko/guests/sgx
COPY --from=builder /opt/raiko/target/release/raiko-guests ./guests/sgx/
# ubuntu@VM-0-6-ubuntu:~/zeth-john/raiko-guests/sgx$ cargo build --release
RUN ls -la /opt/raiko/provers
RUN ls -la /opt/raiko/provers/sgx
COPY --from=builder /opt/raiko/target/release/provers ./provers/sgx/
# ubuntu@VM-0-6-ubuntu:~/zeth-john/provers/sgx$ cargo build --release
# GROTH16_VERIFIER_ADDRESS="" cargo build --features "sgx" --release
# ./raiko-guests/succinct/target
# ./raiko-guests/risc0/guest/target
# /target/release/raiko-host
# "/opt/raiko/target/release/raiko-guests": not found
# ./provers/sp1/target
# ./provers/risc0/guest/target
# /target/release/host
# "/opt/raiko/target/release/provers": not found

# COPY --from=builder /opt/raiko/target/release/raiko-host ./bin/
# COPY --from=builder /opt/raiko/target/release/host ./bin/

# ARG EDMM=0
# ENV EDMM=${EDMM}
# RUN cd ./guests/sgx && \
# RUN cd ./provers/sgx && \
# gramine-manifest -Dlog_level=error -Darch_libdir=/lib/x86_64-linux-gnu/ raiko-guest.manifest.template raiko-guest.manifest

# ENTRYPOINT [ "/opt/raiko/bin/entrypoint.sh" ]
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Look into `prove_block.sh` for the available options or run the script without i
Provers can be enabled using features. To compile with all of them (using standard options):

```
cargo run --release --features "risc0 succinct"
cargo run --release --features "risc0 sp1"
```

### risc zero
Expand Down Expand Up @@ -83,16 +83,19 @@ cargo run -F metal --release --features risc0

CUDA needs to be installed when using `cuda`: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

### succinct's SP1:
### SP1:
```
cargo run --release --features succinct
cargo run --release --features sp1
```

### SGX:
```
cargo build --release --features sgx
cargo run --release --features sgx
```

Make sure to first do a cargo build because cargo run does not build the sgx binary!

If your CPU doesn't support SGX, you can still run the SGX code through gramine like it would on an SGX machine:

```
Expand Down
Loading

0 comments on commit 9ebd97c

Please sign in to comment.