Propagate asyncdb feature flag from database-interface to revm #2310
Propagate asyncdb feature flag from database-interface to revm #2310rakita merged 3 commits intobluealloy:mainfrom
Conversation
CodSpeed Performance ReportMerging #2310 will not alter performanceComparing Summary
|
crates/database/interface/Cargo.toml
Outdated
| std = ["serde?/std", "alloy-sol-types/std", "primitives/std", "state/std"] | ||
| serde = ["dep:serde", "primitives/serde", "state/serde"] | ||
| asyncdb = ["dep:tokio"] | ||
| asyncdb = ["dep:tokio", "tokio/rt", "tokio/rt-multi-thread", "tokio/macros", "tokio/sync", "tokio/time"] |
There was a problem hiding this comment.
When trying to run the following:
cargo build -p revm --features asyncdb
I stumbled on lots of failures:
Compiling revm-database-interface v1.0.0 (/Users/mushow/Desktop/Rust/revm/crates/database/interface)
error[E0432]: unresolved imports `tokio::runtime::Handle`, `tokio::runtime::Runtime`
--> crates/database/interface/src/async_db.rs:7:22
|
7 | use tokio::runtime::{Handle, Runtime};
| ^^^^^^ ^^^^^^^ no `Runtime` in `runtime`
| |
| no `Handle` in `runtime`
|
= help: consider importing this variant instead:
crate::async_db::HandleOrRuntime::Handle
= help: consider importing this variant instead:
crate::async_db::HandleOrRuntime::Runtime
error[E0433]: failed to resolve: could not find `RuntimeFlavor` in `runtime`
--> crates/database/interface/src/async_db.rs:93:33
|
93 | tokio::runtime::RuntimeFlavor::CurrentThread => return None,
| ^^^^^^^^^^^^^ could not find `RuntimeFlavor` in `runtime`
|
note: found an item that was configured out
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/runtime/mod.rs:395:32
|
395 | pub use runtime::{Runtime, RuntimeFlavor};
| ^^^^^^^^^^^^^
note: the item is gated behind the `rt` feature
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/runtime/mod.rs:346:1
|
346 | / cfg_rt! {
347 | | pub(crate) mod task;
348 | |
349 | | mod config;
... |
422 | | type Callback = std::sync::Arc<dyn Fn() + Send + Sync>;
423 | | }
| |_^
= note: this error originates in the macro `cfg_rt` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0425]: cannot find function `block_in_place` in module `tokio::task`
--> crates/database/interface/src/async_db.rs:186:50
|
186 | Self::Handle(handle) => tokio::task::block_in_place(move || handle.block_on(f)),
| ^^^^^^^^^^^^^^ not found in `tokio::task`
error[E0603]: module `runtime` is private
--> crates/database/interface/src/async_db.rs:7:12
|
7 | use tokio::runtime::{Handle, Runtime};
| ^^^^^^^ private module
|
note: the module `runtime` is defined here
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/lib.rs:528:5
|
528 | pub(crate) mod runtime;
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0603]: module `runtime` is private
--> crates/database/interface/src/async_db.rs:93:24
|
93 | tokio::runtime::RuntimeFlavor::CurrentThread => return None,
| ^^^^^^^ private module
|
note: the module `runtime` is defined here
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/lib.rs:528:5
|
528 | pub(crate) mod runtime;
| ^^^^^^^^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0425, E0432, E0433, E0603.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `revm-database-interface` (lib) due to 5 previous errors
I added the following:
"tokio/rt-multi-thread"
I didn't realise others were added, the others aren't needed, but without this addition (the one above), it doesn't work.
There was a problem hiding this comment.
Copilot must've tried adding some others, but in reality only rt-multi-thread is needed to avoid the error above.
There was a problem hiding this comment.
@0xMushow did you try to use only rt feature? It is smaller in scope but it should enable Runtime
There was a problem hiding this comment.
Yes, only rt also fails when running the command above:
cargo build -p revm --features asyncdb
Output:
error[E0425]: cannot find function `block_in_place` in module `tokio::task`
--> crates/database/interface/src/async_db.rs:186:50
|
186 | Self::Handle(handle) => tokio::task::block_in_place(move || handle.block_on(f)),
| ^^^^^^^^^^^^^^ not found in `tokio::task`
|
note: found an item that was configured out
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/task/mod.rs:279:27
|
279 | pub use blocking::block_in_place;
| ^^^^^^^^^^^^^^
note: the item is gated behind the `rt-multi-thread` feature
--> /Users/mushow/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.1/src/task/mod.rs:278:5
|
278 | / cfg_rt_multi_thread! {
279 | | pub use blocking::block_in_place;
280 | | }
| |_____^
= note: this error originates in the macro `cfg_rt_multi_thread` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0425`.
error: could not compile `revm-database-interface` (lib) due to 1 previous errorThe multi-thread is needed here:
note: the item is gated behind the
rt-multi-threadfeature
Closes #2309