chore: misc trait bounds (#12347)

This commit is contained in:
Matthias Seitz
2024-11-06 15:27:06 +01:00
committed by GitHub
parent 660ca389e7
commit b5f8c72095

View File

@ -14,16 +14,14 @@ use alloy_eips::merge::SLOT_DURATION;
use alloy_primitives::{Bytes, B256, U256};
use futures_core::ready;
use futures_util::FutureExt;
use reth_chainspec::{ChainSpec, EthereumHardforks};
use reth_chainspec::EthereumHardforks;
use reth_evm::state_change::post_block_withdrawals_balance_increments;
use reth_payload_builder::{KeepPayloadJobAlive, PayloadId, PayloadJob, PayloadJobGenerator};
use reth_payload_primitives::{
BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError, PayloadKind,
};
use reth_primitives::{constants::RETH_CLIENT_VERSION, proofs, SealedHeader, Withdrawals};
use reth_provider::{
BlockReaderIdExt, CanonStateNotification, ProviderError, StateProviderFactory,
};
use reth_provider::{BlockReaderIdExt, CanonStateNotification, StateProviderFactory};
use reth_revm::cached::CachedReads;
use reth_tasks::TaskSpawner;
use reth_transaction_pool::TransactionPool;
@ -991,12 +989,16 @@ impl WithdrawalsOutcome {
/// Returns the withdrawals root.
///
/// Returns `None` values pre shanghai
pub fn commit_withdrawals<DB: Database<Error = ProviderError>>(
pub fn commit_withdrawals<DB, ChainSpec>(
db: &mut State<DB>,
chain_spec: &ChainSpec,
timestamp: u64,
withdrawals: Withdrawals,
) -> Result<WithdrawalsOutcome, DB::Error> {
) -> Result<WithdrawalsOutcome, DB::Error>
where
DB: Database,
ChainSpec: EthereumHardforks,
{
if !chain_spec.is_shanghai_active_at_timestamp(timestamp) {
return Ok(WithdrawalsOutcome::pre_shanghai())
}
@ -1023,7 +1025,7 @@ pub fn commit_withdrawals<DB: Database<Error = ProviderError>>(
///
/// This compares the total fees of the blocks, higher is better.
#[inline(always)]
pub fn is_better_payload(best_payload: Option<impl BuiltPayload>, new_fees: U256) -> bool {
pub fn is_better_payload<T: BuiltPayload>(best_payload: Option<&T>, new_fees: U256) -> bool {
if let Some(best_payload) = best_payload {
new_fees > best_payload.fees()
} else {