Skip to content

Commit eca1cfe

Browse files
authored
Merge pull request #3816 from stacks-network/feat/contract-error-txid
Add txid to contract deploy logs
2 parents fe9c70a + 4073384 commit eca1cfe

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [2.4.0.0.1]
9+
10+
This is a minor change to add `txid` fields into the log messages from failing
11+
contract deploys. This will help tools (and users) more easily find the log
12+
messages to determine what went wrong.
13+
814
## [2.4.0.0.0]
915
This is a **consensus-breaking** release to revert consensus to PoX, and is the second fork proposed in SIP-022.
1016

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)