improve prover with more idiomatic rust code

This commit is contained in:
Petar Radovic 2025-04-23 09:07:23 +02:00 committed by Giacomo Pasini
parent db80e017ad
commit cae55422a5
No known key found for this signature in database
GPG Key ID: FC08489D2D895D4B
2 changed files with 10 additions and 9 deletions

View File

@ -20,10 +20,10 @@ impl Processor {
let metadata = Metadata::new([0; 32], block.number.into());
// the node expects blobs to be padded to the next chunk size
let remainder = blob.len() % DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE;
blob.extend(
std::iter::repeat(0)
.take(DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE - remainder),
);
blob.extend(std::iter::repeat_n(
0,
DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE - remainder,
));
if let Err(e) = self.da.disperse(blob, metadata).await {
error!("Failed to disperse block: {e}");
} else {

View File

@ -40,14 +40,15 @@ fn run_ethereum_prove(
block_number + batch_size - 1
);
let binary_path = if let Some(dir) = &zeth_binary_dir {
let mut path = PathBuf::from(dir);
path.push("zeth-ethereum");
path
let mut binary_path = if let Some(dir) = &zeth_binary_dir {
PathBuf::from(dir)
} else {
return Err("No binary directory provided".to_string());
debug!("No binary directory provided, trying current directory");
std::env::current_dir().map_err(|e| format!("Failed to get current directory: {}", e))?
};
binary_path.push("zeth-ethereum");
if !binary_path.exists() {
return Err(format!("Binary not found at: {}", binary_path.display()));
}