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 issue with reported fork head vs retrieval of block from fork db #774

Merged
merged 6 commits into from
Mar 5, 2023

Conversation

heifner
Copy link
Member

@heifner heifner commented Mar 3, 2023

When IRREVERSIBLE mode was added EOSIO/eos#4424 access to fork db head was added to controller, during the refactor of fork database EOSIO/eos#6624 access to fork db pending was added to deal with irreversible mode.

This PR simplifies this interface by returning the expected values for fork db head according to IRREVERSIBLE mode or not. This conforms with the existing functionality of fetch_block_state_by_number which looks at IRREVERSIBLE mode to determine what branch to search on.

Not sure if this should be back-ported. We have not seen the test failure on previous versions. My guess is the performance improvements in 4.0 around not having to jump to the main thread to get blocks is causing this to be much more likely.

Resolves #772

@heifner heifner added the OCI Work exclusive to OCI team label Mar 3, 2023
libraries/chain/controller.cpp Outdated Show resolved Hide resolved
@greg7mdp greg7mdp self-requested a review March 3, 2023 21:17
Copy link
Contributor

@greg7mdp greg7mdp left a comment

Choose a reason for hiding this comment

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

Nice, it is getting cleaner. I left a couple more suggestions.

plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
return my->fork_db.pending_head()->id;
block_state_ptr controller_impl::fork_db_head() const {
if( read_mode == db_read_mode::IRREVERSIBLE ) {
// When in IRREVERSIBLE mode fork_db blocks are marked valid when they become irreversible so that
Copy link
Member

Choose a reason for hiding this comment

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

I like those comments!

@heifner heifner merged commit 5b0108f into main Mar 5, 2023
@heifner heifner deleted the GH-772-head branch March 5, 2023 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test Failure: trx_finality_status_forked_test
3 participants