Skip to content

Commit

Permalink
fix: increment post block balances in invalid block hook (#11139)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected committed Sep 23, 2024
1 parent ed2679b commit 89b6ad2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use reth_revm::{
database::StateProviderDatabase,
db::states::bundle_state::BundleRetention,
primitives::{BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg},
state_change::post_block_balance_increments,
DatabaseCommit, StateBuilder,
};
use reth_rpc_api::DebugApiClient;
Expand Down Expand Up @@ -114,6 +115,17 @@ where

drop(evm);

// use U256::MAX here for difficulty, because fetching it is annoying
// NOTE: This is not mut because we are not doing the DAO irregular state change here
let balance_increments = post_block_balance_increments(
self.provider.chain_spec().as_ref(),
&block.block.clone().unseal(),
U256::MAX,
);

// increment balances
db.increment_balances(balance_increments)?;

// Merge all state transitions
db.merge_transitions(BundleRetention::Reverts);

Expand Down

0 comments on commit 89b6ad2

Please sign in to comment.