Skip to content

[Feature] change EvmFactory trait to let implementers use a stricter trait for the generic DB to give to the EVM #157

@alessandromazza98

Description

@alessandromazza98

Describe the feature you would like

Right now the EvmFactory trait in the alloy-evm crate has an associated type called Evm that has a generic DB: alloy_evm::Database.

type Evm<DB: Database, I: Inspector<Self::Context<DB>>>: Evm<

This makes it impossible in the concrete implementation to use a trait that is stricter than the alloy_evm::Database trait because of how Rust compiler works with generic defined on associated types (instead of the generic being defined in the trait itself - something like pub trait EvmFactory<DB: Database>.

Do you think it could make sense to change the trait such that it lets implementers use a stricter (meaning it's at least Database, but it may have additional requirements such as thread safety Send + Sync or clonable Clone) trait on the DB.

I'm down to help here if you give me some guidance and find the proposal appealing.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions