Skip to content

Commit 4c36ab2

Browse files
authored
[Feat] Upgrade for feynman fork (#75)
Signed-off-by: noelwei <[email protected]>
1 parent 6582c28 commit 4c36ab2

File tree

13 files changed

+184
-2751
lines changed

13 files changed

+184
-2751
lines changed

Cargo.lock

Lines changed: 59 additions & 2383 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
alloy = { version = "0.11", features = [
8-
"provider-http",
9-
"transport-http",
10-
"reqwest",
11-
"reqwest-rustls-tls",
12-
"json-rpc",
13-
] }
147
anyhow = "1.0"
158
log = "0.4"
16-
serde = { version = "1.0.198", features = ["derive"] }
17-
serde_json = "1.0.116"
9+
serde = { version = "1", features = ["derive"] }
10+
serde_json = "1.0"
1811
ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
1912
ethers-providers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
2013
reqwest = { version = "0.12.4", features = ["gzip"] }
@@ -33,22 +26,5 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
3326
axum = "0.6.0"
3427
dotenv = "0.15"
3528
rocksdb = "0.23.0"
36-
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-upgrade", features = [
37-
"scroll",
38-
], optional = true }
39-
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-upgrade", features = [
40-
"scroll",
41-
], optional = true }
4229
url = "2.5.4"
4330

44-
[features]
45-
openvm = ["dep:sbv-utils", "dep:sbv-primitives"]
46-
47-
[patch.crates-io]
48-
# patched add rkyv support & MSRV 1.77
49-
alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "v0.8.21" }
50-
#revm = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v55" }
51-
#revm-interpreter = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v55" }
52-
#revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v55" }
53-
#revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "scroll-evm-executor/v55" }
54-
ruint = { git = "https://github.com/scroll-tech/uint.git", branch = "v1.12.3" }

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "nightly-2024-12-06"
2+
channel = "nightly-2025-02-14"

src/config.rs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use crate::{
2-
coordinator_handler::ProverType,
3-
prover::{CircuitType, ProofType},
4-
};
1+
use crate::{coordinator_handler::ProverType, prover::ProofType};
52
use anyhow::{anyhow, Result};
63
use dotenv::dotenv;
74
use serde::{Deserialize, Serialize};
@@ -14,7 +11,6 @@ pub struct Config {
1411
pub keys_dir: String,
1512
pub db_path: Option<String>,
1613
pub coordinator: CoordinatorConfig,
17-
pub l2geth: Option<L2GethConfig>,
1814
pub prover: ProverConfig,
1915
#[serde(default = "default_health_listener_addr")]
2016
pub health_listener_addr: String,
@@ -28,14 +24,8 @@ pub struct CoordinatorConfig {
2824
pub connection_timeout_sec: u64,
2925
}
3026

31-
#[derive(Debug, Serialize, Deserialize, Clone)]
32-
pub struct L2GethConfig {
33-
pub endpoint: String,
34-
}
35-
3627
#[derive(Debug, Serialize, Deserialize, Clone)]
3728
pub struct ProverConfig {
38-
pub circuit_type: CircuitType,
3929
pub supported_proof_types: Vec<ProofType>,
4030
pub circuit_version: String,
4131
#[serde(default = "default_n_workers")]
@@ -93,11 +83,6 @@ impl Config {
9383
if let Some(val) = Self::get_env_var("COORDINATOR_BASE_URL")? {
9484
self.coordinator.base_url = val;
9585
}
96-
if let Some(val) = Self::get_env_var("L2GETH_ENDPOINT")? {
97-
if let Some(l2geth) = &mut self.l2geth {
98-
l2geth.endpoint = val;
99-
}
100-
}
10186

10287
if let Some(val) = Self::get_env_var("PROOF_TYPES")? {
10388
let values_vec: Vec<&str> = val
@@ -129,28 +114,6 @@ impl Config {
129114
}
130115

131116
pub fn coordinator_prover_type(&self) -> Vec<ProverType> {
132-
if self.prover.circuit_type == CircuitType::OpenVM {
133-
vec![ProverType::OpenVM]
134-
} else {
135-
let mut prover_types = vec![];
136-
if self
137-
.prover
138-
.supported_proof_types
139-
.iter()
140-
.any(|t| *t == ProofType::Bundle || *t == ProofType::Batch)
141-
{
142-
prover_types.push(ProverType::Batch)
143-
}
144-
145-
if self
146-
.prover
147-
.supported_proof_types
148-
.contains(&ProofType::Chunk)
149-
{
150-
prover_types.push(ProverType::Chunk)
151-
}
152-
153-
prover_types
154-
}
117+
vec![ProverType::OpenVM]
155118
}
156119
}

src/coordinator_handler/api.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ impl Api {
109109
token: &String,
110110
) -> anyhow::Result<Response<GetTaskResponseData>> {
111111
let method = "/coordinator/v1/get_task";
112+
if self.send_timeout < core::time::Duration::from_secs(600) {
113+
tracing::warn!(
114+
"get_task API is time-consuming, timeout setting is too low ({}), set it to more than 600s",
115+
self.send_timeout.as_secs(),
116+
);
117+
}
118+
112119
self.post_with_token(method, req, token).await
113120
}
114121

src/coordinator_handler/coordinator_client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ impl CoordinatorClient {
8484
self.login(token_guard).await
8585
}
8686

87-
async fn login<'t>(
87+
async fn login(
8888
&self,
89-
mut token_guard: MutexGuard<'t, Option<String>>,
89+
mut token_guard: MutexGuard<'_, Option<String>>,
9090
) -> anyhow::Result<String> {
9191
let challenge_response = self
9292
.api

src/coordinator_handler/types.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use super::error::ErrorCode;
2-
use crate::{
3-
prover::{ProofType, ProverProviderType},
4-
tracing_handler::CommonHash,
5-
};
2+
use crate::prover::{ProofType, ProverProviderType};
63
use rlp::{Encodable, RlpStream};
74
use serde::{Deserialize, Deserializer, Serialize, Serializer};
85

@@ -112,6 +109,8 @@ pub type ChallengeResponseData = LoginResponseData;
112109
pub struct GetTaskRequest {
113110
pub task_types: Vec<ProofType>,
114111
pub prover_height: Option<u64>,
112+
pub universal: bool,
113+
pub task_id: Option<String>,
115114
}
116115

117116
#[derive(Serialize, Deserialize, Clone, Default)]
@@ -123,13 +122,6 @@ pub struct GetTaskResponseData {
123122
pub hard_fork_name: String,
124123
}
125124

126-
#[derive(Debug, Clone, Deserialize)]
127-
pub struct ChunkTaskDetail {
128-
pub block_hashes: Vec<CommonHash>,
129-
pub prev_msg_queue_hash: CommonHash,
130-
pub fork_name: String,
131-
}
132-
133125
#[derive(Serialize, Deserialize)] // TODO: Default?
134126
pub struct SubmitProofRequest {
135127
pub uuid: String,
@@ -139,6 +131,7 @@ pub struct SubmitProofRequest {
139131
pub proof: String,
140132
pub failure_type: Option<ProofFailureType>,
141133
pub failure_msg: Option<String>,
134+
pub universal: bool,
142135
}
143136

144137
#[derive(Serialize, Deserialize)]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ pub mod config;
22
pub mod coordinator_handler;
33
pub mod db;
44
pub mod prover;
5-
pub mod tracing_handler;
5+
//pub mod tracing_handler;
66
pub mod utils;

src/prover/builder.rs

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tokio::sync::RwLock;
22

3-
use super::{ProofType, ProverProviderType};
3+
use super::ProverProviderType;
44
use crate::{
55
config::Config,
66
coordinator_handler::{CoordinatorClient, KeySigner},
@@ -9,7 +9,6 @@ use crate::{
99
proving_service::{GetVkRequest, ProvingService},
1010
Prover,
1111
},
12-
tracing_handler::L2gethClient,
1312
utils::format_cloud_prover_name,
1413
};
1514
use std::path::PathBuf;
@@ -35,16 +34,6 @@ where
3534
anyhow::bail!("cannot use multiple workers with local proving service");
3635
}
3736

38-
if self
39-
.cfg
40-
.prover
41-
.supported_proof_types
42-
.contains(&ProofType::Chunk)
43-
&& self.cfg.l2geth.is_none()
44-
{
45-
anyhow::bail!("circuit_type is chunk but l2geth config is not provided");
46-
}
47-
4837
let get_vk_request = GetVkRequest {
4938
proof_types: self.cfg.prover.supported_proof_types.clone(),
5039
circuit_version: self.cfg.prover.circuit_version.clone(),
@@ -98,25 +87,19 @@ where
9887
.collect();
9988
let coordinator_clients = coordinator_clients?;
10089

101-
let l2geth_client = match self.cfg.l2geth {
102-
Some(l2geth) => Some(L2gethClient::new(l2geth)?),
103-
None => None,
104-
};
105-
106-
let db_path = self.cfg.db_path.unwrap_or_else(|| {
107-
panic!("Missing database path");
108-
});
109-
11090
Ok(Prover {
111-
circuit_type: self.cfg.prover.circuit_type,
11291
proof_types: self.cfg.prover.supported_proof_types,
11392
circuit_version: self.cfg.prover.circuit_version,
11493
coordinator_clients,
115-
l2geth_client,
11694
proving_service: RwLock::new(self.proving_service),
11795
n_workers: self.cfg.prover.n_workers,
11896
health_listener_addr: self.cfg.health_listener_addr,
119-
db: Db::new(&db_path)?,
97+
db: self
98+
.cfg
99+
.db_path
100+
.as_ref()
101+
.map(|path| Db::new(path.as_str()))
102+
.transpose()?,
120103
})
121104
}
122105
}

0 commit comments

Comments
 (0)