Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ trait_duplication_in_bounds = "warn"
transmute_undefined_repr = "warn"
trivial_regex = "warn"
tuple_array_conversions = "warn"
type_repetition_in_bounds = "warn"
uninhabited_references = "warn"
unnecessary_struct_initialization = "warn"
uninlined_format_args = "warn"
Expand Down
14 changes: 6 additions & 8 deletions crates/anvil/src/eth/backend/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2435,10 +2435,10 @@ where
}

// Mining methods — generic over N: Network, with Foundry-associated-type bounds for now.
impl<N: Network> Backend<N>
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>>
Backend<N>
where
Self: TransactionValidator<FoundryTxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
{
/// Mines a new block and stores it.
///
Expand Down Expand Up @@ -3341,9 +3341,8 @@ where
}
}

impl<N: Network> Backend<N>
where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>>
Backend<N>
{
/// Rollback the chain to a common height.
///
Expand Down Expand Up @@ -4064,9 +4063,8 @@ fn get_pool_transactions_nonce(
}

#[async_trait::async_trait]
impl<N: Network> TransactionValidator<FoundryTxEnvelope> for Backend<N>
where
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>>
TransactionValidator<FoundryTxEnvelope> for Backend<N>
{
async fn validate_pool_transaction(
&self,
Expand Down
16 changes: 8 additions & 8 deletions crates/anvil/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ where
filter_eviction_interval: Interval,
}

impl<N: Network> NodeService<N>
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>>
NodeService<N>
where
Backend<N>: TransactionValidator<N::TxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
{
pub fn new(
pool: Arc<Pool<N::TxEnvelope>>,
Expand All @@ -72,10 +72,10 @@ where
}
}

impl<N: Network> Future for NodeService<N>
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>> Future
for NodeService<N>
where
Backend<N>: TransactionValidator<N::TxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
{
type Output = NodeResult<()>;

Expand Down Expand Up @@ -128,20 +128,20 @@ struct BlockProducer<N: Network> {
queued: VecDeque<Vec<Arc<PoolTransaction<N::TxEnvelope>>>>,
}

impl<N: Network> BlockProducer<N>
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>>
BlockProducer<N>
where
Backend<N>: TransactionValidator<N::TxEnvelope>,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope>,
{
fn new(backend: Arc<Backend<N>>) -> Self {
Self { idle_backend: Some(backend), block_mining: None, queued: Default::default() }
}
}

impl<N: Network> Stream for BlockProducer<N>
impl<N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + 'static>
Stream for BlockProducer<N>
where
Backend<N>: TransactionValidator<N::TxEnvelope> + Send + Sync + 'static,
N: Network<TxEnvelope = FoundryTxEnvelope, ReceiptEnvelope = FoundryReceiptEnvelope> + 'static,
{
type Item = MinedBlockOutcome<N::TxEnvelope>;

Expand Down
Loading