Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Cargo.lock

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

36 changes: 36 additions & 0 deletions crates/engine/primitives/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub const DEFAULT_RESERVED_CPU_CORES: usize = 1;
/// Default maximum concurrency for prewarm task.
pub const DEFAULT_PREWARM_MAX_CONCURRENCY: usize = 16;

/// Default maximum concurrency for parallel group execution.
pub const DEFAULT_PARALLEL_GROUP_MAX_CONCURRENCY: usize = 16;

const DEFAULT_BLOCK_BUFFER_LIMIT: u32 = 256;
const DEFAULT_MAX_INVALID_HEADER_CACHE_LENGTH: u32 = 256;
const DEFAULT_MAX_EXECUTE_BLOCK_BATCH_SIZE: usize = 4;
Expand Down Expand Up @@ -125,6 +128,11 @@ pub struct TreeConfig {
always_process_payload_attributes_on_canonical_head: bool,
/// Maximum concurrency for the prewarm task.
prewarm_max_concurrency: usize,
/// Whether to enable parallel group execution.
/// If enabled, transactions will be executed in parallel groups instead of prewarming.
parallel_group_execution_enabled: bool,
/// Maximum concurrency for parallel group execution.
parallel_group_max_concurrency: usize,
/// Whether to unwind canonical header to ancestor during forkchoice updates.
allow_unwind_canonical_header: bool,
/// Number of storage proof worker threads.
Expand Down Expand Up @@ -155,6 +163,8 @@ impl Default for TreeConfig {
state_root_fallback: false,
always_process_payload_attributes_on_canonical_head: false,
prewarm_max_concurrency: DEFAULT_PREWARM_MAX_CONCURRENCY,
parallel_group_execution_enabled: false,
parallel_group_max_concurrency: DEFAULT_PARALLEL_GROUP_MAX_CONCURRENCY,
allow_unwind_canonical_header: false,
storage_worker_count: default_storage_worker_count(),
account_worker_count: default_account_worker_count(),
Expand Down Expand Up @@ -185,6 +195,8 @@ impl TreeConfig {
state_root_fallback: bool,
always_process_payload_attributes_on_canonical_head: bool,
prewarm_max_concurrency: usize,
parallel_group_execution_enabled: bool,
parallel_group_max_concurrency: usize,
allow_unwind_canonical_header: bool,
storage_worker_count: usize,
account_worker_count: usize,
Expand All @@ -209,6 +221,8 @@ impl TreeConfig {
state_root_fallback,
always_process_payload_attributes_on_canonical_head,
prewarm_max_concurrency,
parallel_group_execution_enabled,
parallel_group_max_concurrency,
allow_unwind_canonical_header,
storage_worker_count,
account_worker_count,
Expand Down Expand Up @@ -461,6 +475,28 @@ impl TreeConfig {
self.prewarm_max_concurrency
}

/// Returns whether parallel group execution is enabled.
pub const fn parallel_group_execution_enabled(&self) -> bool {
self.parallel_group_execution_enabled
}

/// Returns the maximum concurrency for parallel group execution.
pub const fn parallel_group_max_concurrency(&self) -> usize {
self.parallel_group_max_concurrency
}

/// Sets whether parallel group execution is enabled.
pub const fn with_parallel_group_execution_enabled(mut self, enabled: bool) -> Self {
self.parallel_group_execution_enabled = enabled;
self
}

/// Sets the maximum concurrency for parallel group execution.
pub const fn with_parallel_group_max_concurrency(mut self, concurrency: usize) -> Self {
self.parallel_group_max_concurrency = concurrency;
self
}

/// Return the number of storage proof worker threads.
pub const fn storage_worker_count(&self) -> usize {
self.storage_worker_count
Expand Down
6 changes: 6 additions & 0 deletions crates/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ reth-node-ethereum.workspace = true
reth-e2e-test-utils.workspace = true

# alloy
alloy-genesis.workspace = true
revm-state.workspace = true

assert_matches.workspace = true
Expand All @@ -104,6 +105,7 @@ crossbeam-channel.workspace = true
proptest.workspace = true
rand.workspace = true
rand_08.workspace = true
secp256k1.workspace = true

[[bench]]
name = "channel_perf"
Expand All @@ -113,6 +115,10 @@ harness = false
name = "state_root_task"
harness = false

[[bench]]
name = "parallel_vs_sequential"
harness = false

[features]
test-utils = [
"reth-chain-state/test-utils",
Expand Down
Loading