From 55a70e22c3c76c8d03a225ae93e9e68bba774b8c Mon Sep 17 00:00:00 2001 From: androm3da Date: Mon, 12 Feb 2018 22:26:19 -0600 Subject: [PATCH 1/4] [CI] remove trusty, add hashes, add optimized builds * [CI] remove Trusty, add hashes * [CI] add optimized builds, signatures --- .gitlab-ci.yml | 36 +++++++++++++++++++++++++++----- ci/{build.sh => build-gitlab.sh} | 8 +++++-- 2 files changed, 37 insertions(+), 7 deletions(-) rename ci/{build.sh => build-gitlab.sh} (92%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 640e05c839..f028ac2795 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,9 +21,10 @@ variables: - build*/*.tar* - build*/*_test - csa_results + - build*/SHA1SUMS script: - - ./ci/build.sh + - ./ci/build-gitlab.sh Arch Linux: @@ -36,10 +37,11 @@ Arch Linux: script: - mkdir -p csa_results/ - - scan-build -o csa_results/ ./ci/build.sh + - scan-build -o csa_results/ ./ci/build-gitlab.sh -Ubuntu Linux Trusty: +# Disabled, dependency on newer Qt than avail +.Ubuntu Linux Trusty: <<: *linux_cfg stage: build image: ubuntu:trusty @@ -75,6 +77,30 @@ Ubuntu Linux Xenial: - ./ci/ubuntu_prep.sh - ./ci/bootstrap_boost.sh +Xenial OPTIMIZED: + <<: *linux_cfg + stage: build + image: ubuntu:xenial + variables: + FLAVOR: xenial + SIMD: 1 + + before_script: + - ./ci/ubuntu_prep.sh + - ./ci/bootstrap_boost.sh + +Artful OPTIMIZED: + <<: *linux_cfg + stage: build + image: ubuntu:artful + variables: + FLAVOR: artful + SIMD: 1 + + before_script: + - ./ci/ubuntu_prep.sh + - ./ci/bootstrap_boost.sh + # DISABLED for now .Ubuntu Linux:ASAN: @@ -115,7 +141,7 @@ Ubuntu Linux Xenial: - osx script: - - ./ci/build.sh + - ./ci/build-gitlab.sh # DISABLED for now .Alpine Linux: @@ -128,5 +154,5 @@ Ubuntu Linux Xenial: - apk add --update alpine-sdk autoconf automake libtool clang-dev cmake ninja qt5-qtbase-dev qt5-qttools-dev boost-dev ttf-freefont xvfb script: - - ./ci/build.sh + - ./ci/build-gitlab.sh diff --git a/ci/build.sh b/ci/build-gitlab.sh similarity index 92% rename from ci/build.sh rename to ci/build-gitlab.sh index 82d834f744..fe69942660 100755 --- a/ci/build.sh +++ b/ci/build-gitlab.sh @@ -24,10 +24,13 @@ fi if [[ ${SIMD} -eq 1 ]]; then SIMD_CFG="-DRAIBLOCKS_SIMD_OPTIMIZATIONS=ON" - CRYPTOPP_CFG="-DCRYPTOPP_CUSTOM=ON" + CRYPTOPP_CFG="" + echo SIMD and other optimizations enabled + echo local CPU: + cat /proc/cpuinfo # TBD for macOS else SIMD_CFG="" - CRYPTOPP_CFG="" + CRYPTOPP_CFG="-DCRYPTOPP_CUSTOM=ON" fi if [[ ${ASAN_INT} -eq 1 ]]; then @@ -74,6 +77,7 @@ run_build() { cmake --build ${PWD} -- -v cmake --build ${PWD} -- install -v cpack -G ${CPACK_TYPE} ${PWD} + sha1sum *.tar* > SHA1SUMS } run_build From 6d3c1690eb9371d7cd6ef466171121eaaaa5b236 Mon Sep 17 00:00:00 2001 From: argakiig Date: Tue, 13 Feb 2018 16:08:45 -0500 Subject: [PATCH 2/4] The code removed was intended to allow for a reworking of PoW, This is not currently being persued and will take place through universal blocks instead. Removed unit test and PoW checking function --- rai/core_test/node.cpp | 44 ------------------------------------------ rai/node/node.cpp | 18 +---------------- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/rai/core_test/node.cpp b/rai/core_test/node.cpp index f7e65f7abd..e97e77eb17 100644 --- a/rai/core_test/node.cpp +++ b/rai/core_test/node.cpp @@ -655,50 +655,6 @@ TEST (node_config, random_rep) ASSERT_NE (config1.preconfigured_representatives.end (), std::find (config1.preconfigured_representatives.begin (), config1.preconfigured_representatives.end (), rep)); } -TEST (node, block_replace) -{ - rai::system system (24000, 2); - system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - auto block1 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); - auto block3 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); - ASSERT_NE (nullptr, block1); - auto initial_work (block1->block_work ()); - while (rai::work_value (block1->root (), block1->block_work ()) <= rai::work_value (block1->root (), initial_work)) - { - system.nodes[1]->generate_work (*block1); - } - { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); - } - for (auto i (0); i < 1; ++i) - { - rai::transaction transaction_a (system.nodes[1]->store.environment, nullptr, false); - system.nodes[1]->network.republish_block (transaction_a, block1); - } - auto iterations1 (0); - std::unique_ptr block2; - while (block2 == nullptr) - { - system.poll (); - ++iterations1; - ASSERT_LT (iterations1, 200); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - auto block (system.nodes[0]->store.block_get (transaction, block1->hash ())); - if (block->block_work () != initial_work) - { - block2 = std::move (block); - } - } - { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); - } - ASSERT_NE (initial_work, block1->block_work ()); - ASSERT_EQ (block1->block_work (), block2->block_work ()); - ASSERT_GT (rai::work_value (block2->root (), block2->block_work ()), rai::work_value (block1->root (), initial_work)); -} - TEST (node, fork_publish) { std::weak_ptr node0; diff --git a/rai/node/node.cpp b/rai/node/node.cpp index 5b5fa1b9c7..f5f65ec5c0 100644 --- a/rai/node/node.cpp +++ b/rai/node/node.cpp @@ -1263,23 +1263,7 @@ rai::process_return rai::block_processor::process_receive_one (MDB_txn * transac } case rai::process_result::old: { - { - auto root (block_a->root ()); - auto hash (block_a->hash ()); - auto existing (node.store.block_get (transaction_a, hash)); - if (existing != nullptr) - { - // Replace block with one that has higher work value - if (rai::work_value (root, block_a->block_work ()) > rai::work_value (root, existing->block_work ())) - { - node.store.block_put (transaction_a, hash, *block_a, node.store.block_successor (transaction_a, hash)); - } - } - else - { - // Could have been rolled back, maybe - } - } + //Existing codeblock will become obesolete with universal blocks and as a result is removed if (node.config.logging.ledger_duplicate_logging ()) { BOOST_LOG (node.log) << boost::str (boost::format ("Old for: %1%") % block_a->hash ().to_string ()); From 2a3b7cdf5813e7340d37dbf6afc6d60b74306b6e Mon Sep 17 00:00:00 2001 From: argakiig Date: Tue, 13 Feb 2018 22:07:40 -0500 Subject: [PATCH 3/4] Revert "The code removed was intended to allow for a reworking of PoW, This is not currently being persued and will take place through universal blocks instead. Removed unit test and PoW checking function" This reverts commit 6d3c1690eb9371d7cd6ef466171121eaaaa5b236. --- rai/core_test/node.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++ rai/node/node.cpp | 18 ++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/rai/core_test/node.cpp b/rai/core_test/node.cpp index e97e77eb17..f7e65f7abd 100644 --- a/rai/core_test/node.cpp +++ b/rai/core_test/node.cpp @@ -655,6 +655,50 @@ TEST (node_config, random_rep) ASSERT_NE (config1.preconfigured_representatives.end (), std::find (config1.preconfigured_representatives.begin (), config1.preconfigured_representatives.end (), rep)); } +TEST (node, block_replace) +{ + rai::system system (24000, 2); + system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); + auto block1 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); + auto block3 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); + ASSERT_NE (nullptr, block1); + auto initial_work (block1->block_work ()); + while (rai::work_value (block1->root (), block1->block_work ()) <= rai::work_value (block1->root (), initial_work)) + { + system.nodes[1]->generate_work (*block1); + } + { + rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); + } + for (auto i (0); i < 1; ++i) + { + rai::transaction transaction_a (system.nodes[1]->store.environment, nullptr, false); + system.nodes[1]->network.republish_block (transaction_a, block1); + } + auto iterations1 (0); + std::unique_ptr block2; + while (block2 == nullptr) + { + system.poll (); + ++iterations1; + ASSERT_LT (iterations1, 200); + rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + auto block (system.nodes[0]->store.block_get (transaction, block1->hash ())); + if (block->block_work () != initial_work) + { + block2 = std::move (block); + } + } + { + rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); + } + ASSERT_NE (initial_work, block1->block_work ()); + ASSERT_EQ (block1->block_work (), block2->block_work ()); + ASSERT_GT (rai::work_value (block2->root (), block2->block_work ()), rai::work_value (block1->root (), initial_work)); +} + TEST (node, fork_publish) { std::weak_ptr node0; diff --git a/rai/node/node.cpp b/rai/node/node.cpp index f5f65ec5c0..5b5fa1b9c7 100644 --- a/rai/node/node.cpp +++ b/rai/node/node.cpp @@ -1263,7 +1263,23 @@ rai::process_return rai::block_processor::process_receive_one (MDB_txn * transac } case rai::process_result::old: { - //Existing codeblock will become obesolete with universal blocks and as a result is removed + { + auto root (block_a->root ()); + auto hash (block_a->hash ()); + auto existing (node.store.block_get (transaction_a, hash)); + if (existing != nullptr) + { + // Replace block with one that has higher work value + if (rai::work_value (root, block_a->block_work ()) > rai::work_value (root, existing->block_work ())) + { + node.store.block_put (transaction_a, hash, *block_a, node.store.block_successor (transaction_a, hash)); + } + } + else + { + // Could have been rolled back, maybe + } + } if (node.config.logging.ledger_duplicate_logging ()) { BOOST_LOG (node.log) << boost::str (boost::format ("Old for: %1%") % block_a->hash ().to_string ()); From 3ccf6e2285d7ae95f7c6b023da430c3f8a4ffce2 Mon Sep 17 00:00:00 2001 From: argakiig Date: Tue, 13 Feb 2018 22:08:48 -0500 Subject: [PATCH 4/4] The code removed was intended to allow for a reworking of PoW, This is not currently being persued and will take place through universal blocks instead. Removed unit test and PoW checking function --- rai/core_test/node.cpp | 44 ------------------------------------------ rai/node/node.cpp | 18 +---------------- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/rai/core_test/node.cpp b/rai/core_test/node.cpp index f7e65f7abd..e97e77eb17 100644 --- a/rai/core_test/node.cpp +++ b/rai/core_test/node.cpp @@ -655,50 +655,6 @@ TEST (node_config, random_rep) ASSERT_NE (config1.preconfigured_representatives.end (), std::find (config1.preconfigured_representatives.begin (), config1.preconfigured_representatives.end (), rep)); } -TEST (node, block_replace) -{ - rai::system system (24000, 2); - system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - auto block1 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); - auto block3 (system.wallet (0)->send_action (rai::test_genesis_key.pub, 0, rai::Gxrb_ratio)); - ASSERT_NE (nullptr, block1); - auto initial_work (block1->block_work ()); - while (rai::work_value (block1->root (), block1->block_work ()) <= rai::work_value (block1->root (), initial_work)) - { - system.nodes[1]->generate_work (*block1); - } - { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); - } - for (auto i (0); i < 1; ++i) - { - rai::transaction transaction_a (system.nodes[1]->store.environment, nullptr, false); - system.nodes[1]->network.republish_block (transaction_a, block1); - } - auto iterations1 (0); - std::unique_ptr block2; - while (block2 == nullptr) - { - system.poll (); - ++iterations1; - ASSERT_LT (iterations1, 200); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - auto block (system.nodes[0]->store.block_get (transaction, block1->hash ())); - if (block->block_work () != initial_work) - { - block2 = std::move (block); - } - } - { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); - ASSERT_EQ (block3->hash (), system.nodes[0]->store.block_successor (transaction, block1->hash ())); - } - ASSERT_NE (initial_work, block1->block_work ()); - ASSERT_EQ (block1->block_work (), block2->block_work ()); - ASSERT_GT (rai::work_value (block2->root (), block2->block_work ()), rai::work_value (block1->root (), initial_work)); -} - TEST (node, fork_publish) { std::weak_ptr node0; diff --git a/rai/node/node.cpp b/rai/node/node.cpp index 5b5fa1b9c7..410572ff08 100644 --- a/rai/node/node.cpp +++ b/rai/node/node.cpp @@ -1263,23 +1263,7 @@ rai::process_return rai::block_processor::process_receive_one (MDB_txn * transac } case rai::process_result::old: { - { - auto root (block_a->root ()); - auto hash (block_a->hash ()); - auto existing (node.store.block_get (transaction_a, hash)); - if (existing != nullptr) - { - // Replace block with one that has higher work value - if (rai::work_value (root, block_a->block_work ()) > rai::work_value (root, existing->block_work ())) - { - node.store.block_put (transaction_a, hash, *block_a, node.store.block_successor (transaction_a, hash)); - } - } - else - { - // Could have been rolled back, maybe - } - } + //Existing codeblock will become obesolete with universal blocks and as a result is removed if (node.config.logging.ledger_duplicate_logging ()) { BOOST_LOG (node.log) << boost::str (boost::format ("Old for: %1%") % block_a->hash ().to_string ());