-
Notifications
You must be signed in to change notification settings - Fork 14
Add cache of finalization states #429
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
Conversation
|
Snapshot functional tests fail as they try to fork before last finalized checkpoint. @kostyantyn and I are looking at it — a reason for WIP. |
src/esperanza/finalizationstate.cpp
Outdated
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.
This diff looks like a mess, however, it's only code moving here. The split view can help a bit.
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've removed this test as it checks C++ standard behavior.
src/test/validation_block_tests.cpp
Outdated
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.
This test can randomly create forks behind last finalization point, workaround it (fallback to default bitcoin behavior).
test/functional/feature_block.py
Outdated
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.
whitelist is default option for ComparisonTestFramework
Gnappuraz
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.
I really don't think that reading every time the whole blockchain from disk is a good idea, my intuition is that it will make startup time grow linearly with the blockchain and thus potentially taking a long time with disk being a big bottleneck.
src/esperanza/finalizationstate.cpp
Outdated
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.
Here it seems to me is more a reset to Genesis than a reset to anything else.
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.
It resets tip's finalization to the fresh state.
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.
In fact, it's an incorrect and temporary solution until I implement full-sync based on commits, and this PR is a base for that. I don't want to present too large PR at once.
|
@Gnappuraz I understand your concern. I'm about to implement finalization states serialization on every checkpoint, but it would be a different PR, and anyway I think to fall back to reading the whole blockchain in case of serialized data isn't presented for any reason. This implementation allows passing all the tests and works fine for regtest. I'd appreciate if you remove your reject as I don't want to mix too many changes in a single PR. I will add serialization next. |
@frolosofsky, what is passing tests on a new code enabling us? if we know it's not the solution we wanna have, I mean it's not that master is currently red and we're looking for a quick fix. |
|
@Gnappuraz The primary purpose of this PR is adding finalization states cache. Once I implemented it I faced with the similar issue as described in #421: if node starts with some blocks presented on the disk, the cache is empty for that blocks, and it's impossible to accept new blocks further. So that, I implemented restoring finalization state from presented blocks. And I'd point it one more time. After we implement proper serialization of finalization states, I think to keep the possibility to fall back to restoring finalization states from blocks on disk for case serialized data isn't presented for any reason. Sure, I missed this description in the PR, updated. |
Removing for the sake of moving forward and with the conditional that a proper solution for handling state serialization and recovery to/from disk
…lized checkpoint Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
Signed-off-by: Kostiantyn Stepaniuk <kostia@thirdhash.com>
Signed-off-by: Kostiantyn Stepaniuk <kostia@thirdhash.com>
acc6f06 to
d036d26
Compare
Signed-off-by: Kostiantyn Stepaniuk <kostia@thirdhash.com>
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
|
A lot of thanks to @kostyantyn for fixing snapshot tests. |
Signed-off-by: Stanislav Frolov <stanislav@thirdhash.com>
kostyantyn
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.
utACK 60e7a70
Gnappuraz
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.
utACK 60e7a70
This PR prepares finalization state for commits based full sync implementation. There are some interconnected changes:
Implementation of finalization states restoring isn't final. Currently, it restores from blocks on the disk. It's slow for large blockchains but still fine for our tests. I'm about to implement proper finalization states serialization on every checkpoint with ability to fall back to reading blocks for any missing data. For example, let's restore finalization state of the following blockchain:
b49 is a checkpoint and we will have serialized finalization state for it. The algorithm is:
It's only one of possible solutions. Let's discuss it the #432.
Signed-off-by: Stanislav Frolov stanislav@thirdhash.com