Skip to content

Commit 3b1484a

Browse files
committed
refactor: move PNT down
1 parent 9256c89 commit 3b1484a

File tree

17 files changed

+89
-57
lines changed

17 files changed

+89
-57
lines changed

crates/journaler/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "signet-journaler"
3+
description = "Manager replayable journals for signet"
4+
version.workspace = true
5+
edition.workspace = true
6+
rust-version.workspace = true
7+
authors.workspace = true
8+
license.workspace = true
9+
homepage.workspace = true
10+
repository.workspace = true
11+
12+
[dependencies]
13+
trevm.workspace = true

crates/journaler/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

crates/node-types/src/lib.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#![deny(unused_must_use, rust_2018_idioms)]
1212
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1313

14+
mod utils;
15+
pub use utils::{NodeTypesDbTrait, Pnt};
16+
1417
use reth::{
1518
primitives::EthPrimitives,
1619
providers::{
@@ -96,21 +99,6 @@ where
9699
type DB = Db;
97100
}
98101

99-
/// Convenience trait to aggregate the DB requirements
100-
pub trait NodeTypesDbTrait:
101-
reth_db::database::Database + reth_db::database_metrics::DatabaseMetrics + Clone + Unpin + 'static
102-
{
103-
}
104-
105-
impl<T> NodeTypesDbTrait for T where
106-
T: reth_db::database::Database
107-
+ reth_db::database_metrics::DatabaseMetrics
108-
+ Clone
109-
+ Unpin
110-
+ 'static
111-
{
112-
}
113-
114102
/// Shim to impl [`CanonStateSubscriptions`]
115103
#[derive(Debug, Clone)]
116104
pub struct SharedCanonState<Db> {
@@ -172,3 +160,15 @@ where
172160
self.sender.subscribe()
173161
}
174162
}
163+
164+
#[cfg(test)]
165+
mod test {
166+
use super::*;
167+
168+
#[allow(dead_code)]
169+
fn compile_check() {
170+
fn inner<P: Pnt>() {}
171+
172+
inner::<SignetNodeTypes<std::sync::Arc<reth_db::mdbx::DatabaseEnv>>>();
173+
}
174+
}

crates/node-types/src/utils.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use reth::{primitives::EthPrimitives, providers::providers::ProviderNodeTypes};
2+
use reth_chainspec::ChainSpec;
3+
use reth_db::mdbx;
4+
use std::sync::Arc;
5+
6+
/// Convenience trait for specifying the [`ProviderNodeTypes`] implementation
7+
/// required for Signet functionality. This is used to condense many trait
8+
/// bounds.
9+
pub trait Pnt:
10+
ProviderNodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives, DB = Arc<mdbx::DatabaseEnv>>
11+
{
12+
}
13+
14+
impl<T> Pnt for T where
15+
T: ProviderNodeTypes<
16+
ChainSpec = ChainSpec,
17+
Primitives = EthPrimitives,
18+
DB = Arc<mdbx::DatabaseEnv>,
19+
>
20+
{
21+
}
22+
23+
/// Convenience trait to aggregate the DB requirements
24+
pub trait NodeTypesDbTrait:
25+
reth_db::database::Database + reth_db::database_metrics::DatabaseMetrics + Clone + Unpin + 'static
26+
{
27+
}
28+
29+
impl<T> NodeTypesDbTrait for T where
30+
T: reth_db::database::Database
31+
+ reth_db::database_metrics::DatabaseMetrics
32+
+ Clone
33+
+ Unpin
34+
+ 'static
35+
{
36+
}

crates/rpc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tokio-util = "0.7.13"
3838
tower-http = { version = "0.6.2", features = ["cors"] }
3939
tracing.workspace = true
4040
serde_json.workspace = true
41+
signet-node-types.workspace = true
4142

4243
[dev-dependencies]
4344
signet-zenith.workspace = true

crates/rpc/src/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
use crate::utils::{serve_axum, serve_ipc, serve_ws};
12
use ajj::{Router, pubsub::ServerShutdown};
23
use reth::{args::RpcServerArgs, tasks::TaskExecutor};
34
use std::net::SocketAddr;
45
use tokio::task::JoinHandle;
56

6-
use crate::util::{serve_axum, serve_ipc, serve_ws};
7-
87
/// Guard to shutdown the RPC servers. When dropped, this will shutdown all
98
/// running servers
109
#[derive(Default)]

crates/rpc/src/ctx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::{
2-
Pnt,
32
eth::EthError,
43
interest::{ActiveFilter, FilterManager, FilterOutput, SubscriptionManager},
54
receipts::build_signet_receipt,
6-
util::BlockRangeInclusiveIter,
5+
utils::BlockRangeInclusiveIter,
76
};
87
use alloy::{
98
consensus::{BlockHeader, Header, Signed, Transaction, TxEnvelope},
@@ -39,6 +38,7 @@ use reth_chainspec::{BaseFeeParams, ChainSpec, ChainSpecProvider};
3938
use reth_node_api::{BlockBody, FullNodeComponents};
4039
use reth_rpc_eth_api::{RpcBlock, RpcConvert, RpcReceipt, RpcTransaction};
4140
use signet_evm::EvmNeedsTx;
41+
use signet_node_types::Pnt;
4242
use signet_tx_cache::client::TxCache;
4343
use signet_types::{MagicSig, constants::SignetSystemConstants};
4444
use std::{marker::PhantomData, sync::Arc};

crates/rpc/src/eth/endpoints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use crate::{
2-
Pnt,
32
ctx::RpcCtx,
43
eth::{CallErrorData, EthError},
54
interest::{FilterOutput, InterestKind},
65
receipts::build_signet_receipt,
7-
util::{await_jh_option, await_jh_option_response, response_tri},
6+
utils::{await_jh_option, await_jh_option_response, response_tri},
87
};
98
use ajj::{HandlerCtx, ResponsePayload};
109
use alloy::{
@@ -28,6 +27,7 @@ use reth_node_api::FullNodeComponents;
2827
use reth_rpc_eth_api::{RpcBlock, RpcHeader, RpcReceipt, RpcTransaction};
2928
use serde::Deserialize;
3029
use signet_evm::EvmErrored;
30+
use signet_node_types::Pnt;
3131
use std::borrow::Cow;
3232
use tracing::{Instrument, debug, trace_span};
3333
use trevm::revm::context::result::ExecutionResult;

crates/rpc/src/eth/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ pub use error::EthError;
77
mod helpers;
88
pub use helpers::CallErrorData;
99

10-
use crate::{Pnt, ctx::RpcCtx};
10+
use crate::ctx::RpcCtx;
1111
use alloy::{eips::BlockNumberOrTag, primitives::B256};
1212
use reth_node_api::FullNodeComponents;
13+
use signet_node_types::Pnt;
1314

1415
/// Instantiate the `eth` API router.
1516
pub fn eth<Host, Signet>() -> ajj::Router<RpcCtx<Host, Signet>>

crates/rpc/src/inspect/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::Pnt;
21
use ajj::serde_json;
32
use eyre::WrapErr;
43
use reth::providers::ProviderFactory;
54
use reth_db::{Database, TableViewer, table::Table};
65
use reth_db_common::{DbTool, ListFilter};
6+
use signet_node_types::Pnt;
77
use std::sync::OnceLock;
88
use tracing::instrument;
99

0 commit comments

Comments
 (0)