-
Notifications
You must be signed in to change notification settings - Fork 37
P2P: Add gossip of BP peers #1265
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
Merged
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
7f66aad
GH-1245 Add gossip_bp_peers_message
heifner 4a48bba
GH-1245 Move max_p2p_address_length to net_utils and enforce in split…
heifner 73ba970
GH-1245 Move net_logger_impl to net_logger.hpp
heifner d51c6ed
GH-1245 Move buffer_factory into buffer_factor.hpp
heifner 414c22d
GH-1245 Add tracking and validation of gossip_bp_peers_message.
heifner 1f97d9d
GH-1245 Refactor some functionality into auto_bp_peering.hpp
heifner b337c1a
GH-1245 The gethostname() seems to be testing this python script rath…
heifner b4abdc7
GH-1245 Support both manually configured bp peers and gossip bp peers.
heifner a18b4fc
GH-1245 Remove extra loop
heifner c6bed3b
Merge remote-tracking branch 'spring/gh_1183' into GH-1245-gossip-bp-…
heifner 8c98362
GH-1245 Add is_bp_gossip_peer to connection_status
heifner 1a788ea
GH-1245 Integrate peer_keys_db
heifner dec942d
GH-1245 Add integration test for bp gossip peering
heifner b4cf089
GH-1245 Do not include sig in digest
heifner e8cbb49
GH-1245 Add peerkeys table and actions to system contract
heifner 77bf31d
GH-1245 Update to match system contract
heifner ac93b63
GH-1245 Track active_schedule so when new peers are received in the s…
heifner 8e7e6bd
GH-1245 Fix startup missing disconnect
heifner 8f0c5c4
Merge remote-tracking branch 'spring/gh_1183' into GH-1245-gossip-bp-…
heifner 292e4c2
GH-1245 Reduce test runtime
heifner b17234d
GH-1245 Simplify and add comment
heifner b3fac2f
GH-1245 Add some additional logging
heifner 7cb4faa
GH-1245 Clarify code with extra comments and simplier if logic
heifner fe41bf2
GH-1245 Simplify logic and make sure no more 4 bp peers is maintained…
heifner c47600c
GH-1245 Make sig update faster and simpler
heifner 1e8c4d2
GH-1245 Move call to connect_to_active_bp_peers() to net_plugin and a…
heifner 52d8878
GH-1245 Remove duplicate code and avoid calling back into net_plugin …
heifner d4e2a9e
GH-1245 Verify private key found
heifner d30b57b
GH-1245 Replace is_gossip_bp_connection and is_configured_bp_connecti…
heifner d8f3204
Use `unique_ptr` in buffer factory. use `send_buffer_type` consistent…
greg7mdp 8dff9eb
Make copies of buffers when posting them.
greg7mdp 17c0cec
Merge branch 'main' into GH-1245-gossip-bp-peers
heifner 3f12cb2
Add a `const`
greg7mdp 1f96d42
Merge branch 'GH-1245-gossip-bp-peers' of github.com:AntelopeIO/sprin…
greg7mdp 724edc0
Return a value as `send_buffer` can be modified at any time.
greg7mdp de8699e
Also update return value of `get_gossip_bp_initial_send_buffer`
greg7mdp 95c26bb
Merge pull request #1283 from AntelopeIO/buff_factory_unique_ptr
greg7mdp 18d8057
Merge remote-tracking branch 'spring/main' into GH-1245-gossip-bp-peers
heifner 313dbfd
GH-1245 Verify regpeerkey is final before shutdown
heifner 770049c
Merge remote-tracking branch 'spring/main' into GH-1245-gossip-bp-peers
heifner 818da30
GH-1245 go_away_reason now an enum class
heifner e686d8d
Merge branch 'main' into GH-1245-gossip-bp-peers
heifner 1260fc0
Merge remote-tracking branch 'spring/gh_1183_3' into GH-1245-gossip-b…
heifner 187c406
Merge remote-tracking branch 'spring/gh_1183_3' into GH-1245-gossip-b…
heifner f87f2b3
GH-1245 Fix merge issue
heifner 89ead3a
GH-1245 peerkeys table moved to peer_keys.?pp
heifner 2235077
GH-1245 Simplify implementation since protoalvote not populated for m…
heifner 65f3c9e
GH-1245 enable-stale-production so production restarts on node restart
heifner dff3da9
GH-1245 Integrate peer key retrieval by read-only trx. Required waiti…
heifner e835f95
Merge remote-tracking branch 'spring/main' into GH-1245-gossip-bp-peers
heifner 9e487c0
GH-1245 Update test for simplified system contract
heifner b629769
1245 Improve test robustness in face of temp duplicate connections
heifner b8d8f22
Merge branch 'main' into GH-1245-gossip-bp-peers
heifner 0721d18
Merge remote-tracking branch 'spring/main' into GH-1245-gossip-bp-peers
heifner 596135d
GH-1245 Use peer_name_set_t throughout
heifner f816643
GH-1245 Verify not webauthn sig and don't check for canonical
heifner 3b8145f
GH-1245 Add and use a new endpoint type instead of using string
heifner e70d33b
GH-1245 Fix host/port parsing when there is only one colon
heifner 436e188
GH-1245 Fix auto_bp_peering_test.py to check for correct host name
heifner 67e038f
Merge remote-tracking branch 'spring/main' into GH-1245-gossip-bp-peers
heifner f778d71
GH-1245 Reduce logging on expected already connected calls to resolve…
heifner 75c63e3
GH-1245 Rename fatal_error to invalid_message
heifner 4fe408f
GH-1245 Don't consider a peer outside of top producers a fatal error
heifner 107647b
GH-1245 Add debug log statement when connection first becoming bp gos…
heifner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1286,7 +1286,7 @@ struct controller_impl { | |
| } | ||
| } | ||
|
|
||
| getpeerkeys_res_t get_top_producer_keys(fc::time_point deadline) { | ||
| getpeerkeys_res_t get_top_producer_keys() { | ||
| try { | ||
| auto get_getpeerkeys_transaction = [&]() { | ||
| auto perms = vector<permission_level>{}; | ||
|
|
@@ -1303,7 +1303,7 @@ struct controller_impl { | |
| transaction_metadata::trx_type::read_only); | ||
|
|
||
| // allow a max of 20ms for getpeerkeys | ||
| auto trace = push_transaction(metadata, deadline, fc::milliseconds(20), 0, false, 0); | ||
| auto trace = push_transaction(metadata, fc::time_point::maximum(), fc::milliseconds(20), 0, false, 0); | ||
|
|
||
| if( trace->except_ptr ) | ||
| std::rethrow_exception(trace->except_ptr); | ||
|
|
@@ -3237,6 +3237,11 @@ struct controller_impl { | |
|
|
||
| auto& bb = std::get<building_block>(pending->_block_stage); | ||
|
|
||
| // limit to complete type to avoid multiple calls per block number due to speculative blocks | ||
| if (pending->_block_status == controller::block_status::complete) { | ||
| update_peer_keys(); | ||
| } | ||
|
|
||
| transaction_trace_ptr onblock_trace; | ||
|
|
||
| // block status is either ephemeral or incomplete. Modify state of speculative block only if we are building a | ||
|
|
@@ -3384,12 +3389,16 @@ struct controller_impl { | |
| return onblock_trace; | ||
| } /// start_block | ||
|
|
||
| void update_peer_keys(fc::time_point deadline) { | ||
| void update_peer_keys() { | ||
| // if syncing or replaying old blocks don't bother updating peer keys | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good call I didn't think of this when reviewing other PR |
||
| if (!peer_keys_db.is_active() || fc::time_point::now() - chain_head.timestamp() > fc::minutes(5)) | ||
| return; | ||
|
|
||
| try { | ||
| // update peer public keys from chainbase db using a readonly trx | ||
| auto block_num = chain_head.block_num(); | ||
| if (block_num % 120 == 0) { // update once/minute | ||
| peer_keys_db.update_peer_keys(get_top_producer_keys(deadline)); | ||
| auto block_num = chain_head.block_num() + 1; | ||
| if (peer_keys_db.should_update(block_num)) { // update once/minute | ||
| // update peer public keys from chainbase db using a readonly trx | ||
| peer_keys_db.update_peer_keys(block_num, get_top_producer_keys()); | ||
| } | ||
| } FC_LOG_AND_DROP() | ||
| } | ||
|
|
@@ -5348,10 +5357,6 @@ transaction_trace_ptr controller::start_block( block_timestamp_type when, | |
| bs, std::optional<block_id_type>(), deadline ); | ||
| } | ||
|
|
||
| void controller::update_peer_keys(fc::time_point deadline) { | ||
| my->update_peer_keys(deadline); | ||
| } | ||
|
|
||
| void controller::assemble_and_complete_block( const signer_callback_type& signer_callback ) { | ||
| validate_db_available_size(); | ||
|
|
||
|
|
@@ -5848,16 +5853,20 @@ chain_id_type controller::get_chain_id()const { | |
| return my->chain_id; | ||
| } | ||
|
|
||
| void controller::set_peer_keys_retrieval_active(bool active) { | ||
| my->peer_keys_db.set_active(active); | ||
| void controller::set_peer_keys_retrieval_active(peer_name_set_t configured_bp_peers) { | ||
| my->peer_keys_db.set_active(std::move(configured_bp_peers)); | ||
| } | ||
|
|
||
| peer_info_t controller::get_peer_info(name n) const { | ||
| std::optional<peer_info_t> controller::get_peer_info(name n) const { | ||
| return my->peer_keys_db.get_peer_info(n); | ||
| } | ||
|
|
||
| getpeerkeys_res_t controller::get_top_producer_keys(fc::time_point deadline) { | ||
| return my->get_top_producer_keys(deadline); | ||
| bool controller::configured_peer_keys_updated() { | ||
| return my->peer_keys_db.configured_peer_keys_updated(); | ||
| } | ||
|
|
||
| getpeerkeys_res_t controller::get_top_producer_keys() { | ||
| return my->get_top_producer_keys(); | ||
| } | ||
|
|
||
| db_read_mode controller::get_read_mode()const { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.