Skip to content

Commit

Permalink
feat: impl noop miner api endpoint (#13102)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 3, 2024
1 parent 0aa4701 commit ca3d989
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -1499,6 +1499,7 @@ where
)
.into_rpc()
.into(),
RethRpcModule::Miner => MinerApi::default().into_rpc().into(),
})
.clone()
})
Expand Down
2 changes: 2 additions & 0 deletions crates/rpc/rpc-server-types/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ pub enum RethRpcModule {
Ots,
/// `flashbots_` module
Flashbots,
/// `miner_` module
Miner,
}

// === impl RethRpcModule ===
Expand Down
2 changes: 2 additions & 0 deletions crates/rpc/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ mod admin;
mod debug;
mod engine;
pub mod eth;
mod miner;
mod net;
mod otterscan;
mod reth;
Expand All @@ -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;
Expand Down
25 changes: 25 additions & 0 deletions crates/rpc/rpc/src/miner.rs
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit ca3d989

Please sign in to comment.