Repository navigation
tests: add curated list of client test invariants from Bitcoin Core - #606
Merged
Merged
Conversation
After analyzing countless Bitcoin Core tests from test/functional folder, invariants were picked for corepc such that 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. Identical test copies from core proved unproductive, extense and tested much more than necessary for corepc. All existing tests are derivations centered around checking corepc honors a particular invariant. Optional fields were specially targeted to prevent absence failures that into_model() conversions failed to catch. Some setups exercise previously untested fields.
Member
|
Mad, bit sad that we didn't find any bugs ... |
tcharding
approved these changes
May 26, 2026
Member
|
Good effort man, this is a ton of work. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #58.
This PR adds 79 tests corresponding to invariants picked after analyzing Bitcoin Core tests from
test/functionalfolder. 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 intests/, there is no additional effort onCargo.toml.The criteria:
Main targets:
banned_until == ban_created + ban_duration).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.