Skip to content

Commit

Permalink
feat: reduce verbose info logging (#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptonemo authored Oct 20, 2021
1 parent 2065052 commit c1475b5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
9 changes: 5 additions & 4 deletions filecoin-proofs/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ where
W: Write,
Tree: 'static + MerkleTreeTrait,
{
info!("unseal_range_inner:start");
trace!("unseal_range_inner:start");

let base_tree_size = get_base_tree_size::<DefaultBinaryTree>(porep_config.sector_size)?;
let base_tree_leafs = get_base_tree_leafs::<DefaultBinaryTree>(base_tree_size)?;
Expand Down Expand Up @@ -310,7 +310,7 @@ where

let amount = UnpaddedBytesAmount(written as u64);

info!("unseal_range_inner:finish");
trace!("unseal_range_inner:finish");
Ok(amount)
}

Expand Down Expand Up @@ -376,7 +376,7 @@ where
R: Read,
W: Write,
{
info!("add_piece:start");
trace!("add_piece:start");

let result = measure_op(Operation::AddPiece, || {
ensure_piece_size(piece_size)?;
Expand Down Expand Up @@ -417,7 +417,7 @@ where
Ok((PieceInfo::new(comm, n)?, written))
});

info!("add_piece:finish");
trace!("add_piece:finish");
result
}

Expand Down Expand Up @@ -705,5 +705,6 @@ where
verify_level_cache_store::<DefaultOctTree>(&t_aux.tree_r_last_config)?;

info!("validate_cache_for_precommit:finish");

Ok(())
}
26 changes: 13 additions & 13 deletions filecoin-proofs/src/api/seal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where
_,
>>::setup(&compound_setup_params)?;

info!("building merkle tree for the original data");
trace!("building merkle tree for the original data");
let (config, comm_d) = measure_op(Operation::CommD, || -> Result<_> {
let base_tree_size = get_base_tree_size::<DefaultBinaryTree>(porep_config.sector_size)?;
let base_tree_leafs = get_base_tree_leafs::<DefaultBinaryTree>(base_tree_size)?;
Expand Down Expand Up @@ -166,7 +166,7 @@ where
Ok((config, comm_d))
})?;

info!("verifying pieces");
trace!("verifying pieces");

ensure!(
verify_pieces(&comm_d, piece_infos, porep_config.into())?,
Expand Down Expand Up @@ -485,7 +485,7 @@ pub fn seal_commit_phase2<Tree: 'static + MerkleTreeTrait>(

let groth_params = get_stacked_params::<Tree>(porep_config)?;

info!(
trace!(
"got groth params ({}) while sealing",
u64::from(PaddedBytesAmount::from(porep_config))
);
Expand All @@ -506,15 +506,15 @@ pub fn seal_commit_phase2<Tree: 'static + MerkleTreeTrait>(
_,
>>::setup(&compound_setup_params)?;

info!("snark_proof:start");
trace!("snark_proof:start");
let groth_proofs = StackedCompound::<Tree, DefaultPieceHasher>::circuit_proofs(
&public_inputs,
vanilla_proofs,
&compound_public_params.vanilla_params,
&groth_params,
compound_public_params.priority,
)?;
info!("snark_proof:finish");
trace!("snark_proof:finish");

let proof = MultiProof::new(groth_proofs, &groth_params.pvk);

Expand Down Expand Up @@ -569,7 +569,7 @@ pub fn get_seal_inputs<Tree: 'static + MerkleTreeTrait>(
ticket: Ticket,
seed: Ticket,
) -> Result<Vec<Vec<Fr>>> {
info!("get_seal_inputs:start");
trace!("get_seal_inputs:start");

ensure!(comm_d != [0; 32], "Invalid all zero commitment (comm_d)");
ensure!(comm_r != [0; 32], "Invalid all zero commitment (comm_r)");
Expand Down Expand Up @@ -628,7 +628,7 @@ pub fn get_seal_inputs<Tree: 'static + MerkleTreeTrait>(
})
.collect::<Result<_>>()?;

info!("get_seal_inputs:finish");
trace!("get_seal_inputs:finish");

Ok(inputs)
}
Expand Down Expand Up @@ -871,15 +871,15 @@ pub fn verify_aggregate_seal_commit_proofs<Tree: 'static + MerkleTreeTrait>(
hasher.finalize().into()
};

info!("start verifying aggregate proof");
trace!("start verifying aggregate proof");
let result = StackedCompound::<Tree, DefaultPieceHasher>::verify_aggregate_proofs(
&srs_verifier_key,
&verifying_key,
&hashed_seeds_and_comm_rs,
commit_inputs.as_slice(),
&aggregate_proof,
)?;
info!("end verifying aggregate proof");
trace!("end verifying aggregate proof");

info!("verify_aggregate_seal_commit_proofs:finish");

Expand All @@ -893,11 +893,11 @@ pub fn verify_aggregate_seal_commit_proofs<Tree: 'static + MerkleTreeTrait>(
/// * `porep_config` - this sector's porep config that contains the number of bytes in the sector.
/// * `piece_infos` - the piece info (commitment and byte length) for each piece in this sector.
pub fn compute_comm_d(sector_size: SectorSize, piece_infos: &[PieceInfo]) -> Result<Commitment> {
info!("compute_comm_d:start");
trace!("compute_comm_d:start");

let result = pieces::compute_comm_d(sector_size, piece_infos);

info!("compute_comm_d:finish");
trace!("compute_comm_d:finish");
result
}

Expand Down Expand Up @@ -969,7 +969,7 @@ pub fn verify_seal<Tree: 'static + MerkleTreeTrait>(
let sector_bytes = PaddedBytesAmount::from(porep_config);
let verifying_key = get_stacked_verifying_key::<Tree>(porep_config)?;

info!(
trace!(
"got verifying key ({}) while verifying seal",
u64::from(sector_bytes)
);
Expand Down Expand Up @@ -1051,7 +1051,7 @@ pub fn verify_batch_seal<Tree: 'static + MerkleTreeTrait>(
let sector_bytes = PaddedBytesAmount::from(porep_config);

let verifying_key = get_stacked_verifying_key::<Tree>(porep_config)?;
info!(
trace!(
"got verifying key ({}) while verifying seal",
u64::from(sector_bytes)
);
Expand Down
4 changes: 2 additions & 2 deletions filecoin-proofs/src/pieces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use anyhow::{ensure, Context, Result};
use filecoin_hashers::{HashFunction, Hasher};
use fr32::Fr32Reader;
use lazy_static::lazy_static;
use log::info;
use log::trace;
use storage_proofs_core::util::NODE_SIZE;

use crate::{
Expand Down Expand Up @@ -83,7 +83,7 @@ fn empty_comm_d(sector_size: SectorSize) -> Commitment {
}

pub fn compute_comm_d(sector_size: SectorSize, piece_infos: &[PieceInfo]) -> Result<Commitment> {
info!("verifying {} pieces", piece_infos.len());
trace!("verifying {} pieces", piece_infos.len());
if piece_infos.is_empty() {
return Ok(empty_comm_d(sector_size));
}
Expand Down

0 comments on commit c1475b5

Please sign in to comment.