mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
replace BuilderBlockValidationRequestV3 with alloy type (#12396)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -8701,8 +8701,6 @@ dependencies = [
|
|||||||
"reth-engine-primitives",
|
"reth-engine-primitives",
|
||||||
"reth-network-peers",
|
"reth-network-peers",
|
||||||
"reth-rpc-eth-api",
|
"reth-rpc-eth-api",
|
||||||
"serde",
|
|
||||||
"serde_with",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -2,12 +2,14 @@ use crate::utils::eth_payload_attributes;
|
|||||||
use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718};
|
use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718};
|
||||||
use alloy_primitives::{Address, B256, U256};
|
use alloy_primitives::{Address, B256, U256};
|
||||||
use alloy_provider::{network::EthereumWallet, Provider, ProviderBuilder, SendableTx};
|
use alloy_provider::{network::EthereumWallet, Provider, ProviderBuilder, SendableTx};
|
||||||
use alloy_rpc_types_beacon::relay::{BidTrace, SignedBidSubmissionV3, SignedBidSubmissionV4};
|
use alloy_rpc_types_beacon::relay::{
|
||||||
|
BidTrace, BuilderBlockValidationRequestV3, BuilderBlockValidationRequestV4,
|
||||||
|
SignedBidSubmissionV3, SignedBidSubmissionV4,
|
||||||
|
};
|
||||||
use rand::{rngs::StdRng, Rng, SeedableRng};
|
use rand::{rngs::StdRng, Rng, SeedableRng};
|
||||||
use reth::{
|
use reth::{
|
||||||
payload::BuiltPayload,
|
payload::BuiltPayload,
|
||||||
rpc::{
|
rpc::{
|
||||||
api::{BuilderBlockValidationRequestV3, BuilderBlockValidationRequestV4},
|
|
||||||
compat::engine::payload::block_to_payload_v3,
|
compat::engine::payload::block_to_payload_v3,
|
||||||
types::{engine::BlobsBundleV1, TransactionRequest},
|
types::{engine::BlobsBundleV1, TransactionRequest},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -35,8 +35,6 @@ alloy-rpc-types-engine.workspace = true
|
|||||||
|
|
||||||
# misc
|
# misc
|
||||||
jsonrpsee = { workspace = true, features = ["server", "macros"] }
|
jsonrpsee = { workspace = true, features = ["server", "macros"] }
|
||||||
serde.workspace = true
|
|
||||||
serde_with.workspace = true
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
client = [
|
client = [
|
||||||
|
|||||||
@ -46,10 +46,7 @@ pub mod servers {
|
|||||||
rpc::RpcApiServer,
|
rpc::RpcApiServer,
|
||||||
trace::TraceApiServer,
|
trace::TraceApiServer,
|
||||||
txpool::TxPoolApiServer,
|
txpool::TxPoolApiServer,
|
||||||
validation::{
|
validation::BlockSubmissionValidationApiServer,
|
||||||
BlockSubmissionValidationApiServer, BuilderBlockValidationRequestV3,
|
|
||||||
BuilderBlockValidationRequestV4,
|
|
||||||
},
|
|
||||||
web3::Web3ApiServer,
|
web3::Web3ApiServer,
|
||||||
};
|
};
|
||||||
pub use reth_rpc_eth_api::{
|
pub use reth_rpc_eth_api::{
|
||||||
|
|||||||
@ -1,45 +1,10 @@
|
|||||||
//! API for block submission validation.
|
//! API for block submission validation.
|
||||||
|
|
||||||
use alloy_primitives::B256;
|
|
||||||
use alloy_rpc_types_beacon::relay::{
|
use alloy_rpc_types_beacon::relay::{
|
||||||
BuilderBlockValidationRequest, BuilderBlockValidationRequestV2, SignedBidSubmissionV3,
|
BuilderBlockValidationRequest, BuilderBlockValidationRequestV2,
|
||||||
SignedBidSubmissionV4,
|
BuilderBlockValidationRequestV3, BuilderBlockValidationRequestV4,
|
||||||
};
|
};
|
||||||
use jsonrpsee::proc_macros::rpc;
|
use jsonrpsee::proc_macros::rpc;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use serde_with::{serde_as, DisplayFromStr};
|
|
||||||
|
|
||||||
/// A Request to validate a [`SignedBidSubmissionV3`]
|
|
||||||
///
|
|
||||||
/// <https://github.com/flashbots/builder/blob/7577ac81da21e760ec6693637ce2a81fe58ac9f8/eth/block-validation/api.go#L198-L202>
|
|
||||||
#[serde_as]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
||||||
pub struct BuilderBlockValidationRequestV3 {
|
|
||||||
/// The request to be validated.
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub request: SignedBidSubmissionV3,
|
|
||||||
/// The registered gas limit for the validation request.
|
|
||||||
#[serde_as(as = "DisplayFromStr")]
|
|
||||||
pub registered_gas_limit: u64,
|
|
||||||
/// The parent beacon block root for the validation request.
|
|
||||||
pub parent_beacon_block_root: B256,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A Request to validate a [`SignedBidSubmissionV4`]
|
|
||||||
///
|
|
||||||
/// <https://github.com/flashbots/builder/blob/7577ac81da21e760ec6693637ce2a81fe58ac9f8/eth/block-validation/api.go#L198-L202>
|
|
||||||
#[serde_as]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
|
||||||
pub struct BuilderBlockValidationRequestV4 {
|
|
||||||
/// The request to be validated.
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub request: SignedBidSubmissionV4,
|
|
||||||
/// The registered gas limit for the validation request.
|
|
||||||
#[serde_as(as = "DisplayFromStr")]
|
|
||||||
pub registered_gas_limit: u64,
|
|
||||||
/// The parent beacon block root for the validation request.
|
|
||||||
pub parent_beacon_block_root: B256,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Block validation rpc interface.
|
/// Block validation rpc interface.
|
||||||
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "flashbots"))]
|
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "flashbots"))]
|
||||||
|
|||||||
@ -5,6 +5,7 @@ use alloy_rpc_types::engine::{
|
|||||||
};
|
};
|
||||||
use alloy_rpc_types_beacon::relay::{
|
use alloy_rpc_types_beacon::relay::{
|
||||||
BidTrace, BuilderBlockValidationRequest, BuilderBlockValidationRequestV2,
|
BidTrace, BuilderBlockValidationRequest, BuilderBlockValidationRequestV2,
|
||||||
|
BuilderBlockValidationRequestV3, BuilderBlockValidationRequestV4,
|
||||||
};
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use jsonrpsee::core::RpcResult;
|
use jsonrpsee::core::RpcResult;
|
||||||
@ -20,10 +21,7 @@ use reth_provider::{
|
|||||||
StateProviderFactory, WithdrawalsProvider,
|
StateProviderFactory, WithdrawalsProvider,
|
||||||
};
|
};
|
||||||
use reth_revm::database::StateProviderDatabase;
|
use reth_revm::database::StateProviderDatabase;
|
||||||
use reth_rpc_api::{
|
use reth_rpc_api::BlockSubmissionValidationApiServer;
|
||||||
BlockSubmissionValidationApiServer, BuilderBlockValidationRequestV3,
|
|
||||||
BuilderBlockValidationRequestV4,
|
|
||||||
};
|
|
||||||
use reth_rpc_eth_types::EthApiError;
|
use reth_rpc_eth_types::EthApiError;
|
||||||
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
||||||
use reth_trie::HashedPostState;
|
use reth_trie::HashedPostState;
|
||||||
|
|||||||
Reference in New Issue
Block a user