Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new engine API handler #8559

Merged
merged 47 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
83081b1
feat: engine 2
mattsse Jun 2, 2024
573c726
Merge branch 'main' into matt/engine2
mattsse Jun 3, 2024
c45d564
wip
mattsse Jun 3, 2024
5518569
wip
mattsse Jun 3, 2024
29354cb
scaffold
mattsse Jun 3, 2024
b6e173a
Merge branch 'main' into matt/engine2
mattsse Jun 4, 2024
27f418d
wip
mattsse Jun 4, 2024
68ef4ba
Merge branch 'main' into matt/engine2
mattsse Jun 5, 2024
8e92150
wip
mattsse Jun 5, 2024
ebe2be9
Merge branch 'main' into matt/engine2
mattsse Jun 6, 2024
1c28492
chore: more docs
mattsse Jun 6, 2024
3a00bbe
more docs
mattsse Jun 6, 2024
81afa85
chore: tree engine chores (#8715)
rkrasiuk Jun 10, 2024
728ea15
feat(engine): add payload conversion (#8754)
rkrasiuk Jun 11, 2024
4f15f90
feat: create init structure of tree state (#8757)
rkrasiuk Jun 13, 2024
4047f5f
feat(tree-engine): invalid ancestor handling (#8795)
rkrasiuk Jun 13, 2024
e708cb4
feat: main control loop for chain orchestrator (#8798)
mattsse Jun 13, 2024
610a9c3
chore: set CODEOWNERS for engine2 (#8819)
Rjected Jun 14, 2024
92c4d0d
Merge branch 'main' into matt/engine2
mattsse Jun 14, 2024
ae55d20
Merge branch 'main' into matt/engine2
mattsse Jun 14, 2024
fcf1b18
bump lock
mattsse Jun 14, 2024
2726a34
feat: add basic request loop (#8836)
mattsse Jun 14, 2024
10837a1
feat: integrate live sync downloader (#8929)
mattsse Jun 18, 2024
65ab360
chore: rm writeaccess tracking (#8928)
mattsse Jun 18, 2024
8cb2a3e
feat: implement tree state provider (#8907)
rkrasiuk Jun 18, 2024
259da7a
feat: support bubbling up custom events (#8932)
mattsse Jun 18, 2024
2787160
Merge branch 'main' into matt/engine2
mattsse Jun 19, 2024
83cbcb9
chore: more request scaffolding (#8983)
mattsse Jun 20, 2024
5fc3629
feat: change engine api request handler (#9010)
mattsse Jun 21, 2024
f2be132
feat(tree): add trie output to executed block (#8994)
rkrasiuk Jun 24, 2024
ebfc15c
chore(tree): remove state locks (#9050)
rkrasiuk Jun 24, 2024
7e6fc55
feat(tree): block buffering & validation (#8978)
rkrasiuk Jun 24, 2024
6c1ceee
fix compilation
rkrasiuk Jun 24, 2024
5b17ac3
feat: add Persistence skeleton for db writes (#8818)
Rjected Jun 24, 2024
92e1e74
chore: rename PipelineHandler -> BackfillSync (#9059)
fgimenez Jun 24, 2024
b4ca471
feat(tree): return outcome on new payload (#9069)
rkrasiuk Jun 25, 2024
042bce2
feat(tree): add hashed state to executed block (#9104)
rkrasiuk Jun 25, 2024
76d01a2
Merge branch 'main' into matt/engine2
mattsse Jun 26, 2024
5330f5d
feat: implement block downloader (#9118)
fgimenez Jun 27, 2024
6241007
chore: add persistence utils, remove warns (#9131)
Rjected Jun 27, 2024
58f0e8f
feat: implement pipeline BackfillSync (#9147)
fgimenez Jun 27, 2024
5ce171c
chore: fix clippy issues (#9170)
mattsse Jun 28, 2024
f6a5527
Mergte branch 'main' into matt/engine2
mattsse Jun 28, 2024
aebbd77
docs
mattsse Jun 28, 2024
61d26dd
feat(tree): return result on successful block insertion (#9171)
rkrasiuk Jun 28, 2024
71d582b
clippy
mattsse Jun 28, 2024
8d05dc3
chore: improve persistence docs, rename SaveBlocks (#9185)
Rjected Jun 29, 2024
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
3 changes: 2 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ crates/chainspec/ @Rjected @joshieDo @mattsse
crates/cli/ @onbjerg @mattsse
crates/config/ @onbjerg
crates/consensus/ @rkrasiuk @mattsse @Rjected
crates/engine @rkrasiuk @mattsse @Rjected
crates/e2e-test-utils/ @mattsse @Rjected
crates/engine-primitives/ @rkrasiuk @mattsse @Rjected
crates/engine/ @rkrasiuk @mattsse @Rjected @fgimenez
crates/errors/ @mattsse
crates/ethereum/ @mattsse @Rjected
crates/ethereum-forks/ @mattsse @Rjected
Expand Down
44 changes: 44 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = [
"crates/ethereum-forks/",
"crates/e2e-test-utils/",
"crates/engine/primitives/",
"crates/engine/tree/",
"crates/engine/util/",
"crates/errors/",
"crates/ethereum-forks/",
Expand Down Expand Up @@ -287,6 +288,7 @@ reth-downloaders = { path = "crates/net/downloaders" }
reth-e2e-test-utils = { path = "crates/e2e-test-utils" }
reth-ecies = { path = "crates/net/ecies" }
reth-engine-primitives = { path = "crates/engine/primitives" }
reth-engine-tree = { path = "crates/engine/tree" }
reth-engine-util = { path = "crates/engine/util" }
reth-errors = { path = "crates/errors" }
reth-eth-wire = { path = "crates/net/eth-wire" }
Expand Down
9 changes: 6 additions & 3 deletions crates/consensus/beacon/src/engine/forkchoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use reth_rpc_types::engine::{ForkchoiceState, PayloadStatusEnum};

/// The struct that keeps track of the received forkchoice state and their status.
#[derive(Debug, Clone, Default)]
pub(crate) struct ForkchoiceStateTracker {
pub struct ForkchoiceStateTracker {
/// The latest forkchoice state that we received.
///
/// Caution: this can be invalid.
Expand Down Expand Up @@ -76,7 +76,7 @@ impl ForkchoiceStateTracker {
}

/// Returns the last received `ForkchoiceState` to which we need to sync.
pub(crate) const fn sync_target_state(&self) -> Option<ForkchoiceState> {
pub const fn sync_target_state(&self) -> Option<ForkchoiceState> {
self.last_syncing
}

Expand Down Expand Up @@ -139,9 +139,12 @@ impl From<PayloadStatusEnum> for ForkchoiceStatus {

/// A helper type to check represent hashes of a [`ForkchoiceState`]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum ForkchoiceStateHash {
pub enum ForkchoiceStateHash {
/// Head hash of the [`ForkchoiceState`].
Head(B256),
/// Safe hash of the [`ForkchoiceState`].
Safe(B256),
/// Finalized hash of the [`ForkchoiceState`].
Finalized(B256),
}

Expand Down
7 changes: 4 additions & 3 deletions crates/consensus/beacon/src/engine/invalid_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use tracing::warn;
const INVALID_HEADER_HIT_EVICTION_THRESHOLD: u8 = 128;

/// Keeps track of invalid headers.
pub(crate) struct InvalidHeaderCache {
#[derive(Debug)]
pub struct InvalidHeaderCache {
/// This maps a header hash to a reference to its invalid ancestor.
headers: LruMap<B256, HeaderEntry>,
/// Metrics for the cache.
Expand All @@ -34,7 +35,7 @@ impl InvalidHeaderCache {
///
/// If this is called, the hit count for the entry is incremented.
/// If the hit count exceeds the threshold, the entry is evicted and `None` is returned.
pub(crate) fn get(&mut self, hash: &B256) -> Option<Arc<Header>> {
pub fn get(&mut self, hash: &B256) -> Option<Arc<Header>> {
{
let entry = self.headers.get(hash)?;
entry.hit_count += 1;
Expand All @@ -49,7 +50,7 @@ impl InvalidHeaderCache {
}

/// Inserts an invalid block into the cache, with a given invalid ancestor.
pub(crate) fn insert_with_invalid_ancestor(
pub fn insert_with_invalid_ancestor(
&mut self,
header_hash: B256,
invalid_ancestor: Arc<Header>,
Expand Down
7 changes: 3 additions & 4 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub use error::{
};

mod invalid_headers;
use invalid_headers::InvalidHeaderCache;
pub use invalid_headers::InvalidHeaderCache;

mod event;
pub use event::{BeaconConsensusEngineEvent, ConsensusEngineLiveSyncProgress};
Expand All @@ -62,13 +62,12 @@ mod handle;
pub use handle::BeaconConsensusEngineHandle;

mod forkchoice;
pub use forkchoice::ForkchoiceStatus;
use forkchoice::{ForkchoiceStateHash, ForkchoiceStateTracker};
pub use forkchoice::{ForkchoiceStateHash, ForkchoiceStateTracker, ForkchoiceStatus};

mod metrics;
use metrics::EngineMetrics;

pub(crate) mod sync;
pub mod sync;
use sync::{EngineSyncController, EngineSyncEvent};

/// Hooks for running during the main loop of
Expand Down
64 changes: 64 additions & 0 deletions crates/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[package]
name = "reth-engine-tree"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[lints]
workspace = true

[dependencies]
# reth
reth-beacon-consensus.workspace = true
reth-blockchain-tree.workspace = true
reth-blockchain-tree-api.workspace = true
reth-chainspec.workspace = true
reth-consensus.workspace = true
reth-db.workspace = true
reth-db-api.workspace = true
reth-engine-primitives.workspace = true
reth-errors.workspace = true
reth-ethereum-consensus.workspace = true
reth-evm.workspace = true
reth-network-p2p.workspace = true
reth-payload-builder.workspace = true
reth-payload-primitives.workspace = true
reth-payload-validator.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-prune.workspace = true
reth-revm.workspace = true
reth-rpc-types.workspace = true
reth-stages-api.workspace = true
reth-static-file.workspace = true
reth-tasks.workspace = true
reth-tokio-util.workspace = true
reth-trie.workspace = true
revm.workspace = true

# common
futures.workspace = true
tokio = { workspace = true, features = ["macros", "sync"] }
tokio-stream = { workspace = true, features = ["sync"] }


# metrics
metrics.workspace = true
reth-metrics = { workspace = true, features = ["common"] }

# misc
aquamarine.workspace = true
parking_lot.workspace = true
tracing.workspace = true

[dev-dependencies]
# reth
reth-network-p2p = { workspace = true, features = ["test-utils"] }
reth-prune-types.workspace = true
reth-stages = { workspace = true, features = ["test-utils"] }
reth-tracing.workspace = true

assert_matches.workspace = true
Loading
Loading