Skip to content

[CI] Fixed esplora blockchain tests in CI #430

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

Merged
merged 4 commits into from
Sep 14, 2021

Conversation

rajarshimaitra
Copy link
Contributor

@rajarshimaitra rajarshimaitra commented Aug 30, 2021

Description

Fixes #431 and esplora blockchain test skips in CI

Notes to the reviewers

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

Bugfixes:

  • I'm linking the issue being fixed by this PR

@rajarshimaitra rajarshimaitra changed the title Esplora fix [bug] Esplora blockchain test fix in CI Aug 30, 2021
@rajarshimaitra rajarshimaitra changed the title [bug] Esplora blockchain test fix in CI [Fix] Fixed esplora blockchain tests in CI Aug 30, 2021
@rajarshimaitra rajarshimaitra changed the title [Fix] Fixed esplora blockchain tests in CI [CI] Fixed esplora blockchain tests in CI Aug 30, 2021
Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

Looks good, also checkout related tcharding#2. We should be able to test esplora with ureq and reqwest. If you can incorporate into this PR I'll close the one I did.

@rajarshimaitra
Copy link
Contributor Author

rajarshimaitra commented Aug 31, 2021

Updated with suggested refactors and async changes.

Rearranged the commits.

Moved out tls changes.

@notmandatory
Copy link
Member

ACK 2caa590

@codecov-commenter
Copy link

Codecov Report

Merging #430 (2caa590) into master (721748e) will decrease coverage by 0.45%.
The diff coverage is n/a.

❗ Current head 2caa590 differs from pull request most recent head 9967045. Consider uploading reports for the commit 9967045 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #430      +/-   ##
==========================================
- Coverage   73.07%   72.62%   -0.46%     
==========================================
  Files          34       34              
  Lines        7399     7419      +20     
==========================================
- Hits         5407     5388      -19     
- Misses       1992     2031      +39     
Impacted Files Coverage Δ
src/blockchain/mod.rs 0.00% <ø> (ø)
src/keys/bip39.rs 97.18% <0.00%> (-2.82%) ⬇️
src/wallet/export.rs 86.98% <0.00%> (-1.37%) ⬇️
src/descriptor/policy.rs 70.17% <0.00%> (-1.00%) ⬇️
src/descriptor/dsl.rs 91.49% <0.00%> (-0.81%) ⬇️
src/wallet/tx_builder.rs 91.42% <0.00%> (-0.79%) ⬇️
src/wallet/mod.rs 96.48% <0.00%> (-0.54%) ⬇️
src/keys/mod.rs 90.67% <0.00%> (-0.52%) ⬇️
src/wallet/coin_selection.rs 96.60% <0.00%> (-0.23%) ⬇️
src/lib.rs 85.20% <0.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 721748e...9967045. Read the comment docs.

Copy link
Contributor

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. I'm glad to see the things I missed in CI being remedied, however I'm not super fond of the re-introduction of hard dependency on tokio - seems like a step backwards to me.

- name: esplora
features: test-esplora,use-esplora-reqwest
- name: esplora
features: test-esplora,use-esplora-ureq
Copy link
Contributor

Choose a reason for hiding this comment

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

This line has trailing whitespace.

run: cargo test --features test-${{ matrix.blockchain.name }} ${{ matrix.blockchain.name }}::bdk_blockchain_tests

run: cargo test --no-default-features --features ${{ matrix.blockchain.features }} ${{ matrix.blockchain.name }}::bdk_blockchain_tests
Copy link
Contributor

Choose a reason for hiding this comment

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

This line has trailing whitespace.

@@ -38,6 +38,10 @@ bitcoinconsensus = { version = "0.19.0-3", optional = true }
# Needed by bdk_blockchain_tests macro
core-rpc = { version = "0.14", optional = true }

# Platform-specific dependencies
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1", features = ["rt"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Please correct me if I'm wrong, but this PR re-introduces a hard dependency on tokio just so we can test esplora-reqwest feature, that seems like a bad choice to me. A user of bdk that wishes to use reqwest will always be using async, why do we want to introduce a hard dependency on tokio just to be able to test in a manner that the library will not be used?

The esplora-reqwest feature can be tested coupled with either async-interface feature or using WASM target.

@@ -106,19 +106,19 @@ impl Blockchain for EsploraBlockchain {
}

fn get_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error> {
Ok(self.url_client._get_tx(txid).await?)
Ok(await_or_block!(self.url_client._get_tx(txid))?)
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like this usage of await_or_block because there is no reason to use reqwest in a blocking environment, we have ureq for that.

@tcharding tcharding mentioned this pull request Aug 31, 2021
6 tasks
@tcharding
Copy link
Contributor

All my comments are resolved by the implementation in #433, please see if you have any concerns with that approach @rajarshimaitra. Thanks.

@notmandatory
Copy link
Member

@tcharding @LLFourn as @rajarshimaitra noted on #433 even if this PR isn't the final solution it will unblock some other work (bitcoindevkit/bdk-cli#41 and #429). Also it's more of a roll back to how the esplora::bdk_blockchain_tests used to work before ureq was introduced. Do you guys have any objection to merging this now while you work on a cleaner solution?

@tcharding
Copy link
Contributor

@tcharding @LLFourn as @rajarshimaitra noted on #433 even if this PR isn't the final solution it will unblock some other work (bitcoindevkit/bdk-cli#41 and #429). Also it's more of a roll back to how the esplora::bdk_blockchain_tests used to work before ureq was introduced. Do you guys have any objection to merging this now while you work on a cleaner solution?

Don't stop the progress on my account :)

- Changed to local bdk-macro
- Added back tokio
- Update esplora-reqwest and test-esplora feature guards
- add back await_or_block! to bdk-macros
- use await_or_block! in reqwest tests
- Fix esplora module level feature flag
- Move esplora blockchain tests to module, to cover for both variants
@notmandatory notmandatory merged commit 10b53a5 into bitcoindevkit:master Sep 14, 2021
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.

[Bug] Esplora reqwest blockchain tests are failing
4 participants