@@ -20,11 +20,11 @@ use alloy_consensus::{Header, Transaction, TxReceipt};
2020use alloy_eips:: {
2121 eip4895:: Withdrawals ,
2222 eip7685:: Requests ,
23- eip7928:: { AccountChanges , BlockAccessList } ,
23+ eip7928:: { AccountChanges , BalanceChange , BlockAccessList } ,
2424 Encodable2718 ,
2525} ;
2626use alloy_hardforks:: EthereumHardfork ;
27- use alloy_primitives:: { Log , B256 } ;
27+ use alloy_primitives:: { Log , B256 , U256 } ;
2828use revm:: {
2929 context:: Block , context_interface:: result:: ResultAndState , database:: State , DatabaseCommit ,
3030 Inspector ,
@@ -262,7 +262,25 @@ where
262262 if let Some ( mut alloy_bal) = self . evm . db_mut ( ) . take_built_alloy_bal ( ) {
263263 if let Some ( withdrawals) = self . ctx . withdrawals . as_deref ( ) {
264264 for withdrawal in withdrawals. iter ( ) {
265- alloy_bal. push ( AccountChanges :: new ( withdrawal. address ) ) ;
265+ let initial = self
266+ . evm
267+ . db_mut ( )
268+ . database
269+ . basic ( withdrawal. address )
270+ . unwrap ( )
271+ . unwrap ( )
272+ . balance ;
273+ let final_balance = initial. saturating_add ( U256 :: from ( withdrawal. amount ) ) ;
274+ if initial != final_balance {
275+ alloy_bal. push (
276+ AccountChanges :: new ( withdrawal. address ) . with_balance_change (
277+ BalanceChange :: new (
278+ self . evm . db ( ) . bal_state . bal_index ,
279+ U256 :: from ( final_balance) ,
280+ ) ,
281+ ) ,
282+ ) ;
283+ }
266284 }
267285 }
268286 alloy_bal. sort_by_key ( |a| a. address ) ;
0 commit comments