From 5d8f2430a7fc749b7ed82e34e7ab0713ef6922ad Mon Sep 17 00:00:00 2001 From: Brice Dobry Date: Mon, 31 Jul 2023 11:57:02 -0400 Subject: [PATCH 1/2] chore: add `txid` to logs for contract deploys This will make it easier to find errors for a transaction when searching logs. --- src/chainstate/stacks/db/transactions.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chainstate/stacks/db/transactions.rs b/src/chainstate/stacks/db/transactions.rs index 46dd796962..78e64bece4 100644 --- a/src/chainstate/stacks/db/transactions.rs +++ b/src/chainstate/stacks/db/transactions.rs @@ -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( @@ -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); @@ -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); @@ -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); @@ -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); From 4073384fa471bc26a10ad91e73277f156b6484dd Mon Sep 17 00:00:00 2001 From: Brice Dobry Date: Fri, 4 Aug 2023 15:04:56 -0400 Subject: [PATCH 2/2] docs: add changelog entry --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c9ad7b314..40ed706181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to the versioning scheme outlined in the [README.md](README.md). +## [2.4.0.0.1] + +This is a minor change to add `txid` fields into the log messages from failing +contract deploys. This will help tools (and users) more easily find the log +messages to determine what went wrong. + ## [2.4.0.0.0] This is a **consensus-breaking** release to revert consensus to PoX, and is the second fork proposed in SIP-022.