@@ -36,7 +36,9 @@ use crate::{
36
36
} ;
37
37
use alloy_chains:: NamedChain ;
38
38
use alloy_consensus:: {
39
- transaction:: Recovered , Account , BlockHeader , Header , Receipt , ReceiptWithBloom , Signed ,
39
+ proofs:: { calculate_receipt_root, calculate_transaction_root} ,
40
+ transaction:: Recovered ,
41
+ Account , BlockHeader , Header , Receipt , ReceiptWithBloom , Signed ,
40
42
Transaction as TransactionTrait , TxEnvelope ,
41
43
} ;
42
44
use alloy_eips:: { eip1559:: BaseFeeParams , eip4844:: MAX_BLOBS_PER_BLOCK } ;
@@ -45,7 +47,8 @@ use alloy_network::{
45
47
EthereumWallet , UnknownTxEnvelope , UnknownTypedTransaction ,
46
48
} ;
47
49
use alloy_primitives:: {
48
- address, hex, keccak256, utils:: Unit , Address , Bytes , TxHash , TxKind , B256 , U256 , U64 ,
50
+ address, hex, keccak256, logs_bloom, utils:: Unit , Address , Bytes , TxHash , TxKind , B256 , U256 ,
51
+ U64 ,
49
52
} ;
50
53
use alloy_rpc_types:: {
51
54
anvil:: Forking ,
@@ -1512,6 +1515,8 @@ impl Backend {
1512
1515
let mut log_index = 0 ;
1513
1516
let mut gas_used = 0 ;
1514
1517
let mut transactions = Vec :: with_capacity ( calls. len ( ) ) ;
1518
+ let mut receipts = Vec :: new ( ) ;
1519
+ let mut logs= Vec :: new ( ) ;
1515
1520
// apply state overrides before executing the transactions
1516
1521
if let Some ( state_overrides) = state_overrides {
1517
1522
state:: apply_cached_db_state_override ( state_overrides, & mut cache_db) ?;
@@ -1617,7 +1622,7 @@ impl Backend {
1617
1622
message : "execution failed" . to_string ( ) ,
1618
1623
}
1619
1624
} ) ,
1620
- logs : result
1625
+ logs : result. clone ( )
1621
1626
. into_logs ( )
1622
1627
. into_iter ( )
1623
1628
. enumerate ( )
@@ -1634,15 +1639,24 @@ impl Backend {
1634
1639
} )
1635
1640
. collect ( ) ,
1636
1641
} ;
1637
-
1642
+ let receipt = Receipt {
1643
+ status : result. is_success ( ) . into ( ) ,
1644
+ cumulative_gas_used : result. gas_used ( ) ,
1645
+ logs : sim_res. logs . clone ( )
1646
+ } ;
1647
+ receipts. push ( receipt. with_bloom ( ) ) ;
1648
+ logs. extend ( sim_res. logs . clone ( ) . iter ( ) . map ( |log| log. inner . clone ( ) ) ) ;
1638
1649
log_index += sim_res. logs . len ( ) ;
1639
1650
call_res. push ( sim_res) ;
1640
1651
}
1641
-
1652
+ let transactions_envelopes: Vec < AnyTxEnvelope > = transactions
1653
+ . iter ( )
1654
+ . map ( |tx| AnyTxEnvelope :: from ( tx. clone ( ) ) )
1655
+ . collect ( ) ;
1642
1656
let header = Header {
1643
- logs_bloom : Default :: default ( ) ,
1644
- transactions_root : Default :: default ( ) ,
1645
- receipts_root : Default :: default ( ) ,
1657
+ logs_bloom : logs_bloom ( logs . iter ( ) ) ,
1658
+ transactions_root : calculate_transaction_root ( & transactions_envelopes ) ,
1659
+ receipts_root : calculate_receipt_root ( & transactions_envelopes ) ,
1646
1660
parent_hash : Default :: default ( ) ,
1647
1661
ommers_hash : Default :: default ( ) ,
1648
1662
beneficiary : block_env. coinbase ,
0 commit comments