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

Only advance finalizer policy generation and provide diff in block header on changes to pending finalizer policy #306

Closed
arhag opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
consensus-protocol Change to the consensus protocol. Impacts light client validation. 👍 lgtm

Comments

@arhag
Copy link
Member

arhag commented Jun 17, 2024

Depends on #292.

Add a new struct proposed_finalizer_policy that is identical to the current finalizer_policy except that it does not have the generation number in it.

There should not be any way to calculate a digest of proposed_finalizer_policy. Only finalizer_policy should have a member function digest to calculate the digest of the finalizer policy which includes the generation number.

A finalizer_policy can be constructed from a proposed_finalizer_policy and the generation number to use in the constructed finalizer_policy.

Diff calculation is only necessary from a finalizer_policy to a finalizer_policy.

transaction_context::set_proposed_finalizers should take a proposed_finalizer_policy as a parameter.

The changes in #292 will have changed block_header_state::finalizer_policies to block_header_state::proposed_finalizer_policies which will now only include proposed finalizer policies. But with the changes in this PR, the type of that field can further be changed to:

std::vector<std::pair<block_num_type, proposed_finalizer_policy_ptr>> proposed_finalizer_policies;

Now when we promote a proposed finalizer policy to pending, we set its generation number to 1 plus the generation number of the prior active finalizer_policy (which may have just become active within the same next function). When this promotion happens, we include the diff between these two policies in the block header.

Additionally, for the block in which the proposed finalizer policy gets promoted to pending (the one that includes a diff), we should include the new pending finalizer policy in the SHiP finality_data_t associated to that block. That means renaming the existing field finality_data_t::proposed_finalizer_policy to finality_data_t::pending_finalizer_policy (but keeping the same type std::optional<finalizer_policy>) to capture the semantic change.

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. 👍 lgtm
Projects
Archived in project
Development

No branches or pull requests

3 participants