mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(exex): relax ExExContext trait bounds (#12055)
This commit is contained in:
@ -70,8 +70,6 @@ where
|
||||
impl<Node> ExExContext<Node>
|
||||
where
|
||||
Node: FullNodeComponents,
|
||||
Node::Provider: Debug,
|
||||
Node::Executor: Debug,
|
||||
{
|
||||
/// Returns the transaction pool of the node.
|
||||
pub fn pool(&self) -> &Node::Pool {
|
||||
@ -123,3 +121,34 @@ where
|
||||
self.notifications.set_with_head(head);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use reth_exex_types::ExExHead;
|
||||
use reth_node_api::FullNodeComponents;
|
||||
|
||||
use crate::ExExContext;
|
||||
|
||||
/// <https://github.com/paradigmxyz/reth/issues/12054>
|
||||
#[test]
|
||||
const fn issue_12054() {
|
||||
#[allow(dead_code)]
|
||||
struct ExEx<Node: FullNodeComponents> {
|
||||
ctx: ExExContext<Node>,
|
||||
}
|
||||
|
||||
impl<Node: FullNodeComponents> ExEx<Node> {
|
||||
async fn _test_bounds(mut self) -> eyre::Result<()> {
|
||||
self.ctx.pool();
|
||||
self.ctx.block_executor();
|
||||
self.ctx.provider();
|
||||
self.ctx.network();
|
||||
self.ctx.payload_builder();
|
||||
self.ctx.task_executor();
|
||||
self.ctx.set_notifications_without_head();
|
||||
self.ctx.set_notifications_with_head(ExExHead { block: Default::default() });
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ impl Debug for ExExContextDyn {
|
||||
.field("config", &self.config)
|
||||
.field("reth_config", &self.reth_config)
|
||||
.field("events", &self.events)
|
||||
.field("notifications", &self.notifications)
|
||||
.field("notifications", &"...")
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,9 +24,7 @@ pub struct ExExNotifications<P, E> {
|
||||
/// A trait, that represents a stream of [`ExExNotification`]s. The stream will emit notifications
|
||||
/// for all blocks. If the stream is configured with a head via [`ExExNotifications::set_with_head`]
|
||||
/// or [`ExExNotifications::with_head`], it will run backfill jobs to catch up to the node head.
|
||||
pub trait ExExNotificationsStream:
|
||||
Debug + Stream<Item = eyre::Result<ExExNotification>> + Unpin
|
||||
{
|
||||
pub trait ExExNotificationsStream: Stream<Item = eyre::Result<ExExNotification>> + Unpin {
|
||||
/// Sets [`ExExNotificationsStream`] to a stream of [`ExExNotification`]s without a head.
|
||||
///
|
||||
/// It's a no-op if the stream has already been configured without a head.
|
||||
@ -92,8 +90,8 @@ impl<P, E> ExExNotifications<P, E> {
|
||||
|
||||
impl<P, E> ExExNotificationsStream for ExExNotifications<P, E>
|
||||
where
|
||||
P: BlockReader + HeaderProvider + StateProviderFactory + Clone + Debug + Unpin + 'static,
|
||||
E: BlockExecutorProvider + Clone + Debug + Unpin + 'static,
|
||||
P: BlockReader + HeaderProvider + StateProviderFactory + Clone + Unpin + 'static,
|
||||
E: BlockExecutorProvider + Clone + Unpin + 'static,
|
||||
{
|
||||
fn set_without_head(&mut self) {
|
||||
let current = std::mem::replace(&mut self.inner, ExExNotificationsInner::Invalid);
|
||||
|
||||
Reference in New Issue
Block a user