Skip to content

Commit

Permalink
feat(logs): improved formatting, reduced verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
polydez committed Jan 23, 2024
1 parent 58b85a9 commit a7a3e3a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
13 changes: 6 additions & 7 deletions block-producer/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,23 @@ where
request: tonic::Request<SubmitProvenTransactionRequest>,
) -> Result<tonic::Response<SubmitProvenTransactionResponse>, Status> {
let request = request.into_inner();
debug!(?request.transaction, COMPONENT, "Submitting proven transaction");
debug!(?request.transaction, COMPONENT);

let tx = ProvenTransaction::read_from_bytes(&request.transaction)
.map_err(|_| Status::invalid_argument("Invalid transaction"))?;

info!(
tx_id = ?tx.id(),
tx_id = %tx.id().inner(),
account_id = ?tx.account_id(),
initial_account_hash = ?tx.initial_account_hash(),
final_account_hash = ?tx.final_account_hash(),
initial_account_hash = %tx.initial_account_hash(),
final_account_hash = %tx.final_account_hash(),
input_notes = ?tx.input_notes(),
output_notes = ?tx.output_notes(),
tx_script_root = ?tx.tx_script_root(),
block_ref = ?tx.block_ref(),
block_ref = %tx.block_ref(),
COMPONENT,
"Submitting proven transaction",
);
debug!(proof = ?tx.proof(), COMPONENT, "Submitting proven transaction");
debug!(proof = ?tx.proof(), COMPONENT);

self.queue
.add_transaction(Arc::new(tx))
Expand Down
10 changes: 5 additions & 5 deletions block-producer/src/state_view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ where
candidate_tx: SharedProvenTx,
) -> Result<(), VerifyTxError> {
info!(
tx_id = ?candidate_tx.id(),
tx_id = %candidate_tx.id().inner(),
account_id = ?candidate_tx.account_id(),
COMPONENT,
"Verifying proven transaction",
);

// 1. soft-check if `tx` violates in-flight requirements.
Expand Down Expand Up @@ -173,16 +172,17 @@ fn ensure_in_flight_constraints(
Ok(())
}

#[instrument(skip(candidate_tx), err(Debug), fields(COMPONENT))]
#[instrument(skip_all, err(Debug), fields(COMPONENT))]
fn ensure_tx_inputs_constraints(
candidate_tx: SharedProvenTx,
tx_inputs: TxInputs,
) -> Result<(), VerifyTxError> {
info!(
tx_id = ?candidate_tx.id(),
tx_id = %candidate_tx.id().inner(),
account_id = ?candidate_tx.account_id(),
tx_inputs.account_hash = ?tx_inputs.account_hash,
?tx_inputs.nullifiers,
COMPONENT,
"Ensuring tx inputs constraints",
);

match tx_inputs.account_hash {
Expand Down
4 changes: 3 additions & 1 deletion block-producer/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl ApplyBlock for DefaultStore {
#[async_trait]
impl Store for DefaultStore {
#[allow(clippy::blocks_in_conditions)] // Workaround of `instrument` issue
#[instrument(skip_all, ret, err, fields(COMPONENT))]
#[instrument(skip_all, err, fields(COMPONENT))]
async fn get_tx_inputs(
&self,
proven_tx: SharedProvenTx,
Expand Down Expand Up @@ -163,6 +163,8 @@ impl Store for DefaultStore {
nullifiers.into_iter().collect()
};

info!(%account_hash, ?nullifiers, COMPONENT);

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / docs stable on ubuntu with --all-features --release

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / docs stable on ubuntu with --all-features --release

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / docs stable on ubuntu with --all-features --release

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / test stable on ubuntu with --all-features --workspace

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / test stable on ubuntu with --all-features --workspace

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / test stable on ubuntu with --all-features --workspace

`std::option::Option<RpoDigest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / clippy nightly on ubuntu

`std::option::Option<miden_objects::Digest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / clippy nightly on ubuntu

`std::option::Option<miden_objects::Digest>` doesn't implement `std::fmt::Display`

Check failure on line 166 in block-producer/src/store/mod.rs

View workflow job for this annotation

GitHub Actions / clippy nightly on ubuntu

`std::option::Option<miden_objects::Digest>` doesn't implement `std::fmt::Display`

Ok(TxInputs {
account_hash,
nullifiers,
Expand Down
2 changes: 1 addition & 1 deletion block-producer/src/txqueue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ where
&self,
tx: SharedProvenTx,
) -> Result<(), AddTransactionError> {
info!(tx_id = ?tx.id(), COMPONENT, "Adding proven transaction to queue");
info!(tx_id = %tx.id().inner(), COMPONENT);
self.tx_verifier
.verify_tx(tx.clone())
.await
Expand Down

0 comments on commit a7a3e3a

Please sign in to comment.