Skip to content

Commit

Permalink
chore: rename executor -> blockchain-tree (paradigmxyz#2285)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Apr 17, 2023
1 parent 2939342 commit db1e6cb
Show file tree
Hide file tree
Showing 24 changed files with 46 additions and 68 deletions.
56 changes: 23 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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::{
Expand Down
17 changes: 2 additions & 15 deletions crates/executor/Cargo.toml → crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "reth-executor"
name = "reth-blockchain-tree"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -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"] }
Expand All @@ -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 = []
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,15 @@ 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,
},
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};
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions crates/revm/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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(())
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -913,25 +913,25 @@ 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);
}

// 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() });
}
Expand Down
2 changes: 1 addition & 1 deletion crates/stages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion docs/crates/stages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/repo/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit db1e6cb

Please sign in to comment.