rpc-types: rm alloy-rpc-types-engine reexport (#11206)

This commit is contained in:
Thomas Coratger
2024-09-25 16:49:50 +02:00
committed by GitHub
parent 3d034519af
commit c00516c3f9
48 changed files with 111 additions and 134 deletions

View File

@ -30,6 +30,7 @@ reth-transaction-pool.workspace = true
# ethereum
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-engine = { workspace = true, features = ["jsonrpsee-types"] }
# async
tokio = { workspace = true, features = ["sync"] }

View File

@ -3,6 +3,12 @@ use crate::{
};
use alloy_eips::eip4844::BlobAndProofV1;
use alloy_primitives::{BlockHash, BlockNumber, B256, U64};
use alloy_rpc_types_engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
ExecutionPayloadBodiesV2, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3,
ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
TransitionConfiguration,
};
use async_trait::async_trait;
use jsonrpsee_core::RpcResult;
use reth_beacon_consensus::BeaconConsensusEngineHandle;
@ -16,12 +22,6 @@ use reth_payload_primitives::{
};
use reth_primitives::{Block, BlockHashOrNumber, EthereumHardfork};
use reth_rpc_api::EngineApiServer;
use reth_rpc_types::engine::{
CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1,
ExecutionPayloadBodiesV2, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3,
ExecutionPayloadV4, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
TransitionConfiguration,
};
use reth_rpc_types_compat::engine::payload::{
convert_payload_input_v2_to_payload, convert_to_payload_body_v1, convert_to_payload_body_v2,
};
@ -948,6 +948,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_rpc_types_engine::{ClientCode, ClientVersionV1};
use assert_matches::assert_matches;
use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage};
use reth_chainspec::{ChainSpec, MAINNET};
@ -955,7 +956,6 @@ mod tests {
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::SealedBlock;
use reth_provider::test_utils::MockEthProvider;
use reth_rpc_types::engine::{ClientCode, ClientVersionV1};
use reth_rpc_types_compat::engine::payload::execution_payload_from_sealed_block;
use reth_tasks::TokioTaskExecutor;
use reth_testing_utils::generators::random_block;

View File

@ -195,7 +195,7 @@ impl From<EngineApiError> for jsonrpsee_types::error::ErrorObject<'static> {
#[cfg(test)]
mod tests {
use super::*;
use reth_rpc_types::engine::ForkchoiceUpdateError;
use alloy_rpc_types_engine::ForkchoiceUpdateError;
#[track_caller]
fn ensure_engine_rpc_error(

View File

@ -1,9 +1,9 @@
use std::time::Duration;
use crate::EngineApiError;
use alloy_rpc_types_engine::{ForkchoiceUpdated, PayloadStatus, PayloadStatusEnum};
use metrics::{Counter, Histogram};
use reth_metrics::Metrics;
use reth_rpc_types::engine::{ForkchoiceUpdated, PayloadStatus, PayloadStatusEnum};
/// All beacon consensus engine metrics
#[derive(Default)]
@ -61,16 +61,16 @@ pub(crate) struct ForkchoiceUpdatedResponseMetrics {
/// The total count of forkchoice updated messages received.
pub(crate) forkchoice_updated_messages: Counter,
/// The total count of forkchoice updated messages that we responded to with
/// [Invalid](reth_rpc_types::engine::PayloadStatusEnum#Invalid).
/// [`Invalid`](alloy_rpc_types_engine::PayloadStatusEnum#Invalid).
pub(crate) forkchoice_updated_invalid: Counter,
/// The total count of forkchoice updated messages that we responded to with
/// [Valid](reth_rpc_types::engine::PayloadStatusEnum#Valid).
/// [`Valid`](alloy_rpc_types_engine::PayloadStatusEnum#Valid).
pub(crate) forkchoice_updated_valid: Counter,
/// The total count of forkchoice updated messages that we responded to with
/// [Syncing](reth_rpc_types::engine::PayloadStatusEnum#Syncing).
/// [`Syncing`](alloy_rpc_types_engine::PayloadStatusEnum#Syncing).
pub(crate) forkchoice_updated_syncing: Counter,
/// The total count of forkchoice updated messages that we responded to with
/// [Accepted](reth_rpc_types::engine::PayloadStatusEnum#Accepted).
/// [`Accepted`](alloy_rpc_types_engine::PayloadStatusEnum#Accepted).
pub(crate) forkchoice_updated_accepted: Counter,
/// The total count of forkchoice updated messages that were unsuccessful, i.e. we responded
/// with an error type that is not a [`PayloadStatusEnum`].
@ -84,16 +84,16 @@ pub(crate) struct NewPayloadStatusResponseMetrics {
/// The total count of new payload messages received.
pub(crate) new_payload_messages: Counter,
/// The total count of new payload messages that we responded to with
/// [Invalid](reth_rpc_types::engine::PayloadStatusEnum#Invalid).
/// [Invalid](alloy_rpc_types_engine::PayloadStatusEnum#Invalid).
pub(crate) new_payload_invalid: Counter,
/// The total count of new payload messages that we responded to with
/// [Valid](reth_rpc_types::engine::PayloadStatusEnum#Valid).
/// [Valid](alloy_rpc_types_engine::PayloadStatusEnum#Valid).
pub(crate) new_payload_valid: Counter,
/// The total count of new payload messages that we responded to with
/// [Syncing](reth_rpc_types::engine::PayloadStatusEnum#Syncing).
/// [Syncing](alloy_rpc_types_engine::PayloadStatusEnum#Syncing).
pub(crate) new_payload_syncing: Counter,
/// The total count of new payload messages that we responded to with
/// [Accepted](reth_rpc_types::engine::PayloadStatusEnum#Accepted).
/// [Accepted](alloy_rpc_types_engine::PayloadStatusEnum#Accepted).
pub(crate) new_payload_accepted: Counter,
/// The total count of new payload messages that were unsuccessful, i.e. we responded with an
/// error type that is not a [`PayloadStatusEnum`].

View File

@ -2,14 +2,14 @@
use alloy_primitives::{Bytes, U256};
use alloy_rlp::{Decodable, Error as RlpError};
use alloy_rpc_types_engine::{
ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadV1, PayloadError,
};
use assert_matches::assert_matches;
use reth_primitives::{
alloy_primitives::Sealable, proofs, Block, SealedBlock, SealedHeader, TransactionSigned,
Withdrawals,
};
use reth_rpc_types::engine::{
ExecutionPayload, ExecutionPayloadBodyV1, ExecutionPayloadV1, PayloadError,
};
use reth_rpc_types_compat::engine::payload::{
block_to_payload, block_to_payload_v1, convert_to_payload_body_v1, try_into_sealed_block,
try_payload_v1_to_block,