mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
chore(tree): Move tree related files to root of the lib (#2359)
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
use crate::{
|
||||
database::SubState,
|
||||
env::{fill_cfg_and_block_env, fill_tx_env},
|
||||
eth_dao_fork::{DAO_HARDFORK_BENEFICIARY, DAO_HARDKFORK_ACCOUNTS},
|
||||
into_reth_log,
|
||||
stack::{InspectorStack, InspectorStackConfig},
|
||||
to_reth_acc,
|
||||
};
|
||||
use reth_blockchain_tree::post_state::PostState;
|
||||
use reth_consensus_common::calc;
|
||||
use reth_interfaces::executor::Error;
|
||||
use reth_primitives::{
|
||||
Account, Address, Block, BlockNumber, Bloom, Bytecode, ChainSpec, Hardfork, Header, Receipt,
|
||||
ReceiptWithBloom, TransactionSigned, Withdrawal, H256, U256,
|
||||
};
|
||||
use reth_provider::{BlockExecutor, StateProvider};
|
||||
use reth_provider::{BlockExecutor, PostState, StateProvider};
|
||||
use revm::{
|
||||
db::{AccountState, CacheDB, DatabaseRef},
|
||||
primitives::{
|
||||
@@ -140,7 +140,7 @@ where
|
||||
let mut drained_balance = U256::ZERO;
|
||||
|
||||
// drain all accounts ether
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS {
|
||||
for address in DAO_HARDKFORK_ACCOUNTS {
|
||||
let db_account = db.load_account(address).map_err(|_| Error::ProviderError)?;
|
||||
let old = to_reth_acc(&db_account.info);
|
||||
// drain balance
|
||||
@@ -151,7 +151,7 @@ where
|
||||
}
|
||||
|
||||
// add drained ether to beneficiary.
|
||||
let beneficiary = reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY;
|
||||
let beneficiary = DAO_HARDFORK_BENEFICIARY;
|
||||
self.increment_account_balance(block_number, beneficiary, drained_balance, post_state)?;
|
||||
|
||||
Ok(())
|
||||
@@ -860,9 +860,7 @@ mod tests {
|
||||
let mut db = StateProviderTest::default();
|
||||
|
||||
let mut beneficiary_balance = 0;
|
||||
for (i, dao_address) in
|
||||
reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter().enumerate()
|
||||
{
|
||||
for (i, dao_address) in DAO_HARDKFORK_ACCOUNTS.iter().enumerate() {
|
||||
db.insert_account(
|
||||
*dao_address,
|
||||
Account { balance: U256::from(i), nonce: 0x00, bytecode_hash: None },
|
||||
@@ -893,26 +891,21 @@ mod tests {
|
||||
// Check if cache is set
|
||||
// beneficiary
|
||||
let db = executor.db();
|
||||
let dao_beneficiary =
|
||||
db.accounts.get(&reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY).unwrap();
|
||||
let dao_beneficiary = db.accounts.get(&DAO_HARDFORK_BENEFICIARY).unwrap();
|
||||
|
||||
assert_eq!(dao_beneficiary.info.balance, U256::from(beneficiary_balance));
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
for address in DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
let account = db.accounts.get(address).unwrap();
|
||||
assert_eq!(account.info.balance, U256::ZERO);
|
||||
}
|
||||
|
||||
// check changesets
|
||||
let beneficiary_state = out
|
||||
.accounts()
|
||||
.get(&reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let beneficiary_state = out.accounts().get(&DAO_HARDFORK_BENEFICIARY).unwrap().unwrap();
|
||||
assert_eq!(
|
||||
beneficiary_state,
|
||||
Account { balance: U256::from(beneficiary_balance), ..Default::default() },
|
||||
);
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
for address in DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
let updated_account = out.accounts().get(address).unwrap().unwrap();
|
||||
assert_eq!(updated_account, Account { balance: U256::ZERO, ..Default::default() });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user