Skip to content

Commit dc3d42f

Browse files
authored
fix: pnt now specified generically again (#19)
1 parent d3fcc27 commit dc3d42f

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

crates/node-types/src/utils.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
11
use reth::{primitives::EthPrimitives, providers::providers::ProviderNodeTypes};
22
use reth_chainspec::ChainSpec;
3-
use reth_db::mdbx;
4-
use std::sync::Arc;
53

64
/// Convenience trait for specifying the [`ProviderNodeTypes`] implementation
75
/// required for Signet functionality. This is used to condense many trait
86
/// bounds.
9-
pub trait Pnt:
10-
ProviderNodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives, DB = Arc<mdbx::DatabaseEnv>>
11-
{
12-
}
7+
pub trait Pnt: ProviderNodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives> {}
138

14-
impl<T> Pnt for T where
15-
T: ProviderNodeTypes<
16-
ChainSpec = ChainSpec,
17-
Primitives = EthPrimitives,
18-
DB = Arc<mdbx::DatabaseEnv>,
19-
>
20-
{
21-
}
9+
impl<T> Pnt for T where T: ProviderNodeTypes<ChainSpec = ChainSpec, Primitives = EthPrimitives> {}
2210

2311
/// Convenience trait to aggregate the DB requirements
2412
pub trait NodeTypesDbTrait:

crates/rpc/src/inspect/db.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use ajj::serde_json;
22
use eyre::WrapErr;
3-
use reth::providers::ProviderFactory;
4-
use reth_db::{Database, TableViewer, table::Table};
3+
use reth::providers::{ProviderFactory, providers::ProviderNodeTypes};
4+
use reth_db::{Database, TableViewer, mdbx, table::Table};
55
use reth_db_common::{DbTool, ListFilter};
66
use signet_node_types::Pnt;
7-
use std::sync::OnceLock;
7+
use std::sync::{Arc, OnceLock};
88
use tracing::instrument;
99

1010
/// Modeled on the `Command` struct from `reth/crates/cli/commands/src/db/list.rs`
@@ -95,7 +95,9 @@ impl<'a, 'b, N: Pnt> ListTableViewer<'a, 'b, N> {
9595
}
9696
}
9797

98-
impl<N: Pnt> TableViewer<()> for ListTableViewer<'_, '_, N> {
98+
impl<N: Pnt + ProviderNodeTypes<DB = Arc<mdbx::DatabaseEnv>>> TableViewer<()>
99+
for ListTableViewer<'_, '_, N>
100+
{
99101
type Error = eyre::Report;
100102

101103
#[instrument(skip(self), err)]

crates/rpc/src/inspect/endpoints.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
use std::sync::Arc;
2+
13
use crate::{
24
RpcCtx,
35
inspect::db::{DbArgs, ListTableViewer},
46
utils::{await_jh_option_response, response_tri},
57
};
68
use ajj::{HandlerCtx, ResponsePayload};
9+
use reth::providers::providers::ProviderNodeTypes;
10+
use reth_db::mdbx;
711
use reth_node_api::FullNodeComponents;
812
use signet_node_types::Pnt;
913

@@ -15,7 +19,7 @@ pub(super) async fn db<Host, Signet>(
1519
) -> ResponsePayload<Box<serde_json::value::RawValue>, String>
1620
where
1721
Host: FullNodeComponents,
18-
Signet: Pnt,
22+
Signet: Pnt + ProviderNodeTypes<DB = Arc<mdbx::DatabaseEnv>>,
1923
{
2024
let task = async move {
2125
let table: reth_db::Tables = response_tri!(args.table(), "invalid table name");

crates/rpc/src/inspect/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ pub(crate) mod db;
22

33
mod endpoints;
44

5+
use std::sync::Arc;
6+
57
use crate::RpcCtx;
8+
use reth::providers::providers::ProviderNodeTypes;
9+
use reth_db::mdbx;
610
use reth_node_api::FullNodeComponents;
711
use signet_node_types::Pnt;
812

913
/// Instantiate the `inspect` API router.
1014
pub fn inspect<Host, Signet>() -> ajj::Router<RpcCtx<Host, Signet>>
1115
where
1216
Host: FullNodeComponents,
13-
Signet: Pnt,
17+
Signet: Pnt + ProviderNodeTypes<DB = Arc<mdbx::DatabaseEnv>>,
1418
{
1519
ajj::Router::new().route("db", endpoints::db::<Host, Signet>)
1620
}

crates/rpc/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
5151

5252
mod config;
53+
5354
pub use config::{RpcServerGuard, ServeConfig};
5455

5556
mod ctx;
@@ -75,8 +76,11 @@ pub mod utils;
7576
pub use ::ajj;
7677

7778
use ajj::Router;
79+
use reth::providers::providers::ProviderNodeTypes;
80+
use reth_db::mdbx::DatabaseEnv;
7881
use reth_node_api::FullNodeComponents;
7982
use signet_node_types::Pnt;
83+
use std::sync::Arc;
8084

8185
/// Create a new router with the given host and signet types.
8286
pub fn router<Host, Signet>() -> Router<ctx::RpcCtx<Host, Signet>>
@@ -91,7 +95,7 @@ where
9195
pub fn hazmat_router<Host, Signet>() -> Router<ctx::RpcCtx<Host, Signet>>
9296
where
9397
Host: FullNodeComponents,
94-
Signet: Pnt,
98+
Signet: Pnt + ProviderNodeTypes<DB = Arc<DatabaseEnv>>,
9599
{
96100
ajj::Router::new().nest("inspect", inspect::inspect::<Host, Signet>())
97101
}

0 commit comments

Comments
 (0)