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,
};
pub use receipt::{Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts};
pub use serde_helper::JsonU256;
pub use snapshot::SnapshotSegment;
pub use storage::StorageEntry;

View File

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