@@ -11,6 +11,7 @@ use alloy_provider::Provider;
11
11
use alloy_rpc_types:: { BlockId , TransactionRequest } ;
12
12
use alloy_serde:: WithOtherFields ;
13
13
use anvil:: { NodeConfig , spawn} ;
14
+ use foundry_test_utils:: rpc;
14
15
15
16
#[ tokio:: test( flavor = "multi_thread" ) ]
16
17
async fn can_send_eip4844_transaction ( ) {
@@ -48,6 +49,33 @@ async fn can_send_eip4844_transaction() {
48
49
assert_eq ! ( receipt. blob_gas_price, Some ( 0x1 ) ) ; // 1 wei
49
50
}
50
51
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
+
51
79
#[ tokio:: test( flavor = "multi_thread" ) ]
52
80
async fn can_send_multiple_blobs_in_one_tx ( ) {
53
81
let node_config = NodeConfig :: test ( ) . with_hardfork ( Some ( EthereumHardfork :: Cancun . into ( ) ) ) ;
0 commit comments