refactor: store plain receipts instead Options in Receipts (#14010)

This commit is contained in:
Arsenii Kulikov
2025-01-27 20:05:48 +04:00
committed by GitHub
parent 0fa79c6c65
commit cde951732e
22 changed files with 88 additions and 128 deletions

View File

@ -15,11 +15,9 @@ workspace = true
# reth
reth-primitives.workspace = true
reth-storage-errors.workspace = true
reth-execution-errors.workspace = true
reth-prune-types.workspace = true
reth-storage-api.workspace = true
reth-trie = { workspace = true, optional = true }
reth-primitives-traits.workspace = true
# alloy
alloy-eips.workspace = true
@ -42,7 +40,6 @@ std = [
"revm/std",
"alloy-eips/std",
"alloy-consensus/std",
"reth-primitives-traits/std",
"reth-ethereum-forks/std"
]
witness = ["dep:reth-trie"]
@ -52,14 +49,12 @@ test-utils = [
"reth-trie?/test-utils",
"revm/test-utils",
"reth-prune-types/test-utils",
"reth-primitives-traits/test-utils",
]
serde = [
"revm/serde",
"alloy-eips/serde",
"alloy-primitives/serde",
"alloy-consensus/serde",
"reth-primitives-traits/serde",
"reth-trie?/serde",
"reth-ethereum-forks/serde"
]

View File

@ -3,10 +3,8 @@
use alloc::vec::Vec;
use alloy_eips::eip7685::Requests;
use alloy_primitives::{BlockNumber, Log};
use reth_execution_errors::BlockExecutionError;
use alloy_primitives::BlockNumber;
use reth_primitives::Receipts;
use reth_primitives_traits::Receipt;
use reth_prune_types::PruneModes;
use revm::db::states::bundle_state::BundleRetention;
@ -120,14 +118,8 @@ impl<T> BlockBatchRecord<T> {
}
/// Save receipts to the executor.
pub fn save_receipts(&mut self, receipts: Vec<T>) -> Result<(), BlockExecutionError>
where
T: Receipt<Log = Log>,
{
let receipts = receipts.into_iter().map(Some).collect();
// Save receipts.
pub fn save_receipts(&mut self, receipts: Vec<T>) {
self.receipts.push(receipts);
Ok(())
}
/// Save EIP-7685 requests to the executor.
@ -146,8 +138,7 @@ mod tests {
// Create an empty vector of receipts
let receipts = vec![];
// Verify that saving receipts completes without error
assert!(recorder.save_receipts(receipts).is_ok());
recorder.save_receipts(receipts);
// Verify that the saved receipts are equal to a nested empty vector
assert_eq!(*recorder.receipts(), vec![vec![]].into());
}