Skip to content

Commit c01eb4f

Browse files
committed
Merge #606: tests: add curated list of client test invariants from Bitcoin Core
6f78f2a tests: add curated bitcoin core test set (satsfy (Renato Britto)) Pull request description: Closes #58. This PR adds 79 tests corresponding to invariants picked after analyzing Bitcoin Core tests from `test/functional` folder. Identical test copies from core proved unproductive, extensive, and tested much more than necessary for corepc, so invariants (not tests) needed to be filtered. By putting these tests in `tests/`, there is no additional effort on `Cargo.toml`. The criteria: - Not a test of Core's behavior. - Only the client layer is tested (meaning the tests apply to the state before the into_model conversion). - If a particular assertion failed, that means corepc has a bug. - The tests are complementary and do not repeat or collide with existing corepc integration tests. Main targets: - Optional fields to prevent absence failures that the into_model conversions failed to catch. - Round trips not exercised or already tested. - Optional argument paths. - Fragile serde renames. - Consistency across fields (such as `banned_until == ban_created + ban_duration`). - Nested structs. - Tests that prove the mutual sanity of RPCs, compressing simple RPC tests into one (such as getblockhash tip matches best block, get_deployment_info + get_deployment_info_tip). All test check corepc honor a particular invariant. Previously untested fields are tested. Many tests contain `is_some()` because exact value assertions are not necessary, as long as the result parses into a particular type. Comprehensiveness was not a target because we test only what Core has. Flags are checked to be covering only the versions it should. How LLM was used: I read through Core tests to see what we were missing. Started developing a philosophy for assertions to pick. Realized that copying tests directly wouldn't work, so we would need to pick invariants (some are hard to reproduce, need Core's particulars, or test no meaningful corepc behavior). Asked Claude Opus 4.7 to convert the entire Bitcoin Core surface, and started iterating on it, covering gaps where needed, shaving off useless assertions, and sharpening the philosophy of tests. I have found various errors (such as rediscovering the inconsistency in numeric types) in RPCs/docs, saving them to investigate and open issues later. ACKs for top commit: tcharding: ACK 6f78f2a Tree-SHA512: 1d1a47b98b6e53da37b5f23632bd28126ddf534cf8dd0df45eaae0f40d8dd3e849e541487863d21bac93cb709f13b4c6da02ca4a91b0b4a8a8ae3d751dd2aec1
2 parents ab47e49 + 6f78f2a commit c01eb4f

8 files changed

Lines changed: 1300 additions & 0 deletions

File tree

integration_test/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ alias test29='BITCOIND_EXE=/opt/bitcoin-29.0/bin/bitcoind cargo test --features=
3434
alias test30='BITCOIND_EXE=/opt/bitcoin-30.2/bin/bitcoind cargo test --features=30_2'
3535
alias test31='BITCOIND_EXE=/opt/bitcoin-31.0/bin/bitcoind cargo test --features=31_0'
3636
```
37+
38+
## Bitcoin Core Tests
39+
40+
Tests derived from Bitcoin Core's `test/functional/` folder live in
41+
`tests/` alongside the modelled tests, with a `_core` filename suffix.

0 commit comments

Comments
 (0)