feat: impl noop miner api endpoint (#13102)

This commit is contained in:
Matthias Seitz
2024-12-03 14:50:59 +01:00
committed by GitHub
parent 0aa4701d30
commit ca3d9895e2
5 changed files with 34 additions and 4 deletions

View File

@ -245,7 +245,7 @@ RPC:
--http.api <HTTP_API> --http.api <HTTP_API>
Rpc Modules to be configured for the HTTP server Rpc Modules to be configured for the HTTP server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots] [possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots, miner]
--http.corsdomain <HTTP_CORSDOMAIN> --http.corsdomain <HTTP_CORSDOMAIN>
Http Corsdomain to allow request from Http Corsdomain to allow request from
@ -269,7 +269,7 @@ RPC:
--ws.api <WS_API> --ws.api <WS_API>
Rpc Modules to be configured for the WS server Rpc Modules to be configured for the WS server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots] [possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots, miner]
--ipcdisable --ipcdisable
Disable the IPC-RPC server Disable the IPC-RPC server

View File

@ -210,8 +210,8 @@ use reth_provider::{
EvmEnvProvider, FullRpcProvider, HeaderProvider, ReceiptProvider, StateProviderFactory, EvmEnvProvider, FullRpcProvider, HeaderProvider, ReceiptProvider, StateProviderFactory,
}; };
use reth_rpc::{ use reth_rpc::{
AdminApi, DebugApi, EngineEthApi, EthBundle, NetApi, OtterscanApi, RPCApi, RethApi, TraceApi, AdminApi, DebugApi, EngineEthApi, EthBundle, MinerApi, NetApi, OtterscanApi, RPCApi, RethApi,
TxPoolApi, ValidationApi, ValidationApiConfig, Web3Api, TraceApi, TxPoolApi, ValidationApi, ValidationApiConfig, Web3Api,
}; };
use reth_rpc_api::servers::*; use reth_rpc_api::servers::*;
use reth_rpc_eth_api::{ use reth_rpc_eth_api::{
@ -1499,6 +1499,7 @@ where
) )
.into_rpc() .into_rpc()
.into(), .into(),
RethRpcModule::Miner => MinerApi::default().into_rpc().into(),
}) })
.clone() .clone()
}) })

View File

@ -269,6 +269,8 @@ pub enum RethRpcModule {
Ots, Ots,
/// `flashbots_` module /// `flashbots_` module
Flashbots, Flashbots,
/// `miner_` module
Miner,
} }
// === impl RethRpcModule === // === impl RethRpcModule ===

View File

@ -36,6 +36,7 @@ mod admin;
mod debug; mod debug;
mod engine; mod engine;
pub mod eth; pub mod eth;
mod miner;
mod net; mod net;
mod otterscan; mod otterscan;
mod reth; mod reth;
@ -49,6 +50,7 @@ pub use admin::AdminApi;
pub use debug::DebugApi; pub use debug::DebugApi;
pub use engine::{EngineApi, EngineEthApi}; pub use engine::{EngineApi, EngineEthApi};
pub use eth::{EthApi, EthBundle, EthFilter, EthPubSub}; pub use eth::{EthApi, EthBundle, EthFilter, EthPubSub};
pub use miner::MinerApi;
pub use net::NetApi; pub use net::NetApi;
pub use otterscan::OtterscanApi; pub use otterscan::OtterscanApi;
pub use reth::RethApi; pub use reth::RethApi;

View File

@ -0,0 +1,25 @@
use alloy_primitives::{Bytes, U128};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_rpc_api::MinerApiServer;
/// `miner` API implementation.
///
/// This type provides the functionality for handling `miner` related requests.
#[derive(Clone, Debug, Default)]
pub struct MinerApi {}
#[async_trait]
impl MinerApiServer for MinerApi {
fn set_extra(&self, _record: Bytes) -> RpcResult<bool> {
Ok(false)
}
fn set_gas_price(&self, _gas_price: U128) -> RpcResult<bool> {
Ok(false)
}
fn set_gas_limit(&self, _gas_price: U128) -> RpcResult<bool> {
Ok(false)
}
}