From 46f5107643568a1ae92dbc460f5676467ffb49b3 Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Wed, 1 Oct 2025 12:01:29 +0200 Subject: [PATCH 1/2] Removes unused handling of failed atomic batch --- crates/node/src/shell/finalize_block.rs | 39 +++++++------------------ 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/crates/node/src/shell/finalize_block.rs b/crates/node/src/shell/finalize_block.rs index 10602f8b055..2854d05daf0 100644 --- a/crates/node/src/shell/finalize_block.rs +++ b/crates/node/src/shell/finalize_block.rs @@ -482,37 +482,20 @@ where let mut temp_log = TempTxLogs::new_from_tx_logs(tx_logs); let ValidityFlags { - commit_batch_hash, - is_any_tx_invalid, + commit_batch_hash, .. } = temp_log.check_inner_results(&mut tx_result, tx_data.height); - if tx_data.is_atomic_batch && is_any_tx_invalid { - // Atomic batches need custom handling when even a single tx fails, - // since we need to drop everything - let unrun_txs = tx_data - .commitments_len - .checked_sub( - u64::try_from(tx_result.len()) - .expect("Should be able to convert to u64"), - ) - .expect("Shouldn't underflow"); - temp_log.stats.set_failing_atomic_batch(unrun_txs); - temp_log.commit_stats_only(tx_logs); - self.state.write_log_mut().drop_batch(); - tx_logs.tx_event.extend(Code(ResultCode::WasmRuntimeError)); - } else { - self.state.write_log_mut().commit_batch_and_current_tx(); - self.state - .in_mem_mut() - .block - .results - .accept(tx_data.tx_index); - temp_log.commit(tx_logs, response); + self.state.write_log_mut().commit_batch_and_current_tx(); + self.state + .in_mem_mut() + .block + .results + .accept(tx_data.tx_index); + temp_log.commit(tx_logs, response); - // Atomic successful batches or non-atomic batches (even if the - // inner txs failed) are marked as Ok - tx_logs.tx_event.extend(Code(ResultCode::Ok)); - } + // Atomic successful batches or non-atomic batches (even if the + // inner txs failed) are marked as Ok + tx_logs.tx_event.extend(Code(ResultCode::Ok)); if commit_batch_hash { // If at least one of the inner txs of the batch requires its hash From 283617670a0a900bca99fd455e9d30f4561587b8 Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Wed, 1 Oct 2025 12:05:38 +0200 Subject: [PATCH 2/2] Changelog #4450 --- .../unreleased/improvements/4450-unused-batch-handling.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/improvements/4450-unused-batch-handling.md diff --git a/.changelog/unreleased/improvements/4450-unused-batch-handling.md b/.changelog/unreleased/improvements/4450-unused-batch-handling.md new file mode 100644 index 00000000000..5a09e33b84d --- /dev/null +++ b/.changelog/unreleased/improvements/4450-unused-batch-handling.md @@ -0,0 +1,2 @@ +- Removed handling of failed atomic batches from `handle_inner_tx_results` that + was never hit. ([\#4450](https://github.com/namada-net/namada/issues/4450)) \ No newline at end of file