Skip to content

Commit 5b162f8

Browse files
committed
rpc-server: fix clone bounds and txpool trait imports
1 parent e24a554 commit 5b162f8

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

crates/rpc/rpc-server/src/middleware/cartridge.rs

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const STARKNET_ESTIMATE_FEE: &str = "starknet_estimateFee";
3636
const CARTRIDGE_ADD_EXECUTE_FROM_OUTSIDE: &str = "cartridge_addExecuteFromOutside";
3737
const CARTRIDGE_ADD_EXECUTE_FROM_OUTSIDE_TX: &str = "cartridge_addExecuteOutsideTransaction";
3838

39-
#[derive(Debug, Clone)]
39+
#[derive(Debug)]
4040
struct ControllerDeploymentContext<Pool, PP, PF>
4141
where
4242
Pool: TransactionPool + 'static,
@@ -49,7 +49,23 @@ where
4949
deployer_private_key: SigningKey,
5050
}
5151

52-
#[derive(Debug, Clone)]
52+
impl<Pool, PP, PF> Clone for ControllerDeploymentContext<Pool, PP, PF>
53+
where
54+
Pool: TransactionPool + 'static,
55+
PP: PendingBlockProvider,
56+
PF: ProviderFactory,
57+
{
58+
fn clone(&self) -> Self {
59+
Self {
60+
starknet: self.starknet.clone(),
61+
cartridge_api: self.cartridge_api.clone(),
62+
deployer_address: self.deployer_address,
63+
deployer_private_key: self.deployer_private_key.clone(),
64+
}
65+
}
66+
}
67+
68+
#[derive(Debug)]
5369
pub struct ControllerDeploymentLayer<Pool, PP, PF>
5470
where
5571
Pool: TransactionPool + 'static,
@@ -97,10 +113,10 @@ where
97113
}
98114
}
99115

100-
#[derive(Debug, Clone)]
116+
#[derive(Debug)]
101117
pub struct ControllerDeploymentService<S, Pool, PP, PF>
102118
where
103-
Pool: TransactionPool,
119+
Pool: TransactionPool + 'static,
104120
PP: PendingBlockProvider,
105121
PF: ProviderFactory,
106122
{
@@ -379,7 +395,7 @@ where
379395
&self,
380396
request: Request<'a>,
381397
) -> impl Future<Output = Self::MethodResponse> + Send + 'a {
382-
let this = self.clone();
398+
let this = (*self).clone();
383399

384400
async move {
385401
let method = request.method_name();
@@ -421,6 +437,29 @@ where
421437
}
422438
}
423439

440+
impl<Pool, PP, PF> Clone for ControllerDeploymentLayer<Pool, PP, PF>
441+
where
442+
Pool: TransactionPool + 'static,
443+
PP: PendingBlockProvider,
444+
PF: ProviderFactory,
445+
{
446+
fn clone(&self) -> Self {
447+
Self { context: self.context.clone() }
448+
}
449+
}
450+
451+
impl<S, Pool, PP, PF> Clone for ControllerDeploymentService<S, Pool, PP, PF>
452+
where
453+
S: Clone,
454+
Pool: TransactionPool + 'static,
455+
PP: PendingBlockProvider,
456+
PF: ProviderFactory,
457+
{
458+
fn clone(&self) -> Self {
459+
Self { context: self.context.clone(), service: self.service.clone() }
460+
}
461+
}
462+
424463
#[derive(Debug, thiserror::Error)]
425464
pub enum Error {
426465
#[error("cartridge api error: {0}")]

crates/rpc/rpc-server/src/txpool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22

33
use jsonrpsee::core::{async_trait, RpcResult};
4-
use katana_pool::{PoolTransaction, TransactionPool};
4+
use katana_pool::api::{PoolTransaction, TransactionPool};
55
use katana_primitives::ContractAddress;
66
use katana_rpc_api::txpool::TxPoolApiServer;
77
use katana_rpc_types::txpool::{TxPoolContent, TxPoolInspect, TxPoolStatus, TxPoolTransaction};

0 commit comments

Comments
 (0)