Skip to content

Commit ae8858c

Browse files
feat(host): extract worker message handling (#307)
* feat(host): extract worker message handling * [WIP](host): add initial cancel API for proof tasks * fix(host): add return expression * fix(host): wrap prover into a option string * fix(host): cleanup imports * refactor(host): move proof handlers into separate module * feat(host): use actor pattern to spawn tasks * refactor(host): clean up task spawning * chore(deps): remove hyper * chore(deps): update dependencies * feat(host): add concurrency limit to proof tasks * fix(pipeline): convert buffer types * fix(harness): pass second argument * refactor(host): move allocator next to memory module * feat(host): handle task cancell status and refactor handler * feat(host,task_manager): add documentation to v2 API * fix(host): fix typo in docs * chore(lib,core,host): use tracing instead of println * feat(host): update cancellation route * refactor(host): move proof file into module * [WIP](core,host,task_manager): stub prune and report endpoints * refactor(task_manager): use `TaskDescriptor` inside `TaskReport` * feat(host): don't start work unless the latest status is `Registered` * feat(host): update prune docs with `PruneStatus` * feat(task_manager): refactor in memory implementation
1 parent d2b87e0 commit ae8858c

File tree

20 files changed

+849
-643
lines changed

20 files changed

+849
-643
lines changed

Diff for: Cargo.lock

+122-130
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+5-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ rlp = "0.5.2"
108108
hex = { version = "0.4.3" }
109109
hex-literal = "0.4"
110110
base64-serde = "0.7.0"
111-
base64 = "0.21.7"
111+
base64 = "0.22.1"
112112
libflate = { version = "2.0.0" }
113113
typetag = { version = "0.2.15" }
114114
num_enum = "0.7.2"
@@ -129,13 +129,12 @@ cap = { git = "https://github.com/brechtpd/cap", branch = "more-stats", features
129129
axum = { version = "0.7.4", features = ["macros"] }
130130
tower-http = { version = "0.5.2", features = ["full"] }
131131
tower = { version = "0.4.13", features = ["full"] }
132-
utoipa-swagger-ui = { version = "6.0.0", features = ["axum"] }
132+
utoipa-swagger-ui = { version = "7.1.0", features = ["axum"] }
133133
utoipa-scalar = { version = "0.1.0", features = ["axum"] }
134134
utoipa = { version = "4.2.0", features = ["axum_extras"] }
135135
structopt = "0.3.24"
136136
prometheus = { version = "0.13.3", features = ["process"] }
137137
tokio = { version = "^1.23", features = ["full"] }
138-
hyper = { version = "0.14.27", features = ["server"] }
139138
reqwest = { version = "0.11.22", features = ["json"] }
140139
url = "2.5.0"
141140
async-trait = "0.1.80"
@@ -151,7 +150,7 @@ secp256k1 = { version = "0.29", default-features = false, features = [
151150
] }
152151

153152
# macro
154-
syn = { version = "1.0", features = ["full"] }
153+
syn = { version = "2.0.68", features = ["full"] }
155154
quote = "1.0"
156155
proc-macro2 = "1.0"
157156

@@ -166,7 +165,7 @@ rusqlite = { version = "0.31.0", features = ["bundled"] }
166165
# misc
167166
hashbrown = { version = "0.14", features = ["inline-more"] }
168167
tempfile = "3.8"
169-
cargo_metadata = "0.12.1"
168+
cargo_metadata = "0.18.1"
170169
clap = { version = "4.4.6", features = ["derive", "string", "env"] }
171170
lru_time_cache = "0.11.11"
172171
lazy_static = "1.4.0"
@@ -176,7 +175,7 @@ cfg-if = "1.0.0"
176175
chrono = { version = "0.4", default-features = false }
177176
assert_cmd = "2.0"
178177
regex = "1.5.4"
179-
rstest = "0.18"
178+
rstest = "0.21"
180179
rand = "0.8.5"
181180
rand_core = "0.6.4"
182181
dirs = "5.0.1"

Diff for: core/src/interfaces.rs

+14
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ impl FromStr for ProofType {
139139
}
140140
}
141141

142+
impl TryFrom<u8> for ProofType {
143+
type Error = RaikoError;
144+
145+
fn try_from(value: u8) -> Result<Self, Self::Error> {
146+
match value {
147+
0 => Ok(Self::Native),
148+
1 => Ok(Self::Sp1),
149+
2 => Ok(Self::Sgx),
150+
3 => Ok(Self::Risc0),
151+
_ => Err(RaikoError::Conversion("Invalid u8".to_owned())),
152+
}
153+
}
154+
}
155+
142156
impl ProofType {
143157
/// Run the prover driver depending on the proof type.
144158
pub async fn run_prover(

Diff for: core/src/preflight.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use reth_evm_ethereum::taiko::decode_anchor;
3232
use reth_primitives::Block;
3333
use serde::{Deserialize, Serialize};
3434
use std::collections::HashSet;
35-
use tracing::{debug, info, warn};
35+
use tracing::{debug, error, info, warn};
3636

3737
pub async fn preflight<BDP: BlockDataProvider>(
3838
provider: BDP,
@@ -137,7 +137,7 @@ pub async fn preflight<BDP: BlockDataProvider>(
137137
num_iterations += 1;
138138
}
139139
clear_line();
140-
println!("State data fetched in {num_iterations} iterations");
140+
info!("State data fetched in {num_iterations} iterations");
141141

142142
let provider_db = builder.db.as_mut().unwrap();
143143

@@ -406,7 +406,7 @@ async fn get_blob_data_blobscan(
406406
let blob: BlobScanData = response.json().await?;
407407
Ok(blob_to_bytes(&blob.data))
408408
} else {
409-
println!(
409+
error!(
410410
"Request {url} failed with status code: {}",
411411
response.status()
412412
);

Diff for: harness/macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl syn::parse::Parse for EntryArgs {
2020
let test_modules: Option<Punctuated<Path, Token![,]>> = if input.peek(Token![,]) {
2121
input.parse::<Token![,]>()?; // Parse and consume the comma
2222
// Now parse a list of module paths if they are present
23-
Some(input.parse_terminated(Path::parse)?)
23+
Some(input.parse_terminated(Path::parse, Token![,])?)
2424
} else {
2525
None
2626
};

Diff for: host/Cargo.toml

+4-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ serde = { workspace = true }
5050
serde_with = { workspace = true }
5151
serde_json = { workspace = true }
5252
tokio = { workspace = true }
53-
hyper = { workspace = true }
5453
env_logger = { workspace = true }
5554
tracing = { workspace = true }
5655
tracing-subscriber = { workspace = true }
@@ -70,10 +69,10 @@ cfg-if = { workspace = true }
7069
cap = { workspace = true }
7170

7271
# reth
73-
reth-primitives.workspace = true
74-
reth-evm.workspace = true
75-
reth-evm-ethereum.workspace = true
76-
reth-provider.workspace = true
72+
reth-primitives = { workspace = true }
73+
reth-evm = { workspace = true }
74+
reth-evm-ethereum = { workspace = true }
75+
reth-provider = { workspace = true }
7776

7877
[dev-dependencies]
7978
assert_cmd = { workspace = true }

0 commit comments

Comments
 (0)