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

Use 2-chain for finality #389

Merged
merged 25 commits into from
Jul 24, 2024
Merged

Use 2-chain for finality #389

merged 25 commits into from
Jul 24, 2024

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jul 22, 2024

  • Update finality_core to use two-chain for finality.
  • Update the proofs in get_new_block_numbers().
  • Update all relevant tests.

Resolves #384

@linh2931 linh2931 marked this pull request as draft July 22, 2024 17:47
Base automatically changed from new_finality_digest to main July 22, 2024 21:27
@heifner heifner added the consensus-protocol Change to the consensus protocol. Impacts light client validation. label Jul 23, 2024
@linh2931 linh2931 marked this pull request as ready for review July 23, 2024 18:49
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: INTERNALS
summary: Switch to 2-chain for finality.
Note:end

// -------------------------------------------------------------------------------
for (size_t i=0; i<3; ++i) {
for (size_t i=0; i<(num_chains_to_final - 1); ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we need a 2-chain, why num_chains_to_final - 1. Also the comment at line 733 above is incorrect, we won't have three pending policies at the same time.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed it by c1feb76

Thanks.

t.check_head_finalizer_policy(1u, pubkeys0); // one 3-chain - new policy still should not be active

t.produce_blocks(2);
t.produce_blocks(num_chains_to_final-1);
t.check_head_finalizer_policy(1u, pubkeys0); // one 3-chain + 2 blocks - new policy still should not be active
Copy link
Contributor

Choose a reason for hiding this comment

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

comment is wrong, it should be + 1 block

Copy link
Member Author

@linh2931 linh2931 Jul 24, 2024

Choose a reason for hiding this comment

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

It's decided the comments in the remaining files to be fixed later. Tracked by #398

@@ -101,8 +101,8 @@ BOOST_AUTO_TEST_CASE(savanna_set_finalizer_multiple_test) { try {
auto pubkeys2 = fin_keys.set_finalizer_policy(2u).pubkeys;
t.produce_block();
t.check_head_finalizer_policy(1u, pubkeys0); // new policy should only be active until after two 3-chains
Copy link
Contributor

Choose a reason for hiding this comment

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

many comments in this file still mention 3-chains. Some in other files as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be fixed by #398

b = t.produce_block(); // pending: pubkeys5, proposed: pubkeysr6, pubkeys7, pubkeys8, pubkeys9
verify_block_finality_policy_diff(b, 9, pubkeys9.back());
auto pubkeys10 = fin_keys.set_finalizer_policy(10u).pubkeys;
t.check_head_finalizer_policy(3u, pubkeys3); // 7 blocks after pubkeys4, pubkeys4 should still be active
t.check_head_finalizer_policy(5u, pubkeys5); // 7 blocks after pubkeys4, pubkeys4 should still be active
Copy link
Contributor

Choose a reason for hiding this comment

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

comment is clearly incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be fixed by #398

@linh2931 linh2931 merged commit f9e9aa6 into main Jul 24, 2024
36 checks passed
@linh2931 linh2931 deleted the 2_chains branch July 24, 2024 21:22
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use 2-chain for finality
5 participants