mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-07 15:43:07 +00:00
use tempfile
This commit is contained in:
parent
f980bb4162
commit
9287a16b09
@ -18,3 +18,4 @@ url = { version = "2" }
|
||||
hex = { version = "0.4" }
|
||||
futures = { version = "0.3" }
|
||||
kzgrs-backend = { git = "https://github.com/logos-co/nomos", branch = "master" }
|
||||
tempfile = "3.19.1"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use tokio::process::Command;
|
||||
use std::path::Path;
|
||||
use std::io::Write;
|
||||
use reqwest::Url;
|
||||
use tracing::{error, info};
|
||||
|
||||
@ -25,9 +26,10 @@ pub async fn verify_proof(
|
||||
.bytes()
|
||||
.await
|
||||
.map_err(|e| format!("Failed to read proof response: {}", e))?;
|
||||
let filename = format!("{}-{}.zkp", block_number, block_count + block_number);
|
||||
tokio::fs::write(&filename, &proof)
|
||||
.await
|
||||
|
||||
let mut tempfile = tempfile::NamedTempFile::new()
|
||||
.map_err(|e| format!("Failed to create temporary file: {}", e))?;
|
||||
tempfile.write_all(&proof)
|
||||
.map_err(|e| format!("Failed to write proof to file: {}", e))?;
|
||||
|
||||
|
||||
@ -37,7 +39,7 @@ pub async fn verify_proof(
|
||||
&format!("--rpc={}", rpc),
|
||||
&format!("--block-number={}", block_number),
|
||||
&format!("--block-count={}", block_count),
|
||||
&format!("--file={}", filename),
|
||||
&format!("--file={}", tempfile.path().display()),
|
||||
])
|
||||
.output().await
|
||||
.map_err(|e| format!("Failed to execute zeth-ethereum verify: {}", e))?;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user