Skip to content

Commit

Permalink
fix: returned error in send_raw_transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
eugypalu committed Sep 20, 2024
1 parent c4683e1 commit 9d972ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/rust_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:
run: ./scripts/make_with_env.sh katana-genesis
- name: Test code
run: make test

# We skip the hive tests for now, will be fixed in the next PR.

# # Inspired by Reth CI.
Expand Down
12 changes: 8 additions & 4 deletions src/eth_rpc/servers/eth_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use crate::{
client::{EthClient, KakarotTransactions},
eth_rpc::api::eth_api::EthApiServer,
providers::eth_provider::{
constant::MAX_PRIORITY_FEE_PER_GAS, error::EthApiError, BlockProvider, ChainProvider, GasProvider, LogProvider,
ReceiptProvider, StateProvider, TransactionProvider,
constant::MAX_PRIORITY_FEE_PER_GAS,
error::{EthApiError, TransactionError},
BlockProvider, ChainProvider, GasProvider, LogProvider, ReceiptProvider, StateProvider, TransactionProvider,
},
};
use jsonrpsee::core::{async_trait, RpcResult as Result};
Expand Down Expand Up @@ -241,17 +242,20 @@ where
Err(EthApiError::Unsupported("eth_sendTransaction").into())
}

#[allow(unreachable_code)]
#[tracing::instrument(skip_all, ret, err)]
async fn send_raw_transaction(&self, bytes: Bytes) -> Result<B256> {
tracing::info!("Serving eth_sendRawTransaction");
#[cfg(feature = "rpc_forwarding")]
{
let provider = ProviderBuilder::new().on_http(Url::parse(MAIN_RPC_URL.as_ref()).unwrap());
let tx_hash = provider.send_raw_transaction(&bytes).await.expect("failed to send transaction");
let tx_hash = provider
.send_raw_transaction(&bytes)
.await
.map_err(|e| EthApiError::Transaction(TransactionError::Broadcast(e.into())))?;

return Ok(*tx_hash.tx_hash());
}
#[cfg(not(feature = "rpc_forwarding"))]
Ok(self.eth_client.send_raw_transaction(bytes).await?)
}

Expand Down

0 comments on commit 9d972ff

Please sign in to comment.