Skip to content

Commit 4ea4b87

Browse files
committed
fix acoording to reviews
1 parent 98a2c1c commit 4ea4b87

File tree

9 files changed

+26
-46
lines changed

9 files changed

+26
-46
lines changed

coordinator/internal/logic/libzkp/libzkp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ char* gen_wrapped_proof(char* proof_json, char* metadata, char* vk, size_t vk_le
5656
// Release memory allocated for a string returned by gen_wrapped_proof
5757
void release_string(char* string_ptr);
5858

59-
void set_dynamic_feature(const char* feats);
60-
6159
// Universal task compatibility fix function
6260
char* univ_task_compatibility_fix(char* task_json);
6361

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkProofs []
328328
if decodeErr != nil {
329329
return nil, fmt.Errorf("failed to decode batch header version %d: %w", dbBatch.CodecVersion, decodeErr)
330330
}
331-
log.Info("Decode batchheader bytes to canonical header", "version", batchHeader.Version())
332331
taskDetail.BatchHeader = batchHeader
333332

334333
taskDetail.ChallengeDigest = common.HexToHash(dbBatch.ChallengeDigest)

crates/libzkp/src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub mod proofs;
22
pub mod tasks;
3-
pub use tasks::ProvintTaskExt;
3+
pub use tasks::ProvingTaskExt;
44
pub mod verifier;
55
use verifier::HardForkName;
66
pub use verifier::{TaskType, VerifierConfig};
@@ -20,7 +20,7 @@ pub(crate) fn witness_use_legacy_mode(fork_name: &str) -> eyre::Result<bool> {
2020
.map(|cfg| cfg.legacy_witness_encoding)
2121
.ok_or_else(|| {
2222
eyre::eyre!(
23-
"can not found features setting for unrecognized fork {}",
23+
"can not find features setting for unrecognized fork {}",
2424
fork_name
2525
)
2626
})
@@ -55,10 +55,6 @@ impl FeatureOptions {
5555
}
5656
}
5757

58-
pub fn set_dynamic_feature(_: &str) {
59-
tracing::error!("call deprecated method");
60-
}
61-
6258
/// Turn the coordinator's chunk task into a json string for formal chunk proving
6359
/// task (with full witnesses)
6460
pub fn checkout_chunk_task(
@@ -196,7 +192,7 @@ pub fn gen_universal_task(
196192

197193
u_task.vk = Vec::from(expected_vk);
198194
let fork_name = u_task.fork_name.clone();
199-
let mut u_task_ext = ProvintTaskExt::new(u_task);
195+
let mut u_task_ext = ProvingTaskExt::new(u_task);
200196

201197
// set additional settings from global features
202198
if let Some(cfg) = ADDITIONAL_FEATURES

crates/libzkp/src/tasks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ fn check_aggregation_proofs<Metadata: MultiVersionPublicInputs>(
3636
}
3737

3838
#[derive(serde::Deserialize, serde::Serialize)]
39-
pub struct ProvintTaskExt {
39+
pub struct ProvingTaskExt {
4040
#[serde(flatten)]
4141
task: ProvingTask,
4242
#[serde(default)]
4343
pub use_openvm_13: bool,
4444
}
4545

46-
impl From<ProvintTaskExt> for ProvingTask {
47-
fn from(wrap_t: ProvintTaskExt) -> Self {
46+
impl From<ProvingTaskExt> for ProvingTask {
47+
fn from(wrap_t: ProvingTaskExt) -> Self {
4848
wrap_t.task
4949
}
5050
}
5151

52-
impl ProvintTaskExt {
52+
impl ProvingTaskExt {
5353
pub fn new(task: ProvingTask) -> Self {
5454
Self {
5555
task,

crates/libzkp/src/tasks/batch.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ pub struct BatchHeaderValidiumWithHash {
2727
}
2828

2929
/// Parse header types passed from golang side and adapt to the
30-
/// defination in zkvm-prover's types
30+
/// definition in zkvm-prover's types
3131
/// We distinguish the header type in golang side according to the codec
32-
/// version, i.e. v6 - v9 (current), and validium
33-
/// And adapt it to different header version used in zkvm-prover's witness
34-
/// defination, i.e. v6- v8 (current), and validium
32+
/// version, i.e. v7 - v9 (current), and validium
33+
/// And adapt it to the corresponding header version used in zkvm-prover's witness
34+
/// definition, i.e. v7- v8 (current), and validium
3535
#[derive(Clone, serde::Deserialize, serde::Serialize)]
3636
#[serde(untagged)]
3737
#[allow(non_camel_case_types)]

crates/libzkp_c/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,3 @@ pub unsafe extern "C" fn release_string(ptr: *mut c_char) {
275275
let _ = CString::from_raw(ptr);
276276
}
277277
}
278-
279-
/// # Safety
280-
#[no_mangle]
281-
pub unsafe extern "C" fn set_dynamic_feature(feats: *const c_char) {
282-
let feats_str = c_char_to_str(feats);
283-
libzkp::set_dynamic_feature(feats_str);
284-
}

crates/prover-bin/src/prover.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use scroll_proving_sdk::{
1212
ProvingService,
1313
},
1414
};
15+
use scroll_zkvm_types::ProvingTask;
1516
use serde::{Deserialize, Serialize};
1617
use std::{
1718
collections::HashMap,
@@ -272,7 +273,9 @@ impl LocalProver {
272273
let duration = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
273274
let created_at = duration.as_secs() as f64 + duration.subsec_nanos() as f64 * 1e-9;
274275

275-
let (prover_task, task_cfg) = UniversalHandler::get_task_from_input(&req.input)?;
276+
let prover_task = UniversalHandler::get_task_from_input(&req.input)?;
277+
let is_openvm_13 = prover_task.use_openvm_13;
278+
let prover_task: ProvingTask = prover_task.into();
276279
let vk = hex::encode(&prover_task.vk);
277280
let handler = if let Some(handler) = self.handlers.get(&vk) {
278281
handler.clone()
@@ -298,8 +301,10 @@ impl LocalProver {
298301
.location_data
299302
.get_asset(&vk, &url_base, &base_config.workspace_path)
300303
.await?;
301-
let circuits_handler =
302-
Arc::new(Mutex::new(UniversalHandler::new(&asset_path, &task_cfg)?));
304+
let circuits_handler = Arc::new(Mutex::new(UniversalHandler::new(
305+
&asset_path,
306+
is_openvm_13,
307+
)?));
303308
self.handlers.insert(vk, circuits_handler.clone());
304309
circuits_handler
305310
};

crates/prover-bin/src/zk_circuits_handler/universal.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,28 @@ use std::path::Path;
33
use super::CircuitsHandler;
44
use async_trait::async_trait;
55
use eyre::Result;
6-
use libzkp::ProvintTaskExt;
6+
use libzkp::ProvingTaskExt;
77
use scroll_zkvm_prover::{Prover, ProverConfig};
88
use scroll_zkvm_types::ProvingTask;
99
use tokio::sync::Mutex;
1010
pub struct UniversalHandler {
1111
prover: Prover,
1212
}
1313

14-
// additional config dispatched with proving task
15-
#[derive(Debug, Default)]
16-
pub(crate) struct TaskConfig {
17-
pub is_openvm_v13: bool,
18-
}
19-
2014
/// Safe for current usage as `CircuitsHandler` trait (protected inside of Mutex and NEVER extract
2115
/// the instance out by `into_inner`)
2216
unsafe impl Send for UniversalHandler {}
2317

2418
impl UniversalHandler {
25-
pub fn new(workspace_path: impl AsRef<Path>, cfg: &TaskConfig) -> Result<Self> {
19+
pub fn new(workspace_path: impl AsRef<Path>, is_openvm_v13: bool) -> Result<Self> {
2620
let path_app_exe = workspace_path.as_ref().join("app.vmexe");
2721
let path_app_config = workspace_path.as_ref().join("openvm.toml");
28-
let segment_len = Some((1 << 22) - 100);
22+
let segment_len = Some((1 << 21) - 100);
2923
let config = ProverConfig {
3024
path_app_config,
3125
path_app_exe,
3226
segment_len,
33-
is_openvm_v13: cfg.is_openvm_v13,
27+
is_openvm_v13,
3428
};
3529

3630
let prover = Prover::setup(config, None)?;
@@ -43,13 +37,8 @@ impl UniversalHandler {
4337
&mut self.prover
4438
}
4539

46-
pub fn get_task_from_input(input: &str) -> Result<(ProvingTask, TaskConfig)> {
47-
let task_ext: ProvintTaskExt = serde_json::from_str(input)?;
48-
let cfg = TaskConfig {
49-
is_openvm_v13: task_ext.use_openvm_13,
50-
};
51-
52-
Ok((task_ext.into(), cfg))
40+
pub fn get_task_from_input(input: &str) -> Result<ProvingTaskExt> {
41+
Ok(serde_json::from_str(input)?)
5342
}
5443
}
5544

tests/prover-e2e/cloak-xen/config.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
"login_expire_duration_sec": 3600
3636
},
3737
"sequencer": {
38-
"decryption_key": "ad25ba5de9f03fd9e3c81a1ad731c5c7e94ae2641f75ed7d3275312053b40f75"
38+
"decryption_key": "<decryption key>"
3939
}
4040
}

0 commit comments

Comments
 (0)