-
Notifications
You must be signed in to change notification settings - Fork 15
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
Synchronize wallet import and chain reindexing #883
Conversation
The problem in the current test is that it relies (a bit) on finalization state which was restored from disk. We have finalization state serialization (see |
58c7b50
to
3814df2
Compare
8193843
to
51ed508
Compare
d6d06b6
to
cb1e076
Compare
@dsaveliev I would appreciate a little bit less force-pushes and rebases. I briefly took a look yesterday evening and now this is very different, so I have to start from scratch. |
Concept ACK |
cb1e076
to
cd71b71
Compare
cd71b71
to
0afe0c6
Compare
Travis, twice:
|
By design, waiting for #881 |
d81bb05
to
0ff0c65
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.
I humbly ask you to ensure finalizer operating well after reindex.
adecf55
to
ecf5a09
Compare
a31476b
to
e308ffb
Compare
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
e308ffb
to
a419ad9
Compare
Signed-off-by: Dmitry Saveliev <dima@thirdhash.com>
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 1b18c37
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.
utACK a419ad9
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 1b18c37
if (gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) { | ||
LoadMempool(); | ||
fDumpMempoolLater = !fRequestShutdown; | ||
} | ||
|
||
// Since the import process can restore the node's ValidatorState, |
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 think, mentioning of ValidatorState misses a huge step in explanation of this code purpose. I'd rephrase this comment in a way to describe how WalletExtention
works when reindex is enabled. What do you think?
@@ -1663,7 +1672,8 @@ bool AppInitMain() | |||
// UNIT-E TODO: Snapshot must start working once we can trust commits | |||
// (commits merkle root added to the header and FROM_COMMITS is dropped). | |||
// Check #836 for details. | |||
if (!snapshot::IsISDEnabled()) { | |||
// In the case of reindex, don't restore finalization's state, since it will be built from scratch. | |||
if (!snapshot::IsISDEnabled() && !fReindex) { |
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 know it is not a main purpose of this PR, but since it fixes things in reindex, I guess we can do it bit better right here. I suggest reseting finalization state database in case of reindex just like CBlockIndex database does it:
pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReset));
Where fReset=fReindex
is passed as fWipe
parameter to the DB.
You can configure StateDBParams.wipe from finalization::StateDB::New
by using ArgsManager
dependency.
proposer=self.proposer, | ||
finalizer=self.finalizer, | ||
count=10) | ||
assert_equal(len(votes), 10) |
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 don't see a reason to generate so many epochs. This test takes ~35 seconds on my machine and huge portion of the time is unnecessary block generation. I just played with the test: changing epoch_length=5 and generating 2 epochs instead of 10 decreases test time to 10 seconds.
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
""" | ||
Test running united with -reindex options and with finalization transactions |
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.
nit: we changed the process name to unite-e
unit-e
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.
united -> unit-e
Fixes #810
Depends on #881
There is a race condition between import thread and wallets sync.
It's possible for the wallet to process VOTE transaction meanwhile ThreadImport didn't import the corresponding validator yet.
In order to avoid such problems during reindexing, I tried to sync these two processes.
In addition, I turned off validator state loading from backup since reindexing must restore it from scratch.
This change depends on #881, so the test will be red until the PR is merged.
Signed-off-by: Dmitry Saveliev dima@thirdhash.com