chore: rm unused reexport (#6377)

This commit is contained in:
Matthias Seitz
2024-02-03 17:07:51 +01:00
committed by GitHub
parent fddabe88a8
commit 44a9975f76
2 changed files with 43 additions and 44 deletions

View File

@ -73,7 +73,6 @@ pub use prune::{
ReceiptsLogPruneConfig, MINIMUM_PRUNING_DISTANCE, ReceiptsLogPruneConfig, MINIMUM_PRUNING_DISTANCE,
}; };
pub use receipt::{Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts}; pub use receipt::{Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts};
pub use serde_helper::JsonU256;
pub use snapshot::SnapshotSegment; pub use snapshot::SnapshotSegment;
pub use storage::StorageEntry; pub use storage::StorageEntry;

View File

@ -8,8 +8,8 @@ use reth_db::{
}; };
use reth_primitives::{ use reth_primitives::{
keccak256, Account as RethAccount, Address, Bloom, Bytecode, Bytes, ChainSpec, keccak256, Account as RethAccount, Address, Bloom, Bytecode, Bytes, ChainSpec,
ChainSpecBuilder, Header as RethHeader, JsonU256, SealedHeader, StorageEntry, Withdrawals, ChainSpecBuilder, Header as RethHeader, SealedHeader, StorageEntry, Withdrawals, B256, B64,
B256, B64, U256, U256,
}; };
use serde::{self, Deserialize}; use serde::{self, Deserialize};
use std::{collections::BTreeMap, ops::Deref}; use std::{collections::BTreeMap, ops::Deref};
@ -49,13 +49,13 @@ pub struct Header {
/// Coinbase. /// Coinbase.
pub coinbase: Address, pub coinbase: Address,
/// Difficulty. /// Difficulty.
pub difficulty: JsonU256, pub difficulty: U256,
/// Extra data. /// Extra data.
pub extra_data: Bytes, pub extra_data: Bytes,
/// Gas limit. /// Gas limit.
pub gas_limit: JsonU256, pub gas_limit: U256,
/// Gas used. /// Gas used.
pub gas_used: JsonU256, pub gas_used: U256,
/// Block Hash. /// Block Hash.
pub hash: B256, pub hash: B256,
/// Mix hash. /// Mix hash.
@ -63,7 +63,7 @@ pub struct Header {
/// Seal nonce. /// Seal nonce.
pub nonce: B64, pub nonce: B64,
/// Block number. /// Block number.
pub number: JsonU256, pub number: U256,
/// Parent hash. /// Parent hash.
pub parent_hash: B256, pub parent_hash: B256,
/// Receipt trie. /// Receipt trie.
@ -71,19 +71,19 @@ pub struct Header {
/// State root. /// State root.
pub state_root: B256, pub state_root: B256,
/// Timestamp. /// Timestamp.
pub timestamp: JsonU256, pub timestamp: U256,
/// Transactions trie. /// Transactions trie.
pub transactions_trie: B256, pub transactions_trie: B256,
/// Uncle hash. /// Uncle hash.
pub uncle_hash: B256, pub uncle_hash: B256,
/// Base fee per gas. /// Base fee per gas.
pub base_fee_per_gas: Option<JsonU256>, pub base_fee_per_gas: Option<U256>,
/// Withdrawals root. /// Withdrawals root.
pub withdrawals_root: Option<B256>, pub withdrawals_root: Option<B256>,
/// Blob gas used. /// Blob gas used.
pub blob_gas_used: Option<JsonU256>, pub blob_gas_used: Option<U256>,
/// Excess blob gas. /// Excess blob gas.
pub excess_blob_gas: Option<JsonU256>, pub excess_blob_gas: Option<U256>,
/// Parent beacon block root. /// Parent beacon block root.
pub parent_beacon_block_root: Option<B256>, pub parent_beacon_block_root: Option<B256>,
} }
@ -91,16 +91,16 @@ pub struct Header {
impl From<Header> for SealedHeader { impl From<Header> for SealedHeader {
fn from(value: Header) -> Self { fn from(value: Header) -> Self {
let header = RethHeader { let header = RethHeader {
base_fee_per_gas: value.base_fee_per_gas.map(|v| v.0.to::<u64>()), base_fee_per_gas: value.base_fee_per_gas.map(|v| v.to::<u64>()),
beneficiary: value.coinbase, beneficiary: value.coinbase,
difficulty: value.difficulty.0, difficulty: value.difficulty,
extra_data: value.extra_data, extra_data: value.extra_data,
gas_limit: value.gas_limit.0.to::<u64>(), gas_limit: value.gas_limit.to::<u64>(),
gas_used: value.gas_used.0.to::<u64>(), gas_used: value.gas_used.to::<u64>(),
mix_hash: value.mix_hash, mix_hash: value.mix_hash,
nonce: u64::from_be_bytes(value.nonce.0), nonce: u64::from_be_bytes(value.nonce.0),
number: value.number.0.to::<u64>(), number: value.number.to::<u64>(),
timestamp: value.timestamp.0.to::<u64>(), timestamp: value.timestamp.to::<u64>(),
transactions_root: value.transactions_trie, transactions_root: value.transactions_trie,
receipts_root: value.receipt_trie, receipts_root: value.receipt_trie,
ommers_hash: value.uncle_hash, ommers_hash: value.uncle_hash,
@ -108,8 +108,8 @@ impl From<Header> for SealedHeader {
parent_hash: value.parent_hash, parent_hash: value.parent_hash,
logs_bloom: value.bloom, logs_bloom: value.bloom,
withdrawals_root: value.withdrawals_root, withdrawals_root: value.withdrawals_root,
blob_gas_used: value.blob_gas_used.map(|v| v.0.to::<u64>()), blob_gas_used: value.blob_gas_used.map(|v| v.to::<u64>()),
excess_blob_gas: value.excess_blob_gas.map(|v| v.0.to::<u64>()), excess_blob_gas: value.excess_blob_gas.map(|v| v.to::<u64>()),
parent_beacon_block_root: value.parent_beacon_block_root, parent_beacon_block_root: value.parent_beacon_block_root,
}; };
header.seal(value.hash) header.seal(value.hash)
@ -156,8 +156,8 @@ impl State {
let has_code = !account.code.is_empty(); let has_code = !account.code.is_empty();
let code_hash = has_code.then(|| keccak256(&account.code)); let code_hash = has_code.then(|| keccak256(&account.code));
let reth_account = RethAccount { let reth_account = RethAccount {
balance: account.balance.0, balance: account.balance,
nonce: account.nonce.0.to::<u64>(), nonce: account.nonce.to::<u64>(),
bytecode_hash: code_hash, bytecode_hash: code_hash,
}; };
tx.put::<tables::PlainAccountState>(address, reth_account)?; tx.put::<tables::PlainAccountState>(address, reth_account)?;
@ -165,15 +165,15 @@ impl State {
if let Some(code_hash) = code_hash { if let Some(code_hash) = code_hash {
tx.put::<tables::Bytecodes>(code_hash, Bytecode::new_raw(account.code.clone()))?; tx.put::<tables::Bytecodes>(code_hash, Bytecode::new_raw(account.code.clone()))?;
} }
account.storage.iter().filter(|(_, v)| v.0 != U256::ZERO).try_for_each(|(k, v)| { account.storage.iter().filter(|(_, v)| !v.is_zero()).try_for_each(|(k, v)| {
let storage_key = B256::from_slice(&k.0.to_be_bytes::<32>()); let storage_key = B256::from_slice(&k.to_be_bytes::<32>());
tx.put::<tables::PlainStorageState>( tx.put::<tables::PlainStorageState>(
address, address,
StorageEntry { key: storage_key, value: v.0 }, StorageEntry { key: storage_key, value: *v },
)?; )?;
tx.put::<tables::HashedStorage>( tx.put::<tables::HashedStorage>(
hashed_address, hashed_address,
StorageEntry { key: keccak256(storage_key), value: v.0 }, StorageEntry { key: keccak256(storage_key), value: *v },
) )
})?; })?;
} }
@ -195,13 +195,13 @@ impl Deref for State {
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct Account { pub struct Account {
/// Balance. /// Balance.
pub balance: JsonU256, pub balance: U256,
/// Code. /// Code.
pub code: Bytes, pub code: Bytes,
/// Nonce. /// Nonce.
pub nonce: JsonU256, pub nonce: U256,
/// Storage. /// Storage.
pub storage: BTreeMap<JsonU256, JsonU256>, pub storage: BTreeMap<U256, U256>,
} }
impl Account { impl Account {
@ -213,8 +213,8 @@ impl Account {
Error::Assertion(format!("Expected account ({address}) is missing from DB: {self:?}")) Error::Assertion(format!("Expected account ({address}) is missing from DB: {self:?}"))
})?; })?;
assert_equal(self.balance.into(), account.balance, "Balance does not match")?; assert_equal(self.balance, account.balance, "Balance does not match")?;
assert_equal(self.nonce.0.to(), account.nonce, "Nonce does not match")?; assert_equal(self.nonce.to(), account.nonce, "Nonce does not match")?;
if let Some(bytecode_hash) = account.bytecode_hash { if let Some(bytecode_hash) = account.bytecode_hash {
assert_equal(keccak256(&self.code), bytecode_hash, "Bytecode does not match")?; assert_equal(keccak256(&self.code), bytecode_hash, "Bytecode does not match")?;
@ -229,11 +229,11 @@ impl Account {
let mut storage_cursor = tx.cursor_dup_read::<tables::PlainStorageState>()?; let mut storage_cursor = tx.cursor_dup_read::<tables::PlainStorageState>()?;
for (slot, value) in self.storage.iter() { for (slot, value) in self.storage.iter() {
if let Some(entry) = if let Some(entry) =
storage_cursor.seek_by_key_subkey(address, B256::new(slot.0.to_be_bytes()))? storage_cursor.seek_by_key_subkey(address, B256::new(slot.to_be_bytes()))?
{ {
if U256::from_be_bytes(entry.key.0) == slot.0 { if U256::from_be_bytes(entry.key.0) == *slot {
assert_equal( assert_equal(
value.0, *value,
entry.value, entry.value,
&format!("Storage for slot {:?} does not match", slot), &format!("Storage for slot {:?} does not match", slot),
)?; )?;
@ -360,31 +360,31 @@ pub enum SealEngine {
pub struct Transaction { pub struct Transaction {
/// Transaction type /// Transaction type
#[serde(rename = "type")] #[serde(rename = "type")]
pub transaction_type: Option<JsonU256>, pub transaction_type: Option<U256>,
/// Data. /// Data.
pub data: Bytes, pub data: Bytes,
/// Gas limit. /// Gas limit.
pub gas_limit: JsonU256, pub gas_limit: U256,
/// Gas price. /// Gas price.
pub gas_price: Option<JsonU256>, pub gas_price: Option<U256>,
/// Nonce. /// Nonce.
pub nonce: JsonU256, pub nonce: U256,
/// Signature r part. /// Signature r part.
pub r: JsonU256, pub r: U256,
/// Signature s part. /// Signature s part.
pub s: JsonU256, pub s: U256,
/// Parity bit. /// Parity bit.
pub v: JsonU256, pub v: U256,
/// Transaction value. /// Transaction value.
pub value: JsonU256, pub value: U256,
/// Chain ID. /// Chain ID.
pub chain_id: Option<JsonU256>, pub chain_id: Option<U256>,
/// Access list. /// Access list.
pub access_list: Option<AccessList>, pub access_list: Option<AccessList>,
/// Max fee per gas. /// Max fee per gas.
pub max_fee_per_gas: Option<JsonU256>, pub max_fee_per_gas: Option<U256>,
/// Max priority fee per gas /// Max priority fee per gas
pub max_priority_fee_per_gas: Option<JsonU256>, pub max_priority_fee_per_gas: Option<U256>,
/// Transaction hash. /// Transaction hash.
pub hash: Option<B256>, pub hash: Option<B256>,
} }