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

Circuit cache dir now uses os cache dir #405

Merged
merged 5 commits into from
Aug 12, 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
1 change: 0 additions & 1 deletion zero_bin/common/src/prover_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ impl ProverStateManager {
/// Initialize global prover state from the configuration.
pub fn initialize(&self) -> anyhow::Result<()> {
info!("initializing prover state...");
set_circuit_cache_dir_env_if_not_set()?;

let state = match self.persistence {
CircuitPersistence::None => {
Expand Down
2 changes: 1 addition & 1 deletion zero_bin/common/src/prover_state/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fn circuit_dir() -> String {
/// We store serialized circuits inside the cache directory specified by an env
/// variable. If the user does not set this, then we set it base to the OS's
/// standard location for the cache directory.
pub(crate) fn set_circuit_cache_dir_env_if_not_set() -> anyhow::Result<()> {
pub fn set_circuit_cache_dir_env_if_not_set() -> anyhow::Result<()> {
if std::env::var_os(ZK_EVM_CACHE_DIR_ENV).is_none() {
let circuit_cache_dir = match ProjectDirs::from("", "", ZK_EVM_CACHE_DIR_NAME) {
Some(proj_dir) => proj_dir.cache_dir().to_path_buf(),
Expand Down
3 changes: 2 additions & 1 deletion zero_bin/leader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ops::register;
use paladin::runtime::Runtime;
use proof_gen::proof_types::GeneratedBlockProof;
use tracing::{info, warn};
use zero_bin_common::block_interval::BlockInterval;
use zero_bin_common::{block_interval::BlockInterval, prover_state::persistence::set_circuit_cache_dir_env_if_not_set};
use zero_bin_common::version;

use crate::client::{client_main, ProofParams};
Expand Down Expand Up @@ -38,6 +38,7 @@ fn get_previous_proof(path: Option<PathBuf>) -> Result<Option<GeneratedBlockProo
#[tokio::main]
async fn main() -> Result<()> {
load_dotenvy_vars_if_present();
set_circuit_cache_dir_env_if_not_set()?;
init::tracing();

if env::var_os(EVM_ARITHMETIZATION_PKG_VER).is_none() {
Expand Down
3 changes: 2 additions & 1 deletion zero_bin/worker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use clap::Parser;
use dotenvy::dotenv;
use ops::register;
use paladin::runtime::WorkerRuntime;
use zero_bin_common::prover_state::cli::CliProverStateConfig;
use zero_bin_common::prover_state::{cli::CliProverStateConfig, persistence::set_circuit_cache_dir_env_if_not_set};
use zero_bin_common::version;

mod init;
Expand Down Expand Up @@ -38,6 +38,7 @@ async fn main() -> Result<()> {

dotenv().ok();
init::tracing();
set_circuit_cache_dir_env_if_not_set()?;
BGluth marked this conversation as resolved.
Show resolved Hide resolved
let args = Cli::parse();

args.prover_state_config
Expand Down
Loading