Skip to content

Commit 5d8f243

Browse files
committed
chore: add txid to logs for contract deploys
This will make it easier to find errors for a transaction when searching logs.
1 parent fe9c70a commit 5d8f243

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/chainstate/stacks/db/transactions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ impl StacksChainState {
11331133
warn!(
11341134
"Runtime error in contract analysis for {}: {:?}",
11351135
&contract_id, &other_error;
1136+
"txid" => %tx.txid(),
11361137
"AST rules" => %format!("{:?}", &ast_rules)
11371138
);
11381139
let receipt = StacksTransactionReceipt::from_analysis_failure(
@@ -1187,6 +1188,7 @@ impl StacksChainState {
11871188
Err(e) => match handle_clarity_runtime_error(e) {
11881189
ClarityRuntimeTxError::Acceptable { error, err_type } => {
11891190
info!("Smart-contract processed with {}", err_type;
1191+
"txid" => %tx.txid(),
11901192
"contract" => %contract_id,
11911193
"code" => %contract_code_str,
11921194
"error" => ?error);
@@ -1215,6 +1217,7 @@ impl StacksChainState {
12151217
// in 2.1 and later, this is a permitted runtime error. take the
12161218
// fee from the payer and keep the tx.
12171219
warn!("Smart-contract encountered an analysis error at runtime";
1220+
"txid" => %tx.txid(),
12181221
"contract" => %contract_id,
12191222
"code" => %contract_code_str,
12201223
"error" => %check_error);
@@ -1230,6 +1233,7 @@ impl StacksChainState {
12301233
} else {
12311234
// prior to 2.1, this is not permitted in a block.
12321235
warn!("Unexpected analysis error invalidating transaction: if included, this will invalidate a block";
1236+
"txid" => %tx.txid(),
12331237
"contract" => %contract_id,
12341238
"code" => %contract_code_str,
12351239
"error" => %check_error);
@@ -1240,6 +1244,7 @@ impl StacksChainState {
12401244
}
12411245
ClarityRuntimeTxError::Rejectable(e) => {
12421246
error!("Unexpected error invalidating transaction: if included, this will invalidate a block";
1247+
"txid" => %tx.txid(),
12431248
"contract_name" => %contract_id,
12441249
"code" => %contract_code_str,
12451250
"error" => ?e);

0 commit comments

Comments
 (0)