chore: extract TestEnv into separate crate#1171
chore: extract TestEnv into separate crate#1171evanlinjin merged 5 commits intobitcoindevkit:masterfrom
TestEnv into separate crate#1171Conversation
This comment was marked as resolved.
This comment was marked as resolved.
dbbe366 to
0be5338
Compare
TestEnv into separate crateTestEnv into separate crate
There was a problem hiding this comment.
We need to change the internals to use electrsd so the test env can serve esplora and electrum as well.
Can use #979 as a reference to see what electrum-server methods we need.
I will look into this(). |
|
I think having reorg functions for all backends will help. I had to use a hack from Steve to implement reorg for electrum. You should see the code in #979. Read more here: https://bitcoin.stackexchange.com/questions/114044/how-can-i-simulate-a-reorg-for-testing. |
|
@vladimirfomene that's a great point. https://github.com/bitcoindevkit/bdk/blob/release/0.29/src/testutils/blockchain_tests.rs Maybe the old |
50c5ccd to
12403a1
Compare
19cafee to
2cadfd2
Compare
evanlinjin
left a comment
There was a problem hiding this comment.
Thanks for taking this forward. The code looks pretty good.
The documentation was a little lacking. It's important to communicate why things are implemented the way they are.
|
A simple electrsd reorg test was written and runs without having to pass in |
2cadfd2 to
c45a8f5
Compare
fb8ab29 to
f2af089
Compare
|
A |
6bb1a40 to
cc50303
Compare
1010efd fix(electrum): fixed chain sync issue (Wei Chen) Pull request description: ### Description This may or may not fix #1125. Fixed what appeared to be a logic error in `construct_update_tip` in `electrum_ext.rs` that caused the local chain tip to always be a block behind the newest confirmed block. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### Bugfixes: * [ ] This pull request breaks the existing API * [x] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: danielabrozzoni: ACK 1010efd - although I've been able to reproduce the issue in #1125, I'm convinced that this PR fixes at least a bug, as demonstrated in #1171 (yet to be reviewed and merged). Tree-SHA512: 92790e9072d17be74d2cd24bec3503e1ad5d97f728ee81490eeb09ac3f8d4a3a7e8d9628e943bc801246d5bfd345152c11d5dbe25246f5a57b3118727d3ae315
53186e2 to
2903697
Compare
|
I know that we're testing it in other crates. |
|
Now that #1351 is open, I made LagginTimes#1 to test stop_gap in |
2903697 to
29ac879
Compare
notmandatory
left a comment
There was a problem hiding this comment.
Overall looks like a great improvement, related tests are much easier to read too. I just have one comment/question about a CI change.
a09b56b to
e8dc8d3
Compare
oleonardolima
left a comment
There was a problem hiding this comment.
Overall looks pretty good!
I just left one minor comment about the documentation that I was uncertain about, and a general question for further discussion.
| @@ -744,7 +624,7 @@ fn mempool_during_reorg() -> anyhow::Result<()> { | |||
| // emission. | |||
| // TODO: How can have have reorg logic in `TestEnv` NOT blacklast old blocks first? | |||
There was a problem hiding this comment.
@LagginTimes general question: after this PR is merged, do you think we'll be able to solve this TODO ?
There was a problem hiding this comment.
Unfortunately no. This can be done in a follow-up PR!
`TestEnv` is extracted into its own crate to serve as a framework for testing other block explorer APIs.
Added scan and reorg tests to check electrum functionality using `TestEnv`.
e8dc8d3 to
04d0ab5
Compare
crates/esplora/Cargo.toml
Outdated
| [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
| electrsd = { version= "0.25.0", features = ["bitcoind_25_0", "esplora_a33e97e1", "legacy"] } |
There was a problem hiding this comment.
Do we need to make the tests run in WASM? Because electrsd is a mandatory dependency of bdk_testenv.
There was a problem hiding this comment.
Right now for CI we only do a cargo check for WASM and don't rerun the tests for that target. Since I haven't heard of any WASM issues that slipped through by not running the tests I don't think we need to change TestEnv to work with WASM.
notmandatory
left a comment
There was a problem hiding this comment.
ACK 04d0ab5
Great job, this will be a big help with testing.
None of the `bdk_esplora` tests can run under WASM anyway since we depend on `electrsd`.
Description
TestEnvis extracted into its own crate withelectrsdsupport added so thatTestEnvcan also serveesploraandelectrum.The tests in the
esploracrate have also been updated to useTestEnv.The
tx_can_become_unconfirmed_after_reorg()test intest_electrumsuggests that the electrum issue where a reorged tx would be stuck at confirmed does not exist anymore.Notes to the reviewers
The code for
tx_can_become_unconfirmed_after_reorg()was adapted from the same test inbitcoind_rpc/test_emitter. This electrum version of the test requires extra review, as I am uncertain if I used the API efficiently.All Submissions:
cargo fmtandcargo clippybefore committing