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

Commit

Permalink
Merge pull request #154 from anton-rs/refcell/fix-refcell-nits
Browse files Browse the repository at this point in the history
fix all refcell nits
  • Loading branch information
refcell authored Nov 2, 2023
2 parents 779ca19 + 6de2577 commit 23e9440
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 19 deletions.
4 changes: 1 addition & 3 deletions crates/payload/builder/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,14 @@ pub struct PayloadBuilderAttributes {
}

/// Optimism Payload Builder Attributes
#[cfg(feature = "optimism")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OptimismPayloadBuilderAttributes {
/// NoTxPool option for the generated payload
#[cfg(feature = "optimism")]
pub no_tx_pool: bool,
/// Transactions for the generated payload
#[cfg(feature = "optimism")]
pub transactions: Vec<TransactionSigned>,
/// The gas limit for the generated payload
#[cfg(feature = "optimism")]
pub gas_limit: Option<u64>,
}

Expand Down
5 changes: 1 addition & 4 deletions crates/primitives/src/transaction/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use derive_more::{AsRef, Deref};
use reth_codecs::add_arbitrary_tests;
use serde::{Deserialize, Serialize};

#[cfg(feature = "optimism")]
use crate::TxDeposit;

/// A response to `GetPooledTransactions`. This can include either a blob transaction, or a
/// non-4844 signed transaction.
#[add_arbitrary_tests]
Expand Down Expand Up @@ -51,7 +48,7 @@ pub enum PooledTransactionsElement {
#[cfg(feature = "optimism")]
Deposit {
/// The inner transaction
transaction: TxDeposit,
transaction: crate::TxDeposit,
/// The signature
signature: Signature,
/// The hash of the transaction
Expand Down
5 changes: 1 addition & 4 deletions crates/rpc/rpc/src/eth/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,13 @@ pub enum EthApiError {
}

/// Eth Optimism Api Error
#[cfg(feature = "optimism")]
#[derive(Debug, thiserror::Error)]
pub enum OptimismEthApiError {
/// Wrapper around a [hyper::Error].
#[cfg(feature = "optimism")]
#[error(transparent)]
HyperError(#[from] hyper::Error),
/// Wrapper around an [http::Error].
#[cfg(feature = "optimism")]
#[error(transparent)]
HttpError(#[from] http::Error),
}
Expand Down Expand Up @@ -348,11 +347,9 @@ pub enum RpcInvalidTransactionError {
pub enum OptimismInvalidTransactionError {
/// A deposit transaction was submitted as a system transaction post-regolith.
#[error("no system transactions allowed after regolith")]
#[cfg(feature = "optimism")]
DepositSystemTxPostRegolith,
/// A deposit transaction halted post-regolith
#[error("deposit transaction halted after regolith")]
#[cfg(feature = "optimism")]
HaltedDepositPostRegolith,
}

Expand Down
5 changes: 1 addition & 4 deletions crates/transaction-pool/src/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ use reth_primitives::{Address, BlobTransactionSidecar, TxHash};
use std::{collections::HashSet, marker::PhantomData, sync::Arc};
use tokio::sync::{mpsc, mpsc::Receiver};

#[cfg(feature = "optimism")]
use reth_primitives::InvalidTransactionError;

/// A [`TransactionPool`] implementation that does nothing.
///
/// All transactions are rejected and no events are emitted.
Expand Down Expand Up @@ -242,7 +239,7 @@ impl<T: PoolTransaction> TransactionValidator for MockTransactionValidator<T> {
if transaction.is_deposit() {
return TransactionValidationOutcome::Invalid(
transaction,
InvalidTransactionError::TxTypeNotSupported.into(),
reth_primitives::InvalidTransactionError::TxTypeNotSupported.into(),
)
}

Expand Down
9 changes: 5 additions & 4 deletions crates/transaction-pool/src/validate/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ use std::{
};
use tokio::sync::Mutex;

#[cfg(feature = "optimism")]
use reth_primitives::{bytes::BytesMut, BlockNumberOrTag};
#[cfg(feature = "optimism")]
use reth_revm::optimism::RethL1BlockInfo;

Expand Down Expand Up @@ -377,7 +375,10 @@ where

#[cfg(feature = "optimism")]
let cost = {
let block = match self.client.block_by_number_or_tag(BlockNumberOrTag::Latest) {
let block = match self
.client
.block_by_number_or_tag(reth_primitives::BlockNumberOrTag::Latest)
{
Ok(Some(block)) => block,
Ok(None) => {
return TransactionValidationOutcome::Error(
Expand All @@ -390,7 +391,7 @@ where
}
};

let mut encoded = BytesMut::default();
let mut encoded = reth_primitives::bytes::BytesMut::default();
transaction.to_recovered_transaction().encode_enveloped(&mut encoded);
let cost_addition = match reth_revm::optimism::extract_l1_info(&block).map(|info| {
info.l1_tx_data_fee(
Expand Down

0 comments on commit 23e9440

Please sign in to comment.