You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that esplora-reqwest blockchain tests have been failing for some time now.
The CI missed it because all the esplora tests were being skipped.
The major sources of failure are async related. Especially calling async functions in bdk_blockchain_tests macro.
Error sample
error[E0599]: no method named `unwrap` found for opaque type `impl futures::Future` in the current scope
--> src/testutils/blockchain_tests.rs:875:52
|
875 | wallet.sync(noop_progress(), None).unwrap();
| ^^^^^^ method not found in `impl futures::Future`
|
::: src/blockchain/esplora/mod.rs:125:1
|
125 | / crate::bdk_blockchain_tests! {
126 | | fn test_instance(test_client: &TestClient) -> EsploraBlockchain {
127 | | EsploraBlockchain::new(&format!("http://{}",test_client.electrsd.esplora_url.as_ref().unwrap()), 20)
128 | | }
129 | | }
| |_- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider `await`ing on the `Future` and calling the method on its `Output`
|
875 | wallet.sync(noop_progress(), None).await.unwrap();
| ^^^^^^
error: aborting due to 58 previous errors
Some errors have detailed explanations: E0195, E0308, E0599.
For more information about an error, try `rustc --explain E0195`.
Reproduce:
Edit test-esplora feature in cargo like test-esplora = ["use-esplora-reqwest", "electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"].
then run cargo test --features test-esplora
Analysis
As far as I understand, its happening because in the test macro we are calling wallet APIs in non async mode, whereas, for esplora-reqwest these are async functions.
I tried putting in the maybe_async and maybe_await macros where applicable. But #[test] are not allowed to be async (or at least the vanilla flavour of them).
we can have async tests but with using tokio directly. But then, they cannot be non-async anymore.
Or maybe we can create some proc macros like #[maybe_async_test]?
I noticed this issue few weeks back in bdk-cli bitcoindevkit/bdk-cli#36 (comment). Was confused why I couldn't reproduce it in BDK. The reason is the current test-esplora feature is broken, and is not compiling the blockchian tests. This is now fixed with #430
The text was updated successfully, but these errors were encountered:
Bug
It seems that
esplora-reqwest
blockchain tests have been failing for some time now.The CI missed it because all the esplora tests were being skipped.
The major sources of failure are
async
related. Especially callingasync
functions inbdk_blockchain_tests
macro.Error sample
Reproduce:
Edit test-esplora feature in cargo like
test-esplora = ["use-esplora-reqwest", "electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"]
.then run
cargo test --features test-esplora
Analysis
As far as I understand, its happening because in the test macro we are calling wallet APIs in non async mode, whereas, for
esplora-reqwest
these are async functions.bdk/src/testutils/blockchain_tests.rs
Lines 378 to 380 in 721748e
Thoughts
I tried putting in the
maybe_async
andmaybe_await
macros where applicable. But#[test]
are not allowed to be async (or at least the vanilla flavour of them).we can have async tests but with using
tokio
directly. But then, they cannot be non-async anymore.Or maybe we can create some proc macros like
#[maybe_async_test]
?I noticed this issue few weeks back in bdk-cli bitcoindevkit/bdk-cli#36 (comment). Was confused why I couldn't reproduce it in BDK. The reason is the current
test-esplora
feature is broken, and is not compiling the blockchian tests. This is now fixed with #430The text was updated successfully, but these errors were encountered: