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: Use finalizer diffs in instant_finality_extension #118

Merged
merged 24 commits into from
May 9, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented May 7, 2024

Instead of placing the entire finalizer set in the instant_finality_extension, only put a diff of the active finalizer policy in the extension.

@heifner heifner added the OCI Work exclusive to OCI team label May 7, 2024
unittests/svnn_ibc_tests.cpp Outdated Show resolved Hide resolved
@heifner heifner requested review from greg7mdp and linh2931 May 7, 2024 21:26
@ericpassmore
Copy link
Contributor

Note:start
group: IF
category: PERFORMANCE
summary: Instead of placing the entire finalizer set in the instant_finality_extension, only put a diff of the active finalizer policy in the extension.
Note:end

@greg7mdp
Copy link
Contributor

greg7mdp commented May 8, 2024

I think ordered_diff should be templatized by size_type, because for policy diffs uint16_t is probably plenty enough to store in the remove_indexes and insert_indexes vectors.

libraries/chain/block_header_state.cpp Outdated Show resolved Hide resolved
libraries/chain/block_header_state.cpp Outdated Show resolved Hide resolved
libraries/chain/block_header_state.cpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/block_header_state.hpp Outdated Show resolved Hide resolved
libraries/libfc/include/fc/container/ordered_diff.hpp Outdated Show resolved Hide resolved
libraries/libfc/include/fc/container/ordered_diff.hpp Outdated Show resolved Hide resolved
@heifner

This comment was marked as resolved.

Copy link
Member

@linh2931 linh2931 left a comment

Choose a reason for hiding this comment

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

I started to wonder if it is worthy the trouble (time to diff and apply_diff, and more code) to pack diff only in the extension. Another side effect is one cannot just look at the extension to see the finalizers; previous extensions need to be checked.

@heifner heifner requested a review from greg7mdp May 8, 2024 23:41
@heifner heifner requested a review from linh2931 May 8, 2024 23:41
@heifner heifner added the consensus-protocol Change to the consensus protocol. Impacts light client validation. label May 9, 2024
libraries/chain/block_header_state.cpp Outdated Show resolved Hide resolved

namespace eosio::chain {

static_assert(std::numeric_limits<uint16_t>::max() <= config::max_finalizers);
Copy link
Contributor

Choose a reason for hiding this comment

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

should be static_assert(config::max_finalizers <= std::numeric_limits<uint16_t>::max() + 1)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, already had that in my changes for the next PR. Note you can't use max() + 1 because that overflows. So max_finalizers - 1.

@@ -71,6 +71,18 @@ BOOST_AUTO_TEST_CASE(savanna_set_finalizer_multiple_test) { try {
size_t num_keys = 50u;
size_t finset_size = 21u;

auto verify_block_finality_generation = [](const signed_block_ptr& block, uint32_t gen, const bls_public_key& key) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good check!

No big deal, but I think this is a more accurate name.

Suggested change
auto verify_block_finality_generation = [](const signed_block_ptr& block, uint32_t gen, const bls_public_key& key) {
auto verify_block_finality_policy_diff = [](const signed_block_ptr& block, uint32_t gen, const bls_public_key& key) {

@heifner heifner merged commit 72c2958 into main May 9, 2024
36 checks passed
@heifner heifner deleted the GH-5-diff-policies branch May 9, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus-protocol Change to the consensus protocol. Impacts light client validation. OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use diffs for proposer finalizer policy and proposer policy in block_header extension
4 participants