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

Commit

Permalink
🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Oct 21, 2023
1 parent d562387 commit ba309ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 39 deletions.
1 change: 0 additions & 1 deletion crates/net/network/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ where
let _ = response.send(Ok(PooledTransactions::default()));
return
}
// TODO softResponseLimit 2 * 1024 * 1024
let transactions = self
.pool
.get_pooled_transaction_elements(request.0, GET_POOLED_TRANSACTION_SOFT_LIMIT_SIZE);
Expand Down
32 changes: 0 additions & 32 deletions crates/primitives/src/serde_helper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,6 @@ pub mod option_u64_hex {
}
}

/// serde functions for handling bytes as hex strings, such as [bytes::Bytes]
pub mod hex_bytes {
use alloy_primitives::hex;
use serde::{Deserialize, Deserializer, Serializer};

/// Serialize a byte vec as a hex string with 0x prefix
pub fn serialize<S, T>(x: T, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
T: AsRef<[u8]>,
{
s.serialize_str(&format!("0x{}", hex::encode(x.as_ref())))
}

/// Deserialize a hex string into a byte vec
/// Accepts a hex string with optional 0x prefix
pub fn deserialize<'de, T, D>(d: D) -> Result<T, D::Error>
where
D: Deserializer<'de>,
T: From<Vec<u8>>,
{
let value = String::deserialize(d)?;
if let Some(value) = value.strip_prefix("0x") {
hex::decode(value)
} else {
hex::decode(&value)
}
.map(Into::into)
.map_err(|e| serde::de::Error::custom(e.to_string()))
}
}

/// Serialize a byte vec as a hex string _without_ the "0x" prefix.
///
/// This behaves the same as [`hex::encode`](crate::hex::encode).
Expand Down
12 changes: 6 additions & 6 deletions crates/revm/src/optimism/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ impl RethL1BlockInfo for L1BlockInfo {
return Ok(U256::ZERO)
}

if chain_spec.is_fork_active_at_timestamp(Hardfork::Bedrock, timestamp) {
Ok(self.calculate_tx_l1_cost::<BedrockSpec>(input))
} else if chain_spec.is_fork_active_at_timestamp(Hardfork::Regolith, timestamp) {
if chain_spec.is_fork_active_at_timestamp(Hardfork::Regolith, timestamp) {
Ok(self.calculate_tx_l1_cost::<RegolithSpec>(input))
} else if chain_spec.is_fork_active_at_timestamp(Hardfork::Bedrock, timestamp) {
Ok(self.calculate_tx_l1_cost::<BedrockSpec>(input))
} else {
Err(reth_executor::BlockExecutionError::L1BlockInfoError {
message: "Optimism hardforks are not active".to_string(),
Expand All @@ -128,10 +128,10 @@ impl RethL1BlockInfo for L1BlockInfo {
timestamp: u64,
input: &Bytes,
) -> Result<U256, BlockExecutionError> {
if chain_spec.is_fork_active_at_timestamp(Hardfork::Bedrock, timestamp) {
Ok(self.data_gas::<BedrockSpec>(input))
} else if chain_spec.is_fork_active_at_timestamp(Hardfork::Regolith, timestamp) {
if chain_spec.is_fork_active_at_timestamp(Hardfork::Regolith, timestamp) {
Ok(self.data_gas::<RegolithSpec>(input))
} else if chain_spec.is_fork_active_at_timestamp(Hardfork::Bedrock, timestamp) {
Ok(self.data_gas::<BedrockSpec>(input))
} else {
Err(reth_executor::BlockExecutionError::L1BlockInfoError {
message: "Optimism hardforks are not active".to_string(),
Expand Down

0 comments on commit ba309ec

Please sign in to comment.