Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(circuit_prover): Add circuit prover #2908

Merged
merged 8 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/lib/basic_types/src/prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
basic_fri_types::AggregationRound, protocol_version::ProtocolVersionId, L1BatchNumber,
};

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy)]
pub struct FriProverJobMetadata {
pub id: u32,
pub block_number: L1BatchNumber,
Expand Down
29 changes: 29 additions & 0 deletions prover/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ structopt = "0.3.26"
strum = { version = "0.26" }
tempfile = "3"
tokio = "1"
tokio-util = "0.7.11"
toml_edit = "0.14.4"
tracing = "0.1"
tracing-subscriber = "0.3"
Expand Down
38 changes: 38 additions & 0 deletions prover/crates/bin/circuit_prover/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[package]
name = "zksync_circuit_prover"
EmilLuta marked this conversation as resolved.
Show resolved Hide resolved
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true

[dependencies]
tokio = { workspace = true, features = ["macros", "time"] }
tokio-util.workspace = true
anyhow.workspace = true
async-trait.workspace = true
tracing.workspace = true
bincode.workspace = true
clap = { workspace = true, features = ["derive"] }

zksync_config.workspace = true
zksync_object_store.workspace = true
zksync_prover_dal.workspace = true
zksync_prover_fri_types.workspace = true
zksync_prover_fri_utils.workspace = true
zksync_queued_job_processor.workspace = true
zksync_types.workspace = true
zksync_prover_keystore = { workspace = true, features = ["gpu"] }
zksync_env_config.workspace = true
zksync_core_leftovers.workspace = true
zksync_utils.workspace = true

vise.workspace = true
shivini = { workspace = true, features = [
"circuit_definitions",
"zksync",
] }
zkevm_test_harness.workspace = true
EmilLuta marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 33 additions & 0 deletions prover/crates/bin/circuit_prover/src/backoff.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use std::time::Duration;

/// Backoff - convenience structure that takes care of backoff timings.
#[derive(Debug, Clone)]
pub struct Backoff {
base_delay: Duration,
current_delay: Duration,
max_delay: Duration,
}

impl Backoff {
/// Create a backoff with base_delay (first delay) and max_delay (maximum delay possible).
pub fn new(base_delay: Duration, max_delay: Duration) -> Self {
Backoff {
base_delay,
current_delay: base_delay,
max_delay,
}
}

/// Get current delay, handling future delays if needed
pub fn delay(&mut self) -> Duration {
let delay = self.current_delay;
self.current_delay *= 2;
self.current_delay = self.current_delay.min(self.max_delay);
EmilLuta marked this conversation as resolved.
Show resolved Hide resolved
delay
}

/// Reset the backoff time for to base delay
pub fn reset(&mut self) {
self.current_delay = self.base_delay;
}
}
Loading
Loading