Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into blockprocessor/pos…
Browse files Browse the repository at this point in the history
…t-events-full
  • Loading branch information
guilhermelawless committed Oct 9, 2020
2 parents 566936d + a425c30 commit b91f072
Show file tree
Hide file tree
Showing 83 changed files with 2,454 additions and 601 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
Expand All @@ -44,7 +44,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

windows_test:
runs-on: windows-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rocksdb_release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
Expand All @@ -45,4 +45,4 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
4 changes: 2 additions & 2 deletions .github/workflows/rocksdb_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

windows_test:
runs-on: windows-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
run: docker run -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

windows_test:
runs-on: windows-latest
Expand Down
51 changes: 23 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,14 @@ set(WITH_GFLAGS OFF CACHE BOOL "")
set(WITH_TESTS OFF CACHE BOOL "")
set(WITH_BENCHMARK_TOOLS OFF CACHE BOOL "")
set(ROCKSDB_BUILD_SHARED OFF CACHE BOOL "")
set(WITH_CORE_TOOLS OFF CACHE BOOL "")
set(WITH_TOOLS OFF CACHE BOOL "")
set(WITH_CORE_TOOLS ${NANO_ROCKSDB_TOOLS})
set(WITH_TOOLS ${NANO_ROCKSDB_TOOLS})
add_subdirectory(rocksdb)
set(WITH_CORE_TOOLS ${NANO_ROCKSDB_TOOLS} CACHE BOOL "" FORCE)
set(WITH_TOOLS ${NANO_ROCKSDB_TOOLS} CACHE BOOL "" FORCE)
if (ENABLE_AVX2)
set(PORTABLE OFF CACHE BOOL "" FORCE)
else()
set(PORTABLE ON CACHE BOOL "" FORCE)
endif()
add_subdirectory(rocksdb EXCLUDE_FROM_ALL)

# There is a compile bug with boost 1.69 interprocess headers on Mac
if (APPLE AND Boost_VERSION EQUAL 106900)
Expand Down Expand Up @@ -558,18 +561,14 @@ if (NANO_GUI OR RAIBLOCKS_GUI)
install (DIRECTORY ${Qt5_DIR}/../../QtWidgets.framework DESTINATION Nano.app/Contents/Frameworks)
install (FILES "${Qt5_DIR}/../../../plugins/platforms/libqcocoa.dylib" DESTINATION Nano.app/Contents/PlugIns/platforms)
if (NANO_SHARED_BOOST)
get_filename_component(Boost_LIB_DIR ${BOOST_ROOT}/lib ABSOLUTE)
install (FILES ${Boost_LIB_DIR}/libboost_log.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_filesystem.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_log_setup.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_regex.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_program_options.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_system.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_thread.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_date_time.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_chrono.dylib DESTINATION Nano.app/Contents/boost/lib)
install (FILES ${Boost_LIB_DIR}/libboost_atomic.dylib DESTINATION Nano.app/Contents/boost/lib)
endif()
foreach(boost_lib IN LISTS Boost_LIBRARIES)
string(REGEX MATCH "(.+/.*boost_[^-]+)" boost_lib_name ${boost_lib})
set (boost_dll "${CMAKE_MATCH_1}")
if (${boost_dll} MATCHES "boost")
install (FILES ${boost_dll} DESTINATION Nano.app/Contents/boost/lib)
endif()
endforeach(boost_lib)
endif()
if (NANO_POW_SERVER)
install (TARGETS nano_pow_server DESTINATION Nano.app/Contents/MacOS)
install (DIRECTORY ${PROJECT_SOURCE_DIR}/nano-pow-server/public DESTINATION Nano.app/Contents/MacOS)
Expand Down Expand Up @@ -634,17 +633,13 @@ if (NANO_GUI OR RAIBLOCKS_GUI)
RUNTIME DESTINATION ./bin
)
if (NANO_SHARED_BOOST)
get_filename_component(Boost_LIB_DIR ${BOOST_ROOT}/lib ABSOLUTE)
install (FILES ${Boost_LIB_DIR}/libboost_log.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_filesystem.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_log_setup.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_regex.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_program_options.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_system.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_thread.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_date_time.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_chrono.so.${Boost_VERSION_STRING} DESTINATION ./lib)
install (FILES ${Boost_LIB_DIR}/libboost_atomic.so.${Boost_VERSION_STRING} DESTINATION ./lib)
foreach(boost_lib IN LISTS Boost_LIBRARIES)
string(REGEX MATCH "(.+/.*boost_[^-]+)" boost_lib_name ${boost_lib})
set (boost_dll "${CMAKE_MATCH_1}.${Boost_VERSION_STRING}")
if (${boost_dll} MATCHES "boost")
install (FILES ${boost_dll} DESTINATION ./lib)
endif()
endforeach(boost_lib)
endif()
if (NANO_POW_SERVER)
install (TARGETS nano_pow_server DESTINATION ./bin)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Other documentation details can be found at https://docs.nano.org.

### Want to Contribute?

Please see the [contributors guide](https://docs.nano.org/protocol-design/overview/#contributing-code-to-the-nano-node).
Please see the [contributors guide](https://docs.nano.org/node-implementation/contributing/).

---

Expand Down
3 changes: 3 additions & 0 deletions docker/node/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ case "${network}" in
dev)
dirSuffix='Dev'
;;
test)
dirSuffix='Test'
;;
esac

raidir="${HOME}/RaiBlocks${dirSuffix}"
Expand Down
28 changes: 14 additions & 14 deletions nano/core_test/active_transactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST (active_transactions, inactive_votes_cache)
.work (*system.work.generate (latest))
.build_shared ();
auto vote (std::make_shared<nano::vote> (nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, 0, std::vector<nano::block_hash> (1, send->hash ())));
node.vote_processor.vote (vote, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote, std::make_shared<nano::transport::channel_loopback> (node));
ASSERT_TIMELY (5s, node.active.inactive_votes_cache_size () == 1);
node.process_active (send);
node.block_processor.flush ();
Expand Down Expand Up @@ -211,7 +211,7 @@ TEST (active_transactions, inactive_votes_cache_fork)
.work (*system.work.generate (latest))
.build_shared ();
auto vote (std::make_shared<nano::vote> (nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, 0, std::vector<nano::block_hash> (1, send1->hash ())));
node.vote_processor.vote (vote, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote, std::make_shared<nano::transport::channel_loopback> (node));
auto channel1 (node.network.udp_channels.create (node.network.endpoint ()));
ASSERT_TIMELY (5s, node.active.inactive_votes_cache_size () == 1);
node.network.process_message (nano::publish (send2), channel1);
Expand Down Expand Up @@ -264,7 +264,7 @@ TEST (active_transactions, inactive_votes_cache_existing_vote)
ASSERT_GT (node.weight (key.pub), node.minimum_principal_weight ());
// Insert vote
auto vote1 (std::make_shared<nano::vote> (key.pub, key.prv, 1, std::vector<nano::block_hash> (1, send->hash ())));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_loopback> (node));
system.deadline_set (5s);
ASSERT_TIMELY (5s, election->votes ().size () == 2)
ASSERT_EQ (1, node.stats.count (nano::stat::type::election, nano::stat::detail::vote_new));
Expand Down Expand Up @@ -325,9 +325,9 @@ TEST (active_transactions, inactive_votes_cache_multiple_votes)
node.block_processor.flush ();
// Process votes
auto vote1 (std::make_shared<nano::vote> (key1.pub, key1.prv, 0, std::vector<nano::block_hash> (1, send1->hash ())));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_loopback> (node));
auto vote2 (std::make_shared<nano::vote> (nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, 0, std::vector<nano::block_hash> (1, send1->hash ())));
node.vote_processor.vote (vote2, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote2, std::make_shared<nano::transport::channel_loopback> (node));
system.deadline_set (5s);
while (true)
{
Expand Down Expand Up @@ -470,23 +470,23 @@ TEST (active_transactions, inactive_votes_cache_election_start)
// Inactive votes
std::vector<nano::block_hash> hashes{ open1->hash (), open2->hash (), open3->hash (), open4->hash (), open5->hash (), send7->hash () };
auto vote1 (std::make_shared<nano::vote> (key1.pub, key1.prv, 0, hashes));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote1, std::make_shared<nano::transport::channel_loopback> (node));
auto vote2 (std::make_shared<nano::vote> (key2.pub, key2.prv, 0, hashes));
node.vote_processor.vote (vote2, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote2, std::make_shared<nano::transport::channel_loopback> (node));
auto vote3 (std::make_shared<nano::vote> (key3.pub, key3.prv, 0, hashes));
node.vote_processor.vote (vote3, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote3, std::make_shared<nano::transport::channel_loopback> (node));
auto vote4 (std::make_shared<nano::vote> (key4.pub, key4.prv, 0, hashes));
node.vote_processor.vote (vote4, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote4, std::make_shared<nano::transport::channel_loopback> (node));
ASSERT_TIMELY (5s, node.active.inactive_votes_cache_size () == 6);
ASSERT_TRUE (node.active.empty ());
ASSERT_EQ (1, node.ledger.cache.cemented_count);
// 5 votes are required to start election
auto vote5 (std::make_shared<nano::vote> (key5.pub, key5.prv, 0, hashes));
node.vote_processor.vote (vote5, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote5, std::make_shared<nano::transport::channel_loopback> (node));
ASSERT_TIMELY (5s, 5 == node.active.size ());
// Confirm elections with weight quorum
auto vote0 (std::make_shared<nano::vote> (nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, 0, hashes));
node.vote_processor.vote (vote0, std::make_shared<nano::transport::channel_udp> (node.network.udp_channels, node.network.endpoint (), node.network_params.protocol.protocol_version));
node.vote_processor.vote (vote0, std::make_shared<nano::transport::channel_loopback> (node));
ASSERT_TIMELY (5s, node.active.empty ());
ASSERT_TIMELY (5s, 11 == node.ledger.cache.cemented_count);
// A late block arrival also checks the inactive votes cache
Expand Down Expand Up @@ -867,16 +867,16 @@ TEST (active_multiplier, less_than_one)
auto base_active_multiplier = 1.0;
auto min_active_difficulty = node.network_params.network.publish_thresholds.entry;
auto min_multiplier = nano::difficulty::to_multiplier (min_active_difficulty, base_active_difficulty);
ASSERT_EQ (node.active.trended_active_multiplier, base_active_multiplier);
ASSERT_EQ (node.active.trended_active_multiplier.load (), base_active_multiplier);
for (int i = 0; i < node.active.multipliers_cb.size () - 1; ++i)
{
node.active.multipliers_cb.push_front (min_multiplier);
}
auto sum (std::accumulate (node.active.multipliers_cb.begin (), node.active.multipliers_cb.end (), double(0)));
auto sum (std::accumulate (node.active.multipliers_cb.begin (), node.active.multipliers_cb.end (), 0.));
auto multiplier = sum / node.active.multipliers_cb.size ();
node.active.multipliers_cb.push_front (min_multiplier);
node.active.update_active_multiplier (lock);
ASSERT_EQ (node.active.trended_active_multiplier, multiplier);
ASSERT_EQ (node.active.trended_active_multiplier.load (), multiplier);
}

TEST (active_multiplier, normalization)
Expand Down
Loading

0 comments on commit b91f072

Please sign in to comment.