Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate asyncdb feature flag from database-interface to revm #2310

Merged
merged 3 commits into from
Mar 26, 2025

Conversation

0xMushow
Copy link
Contributor

Closes #2309

Copy link

codspeed-hq bot commented Mar 25, 2025

CodSpeed Performance Report

Merging #2310 will not alter performance

Comparing 0xMushow:propagate-asyncdb-ff (71c4669) with main (6f38322)

Summary

✅ 8 untouched benchmarks

@@ -45,4 +45,4 @@ alloy-sol-types.workspace = true
default = ["std"]
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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add all of those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot must've tried adding some others, but in reality only rt-multi-thread is needed to avoid the error above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rt-multi-thread makes sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xMushow did you try to use only rt feature? It is smaller in scope but it should enable Runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 error

The multi-thread is needed here:

note: the item is gated behind the rt-multi-thread feature

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for checking!

@rakita rakita merged commit 76e1266 into bluealloy:main Mar 26, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagate asyncdb feature flag from database-interface to revm
2 participants