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

P2P: Update p2p-auto-bp-peer for Savanna #1244

Merged
merged 10 commits into from
Mar 11, 2025
Merged

P2P: Update p2p-auto-bp-peer for Savanna #1244

merged 10 commits into from
Mar 11, 2025

Conversation

heifner
Copy link
Member

@heifner heifner commented Mar 7, 2025

Change p2p-auto-bp-peer to remain connected to the current active producer schedule instead of just the next 2 in the schedule. With Savanna, it is important to have connections to all finalizers. Currently block proposers are also block finalizers.

Block producers can configure their BP canary p2p node with p2p-auto-bp-peer entries for all p2p nodes they know are associated with corresponding block producer. As the active producer schedule changes, the net_plugin will connect to peers that are in the pending producer schedule and disconnect from peers when they drop out of the active schedule.

Resolves #1227

heifner added 4 commits March 5, 2025 16:30
…ck proposers instead of just a few. Remove requirement to be configured as a block producer.
…ssue with the test not actually testing anything because python peers = peers.sort() meant that peers==None.
@heifner heifner linked an issue Mar 7, 2025 that may be closed by this pull request
@heifner heifner added the OCI Work exclusive to OCI team label Mar 7, 2025
@heifner heifner requested review from greg7mdp and linh2931 March 7, 2025 13:03
…avanna head is so close to lib and a node can temporarily fall back into head catchup on slight block delays.
Base automatically changed from GH-1239-p2p-stuck-in-head-catchup-main to main March 7, 2025 14:14
Copy link
Member

@linh2931 linh2931 left a comment

Choose a reason for hiding this comment

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

This version is much simpler/cleaner than the legacy version.

@ericpassmore
Copy link
Contributor

Note:start
category: Other
component: P2P
summary: Modify p2p-auto-bp-peer to connect to all finalizers, the top 21 producers.
Note:end

Comment on lines +31 to +32
flat_set<account_name> pending_configured_bps;
flat_set<account_name> active_configured_bps;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think boost::unordered_flat_set would be faster, although it may not make a significant difference and you wouldn't be able to use the std::set_* algos.
Oh and you wouldn't be able to compare them in tests. Forget it then.

mock_connections_manager connections;
std::vector<std::string> p2p_addresses{"0.0.0.0:9876"};
const std::string& get_first_p2p_address() const { return *p2p_addresses.begin(); }

bool in_sync() { return is_in_sync; }
bool not_lib_catchup() { return is_not_lib_catchup; }
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like these negative booleans personally, for example this is harder to parse for me:
plugin.is_not_lib_catchup = true;

than:

plugin._lib_catchup = false;

I think it would be better to have:
bool lib_catchup() { return _lib_catchup; }

Copy link
Member Author

Choose a reason for hiding this comment

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

renamed

"proda"_n, "prodb"_n, "prodc"_n, "prodd"_n, "prode"_n, "prodf"_n,
"prodg"_n, "prodh"_n, "prodi"_n, "prodj"_n, /*"prodk"_n,*/ "prodl"_n,
"prodm"_n, "prodn"_n, "prodo"_n, "prodp"_n, "prodq"_n, "prodr"_n,
"prods"_n, /*"prodt"_n,*/ "produ"_n };
Copy link
Member

Choose a reason for hiding this comment

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

couple items commented out here and above. Maybe consider removing them; it's not clear if it's intentional or not

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is intentional, the list is named producers_minus_prodkt and prodk and prodt are commented out for clarity.

Copy link
Member

Choose a reason for hiding this comment

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

ah true for this new one the name does make it clearer. But the two above don't have such an indication though, and they weren't previously commented out; only newly commented out in this PR, that made those more sus to me

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated comments: a1f55d6

Copy link
Member

Choose a reason for hiding this comment

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

lgtm

@heifner heifner merged commit b929322 into main Mar 11, 2025
36 checks passed
@heifner heifner deleted the GH-1227-auto-bp-peer branch March 11, 2025 17:40
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.

Update p2p-auto-bp-peer for finalizers
5 participants