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

IF: Update finalizer safety information and rules for how a finalizer signs #2135

Merged
merged 90 commits into from
Feb 15, 2024

Conversation

greg7mdp
Copy link
Contributor

@greg7mdp greg7mdp commented Jan 24, 2024

resolves #2070.

This PR implements support for managing a set of stateful finalizers (the local finalizers that this node is running).

It is important that the safety information for each finalizer (last vote and proposal lock) is preserved across nodeos invocations, since incorrect voting can lead to finality violations.

The safety information for all finalizers is saved in a file named safety.dat, which is by default located in {data_dir}/finalizers. This file preserves the safety information for not only the currently running finalizers, but for all thefinalizers who ever ran on this node with the same specified safety file location.

The currently running finalizers are always the first ones stored in the file, followed by all the inactive ones. After each vote, only the information for the currently running finalizers is written to the file, which is then flushed. This file update occurs before the vote is propagated.

The way the finalizer safety information is initialized (if not found in the persistent safety.dat file) is important, and described here. The initial configuration must be such that it will prevent safety violations, while still allowing liveness to eventually happen, so the finalizer can vote.

This specification may yet evolve, as the document is not 100% completed.

This PR also includes some other misceallenous changes:

  • update fc/crypto bls primitives to take std::span instead of std::vector, so we don't have to do unnecessary copies.
  • correct support for weak digest (which is the strong digest with the 4 characters "WEAK" appended at the end). since we couldn't use digest_type, a custom type weak_digest_t was defined.
  • extract a couple of utility functions from tester.cpp into a new file bls_utils.hpp, so that they can be reused in boost tests.

@greg7mdp greg7mdp changed the base branch from main to hotstuff_integration January 24, 2024 20:51
@greg7mdp greg7mdp marked this pull request as draft January 24, 2024 20:51
@greg7mdp greg7mdp requested a review from linh2931 February 14, 2024 21:02
libraries/chain/block_state.cpp Show resolved Hide resolved
libraries/chain/include/eosio/chain/block_header_state.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/hotstuff/finalizer.hpp Outdated Show resolved Hide resolved
libraries/chain/hotstuff/finalizer.cpp Show resolved Hide resolved
};

// ----------------------------------------------------------------------------------------
struct my_finalizers_t {
Copy link
Member

Choose a reason for hiding this comment

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

I thought this name again. It seems my_fianlizers is more accurate, as we are talking about the finalizers on the local node. In configuration instructions to BPs, local finalizer sounds more natural than my finalizers. my implies something at implementation level like a class or a file. @heifner @arhag ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a class name at the implementation level.

@greg7mdp greg7mdp requested review from heifner and linh2931 February 15, 2024 20:39
@@ -453,6 +454,7 @@ BOOST_AUTO_TEST_CASE(delayed_strong_weak_lost_vote) { try {

BOOST_REQUIRE(cluster.produce_blocks_and_verify_lib_advancing());
} FC_LOG_AND_RETHROW() }
#endif
Copy link
Member

Choose a reason for hiding this comment

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

I believe in Boost unit tests, when safety file is the default, those simulated weak vote tests should have passed. Should come back to revisit those later.

@greg7mdp greg7mdp merged commit e3156fe into hotstuff_integration Feb 15, 2024
26 checks passed
@greg7mdp greg7mdp deleted the gh_2070 branch February 15, 2024 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IF: Update finalizer safety information and rules for how a finalizer signs
4 participants