feat: use reth-ethereum-primitives (#13830)

This commit is contained in:
Arsenii Kulikov
2025-01-17 04:22:21 +04:00
committed by GitHub
parent 7e972ea23d
commit 8efe441cc0
67 changed files with 941 additions and 3025 deletions

View File

@ -107,7 +107,7 @@ impl crate::Compact for OpTxType {
match extended_identifier {
EIP7702_TX_TYPE_ID => Self::Eip7702,
op_alloy_consensus::DEPOSIT_TX_TYPE_ID => Self::Deposit,
_ => panic!("Unsupported TxType identifier: {extended_identifier}"),
_ => panic!("Unsupported OpTxType identifier: {extended_identifier}"),
}
}
_ => panic!("Unknown identifier for TxType: {identifier}"),

View File

@ -87,7 +87,6 @@ arbitrary = [
"reth-optimism-primitives?/arbitrary"
]
optimism = [
"reth-primitives/optimism",
"reth-codecs/op",
"reth-optimism-primitives?/optimism",
"op",

View File

@ -112,7 +112,7 @@ arbitrary = [
"reth-stages-types/arbitrary",
"alloy-consensus/arbitrary",
]
optimism = ["reth-primitives/optimism", "reth-db-api/optimism"]
optimism = ["reth-db-api/optimism"]
op = ["reth-db-api/op"]
disable-lock = []

View File

@ -88,7 +88,6 @@ alloy-consensus.workspace = true
[features]
optimism = [
"reth-primitives/optimism",
"reth-execution-types/optimism",
"reth-optimism-primitives",
"reth-codecs/op",

View File

@ -2402,7 +2402,7 @@ mod tests {
let mut in_memory_blocks: std::collections::VecDeque<_> = in_memory_blocks.into();
$(
let tx_hash = |block: &SealedBlock| block.body().transactions[0].hash();
let tx_hash = |block: &SealedBlock| *block.body().transactions[0].tx_hash();
let tx_num = |block: &SealedBlock| {
database_blocks
.iter()
@ -2726,7 +2726,7 @@ mod tests {
// above, we do not see it.
assert!(matches!(
old_transaction_hash_fn(
to_be_persisted_tx.hash(),
*to_be_persisted_tx.tx_hash(),
provider.canonical_in_memory_state(),
provider.database.clone()
),
@ -2743,7 +2743,7 @@ mod tests {
assert!(matches!(
correct_transaction_hash_fn(
to_be_persisted_tx.hash(),
*to_be_persisted_tx.tx_hash(),
provider.canonical_in_memory_state(),
provider.database
),

View File

@ -708,7 +708,7 @@ mod tests {
if sender == block.body().transactions[0].recover_signer().unwrap()
);
assert_matches!(
provider.transaction_id(block.body().transactions[0].hash()),
provider.transaction_id(*block.body().transactions[0].tx_hash()),
Ok(Some(0))
);
}
@ -726,7 +726,10 @@ mod tests {
Ok(_)
);
assert_matches!(provider.transaction_sender(0), Ok(None));
assert_matches!(provider.transaction_id(block.body().transactions[0].hash()), Ok(None));
assert_matches!(
provider.transaction_id(*block.body().transactions[0].tx_hash()),
Ok(None)
);
}
}

View File

@ -253,7 +253,7 @@ impl TransactionsProvider for MockEthProvider {
let tx_number = lock
.values()
.flat_map(|block| &block.body.transactions)
.position(|tx| tx.hash() == tx_hash)
.position(|tx| *tx.tx_hash() == tx_hash)
.map(|pos| pos as TxNumber);
Ok(tx_number)
@ -280,7 +280,7 @@ impl TransactionsProvider for MockEthProvider {
fn transaction_by_hash(&self, hash: TxHash) -> ProviderResult<Option<TransactionSigned>> {
Ok(self.blocks.lock().iter().find_map(|(_, block)| {
block.body.transactions.iter().find(|tx| tx.hash() == hash).cloned()
block.body.transactions.iter().find(|tx| *tx.tx_hash() == hash).cloned()
}))
}
@ -291,7 +291,7 @@ impl TransactionsProvider for MockEthProvider {
let lock = self.blocks.lock();
for (block_hash, block) in lock.iter() {
for (index, tx) in block.body.transactions.iter().enumerate() {
if tx.hash() == hash {
if *tx.tx_hash() == hash {
let meta = TransactionMeta {
tx_hash: hash,
index: index as u64,