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

[1.0] Add max_reversible_blocks_allowed(), use in net_plugin to limit sync-fetch-span #609

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented Aug 21, 2024

Instead of net_plugin calculating how many reversible blocks are allowed to limit sync-fetch-span, call a method on controller. Now logic about which fork database to check is encapsulated to the controller.

Resolves #608

…et_plugin for limiting sync_fetch_span instead of calculating the value in net_plugin
@heifner heifner added the OCI Work exclusive to OCI team label Aug 21, 2024
@heifner heifner linked an issue Aug 21, 2024 that may be closed by this pull request
@heifner heifner requested review from greg7mdp and arhag August 21, 2024 00:54
int32_t max_reversible_blocks_allowed() const {
if (conf.max_reversible_blocks == 0)
return std::numeric_limits<int32_t>::max();
return conf.max_reversible_blocks - fork_db_savanna_size();
Copy link
Contributor

@greg7mdp greg7mdp Aug 21, 2024

Choose a reason for hiding this comment

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

shouldn't it also return std::numeric_limits<int32_t>::max() when we have a legacy fork_db instead of max_reversible_blocks?

Otherwise in net_plugin you could have (reversible_remaining < sync_fetch_span). I guess maybe it is not a big deal, it just may limit sync_fetch_span which could seem strange.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe. As is, if max-reversible-blocks is default 3600 it limits sync-fetch-span to 3600. I kind of thought that a good thing. But would be ok with changing it to return MAX_INT32 if legacy fork db. @arhag what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think std::numeric_limits<int32_t>::max() if more bulletproof, as you don't have to check how the return value is used in net_plugin to know it won't add a limitation.

Copy link
Member

Choose a reason for hiding this comment

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

I do think it should return the max value from this function if only dealing with the legacy fork db. It is also consistent with your existing comment describing max_reversible_blocks_allowed in controller.hpp.

plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
libraries/chain/controller.cpp Show resolved Hide resolved
@heifner heifner merged commit 7254bab into release/1.0 Aug 21, 2024
36 checks passed
@heifner heifner deleted the GH-608-max-reversible-sync branch August 21, 2024 19:39
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: INTERNALS
summary: Improve where calculation of max_reversible_blocks_allowed is performed.
Note:end

@ericpassmore ericpassmore added the bug The product is not working as was intended. label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The product is not working as was intended. OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

max-reversible-blocks exceeded while syncing legacy blocks
4 participants