mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rename executor -> blockchain-tree (#2285)
This commit is contained in:
56
Cargo.lock
generated
56
Cargo.lock
generated
@ -4468,10 +4468,10 @@ dependencies = [
|
||||
"reth-auto-seal-consensus",
|
||||
"reth-basic-payload-builder",
|
||||
"reth-beacon-consensus",
|
||||
"reth-blockchain-tree",
|
||||
"reth-db",
|
||||
"reth-discv4",
|
||||
"reth-downloaders",
|
||||
"reth-executor",
|
||||
"reth-interfaces",
|
||||
"reth-net-nat",
|
||||
"reth-network",
|
||||
@ -4544,9 +4544,9 @@ dependencies = [
|
||||
"assert_matches",
|
||||
"futures",
|
||||
"metrics",
|
||||
"reth-blockchain-tree",
|
||||
"reth-consensus-common",
|
||||
"reth-db",
|
||||
"reth-executor",
|
||||
"reth-interfaces",
|
||||
"reth-metrics-derive",
|
||||
"reth-payload-builder",
|
||||
@ -4562,6 +4562,20 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-blockchain-tree"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aquamarine",
|
||||
"assert_matches",
|
||||
"parking_lot 0.12.1",
|
||||
"reth-db",
|
||||
"reth-interfaces",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-codecs"
|
||||
version = "0.1.0"
|
||||
@ -4762,29 +4776,6 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-executor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aquamarine",
|
||||
"assert_matches",
|
||||
"auto_impl",
|
||||
"hash-db",
|
||||
"parking_lot 0.12.1",
|
||||
"plain_hasher",
|
||||
"reth-db",
|
||||
"reth-interfaces",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-rlp",
|
||||
"rlp",
|
||||
"sha3",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"triehash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reth-interfaces"
|
||||
version = "0.1.0"
|
||||
@ -5053,8 +5044,8 @@ dependencies = [
|
||||
name = "reth-revm"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"reth-blockchain-tree",
|
||||
"reth-consensus-common",
|
||||
"reth-executor",
|
||||
"reth-interfaces",
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
@ -5282,11 +5273,11 @@ dependencies = [
|
||||
"pprof",
|
||||
"rand 0.8.5",
|
||||
"rayon",
|
||||
"reth-blockchain-tree",
|
||||
"reth-codecs",
|
||||
"reth-db",
|
||||
"reth-downloaders",
|
||||
"reth-eth-wire",
|
||||
"reth-executor",
|
||||
"reth-interfaces",
|
||||
"reth-metrics-derive",
|
||||
"reth-primitives",
|
||||
@ -6548,14 +6539,13 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.26.0"
|
||||
version = "1.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||
checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"parking_lot 0.12.1",
|
||||
@ -6568,13 +6558,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.8.2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.56",
|
||||
"quote 1.0.26",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -4,7 +4,7 @@ members = [
|
||||
"crates/consensus/auto-seal",
|
||||
"crates/consensus/beacon",
|
||||
"crates/consensus/common",
|
||||
"crates/executor",
|
||||
"crates/blockchain-tree",
|
||||
"crates/interfaces",
|
||||
"crates/payload/builder",
|
||||
"crates/metrics/metrics-derive",
|
||||
|
||||
@ -20,7 +20,7 @@ reth-interfaces = { path = "../../crates/interfaces", features = ["test-utils"]
|
||||
reth-transaction-pool = { path = "../../crates/transaction-pool" }
|
||||
reth-beacon-consensus = { path = "../../crates/consensus/beacon" }
|
||||
reth-auto-seal-consensus = { path = "../../crates/consensus/auto-seal" }
|
||||
reth-executor = { path = "../../crates/executor" }
|
||||
reth-blockchain-tree = { path = "../../crates/blockchain-tree" }
|
||||
reth-rpc-engine-api = { path = "../../crates/rpc/rpc-engine-api" }
|
||||
reth-rpc-builder = { path = "../../crates/rpc/rpc-builder" }
|
||||
reth-rpc = { path = "../../crates/rpc/rpc" }
|
||||
|
||||
@ -15,6 +15,9 @@ use futures::{pin_mut, stream::select as stream_select, StreamExt};
|
||||
use reth_auto_seal_consensus::{AutoSealBuilder, AutoSealConsensus};
|
||||
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
|
||||
use reth_beacon_consensus::{BeaconConsensus, BeaconConsensusEngine, BeaconEngineMessage};
|
||||
use reth_blockchain_tree::{
|
||||
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
|
||||
};
|
||||
use reth_db::{
|
||||
database::Database,
|
||||
mdbx::{Env, WriteMap},
|
||||
@ -26,9 +29,6 @@ use reth_downloaders::{
|
||||
bodies::bodies::BodiesDownloaderBuilder,
|
||||
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
|
||||
};
|
||||
use reth_executor::blockchain_tree::{
|
||||
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
|
||||
};
|
||||
use reth_interfaces::{
|
||||
consensus::{Consensus, ForkchoiceState},
|
||||
p2p::{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "reth-executor"
|
||||
name = "reth-blockchain-tree"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
@ -16,29 +16,15 @@ normal = [
|
||||
# reth
|
||||
reth-primitives = { path = "../primitives" }
|
||||
reth-interfaces = { path = "../interfaces" }
|
||||
reth-rlp = { path = "../rlp" }
|
||||
reth-db = { path = "../storage/db" }
|
||||
reth-provider = { path = "../storage/provider" }
|
||||
|
||||
# common
|
||||
thiserror = "1.0.37"
|
||||
auto_impl = "1.0"
|
||||
tracing = "0.1.37"
|
||||
tokio = { version = "1.21.2", features = ["sync"] }
|
||||
parking_lot = { version = "0.12"}
|
||||
|
||||
# mics
|
||||
aquamarine = "0.3.0"
|
||||
|
||||
triehash = "0.8"
|
||||
# See to replace hashers to simplify libraries
|
||||
plain_hasher = "0.2"
|
||||
hash-db = "0.15"
|
||||
# todo replace with faster rlp impl
|
||||
rlp = { version = "0.5", default-features = false }
|
||||
# replace with tiny-keccak (it is faster hasher)
|
||||
sha3 = { version = "0.10", default-features = false }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
reth-db = { path = "../storage/db", features = ["test-utils"] }
|
||||
@ -47,6 +33,7 @@ reth-primitives = { path = "../primitives", features = ["test-utils"] }
|
||||
reth-provider = { path = "../storage/provider", features = ["test-utils"] }
|
||||
parking_lot = "0.12"
|
||||
assert_matches = "1.5"
|
||||
tokio = { version = "1", features = ["macros", "sync"] }
|
||||
|
||||
[features]
|
||||
test-utils = []
|
||||
@ -13,6 +13,7 @@ pub mod eth_dao_fork;
|
||||
pub use reth_provider::post_state;
|
||||
|
||||
pub mod blockchain_tree;
|
||||
pub use blockchain_tree::*;
|
||||
|
||||
#[cfg(any(test, feature = "test-utils"))]
|
||||
/// Common test helpers for mocking out executor and executor factory
|
||||
@ -33,7 +33,7 @@ metrics = "0.20.1"
|
||||
reth-payload-builder = { path = "../../payload/builder", features = ["test-utils"] }
|
||||
reth-interfaces = { path = "../../interfaces", features = ["test-utils"] }
|
||||
reth-stages = { path = "../../stages", features = ["test-utils"] }
|
||||
reth-executor = { path = "../../executor", features = ["test-utils"] }
|
||||
reth-blockchain-tree = { path = "../../blockchain-tree", features = ["test-utils"] }
|
||||
reth-db = { path = "../../storage/db", features = ["test-utils"] }
|
||||
reth-provider = { path = "../../storage/provider", features = ["test-utils"] }
|
||||
reth-tracing = { path = "../../tracing" }
|
||||
|
||||
@ -641,8 +641,7 @@ enum PipelineTarget {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use assert_matches::assert_matches;
|
||||
use reth_db::mdbx::{test_utils::create_test_rw_db, Env, WriteMap};
|
||||
use reth_executor::{
|
||||
use reth_blockchain_tree::{
|
||||
blockchain_tree::{
|
||||
config::BlockchainTreeConfig, externals::TreeExternals, BlockchainTree,
|
||||
ShareableBlockchainTree,
|
||||
@ -650,6 +649,7 @@ mod tests {
|
||||
post_state::PostState,
|
||||
test_utils::TestExecutorFactory,
|
||||
};
|
||||
use reth_db::mdbx::{test_utils::create_test_rw_db, Env, WriteMap};
|
||||
use reth_interfaces::{sync::NoopSyncStateUpdate, test_utils::TestConsensus};
|
||||
use reth_payload_builder::test_utils::spawn_test_payload_service;
|
||||
use reth_primitives::{ChainSpec, ChainSpecBuilder, SealedBlockWithSenders, H256, MAINNET};
|
||||
|
||||
@ -13,7 +13,7 @@ reth-interfaces = { path = "../interfaces" }
|
||||
reth-provider = { path = "../storage/provider" }
|
||||
reth-revm-primitives = { path = "./revm-primitives" }
|
||||
reth-revm-inspectors = { path = "./revm-inspectors" }
|
||||
reth-executor = { path = "../executor" }
|
||||
reth-blockchain-tree = { path = "../blockchain-tree" }
|
||||
reth-consensus-common = { path = "../consensus/common" }
|
||||
|
||||
# revm
|
||||
|
||||
@ -5,8 +5,8 @@ use crate::{
|
||||
stack::{InspectorStack, InspectorStackConfig},
|
||||
to_reth_acc,
|
||||
};
|
||||
use reth_blockchain_tree::post_state::PostState;
|
||||
use reth_consensus_common::calc;
|
||||
use reth_executor::post_state::PostState;
|
||||
use reth_interfaces::executor::Error;
|
||||
use reth_primitives::{
|
||||
Account, Address, Block, Bloom, Bytecode, ChainSpec, Hardfork, Header, Receipt,
|
||||
@ -135,7 +135,7 @@ where
|
||||
let mut drained_balance = U256::ZERO;
|
||||
|
||||
// drain all accounts ether
|
||||
for address in reth_executor::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS {
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS {
|
||||
let db_account = db.load_account(address).map_err(|_| Error::ProviderError)?;
|
||||
let old = to_reth_acc(&db_account.info);
|
||||
// drain balance
|
||||
@ -146,7 +146,7 @@ where
|
||||
}
|
||||
|
||||
// add drained ether to beneficiary.
|
||||
let beneficiary = reth_executor::eth_dao_fork::DAO_HARDFORK_BENEFICIARY;
|
||||
let beneficiary = reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY;
|
||||
self.increment_account_balance(beneficiary, drained_balance, post_state)?;
|
||||
|
||||
Ok(())
|
||||
@ -875,7 +875,7 @@ mod tests {
|
||||
|
||||
let mut beneficiary_balance = 0;
|
||||
for (i, dao_address) in
|
||||
reth_executor::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter().enumerate()
|
||||
reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter().enumerate()
|
||||
{
|
||||
db.insert_account(
|
||||
*dao_address,
|
||||
@ -913,10 +913,10 @@ mod tests {
|
||||
// beneficiary
|
||||
let db = executor.db();
|
||||
let dao_beneficiary =
|
||||
db.accounts.get(&reth_executor::eth_dao_fork::DAO_HARDFORK_BENEFICIARY).unwrap();
|
||||
db.accounts.get(&reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY).unwrap();
|
||||
|
||||
assert_eq!(dao_beneficiary.info.balance, U256::from(beneficiary_balance));
|
||||
for address in reth_executor::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
let account = db.accounts.get(address).unwrap();
|
||||
assert_eq!(account.info.balance, U256::ZERO);
|
||||
}
|
||||
@ -924,14 +924,14 @@ mod tests {
|
||||
// check changesets
|
||||
let beneficiary_state = out
|
||||
.accounts()
|
||||
.get(&reth_executor::eth_dao_fork::DAO_HARDFORK_BENEFICIARY)
|
||||
.get(&reth_blockchain_tree::eth_dao_fork::DAO_HARDFORK_BENEFICIARY)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
beneficiary_state,
|
||||
Account { balance: U256::from(beneficiary_balance), ..Default::default() },
|
||||
);
|
||||
for address in reth_executor::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
for address in reth_blockchain_tree::eth_dao_fork::DAO_HARDKFORK_ACCOUNTS.iter() {
|
||||
let updated_account = out.accounts().get(address).unwrap().unwrap();
|
||||
assert_eq!(updated_account, Account { balance: U256::ZERO, ..Default::default() });
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ reth-db = { path = "../storage/db", features = ["test-utils", "mdbx"] }
|
||||
reth-interfaces = { path = "../interfaces", features = ["test-utils"] }
|
||||
reth-downloaders = { path = "../net/downloaders" }
|
||||
reth-eth-wire = { path = "../net/eth-wire" } # TODO(onbjerg): We only need this for [BlockBody]
|
||||
reth-executor = { path = "../executor" }
|
||||
reth-blockchain-tree = { path = "../blockchain-tree" }
|
||||
reth-rlp = { path = "../rlp" }
|
||||
reth-revm = { path = "../revm" }
|
||||
reth-trie = { path = "../trie", features = ["test-utils"] }
|
||||
|
||||
@ -155,7 +155,7 @@ Once the transaction signer has been recovered, the signer is then added to the
|
||||
|
||||
## ExecutionStage
|
||||
|
||||
Finally, after all headers, bodies and senders are added to the database, the `ExecutionStage` starts to execute. This stage is responsible for executing all of the transactions and updating the state stored in the database. For every new block header added to the database, the corresponding transactions have their signers attached to them and `reth_executor::executor::execute_and_verify_receipt()` is called, pushing the state changes resulting from the execution to a `Vec`.
|
||||
Finally, after all headers, bodies and senders are added to the database, the `ExecutionStage` starts to execute. This stage is responsible for executing all of the transactions and updating the state stored in the database. For every new block header added to the database, the corresponding transactions have their signers attached to them and `reth_blockchain_tree::executor::execute_and_verify_receipt()` is called, pushing the state changes resulting from the execution to a `Vec`.
|
||||
|
||||
[File: crates/stages/src/stages/execution.rs](https://github.com/paradigmxyz/reth/blob/main/crates/stages/src/stages/execution.rs)
|
||||
```rust,ignore
|
||||
|
||||
@ -60,7 +60,7 @@ These crates are related to networking (p2p and RPC), as well as networking prot
|
||||
|
||||
These crates are Ethereum-specific (e.g. EVM, consensus, transaction pools).
|
||||
|
||||
- [`executor`](../../crates/executor): Blazing-fast instrumented EVM using [`revm`](https://github.com/bluealloy/revm/). Used during consensus, syncing & during transaction simulation / gas estimation.
|
||||
- [`executor`](../../crates/blockchain-tree): Blazing-fast instrumented EVM using [`revm`](https://github.com/bluealloy/revm/). Used during consensus, syncing & during transaction simulation / gas estimation.
|
||||
- [`consensus`](../../crates/consensus): Implementations of consensus protocols.
|
||||
- [`transaction-pool`](../../crates/transaction-pool): An in-memory pending transactions pool.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user