Skip to content

Commit

Permalink
chore: add txid to logs for contract deploys
Browse files Browse the repository at this point in the history
This will make it easier to find errors for a transaction when searching
logs.
  • Loading branch information
obycode committed Aug 4, 2023
1 parent fe9c70a commit 5d8f243
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/chainstate/stacks/db/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ impl StacksChainState {
warn!(
"Runtime error in contract analysis for {}: {:?}",
&contract_id, &other_error;
"txid" => %tx.txid(),
"AST rules" => %format!("{:?}", &ast_rules)
);
let receipt = StacksTransactionReceipt::from_analysis_failure(
Expand Down Expand Up @@ -1187,6 +1188,7 @@ impl StacksChainState {
Err(e) => match handle_clarity_runtime_error(e) {
ClarityRuntimeTxError::Acceptable { error, err_type } => {
info!("Smart-contract processed with {}", err_type;
"txid" => %tx.txid(),
"contract" => %contract_id,
"code" => %contract_code_str,
"error" => ?error);
Expand Down Expand Up @@ -1215,6 +1217,7 @@ impl StacksChainState {
// in 2.1 and later, this is a permitted runtime error. take the
// fee from the payer and keep the tx.
warn!("Smart-contract encountered an analysis error at runtime";
"txid" => %tx.txid(),
"contract" => %contract_id,
"code" => %contract_code_str,
"error" => %check_error);
Expand All @@ -1230,6 +1233,7 @@ impl StacksChainState {
} else {
// prior to 2.1, this is not permitted in a block.
warn!("Unexpected analysis error invalidating transaction: if included, this will invalidate a block";
"txid" => %tx.txid(),
"contract" => %contract_id,
"code" => %contract_code_str,
"error" => %check_error);
Expand All @@ -1240,6 +1244,7 @@ impl StacksChainState {
}
ClarityRuntimeTxError::Rejectable(e) => {
error!("Unexpected error invalidating transaction: if included, this will invalidate a block";
"txid" => %tx.txid(),
"contract_name" => %contract_id,
"code" => %contract_code_str,
"error" => ?e);
Expand Down

0 comments on commit 5d8f243

Please sign in to comment.