mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: install op miner endpoint (#13147)
This commit is contained in:
@ -45,6 +45,7 @@ alloy-consensus.workspace = true
|
||||
op-alloy-network.workspace = true
|
||||
op-alloy-rpc-types.workspace = true
|
||||
op-alloy-rpc-types-engine.workspace = true
|
||||
op-alloy-rpc-jsonrpsee.workspace = true
|
||||
op-alloy-consensus.workspace = true
|
||||
revm.workspace = true
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
pub mod error;
|
||||
pub mod eth;
|
||||
pub mod miner;
|
||||
pub mod sequencer;
|
||||
pub mod witness;
|
||||
|
||||
|
||||
32
crates/optimism/rpc/src/miner.rs
Normal file
32
crates/optimism/rpc/src/miner.rs
Normal file
@ -0,0 +1,32 @@
|
||||
//! Miner API extension for OP.
|
||||
|
||||
use alloy_primitives::U64;
|
||||
use jsonrpsee_core::{async_trait, RpcResult};
|
||||
pub use op_alloy_rpc_jsonrpsee::traits::MinerApiExtServer;
|
||||
use reth_optimism_payload_builder::config::OpDAConfig;
|
||||
use tracing::debug;
|
||||
|
||||
/// Miner API extension for OP, exposes settings for the data availability configuration via the
|
||||
/// `miner_` API.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OpMinerExtApi {
|
||||
da_config: OpDAConfig,
|
||||
}
|
||||
|
||||
impl OpMinerExtApi {
|
||||
/// Instantiate the miner API extension with the given, sharable data availability
|
||||
/// configuration.
|
||||
pub const fn new(da_config: OpDAConfig) -> Self {
|
||||
Self { da_config }
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl MinerApiExtServer for OpMinerExtApi {
|
||||
/// Handler for `miner_setMaxDASize` RPC method.
|
||||
async fn set_max_da_size(&self, max_tx_size: U64, max_block_size: U64) -> RpcResult<()> {
|
||||
debug!(target: "rpc", "Setting max DA size: tx={}, block={}", max_tx_size, max_block_size);
|
||||
self.da_config.set_max_da_size(max_tx_size.to(), max_block_size.to());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user