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

[Fix] Initialize the BFT DAG with the correct certificates at bootup #3162

Merged
merged 14 commits into from Mar 9, 2024

Conversation

raychu86
Copy link
Contributor

@raychu86 raychu86 commented Mar 6, 2024

Motivation

This PR initializes the BFT DAG with the correct committed certificate state by updating sync_bft_dag_at_bootup to simply commit all the certificates that were fetched from ledger. Previously, we were calling DAG::insert and BFT::commit_leader_certificate to simulate the commit process, but because we can guarantee these certificates have already been committed (exist in the ledger), this logic was incorrect.

In addition, we've updated order_dag_with_dfs to skip certificates that already exist in the ledger for the same reason. There is no need to reorder certificates that have been ordered before in previous subdags.

With the removal of the extraneous logic, we could also simplify the sync_bft_dag_at_bootup channel and remove the IS_SYNCING const generic.

Test Plan

Unit tests have been added to check that the DAG state of the BFT after bootup has the correct commit state.

node/bft/src/bft.rs Outdated Show resolved Hide resolved
Co-authored-by: Howard Wu <9260812+howardwu@users.noreply.github.com>
Signed-off-by: Raymond Chu <14917648+raychu86@users.noreply.github.com>
@howardwu howardwu merged commit 9c822d8 into mainnet-staging Mar 9, 2024
@howardwu howardwu deleted the test/bootup-dag branch March 9, 2024 00:33
@howardwu howardwu changed the title Initialize the BFT DAG with the correct certificates at bootup [Fix] Initialize the BFT DAG with the correct certificates at bootup Mar 26, 2024
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.

None yet

3 participants