Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: relax PayloadBuilderService bound #13456

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use reth_evm::state_change::post_block_withdrawals_balance_increments;
use reth_payload_builder::{KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJobGenerator};
use reth_payload_builder_primitives::PayloadBuilderError;
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes, PayloadKind};
use reth_primitives::{proofs, SealedHeader};
use reth_primitives::{proofs, NodePrimitives, SealedHeader};
use reth_provider::{BlockReaderIdExt, CanonStateNotification, StateProviderFactory};
use reth_revm::cached::CachedReads;
use reth_tasks::TaskSpawner;
Expand Down Expand Up @@ -191,7 +191,7 @@ where
Ok(job)
}

fn on_new_state(&mut self, new_state: CanonStateNotification) {
fn on_new_state<N: NodePrimitives>(&mut self, new_state: CanonStateNotification<N>) {
let mut cached = CachedReads::default();

// extract the state from the notification and put it into the cache
Expand Down
1 change: 1 addition & 0 deletions crates/payload/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true
[dependencies]
# reth
reth-primitives = { workspace = true, optional = true }
reth-primitives-traits.workspace = true
reth-chain-state.workspace = true
reth-payload-builder-primitives.workspace = true
reth-payload-primitives.workspace = true
Expand Down
6 changes: 4 additions & 2 deletions crates/payload/builder/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use reth_payload_builder_primitives::{
Events, PayloadBuilder, PayloadBuilderError, PayloadEvents, PayloadStoreExt,
};
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes, PayloadKind, PayloadTypes};
use reth_primitives_traits::NodePrimitives;
use std::{
fmt,
future::Future,
Expand Down Expand Up @@ -352,12 +353,13 @@ where
}
}

impl<Gen, St, T> Future for PayloadBuilderService<Gen, St, T>
impl<Gen, St, T, N> Future for PayloadBuilderService<Gen, St, T>
where
T: PayloadTypes,
N: NodePrimitives,
Gen: PayloadJobGenerator + Unpin + 'static,
<Gen as PayloadJobGenerator>::Job: Unpin + 'static,
St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
St: Stream<Item = CanonStateNotification<N>> + Send + Unpin + 'static,
Gen::Job: PayloadJob<PayloadAttributes = T::PayloadBuilderAttributes>,
<Gen::Job as PayloadJob>::BuiltPayload: Into<T::BuiltPayload>,
{
Expand Down
3 changes: 2 additions & 1 deletion crates/payload/builder/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use reth_chain_state::CanonStateNotification;
use reth_payload_builder_primitives::PayloadBuilderError;
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes, PayloadKind};
use reth_primitives_traits::NodePrimitives;
use std::future::Future;

/// A type that can build a payload.
Expand Down Expand Up @@ -105,7 +106,7 @@ pub trait PayloadJobGenerator: Send + Sync {
///
/// This is intended for any logic that needs to be run when the chain state changes or used to
/// use the in memory state for the head block.
fn on_new_state(&mut self, new_state: CanonStateNotification) {
fn on_new_state<N: NodePrimitives>(&mut self, new_state: CanonStateNotification<N>) {
let _ = new_state;
}
}
Loading