Skip to content

Commit

Permalink
Merge branch 'main'
Browse files Browse the repository at this point in the history
  • Loading branch information
35359595 committed May 17, 2024
2 parents cd05248 + 5ab3275 commit a1ee3ae
Show file tree
Hide file tree
Showing 47 changed files with 386 additions and 186,117 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
!/Cargo.toml
!/config.json
!/docker/entrypoint.sh
!/docker/enclave-key.pem
!/lib
!/primitives
!/provers
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/openapi-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ concurrency:
jobs:
deploy-docs:
name: Generate OpenAPI docs
runs-on: ubuntu-latest
environment:
name: github-pages
name: ${{ (github.ref == 'refs/heads/main') && 'github-pages' || 'test-environment' }}
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand All @@ -36,13 +36,16 @@ jobs:
run: ./script/generate-docs.sh

- name: Setup Pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v3

- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v2
with:
path: './openapi'
path: './openapi'

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v2
27 changes: 27 additions & 0 deletions .github/workflows/repo--validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Validate PR Title

on:
pull_request_target:
types:
- opened
- edited
- synchronize
push:
branches:
- release-please-* # Trigger for release-please PRs, but skip the job
merge_group: # Trigger in the merge queue, but skip the job

jobs:
validate-pr-title:
if: github.event_name == 'pull_request_target'
runs-on: [taiko-runner]
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
subjectPattern: ^(?![A-Z])(?!.*\btypo\b).+$ # Require lowercase PR title and prohibit word "typo"
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character and doesn't contain the word "typo".
7 changes: 7 additions & 0 deletions Cargo.lock

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

51 changes: 28 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,45 @@ alloy-provider = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22
alloy-transport-http = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" }
alloy-signer = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" }
alloy-signer-wallet = { git = "https://github.com/brechtpd/alloy", branch = "175_4e22b9e" }
reqwest_alloy = { package = "reqwest", version = "0.12.4", features = ["json"] }


# ethers (TODO: remove)
ethers-contract = { git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10" }
ethers-core = { git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10" }
ethers-providers = { git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10" }

# serde
# Conversion, serialization, codecs, compression
serde = { version = "1.0", default-features = false, features = [
"derive",
"alloc",
] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde_with = { version = "3.0" }
bincode = "1.3.3"
bytemuck = "1.13"
flate2 = "1.0.28"
rlp = "0.5.2"
hex = { version = "0.4.3" }
hex-literal = "0.4"
base64-serde = "0.7.0"
base64 = "0.21.7"
libflate = { version = "2.0.0" }
typetag = { version = "0.2.15" }

# tracing
# tracing, logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tracing-appender = "0.2"
log = { version = "0.4.13" }
env_logger = { version = "0.11.3" }

# memory
cap = { git = "https://github.com/brechtpd/cap", branch = "more-stats", features = [
"stats",
] }

# server
# async, server, http queries
axum = { version = "0.7.4", features = ["macros"] }
tower-http = { version = "0.5.2", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
Expand All @@ -110,11 +124,16 @@ utoipa-scalar = { version = "0.1.0", features = ["axum"] }
utoipa = { version = "4.2.0", features = ["axum_extras"] }
structopt = "0.3.24"
prometheus = { version = "0.13.3", features = ["process"] }
tokio = { version = "^1.23", features = ["full"] }
hyper = { version = "0.14.27", features = ["server"] }
reqwest = { version = "0.11.22", features = ["json"] }
url = "2.5.0"

# crypto
c-kzg = "1.0.0"
c-kzg-taiko = { git = "https://github.com/smtmfft/c-kzg-4844", branch = "for-alpha7", default-features = false, features = [
"preload-kzg-settings",
"no-threads",
] }
sha3 = { version = "0.10", default-features = false }
sha2 = "0.10.8"
Expand All @@ -124,40 +143,26 @@ secp256k1 = { version = "0.27.0", features = [
"recovery",
] }

# Error model
anyhow = "1.0"
thiserror = "1.0"
thiserror-no-std = "2.0.2"

# misc
hashbrown = { version = "0.14", features = ["inline-more"] }
tempfile = "3.8"
anyhow = "1.0"
bincode = "1.3.3"
bytemuck = "1.13"
cargo_metadata = "0.12.1"
clap = { version = "4.4.6", features = ["derive", "string", "env"] }
flate2 = "1.0.28"
tokio = { version = "^1.23", features = ["full"] }
hyper = { version = "0.14.27", features = ["server"] }
lru_time_cache = "0.11.11"
lazy_static = "1.4.0"
once_cell = "1.8.0"
thiserror = "1.0"
reqwest = { version = "0.11.22", features = ["json"] }
reqwest_alloy = { package = "reqwest", version = "0.12.4", features = ["json"] }
proptest = "1.4.0"
rlp = "0.5.2"
url = "2.5.0"
cfg-if = "1.0.0"
libflate = { version = "2.0.0" }
log = { version = "0.4.13" }
env_logger = { version = "0.11.3" }
typetag = { version = "0.2.15" }
hex = { version = "0.4.3" }
thiserror-no-std = "2.0.2"
chrono = { version = "0.4", default-features = false }
hex-literal = "0.4"
assert_cmd = "2.0"
regex = "1.5.4"
rstest = "0.18"
rand = "0.8.5"
rand_core = "0.6.4"
base64-serde = "0.7.0"
base64 = "0.21.7"
dirs = "5.0.1"
pathdiff = "0.2.1"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ COPY --from=builder /opt/raiko/host/config/config.sgx.json /etc/raiko/
COPY --from=builder /opt/raiko/target/release/sgx-guest ./bin/
COPY --from=builder /opt/raiko/target/release/raiko-host ./bin/
COPY --from=builder /opt/raiko/target/release/raiko-setup ./bin/
COPY --from=builder /opt/raiko/docker/enclave-key.pem /root/.config/gramine/enclave-key.pem

ARG EDMM=0
ENV EDMM=${EDMM}
RUN cd ./bin && \
gramine-sgx-gen-private-key -f && \
gramine-manifest -Dlog_level=error -Ddirect_mode=0 -Darch_libdir=/lib/x86_64-linux-gnu/ ../provers/sgx/config/sgx-guest.local.manifest.template sgx-guest.manifest && \
gramine-sgx-sign --manifest sgx-guest.manifest --output sgx-guest.manifest.sgx && \
gramine-sgx-sigstruct-view "sgx-guest.sig"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Look into `prove-block.sh` for the available options or run the script without i
```

## Provers
For all host program, you can enable CPU optimization through exporting `CPU_OPT=1`.
### Risc zero
To install, build, and run in one step:
```console
Expand Down Expand Up @@ -84,6 +85,7 @@ To build and run test on Sp1 Zkvm:
```console
$ TARGET=sp1 make test
```
Some optimized configuration tailored to the host can be found [here](docs/README_Sp1.md)

### SGX:
To install, build, and run in one step:
Expand All @@ -101,6 +103,10 @@ If your CPU doesn't support SGX, you can still run the SGX code through gramine
$ MOCK=1 TARGET=sgx make run
```

## Misc
[Docker & Remote Attestation Support](docs/README_Docker_and_RA.md)
[Metrics](docs/README_Metrics.md)

### Execution Trace

You can generate an execution trace for the block that is being proven by enabling the `tracer` feature:
Expand Down
39 changes: 39 additions & 0 deletions docker/enclave-key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-----BEGIN RSA PRIVATE KEY-----
MIIG4wIBAAKCAYEAy2c2h0zCLmynJY+E5wpHPjz9VoaCskcxNfQVM5E1cbf3/b4j
7nPcSs/3oxvBFHTZGxnLIJY/A29Y/GKDjBIQdh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e1g6VYy6wktnysaBGgqoqCMKVfw+fCRXEV+b
sQEOIJRGZvbrBU38Jm41386ZDnqOXGGlWjI12BvFarUIN6IPNytxuj4J0+BTwre/
/YxlapRxEkmHTHZWMXF03Nhv5tPa63BVM6PNdP4xO3kJWwg1tPqF
-----END RSA PRIVATE KEY-----
32 changes: 32 additions & 0 deletions docs/README_Sp1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
reference: https://succinctlabs.github.io/sp1/generating-proofs/advanced.html

## CPU Acceleration

To enable CPU acceleration, you can use the `RUSTFLAGS` environment variable to enable the `target-cpu=native` flag when running your script. This will enable the compiler to generate code that is optimized for your CPU. We encapsulate this with `CPU_OPT=1`

```bash
RUSTFLAGS='-C target-cpu=native' cargo run --release
```

Currently there is support for AVX512 and NEON SIMD instructions. For NEON, you must also enable the `sp1-driver` feature `neon`.

```bash
cargo run --features sp1,neon --release
```

## Performance

For maximal performance, you should run proof generation with the following command and vary your `shard_size` depending on your program's number of cycles.

```rust,noplayground
SHARD_SIZE=4194304 RUST_LOG=info RUSTFLAGS='-C target-cpu=native' cargo run --release
```

## Memory Usage

To reduce memory usage, set the `SHARD_BATCH_SIZE` enviroment variable depending on how much RAM
your machine has. A higher number will use more memory, but will be faster.

```rust,noplayground
SHARD_BATCH_SIZE=1 SHARD_SIZE=2097152 RUST_LOG=info RUSTFLAGS='-C target-cpu=native' cargo run --release
```
Loading

0 comments on commit a1ee3ae

Please sign in to comment.