From 3ba2398f9586bb41f78e6c94b7ef87d8275b265a Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 13 Mar 2023 10:35:02 +0100 Subject: [PATCH] bug: Increment transition_id if block changeset is present (#1718) --- crates/storage/provider/src/transaction.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/storage/provider/src/transaction.rs b/crates/storage/provider/src/transaction.rs index b3aabfa304..eb7b4518d3 100644 --- a/crates/storage/provider/src/transaction.rs +++ b/crates/storage/provider/src/transaction.rs @@ -719,6 +719,8 @@ where current_transition_id += 1; } + let have_block_changeset = !results.block_changesets.is_empty(); + // If there are any post block changes, we will add account changesets to db. for (address, changeset) in results.block_changesets.into_iter() { trace!(target: "sync::stages::execution", ?address, current_transition_id, "Applying block reward"); @@ -729,7 +731,13 @@ where spurious_dragon_active, )?; } - current_transition_id += 1; + + // Transition is incremeneted every time before Paris hardfork and after + // Shanghai only if there are Withdrawals in the block. So it is correct to + // to increment transition id every time there is a block changeset present. + if have_block_changeset { + current_transition_id += 1; + } } Ok(()) }