Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
prajwolrg committed Oct 2, 2024
1 parent 7fd288e commit 4c4dfad
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 34 deletions.
1 change: 1 addition & 0 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 @@ -41,13 +41,13 @@ members = [
"crates/vtxjmt",
"provers/risc0",
"provers/sp1",
"crates/tx-parser",

# binaries listed separately
"bin/bridge-client",
"bin/prover-client",
"reth",
"sequencer",
"crates/tx-parser",

# integration tests
"tests",
Expand Down Expand Up @@ -195,6 +195,7 @@ toml = "0.5"
tower = "0.4"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
uuid = { version = "1.0", features = ["v4", "serde"] }

# This is needed for custom build of SP1
[profile.release.build-override]
Expand Down
12 changes: 5 additions & 7 deletions bin/prover-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ path = "src/main.rs"
required-features = ["prover"]

[dependencies]
alpen-express-btcio = { workspace = true }
alpen-express-common = { workspace = true }
alpen-express-db = { workspace = true }
alpen-express-primitives = { workspace = true }
alpen-express-rocksdb = { workspace = true }
alpen-express-rpc-types = { workspace = true }
alpen-express-state = { workspace = true }
Expand All @@ -20,27 +22,23 @@ express-sp1-adapter = { workspace = true, features = ["prover"] }
express-sp1-guest-builder = { path = "../../provers/sp1" }
express-zkvm = { workspace = true }


alpen-express-btcio.workspace = true
alpen-express-primitives.workspace = true
anyhow = { workspace = true }
argh = { workspace = true }
async-trait = { workspace = true }
bincode = { workspace = true }
bitcoin.workspace = true
bitcoin = { workspace = true }
borsh = { workspace = true }
jsonrpsee = { workspace = true, features = ["http-client"] }
rayon = "1.8.0"
reth-rpc-types = { workspace = true }
rockbound = { workspace = true }
serde = { workspace = true }
strata-tx-parser.workspace = true
strata-tx-parser = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
uuid = { version = "1.0", features = ["v4", "serde"] }

uuid = { workspace = true }

[features]
prover = []
2 changes: 1 addition & 1 deletion bin/prover-client/src/proving_ops/btc_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl ProvingOperations for BtcOperations {
}

async fn fetch_input(&self, block_num: u64) -> Result<Self::Input, anyhow::Error> {
debug!("Fetching BTC block input for block {}", block_num);
debug!(%block_num, "Fetching BTC block input");
let filters = get_tx_filters();
let block = self.btc_client.get_block_at(block_num).await?;
debug!("Fetched BTC block {}", block_num);
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/proving_ops/cl_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl ProvingOperations for ClOperations {
}

async fn fetch_input(&self, block_num: u64) -> Result<Self::Input, anyhow::Error> {
debug!("Fetching CL block input for block {}", block_num);
debug!(%block_num, "Fetching CL block input");
let witness: Option<Vec<u8>> = self
.cl_client
.request("alp_getCLBlockWitness", rpc_params![block_num])
Expand Down
2 changes: 1 addition & 1 deletion bin/prover-client/src/proving_ops/el_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl ProvingOperations for ElOperations {
}

async fn fetch_input(&self, block_num: u64) -> Result<Self::Input, anyhow::Error> {
debug!("Fetching EL block input for block {}", block_num);
debug!(%block_num, "Fetching EL block input");
let block: Block = self
.el_client
.request(
Expand Down
29 changes: 13 additions & 16 deletions bin/prover-client/src/rpc_server.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Bootstraps an RPC server for the prover client.

use std::str::FromStr;

use alpen_express_rpc_types::RpcCheckpointInfo;
use anyhow::{Context, Ok};
use async_trait::async_trait;
Expand Down Expand Up @@ -101,74 +99,73 @@ impl ProverClientRpc {

#[async_trait]
impl ExpressProverClientApiServer for ProverClientRpc {
async fn prove_btc_block(&self, btc_block_num: u64) -> RpcResult<String> {
async fn prove_btc_block(&self, btc_block_num: u64) -> RpcResult<Uuid> {
let task_id = self
.context
.btc_proving_task_dispatcher
.create_task(btc_block_num)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn prove_el_block(&self, el_block_num: u64) -> RpcResult<String> {
async fn prove_el_block(&self, el_block_num: u64) -> RpcResult<Uuid> {
let task_id = self
.context
.el_proving_task_dispatcher
.create_task(el_block_num)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn prove_cl_block(&self, cl_block_num: u64) -> RpcResult<String> {
async fn prove_cl_block(&self, cl_block_num: u64) -> RpcResult<Uuid> {
let task_id = self
.context
.cl_proving_task_dispatcher
.create_task(cl_block_num)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn prove_l1_batch(&self, l1_range: (u64, u64)) -> RpcResult<String> {
async fn prove_l1_batch(&self, l1_range: (u64, u64)) -> RpcResult<Uuid> {
let task_id = self
.context
.l1_batch_task_dispatcher
.create_task(l1_range)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn prove_l2_batch(&self, l2_range: (u64, u64)) -> RpcResult<String> {
async fn prove_l2_batch(&self, l2_range: (u64, u64)) -> RpcResult<Uuid> {
let task_id = self
.context
.l2_batch_task_dispatcher
.create_task(l2_range)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn prove_checkpoint(&self, checkpoint_info: RpcCheckpointInfo) -> RpcResult<String> {
async fn prove_checkpoint(&self, checkpoint_info: RpcCheckpointInfo) -> RpcResult<Uuid> {
let task_id = self
.context
.checkpoint_dispatcher
.create_task(checkpoint_info)
.await
.expect("failed to add proving task");

RpcResult::Ok(task_id.to_string())
RpcResult::Ok(task_id)
}

async fn get_task_status(&self, task_id: String) -> RpcResult<Option<String>> {
let task_id = Uuid::from_str(&task_id).expect("invalid UUID params");
async fn get_task_status(&self, task_id: Uuid) -> RpcResult<Option<String>> {
let task_tracker = self.context.el_proving_task_dispatcher.task_tracker();

if let Some(proving_task) = task_tracker.get_task(task_id).await {
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/prover-client-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rustdoc.all = "warn"
[dependencies]
jsonrpsee = { workspace = true, features = ["server", "macros"] }
alpen-express-rpc-types = { workspace = true }
uuid = { workspace = true }

[features]
client = ["jsonrpsee/client"]
15 changes: 8 additions & 7 deletions crates/rpc/prover-client-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,37 @@

use alpen_express_rpc_types::RpcCheckpointInfo;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use uuid::Uuid;

/// RPCs related to information about the client itself.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "dev_alp"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "dev_alp"))]
pub trait ExpressProverClientApi {
/// Start proving the given el block
#[method(name = "proveBtcBlock")]
async fn prove_btc_block(&self, el_block_num: u64) -> RpcResult<String>;
async fn prove_btc_block(&self, el_block_num: u64) -> RpcResult<Uuid>;

/// Start proving the given el block
#[method(name = "proveELBlock")]
async fn prove_el_block(&self, el_block_num: u64) -> RpcResult<String>;
async fn prove_el_block(&self, el_block_num: u64) -> RpcResult<Uuid>;

/// Start proving the given cl block
#[method(name = "proveCLBlock")]
async fn prove_cl_block(&self, cl_block_num: u64) -> RpcResult<String>;
async fn prove_cl_block(&self, cl_block_num: u64) -> RpcResult<Uuid>;

/// Start proving the given cl block
#[method(name = "proveL1Batch")]
async fn prove_l1_batch(&self, l1_range: (u64, u64)) -> RpcResult<String>;
async fn prove_l1_batch(&self, l1_range: (u64, u64)) -> RpcResult<Uuid>;

/// Start proving the given cl batch
#[method(name = "proveL2Batch")]
async fn prove_l2_batch(&self, l2_range: (u64, u64)) -> RpcResult<String>;
async fn prove_l2_batch(&self, l2_range: (u64, u64)) -> RpcResult<Uuid>;

/// Start proving the given cl block
#[method(name = "proveCheckpoint")]
async fn prove_checkpoint(&self, checkpoint: RpcCheckpointInfo) -> RpcResult<String>;
async fn prove_checkpoint(&self, checkpoint: RpcCheckpointInfo) -> RpcResult<Uuid>;

/// Start proving the given el block
#[method(name = "getTaskStatus")]
async fn get_task_status(&self, task_id: String) -> RpcResult<Option<String>>;
async fn get_task_status(&self, task_id: Uuid) -> RpcResult<Option<String>>;
}

0 comments on commit 4c4dfad

Please sign in to comment.