Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

Commit 531c0c0

Browse files
committed
chore: keep pruning
1 parent 256796f commit 531c0c0

22 files changed

Lines changed: 196 additions & 335 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ log.build.*
6868
# -----------------------------------------------------------------------------------------
6969
venv/
7070
.venv/
71+
*.pyc
7172

Dockerfile.zk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ COPY --from=builder /opt/raiko/target/release/raiko-host /opt/raiko/bin/
9797
# Copy the .env file with RISC0 and SP1 image IDs from builder stage
9898
COPY --from=builder /opt/raiko/.env /opt/raiko/.env
9999
# Include only the runtime guest ELF artifacts for SP1 and RISC0
100-
COPY --from=builder /opt/raiko/provers/sp1/guest/elf/sp1-aggregation /opt/raiko/provers/sp1/elf/sp1-aggregation
101100
COPY --from=builder /opt/raiko/provers/sp1/guest/elf/sp1-batch /opt/raiko/provers/sp1/elf/sp1-batch
102101
COPY --from=builder /opt/raiko/provers/sp1/guest/elf/sp1-shasta-aggregation /opt/raiko/provers/sp1/elf/sp1-shasta-aggregation
103102
COPY --from=builder /opt/raiko/provers/risc0/guest/target/riscv32im-risc0-zkvm-elf/release/boundless-aggregation.bin /opt/raiko/provers/risc0/elf/boundless-aggregation.bin
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use axum::{extract::State, routing::get, Json, Router};
2+
use serde_json::Value;
3+
use utoipa::OpenApi;
4+
5+
use crate::interfaces::HostResult;
6+
use raiko_reqactor::Actor;
7+
8+
#[utoipa::path(post, path = "/proof/list",
9+
tag = "Proving",
10+
responses (
11+
(status = 200, description = "Successfully listed all proofs & Ids", body = CancelStatus)
12+
)
13+
)]
14+
async fn list_handler(State(_actor): State<Actor>) -> HostResult<Json<Value>> {
15+
todo!()
16+
}
17+
18+
#[derive(OpenApi)]
19+
#[openapi(paths(list_handler))]
20+
struct Docs;
21+
22+
pub fn create_docs() -> utoipa::openapi::OpenApi {
23+
Docs::openapi()
24+
}
25+
26+
pub fn create_router() -> Router<Actor> {
27+
Router::new().route("/", get(list_handler))
28+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use crate::interfaces::HostResult;
2+
use crate::server::api::v3::PruneStatus;
3+
use axum::{extract::State, routing::post, Json, Router};
4+
use raiko_reqactor::Actor;
5+
use utoipa::OpenApi;
6+
7+
#[utoipa::path(post, path = "/proof/prune",
8+
tag = "Proving",
9+
responses (
10+
(status = 200, description = "Successfully pruned tasks", body = PruneStatus)
11+
)
12+
)]
13+
/// Prune all tasks.
14+
async fn prune_handler(State(actor): State<Actor>) -> HostResult<Json<PruneStatus>> {
15+
let statuses = actor
16+
.pool_list_status()
17+
.await
18+
.map_err(|e| anyhow::anyhow!(e))?;
19+
for (key, status) in statuses {
20+
tracing::info!("Pruning task: {key} with status: {status}");
21+
let _ = actor
22+
.pool_remove_request(&key)
23+
.await
24+
.map_err(|e| anyhow::anyhow!(e))?;
25+
// Also remove from the queue
26+
actor.queue_remove(&key).await;
27+
}
28+
Ok(Json(PruneStatus::Ok))
29+
}
30+
31+
#[derive(OpenApi)]
32+
#[openapi(paths(prune_handler))]
33+
struct Docs;
34+
35+
pub fn create_docs() -> utoipa::openapi::OpenApi {
36+
Docs::openapi()
37+
}
38+
39+
pub fn create_router() -> Router<Actor> {
40+
Router::new().route("/", post(prune_handler))
41+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
use crate::interfaces::HostResult;
2+
use axum::{extract::State, routing::get, Json, Router};
3+
use raiko_reqactor::Actor;
4+
use raiko_reqpool::{RequestKey, Status, StatusWithContext};
5+
use raiko_tasks::{
6+
AggregationTaskDescriptor, BatchGuestInputTaskDescriptor, BatchProofTaskDescriptor,
7+
GuestInputTaskDescriptor, ProofTaskDescriptor, ShastaGuestInputTaskDescriptor,
8+
ShastaProofTaskDescriptor, TaskDescriptor, TaskReport, TaskStatus,
9+
};
10+
use serde_json::Value;
11+
use utoipa::OpenApi;
12+
13+
#[utoipa::path(post, path = "/proof/report",
14+
tag = "Proving",
15+
responses (
16+
(status = 200, description = "Successfully listed all current tasks")
17+
)
18+
)]
19+
/// List all tasks.
20+
///
21+
/// Retrieve a list of `{ chain_id, blockhash, prover_type, prover, status }` items.
22+
async fn report_handler(State(actor): State<Actor>) -> HostResult<Json<Value>> {
23+
let statuses = actor
24+
.pool_list_status()
25+
.await
26+
.map_err(|e| anyhow::anyhow!(e))?;
27+
28+
// For compatibility with the old API, we need to convert the statuses to the old format.
29+
let to_task_status = |status: StatusWithContext| match status.into_status() {
30+
Status::Registered => TaskStatus::Registered,
31+
Status::WorkInProgress => TaskStatus::WorkInProgress,
32+
Status::Cancelled => TaskStatus::Cancelled,
33+
Status::Success { .. } => TaskStatus::Success,
34+
Status::Failed { error } => TaskStatus::AnyhowError(error),
35+
};
36+
let to_task_descriptor = |request_key: RequestKey| match request_key {
37+
RequestKey::GuestInput(key) => TaskDescriptor::GuestInput(GuestInputTaskDescriptor {
38+
chain_id: *key.chain_id(),
39+
block_id: *key.block_number(),
40+
blockhash: *key.block_hash(),
41+
}),
42+
RequestKey::SingleProof(key) => TaskDescriptor::SingleProof(ProofTaskDescriptor {
43+
chain_id: *key.chain_id(),
44+
block_id: *key.block_number(),
45+
blockhash: *key.block_hash(),
46+
proof_system: *key.proof_type(),
47+
prover: key.prover_address().clone(),
48+
}),
49+
RequestKey::Aggregation(key) => TaskDescriptor::Aggregation(AggregationTaskDescriptor {
50+
aggregation_ids: key.block_numbers().clone(),
51+
proof_type: Some(key.proof_type().to_string()),
52+
}),
53+
RequestKey::BatchProof(key) => TaskDescriptor::BatchProof(BatchProofTaskDescriptor {
54+
chain_id: *key.guest_input_key().chain_id(),
55+
batch_id: *key.guest_input_key().batch_id(),
56+
l1_height: *key.guest_input_key().l1_inclusion_height(),
57+
proof_system: *key.proof_type(),
58+
prover: key.prover_address().clone(),
59+
}),
60+
RequestKey::BatchGuestInput(key) => {
61+
TaskDescriptor::BatchGuestInput(BatchGuestInputTaskDescriptor {
62+
chain_id: *key.chain_id(),
63+
batch_id: *key.batch_id(),
64+
l1_height: *key.l1_inclusion_height(),
65+
})
66+
}
67+
RequestKey::ShastaGuestInput(key) => {
68+
TaskDescriptor::ShastaGuestInput(ShastaGuestInputTaskDescriptor {
69+
proposal_id: *key.proposal_id(),
70+
l1_network: key.l1_network().clone(),
71+
l2_network: key.l2_network().clone(),
72+
})
73+
}
74+
RequestKey::ShastaProof(key) => TaskDescriptor::ShastaProof(ShastaProofTaskDescriptor {
75+
proposal_id: *key.guest_input_key().proposal_id(),
76+
l1_network: key.guest_input_key().l1_network().clone(),
77+
l2_network: key.guest_input_key().l2_network().clone(),
78+
proof_system: *key.proof_type(),
79+
prover: key.actual_prover_address().clone(),
80+
}),
81+
RequestKey::ShastaAggregation(key) => {
82+
TaskDescriptor::Aggregation(AggregationTaskDescriptor {
83+
aggregation_ids: key.block_numbers().clone(),
84+
proof_type: Some(key.proof_type().to_string()),
85+
})
86+
}
87+
};
88+
89+
let task_report: Vec<TaskReport> = statuses
90+
.into_iter()
91+
.map(|(request_key, status)| (to_task_descriptor(request_key), to_task_status(status)))
92+
.collect();
93+
Ok(Json(serde_json::to_value(task_report)?))
94+
}
95+
96+
#[derive(OpenApi)]
97+
#[openapi(paths(report_handler))]
98+
struct Docs;
99+
100+
pub fn create_docs() -> utoipa::openapi::OpenApi {
101+
Docs::openapi()
102+
}
103+
104+
pub fn create_router() -> Router<Actor> {
105+
Router::new().route("/", get(report_handler))
106+
}

provers/risc0/builder/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
"provers/risc0/driver/src/methods",
1515
);
1616
#[cfg(feature = "test")]
17-
pipeline.tests(&["risc0-batch"], "provers/risc0/driver/src/methods");
17+
pipeline.tests(&["boundless-batch"], "provers/risc0/driver/src/methods");
1818
#[cfg(feature = "bench")]
1919
pipeline.bins(&["ecdsa", "sha256"], "provers/risc0/driver/src/methods");
2020
}

provers/risc0/driver/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,16 +399,16 @@ fn build_shasta_block_inputs(
399399
mod test {
400400
use super::*;
401401
use methods::boundless_batch::BOUNDLESS_BATCH_ID as RISC0_BATCH_ID;
402-
use methods::test_risc0_batch::{TEST_RISC0_BATCH_ELF, TEST_RISC0_BATCH_ID};
402+
use methods::test_boundless_batch::{TEST_BOUNDLESS_BATCH_ELF, TEST_BOUNDLESS_BATCH_ID};
403403
use risc0_zkvm::{default_prover, ExecutorEnv};
404404

405405
#[test]
406406
fn run_unittest_elf() {
407407
std::env::set_var("RISC0_PROVER", "local");
408408
let env = ExecutorEnv::builder().build().unwrap();
409409
let prover = default_prover();
410-
let receipt = prover.prove(env, TEST_RISC0_BATCH_ELF).unwrap();
411-
receipt.receipt.verify(TEST_RISC0_BATCH_ID).unwrap();
410+
let receipt = prover.prove(env, TEST_BOUNDLESS_BATCH_ELF).unwrap();
411+
receipt.receipt.verify(TEST_BOUNDLESS_BATCH_ID).unwrap();
412412
}
413413

414414
#[ignore = "only to print image id for docker image build"]

provers/risc0/driver/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ pub mod ecdsa;
1010
#[cfg(feature = "bench")]
1111
pub mod sha256;
1212
#[cfg(test)]
13-
pub mod test_risc0_batch;
13+
pub mod test_boundless_batch;

provers/risc0/driver/src/methods/risc0_aggregation.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

provers/risc0/driver/src/methods/risc0_batch.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)