Skip to content

Conversation

@heifner
Copy link
Contributor

@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
@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.

@heifner

This comment was marked as resolved.

Copy link
Contributor

@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

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
Contributor 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.

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
@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