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

Misc features and and quality of life improvements motivated by Op testing #105

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ pub fn save_receipt<T: serde::Serialize>(receipt_label: &String, receipt_data: &
}

fn zkp_cache_path(receipt_label: &String) -> String {
Path::new("cache_zkp")
.join(format!("{}.zkp", receipt_label))
let dir = Path::new("cache_zkp");
std::fs::create_dir_all(&dir).expect("Could not create directory");
dir.join(format!("{}.zkp", receipt_label))
.to_str()
.unwrap()
.to_string()
Expand Down
7 changes: 3 additions & 4 deletions lib/src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ pub mod rpc_db;
pub mod verify;

pub fn cache_file_path(cache_path: &Path, network: &str, block_no: u64, ext: &str) -> PathBuf {
cache_path
.join(network)
.join(block_no.to_string())
.with_extension(ext)
let dir = cache_path.join(network);
std::fs::create_dir_all(&dir).expect("Could not create directory");
dir.join(block_no.to_string()).with_extension(ext)
}

#[derive(Clone)]
Expand Down
14 changes: 5 additions & 9 deletions lib/src/host/rpc_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::path::{Path, PathBuf};
use std::path::PathBuf;

use anyhow::Context;
use zeth_primitives::{
Expand All @@ -22,21 +22,17 @@ use zeth_primitives::{
};

use crate::{
host::provider::{new_provider, BlockQuery},
host::{
cache_file_path,
provider::{new_provider, BlockQuery},
},
optimism::{
batcher_db::{BatcherDb, BlockInput, MemDb},
config::ChainConfig,
deposits, system_config,
},
};

fn cache_file_path(cache_path: &Path, network: &str, block_no: u64, ext: &str) -> PathBuf {
cache_path
.join(network)
.join(block_no.to_string())
.with_extension(ext)
}

fn eth_cache_path(cache: &Option<PathBuf>, block_no: u64) -> Option<PathBuf> {
cache
.as_ref()
Expand Down
Loading