Skip to content

Commit

Permalink
Merge pull request #138 from anton-rs/rf/extend-engine-trait
Browse files Browse the repository at this point in the history
chore(engine): Extend Engine API Trait
  • Loading branch information
refcell authored Dec 3, 2024
2 parents e57cbd4 + 11cf8d3 commit bd34d77
Show file tree
Hide file tree
Showing 8 changed files with 633 additions and 400 deletions.
596 changes: 283 additions & 313 deletions Cargo.lock

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[patch.crates-io]
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "rf/bump-other-deps" }
kona-driver = { git = "https://github.com/anton-rs/kona", branch = "rf/bump-other-deps" }
kona-derive = { git = "https://github.com/anton-rs/kona", branch = "rf/fix/executor-trait" }
kona-driver = { git = "https://github.com/anton-rs/kona", branch = "rf/fix/executor-trait" }

[workspace.dependencies]
# Workspace
Expand All @@ -56,29 +56,29 @@ kona-driver = { version = "0.1.0", default-features = false }

# Alloy
alloy-rlp = { version = "0.3.9", default-features = false }
alloy-eips = { version = "0.7.0", default-features = false }
alloy-serde = { version = "0.7.0", default-features = false }
alloy-signer = { version = "0.7.0", default-features = false }
alloy-network = { version = "0.7.0", default-features = false }
alloy-provider = { version = "0.7.0", default-features = false }
alloy-consensus = { version = "0.7.0", default-features = false }
alloy-rpc-types = { version = "0.7.0", default-features = false }
alloy-transport = { version = "0.7.0", default-features = false }
alloy-rpc-client = { version = "0.7.0", default-features = false }
alloy-primitives = { version = "0.8.13", default-features = false }
alloy-rpc-types-eth = { version = "0.7.0", default-features = false }
alloy-node-bindings = { version = "0.7.0", default-features = false }
alloy-transport-http = { version = "0.7.0", default-features = false }
alloy-rpc-types-beacon = { version = "0.7.0", default-features = false }
alloy-rpc-types-engine = { version = "0.7.0", default-features = false }
alloy-eips = { version = "0.7.2", default-features = false }
alloy-serde = { version = "0.7.2", default-features = false }
alloy-signer = { version = "0.7.2", default-features = false }
alloy-network = { version = "0.7.2", default-features = false }
alloy-provider = { version = "0.7.2", default-features = false }
alloy-consensus = { version = "0.7.2", default-features = false }
alloy-rpc-types = { version = "0.7.2", default-features = false }
alloy-transport = { version = "0.7.2", default-features = false }
alloy-rpc-client = { version = "0.7.2", default-features = false }
alloy-primitives = { version = "0.8.14", default-features = false }
alloy-rpc-types-eth = { version = "0.7.2", default-features = false }
alloy-node-bindings = { version = "0.7.2", default-features = false }
alloy-transport-http = { version = "0.7.2", default-features = false }
alloy-rpc-types-beacon = { version = "0.7.2", default-features = false }
alloy-rpc-types-engine = { version = "0.7.2", default-features = false }

# OP Alloy
op-alloy-genesis = { version = "0.7.1", default-features = false }
op-alloy-provider = { version = "0.7.1", default-features = false }
op-alloy-protocol = { version = "0.7.1", default-features = false }
op-alloy-registry = { version = "0.7.1", default-features = false }
op-alloy-consensus = { version = "0.7.1", default-features = false }
op-alloy-rpc-types-engine = { version = "0.7.1", default-features = false }
op-alloy-genesis = { version = "0.7.2", default-features = false }
op-alloy-provider = { version = "0.7.2", default-features = false }
op-alloy-protocol = { version = "0.7.2", default-features = false }
op-alloy-registry = { version = "0.7.2", default-features = false }
op-alloy-consensus = { version = "0.7.2", default-features = false }
op-alloy-rpc-types-engine = { version = "0.7.2", default-features = false }

# Reth
reth-exex = { git = "https://github.com/paradigmxyz/reth", rev = "aea5613" }
Expand All @@ -87,44 +87,44 @@ reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "aea5613"
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", rev = "aea5613" }

# Serialization
serde = { version = "1.0.214", default-features = false }
serde_json = { version = "1.0.132", default-features = false }
serde = { version = "1.0.215", default-features = false }
serde_json = { version = "1.0.133", default-features = false }

# Tracing
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.18", default-features = false }
tracing = { version = "0.1.41", default-features = false }
tracing-subscriber = { version = "0.3.19", default-features = false }
metrics-exporter-prometheus = { version = "0.16.0", default-features = false }

# Networking
snap = "1.1.1"
discv5 = "0.9.0"
libp2p = "0.54.1"
openssl = "0.10.68"
libp2p-identity = "0.2.9"
libp2p-identity = "0.2.10"

# Testing
arbtest = "0.3"
arbitrary = "1"
arbtest = "0.3.1"
arbitrary = "1.4.1"

# CLI
clap = "4.5.20"
figment = { version = "0.10.8", features = ["toml", "env"] }
clap = "4.5.21"
figment = { version = "0.10.19", features = ["toml", "env"] }

# Misc
url = "2.5.2"
url = "2.5.4"
lru = "0.12.5"
eyre = "0.6.12"
again = "0.1.2"
tokio = "1.41.0"
tokio = "1.42.0"
futures = "0.3.31"
reqwest = "0.12.9"
tower = "0.5"
tower = "0.5.1"
http-body-util = "0.1.2"
parking_lot = "0.12.3"
async-trait = "0.1.83"
futures-timer = "3.0.3"
unsigned-varint = "0.8.0"
thiserror = { version = "2.0", default-features = false }
thiserror = { version = "2.0.4", default-features = false }
derive_more = { version = "1.0.0", default-features = false }
lazy_static = { version = "1.5.0", default-features = false }
ctrlc = { version = "3.2.3", features = ["termination"] }
ctrlc = { version = "3.4.5", features = ["termination"] }
1 change: 1 addition & 0 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ alloy-rpc-types-engine = { workspace = true, features = ["jwt", "serde"] }
# Op Alloy
op-alloy-genesis.workspace = true
op-alloy-provider.workspace = true
op-alloy-consensus.workspace = true
op-alloy-protocol.workspace = true
op-alloy-rpc-types-engine.workspace = true

Expand Down
27 changes: 24 additions & 3 deletions crates/engine/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use alloy_primitives::{Bytes, B256};
use alloy_provider::{ReqwestProvider, RootProvider};
use alloy_rpc_client::RpcClient;
use alloy_rpc_types_engine::{
ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, JwtSecret, PayloadId, PayloadStatus,
ExecutionPayloadEnvelopeV2, ExecutionPayloadInputV2, ExecutionPayloadV2, ExecutionPayloadV3,
ForkchoiceState, ForkchoiceUpdated, JwtSecret, PayloadId, PayloadStatus,
};
use alloy_transport_http::{
hyper_util::{
Expand Down Expand Up @@ -64,7 +65,14 @@ impl EngineClient {
impl Engine for EngineClient {
type Error = EngineError;

async fn get_payload(
async fn get_payload_v2(
&self,
payload_id: PayloadId,
) -> Result<ExecutionPayloadEnvelopeV2, Self::Error> {
self.engine.get_payload_v2(payload_id).await.map_err(|_| EngineError::PayloadError)
}

async fn get_payload_v3(
&self,
payload_id: PayloadId,
) -> Result<OpExecutionPayloadEnvelopeV3, Self::Error> {
Expand All @@ -79,7 +87,20 @@ impl Engine for EngineClient {
self.engine.fork_choice_updated_v2(state, attr).await.map_err(|_| EngineError::PayloadError)
}

async fn new_payload(
async fn new_payload_v2(
&self,
payload: ExecutionPayloadV2,
) -> Result<PayloadStatus, Self::Error> {
self.engine
.new_payload_v2(ExecutionPayloadInputV2 {
execution_payload: payload.payload_inner,
withdrawals: Some(payload.withdrawals),
})
.await
.map_err(|_| EngineError::PayloadError)
}

async fn new_payload_v3(
&self,
payload: ExecutionPayloadV3,
parent_beacon_block_root: B256,
Expand Down
Loading

0 comments on commit bd34d77

Please sign in to comment.