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>
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 to allow request from
@ -269,7 +269,7 @@ RPC:
--ws.api <WS_API>
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
Disable the IPC-RPC server

View File

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

View File

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

View File

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