-
Notifications
You must be signed in to change notification settings - Fork 97
Remove the 'async-std' due to deprecation #7094
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
Remove the 'async-std' due to deprecation #7094
Conversation
📝 Walkthrough## Walkthrough
This change removes all support for the `async-std` asynchronous runtime and related libraries throughout the codebase, standardizing exclusively on the `tokio` runtime for all features, dependencies, and tests. All code, tests, and configuration files are updated to use `tokio` and its associated ecosystem, with related HTTP clients switched from `surf` to `reqwest`.
## Changes
| File(s) / Path(s) | Change Summary |
|------------------------------------------------------|---------------|
| Cargo.toml, Makefile, nix/rust-package.nix | Updated dependency versions, removed `async-std` feature flags, and standardized on `tokio` for testing and build scripts. |
| **chain/actions/\***, **chain/api/\***, **chain/indexer/\***, **chain/rpc/\*** | Removed `runtime-async-std` features, dependencies, and test attributes; switched all async runtime usage and HTTP clients in code and tests from `async-std`/`surf` to `tokio`/`reqwest`. |
| common/async-runtime/src/lib.rs | Deprecated the `runtime-async-std` prelude module and removed its conditional compilation in favor of always enabling the `tokio` prelude when the feature is active. |
| **common/network-types/\*** | Removed all async-std-based DNS resolution and test code, eliminated `async-std` dependencies, and migrated all tests and async utilities to `tokio`. |
| **common/parallelize/Cargo.toml**, **crypto/packet/Cargo.toml**, **db/entity/Cargo.toml**, **db/migration/Cargo.toml**, **db/sql/Cargo.toml**, **hopli/Cargo.toml**, **hopr/hopr-lib/Cargo.toml**, **hoprd/db/api/Cargo.toml**, **hoprd/db/entity/Cargo.toml**, **hoprd/db/migration/Cargo.toml**, **hoprd/hoprd/Cargo.toml**, **hoprd/inbox/Cargo.toml**, **logic/path/Cargo.toml**, **logic/strategy/Cargo.toml**, **transport/api/Cargo.toml**, **transport/mixer/Cargo.toml**, **transport/network/Cargo.toml**, **transport/p2p/Cargo.toml**, **transport/protocol/Cargo.toml**, **transport/session/Cargo.toml**, **transport/ticket-aggregation/Cargo.toml** | Removed `async-std` and `runtime-async-std` features and dependencies from all crate manifests; replaced with `tokio` and `runtime-tokio` as appropriate. |
| **db/sql/src/\***, **hoprd/db/api/src/\***, **logic/strategy/src/\***, **transport/session/src/\***, **transport/protocol/src/\***, **transport/network/src/\***, **transport/mixer/src/\***, **transport/ticket-aggregation/src/\***, **crypto/packet/src/\***, **logic/path/src/\*** | Migrated all async test code and utilities from `async-std` to `tokio`, updated test attributes, task spawning, sleep, and timeout handling accordingly. |
| chain/rpc/src/client.rs | Removed the `surf_client` module and all usage of the `SurfRequestor` HTTP client; all HTTP client usage is now via `ReqwestRequestor`. |
| hopli/src/environment_config.rs, hopli/src/methods.rs, hopli/src/main.rs | Updated imports and runtime attributes to use `tokio` and `DefaultHttpRequestor` from the new source; migrated all async test code to `tokio`. |
| hopr/hopr-lib/tests/\*, hopr/hopr-lib/tests/common/mod.rs | Switched all test HTTP clients from `SurfRequestor` to `ReqwestRequestor`; updated test runtime attributes to `tokio`. |
| transport/p2p/src/swarm.rs | Removed async-std-specific swarm construction code; now always uses tokio-based swarm. |
| transport/p2p/tests/p2p_transport_test.rs | Migrated all test runtime and utilities from `async-std` to `tokio`; updated join handle and task management accordingly. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Test as Test Function
participant Tokio as Tokio Runtime
participant Reqwest as Reqwest HTTP Client
participant App as Application Code
Test->>Tokio: #[tokio::test] async fn test_...()
Note right of Tokio: Test code runs in Tokio runtime
Test->>Reqwest: Instantiate ReqwestRequestor
Reqwest->>App: Make HTTP request
App-->>Reqwest: Process request/response
Reqwest-->>Test: Return result
Test->>Tokio: Spawn async tasks, sleep, timeout (Tokio APIs)
Note right of Test: All async utilities via Tokio Possibly related PRs
Suggested labels
Suggested reviewers
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes support for the deprecated async-std runtime and migrates test and runtime usage to the tokio runtime. Key changes include replacing async-std test attributes and task/spawn/sleep calls with tokio equivalents, removing async-std-related dependencies from Cargo.toml files, and updating client usages from SurfRequestor to ReqwestRequestor.
Reviewed Changes
Copilot reviewed 95 out of 96 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
common/network-types/src/session/frame.rs | Updates test attributes and sleep calls to use tokio |
common/network-types/Cargo.toml | Removes async-std resolver dependency |
common/async-runtime/src/lib.rs | Deprecates async-std module with a note |
chain/rpc/src/rpc.rs | Updates test attributes, sleep calls, and client usage |
chain/rpc/src/indexer.rs | Migrates test attributes and updates timeout usage for tokio |
chain/rpc/src/client.rs | Removes SurfRequestor usage in favor of ReqwestRequestor |
chain/rpc/Cargo.toml | Removes async-std dependencies and updates runtime configuration |
chain/indexer/src/handlers.rs | Migrates test attributes to tokio |
chain/indexer/src/block.rs | Migrates test attributes and sleep calls to tokio for async tests |
chain/indexer/Cargo.toml | Removes async-std dependencies and updates runtime configuration |
chain/api/src/lib.rs | Adjusts default HTTP requestor to use ReqwestRequestor |
chain/api/Cargo.toml | Removes async-std dependencies and updates runtime configuration |
chain/actions/src/redeem.rs | Migrates test attributes and spawn calls to tokio |
chain/actions/src/payload.rs | Updates test attributes and client usage from SurfRequestor to ReqwestClient |
chain/actions/src/node.rs | Migrates test attributes and spawn calls to tokio |
chain/actions/src/channels.rs | Migrates test attributes and spawn calls to tokio |
chain/actions/src/action_state.rs | Updates test attributes and timeout calls to tokio runtime |
chain/actions/Cargo.toml | Removes async-std dependencies and updates runtime configuration |
Cargo.toml | Updates dependency features to use tokio instead of async-std |
Files not reviewed (1)
- Makefile: Language not supported
3a9f77f
to
b70c3c7
Compare
aae0999
to
a05a042
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
transport/mixer/benches/mixer_throughput.rs (2)
43-46
:⚠️ Potential issueRuntime mismatch will panic – replace
AsyncStdExecutor
with a Tokio executor
tokio::task::spawn
(l. 77) andtokio::time::sleep
(l. 119) require an active Tokio runtime.
Running them insidecriterion::async_executor::AsyncStdExecutor
results inthread panicked at 'there is no reactor running, must be called from the context of a Tokio runtime'
Switch the benchmark to Criterion’s Tokio executor (or roll your own runtime, as the other bench does):
- let runtime = criterion::async_executor::AsyncStdExecutor {}; + let runtime = criterion::async_executor::TokioExecutor::new() + .expect("Tokio executor must be constructible");or
- let runtime = criterion::async_executor::AsyncStdExecutor {}; + let runtime = tokio::runtime::Runtime::new() + .expect("Tokio runtime must be constructible");and pass the corresponding executor to
b.to_async(runtime)
.Failing to do so will make every benchmark panic at the first
spawn
call.Also applies to: 77-80
87-88
:⚠️ Potential issue
cancel()
is from async-std – useabort()
for TokioJoinHandle
tokio::task::JoinHandle
exposesabort()
(non-async) instead ofcancel().await
.- pipe.cancel().await; + pipe.abort();
♻️ Duplicate comments (2)
transport/protocol/tests/msg_ack_workflows.rs (1)
15-17
: Same remark as aboveApply the same
flavor = "current_thread"
tweak here for consistency.chain/rpc/src/indexer.rs (1)
411-412
: Timeout handling correctly updated to Tokio pattern.The timeout pattern has been correctly updated from
future.timeout(Duration).await??
(async-std style) totimeout(Duration, future).await???
(tokio style). The triple question marks are correct here as they handle:
- The Result from timeout (did the operation time out?)
- The Result from the spawned task
- The Result from the operation inside the task
This matches the user's confirmation from the previous review.
Also applies to: 546-547
🧹 Nitpick comments (11)
logic/path/Cargo.toml (1)
53-53
: Ensure Tokio dev-dependency includes necessary features for tests.You’ve added
tokio = { workspace = true }
as a dev-dependency, but#[tokio::test]
and the Tokio runtime require at least themacros
and an executor feature (e.g.,rt
orrt-multi-thread
). Please verify that the workspacetokio
default features cover this, or explicitly enable them:tokio = { workspace = true, default-features = false, features = ["macros", "rt-multi-thread", "time"] }crypto/packet/Cargo.toml (1)
44-44
: Verify Tokio dev-dependency configuration.Adding
tokio = { workspace = true }
under[dev-dependencies]
is correct for migrating tests, but please confirm that the Tokio crate in the workspace is built with themacros
and runtime features required by#[tokio::test]
. Otherwise, specify:tokio = { workspace = true, default-features = false, features = ["macros", "rt-multi-thread", "time"] }hoprd/db/entity/Cargo.toml (1)
15-15
: Addtokio
build-dependency for async build script.Including
tokio
under[build-dependencies]
is appropriate ifbuild.rs
now uses#[tokio::main]
or other Tokio macros. Please verify the workspacetokio
crate enables themacros
and runtime features needed at build time.transport/protocol/tests/msg_ack_workflows.rs (1)
6-8
: Prefer the single-threaded Tokio runtime for serialised tests
serial_test::serial
guarantees tests run one-at-a-time, yet the default#[tokio::test]
spins up a multi-threaded runtime.
Using the current-thread flavour avoids spawning extra threads, reduces scheduler noise and still plays nicely withserial_test
.-#[tokio::test] +#[tokio::test(flavor = "current_thread")]hoprd/db/entity/build.rs (2)
42-44
: Build-script: favour the single-threaded runtime to cut compile-time overheadA build-script rarely needs Tokio’s full multi-threaded scheduler.
Reducing it to a current-thread runtime trims compile time and avoids spawning extra threads duringcargo build
.-#[tokio::main] +#[tokio::main(flavor = "current_thread")]
8-8
: Unused import:clap::Parser
Parser
is imported but never used anymore after the refactor.
Removing it eliminates a warning and an unnecessary dependency onclap
in the build-script.transport/protocol/benches/protocol_throughput_emulated.rs (1)
36-37
: Consider constraining the Tokio runtime to 1 worker threadThe benchmark creates a fresh Tokio runtime per iteration.
Using a single-threaded runtime (Runtime::new()
defaults to multi-thread) reduces thread churn and may yield more stable measurements:let runtime = tokio::runtime::Builder::new_current_thread() .enable_all() .build() .expect("Tokio runtime must be constructible");hoprd/db/api/Cargo.toml (1)
39-39
: Consider addressing the TODO comment.There's a comment suggesting that the
hopr-async-runtime
dependency might be removable. Consider investigating whether this dependency is actually needed now that the codebase has migrated to tokio.chain/rpc/src/client.rs (1)
881-909
: Trim down the wall-clock duration of the block-generation testThe test sleeps three times for a whole second, making the suite ~3 s slower.
A shorter interval (e.g. 100–250 ms) is sufficient to advance Anvil blocks deterministically while speeding up CI.- let block_time = Duration::from_secs(1); + // 100 ms keeps the semantics but runs faster + let block_time = Duration::from_millis(100);logic/path/src/lib.rs (2)
461-465
: Consider avoiding per-test runtime constructionEach sync test builds a fresh multi-thread Tokio runtime, which is relatively heavy and can’t run inside an existing runtime.
Ifparameterized
gains async support (or you switch toparameterized_async
), you could write:#[parameterized(hops = { 1, 2, 3 })] #[tokio::test] async fn validated_path_multi_hop_validation(hops: usize) { … }Until then,
tokio_test::block_on
or a lazily-initialised global runtime would cut overhead.Also applies to: 499-507, 531-534
600-608
: Nit: reuse the created runtimeBoth
.block_on
calls can share the existingruntime
value instead of creating a second one, saving a few milliseconds.- let validated_2 = tokio::runtime::Runtime::new() - .expect("runtime must exist") - .block_on(ValidatedPath::new(validated_1.clone(), &cg, PATH_ADDRS.deref()))?; + let validated_2 = runtime.block_on(ValidatedPath::new(validated_1.clone(), &cg, PATH_ADDRS.deref()))?;Also applies to: 622-624
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (95)
Cargo.toml
(1 hunks)Makefile
(1 hunks)chain/actions/Cargo.toml
(1 hunks)chain/actions/src/action_state.rs
(7 hunks)chain/actions/src/channels.rs
(20 hunks)chain/actions/src/node.rs
(6 hunks)chain/actions/src/payload.rs
(4 hunks)chain/actions/src/redeem.rs
(14 hunks)chain/api/Cargo.toml
(1 hunks)chain/api/src/lib.rs
(1 hunks)chain/indexer/Cargo.toml
(1 hunks)chain/indexer/src/block.rs
(8 hunks)chain/indexer/src/handlers.rs
(33 hunks)chain/rpc/Cargo.toml
(1 hunks)chain/rpc/src/client.rs
(18 hunks)chain/rpc/src/indexer.rs
(13 hunks)chain/rpc/src/rpc.rs
(17 hunks)common/async-runtime/src/lib.rs
(2 hunks)common/network-types/Cargo.toml
(0 hunks)common/network-types/src/session/frame.rs
(19 hunks)common/network-types/src/session/state.rs
(14 hunks)common/network-types/src/session/utils.rs
(6 hunks)common/network-types/src/types.rs
(0 hunks)common/network-types/src/utils.rs
(4 hunks)common/parallelize/Cargo.toml
(0 hunks)crypto/packet/Cargo.toml
(1 hunks)crypto/packet/src/validation.rs
(7 hunks)db/entity/Cargo.toml
(0 hunks)db/migration/Cargo.toml
(1 hunks)db/migration/src/main.rs
(1 hunks)db/sql/Cargo.toml
(1 hunks)db/sql/src/accounts.rs
(12 hunks)db/sql/src/channels.rs
(5 hunks)db/sql/src/db.rs
(3 hunks)db/sql/src/info.rs
(6 hunks)db/sql/src/logs.rs
(11 hunks)db/sql/src/peers.rs
(10 hunks)db/sql/src/registry.rs
(2 hunks)db/sql/src/resolver.rs
(6 hunks)db/sql/src/ticket_manager.rs
(1 hunks)db/sql/src/tickets.rs
(56 hunks)hopli/Cargo.toml
(2 hunks)hopli/src/environment_config.rs
(5 hunks)hopli/src/main.rs
(1 hunks)hopli/src/methods.rs
(28 hunks)hopr/hopr-lib/Cargo.toml
(1 hunks)hopr/hopr-lib/tests/chain_integration_tests.rs
(3 hunks)hopr/hopr-lib/tests/common/mod.rs
(3 hunks)hopr/hopr-lib/tests/node_integration_tests.rs
(1 hunks)hoprd/db/api/Cargo.toml
(1 hunks)hoprd/db/api/src/aliases.rs
(13 hunks)hoprd/db/api/src/db.rs
(1 hunks)hoprd/db/entity/Cargo.toml
(1 hunks)hoprd/db/entity/build.rs
(4 hunks)hoprd/db/migration/Cargo.toml
(1 hunks)hoprd/db/migration/src/main.rs
(1 hunks)hoprd/hoprd/Cargo.toml
(0 hunks)hoprd/hoprd/src/main.rs
(1 hunks)hoprd/inbox/Cargo.toml
(1 hunks)hoprd/inbox/src/inbox.rs
(2 hunks)hoprd/inbox/src/ring.rs
(13 hunks)hoprd/rest-api/Cargo.toml
(1 hunks)logic/path/Cargo.toml
(1 hunks)logic/path/src/lib.rs
(7 hunks)logic/path/src/selectors/dfs.rs
(11 hunks)logic/strategy/Cargo.toml
(1 hunks)logic/strategy/src/aggregating.rs
(11 hunks)logic/strategy/src/auto_funding.rs
(1 hunks)logic/strategy/src/auto_redeeming.rs
(6 hunks)logic/strategy/src/channel_finalizer.rs
(1 hunks)logic/strategy/src/promiscuous.rs
(2 hunks)logic/strategy/src/strategy.rs
(2 hunks)nix/rust-package.nix
(1 hunks)transport/api/Cargo.toml
(1 hunks)transport/mixer/Cargo.toml
(1 hunks)transport/mixer/benches/mixer_throughput.rs
(2 hunks)transport/mixer/src/channel.rs
(10 hunks)transport/network/Cargo.toml
(1 hunks)transport/network/src/heartbeat.rs
(3 hunks)transport/network/src/network.rs
(16 hunks)transport/network/src/ping.rs
(11 hunks)transport/p2p/Cargo.toml
(1 hunks)transport/p2p/src/swarm.rs
(1 hunks)transport/p2p/tests/p2p_transport_test.rs
(1 hunks)transport/protocol/Cargo.toml
(1 hunks)transport/protocol/benches/protocol_throughput_emulated.rs
(3 hunks)transport/protocol/src/processor.rs
(3 hunks)transport/protocol/src/stream.rs
(1 hunks)transport/protocol/tests/common/mod.rs
(4 hunks)transport/protocol/tests/msg_ack_workflows.rs
(2 hunks)transport/session/Cargo.toml
(1 hunks)transport/session/src/manager.rs
(19 hunks)transport/session/src/types.rs
(4 hunks)transport/ticket-aggregation/Cargo.toml
(1 hunks)transport/ticket-aggregation/src/lib.rs
(7 hunks)
💤 Files with no reviewable changes (5)
- common/network-types/Cargo.toml
- db/entity/Cargo.toml
- hoprd/hoprd/Cargo.toml
- common/network-types/src/types.rs
- common/parallelize/Cargo.toml
🧰 Additional context used
🧠 Learnings (12)
transport/p2p/Cargo.toml (1)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
chain/api/Cargo.toml (2)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
transport/api/Cargo.toml (3)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: common/primitive-types/Cargo.toml:24-24
Timestamp: 2024-11-01T09:32:55.651Z
Learning: In the hoprnet project, dependency versions are defined in the workspace Cargo.toml, so it's not necessary to specify them in individual package Cargo.toml files.
transport/session/Cargo.toml (1)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
chain/indexer/Cargo.toml (1)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
chain/actions/Cargo.toml (1)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
chain/indexer/src/handlers.rs (1)
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6511
File: tests/test_integration.py:1182-1198
Timestamp: 2024-10-01T04:47:11.992Z
Learning: In the test `test_hoprd_should_not_accept_tickets_with_lower_than_min_win_prob`, the relay's `rejected_tickets_value` and `unredeemed_value` are already being verified to ensure tickets are rejected and the unredeemed value does not increase.
transport/network/Cargo.toml (1)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
hopr/hopr-lib/Cargo.toml (1)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
logic/strategy/Cargo.toml (1)
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
hoprd/db/api/Cargo.toml (2)
Learnt from: Teebor-Choka
PR: hoprnet/hoprnet#6345
File: hopr-socks/hopr-socks-server/Cargo.toml:20-20
Timestamp: 2024-06-21T20:51:35.871Z
Learning: All code and packages in the `hoprnet` project should use the workspace level dependency of `reqwest`.
Learnt from: tolbrino
PR: hoprnet/hoprnet#6399
File: chain/api/Cargo.toml:50-53
Timestamp: 2024-11-01T15:26:53.058Z
Learning: In `chain/api/Cargo.toml`, it's acceptable to declare the same dependency `hopr-db-sql` in both `[dependencies]` and `[dev-dependencies]` with different features, especially when additional features are only needed for tests.
chain/rpc/src/client.rs (1)
Learnt from: NumberFour8
PR: hoprnet/hoprnet#6292
File: chain/actions/src/payload.rs:596-596
Timestamp: 2024-07-28T07:26:06.634Z
Learning: The `SurfRequestor` in the `chain_rpc::client::surf_client` module implements the `Debug` trait.
🧬 Code Graph Analysis (2)
transport/mixer/benches/mixer_throughput.rs (1)
transport/mixer/src/config.rs (1)
random_delay
(30-40)
hoprd/db/entity/build.rs (4)
db/migration/src/main.rs (1)
main
(4-6)hoprd/db/migration/src/main.rs (1)
main
(4-6)hopli/src/main.rs (1)
main
(65-99)db/entity/build.rs (2)
main
(64-138)execute_sea_orm_cli_command
(11-62)
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: hoprd / docker
- GitHub Check: hopli / docker
- GitHub Check: zizmor
- GitHub Check: Docs / Rust docs
- GitHub Check: tests-smoke-websocket
- GitHub Check: tests-smart-contracts
- GitHub Check: tests-unit-nightly
- GitHub Check: Linter
- GitHub Check: tests-unit
- GitHub Check: Cargo Audit
- GitHub Check: Cargo Audit
🔇 Additional comments (258)
hoprd/inbox/Cargo.toml (1)
29-29
: Add Tokio as a dev-dependency to support async tests
Switching the test runtime to Tokio requires addingtokio
under[dev-dependencies]
. This ensures that any test modules annotated with#[tokio::test]
can compile and run.transport/mixer/Cargo.toml (2)
32-32
: Introducetokio
for async test support
Addingtokio
as a dev-dependency aligns this crate’s benchmarks and tests with the Tokio runtime, replacing any previousasync-std
runtime expectations.
34-34
: Updatecriterion
to use Tokio under the hood
Changing thecriterion
features to["async_futures", "async_tokio"]
ensures benchmarks use Tokio’s async executor rather thanasync-std
.transport/network/Cargo.toml (2)
44-44
: Addtokio
to dev-dependencies for async tests
Includingtokio
here ensures that any tests using#[tokio::test]
compile successfully and run on the Tokio runtime.
47-47
: Switchhopr-db-sql
toruntime-tokio
The dev-dependency onhopr-db-sql
now specifiesfeatures = ["runtime-tokio"]
, which complements the project-wide migration offasync-std
.transport/api/Cargo.toml (1)
81-88
: Standardize dev-dependencies onruntime-tokio
feature
You’ve updatedhopr-db-sql
,hopr-transport-network
,hopr-transport-protocol
,hopr-transport-p2p
, andhopr-transport-ticket-aggregation
to usefeatures = ["runtime-tokio"]
. This aligns with the removal ofasync-std
. Ensure all test modules have been updated to#[tokio::test]
and remove any leftoverasync-std
imports or annotations.hopr/hopr-lib/Cargo.toml (1)
85-90
: Update dev-dependencies for Tokio migration
The new dev-dependencies (hopr-crypto-types
,hopr-crypto-random
,hopr-db-sql
withruntime-tokio
, andhopr-transport-session
withruntime-tokio
) ensure test and integration code compiles against Tokio. This change is consistent with the crate’s transition offasync-std
.hoprd/db/api/src/db.rs (1)
76-76
: Replaceasync-std
test attribute withtokio::test
.Switching the test macro to
#[tokio::test]
aligns with the runtime migration. Ensure thattokio
is available in dev-dependencies (with the proper features) so this attribute and the async execution work correctly.transport/protocol/src/stream.rs (1)
200-200
: Update async test macro to#[tokio::test]
.Changing the test to use
#[tokio::test]
is consistent with the migration. Confirm that returninganyhow::Result<()>
is compatible with the Tokio test runner (latest versions support-> Result<(), E>
).hoprd/db/migration/Cargo.toml (1)
16-16
: Dependency addition looks good.The addition of
tokio
as a workspace dependency aligns with the PR's objective to migrate fromasync-std
totokio
runtime across the codebase.logic/strategy/src/auto_funding.rs (1)
161-161
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the broader migration from async-std to tokio runtime.db/sql/src/channels.rs (5)
364-364
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
388-388
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
415-415
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
430-430
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
457-457
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.logic/strategy/src/auto_redeeming.rs (6)
273-273
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the broader migration from async-std to tokio runtime.
303-303
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
337-337
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
371-371
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
423-423
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.
468-468
: Test runtime migration looks good.The test attribute has been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to tokio runtime.hoprd/rest-api/Cargo.toml (1)
24-24
: Correct runtime feature flag change.The feature flag change from
runtime-async-std
toruntime-tokio
is consistent with the PR objective to transition from the async-std runtime to the tokio runtime.db/migration/Cargo.toml (1)
17-19
: Appropriate dependency update for tokio migration.The replacement of async-std with tokio as a dependency is aligned with the PR's goal to remove the deprecated async-std crate.
db/sql/src/ticket_manager.rs (1)
375-375
: Test macro updated correctly for tokio runtime.Test annotation change from
#[async_std::test]
to#[tokio::test]
is consistent with the project's migration to the tokio runtime.logic/strategy/src/channel_finalizer.rs (1)
191-191
: Test macro updated correctly for tokio runtime.Test annotation change from
#[async_std::test]
to#[tokio::test]
is consistent with the project's migration to the tokio runtime.db/sql/src/peers.rs (1)
337-337
: Successfully transitioned tests to tokio runtime.All test attributes have been properly migrated from
#[async_std::test]
to#[tokio::test]
, which is aligned with the project-wide migration to tokio as the standard async runtime.Also applies to: 365-365, 385-385, 398-398, 414-414, 424-424, 467-467, 490-490, 519-519, 569-569
Cargo.toml (1)
157-157
: Correctly switched sea-query-binder to use tokio runtime.The feature flag has been properly updated from
runtime-async-std-rustls
toruntime-tokio-rustls
, which is necessary for database query operations to work with the tokio runtime.transport/p2p/Cargo.toml (1)
54-54
: Successfully removed async-std dependency.The
async-std
dev-dependency has been removed while maintaining the tokio dependency, correctly aligning with the project's migration to standardize on the tokio runtime.I've noticed from the retrieved learnings that all packages in the project should use workspace-level dependencies for tools like
reqwest
. This change correctly maintains that pattern by using only workspace dependencies.hoprd/inbox/src/inbox.rs (2)
198-198
: Test attribute correctly migrated to tokio.The test attribute has been properly updated from
#[async_std::test]
to#[tokio::test]
to align with the project-wide migration to tokio runtime.
249-249
: Successfully migrated async sleep function to tokio equivalent.The sleep function has been correctly changed from
async_std::task::sleep
totokio::time::sleep
, which is the proper equivalent in the tokio runtime.db/sql/src/registry.rs (2)
170-170
: Test attribute updated to use Tokio runtimeThis test has been properly migrated from
async-std
totokio
runtime as part of the codebase-wide transition away from the deprecatedasync-std
crate.
199-199
: Test attribute updated to use Tokio runtimeThis test has been properly migrated from
async-std
totokio
runtime as part of the codebase-wide transition away from the deprecatedasync-std
crate.logic/strategy/src/strategy.rs (2)
282-282
: Test attribute updated to use Tokio runtimeThis test has been properly migrated from
async-std
totokio
runtime as part of the codebase-wide transition away from the deprecatedasync-std
crate.
311-311
: Test attribute updated to use Tokio runtimeThis test has been properly migrated from
async-std
totokio
runtime as part of the codebase-wide transition away from the deprecatedasync-std
crate.chain/actions/Cargo.toml (1)
56-56
: Dev dependency updated from async-std to tokioThe development dependency has been properly updated to use
tokio
instead ofasync-std
, which aligns with the PR's objective to standardize on the Tokio runtime.Note: The
runtime-async-std
feature has also been correctly removed from the features section, completing the migration from async-std to tokio.hopli/src/main.rs (1)
64-64
: Main function attribute updated to use Tokio runtimeThe main function attribute has been properly updated from
#[async_std::main]
to#[tokio::main]
, switching the async runtime used to drive the program from async-std to tokio.hoprd/db/api/src/aliases.rs (1)
141-141
: Test attribute migration looks goodAll test attributes have been properly updated from
#[async_std::test]
to#[tokio::test]
, aligning with the project-wide migration from async-std to tokio runtime.Also applies to: 154-154, 177-177, 204-204, 220-220, 240-240, 260-260, 276-276, 295-295, 313-313, 339-339, 364-364, 388-388
db/sql/src/info.rs (1)
598-598
: Test attribute migration correctly implementedAll async test functions have been properly updated to use
#[tokio::test]
instead of#[async_std::test]
, consistent with the codebase-wide transition to tokio runtime.Also applies to: 619-619, 641-641, 660-660, 677-677, 695-695
common/network-types/src/utils.rs (1)
458-458
: AsyncReadStreamer tests successfully migrated to tokioAll test attributes for the AsyncReadStreamer functionality have been correctly updated from
#[async_std::test]
to#[tokio::test]
, maintaining consistent test behavior while switching to the tokio runtime.Also applies to: 471-471, 485-485, 499-499
crypto/packet/src/validation.rs (1)
137-137
: Validation tests properly migrated to tokio runtimeAll ticket validation test attributes have been successfully updated from
#[async_std::test]
to#[tokio::test]
, completing the migration from async-std to tokio for this module.Also applies to: 158-158, 177-177, 196-196, 221-221, 241-241, 266-266
hoprd/db/migration/src/main.rs (1)
3-3
: Runtime attribute updated correctly.The
#[tokio::main]
attribute has been properly added to replace the previous async-std runtime attribute, aligning with the project-wide migration to the Tokio runtime.hopli/Cargo.toml (3)
21-21
: Correctly added tokio dependency.The tokio dependency has been added as a direct dependency, which is necessary for the migration from async-std.
26-26
: Runtime feature flag updated appropriately.The feature flag for hopr-chain-api has been correctly updated from
runtime-async-std
toruntime-tokio
to match the runtime migration.
38-39
: Dev dependency reordering.The reordering of the hopr-crypto-random dependency is functionally equivalent to the previous placement.
chain/indexer/src/handlers.rs (2)
974-974
: Test attribute updated to tokio.The test attribute has been correctly migrated from
#[async_std::test]
to#[tokio::test]
.
1020-1020
: Multiple test attributes consistently updated to tokio.All test attributes throughout the file have been consistently migrated from
#[async_std::test]
to#[tokio::test]
, ensuring compatibility with the Tokio runtime.Also applies to: 1196-1196, 1254-1254, 1288-1288, 1322-1322, 1386-1386, 1427-1427, 1468-1468, 1512-1512, 1556-1556, 1584-1584, 1614-1614, 1647-1647, 1682-1682, 1732-1732, 1774-1774, 1824-1824, 1882-1882, 1929-1929, 1976-1976, 2033-2033, 2098-2098, 2201-2201, 2307-2307, 2377-2377, 2432-2432, 2484-2484, 2538-2538, 2566-2566, 2600-2600, 2633-2633, 2673-2673
hoprd/inbox/src/ring.rs (2)
220-220
: All test attributes consistently updated to tokio.All test attributes in the file have been systematically migrated from
#[async_std::test]
to#[tokio::test]
, maintaining consistent usage of the Tokio runtime throughout the test suite.Also applies to: 270-270, 293-293, 321-321, 353-353, 372-372, 399-399, 428-428, 456-456, 506-506, 536-536
469-469
: Sleep implementation properly updated to tokio.The async sleep calls have been correctly migrated from
async_std::task::sleep
totokio::time::sleep
, ensuring consistent usage of Tokio's utilities for time-based operations.Also applies to: 515-515
db/sql/src/resolver.rs (1)
39-39
: Test attribute changes look good!All test attributes have been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration from async-std to tokio runtime. The test logic remains unchanged, which is the expected approach for this transition.Also applies to: 51-51, 63-63, 94-94, 131-131, 163-163
transport/network/src/network.rs (1)
397-397
: Test attribute changes look good!All test attributes have been properly migrated from
#[async_std::test]
to#[tokio::test]
across the network module's test suite. This change is consistent with the project-wide migration to the tokio runtime while preserving all test logic.Also applies to: 418-418, 440-440, 464-464, 488-488, 512-512, 547-547, 577-577, 608-608, 651-651, 662-662, 677-677, 693-693, 719-719, 748-748, 777-777
Makefile (1)
64-64
: Makefile update correctly switches to tokio runtime!The test target has been properly updated to use
--features runtime-tokio
instead ofruntime-async-std
, ensuring that all tests run through the Makefile will use the tokio runtime. This matches the PR objectives of standardizing on tokio throughout the project.logic/strategy/src/promiscuous.rs (1)
806-806
: Test attribute and sleep function correctly migrated to tokio!Both changes in this file properly migrate from async-std to tokio:
- The test attribute macro is now using
tokio::test
- The sleep function now uses
tokio::time::sleep
instead ofasync_std::task::sleep
This completes both aspects of the migration mentioned in the PR objectives: updating test annotations and replacing delay functions.
Also applies to: 872-872
db/sql/src/tickets.rs (1)
1417-1417
: Runtime migration successfully implemented.The test annotations have been properly updated from
#[async_std::test]
to#[tokio::test]
across all test functions in this file, consistent with the project-wide migration from async-std to tokio. This change maintains the same test behavior while standardizing on the tokio runtime.Also applies to: 1449-1449, 1512-1512, 1528-1528, 1542-1542, 1589-1589, 1617-1617, 1661-1661, 1684-1684, 1704-1704, 1715-1715, 1747-1747, 1812-1812, 1873-1873, 1895-1895, 1943-1943, 1979-1979, 2005-2005, 2032-2032, 2071-2071, 2096-2096, 2137-2137, 2166-2166, 2196-2196, 2226-2226, 2256-2256, 2286-2286, 2311-2311, 2334-2334, 2362-2362, 2391-2391, 2412-2412, 2442-2442, 2496-2496, 2537-2537, 2572-2572, 2603-2603, 2641-2641, 2693-2693, 2793-2793, 2834-2834, 2855-2855, 2905-2905, 2942-2942, 3036-3036, 3048-3048, 3082-3082, 3110-3110, 3140-3140, 3172-3172, 3201-3201, 3232-3232, 3263-3263, 3293-3293, 3331-3331, 3352-3352, 3391-3391
chain/actions/src/channels.rs (5)
260-260
: Switched test attribute to Tokio runtime
Replaced the deprecated#[async_std::test]
with#[tokio::test]
to run tests under the Tokio executor.
309-310
: Migrated background task spawn to Tokio
Updated the test setup to usetokio::task::spawn
instead ofasync_std::task::spawn
for running the action queue. This aligns with the new Tokio-based runtime.
627-629
: Updated background task spawn in fund_channel test
Switched the spawn call in thetest_fund_channel
totokio::task::spawn
to use the Tokio runtime.
920-923
: Updated background task spawn in close_channel_outgoing test
Changed the test’s queue runner totokio::task::spawn
for consistency with Tokio runtime.
1013-1015
: Updated background task spawn in close_channel_incoming test
Replaced the previousasync-std
spawn withtokio::task::spawn
to schedule the action queue under Tokio.db/sql/src/logs.rs (10)
455-455
: Switched log test attribute to Tokio runtime
Replaced#[async_std::test]
with#[tokio::test]
for thetest_store_single_log
test.
481-481
: Switched log test attribute to Tokio runtime
Updatedtest_store_multiple_logs
to use#[tokio::test]
.
531-531
: Switched log test attribute to Tokio runtime
Replaced the attribute fortest_store_duplicate_log
with#[tokio::test]
.
558-558
: Switched log test attribute to Tokio runtime
Migratedtest_set_log_processed
to use#[tokio::test]
.
590-590
: Switched log test attribute to Tokio runtime
Changedtest_list_logs_ordered
to#[tokio::test]
.
653-653
: Switched log test attribute to Tokio runtime
Updatedtest_get_logs_block_numbers
to run under Tokio.
707-707
: Switched log test attribute to Tokio runtime
Migratedtest_set_logs_unprocessed
to use#[tokio::test]
.
736-736
: Switched log test attribute to Tokio runtime
Replaced the attribute for the secondtest_get_logs_block_numbers
with#[tokio::test]
.
809-809
: Switched log test attribute to Tokio runtime
Updatedtest_update_logs_checksums
to use Tokio’s test macro.
873-873
: Switched log test attribute to Tokio runtime
Migratedtest_should_not_allow_inconsistent_logs_in_the_db
to#[tokio::test]
.hopli/src/methods.rs (3)
1455-1455
: Updated HTTP requestor import
The import ofReqwestRequestor
fromhopr_chain_rpc::client
replaces the previous async-std–based SurfRequestor, aligning with the migration to Tokio.
1560-1560
: Switched async test attributes to Tokio
All#[async_std::test]
attributes have been correctly replaced with#[tokio::test]
, ensuring tests run on the Tokio runtime. No test logic was altered.Also applies to: 1588-1588, 1651-1651, 1710-1710, 1749-1749, 1789-1789, 1851-1851, 1864-1864, 1881-1881, 1976-1976, 2050-2050, 2145-2145, 2220-2220, 2278-2278, 2371-2371, 2444-2444
1569-1569
: Updated client instantiation to useReqwestRequestor
Each test now callscreate_rpc_client_to_anvil(ReqwestRequestor::default(), ...)
, replacing any async-std HTTP client. This is consistent with the PR’s removal of async-std.Also applies to: 1599-1599, 1659-1659, 1719-1719, 1760-1760, 1800-1800
logic/path/src/selectors/dfs.rs (1)
474-474
: Replaced async-std test annotations with Tokio
Each unit test attribute was updated from#[async_std::test]
to#[tokio::test]
, in line with the repo-wide runtime migration. Test bodies and assertions remain unchanged.Also applies to: 486-486, 503-503, 520-520, 549-549, 565-565, 582-582, 601-601, 618-618, 635-635, 651-651
db/migration/src/main.rs (1)
3-3
: Runtime attribute successfully updated to tokioThe change from
#[async_std::main]
to#[tokio::main]
correctly aligns the main function with the project's transition to the tokio runtime.db/sql/src/accounts.rs (2)
459-459
: Test attribute correctly migrated to tokioThe test attribute has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the codebase-wide runtime migration.
512-512
: All test attributes consistently migrated to tokioAll remaining test attributes in this file have been consistently updated from
#[async_std::test]
to#[tokio::test]
, ensuring complete migration to the tokio runtime for all tests.Also applies to: 553-553, 571-571, 622-622, 651-651, 666-666, 698-698, 727-727, 742-742, 802-802, 864-864
nix/rust-package.nix (1)
95-95
: Successfully removed async-std feature flag from test configurationThe
-F runtime-async-std
feature flag has been correctly removed from the test arguments, leaving only-F runtime-tokio
. This ensures tests run exclusively on the tokio runtime, completing the migration away from async-std.transport/protocol/Cargo.toml (2)
55-55
: Dev dependency successfully migrated to tokioThe dev dependency has been correctly updated from
async-std
totokio
, aligning with the project's runtime migration strategy.
59-59
: Feature flags appropriately updated for tokio runtimeThe feature flags for both
criterion
andhopr-db-sql
have been properly updated to use tokio instead of async-std:
criterion
now usesasync_tokio
instead ofasync_std
hopr-db-sql
now usesruntime-tokio
instead ofruntime-async-std
These changes ensure consistent use of the tokio runtime throughout the dependency chain.
Also applies to: 60-60
chain/api/Cargo.toml (1)
52-53
: Correctly updated dev-dependencies to use tokio runtimeThe dependency changes properly align with the PR objective of replacing async-std with tokio across the codebase. This file correctly:
- Adds tokio as a dev-dependency from the workspace
- Updates hopr-db-sql dev-dependency to use the runtime-tokio feature
This is consistent with the learning from tolbrino about how it's appropriate to declare hopr-db-sql in both dependencies and dev-dependencies with different features for testing.
hopr/hopr-lib/tests/node_integration_tests.rs (3)
4-4
: Switched from SurfRequestor to ReqwestRequestorThe import change correctly aligns with the PR objective of removing async-std dependencies, as ReqwestRequestor uses the tokio runtime while the previous SurfRequestor used async-std.
12-12
: Simplified test attribute to use only tokio runtimeCorrectly simplified the test attribute to only use tokio::test instead of conditionally supporting both async-std and tokio runtimes, which aligns with the PR objective of standardizing on tokio.
17-17
: Updated SnapshotRequestor to use ReqwestRequestorThe instantiation of SnapshotRequestor now correctly uses ReqwestRequestor which is tokio-based, replacing the previous SurfRequestor which was async-std-based.
chain/actions/src/payload.rs (3)
606-606
: Switched to reqwest_client::ReqwestRequestorThe import has been correctly updated to use reqwest_client::ReqwestRequestor instead of the previous surf_client::SurfRequestor, which aligns with the migration from async-std to tokio.
615-615
: Updated test attributes to use tokio runtimeAll test attributes have been correctly changed from #[async_std::test] to #[tokio::test], consistently applying the migration from async-std to tokio throughout the test suite.
Also applies to: 652-652, 712-712
621-621
: Updated RPC client creation to use ReqwestRequestorAll instances of create_rpc_client_to_anvil now correctly use ReqwestRequestor instead of the previous SurfRequestor, consistently applying the migration from async-std to tokio-based HTTP clients.
Also applies to: 657-657, 717-717
transport/protocol/src/processor.rs (3)
267-267
: Switched to tokio::time::timeoutThe import has been correctly updated to use tokio::time::timeout instead of the previous async_std::future::timeout, aligning with the migration to tokio.
269-269
: Updated test attributes to use tokio runtimeTest attributes have been correctly changed from #[async_std::test] to #[tokio::test], consistently applying the migration from async-std to tokio throughout the test suite.
Also applies to: 283-283
313-315
: Updated task spawning and sleep to use tokioThe task spawning and sleep operations have been correctly migrated from async_std to tokio:
- Changed from async_std::task::spawn to tokio::task::spawn
- Changed from async_std::time::sleep to tokio::time::sleep
These changes ensure consistent use of the tokio runtime for asynchronous operations.
db/sql/src/db.rs (3)
260-260
: Correctly migrated test annotations to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
to align with the migration from async-std to tokio runtime.
273-273
: Test annotation updated correctly to tokio runtimeThis test annotation change is consistent with the project-wide migration to the tokio runtime.
311-311
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
while maintaining the test logic.chain/actions/src/node.rs (6)
118-118
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
to align with the migration to tokio runtime.
159-161
: Task spawning function updated to use tokioThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same execution flow.
176-176
: Test annotation correctly migrated to tokioThe test annotation has been updated from
#[async_std::test]
to#[tokio::test]
as part of the runtime migration.
217-217
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
while maintaining the test logic.
238-240
: Task spawning updated to use tokio runtimeThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same execution flow.
259-259
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the project-wide migration.transport/network/src/heartbeat.rs (3)
249-249
: Sleep utility correctly migrated to tokioThe import has been properly updated from
async_std::task::sleep
totokio::time::sleep
to align with the tokio runtime migration.
273-273
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
while maintaining the test logic.
298-298
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the project-wide migration.chain/actions/src/redeem.rs (14)
352-352
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
to align with the tokio runtime migration.
418-420
: Task spawning updated to use tokio runtimeThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same execution flow and functionality.
452-452
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the project-wide migration.
497-499
: Task spawning correctly migrated to tokioThe task spawning has been properly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same functionality.
539-539
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
while maintaining the test logic.
587-589
: Task spawning updated to use tokio runtimeThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same execution flow.
620-620
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the project's runtime migration.
669-671
: Task spawning correctly migrated to tokioThe task spawning has been properly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the test's execution flow.
691-691
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
in line with the runtime migration.
739-741
: Task spawning updated to use tokio runtimeThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same behavior.
766-766
: Test annotation successfully migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the project-wide migration.
799-801
: Task spawning correctly migrated to tokioThe task spawning has been properly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the test's functionality.
820-820
: Test annotation correctly migrated to tokioThe test annotation has been properly updated from
#[async_std::test]
to#[tokio::test]
as part of the tokio runtime migration.
856-858
: Task spawning updated to use tokio runtimeThe task spawning has been correctly migrated from
async_std::task::spawn
totokio::task::spawn
, maintaining the same execution flow.logic/strategy/Cargo.toml (1)
62-63
: LGTM! Successfully migrated to tokio runtimeThe change correctly adds tokio as a dev-dependency and configures hopr-db-sql with the runtime-tokio feature, which is in line with the project-wide migration from async-std to tokio.
chain/indexer/Cargo.toml (1)
55-58
: LGTM! Successfully migrated to tokio runtimeThe change correctly adds tokio as a dev-dependency and configures hopr-db-sql with the runtime-tokio feature, which aligns with the project-wide migration from async-std to tokio.
transport/session/src/types.rs (4)
638-638
: LGTM! Successfully migrated test attribute to tokioThe test attribute has been correctly updated from
async_std::test
totokio::test
as part of the migration from async-std to tokio runtime.
669-669
: LGTM! Successfully migrated test attribute to tokioThe test attribute has been correctly updated from
async_std::test
totokio::test
.
707-707
: LGTM! Successfully migrated test attribute to tokioThe test attribute has been correctly updated from
async_std::test
totokio::test
.
741-741
: LGTM! Successfully migrated test attribute to tokioThe test attribute has been correctly updated from
async_std::test
totokio::test
.db/sql/Cargo.toml (1)
63-71
: LGTM! Successfully migrated to tokio runtime and rustls featuresThe changes correctly update all dev-dependencies to use tokio runtime:
- Added tokio as a direct dev-dependency
- Updated sea-orm to use runtime-tokio-rustls feature
- Updated sea-query-binder to use runtime-tokio-rustls feature
- Updated sqlx to use runtime-tokio-rustls feature
These changes appropriately align with the project-wide migration from async-std to tokio.
hopr/hopr-lib/tests/common/mod.rs (3)
2-2
: LGTM! Successfully migrated HTTP client to ReqwestUpdated to use ReqwestRequestor instead of SurfRequestor as part of the migration from async-std to tokio runtime.
13-13
: LGTM! Successfully migrated to tokio sleep functionUpdated to use tokio::time::sleep instead of async_std::task::sleep.
22-22
: LGTM! Successfully updated Requestor type aliasUpdated the Requestor type alias to use ReqwestRequestor instead of SurfRequestor.
transport/p2p/src/swarm.rs (1)
47-47
: Excellent simplification of runtime configuration.The conditional compilation has been simplified to only check for the "runtime-tokio" feature, removing the previous async-std related code path. This change aligns perfectly with the PR objective of standardizing on the Tokio runtime.
chain/indexer/src/block.rs (5)
656-656
: Test attribute correctly migrated to tokio.Replacing
#[async_std::test]
with#[tokio::test]
correctly updates the test to use the tokio runtime.
691-691
: Sleep function correctly migrated to tokio.Replacing
async_std::time::sleep
withtokio::time::sleep
properly updates the sleep function for the new runtime.
699-699
: Test attribute with test_log wrapper correctly migrated to tokio.Replacing
#[test_log::test(async_std::test)]
with#[test_log::test(tokio::test)]
correctly updates the test to use the tokio runtime.
757-757
: All sleep calls correctly migrated to tokio.All instances of sleep calls have been properly migrated from async-std to tokio.
Also applies to: 809-809, 871-871, 952-952
765-765
: Remaining test attributes correctly migrated to tokio.All remaining test attributes have been properly updated to use the tokio runtime.
Also applies to: 816-816, 964-964, 1034-1034
transport/ticket-aggregation/Cargo.toml (3)
37-37
: Dev dependency correctly switched to tokio.The dev-dependency has been properly changed from async-std to tokio, aligning with the PR objective.
41-41
: Criterion features correctly updated for tokio.The criterion features have been properly updated from
async_std
toasync_tokio
, maintaining the async testing capabilities with the new runtime.
46-46
: Dependency feature flag correctly updated for tokio.The hopr-db-sql dependency's feature flag has been properly changed from
runtime-async-std
toruntime-tokio
, ensuring consistent runtime usage across dependencies.chain/rpc/src/rpc.rs (4)
475-475
: Import correctly changed to use reqwest client.The import has been correctly updated to use
ReqwestRequestor
instead of the previousSurfRequestor
, aligning with the change from async-std to tokio.
515-515
: Test attributes correctly migrated to tokio.All test functions have been properly updated to use
#[tokio::test]
instead of#[async_std::test]
.Also applies to: 568-568, 612-612, 669-669, 713-713, 757-757, 850-850
541-541
: Client instances correctly changed to use ReqwestRequestor.All instances of client creation now use
ReqwestRequestor::default()
instead of the previousSurfRequestor::default()
, consistently applying the HTTP client change across the tests.Also applies to: 548-548, 587-587, 594-594, 631-631, 638-638, 688-688, 695-695, 742-742, 749-749, 798-798, 805-805, 892-892, 899-899
723-723
: RPC client creation correctly updated to use ReqwestRequestor.The calls to
create_rpc_client_to_anvil
have been properly updated to useReqwestRequestor
, maintaining consistent HTTP client usage across the test suite.Also applies to: 767-767, 861-861
transport/network/src/ping.rs (16)
275-275
: Successfully migrated test annotations to TokioThe change from
#[async_std::test]
to#[tokio::test]
is correctly implemented as part of the project-wide migration to thetokio
runtime.
293-293
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
310-310
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
319-319
: Successfully migrated sleep function to TokioThe sleep function has been properly updated from
async_std::task::sleep
totokio::time::sleep
.
337-337
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
341-341
: Successfully migrated task spawning and cancellation to TokioThe changes correctly update:
- Task spawning from
async_std::task::spawn
totokio::task::spawn
- Task cancellation from
cancel().await
toabort()
which is Tokio's equivalent methodThese changes align with the Tokio runtime's API.
Also applies to: 359-359
364-364
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
368-368
: Successfully migrated task spawning and cancellation to TokioThe code correctly updates task spawning and cancellation methods to use Tokio's API.
Also applies to: 394-394
399-399
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
403-403
: Successfully migrated task spawning and cancellation to TokioThe code correctly updates task spawning and cancellation methods to use Tokio's API.
Also applies to: 428-428
433-433
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
438-438
: Successfully migrated task spawning, sleep function, and cancellation to TokioThe code correctly updates:
- Task spawning to
tokio::task::spawn
- Sleep function to
tokio::time::sleep
- Task cancellation to
abort()
These changes align with Tokio's API.
Also applies to: 442-442, 469-469
474-474
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
478-478
: Successfully migrated task spawning and cancellation to TokioThe code correctly updates task spawning and cancellation methods to use Tokio's API.
Also applies to: 512-512
517-517
: Successfully migrated test annotations to TokioThe test annotation has been properly updated to use
tokio::test
instead ofasync_std::test
.
523-523
: Successfully migrated task spawning, sleep function, and cancellation to TokioThe code correctly updates:
- Task spawning to
tokio::task::spawn
- Sleep function to
tokio::time::sleep
- Task cancellation to
abort()
These changes align with Tokio's API.
Also applies to: 527-527, 570-570
transport/session/Cargo.toml (2)
22-24
: Successfully removed async-std runtime featureThe
runtime-async-std
feature has been removed, leaving only theruntime-tokio
feature, which aligns with the PR objective to standardize on the Tokio runtime.
51-53
: Successfully updated dev-dependencies to use TokioThe changes correctly:
- Replace
async-std
withtokio
in dev-dependencies- Update the
hopr-network-types
feature to useruntime-tokio
instead ofruntime-async-std
This aligns with the learnings that the project should standardize on the workspace level dependency of
reqwest
, which is compatible withtokio
.hopr/hopr-lib/tests/chain_integration_tests.rs (3)
18-18
: Successfully migrated HTTP client to ReqwestChanged from
surf_client::SurfRequestor
(which relies on async-std) toreqwest_client::ReqwestRequestor
(which uses tokio), aligning with the PR objective to standardize on Tokio.
176-176
: Successfully updated test attribute for Tokio runtimeThe test attribute has been correctly updated to use
tokio::test
instead ofasync_std::test
, maintaining thetest_log::test
wrapper.
195-218
: Successfully replaced all SurfRequestor instances with ReqwestRequestorAll instances of
SnapshotRequestor
creation have been updated to useReqwestRequestor
instead ofSurfRequestor
, maintaining the same snapshot file paths and configuration options (ignore_snapshot, aggressive_save).chain/actions/src/action_state.rs (13)
176-176
: Successfully updated timeout import for TokioReplaced the import of
async_std::prelude::FutureExt
withtokio::time::timeout
, which is the correct Tokio equivalent for timeout functionality.
183-183
: Successfully migrated test attribute to TokioThe test attribute has been properly updated to use
tokio::test
instead ofasync_std::test
.
195-197
: Successfully migrated task spawning and sleep function to TokioThe code correctly updates:
- Task spawning from
async_std::task::spawn
totokio::task::spawn
- Sleep function from using
.delay()
totokio::time::sleep()
These changes align with Tokio's API.
204-213
: Successfully updated timeout handling for TokioThe timeout handling pattern has been correctly updated from the chained method style in async-std (
.timeout()
) to the wrapper function style in Tokio (timeout(duration, future)
). This maintains the same timeout functionality while adapting to Tokio's API.
219-219
: Successfully migrated test attribute to TokioThe test attribute has been properly updated to use
tokio::test
instead ofasync_std::test
.
230-233
: Successfully migrated task spawning and sleep function to TokioThe code correctly updates task spawning and sleep functionality to use Tokio's API.
235-244
: Successfully updated timeout handling for TokioThe timeout handling pattern has been correctly updated to use Tokio's wrapper function style.
253-253
: Successfully migrated test attribute to TokioThe test attribute has been properly updated to use
tokio::test
instead ofasync_std::test
.
275-279
: Successfully migrated task spawning and sleep function to TokioThe task spawning and sleep function calls have been correctly updated to use Tokio's API in the loop that processes test events.
282-294
: Successfully updated timeout handling for TokioThe timeout handling pattern has been correctly updated to use Tokio's wrapper function style while maintaining the same timeout duration and functionality.
300-300
: Successfully migrated test attribute to TokioThe test attribute has been properly updated to use
tokio::test
instead ofasync_std::test
.
321-325
: Successfully migrated task spawning and sleep function to TokioThe task spawning and sleep function calls have been correctly updated to use Tokio's API in the loop that processes test events.
344-346
: Successfully updated timeout handling for TokioThe timeout wrapper has been correctly applied to the
futures::future::try_join_all
call, maintaining the same timeout functionality while adapting to Tokio's API.transport/p2p/tests/p2p_transport_test.rs (3)
121-121
: Task cancellation method updated correctlyThe change from
cancel().await
toabort()
correctly adapts to Tokio's JoinHandle API for task cancellation.
126-129
: Import statements correctly migrated to tokioThe imports have been correctly updated from async-std to tokio, maintaining equivalent functionality for task spawning, JoinHandle, and time utilities.
134-135
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[async_std::test]
to#[tokio::test]
to align with the new runtime.hopli/src/environment_config.rs (5)
29-34
: Successfully migrated HTTP client importsImports have been correctly updated to use
DefaultHttpRequestor
fromhopr_chain_api
instead of the previous type alias, aligning with the standardization on tokio-based HTTP clients.
130-131
: HTTP client instantiation updated for provider with signerThe code correctly creates a JSON RPC client using the tokio-compatible
DefaultHttpRequestor
instead of the async-std-basedDefaultHttpPostRequestor
.
162-163
: HTTP client instantiation updated for provider without signerThe code correctly creates a JSON RPC client using the tokio-compatible
DefaultHttpRequestor
instead of the async-std-basedDefaultHttpPostRequestor
.
306-307
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[async_std::test]
to#[tokio::test]
to align with the new runtime.
327-328
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[async_std::test]
to#[tokio::test]
to align with the new runtime.transport/ticket-aggregation/src/lib.rs (9)
443-444
: Timeout utility import successfully migratedThe code now correctly imports
timeout
fromtokio::time
instead of using theFutureExt
trait extension method from async-std.
526-527
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[async_std::test]
to#[tokio::test]
to align with the new runtime.
584-585
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method
.timeout(Duration::from_secs(5)).await
to the tokio function calltimeout(Duration::from_secs(5), future).await
.
601-602
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method to the tokio function call.
608-609
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method to the tokio function call.
652-653
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[async_std::test]
to#[tokio::test]
to align with the new runtime.
706-707
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method to the tokio function call.
723-724
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method to the tokio function call.
730-731
: Timeout call correctly migrated to tokioThe timeout pattern has been properly updated from the async-std extension method to the tokio function call.
common/network-types/src/session/state.rs (13)
1170-1192
: Task spawning and joining logic updated for tokioThe task spawning has been properly migrated from async-std to tokio, with appropriate changes to the await patterns for handling task completion. The use of
async move
blocks with explicitawait
calls adapts to tokio's task joining semantics.
1216-1217
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1238-1239
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1257-1258
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1288-1289
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1319-1320
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1350-1351
: Parameterized test macro updated to tokioThe parameterized test attribute has been correctly migrated from
#[parameterized_macro(async_std::test)]
to#[parameterized_macro(tokio::test)]
.
1378-1379
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[test(async_std::test)]
to#[test(tokio::test)]
to align with the new runtime.
1422-1423
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[test(async_std::test)]
to#[test(tokio::test)]
to align with the new runtime.
1467-1468
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[test(async_std::test)]
to#[test(tokio::test)]
to align with the new runtime.
1488-1489
: Sleep call correctly migrated to tokioThe sleep call has been properly updated from
async_std::task::sleep
totokio::time::sleep
.
1498-1499
: Test attribute correctly updated to tokioThe test attribute has been properly migrated from
#[test(async_std::test)]
to#[test(tokio::test)]
to align with the new runtime.
1520-1521
: Sleep call correctly migrated to tokioThe sleep call has been properly updated from
async_std::task::sleep
totokio::time::sleep
.chain/rpc/src/indexer.rs (4)
232-232
: Correct update to tokio's timeout implementation.This change correctly imports the
timeout
function from thetokio::time
module to replace the previously usedasync_std::prelude::FutureExt
trait that provided.timeout()
method on futures.
241-241
: Correctly switched to Tokio-compatible HTTP client.The change from
SurfRequestor
(async-std based) toReqwestRequestor
(tokio based) aligns with the migration from async-std to tokio runtime.
267-267
: Test annotation correctly updated to Tokio.Changed test annotation from
#[async_std::test]
to#[tokio::test]
as part of the migration to the tokio runtime.Also applies to: 301-301, 336-336, 471-471
309-310
: HTTP client instances updated to use Tokio-compatible implementation.Correctly updated all HTTP client instances to use
ReqwestRequestor
instead ofSurfRequestor
.Also applies to: 323-324, 368-369, 505-506, 512-512
logic/strategy/src/aggregating.rs (5)
321-321
: Correct import of tokio timeout functionality.This change correctly imports the
timeout
function from thetokio::time
module to replace the previously usedasync_std::prelude::FutureExt
trait.
469-469
: Task spawning correctly updated to use Tokio.Task spawning mechanism updated from
async_std::task::spawn
totokio::task::spawn
for compatibility with the tokio runtime.
517-517
: Test annotation correctly updated to Tokio.All test annotations have been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to the tokio runtime.Also applies to: 564-564, 611-611, 662-662, 717-717
551-551
: Sleep functionality correctly updated to use Tokio.Sleep functionality updated from
async_std::task::sleep
totokio::time::sleep
for compatibility with the tokio runtime.Also applies to: 598-598
705-705
: Timeout handling correctly updated to Tokio pattern.The timeout pattern has been correctly updated from the async-std style to the tokio style, which wraps the future in the timeout function instead of calling timeout as a method on the future.
Also applies to: 761-763
hoprd/hoprd/src/main.rs (1)
145-145
: Simplified runtime attribute for Tokio.The runtime attribute has been simplified to only use tokio's main attribute, removing the conditional compilation for async-std which aligns with the PR objective of standardizing on tokio as the sole runtime.
transport/mixer/src/channel.rs (5)
304-304
: Correctly updated to tokio's timeout implementation.This change correctly imports the
timeout
function from thetokio::time
module to replace the previously usedasync_std::prelude::FutureExt
trait.
313-313
: Test annotations correctly updated to use Tokio.All test annotations have been correctly updated from
#[async_std::test]
to#[tokio::test]
as part of the migration to the tokio runtime.Also applies to: 322-322, 338-338, 363-363, 390-390, 413-413, 437-437, 462-462
351-351
: Timeout handling correctly updated to Tokio pattern.The timeout pattern has been correctly updated from the async-std style (chaining
.timeout()
on futures) to the tokio style (wrapping futures with thetimeout()
function). All instances throughout the test module have been consistently updated.Also applies to: 371-372, 381-383, 403-408, 427-432, 452-457, 479-484
370-370
: Task spawning correctly updated to use Tokio.Task spawning mechanism updated from
async_std::task::spawn
totokio::task::spawn
for compatibility with the tokio runtime.Also applies to: 378-378
385-385
: Error handling correctly adjusted for nested futures.The error handling pattern has been correctly updated to account for the changed nesting of Results when using tokio's timeout pattern with futures::try_join.
chain/rpc/Cargo.toml (1)
67-67
: Looks good: Added tokio as a dev dependency.This change aligns with the PR objective to transition from
async-std
totokio
as the standard async runtime. With tokio now available in dev-dependencies, tests in this crate can use tokio's async runtime.hoprd/db/api/Cargo.toml (1)
35-39
: Successfully migrated from async-std to tokio runtime.The changes correctly update sea-orm and sqlx to use the tokio runtime with rustls instead of async-std, which aligns with the PR objectives.
transport/protocol/tests/common/mod.rs (4)
29-29
: Import of tokio's timeout function is correct.This properly replaces the
FutureExt
trait from async-std which provided the.timeout()
method on futures.
378-378
: Successfully migrated task spawning to tokio.The change from
async_std::task::spawn
totokio::task::spawn
is correct for spawning the task to emulate channel communication.
422-422
: Correctly migrated timeout handling to tokio.The code now uses
timeout(TIMEOUT_SECONDS, compare_packets).await
instead of chaining.timeout()
on the future, which is the proper way to use timeouts with tokio.
436-437
: Properly updated timeout usage for ticket checks.This correctly replaces the async-std style timeout with tokio's timeout function while maintaining the same functionality.
common/network-types/src/session/frame.rs (7)
749-749
: Successfully migrated test annotations to tokio.All test annotations have been properly updated from
#[async_std::test]
to#[tokio::test]
to support the migration from async-std to tokio runtime.Also applies to: 769-769, 829-829, 848-848, 888-888, 910-910, 965-965, 1019-1019, 1091-1091, 1150-1150, 1210-1210
838-838
: Sleep functionality properly migrated to tokio.All instances of
async_std::task::sleep
have been correctly replaced withtokio::time::sleep
, maintaining the same timing functionality.Also applies to: 956-956, 1008-1008, 1034-1034, 1113-1113, 1198-1198, 1220-1220
938-938
: Task spawning with type annotation updated for tokio.The code now spawns tasks using
tokio::task::spawn
with the appropriate type annotation for the JoinHandle. This ensures type compatibility with the existing code that expects a specific JoinHandle type.Also applies to: 991-991
1033-1033
: Successfully migrated task spawning in buffer_unordered.The migration from async-std to tokio for task spawning within the stream processing pipeline is correct.
1039-1039
: Added Result unwrapping to stream processing.The addition of
.map(Result::unwrap)
after.buffer_unordered(4)
is necessary because tokio's JoinHandle result structure differs slightly from async-std's. This ensures the returned values are properly unwrapped before being forwarded to the sink.
960-962
: Updated join handle awaiting and error propagation.The code now properly propagates errors from the join handle with
.await??
and returns an explicitOk(())
. This handles a subtle difference in how tokio's JoinHandles work compared to async-std.Also applies to: 1014-1016
1234-1234
: Error propagation added for join handle.The
?
operator has been added toeviction_jh.await
to propagate any errors from the spawned task. This is necessary when migrating to tokio's JoinHandle which has a different error propagation model.common/async-runtime/src/lib.rs (2)
6-6
: Good addition of deprecation notice for the async-std featureThis effectively communicates to users that they should migrate to tokio, aligning with the PR's goal of removing the deprecated async-std crate.
18-18
: Clean feature flag simplificationGood simplification of the conditional compilation for tokio. Previously, this was likely guarded with
#[cfg(all(feature = "runtime-tokio", not(feature = "runtime-async-std")))]
to ensure mutual exclusivity, but now tokio is the standard runtime and can be unconditionally enabled when its feature is present.common/network-types/src/session/utils.rs (8)
206-206
: Appropriate import for tokio's JoinErrorCorrectly importing the JoinError type from tokio to handle task result errors.
211-214
: Updated return type signatures for tokio compatibilityThe function signature has been properly updated to account for tokio's different task spawning mechanism that returns
Result<Vec<u8>, JoinError>
rather than async-std's approach.
221-221
: Correctly migrated task spawning to tokioTask spawning calls have been appropriately converted from
async_std::task::spawn
totokio::task::spawn
.Also applies to: 234-234
247-247
: Updated test attributes to use tokioTest annotations have been consistently changed from
#[async_std::test]
to#[tokio::test]
.Also applies to: 274-274, 298-298
261-263
: Proper error handling for tokio tasksThe code now correctly handles awaiting tokio tasks with explicit expect calls, which is necessary since tokio's task join handles return Results wrapped with JoinError.
Also applies to: 289-292
754-754
: Updated import for tokio timeoutCorrectly importing timeout from tokio's time module, replacing the previous usage of the timeout extension method from async-std.
889-900
: Proper timeout pattern for tokioThe timeout pattern has been correctly updated from async-std's
.timeout(Duration)
chaining to tokio'stimeout(Duration, future)
function call.Also applies to: 1023-1034
912-912
: Updated sleep calls to use tokioSleep calls have been properly migrated from
async_std::time::sleep
totokio::time::sleep
.Also applies to: 915-915, 1047-1047
chain/api/src/lib.rs (1)
36-37
: Standardized on tokio-based HTTP requestorThe DefaultHttpRequestor type alias has been correctly updated to only use the tokio-based ReqwestRequestor, removing the conditional path for SurfRequestor which was tied to async-std. This aligns with the PR's objective of standardizing on the tokio runtime.
transport/session/src/manager.rs (2)
814-816
: Updated blocking approach for tokio runtimeThe mock transport handlers have been correctly updated to use
tokio::runtime::Runtime::new().expect().block_on()
instead ofasync_std::task::block_on()
, which is necessary due to tokio's different approach to blocking operations.Also applies to: 835-837, 857-858, 892-893, 948-950, 969-971, 990-992, 1004-1006, 1094-1096, 1108-1110
771-771
: Consistently updated test attributesAll test attributes have been properly migrated from async-std to tokio, including both standalone
#[tokio::test]
and combined#[test_log::test(tokio::test)]
attributes.Also applies to: 793-793, 923-923, 1056-1056, 1140-1140
chain/rpc/src/client.rs (9)
912-929
: LGTM – runtime attribute migratedThe switch to
#[tokio::test]
together withReqwestRequestor
is correct and compiles cleanly.
930-954
: LGTM – malformed-response assertionOnly the runtime/client changed; the assertion logic is untouched.
956-991
: Retry-on-HTTP-error test: consider a tighter back-offTo keep the test fast you can lower
initial_backoff
(e.g. 10–20 ms); otherwise looks good.
993-1019
: LGTM – zero-retry policy testBehaviour preserved; no issues.
1021-1065
: LGTM – JSON-RPC retry testNo further remarks.
1067-1111
: LGTM – non-retryable JSON-RPC error testAssertions remain valid.
1113-1158
: LGTM – min-retries enforcementTest accurately checks
min_retries
; no concerns.
1160-1203
: LGTM – malformed JSON-RPC error handlingThe runtime migration is correct and logic intact.
1220-1266
: Snapshot-based test under TokioWorks correctly; temp-file is cleaned up via
Drop
, good job.logic/path/src/lib.rs (6)
567-575
: LGTM – async zero-hop testRuntime migration is correct; logic unchanged.
590-608
: LGTM – zero-hop non-open channel testNo issues spotted.
638-663
: LGTM – non-open channel (mid-path) negative testsBehaviour remains identical; good.
667-693
: LGTM – non-existing channel (mid-path) negative testsLooks correct.
697-709
: LGTM – simple loop rejectionAssertion logic intact.
715-725
: LGTM – long cycle acceptanceTest passes under Tokio; no further comments.
bbac42e
to
7cd473c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to bump crate versions.
…deprecated-async-std
…deprecated-async-std
There's a
|
c0d10bb
to
d45672d
Compare
2827458
to
040eca2
Compare
This pull request introduces several updates, primarily focused on upgrading dependencies in
Cargo.toml
and transitioning the codebase fromasync-std
totokio
for asynchronous runtime. These changes aim to modernize the project, improve compatibility, and enhance performance. Below are the most significant changes grouped by theme:Dependency Updates:
Cargo.toml
, includingclap
(4.5.36 → 4.5.37),ctor
(0.4.1 → 0.4.2),rpassword
(7.3.1 → 7.4.0),sea-query
(0.32.3 → 0.32.4), andtokio
(1.44.2 → 1.45.0). These updates ensure compatibility with newer versions and leverage bug fixes and optimizations. [1] [2] [3] [4] [5]Transition to
tokio
Runtime:async-std
withtokio
in test files, including the use of#[tokio::test]
for asynchronous tests andtokio::task::spawn
for task spawning. This change aligns the project with the more widely adoptedtokio
runtime. [1] [2] [3] [4]Makefile
test command to use theruntime-tokio
feature instead ofruntime-async-std
.runtime-async-std
feature and its associated dependencies fromchain/actions/Cargo.toml
. Addedtokio
as a development dependency. [1] [2]Test Enhancements:
async_std::task::spawn
withtokio::task::spawn
and introducedtokio::time::timeout
for better control over asynchronous operations in tests. This ensures that tests have a consistent timeout mechanism. [1] [2]tokio::time::sleep
instead ofasync_std::prelude::FutureExt::delay
. [1] [2]These changes collectively improve the project's maintainability, performance, and alignment with modern Rust ecosystem practices.