@@ -67,6 +67,7 @@ use anvil_core::eth::{
67
67
} ;
68
68
use anvil_rpc:: error:: RpcError ;
69
69
70
+ use alloy_chains:: NamedChain ;
70
71
use flate2:: { read:: GzDecoder , write:: GzEncoder , Compression } ;
71
72
use foundry_evm:: {
72
73
backend:: { DatabaseError , DatabaseResult , RevertSnapshotAction } ,
@@ -1640,7 +1641,7 @@ impl Backend {
1640
1641
Some ( block. into_full_block ( transactions. into_iter ( ) . map ( |t| t. inner ) . collect ( ) ) )
1641
1642
}
1642
1643
1643
- /// Takes a block as it's stored internally and returns the eth api conform block format
1644
+ /// Takes a block as it's stored internally and returns the eth api conform block format.
1644
1645
pub fn convert_block ( & self , block : Block ) -> AlloyBlock {
1645
1646
let size = U256 :: from ( alloy_rlp:: encode ( & block) . len ( ) as u32 ) ;
1646
1647
@@ -1671,7 +1672,7 @@ impl Backend {
1671
1672
parent_beacon_block_root,
1672
1673
} = header;
1673
1674
1674
- AlloyBlock {
1675
+ let mut block = AlloyBlock {
1675
1676
header : AlloyHeader {
1676
1677
hash : Some ( hash) ,
1677
1678
parent_hash,
@@ -1704,7 +1705,23 @@ impl Backend {
1704
1705
uncles : vec ! [ ] ,
1705
1706
withdrawals : None ,
1706
1707
other : Default :: default ( ) ,
1707
- }
1708
+ } ;
1709
+
1710
+ // If Arbitrum, apply chain specifics to converted block.
1711
+ if let Ok (
1712
+ NamedChain :: Arbitrum |
1713
+ NamedChain :: ArbitrumGoerli |
1714
+ NamedChain :: ArbitrumNova |
1715
+ NamedChain :: ArbitrumTestnet ,
1716
+ ) = NamedChain :: try_from ( self . env . read ( ) . env . cfg . chain_id )
1717
+ {
1718
+ // Block number is the best number.
1719
+ block. header . number = Some ( self . best_number ( ) ) ;
1720
+ // Set `l1BlockNumber` field.
1721
+ block. other . insert ( "l1BlockNumber" . to_string ( ) , number. into ( ) ) ;
1722
+ }
1723
+
1724
+ block
1708
1725
}
1709
1726
1710
1727
/// Converts the `BlockNumber` into a numeric value
0 commit comments