Skip to content

Commit

Permalink
Merge branch 'nanocurrency:develop' into qt_state_open
Browse files Browse the repository at this point in the history
  • Loading branch information
SergiySW authored Jan 3, 2025
2 parents 7f4b7d6 + e65e07a commit c472af2
Show file tree
Hide file tree
Showing 336 changed files with 11,013 additions and 13,641 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/develop_branch_dockers_deploy.yml

This file was deleted.

11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ endif()

if(MSVC)
add_definitions(/MP)
add_definitions(
-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING) # Suppress iterator warning
endif()

set(CPACK_PACKAGE_VENDOR "Nano Currency")
Expand Down Expand Up @@ -114,8 +116,8 @@ set(NANO_FUZZER_TEST
OFF
CACHE BOOL "")
set(NANO_ASIO_HANDLER_TRACKING
0
CACHE STRING "")
OFF
CACHE BOOL "")
set(NANO_ROCKSDB_TOOLS
OFF
CACHE BOOL "")
Expand Down Expand Up @@ -151,9 +153,8 @@ if(${NANO_TIMED_LOCKS} GREATER 0)
endif()
endif()

if(${NANO_ASIO_HANDLER_TRACKING} GREATER 0)
add_definitions(-DNANO_ASIO_HANDLER_TRACKING=${NANO_ASIO_HANDLER_TRACKING}
-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
if(NANO_ASIO_HANDLER_TRACKING)
add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
endif()

option(NANO_SIMD_OPTIMIZATIONS
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@



[![Live Artifacts](https://github.com/nanocurrency/nano-node/workflows/Live/badge.svg)](https://github.com/nanocurrency/nano-node/actions?query=workflow%3ALive)
[![Beta Artifacts](https://github.com/nanocurrency/nano-node/workflows/Beta/badge.svg)](https://github.com/nanocurrency/nano-node/actions?query=workflow%3ABeta)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/nanocurrency/nano-node)](https://github.com/nanocurrency/nano-node/releases/latest)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/nanocurrency/nano-node?color=darkblue&label=beta)](https://github.com/nanocurrency/nano-node/tags)
[![Nano CT Status](https://raw.githubusercontent.com/gr0vity-dev/nano-node-builder/main/status_latest.svg)](https://ct.bnano.info)
[![Coverage Status](https://coveralls.io/repos/github/nanocurrency/nano-node/badge.svg?branch=develop)](https://coveralls.io/github/nanocurrency/nano-node?branch=develop)
[![Tests](https://github.com/nanocurrency/nano-node/workflows/Tests/badge.svg)](https://github.com/nanocurrency/nano-node/actions?query=workflow%3ATests)
[![RelWithDebug Tests](https://github.com/nanocurrency/nano-node/workflows/Release%20Tests/badge.svg)](https://github.com/nanocurrency/nano-node/actions?query=workflow%3A%22Release+Tests%22)
[![Discord](https://img.shields.io/badge/discord-join%20chat-orange.svg)](https://chat.nano.org)
[![Nano CT Status](https://raw.githubusercontent.com/gr0vity-dev/nano-node-builder/main/status_latest.svg)](https://ct.bnano.info)

---

Expand Down
5 changes: 0 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,5 @@ To report security issues in the Nano protocol, please send an email to security
| GitHub Username | Email | GPG Pubkey |
|-----------------------|--------|-----------------|
| [clemahieu](https://github.com/clemahieu) | clemahieu { at } gmail.com | [clemahieu.asc](https://github.com/nanocurrency/nano-node/blob/develop/etc/gpg/clemahieu.asc) |
| [argakiig](https://github.com/argakiig) | russel { at } nano.org | [argakiig.asc](https://github.com/nanocurrency/nano-node/blob/develop/etc/gpg/argakiig.asc) |
| [sergiysw](https://github.com/sergiysw) | sergiysw { at } gmail.com | [sergiysw.asc](https://github.com/nanocurrency/nano-node/blob/develop/etc/gpg/sergiysw.asc) |
| [zhyatt](https://github.com/zhyatt) | zach { at } nano.org | [zhyatt.asc](https://github.com/nanocurrency/nano-node/blob/develop/etc/gpg/zhyatt.asc) |

For details on how to send a GPG encrypted email, see the tutorial here: https://www.linode.com/docs/security/encryption/gpg-keys-to-send-encrypted-messages/.

For general support and other non-sensitive inquiries, please visit https://forum.nano.org.
11 changes: 9 additions & 2 deletions nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ add_executable(
fakes/websocket_client.hpp
fakes/work_peer.hpp
active_elections.cpp
assert.cpp
async.cpp
backlog.cpp
block.cpp
block_store.cpp
blockprocessor.cpp
block_processor.cpp
bootstrap.cpp
bootstrap_ascending.cpp
bootstrap_server.cpp
bucketing.cpp
cli.cpp
confirmation_solicitor.cpp
confirming_set.cpp
Expand All @@ -26,6 +27,7 @@ add_executable(
ipc.cpp
ledger.cpp
ledger_confirm.cpp
ledger_priority.cpp
locks.cpp
logging.cpp
message.cpp
Expand All @@ -37,10 +39,14 @@ add_executable(
node.cpp
numbers.cpp
object_stream.cpp
observer_set.cpp
online_reps.cpp
optimistic_scheduler.cpp
processing_queue.cpp
processor_service.cpp
random.cpp
random_pool.cpp
rate_limiting.cpp
rep_crawler.cpp
receivable.cpp
peer_history.cpp
Expand All @@ -52,6 +58,7 @@ add_executable(
signal_manager.cpp
socket.cpp
system.cpp
tcp_listener.cpp
telemetry.cpp
thread_pool.cpp
throttle.cpp
Expand Down
60 changes: 35 additions & 25 deletions nano/core_test/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
#include <nano/node/active_elections.hpp>
#include <nano/node/confirming_set.hpp>
#include <nano/node/election.hpp>
#include <nano/node/online_reps.hpp>
#include <nano/node/scheduler/component.hpp>
#include <nano/node/scheduler/manual.hpp>
#include <nano/node/scheduler/priority.hpp>
#include <nano/node/transport/fake.hpp>
#include <nano/node/transport/inproc.hpp>
#include <nano/node/vote_router.hpp>
#include <nano/secure/ledger.hpp>
#include <nano/secure/ledger_set_any.hpp>
#include <nano/secure/ledger_set_confirmed.hpp>
#include <nano/secure/vote.hpp>
#include <nano/test_common/chains.hpp>
#include <nano/test_common/system.hpp>
#include <nano/test_common/testutil.hpp>
Expand Down Expand Up @@ -121,8 +124,9 @@ TEST (active_elections, confirm_frontier)
nano::node_flags node_flags;
node_flags.disable_request_loop = true;
node_flags.disable_ongoing_bootstrap = true;
node_flags.disable_ascending_bootstrap = true;
auto & node1 = *system.add_node (node_flags);
nano::node_config node_config;
node_config.bootstrap.enable = false;
auto & node1 = *system.add_node (node_config, node_flags);
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);

// we cannot use the same block instance on 2 different nodes, so make a copy
Expand All @@ -134,10 +138,11 @@ TEST (active_elections, confirm_frontier)
// The rep crawler would otherwise request confirmations in order to find representatives
nano::node_flags node_flags2;
node_flags2.disable_ongoing_bootstrap = true;
node_flags2.disable_ascending_bootstrap = true;
node_flags2.disable_rep_crawler = true;
nano::node_config node_config2;
node_config2.bootstrap.enable = false;
// start node2 later so that we do not get the gossip traffic
auto & node2 = *system.add_node (node_flags2);
auto & node2 = *system.add_node (node_config2, node_flags2);

// Add representative to disabled rep crawler
auto peers (node2.network.random_set (1));
Expand Down Expand Up @@ -166,7 +171,7 @@ TEST (active_elections, DISABLED_keep_local)
// Bound to 2, won't drop wallet created transactions, but good to test dropping remote
node_config.active_elections.size = 2;
// Disable frontier confirmation to allow the test to finish before
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;

auto & node = *system.add_node (node_config);
auto & wallet (*system.wallet (0));
Expand Down Expand Up @@ -326,7 +331,7 @@ TEST (inactive_votes_cache, existing_vote)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node = *system.add_node (node_config);
nano::block_hash latest (node.latest (nano::dev::genesis_key.pub));
nano::keypair key;
Expand Down Expand Up @@ -380,7 +385,7 @@ TEST (inactive_votes_cache, multiple_votes)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node = *system.add_node (node_config);
nano::keypair key1;
nano::block_builder builder;
Expand Down Expand Up @@ -433,9 +438,9 @@ TEST (inactive_votes_cache, election_start)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.priority_scheduler.enabled = false;
node_config.optimistic_scheduler.enabled = false;
node_config.backlog_scan.enable = false;
node_config.priority_scheduler.enable = false;
node_config.optimistic_scheduler.enable = false;
auto & node = *system.add_node (node_config);
nano::block_hash latest (node.latest (nano::dev::genesis_key.pub));
nano::keypair key1, key2;
Expand Down Expand Up @@ -510,14 +515,16 @@ TEST (inactive_votes_cache, election_start)
node.vote_processor.vote (vote2, std::make_shared<nano::transport::inproc::channel> (node, node));
// Only election for send1 should start, other blocks are missing dependencies and don't have enough final weight
ASSERT_TIMELY_EQ (5s, 1, node.active.size ());
ASSERT_TRUE (node.vote_router.contains (send1->hash ()));
ASSERT_TRUE (node.vote_router.active (send1->hash ()));

// Confirm elections with weight quorum
auto vote0 = nano::test::make_final_vote (nano::dev::genesis_key, { open1, open2, send4 });
node.vote_processor.vote (vote0, std::make_shared<nano::transport::inproc::channel> (node, node));
ASSERT_TIMELY_EQ (5s, 0, node.active.size ());
ASSERT_TIMELY_EQ (5s, 5, node.ledger.cemented_count ());
ASSERT_TRUE (nano::test::confirmed (node, { send1, send2, open1, open2 }));
// Confirmation on disk may lag behind cemented_count cache
ASSERT_TIMELY (5s, nano::test::confirmed (node, { send1, send2, open1, open2 }));

// A late block arrival also checks the inactive votes cache
ASSERT_TRUE (node.active.empty ());
Expand All @@ -539,7 +546,7 @@ TEST (active_elections, vote_replays)
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.enable_voting = false;
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node = *system.add_node (node_config);
nano::keypair key;
nano::state_block_builder builder;
Expand Down Expand Up @@ -695,7 +702,7 @@ TEST (active_elections, republish_winner)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node1 = *system.add_node (node_config);
node_config.peering_port = system.get_available_port ();
auto & node2 = *system.add_node (node_config);
Expand Down Expand Up @@ -761,7 +768,7 @@ TEST (active_elections, fork_filter_cleanup)
nano::test::system system{};

nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;

auto & node1 = *system.add_node (node_config);
nano::keypair key{};
Expand Down Expand Up @@ -842,7 +849,7 @@ TEST (active_elections, fork_replacement_tally)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node1 (*system.add_node (node_config));

size_t const reps_count = 20;
Expand Down Expand Up @@ -896,6 +903,7 @@ TEST (active_elections, fork_replacement_tally)
.build ();

// Forks without votes
std::shared_ptr<nano::election> election;
for (auto i (0); i < reps_count; i++)
{
auto fork = builder.make_block ()
Expand All @@ -908,10 +916,12 @@ TEST (active_elections, fork_replacement_tally)
.work (*system.work.generate (latest))
.build ();
node1.process_active (fork);

// Assert election exists and is the same for each fork
ASSERT_TIMELY (1s, election = node1.active.election (fork->qualified_root ()));
}

// Check overflow of blocks
std::shared_ptr<nano::election> election;
ASSERT_TIMELY (5s, election = node1.active.election (send_last->qualified_root ()));
ASSERT_TIMELY_EQ (5s, max_blocks, election->blocks ().size ());

Expand Down Expand Up @@ -961,7 +971,7 @@ TEST (active_elections, fork_replacement_tally)
node_config.peering_port = system.get_available_port ();
auto & node2 (*system.add_node (node_config));
node1.network.filter.clear ();
node2.network.flood_block (send_last);
node2.network.flood_block (send_last, nano::transport::traffic_type::test);
ASSERT_TIMELY (3s, node1.stats.count (nano::stat::type::message, nano::stat::detail::publish, nano::stat::dir::in) > 0);

// Correct block without votes is ignored
Expand All @@ -975,7 +985,7 @@ TEST (active_elections, fork_replacement_tally)
// ensure vote arrives before the block
ASSERT_TIMELY_EQ (5s, 1, node1.vote_cache.find (send_last->hash ()).size ());
node1.network.filter.clear ();
node2.network.flood_block (send_last);
node2.network.flood_block (send_last, nano::transport::traffic_type::test);
ASSERT_TIMELY (5s, node1.stats.count (nano::stat::type::message, nano::stat::detail::publish, nano::stat::dir::in) > 1);

// the send_last block should replace one of the existing block of the election because it has higher vote weight
Expand All @@ -999,7 +1009,7 @@ TEST (active_elections, confirmation_consistency)
{
nano::test::system system;
nano::node_config node_config = system.default_config ();
node_config.backlog_population.enable = false;
node_config.backlog_scan.enable = false;
auto & node = *system.add_node (node_config);
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
for (unsigned i = 0; i < 10; ++i)
Expand Down Expand Up @@ -1091,7 +1101,7 @@ TEST (active_elections, activate_account_chain)
nano::test::system system;
nano::node_flags flags;
nano::node_config config = system.default_config ();
config.backlog_population.enable = false;
config.backlog_scan.enable = false;
auto & node = *system.add_node (config, flags);

nano::keypair key;
Expand Down Expand Up @@ -1183,7 +1193,7 @@ TEST (active_elections, activate_inactive)
nano::test::system system;
nano::node_flags flags;
nano::node_config config = system.default_config ();
config.backlog_population.enable = false;
config.backlog_scan.enable = false;
auto & node = *system.add_node (config, flags);

nano::keypair key;
Expand Down Expand Up @@ -1333,8 +1343,8 @@ TEST (active_elections, limit_vote_hinted_elections)
nano::test::system system;
nano::node_config config = system.default_config ();
const int aec_limit = 10;
config.backlog_population.enable = false;
config.optimistic_scheduler.enabled = false;
config.backlog_scan.enable = false;
config.optimistic_scheduler.enable = false;
config.active_elections.size = aec_limit;
config.active_elections.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election
auto & node = *system.add_node (config);
Expand Down Expand Up @@ -1442,10 +1452,10 @@ TEST (active_elections, broadcast_block_on_activation)
nano::node_config config1 = system.default_config ();
// Deactivates elections on both nodes.
config1.active_elections.size = 0;
config1.bootstrap_ascending.enable = false;
config1.bootstrap.enable = false;
nano::node_config config2 = system.default_config ();
config2.active_elections.size = 0;
config2.bootstrap_ascending.enable = false;
config2.bootstrap.enable = false;
nano::node_flags flags;
// Disables bootstrap listener to make sure the block won't be shared by this channel.
flags.disable_bootstrap_listener = true;
Expand Down
15 changes: 15 additions & 0 deletions nano/core_test/assert.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <nano/lib/assert.hpp>

#include <gtest/gtest.h>

TEST (assert_DeathTest, debug_assert)
{
debug_assert (true);
ASSERT_DEATH (debug_assert (false), ".*Assertion \\(false\\) failed.*");
}

TEST (assert_DeathTest, release_assert)
{
release_assert (true);
ASSERT_DEATH (release_assert (false), ".*Assertion \\(false\\) failed.*");
}
Loading

0 comments on commit c472af2

Please sign in to comment.