Skip to content
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

Refactor fork database #347

Merged
merged 32 commits into from
Jul 10, 2024
Merged

Refactor fork database #347

merged 32 commits into from
Jul 10, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented Jul 9, 2024

  • Remove distinction between fork database pending_head and head
    • head() is now the old pending_head()
    • Track pending head as the head of the fork database best branch index
  • Remove valid as consideration of best fork
    • Set block state valid outside of fork database
    • Remove mark_valid() method and mark_valid_t arg of add()
    • Remove rollback_head_to_root() as block state is_valid() is no longer part of what fork database tracks
  • Persist if_irreversible_block_id in fork database as pending_savanna_lib_id
  • Add pending_lib_id() method to fork database
  • Rename conroller set_if_irreversible_block_id to set_savanna_lib_id
  • Remove fork_db_head_or_pending() from controller and use explicit calls to irreversible_mode() where needed

Developer note: fork database file format changed, restart from snapshot will be required

Resolves #333

heifner added 24 commits July 3, 2024 13:26
…on to avoid confusion with local variables named fork_head
…m pending_head() which will be clearer when renamed to head().
…ition from legacy to savanna depends on this.
libraries/chain/controller.cpp Outdated Show resolved Hide resolved
libraries/chain/fork_database.cpp Outdated Show resolved Hide resolved
Base automatically changed from replay_test to main July 10, 2024 13:28
libraries/chain/include/eosio/chain/fork_database.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/fork_database.hpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Show resolved Hide resolved

/**
* The calculated pending savanna LIB ID that will become LIB or is currently LIB
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those comments are very helpful!

@heifner heifner merged commit 717ec0c into main Jul 10, 2024
36 checks passed
@heifner heifner deleted the GH-333-forkdb-head branch July 10, 2024 16:48
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: INTERNALS
summary: Refactor ForkDB to consolidate concept of HEAD and better track the pending irreversible block.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
4 participants