bitcoindevkit / bdk

A modern, lightweight, descriptor-based wallet library written in Rust!
Other
839 stars 299 forks source link

Test blockchain backend #543

Open LLFourn opened 2 years ago

LLFourn commented 2 years ago

Rather than running a regtest node it would be cool if we just had a simulated blockchain that we could do things to from test code.

idea originally from: https://github.com/bitcoindevkit/bdk/issues/446

casey commented 2 years ago

Ideally it would also be fast. We're running tests against regtest nodes, and our main issue is that it's very slow.

LLFourn commented 2 years ago

Happy to mentor someone on this issue if anyone wants to have a shot. It looks like fun!

casey commented 2 years ago

See my comment here: https://github.com/bitcoindevkit/bdk/issues/690#issuecomment-1201471031

TL;DR Maybe we should implement a dummy RPC server instead of a dummy bdk::blockchain::Blockchain?

danielabrozzoni commented 2 years ago

Where we would use this backend, btw? In src/testutils/blockchain_tests.rs, I suppose?

TL;DR Maybe we should implement a dummy RPC server instead of a dummy bdk::blockchain::Blockchain?

Eh, to me it looks more though to implement a dummy RPC server, but I don't really know...

rajarshimaitra commented 2 years ago

One thing I was wondering was, for this to work, we need to mock a considerable portion of bitcoin core's mempool and other behaviors too, if we wanna use it for any meaningful testing situation.. Not sure how difficult or worthwhile its gonna be..

notmandatory commented 11 months ago

@vladimirfomene as we discussed on discord, with the new 1.0 bdk electrum/esplora/rpc clients it's worth taking another look at using a mocking framework instead of or in addition to our current integration tests. One framework that looks like it could do the job is https://docs.rs/mockall/latest/mockall/.

notmandatory commented 5 months ago

Moved to beta release since this is a testing issue. Due to level of work to do this may have to push it out to a post 1.0 release.