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

Rep crawler overhaul #4449

Merged
merged 28 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
27973bc
Improve channel logging
pwojcikdev Feb 22, 2024
efe7606
Organize members
pwojcikdev Feb 13, 2024
167fefe
Single mutex
pwojcikdev Feb 15, 2024
e820ed0
Move collect_container_info into source file
pwojcikdev Feb 15, 2024
d867e5f
Move rep_crawler tests to a dedicated file
pwojcikdev Feb 16, 2024
3cdee96
Overhaul `rep_crawler`
pwojcikdev Feb 15, 2024
3d80318
Improve tests
pwojcikdev Feb 16, 2024
70003b7
Simplify `nano::representative` struct
pwojcikdev Feb 17, 2024
fb516f3
Use pointer as channel identity
pwojcikdev Feb 19, 2024
8c8026d
Rework `rep_crawler::process ()`
pwojcikdev Feb 19, 2024
c45d78f
Move remaining rep_crawler tests
pwojcikdev Feb 20, 2024
80c0b8b
Overhaul `rep_crawler` part 2
pwojcikdev Feb 21, 2024
60f1901
Fix tests
pwojcikdev Feb 23, 2024
331ea3c
Cleanup
pwojcikdev Feb 24, 2024
5c93ddd
Uniform rep crawler log enum naming
pwojcikdev Feb 24, 2024
603379e
Notify condition after successful response
pwojcikdev Feb 24, 2024
202d6ce
Simplify `keepalive_preconfigured ()`
pwojcikdev Feb 25, 2024
beb4c5b
Allow multiple queries per channel during warmup
pwojcikdev Feb 25, 2024
638b18e
Improve `collect_container_info ()`
pwojcikdev Feb 25, 2024
701d821
No limiter drop
pwojcikdev Feb 26, 2024
5cc8256
Adjustments
pwojcikdev Feb 26, 2024
3ddfd78
Throttle queries to active reps
pwojcikdev Mar 5, 2024
e7f28c6
Rep crawler test case for having 2 reps inside one node
dsiganos Mar 7, 2024
eb55b98
rep_query_interval needs to be faster for dev network
dsiganos Mar 7, 2024
62fb8ff
Fix rep tracking when there are multiple reps inside one node
dsiganos Mar 7, 2024
4f2f66b
Do not complain when a query timeout, if replies were received
dsiganos Mar 7, 2024
1f0fd2e
Merge branch 'develop' into repcrawler-overhaul-2
dsiganos Mar 8, 2024
49a6b41
Fix comment of rep_crawler::process function
dsiganos Mar 8, 2024
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
1 change: 1 addition & 0 deletions nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ add_executable(
optimistic_scheduler.cpp
processing_queue.cpp
processor_service.cpp
rep_crawler.cpp
peer_container.cpp
scheduler_buckets.cpp
request_aggregator.cpp
Expand Down
16 changes: 2 additions & 14 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

using namespace std::chrono_literals;

namespace nano
{
/*
* Tests that an election can be confirmed as the result of a confirmation request
*
Expand Down Expand Up @@ -80,10 +78,7 @@ TEST (active_transactions, confirm_election_by_request)
ASSERT_FALSE (peers.empty ());

// Add representative (node1) to disabled rep crawler of node2
{
nano::lock_guard<nano::mutex> guard (node2.rep_crawler.probable_reps_mutex);
node2.rep_crawler.probable_reps.emplace (nano::dev::genesis_key.pub, *peers.cbegin ());
}
node2.rep_crawler.force_add_rep (nano::dev::genesis_key.pub, *peers.cbegin ());

// Expect a vote to come back
ASSERT_TIMELY (5s, election->votes ().size () >= 1);
Expand All @@ -97,10 +92,7 @@ TEST (active_transactions, confirm_election_by_request)
ASSERT_TIMELY (5s, nano::test::confirmed (node1, { send1 }));
ASSERT_TIMELY (5s, nano::test::confirmed (node2, { send1 }));
}
}

namespace nano
{
TEST (active_transactions, confirm_frontier)
{
nano::test::system system;
Expand Down Expand Up @@ -144,10 +136,7 @@ TEST (active_transactions, confirm_frontier)
// Add representative to disabled rep crawler
auto peers (node2.network.random_set (1));
ASSERT_FALSE (peers.empty ());
{
nano::lock_guard<nano::mutex> guard (node2.rep_crawler.probable_reps_mutex);
node2.rep_crawler.probable_reps.emplace (nano::dev::genesis_key.pub, *peers.begin ());
}
node2.rep_crawler.force_add_rep (nano::dev::genesis_key.pub, *peers.begin ());

ASSERT_EQ (nano::block_status::progress, node2.process (send));
ASSERT_TIMELY (5s, !node2.active.empty ());
Expand All @@ -160,7 +149,6 @@ TEST (active_transactions, confirm_frontier)
ASSERT_TIMELY (5s, node2.active.empty ());
ASSERT_GT (election2->confirmation_request_count, 0u);
}
}

TEST (active_transactions, keep_local)
{
Expand Down
4 changes: 2 additions & 2 deletions nano/core_test/confirmation_solicitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST (confirmation_solicitor, batches)
auto & node2 = *system.add_node (node_flags);
auto channel1 = nano::test::establish_tcp (system, node2, node1.network.endpoint ());
// Solicitor will only solicit from this representative
nano::representative representative (nano::dev::genesis_key.pub, channel1);
nano::representative representative{ nano::dev::genesis_key.pub, channel1 };
std::vector<nano::representative> representatives{ representative };
nano::confirmation_solicitor solicitor (node2.network, node2.config);
solicitor.prepare (representatives);
Expand Down Expand Up @@ -70,7 +70,7 @@ TEST (confirmation_solicitor, different_hash)
auto & node2 = *system.add_node (node_flags);
auto channel1 = nano::test::establish_tcp (system, node2, node1.network.endpoint ());
// Solicitor will only solicit from this representative
nano::representative representative (nano::dev::genesis_key.pub, channel1);
nano::representative representative{ nano::dev::genesis_key.pub, channel1 };
std::vector<nano::representative> representatives{ representative };
nano::confirmation_solicitor solicitor (node2.network, node2.config);
solicitor.prepare (representatives);
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/election.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks)
ASSERT_NE (channel, nullptr);

auto vote2 = nano::test::make_final_vote (key1, { send1->hash () });
ASSERT_FALSE (node1.rep_crawler.response (channel, vote2, true));
node1.rep_crawler.force_process (vote2, channel);

ASSERT_FALSE (election->confirmed ());
{
Expand Down
Loading
Loading