Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Driver pattern for generic Guest execution #68

Merged
merged 34 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ab3555b
added sp1 script
CeciliaZ030 Mar 22, 2024
7b9cc0d
driver poc
CeciliaZ030 Mar 22, 2024
e36ee9f
GuestDriver
CeciliaZ030 Mar 23, 2024
a182bc2
succinct impl done & native + succinct proving successfully
CeciliaZ030 Mar 23, 2024
c7becdf
succinct done
CeciliaZ030 Mar 23, 2024
d8395c5
fmt & clippy
CeciliaZ030 Mar 23, 2024
1ff5704
move all risc0 stuffs in guest
CeciliaZ030 Mar 24, 2024
ae949ae
r0 in host/execution
CeciliaZ030 Mar 24, 2024
1a11955
Merge remote-tracking branch 'origin/taiko/unstable' into improve-ci
CeciliaZ030 Mar 24, 2024
39e7cdf
host runs
CeciliaZ030 Mar 25, 2024
be69a31
clean up
CeciliaZ030 Mar 25, 2024
309f5d5
fmt & clippy
CeciliaZ030 Mar 25, 2024
210ea79
CI redo & dependency cleanup
CeciliaZ030 Mar 25, 2024
2fae6e6
sgx refactored
CeciliaZ030 Mar 26, 2024
cdc0f2d
fmt
CeciliaZ030 Mar 26, 2024
d831e57
cleanup
CeciliaZ030 Mar 26, 2024
206ecd6
Merge remote-tracking branch 'origin/taiko/unstable' into improve-ci
CeciliaZ030 Mar 29, 2024
86534e9
sp1 & r0 compiles with host
CeciliaZ030 Mar 29, 2024
9870a0d
delete useless shit & refactor sgx execute
CeciliaZ030 Mar 30, 2024
163824a
fixed ICE
CeciliaZ030 Apr 1, 2024
6f72051
sgx working
CeciliaZ030 Apr 1, 2024
af47aa0
fix & clippy
CeciliaZ030 Apr 1, 2024
bfabf1a
fmt
CeciliaZ030 Apr 1, 2024
9d4e11e
rename provers
CeciliaZ030 Apr 1, 2024
f3e8577
rename raiko-guest to guest
CeciliaZ030 Apr 1, 2024
ae7c239
rename succinct to sp1
CeciliaZ030 Apr 1, 2024
7e50e89
fix sp1
Brechtpd Apr 1, 2024
fdc6943
rename SP1 program to SP1 guest
Brechtpd Apr 2, 2024
1ca3876
Moved prover implementations to their respective package
Brechtpd Apr 2, 2024
2258f4d
rename guests to provers
Brechtpd Apr 2, 2024
f8ba02f
delete sgx private key every time for now
Brechtpd Apr 2, 2024
7cce49e
remove unnecessary unstable features
Brechtpd Apr 2, 2024
68dd909
remove guest sgx dependency (because it's ignored anyway because it's…
Brechtpd Apr 2, 2024
de866b8
add build comments
Brechtpd Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading