mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: remove optimism feature from execution-types tests (#13676)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -7637,6 +7637,7 @@ dependencies = [
|
|||||||
"arbitrary",
|
"arbitrary",
|
||||||
"bincode",
|
"bincode",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
|
"reth-ethereum-primitives",
|
||||||
"reth-execution-errors",
|
"reth-execution-errors",
|
||||||
"reth-primitives",
|
"reth-primitives",
|
||||||
"reth-primitives-traits",
|
"reth-primitives-traits",
|
||||||
|
|||||||
@ -32,6 +32,7 @@ arbitrary.workspace = true
|
|||||||
bincode.workspace = true
|
bincode.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
reth-primitives = { workspace = true, features = ["arbitrary", "test-utils"] }
|
reth-primitives = { workspace = true, features = ["arbitrary", "test-utils"] }
|
||||||
|
reth-ethereum-primitives.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
@ -65,5 +66,6 @@ std = [
|
|||||||
"reth-primitives-traits/std",
|
"reth-primitives-traits/std",
|
||||||
"alloy-consensus/std",
|
"alloy-consensus/std",
|
||||||
"serde_with?/std",
|
"serde_with?/std",
|
||||||
"reth-trie-common?/std"
|
"reth-trie-common?/std",
|
||||||
|
"reth-ethereum-primitives/std"
|
||||||
]
|
]
|
||||||
|
|||||||
@ -694,9 +694,26 @@ pub(super) mod serde_bincode_compat {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use alloy_primitives::B256;
|
use alloy_consensus::TxType;
|
||||||
|
use alloy_primitives::{Address, B256};
|
||||||
|
use reth_ethereum_primitives::Receipt;
|
||||||
|
use reth_primitives::Receipts;
|
||||||
use revm::primitives::{AccountInfo, HashMap};
|
use revm::primitives::{AccountInfo, HashMap};
|
||||||
|
|
||||||
|
// TODO: this is temporary, until we fully switch over to `reth_ethereum_primitives` for the
|
||||||
|
// `Receipt` type in `EthPrimitives`.
|
||||||
|
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
struct TestPrimitives;
|
||||||
|
|
||||||
|
impl reth_primitives_traits::NodePrimitives for TestPrimitives {
|
||||||
|
type Block = reth_primitives::Block;
|
||||||
|
type BlockHeader = alloy_consensus::Header;
|
||||||
|
type BlockBody = reth_primitives::BlockBody;
|
||||||
|
type SignedTx = reth_primitives::TransactionSigned;
|
||||||
|
type Receipt = Receipt;
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn chain_append() {
|
fn chain_append() {
|
||||||
let block: SealedBlockWithSenders = Default::default();
|
let block: SealedBlockWithSenders = Default::default();
|
||||||
@ -828,10 +845,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn receipts_by_block_hash() {
|
fn receipts_by_block_hash() {
|
||||||
use reth_primitives::{Receipt, Receipts, TxType};
|
|
||||||
|
|
||||||
// Create a default SealedBlockWithSenders object
|
// Create a default SealedBlockWithSenders object
|
||||||
let block: SealedBlockWithSenders = Default::default();
|
let block: SealedBlockWithSenders = Default::default();
|
||||||
|
|
||||||
@ -878,7 +892,7 @@ mod tests {
|
|||||||
|
|
||||||
// Create a Chain object with a BTreeMap of blocks mapped to their block numbers,
|
// Create a Chain object with a BTreeMap of blocks mapped to their block numbers,
|
||||||
// including block1_hash and block2_hash, and the execution_outcome
|
// including block1_hash and block2_hash, and the execution_outcome
|
||||||
let chain: Chain = Chain {
|
let chain: Chain<TestPrimitives> = Chain {
|
||||||
blocks: BTreeMap::from([(10, block1), (11, block2)]),
|
blocks: BTreeMap::from([(10, block1), (11, block2)]),
|
||||||
execution_outcome: execution_outcome.clone(),
|
execution_outcome: execution_outcome.clone(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
@ -381,17 +381,11 @@ impl<T> From<(BlockExecutionOutput<T>, BlockNumber)> for ExecutionOutcome<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[cfg(not(feature = "optimism"))]
|
use alloy_consensus::TxType;
|
||||||
use alloy_primitives::bytes;
|
use alloy_primitives::{bytes, Address, LogData, B256};
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
use alloy_primitives::LogData;
|
|
||||||
use alloy_primitives::{Address, B256};
|
|
||||||
use reth_primitives::Receipts;
|
use reth_primitives::Receipts;
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
use reth_primitives::TxType;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_initialisation() {
|
fn test_initialisation() {
|
||||||
// Create a new BundleState object with initial data
|
// Create a new BundleState object with initial data
|
||||||
let bundle = BundleState::new(
|
let bundle = BundleState::new(
|
||||||
@ -402,7 +396,7 @@ mod tests {
|
|||||||
|
|
||||||
// Create a Receipts object with a vector of receipt vectors
|
// Create a Receipts object with a vector of receipt vectors
|
||||||
let receipts = Receipts {
|
let receipts = Receipts {
|
||||||
receipt_vec: vec![vec![Some(reth_primitives::Receipt {
|
receipt_vec: vec![vec![Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![],
|
logs: vec![],
|
||||||
@ -460,11 +454,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_block_number_to_index() {
|
fn test_block_number_to_index() {
|
||||||
// Create a Receipts object with a vector of receipt vectors
|
// Create a Receipts object with a vector of receipt vectors
|
||||||
let receipts = Receipts {
|
let receipts = Receipts {
|
||||||
receipt_vec: vec![vec![Some(reth_primitives::Receipt {
|
receipt_vec: vec![vec![Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![],
|
logs: vec![],
|
||||||
@ -495,11 +488,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_get_logs() {
|
fn test_get_logs() {
|
||||||
// Create a Receipts object with a vector of receipt vectors
|
// Create a Receipts object with a vector of receipt vectors
|
||||||
let receipts = Receipts {
|
let receipts = Receipts {
|
||||||
receipt_vec: vec![vec![Some(reth_primitives::Receipt {
|
receipt_vec: vec![vec![Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![Log::<LogData>::default()],
|
logs: vec![Log::<LogData>::default()],
|
||||||
@ -527,11 +519,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_receipts_by_block() {
|
fn test_receipts_by_block() {
|
||||||
// Create a Receipts object with a vector of receipt vectors
|
// Create a Receipts object with a vector of receipt vectors
|
||||||
let receipts = Receipts {
|
let receipts = Receipts {
|
||||||
receipt_vec: vec![vec![Some(reth_primitives::Receipt {
|
receipt_vec: vec![vec![Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![Log::<LogData>::default()],
|
logs: vec![Log::<LogData>::default()],
|
||||||
@ -557,7 +548,7 @@ mod tests {
|
|||||||
// Assert that the receipts for block number 123 match the expected receipts
|
// Assert that the receipts for block number 123 match the expected receipts
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
receipts_by_block,
|
receipts_by_block,
|
||||||
vec![&Some(reth_primitives::Receipt {
|
vec![&Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![Log::<LogData>::default()],
|
logs: vec![Log::<LogData>::default()],
|
||||||
@ -567,11 +558,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_receipts_len() {
|
fn test_receipts_len() {
|
||||||
// Create a Receipts object with a vector of receipt vectors
|
// Create a Receipts object with a vector of receipt vectors
|
||||||
let receipts = Receipts {
|
let receipts = Receipts {
|
||||||
receipt_vec: vec![vec![Some(reth_primitives::Receipt {
|
receipt_vec: vec![vec![Some(reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![Log::<LogData>::default()],
|
logs: vec![Log::<LogData>::default()],
|
||||||
@ -616,10 +606,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_revert_to() {
|
fn test_revert_to() {
|
||||||
// Create a random receipt object
|
// Create a random receipt object
|
||||||
let receipt = reth_primitives::Receipt {
|
let receipt = reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![],
|
logs: vec![],
|
||||||
@ -665,10 +654,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_extend_execution_outcome() {
|
fn test_extend_execution_outcome() {
|
||||||
// Create a Receipt object with specific attributes.
|
// Create a Receipt object with specific attributes.
|
||||||
let receipt = reth_primitives::Receipt {
|
let receipt = reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![],
|
logs: vec![],
|
||||||
@ -709,10 +697,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "optimism"))]
|
|
||||||
fn test_split_at_execution_outcome() {
|
fn test_split_at_execution_outcome() {
|
||||||
// Create a random receipt object
|
// Create a random receipt object
|
||||||
let receipt = reth_primitives::Receipt {
|
let receipt = reth_ethereum_primitives::Receipt {
|
||||||
tx_type: TxType::Legacy,
|
tx_type: TxType::Legacy,
|
||||||
cumulative_gas_used: 46913,
|
cumulative_gas_used: 46913,
|
||||||
logs: vec![],
|
logs: vec![],
|
||||||
|
|||||||
Reference in New Issue
Block a user