-
Notifications
You must be signed in to change notification settings - Fork 969
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
Best-offer debugging #2944
Best-offer debugging #2944
Conversation
da17ff3
to
dae0070
Compare
To try to get some idea of the impact of this on test speed, I ran
I'm guessing that's well within the variation (and even if it weren't, it's probably an irrelevant difference for a unit test), so I think we can indeed comfortably afford not to provide a |
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.
I reviewed the last commit and the logic looks good to me. Just included a few minor comments.
I also tried it on a catchup. The range I chose took ~5.5 minutes without best-offer debugging, and ~45 minutes with it. |
Is the configure option needed now that you have the config? Why not just enable it if people enable extra-checks? |
Extrachecks are off unless |
Nicolas requested the removal of the separate He also requested removing the I've pushed commits to do each of those two things. |
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.
cool. you should squash those last 2 commits into the previous commits as they're (mostly) cancelling things that this PR added
src/ledger/InMemoryLedgerTxnRoot.cpp
Outdated
@@ -10,8 +10,15 @@ | |||
namespace stellar | |||
{ | |||
|
|||
InMemoryLedgerTxnRoot::InMemoryLedgerTxnRoot() | |||
InMemoryLedgerTxnRoot::InMemoryLedgerTxnRoot( | |||
#if BEST_OFFER_DEBUGGING |
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.
do not mix #if BEST_OFFER_DEBUGGING
and #ifdef BEST_OFFER_DEBUGGING
What you want everywhere is #ifdef BEST_OFFER_DEBUGGING
given how you set it in the configure script
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.
Yikes, thanks for catching that. Fixed.
src/test/FuzzerImpl.cpp
Outdated
@@ -983,7 +983,11 @@ void | |||
TransactionFuzzer::initialize() | |||
{ | |||
resetRandomSeed(1); | |||
mApp = createTestApplication(mClock, getFuzzConfig(0)); | |||
auto cfg = getFuzzConfig(0); | |||
#ifdef BEST_OFFER_DEBUGGING |
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.
you don't need this: as you're using a test configuration, it's already set
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.
Good point. Removed.
1feeee3
to
83a95fd
Compare
Squashed. (The previous two were also squashable.) |
Fuzz metrics from current master without this PR: And with this PR: So the impact of this on exec speed is very substantial, although the benefits in terms of noticing bugs that fuzzing might find could also be large. (That all applies to #2959 as well.) |
Compile in best-offer debugging if extrachecks are enabled.
The Config option is initialized to false, so that best-offer debugging will be used only if something explicitly turns it on. (For example, a test might set it in a Config option before calling createTestApplication(), or the "test" command might enable it by default if not explicitly disabled on the command line, or the "run" command might enable it if explicitly enabled on the command line.)
Always use best-offer debugging in `stellar-core test`.
Add parameters to the constructors of LedgerTxnRoot and InMemoryLedgerTxnRoot to pass in the state of the best-offer debug Config option (or "false" if best-offer debugging is not compiled in). If best-offer debugging is compiled in, also give those classes new boolean members to store the value of the option.
If best-offer debugging is compiled in and the run-time Config option is set, check the results of getBestOffer() against a new getBestOfferSlow().
6714930
to
ae3dfa0
Compare
r+ ae3dfa0 |
Best-offer debugging
Updates and integrates some formerly-private debugging for
getBestOffer()
which cross-checks its return values against a much slower, simpler algorithm.Because the debug algorithm is so slow, it is compiled in by default only when tests are compiled in (or when explicitly requested with a
configure
option), and if is compiled in, it runs by default only under thetest
andfuzz
commands (or when explicitly requested with a command-line option; it can also be disabled fortest
andfuzz
with a command-line option).Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)