-
Notifications
You must be signed in to change notification settings - Fork 73
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
IF: Support Leap 5 Fork Database disk format and new Savanna disk format. #2306
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0aae968
Add support for new version of fork_db persistent file.
greg7mdp 70c3919
Merge branch 'hotstuff_integration' of github.com:AntelopeIO/leap int…
greg7mdp 009ff14
Fix issue when loading from snapshot post IF-transition
greg7mdp 8d4d5a0
Update comment
greg7mdp c03d87c
Address PR comments.
greg7mdp c095bae
Address PR comments.
greg7mdp 2043d6e
Merge branch 'hotstuff_integration' of github.com:AntelopeIO/leap int…
greg7mdp 647e35d
Rename `block_handle_variant_t&` to `block_state_variant_t&`
greg7mdp 06329b4
remove `std::memory_order_relaxed`.
greg7mdp d57644d
Don't save a fork_db with an undefined head.
greg7mdp 3385dca
Make sure `head` is in the index before saving (since we serialize on…
greg7mdp 5d57dcb
Make `fork_db_l` and `fork_db_s` direct members and not pointers.
greg7mdp af8d8e6
Fix `fork_database::is_valid`
greg7mdp 846703a
Merge branch 'hotstuff_integration' of github.com:AntelopeIO/leap int…
greg7mdp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1059,12 +1059,7 @@ struct controller_impl { | |
} | ||
|
||
void fork_db_reset_root_to_chain_head() { | ||
fork_db.apply<void>([&](auto& forkdb) { | ||
apply<void>(chain_head, [&](const auto& head) { | ||
if constexpr (std::is_same_v<std::decay_t<decltype(head)>, std::decay_t<decltype(forkdb.head())>>) | ||
forkdb.reset_root(head); | ||
}); | ||
}); | ||
fork_db.reset_root(chain_head.internal()); | ||
} | ||
|
||
signed_block_ptr fork_db_fetch_block_by_id( const block_id_type& id ) const { | ||
|
@@ -1438,10 +1433,10 @@ struct controller_impl { | |
} | ||
|
||
if (startup == startup_t::genesis) { | ||
if (!fork_db.fork_db_if_present()) { | ||
if (fork_db.version_in_use() == fork_database::in_use_t::legacy) { | ||
// switch to savanna if needed | ||
apply_s<void>(chain_head, [&](const auto& head) { | ||
fork_db.switch_from_legacy(chain_head); | ||
fork_db.switch_from_legacy(chain_head.internal()); | ||
}); | ||
} | ||
auto do_startup = [&](auto& forkdb) { | ||
|
@@ -1694,12 +1689,12 @@ struct controller_impl { | |
// If we start at a block during or after the IF transition, we need to provide this information | ||
// at startup. | ||
// --------------------------------------------------------------------------------------------- | ||
if (fork_db.fork_db_if_present()) { | ||
if (auto in_use = fork_db.version_in_use(); in_use == fork_database::in_use_t::both || in_use == fork_database::in_use_t::savanna) { | ||
// we are already past the IF transition point where we create the updated fork_db. | ||
// so we can't rely on the finalizer safety information update happening during the transition. | ||
// see https://github.com/AntelopeIO/leap/issues/2070#issuecomment-1941901836 | ||
// ------------------------------------------------------------------------------------------- | ||
if (fork_db.fork_db_legacy_present()) { | ||
if (in_use == fork_database::in_use_t::both) { | ||
// fork_db_legacy is present as well, which means that we have not completed the transition | ||
auto set_finalizer_defaults = [&](auto& forkdb) -> void { | ||
auto lib = forkdb.root(); | ||
|
@@ -3025,7 +3020,7 @@ struct controller_impl { | |
|
||
chain_head = block_handle{std::move(new_head)}; | ||
if (s != controller::block_status::irreversible) { | ||
fork_db.switch_from_legacy(chain_head); | ||
fork_db.switch_from_legacy(chain_head.internal()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not your PR. This |
||
} | ||
} | ||
|
||
|
@@ -3756,7 +3751,7 @@ struct controller_impl { | |
} else if( new_head->id() != chain_head.id() ) { | ||
ilog("switching forks from ${current_head_id} (block number ${current_head_num}) ${c} to ${new_head_id} (block number ${new_head_num}) ${n}", | ||
("current_head_id", chain_head.id())("current_head_num", chain_head.block_num())("new_head_id", new_head->id())("new_head_num", new_head->block_num()) | ||
("c", log_fork_comparison(chain_head))("n", log_fork_comparison(*new_head))); | ||
("c", log_fork_comparison(chain_head.internal()))("n", log_fork_comparison(*new_head))); | ||
|
||
// not possible to log transaction specific infor when switching forks | ||
if (auto dm_logger = get_deep_mind_logger(false)) { | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Maybe you can have a method
version_is_savanna()
andversion_is_legacy()
to avoid this long expression. But no need to change now.