mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-04-23 03:00:50 -04:00
fix: comments
This commit is contained in:
36
prover/Cargo.lock
generated
36
prover/Cargo.lock
generated
@@ -552,22 +552,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.64.0"
|
||||
version = "0.69.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
|
||||
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.5.0",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.10.5",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"peeking_take_while",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.66",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2687,14 +2687,13 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "librocksdb-sys"
|
||||
version = "0.10.0+7.9.2"
|
||||
version = "0.17.1+9.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b"
|
||||
checksum = "2b7869a512ae9982f4d46ba482c2a304f1efd80c6412a3d4bf57bb79a619679f"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"bzip2-sys",
|
||||
"cc",
|
||||
"glob",
|
||||
"libc",
|
||||
"libz-sys",
|
||||
"lz4-sys",
|
||||
@@ -3303,12 +3302,6 @@ dependencies = [
|
||||
"hmac",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.3.1"
|
||||
@@ -4018,9 +4011,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rocksdb"
|
||||
version = "0.20.1"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99"
|
||||
checksum = "26ec73b20525cb235bad420f911473b69f9fe27cc856c5461bccd7e4af037f43"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"librocksdb-sys",
|
||||
@@ -4237,25 +4230,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
[[package]]
|
||||
name = "scroll-proving-sdk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/scroll-proving-sdk.git?rev=4ae7687#4ae7687d373e830ec95ff278217ea0d798e86c27"
|
||||
source = "git+https://github.com/scroll-tech/scroll-proving-sdk.git?rev=92634c6#92634c65988eb7d7890759adb7ca1f1481fa41b8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"axum",
|
||||
"base64 0.13.1",
|
||||
"clap",
|
||||
"ctor 0.2.8",
|
||||
"dotenv",
|
||||
"env_logger 0.11.3",
|
||||
"eth-keystore",
|
||||
"ethers-core 2.0.7 (git+https://github.com/scroll-tech/ethers-rs.git?branch=v2.0.7)",
|
||||
"ethers-providers 2.0.7 (git+https://github.com/scroll-tech/ethers-rs.git?branch=v2.0.7)",
|
||||
"futures",
|
||||
"halo2_proofs",
|
||||
"hex",
|
||||
"http 1.1.0",
|
||||
"log",
|
||||
"once_cell",
|
||||
"prover 0.13.0",
|
||||
"rand",
|
||||
"reqwest 0.12.4",
|
||||
@@ -4265,8 +4251,6 @@ dependencies = [
|
||||
"rocksdb",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sled",
|
||||
"snark-verifier-sdk",
|
||||
"tiny-keccak",
|
||||
"tokio",
|
||||
"tracing",
|
||||
|
||||
@@ -31,7 +31,7 @@ halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.
|
||||
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
|
||||
prover_darwin = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.12.2", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
|
||||
prover_darwin_v2 = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.13.1", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
|
||||
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "4ae7687"}
|
||||
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "92634c6"}
|
||||
base64 = "0.13.1"
|
||||
reqwest = { version = "0.12.4", features = ["gzip"] }
|
||||
reqwest-middleware = "0.3"
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{
|
||||
utils::get_prover_type,
|
||||
zk_circuits_handler::{CircuitsHandler, CircuitsHandlerProvider},
|
||||
};
|
||||
use anyhow::{Context, Result};
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use scroll_proving_sdk::{
|
||||
config::LocalProverConfig,
|
||||
@@ -12,7 +12,7 @@ use scroll_proving_sdk::{
|
||||
GetVkRequest, GetVkResponse, ProveRequest, ProveResponse, QueryTaskRequest,
|
||||
QueryTaskResponse, TaskStatus,
|
||||
},
|
||||
CircuitType, ProvingService,
|
||||
ProvingService,
|
||||
},
|
||||
};
|
||||
use std::{
|
||||
@@ -44,12 +44,11 @@ impl ProvingService for LocalProver {
|
||||
}
|
||||
});
|
||||
|
||||
let local_prover_config = self.config.clone();
|
||||
let vks = self
|
||||
.circuits_handler_provider
|
||||
.read()
|
||||
.await
|
||||
.init_vks(&local_prover_config, prover_types)
|
||||
.init_vks(&self.config, prover_types)
|
||||
.await;
|
||||
GetVkResponse { vks, error: None }
|
||||
}
|
||||
@@ -59,17 +58,15 @@ impl ProvingService for LocalProver {
|
||||
.write()
|
||||
.await
|
||||
.get_circuits_handler(&req.hard_fork_name, self.prover_types.clone())
|
||||
.context("failed to get circuit handler")
|
||||
.unwrap();
|
||||
.expect("failed to get circuit handler");
|
||||
|
||||
match self.do_prove(req.clone(), handler).await {
|
||||
Ok(resp) => resp,
|
||||
Err(e) => build_prove_error_response(
|
||||
String::new(),
|
||||
TaskStatus::Failed,
|
||||
None,
|
||||
String::from(&format!("failed to request proof: {}", e)),
|
||||
),
|
||||
Err(e) => ProveResponse {
|
||||
status: TaskStatus::Failed,
|
||||
error: Some(format!("failed to request proof: {}", e)),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,39 +74,41 @@ impl ProvingService for LocalProver {
|
||||
let handle = self.current_task.lock().unwrap().take();
|
||||
if let Some(handle) = handle {
|
||||
if handle.is_finished() {
|
||||
match handle.await {
|
||||
Ok(result) => match result {
|
||||
Ok(proof) => build_query_task_response(
|
||||
req.task_id,
|
||||
TaskStatus::Success,
|
||||
Some(proof),
|
||||
None,
|
||||
),
|
||||
Err(e) => build_query_task_response(
|
||||
req.task_id,
|
||||
TaskStatus::Failed,
|
||||
None,
|
||||
Some(format!("proving task failed: {}", e)),
|
||||
),
|
||||
return match handle.await {
|
||||
Ok(Ok(proof)) => QueryTaskResponse {
|
||||
task_id: req.task_id,
|
||||
status: TaskStatus::Success,
|
||||
proof: Some(proof),
|
||||
..Default::default()
|
||||
},
|
||||
Err(e) => build_query_task_response(
|
||||
req.task_id,
|
||||
TaskStatus::Failed,
|
||||
None,
|
||||
Some(format!("proving task panicked: {}", e)),
|
||||
),
|
||||
}
|
||||
Ok(Err(e)) => QueryTaskResponse {
|
||||
task_id: req.task_id,
|
||||
status: TaskStatus::Failed,
|
||||
error: Some(format!("proving task failed: {}", e)),
|
||||
..Default::default()
|
||||
},
|
||||
Err(e) => QueryTaskResponse {
|
||||
task_id: req.task_id,
|
||||
status: TaskStatus::Failed,
|
||||
error: Some(format!("proving task panicked: {}", e)),
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
} else {
|
||||
*self.current_task.lock().unwrap() = Some(handle);
|
||||
build_query_task_response(req.task_id, TaskStatus::Proving, None, None)
|
||||
return QueryTaskResponse {
|
||||
task_id: req.task_id,
|
||||
status: TaskStatus::Proving,
|
||||
..Default::default()
|
||||
};
|
||||
}
|
||||
} else {
|
||||
build_query_task_response(
|
||||
req.task_id,
|
||||
TaskStatus::Failed,
|
||||
None,
|
||||
Some("no proving task is running".to_string()),
|
||||
)
|
||||
}
|
||||
// If no handle is found
|
||||
QueryTaskResponse {
|
||||
task_id: req.task_id,
|
||||
status: TaskStatus::Failed,
|
||||
error: Some("no proving task is running".to_string()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +116,7 @@ impl ProvingService for LocalProver {
|
||||
impl LocalProver {
|
||||
pub fn new(config: LocalProverConfig, prover_types: Vec<ProverType>) -> Self {
|
||||
let circuits_handler_provider = CircuitsHandlerProvider::new(config.clone())
|
||||
.context("failed to create circuits handler provider")
|
||||
.unwrap();
|
||||
.expect("failed to create circuits handler provider");
|
||||
|
||||
Self {
|
||||
config,
|
||||
@@ -126,7 +124,6 @@ impl LocalProver {
|
||||
circuits_handler_provider: RwLock::new(circuits_handler_provider),
|
||||
next_task_id: Arc::new(Mutex::new(0)),
|
||||
current_task: Arc::new(Mutex::new(None)),
|
||||
// result: Arc::new(Mutex::new(Err(anyhow::Error::msg("prover not started")))),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,49 +165,3 @@ impl LocalProver {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn build_prove_error_response(
|
||||
task_id: String,
|
||||
status: TaskStatus,
|
||||
proof: Option<String>,
|
||||
error_msg: String,
|
||||
) -> ProveResponse {
|
||||
ProveResponse {
|
||||
task_id,
|
||||
circuit_type: CircuitType::Undefined, // TODO
|
||||
circuit_version: "".to_string(),
|
||||
hard_fork_name: "".to_string(),
|
||||
status,
|
||||
created_at: 0.0,
|
||||
started_at: None,
|
||||
finished_at: None,
|
||||
compute_time_sec: None,
|
||||
input: None,
|
||||
proof,
|
||||
vk: None,
|
||||
error: Some(error_msg),
|
||||
}
|
||||
}
|
||||
|
||||
fn build_query_task_response(
|
||||
task_id: String,
|
||||
status: TaskStatus,
|
||||
proof: Option<String>,
|
||||
error_msg: Option<String>,
|
||||
) -> QueryTaskResponse {
|
||||
QueryTaskResponse {
|
||||
task_id,
|
||||
circuit_type: CircuitType::Undefined, // TODO
|
||||
circuit_version: "".to_string(),
|
||||
hard_fork_name: "".to_string(),
|
||||
status,
|
||||
created_at: 0.0,
|
||||
started_at: None,
|
||||
finished_at: None,
|
||||
compute_time_sec: None,
|
||||
input: None,
|
||||
proof,
|
||||
vk: None,
|
||||
error: error_msg,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ impl CircuitsHandlerProvider {
|
||||
let mut m: HashMap<HardForkName, CircuitsHandlerBuilder> = HashMap::new();
|
||||
|
||||
if let Err(e) = AssetsDirEnvConfig::init() {
|
||||
log::error!("AssetsDirEnvConfig init failed: {:#}", e);
|
||||
std::process::exit(-2);
|
||||
panic!("AssetsDirEnvConfig init failed: {:#}", e);
|
||||
}
|
||||
|
||||
fn handler_builder(
|
||||
@@ -140,7 +139,7 @@ impl CircuitsHandlerProvider {
|
||||
config: &LocalProverConfig,
|
||||
prover_types: Vec<ProverType>,
|
||||
) -> Vec<String> {
|
||||
let mut vks: Vec<String> = Vec::new();
|
||||
let mut vks = Vec::new();
|
||||
for (hard_fork_name, build) in self.circuits_handler_builder_map.iter() {
|
||||
let handler =
|
||||
build(prover_types.clone(), config).expect("failed to build circuits handler");
|
||||
|
||||
Reference in New Issue
Block a user