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 the same way to determine if instant finality is active #2043

Merged
merged 4 commits into from
Jan 6, 2024

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jan 5, 2024

#2028 reports transaction_mroot difference between when it is first calculated and when it is recreated in create_block_state_i. The difference is caused by the way how hs_active is determined for mroot calculation. When transaction_mroot is first created, hs_lib > 0 is used as an indication of hs_active; in create_block_state_i, only presence of instant_finality_extension is used.

This inconsistency causes integration test failures too.

This PR changes to use the same hs_lib > 0 as the indication.

Resolved #2028

@linh2931 linh2931 requested review from greg7mdp and heifner January 5, 2024 15:13
@linh2931 linh2931 linked an issue Jan 5, 2024 that may be closed by this pull request
@linh2931 linh2931 requested a review from heifner January 5, 2024 20:30
trx_mroot = calculate_trx_merkle( b->transactions, !hs_active );
EOS_ASSERT( b->transaction_mroot == trx_mroot, block_validate_exception,
"invalid block transaction merkle root ${b} != ${c}", ("b", b->transaction_mroot)("c", trx_mroot) );
}
Copy link
Member

Choose a reason for hiding this comment

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

This opens up an attack vector as you can create a block with invalid mroot that will pass this validation. I think we can go with your first implementation. There is a small race condition at time of activation, but even if that is tripped and the block is considered invalid, the node will attempt to sync the block in the future and succeed; that is what I meant by re-try.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your insight!

@ericpassmore
Copy link
Contributor

Note:start
group: IF
category: INTERNALS
summary: Unified implementation to detect activation of new faster finality.
Note:end

@linh2931 linh2931 requested a review from heifner January 6, 2024 19:40
@linh2931 linh2931 merged commit 47c56ea into hotstuff_integration Jan 6, 2024
26 checks passed
@linh2931 linh2931 deleted the instant_finality_active branch January 6, 2024 21:25
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.

IF: use the same way to determine if instant finality is active
4 participants