chore(consensus): emit warnings if no CL found (#2961)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Alexey Shekhirin
2023-06-05 20:48:40 +04:00
committed by GitHub
parent b72c3aed90
commit e1148c81a7
9 changed files with 206 additions and 39 deletions

View File

@ -162,6 +162,8 @@ pub enum BeaconEngineMessage {
/// The sender for returning forkchoice updated result.
tx: oneshot::Sender<Result<OnForkChoiceUpdated, reth_interfaces::Error>>,
},
/// Message with exchanged transition configuration.
TransitionConfigurationExchanged,
/// Add a new listener for [`BeaconEngineMessage`].
EventListener(UnboundedSender<BeaconConsensusEngineEvent>),
}

View File

@ -83,7 +83,7 @@ impl BeaconConsensusEngineHandle {
/// Sends a new payload message to the beacon consensus engine and waits for a response.
///
/// See also <https://github.com/ethereum/execution-apis/blob/8db51dcd2f4bdfbd9ad6e4a7560aac97010ad063/src/engine/specification.md#engine_newpayloadv2>
/// See also <https://github.com/ethereum/execution-apis/blob/3d627c95a4d3510a8187dd02e0250ecb4331d27e/src/engine/shanghai.md#engine_newpayloadv2>
pub async fn new_payload(
&self,
payload: ExecutionPayload,
@ -95,7 +95,7 @@ impl BeaconConsensusEngineHandle {
/// Sends a forkchoice update message to the beacon consensus engine and waits for a response.
///
/// See also <https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#engine_forkchoiceupdatedv2>
/// See also <https://github.com/ethereum/execution-apis/blob/3d627c95a4d3510a8187dd02e0250ecb4331d27e/src/engine/shanghai.md#engine_forkchoiceupdatedv2>
pub async fn fork_choice_updated(
&self,
state: ForkchoiceState,
@ -124,6 +124,13 @@ impl BeaconConsensusEngineHandle {
rx
}
/// Sends a transition configuration exchagne message to the beacon consensus engine.
///
/// See also <https://github.com/ethereum/execution-apis/blob/3d627c95a4d3510a8187dd02e0250ecb4331d27e/src/engine/paris.md#engine_exchangetransitionconfigurationv1>
pub async fn transition_configuration_exchanged(&self) {
let _ = self.to_engine.send(BeaconEngineMessage::TransitionConfigurationExchanged);
}
/// Creates a new [`BeaconConsensusEngineEvent`] listener stream.
pub fn event_listener(&self) -> UnboundedReceiverStream<BeaconConsensusEngineEvent> {
let (tx, rx) = mpsc::unbounded_channel();
@ -1177,6 +1184,9 @@ where
let res = this.on_new_payload(payload);
let _ = tx.send(res);
}
BeaconEngineMessage::TransitionConfigurationExchanged => {
this.blockchain.on_transition_configuration_exchanged();
}
BeaconEngineMessage::EventListener(tx) => {
this.listeners.push_listener(tx);
}