alloy-rs / alloy-rs/evm

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

オープン
#157 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Rust
スター
83
フォーク
106
平均マージ
36分
マージ済み PR(30日)
2

説明

### 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`.

https://github.com/alloy-rs/evm/blob/224bf74d78c3d901e3855e7932d1d8f82d75f553/crates/evm/src/evm.rs#L197

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`.

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_

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。