Skip to content

Commit

Permalink
Update to LH v5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jun 17, 2024
1 parent 48a2f80 commit a117918
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ hmac = "0.12.1"
sha2 = "0.10.7"
toml = "0.8.0"
hex = "0.4.3"
async-channel = "1.9.0"
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use execution_layer::http::{
ENGINE_GET_PAYLOAD_V3, ENGINE_NEW_PAYLOAD_V1, ENGINE_NEW_PAYLOAD_V2, ENGINE_NEW_PAYLOAD_V3,
ETH_SYNCING,
};
use futures::channel::mpsc::channel;
use slog::Logger;
use std::net::SocketAddr;
use std::sync::Arc;
Expand Down Expand Up @@ -90,9 +89,9 @@ struct AppState {
// TODO: do something with signal/signal_rx
async fn new_task_executor(log: Logger) -> TaskExecutor {
let handle = Handle::current();
let (_signal, exit) = exit_future::signal();
let (signal_tx, _signal_rx) = channel(1);
TaskExecutor::new(handle, exit, log, signal_tx)
let (_signal, exit) = async_channel::bounded(1);
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
TaskExecutor::new(handle, exit, log, shutdown_tx)
}

async fn handle_client_json_rpc(
Expand Down
12 changes: 7 additions & 5 deletions src/new_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::{
multiplexer::{Multiplexer, NewPayloadCacheEntry},
types::{
ErrorResponse, JsonExecutionPayload, JsonPayloadStatusV1, JsonPayloadStatusV1Status,
JsonValue, NewPayloadRequest, NewPayloadRequestCapella, NewPayloadRequestDeneb,
NewPayloadRequestMerge, QuantityU64, Request, Response,
JsonValue, NewPayloadRequest, NewPayloadRequestBellatrix, NewPayloadRequestCapella,
NewPayloadRequestDeneb, QuantityU64, Request, Response,
},
};
use eth2::types::{
Expand Down Expand Up @@ -156,8 +156,8 @@ impl<E: EthSpec> Multiplexer<E> {
parent_beacon_block_root: Option<Hash256>,
) -> NewPayloadRequest<E> {
match execution_payload {
ExecutionPayload::Merge(execution_payload) => {
NewPayloadRequest::Merge(NewPayloadRequestMerge { execution_payload })
ExecutionPayload::Bellatrix(execution_payload) => {
NewPayloadRequest::Bellatrix(NewPayloadRequestBellatrix { execution_payload })
}
ExecutionPayload::Capella(execution_payload) => {
NewPayloadRequest::Capella(NewPayloadRequestCapella { execution_payload })
Expand All @@ -172,6 +172,8 @@ impl<E: EthSpec> Multiplexer<E> {
parent_beacon_block_root: parent_beacon_block_root.unwrap_or_default(),
})
}
// TODO: Electra
ExecutionPayload::Electra(_) => todo!("Electra"),
}
}

Expand Down Expand Up @@ -234,7 +236,7 @@ impl<E: EthSpec> Multiplexer<E> {

let fork_name = self.spec.fork_name_at_slot::<E>(slot);

let payload = if method == ENGINE_NEW_PAYLOAD_V1 || fork_name == ForkName::Merge {
let payload = if method == ENGINE_NEW_PAYLOAD_V1 || fork_name == ForkName::Bellatrix {
serde_json::from_value(payload_json).map(JsonExecutionPayload::V1)
} else if method == ENGINE_NEW_PAYLOAD_V2 || fork_name == ForkName::Capella {
serde_json::from_value(payload_json).map(JsonExecutionPayload::V2)
Expand Down
12 changes: 9 additions & 3 deletions src/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crate::{
ErrorResponse, Multiplexer, Request, Response,
};
use eth2::types::{
BlobsBundle, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella,
ExecutionPayloadDeneb, ExecutionPayloadMerge, FixedVector, ForkName, Hash256, Uint256,
BlobsBundle, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
ExecutionPayloadCapella, ExecutionPayloadDeneb, FixedVector, ForkName, Hash256, Uint256,
Unsigned, VariableList,
};
use execution_layer::{calculate_execution_block_hash, PayloadAttributes};
Expand Down Expand Up @@ -113,7 +113,7 @@ impl<E: EthSpec> Multiplexer<E> {
let block_hash = ExecutionBlockHash::zero();

let mut payload = match fork_name {
ForkName::Merge => ExecutionPayload::Merge(ExecutionPayloadMerge {
ForkName::Bellatrix => ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix {
parent_hash,
fee_recipient,
state_root,
Expand Down Expand Up @@ -179,6 +179,8 @@ impl<E: EthSpec> Multiplexer<E> {
excess_blob_gas,
})
}
// TODO: support Electra
ForkName::Electra => todo!(),
ForkName::Base | ForkName::Altair => return Err(format!("invalid fork: {fork_name}")),
};

Expand Down Expand Up @@ -281,6 +283,10 @@ impl<E: EthSpec> Multiplexer<E> {
},
)
}
// TODO: Electra support
JsonExecutionPayload::V4(_) => {
todo!("Electra")
}
}
}
}
3 changes: 2 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ pub use execution_layer::{
JsonPayloadAttributes, JsonPayloadAttributesV2, JsonPayloadStatusV1,
JsonPayloadStatusV1Status, TransparentJsonPayloadId,
},
NewPayloadRequest, NewPayloadRequestCapella, NewPayloadRequestDeneb, NewPayloadRequestMerge,
NewPayloadRequest, NewPayloadRequestBellatrix, NewPayloadRequestCapella,
NewPayloadRequestDeneb,
};
pub use serde_json::Value as JsonValue;
pub use task_executor::TaskExecutor;
Expand Down

0 comments on commit a117918

Please sign in to comment.