Skip to content

Commit 60c7bda

Browse files
committed
fix clippy
1 parent 2109109 commit 60c7bda

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ alloy-primitives = { version = "1.2.0", default-features = false }
9494
alloy-consensus = { version = "1.0.17", default-features = false }
9595
alloy-rlp = { version = "0.3", default-features = false }
9696
alloy-genesis = { version = "1.0.17", default-features = false }
97+
alloy-rpc-types-txpool = { version = "1.0.17", default-features = false }
9798

9899
# Core dependencies
99100
eyre = "0.6"
@@ -105,6 +106,7 @@ thiserror = "2.0"
105106
async-trait = "0.1"
106107
futures = "0.3"
107108
clap = { version = "4.5", features = ["derive", "env"] }
109+
jsonrpsee = "0.25.1"
108110

109111
# Additional dependencies
110112
reqwest = { version = "0.11", features = ["json"] }

bin/lumen/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ use alloy_rpc_types::engine::{
1717
use clap::Parser;
1818
use lumen_rollkit::{
1919
config::RollkitConfig,
20-
rpc::{
21-
create_rollkit_txpool_module,
22-
txpool::{RollkitTxpoolApiImpl, RollkitTxpoolApiServer},
23-
},
20+
rpc::txpool::{RollkitTxpoolApiImpl, RollkitTxpoolApiServer},
2421
};
2522
use reth_ethereum::{
2623
chainspec::ChainSpec,
@@ -177,7 +174,7 @@ fn main() {
177174
.extend_rpc_modules(move |ctx| {
178175
// Build custom txpool RPC
179176
let rollkit_txpool = RollkitTxpoolApiImpl::new(
180-
ctx.pool(),
177+
ctx.pool().clone(),
181178
RollkitConfig::default().max_txpool_bytes,
182179
);
183180

crates/rollkit/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ reth-payload-primitives.workspace = true
1414
reth-primitives.workspace = true
1515
reth-primitives-traits.workspace = true
1616
reth-engine-primitives.workspace = true
17+
reth-transaction-pool.workspace = true
1718

1819
# Alloy dependencies
1920
alloy-rpc-types-engine.workspace = true
2021
alloy-primitives.workspace = true
2122
alloy-eips.workspace = true
2223
alloy-consensus.workspace = true
2324
alloy-rlp.workspace = true
25+
alloy-rpc-types-txpool.workspace = true
2426

2527
# Core dependencies
2628
serde = { workspace = true, features = ["derive"] }
2729
thiserror.workspace = true
30+
async-trait.workspace = true
31+
jsonrpsee.workspace = true
2832

2933
[dev-dependencies]
3034
serde_json.workspace = true

crates/rollkit/src/config.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub const DEFAULT_MAX_TXPOOL_BYTES: u64 = 1_980 * 1024; // 1.98 MB = 2,027,520 b
77
#[derive(Debug, Clone, Serialize, Deserialize)]
88
pub struct RollkitConfig {
99
/// Maximum bytes of transactions to return from the txpool
10-
#[serde(default = "default_max_txpool_bytes")]
1110
pub max_txpool_bytes: u64,
1211
}
1312

@@ -20,12 +19,8 @@ impl Default for RollkitConfig {
2019
}
2120

2221
impl RollkitConfig {
23-
/// Creates a new RollkitConfig with the given max txpool bytes
22+
/// Creates a new `RollkitConfig` with the given max txpool bytes
2423
pub const fn new(max_txpool_bytes: u64) -> Self {
2524
Self { max_txpool_bytes }
2625
}
2726
}
28-
29-
fn default_max_txpool_bytes() -> u64 {
30-
DEFAULT_MAX_TXPOOL_BYTES
31-
}

crates/rollkit/src/rpc/txpool.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use alloy_primitives::{hex::encode as hex_encode, Address};
22
use alloy_rlp::encode as rlp_encode;
33
use alloy_rpc_types_txpool::TxpoolContent;
44
use async_trait::async_trait;
5-
use jsonrpsee::{core::RpcResult, proc_macros::rpc, RpcModule};
5+
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
66
use reth_transaction_pool::{TransactionPool, ValidPoolTransaction};
77
use std::collections::BTreeMap;
88

99
/// Rollkit txpool RPC API trait
1010
#[rpc(server, namespace = "txpoolExt")]
1111
pub trait RollkitTxpoolApi {
12-
/// Get transactions from the pool up to the configured max_bytes limit
12+
/// Get transactions from the pool up to the configured `max_bytes` limit
1313
#[method(name = "getTxs")]
1414
async fn get_txs(&self) -> RpcResult<TxpoolContent<String>>;
1515
}
@@ -31,7 +31,10 @@ impl<Pool> RollkitTxpoolApiImpl<Pool> {
3131
}
3232

3333
/// Creates a new Rollkit txpool RPC module
34-
pub fn create_rollkit_txpool_module<Pool>(pool: Pool, max_bytes: u64) -> RollkitTxpoolApiImpl<Pool>
34+
pub const fn create_rollkit_txpool_module<Pool>(
35+
pool: Pool,
36+
max_bytes: u64,
37+
) -> RollkitTxpoolApiImpl<Pool>
3538
where
3639
Pool: TransactionPool + Send + Sync + 'static,
3740
{
@@ -43,7 +46,7 @@ impl<Pool> RollkitTxpoolApiServer for RollkitTxpoolApiImpl<Pool>
4346
where
4447
Pool: TransactionPool + Send + Sync + 'static,
4548
{
46-
/// Returns a Geth-style TxpoolContent with raw RLP hex strings.
49+
/// Returns a Geth-style `TxpoolContent` with raw RLP hex strings.
4750
async fn get_txs(&self) -> RpcResult<TxpoolContent<String>> {
4851
//------------------------------------------------------------------//
4952
// 1. Iterate pending txs and stop once we hit the byte cap //

0 commit comments

Comments
 (0)