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: Block propagation optimization #1099

Merged
merged 33 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b54eea7
GH-1091 Initial implementation of block_nack with block_nack_message …
heifner Jan 6, 2025
167ecb4
GH-1091 Call send_block_nack on correct strand
heifner Jan 6, 2025
5094f92
GH-1091 Handle repeated block_notice with request for blocks
heifner Jan 6, 2025
2afb174
GH-1091 Use correct req_blocks.mode
heifner Jan 7, 2025
1d18678
GH-1091 Use normal req_blocks.mode since need to start with provided …
heifner Jan 8, 2025
dd0417b
GH-1091 Add back sync_write_queue for sync blocks
heifner Jan 8, 2025
f5be27b
GH-1091 Check if peer has block before sending either block or block_…
heifner Jan 8, 2025
85bbf2b
GH-1091 Fix compile error
heifner Jan 8, 2025
84db166
GH-1091 Handle on_fork with normal request_message correctly
heifner Jan 8, 2025
843e3d3
GH-1091 Test threshold of 0
heifner Jan 9, 2025
cf44653
GH-1091 Wait for 7 empty blocks before starting perf run. The bios no…
heifner Jan 10, 2025
7ff8ebf
GH-1091 Always send block_nack when a block is received the node alre…
heifner Jan 10, 2025
65431db
GH-1091 Call blk_send_branch directly with requested blocks instead o…
heifner Jan 13, 2025
5c0e192
GH-1091 Better output on failure
heifner Jan 13, 2025
121fadc
GH-1091 Always broadcast blocks we produce
heifner Jan 13, 2025
35d3118
GH-1091 Only send block_notice if in sync.
heifner Jan 13, 2025
efd95f6
GH-1091 Optimize blk_send_branch for when branch send already in prog…
heifner Jan 13, 2025
ddcf5df
GH-1091 Optimize blk_send_branch for when branch send already in prog…
heifner Jan 14, 2025
3627f4c
GH-1091 Do not request blocks if already requested on a different con…
heifner Jan 14, 2025
6fcd36a
GH-1091 Remove is_in_sync check for block notice send. This degrades …
heifner Jan 14, 2025
e0cc48b
GH-1091 Add p2p-disable-block-nack option
heifner Jan 14, 2025
f4f32eb
Merge branch 'main' into GH-1091-block-nack
heifner Jan 14, 2025
d2ffa9f
GH-1091 Use contains instead of count
heifner Jan 17, 2025
f414b80
GH-1091 Remove unneeded code
heifner Jan 17, 2025
4e5acfa
GH-1091 Use an enum instead of a bool for to_sync_queue
heifner Jan 17, 2025
2cb2f47
GH-1091 Updated comment
heifner Jan 17, 2025
9db544e
GH-1091 Simplified if by using the calculated _write_queue_size
heifner Jan 17, 2025
9361c85
GH-1091 Fix log of received block nack to be clearer
heifner Jan 17, 2025
1a07ac2
GH-1091 Update log messages
heifner Jan 17, 2025
06dad7d
Merge branch 'main' into GH-1091-block-nack
heifner Jan 20, 2025
a1bebf2
GH-1091 Use debug level log instead of info
heifner Jan 23, 2025
2c1cd11
GH-1101 Add previous to block_notice_message which allows for immedia…
heifner Jan 25, 2025
6fbf7b2
Merge branch 'main' into GH-1091-block-nack
heifner Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class bp_connection_manager {
config.my_bp_accounts.insert(accounts.begin(), accounts.end());
}

// thread safe, my_bp_accounts only modified during plugin startup
bool is_producer(account_name account) const {
return config.my_bp_accounts.contains(account);
}

// Only called at plugin startup
void set_bp_peers(const std::vector<std::string>& peers) {
try {
Expand Down
16 changes: 15 additions & 1 deletion plugins/net_plugin/include/eosio/net_plugin/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace eosio {
uint32_t pending{0};
vector<T> ids;
bool empty () const { return (mode == none || ids.empty()); }
bool operator==(const select_ids&) const noexcept = default;
};

using ordered_txn_ids = select_ids<transaction_id_type>;
Expand All @@ -134,6 +135,15 @@ namespace eosio {
uint32_t end_block{0};
};

struct block_nack_message {
block_id_type id;
};

struct block_notice_message {
block_id_type previous;
block_id_type id;
};

using net_message = std::variant<handshake_message,
chain_size_message,
go_away_message,
Expand All @@ -143,7 +153,9 @@ namespace eosio {
sync_request_message,
signed_block,
packed_transaction,
vote_message>;
vote_message,
block_nack_message,
block_notice_message>;

} // namespace eosio

Expand All @@ -162,6 +174,8 @@ FC_REFLECT( eosio::time_message, (org)(rec)(xmt)(dst) )
FC_REFLECT( eosio::notice_message, (known_trx)(known_blocks) )
FC_REFLECT( eosio::request_message, (req_trx)(req_blocks) )
FC_REFLECT( eosio::sync_request_message, (start_block)(end_block) )
FC_REFLECT( eosio::block_nack_message, (id) )
FC_REFLECT( eosio::block_notice_message, (previous)(id) )

/**
*
Expand Down
Loading
Loading