diff --git a/crates/networking/rpc/clients/eth/mod.rs b/crates/networking/rpc/clients/eth/mod.rs index db3e03b6dc..b1f8530e18 100644 --- a/crates/networking/rpc/clients/eth/mod.rs +++ b/crates/networking/rpc/clients/eth/mod.rs @@ -155,7 +155,11 @@ impl EthClient { for url in self.urls.iter() { response = self.send_request_to_url(url, &request).await; if response.is_ok() { - return response; + // Some RPC servers don't implement all the endpoints or don't implement them completely/correctly + // so if the server returns Ok(RpcResponse::Error) we retry with the others + if let Ok(RpcResponse::Success(ref _a)) = response { + return response; + } } } response @@ -436,6 +440,20 @@ impl EthClient { ); } + if !transaction.blobs.is_empty() { + let blobs_str: Vec<_> = transaction + .blobs + .into_iter() + .map(|blob| format!("0x{}", hex::encode(blob))) + .collect(); + + data.as_object_mut() + .ok_or_else(|| { + EthClientError::Custom("Failed to mutate data in estimate_gas".to_owned()) + })? + .insert("blobs".to_owned(), json!(blobs_str)); + } + // Add the nonce just if present, otherwise the RPC will use the latest nonce if let Some(nonce) = transaction.nonce { if let Value::Object(ref mut map) = data { @@ -843,7 +861,9 @@ impl EthClient { ) -> Result<(), EthClientError> { let mut transaction = match wrapped_tx { WrappedTransaction::EIP4844(wrapped_eip4844_transaction) => { - GenericTransaction::from(wrapped_eip4844_transaction.clone().tx) + let mut tx = GenericTransaction::from(wrapped_eip4844_transaction.clone().tx); + add_blobs_to_generic_tx(&mut tx, &wrapped_eip4844_transaction.blobs_bundle); + tx } WrappedTransaction::EIP1559(eip1559_transaction) => { GenericTransaction::from(eip1559_transaction.clone()) @@ -877,7 +897,9 @@ impl EthClient { ) -> Result { let mut transaction = match wrapped_tx { WrappedTransaction::EIP4844(wrapped_eip4844_transaction) => { - GenericTransaction::from(wrapped_eip4844_transaction.clone().tx) + let mut tx = GenericTransaction::from(wrapped_eip4844_transaction.clone().tx); + add_blobs_to_generic_tx(&mut tx, &wrapped_eip4844_transaction.blobs_bundle); + tx } WrappedTransaction::EIP1559(eip1559_transaction) => { GenericTransaction::from(eip1559_transaction.clone()) @@ -1423,6 +1445,14 @@ pub fn get_address_from_secret_key(secret_key: &SecretKey) -> Result