-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Add and use ElapseTime helper #32430
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
base: master
Are you sure you want to change the base?
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32430. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-01-16 |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
fa123d4 to
fae29c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK - was thinking of something similar when reviewing 41479ed (#32414)
|
Sorry for the force-pushes, but this uncovered pre-existing issues in the fuzz tests that were not using mocktime during init. So I went ahead and fixed those as well in a separate commit. Should be good now, hopefully 😅 |
w0xlt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fae29c5
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
Went ahead and cherry-picked out the fuzz-fixes into #32927. Should be easy to (re-)review that one. |
fa55137 to
fafcff1
Compare
fafcff1 to
faaaaac
Compare
l0rinc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing these, left quite a few comments, hope you'll find them useful
faaaaac to
fa80e75
Compare
|
Force pushed with some minor doc-changes and small refactoring in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code review ACK fa80e75
This is less code and also required for the next commit.
This is a bit more type-safe than a raw i64.
This makes it easier to use mock-time in tests. Also, it resets the global mocktime, so that no state is leaked between test cases. Also, it resets the global steady mock-time for the same reason.
This is required in the next commit.
fa80e75 to
fa053c2
Compare
|
rebased. should be trivial to re-review via |
l0rinc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff reACK fa053c2
mini_miner_selection and LimitOrphans fuzz targets were removed during rebase and the refactored chainstate_write_interval refactoring was adjusted.
Currently mocktime is written to a global, which may leak between sub-tests (albeit some tests try to reset the mocktime on a best-effort basis). Also, when advancing it, one has to keep a counter variable around.
Fix both issues by a new
ElapseTimehelper, which resets the mocktime once it goes out of scope. Also, it has a method to advance the mocktime by a delta.