Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
deny: warnings
token: ${{ secrets.GITHUB_TOKEN }}
options: "--workspace --all-targets -F sp1 -F risc0 -F reth"
options: "--workspace --all-targets -F sp1 -F risc0"
- name: Run cargo check
run: cargo check --workspace

Expand Down
43 changes: 28 additions & 15 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ members = [
"crates/jolt/verifier-worker",
"crates/sp1/verifier-worker",
"crates/risc0/verifier-worker",
"crates/reth/verifier-worker",
"crates/hyli-bus",
"crates/hyli-modules",
"crates/hyli-test-containers",
Expand Down Expand Up @@ -79,6 +80,7 @@ hyli-modules = { version = "0.15.0", default-features = false, path = "crates/hy
hyli-test-containers = { version = "0.15.0", path = "crates/hyli-test-containers", package = "hyli-test-containers" }
hyli-jolt-model = { version = "0.15.0", path = "crates/jolt/model", package = "hyli-jolt-model" }
hyli-jolt-prover = { version = "0.15.0", path = "crates/jolt/prover", package = "hyli-jolt-prover" }
hyli-reth-verifier-worker = { version = "0.15.0", path = "crates/reth/verifier-worker", package = "hyli-reth-verifier-worker" }

hyli-registry = { version = "0.5.0" }

Expand Down Expand Up @@ -358,7 +360,6 @@ turmoil = [
]

cairo-m = ["hyli-verifiers/cairo-m"]
reth = ["hyli-verifiers/reth"]

# Disable dependency keyring by default, as it requires libdbus
keyring = ["hyli-crypto/keyring"]
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY crates ./crates
RUN cargo build --release -F risc0 -F rate-proxy;
RUN cargo build --release -p hyli-jolt-verifier-worker
RUN cargo build --release -p hyli-sp1-verifier-worker
RUN cargo build --release -p hyli-reth-verifier-worker

# RUNNER
FROM ${BASE_IMAGE} AS runner
Expand All @@ -32,6 +33,7 @@ COPY --from=builder /usr/src/hyli/target/release/rate_limiter_proxy ./
COPY --from=builder /usr/src/hyli/target/release/hyli-jolt-verifier ./
COPY --from=builder /usr/src/hyli/target/release/hyli-risc0-verifier ./
COPY --from=builder /usr/src/hyli/target/release/hyli-sp1-verifier ./
COPY --from=builder /usr/src/hyli/target/release/hyli-reth-verifier ./

VOLUME /hyli/data

Expand Down
34 changes: 1 addition & 33 deletions crates/hyli-verifiers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ rust-version = { workspace = true }
[dependencies]
hyli-model = { workspace = true, features = ["std"] }

serde_json = { workspace = true, optional = true }
anyhow = { workspace = true }
borsh = { workspace = true, features = ["derive"] }
tracing = { workspace = true }
hex = { workspace = true }
rand = { workspace = true }
alloy-signer = { workspace = true, optional = true }
alloy-signer-local = { workspace = true, optional = true }

cairo-m-prover = { git = "https://github.com/kkrt-labs/cairo-m", optional = true }
serde = { workspace = true, features = ["derive"], optional = true }
Expand All @@ -27,38 +23,10 @@ stwo-prover = { git = "https://github.com/starkware-libs/stwo", features = [
"parallel",
], rev = "ab57a1c", optional = true }

bincode = { workspace = true, optional = true }
reth-stateless = { workspace = true, optional = true, features = ["k256"] }
reth-ethereum = { workspace = true, optional = true, features = ["evm"] }
reth-ethereum-primitives = { workspace = true, optional = true }
reth-primitives-traits = { workspace = true, optional = true }
alloy-genesis = { workspace = true, optional = true }
alloy-consensus = { workspace = true, optional = true }
alloy-eips = { workspace = true, optional = true }
alloy-primitives = { workspace = true, optional = true }
alloy-rlp = { workspace = true, optional = true }
k256 = { workspace = true, optional = true }

[dev-dependencies]
test-log = { workspace = true, features = ["color", "trace"] }

[features]
default = []
cairo-m =["dep:cairo-m-prover", "dep:stwo-prover", "dep:sonic-rs", "dep:serde"]
reth = [
"dep:reth-stateless",
"dep:reth-ethereum",
"dep:reth-ethereum-primitives",
"dep:reth-primitives-traits",
"dep:alloy-genesis",
"dep:alloy-consensus",
"dep:alloy-eips",
"dep:alloy-primitives",
"dep:alloy-rlp",
"dep:alloy-signer",
"dep:alloy-signer-local",
"dep:serde",
"dep:serde_json",
"dep:bincode",
"dep:k256",
]
cairo-m = ["dep:cairo-m-prover", "dep:stwo-prover", "dep:sonic-rs", "dep:serde"]
5 changes: 0 additions & 5 deletions crates/hyli-verifiers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ use tracing::debug;

pub mod noir_utils;

#[cfg(feature = "reth")]
pub mod reth;

pub fn verify(
verifier: &Verifier,
proof: &ProofData,
Expand All @@ -21,8 +18,6 @@ pub fn verify(
#[cfg(feature = "cairo-m")]
hyli_model::verifiers::CAIRO_M => cairo_m::verify(proof, program_id),
hyli_model::verifiers::NOIR => noir::verify(proof, program_id),
#[cfg(feature = "reth")]
hyli_model::verifiers::RETH => reth::verify(proof, program_id),
_ => Err(anyhow::anyhow!("{} verifier not implemented yet", verifier)),
}
}
Expand Down
45 changes: 45 additions & 0 deletions crates/reth/verifier-worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "hyli-reth-verifier-worker"
description = "Reth stateless verifier and external worker for Hyli"
license-file = { workspace = true }
version = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }
rust-version = { workspace = true }

[lib]
name = "hyli_reth_verifier_worker"
path = "src/lib.rs"

[[bin]]
name = "hyli-reth-verifier"
path = "src/main.rs"

[dependencies]
hyli-model = { workspace = true, features = ["full"] }
hyli-verifier-worker-core = { path = "../../verifier-worker" }

anyhow = { workspace = true }
bincode = { workspace = true }
borsh = { workspace = true }
hex = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }

reth-stateless = { workspace = true, features = ["k256"] }
reth-ethereum = { workspace = true, features = ["evm"] }
reth-ethereum-primitives = { workspace = true }
reth-primitives-traits = { workspace = true }
alloy-consensus = { workspace = true }
alloy-eips = { workspace = true }
alloy-genesis = { workspace = true }
alloy-primitives = { workspace = true }
alloy-rlp = { workspace = true }
alloy-signer = { workspace = true }
alloy-signer-local = { workspace = true }
k256 = { workspace = true }

[dev-dependencies]
test-log = { workspace = true, features = ["color", "trace"] }
47 changes: 47 additions & 0 deletions crates/reth/verifier-worker/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use anyhow::{Context, Result};
use borsh::to_vec;
use hyli_model::{
verifier_worker::{VerifyRequest, VerifyResponse},
verifiers::RETH,
};
use hyli_verifier_worker_core::{init_worker_tracing, run_worker_loop};
use tracing::{error, info};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
init_worker_tracing("info")?;
run_worker_loop(|request| async move { handle_request(request).await }).await
}

async fn handle_request(request: VerifyRequest) -> Result<VerifyResponse> {
if request.verifier != RETH {
return Ok(VerifyResponse {
ok: false,
outputs: vec![],
error: format!("unsupported verifier '{}'", request.verifier),
});
}

info!("⚡ Verifying Reth proof");

let proof = hyli_model::ProofData(request.proof);
let program_id = hyli_model::ProgramId(request.program_id);

let outputs = match hyli_reth_verifier_worker::verify(&proof, &program_id)
.context("verifying Reth proof")
{
Ok(outputs) => outputs,
Err(err) => {
error!("❌ Reth proof verification failed: {err:#}");
return Err(err);
}
};

info!("✅ Reth proof verified.");

Ok(VerifyResponse {
ok: true,
outputs: to_vec(&outputs).context("serializing proof outputs")?,
error: String::new(),
})
}
11 changes: 11 additions & 0 deletions src/bin/hyli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ pub struct Args {

#[clap(long, action)]
pub risc0: bool,

#[clap(long, action)]
pub reth: bool,
}

#[cfg(feature = "dhat")]
Expand Down Expand Up @@ -139,6 +142,14 @@ async fn inner_main() -> Result<()> {
}
}

if args.reth {
if let Some(backend) = config.verifier_workers.backends.get_mut("reth") {
backend.enabled = true;
} else {
anyhow::bail!("Reth verifier worker backend not found in config");
}
}

log_error!(
hyli::entrypoint::main_process(config, Some(crypto)).await,
"Error running hyli"
Expand Down
3 changes: 2 additions & 1 deletion src/utils/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ impl Default for VerifierWorkersConf {
..Default::default()
},
);

Self {
enabled: true,
default_request_timeout_ms: 30_000,
Expand Down Expand Up @@ -319,6 +318,8 @@ impl Conf {
.with_list_parse_key("fast_catchup_peers")
.with_list_parse_key("verifier_workers.backends.jolt.args")
.with_list_parse_key("verifier_workers.backends.jolt.verifiers")
.with_list_parse_key("verifier_workers.backends.reth.args")
.with_list_parse_key("verifier_workers.backends.reth.verifiers")
.try_parsing(true),
)
.set_override_option("data_directory", data_directory)?
Expand Down
9 changes: 9 additions & 0 deletions src/utils/conf_defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,12 @@ verifiers = ["risc0-3"]
startup_timeout_ms = 5000
request_timeout_ms = 30000
auto_restart = true

[verifier_workers.backends.reth]
enabled = false
command = "hyli-reth-verifier"
args = []
verifiers = ["reth"]
startup_timeout_ms = 5000
request_timeout_ms = 30000
auto_restart = true
Loading