File tree Expand file tree Collapse file tree
primitives/src/transaction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,6 +103,29 @@ async fn can_send_eip4844_transaction_eth_send_transaction() {
103103 let _blobs = api. anvil_get_blob_by_tx_hash ( tx_hash) . unwrap ( ) . unwrap ( ) ;
104104}
105105
106+ // <https://github.com/foundry-rs/foundry/issues/13217>
107+ #[ tokio:: test( flavor = "multi_thread" ) ]
108+ async fn can_send_eip4844_transaction_with_eip7594_sidecar_format ( ) {
109+ let node_config = NodeConfig :: test ( ) . with_hardfork ( Some ( EthereumHardfork :: Osaka . into ( ) ) ) ;
110+ let ( api, handle) = spawn ( node_config) . await ;
111+ let provider = ProviderBuilder :: new ( ) . connect ( handle. http_endpoint ( ) . as_str ( ) ) . await . unwrap ( ) ;
112+ let accounts = provider. get_accounts ( ) . await . unwrap ( ) ;
113+ let alice = accounts[ 0 ] ;
114+ let bob = accounts[ 1 ] ;
115+
116+ let sidecar: SidecarBuilder < SimpleCoder > = SidecarBuilder :: from_slice ( b"Blobs are fun!" ) ;
117+ let sidecar = sidecar. build_7594 ( ) . unwrap ( ) ;
118+
119+ let mut tx = TransactionRequest :: default ( ) . with_from ( alice) . with_to ( bob) ;
120+ alloy_network:: TransactionBuilder7594 :: set_blob_sidecar_7594 ( & mut tx, sidecar) ;
121+
122+ let pending_tx = provider. send_transaction ( tx) . await . unwrap ( ) ;
123+ let receipt = pending_tx. get_receipt ( ) . await . unwrap ( ) ;
124+ let tx_hash = receipt. transaction_hash ;
125+
126+ let _blobs = api. anvil_get_blob_by_tx_hash ( tx_hash) . unwrap ( ) . unwrap ( ) ;
127+ }
128+
106129#[ tokio:: test( flavor = "multi_thread" ) ]
107130async fn can_send_multiple_blobs_in_one_tx ( ) {
108131 let node_config = NodeConfig :: test ( ) . with_hardfork ( Some ( EthereumHardfork :: Cancun . into ( ) ) ) ;
Original file line number Diff line number Diff line change @@ -216,9 +216,12 @@ impl FoundryTransactionRequest {
216216 access_list : self . access_list ( ) . cloned ( ) . unwrap_or_default ( ) ,
217217 ..Default :: default ( )
218218 } ) )
219- } else if self . as_ref ( ) . has_eip4844_fields ( ) && self . as_ref ( ) . blob_sidecar ( ) . is_none ( ) {
220- // if request has eip4844 fields but no blob sidecar, try to build to eip4844 without
221- // sidecar
219+ } else if self . as_ref ( ) . has_eip4844_fields ( )
220+ && self . blob_sidecar ( ) . is_none ( )
221+ && alloy_network:: TransactionBuilder7594 :: blob_sidecar_7594 ( self . as_ref ( ) ) . is_none ( )
222+ {
223+ // if request has eip4844 fields but no blob sidecar (neither eip4844 nor eip7594
224+ // format), try to build to eip4844 without sidecar
222225 self . 0
223226 . into_inner ( )
224227 . build_4844_without_sidecar ( )
You can’t perform that action at this time.
0 commit comments