@@ -11,6 +11,7 @@ use alloy_provider::Provider;
1111use alloy_rpc_types:: { BlockId , TransactionRequest } ;
1212use alloy_serde:: WithOtherFields ;
1313use anvil:: { NodeConfig , spawn} ;
14+ use foundry_test_utils:: rpc;
1415
1516#[ tokio:: test( flavor = "multi_thread" ) ]
1617async fn can_send_eip4844_transaction ( ) {
@@ -48,6 +49,33 @@ async fn can_send_eip4844_transaction() {
4849 assert_eq ! ( receipt. blob_gas_price, Some ( 0x1 ) ) ; // 1 wei
4950}
5051
52+ #[ tokio:: test( flavor = "multi_thread" ) ]
53+ async fn can_send_eip4844_transaction_fork ( ) {
54+ let node_config = NodeConfig :: test ( )
55+ . with_eth_rpc_url ( Some ( rpc:: next_http_archive_rpc_url ( ) ) )
56+ . with_fork_block_number ( Some ( 23432306u64 ) )
57+ . with_hardfork ( Some ( EthereumHardfork :: Cancun . into ( ) ) ) ;
58+ let ( api, handle) = spawn ( node_config) . await ;
59+ let provider = handle. http_provider ( ) ;
60+ let accounts = provider. get_accounts ( ) . await . unwrap ( ) ;
61+ let alice = accounts[ 0 ] ;
62+ let bob = accounts[ 1 ] ;
63+
64+ let sidecar: SidecarBuilder < SimpleCoder > = SidecarBuilder :: from_slice ( b"Blobs are fun!" ) ;
65+ let sidecar = sidecar. build ( ) . unwrap ( ) ;
66+
67+ let tx = TransactionRequest :: default ( )
68+ . with_from ( alice)
69+ . with_to ( bob)
70+ . with_blob_sidecar ( sidecar. clone ( ) ) ;
71+
72+ let pending_tx = provider. send_transaction ( tx. into ( ) ) . await . unwrap ( ) ;
73+ let receipt = pending_tx. get_receipt ( ) . await . unwrap ( ) ;
74+ let tx_hash = receipt. transaction_hash ;
75+
76+ let _blobs = api. anvil_get_blob_by_tx_hash ( tx_hash) . unwrap ( ) . unwrap ( ) ;
77+ }
78+
5179#[ tokio:: test( flavor = "multi_thread" ) ]
5280async fn can_send_multiple_blobs_in_one_tx ( ) {
5381 let node_config = NodeConfig :: test ( ) . with_hardfork ( Some ( EthereumHardfork :: Cancun . into ( ) ) ) ;
0 commit comments