Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
chore: minor nits
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Nov 3, 2023
1 parent ac96757 commit fe52763
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
22 changes: 12 additions & 10 deletions bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,6 @@ impl<Ext: RethCliExt> Cli<Ext> {

let _guard = self.init_tracing()?;

// Runtime safety check for the `optimism` feature flag being enabled on a non-OP Stack
// chain.
#[cfg(feature = "optimism")]
if !self.chain.is_optimism() {
eyre::bail!(
"The `optimism` feature flag is enabled, but the chain is a non OP Stack chain."
)
}

let runner = CliRunner;
match self.command {
Commands::Node(command) => runner.run_command_until_exit(|ctx| command.execute(ctx)),
Expand Down Expand Up @@ -136,7 +127,18 @@ impl<Ext: RethCliExt> Cli<Ext> {
/// Convenience function for parsing CLI options, set up logging and run the chosen command.
#[inline]
pub fn run() -> eyre::Result<()> {
Cli::<()>::parse().run()
let cli = Cli::<()>::parse();

// Runtime safety check for the `optimism` feature flag
// being enabled on a non-OP Stack chain.
#[cfg(feature = "optimism")]
if !cli.chain.is_optimism() {
eyre::bail!(
"The `optimism` feature flag is enabled, but the chain is a non OP Stack chain."
)
}

cli.run()
}

/// Commands to be executed
Expand Down
22 changes: 13 additions & 9 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,15 +890,13 @@ where
meta: TransactionMeta,
receipt: Receipt,
) -> EthResult<TransactionReceipt> {
let receipt_fut = self.cache().get_receipts(meta.block_hash);
let block_fut = self.cache().get_block(meta.block_hash);

let (receipts, block) = futures::try_join!(receipt_fut, block_fut)?;
let (receipts, block) = (
receipts.ok_or(EthApiError::InternalEthError)?,
block.ok_or(EthApiError::InternalEthError)?,
);
let (block, receipts) = self
.cache()
.get_block_and_receipts(meta.block_hash)
.await?
.ok_or(EthApiError::UnknownBlockNumber)?;

let block = block.unseal();
let l1_block_info = reth_revm::optimism::extract_l1_info(&block).ok();
let optimism_tx_meta = self.build_op_tx_meta(&tx, l1_block_info, block.timestamp)?;

Expand Down Expand Up @@ -976,7 +974,13 @@ where
"params": [format!("0x{}", alloy_primitives::hex::encode(tx))],
"id": self.network().chain_id()
}))
.map_err(|_| EthApiError::InternalEthError)?;
.map_err(|_| {
tracing::warn!(
target = "rpc::eth",
"Failed to serialize transaction for forwarding to sequencer"
);
EthApiError::InternalEthError
})?;

let client = reqwest::Client::new();

Expand Down

0 comments on commit fe52763

Please sign in to comment.