From 355a69c47da93d996f48da2c528489623266bdeb Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 4 Apr 2022 09:54:45 +0200 Subject: [PATCH 1/3] Merge bitcoin/bitcoin#24558: build: explicitly disable Boost multi_index serialization 0d01272cd883f4d2a53409fdc49b8732a3dbda26 build: don't use Boost multi_index serialization (fanquake) Pull request description: We don't use the serialization or archiving facilities of multi_index. So globally disable support, which gives a minor improvement in build time, i.e less preprocessing work, given we don't link any Boost libs. See: https://www.boost.org/doc/libs/1_78_0/libs/multi_index/doc/tutorial/creation.html > Serialization capabilities are automatically provided by just linking with the appropriate Boost.Serialization library module: it is not necessary to explicitly include any header from Boost.Serialization, apart from those declaring the type of archive used in the process. If not used, however, serialization support can be disabled by globally defining the macro BOOST_MULTI_INDEX_DISABLE_SERIALIZATION. Disabling serialization for Boost.MultiIndex can yield a small improvement in build times, and may be necessary in those defective compilers that fail to correctly process Boost.Serialization headers. ACKs for top commit: MarcoFalke: cr ACK 0d01272cd883f4d2a53409fdc49b8732a3dbda26 Tree-SHA512: 87c664a2f142dc6b8f8598341f9829be3fda8cf614d73cc9a894c8033ee40c6daa9b50f4049ecb1f1e3aaf342568d9a5f5c65af1e04c36ee3a9cb46eca95767b --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 6338f6380a..df486123ee 100644 --- a/configure.ac +++ b/configure.ac @@ -1466,6 +1466,9 @@ if test x$want_boost = xno; then AC_MSG_ERROR([[only libdashconsensus can be built without boost]]) fi + dnl we don't use multi_index serialization + BOOST_CPPFLAGS="$BOOST_CPPFLAGS -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION" + dnl Prevent use of std::unary_function, which was removed in C++17, dnl and will generate warnings with newer compilers for Boost dnl older than 1.80. From 49fcd4ab64825df39d750ad7aef66095cabd8b44 Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 13 Dec 2023 14:21:58 +0000 Subject: [PATCH 2/3] Merge bitcoin/bitcoin#29066: Bump minimum required Boost version due to migration to C++20 49a90915aa3ee8e3a7e163f23a55de931faf8523 build: Bump minimum required Boost to 1.73.0 to support C++20 (Hennadii Stepanov) Pull request description: Boost versions <1.73 have C++20-specific bugs that were fixed in the following commits: - https://github.com/boostorg/signals2/commit/15fcf213563718d2378b6b83a1614680a4fa8cec - https://github.com/boostorg/test/commit/495c095dc063052ce54f2fe9217fe0fc69ced5f1 I tested [`libboost1.71-dev`](https://packages.ubuntu.com/focal/libboost1.71-dev) in Ubuntu 20.04 and Boost 1.71, 1.72, 1.73 in our depends build system. Closes https://github.com/bitcoin/bitcoin/issues/29063. ACKs for top commit: fanquake: ACK 49a90915aa3ee8e3a7e163f23a55de931faf8523 Tree-SHA512: b8ebc08af85abfa3fda70961bd1136ee9e5149dd76a3f901e43acba624d231971873cba5cbf30837f9e5ab58790b8330f241a76cb76d8cf5dce5ad0cca33fba8 --- configure.ac | 2 +- doc/dependencies.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index df486123ee..ec2b59a234 100644 --- a/configure.ac +++ b/configure.ac @@ -1461,7 +1461,7 @@ fi if test x$use_boost = xyes; then dnl Check for Boost headers -AX_BOOST_BASE([1.64.0],[],[AC_MSG_ERROR([Boost is not available!])]) +AX_BOOST_BASE([1.73.0],[],[AC_MSG_ERROR([Boost is not available!])]) if test x$want_boost = xno; then AC_MSG_ERROR([[only libdashconsensus can be built without boost]]) fi diff --git a/doc/dependencies.md b/doc/dependencies.md index f27487d158..38893d8f1c 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -6,7 +6,7 @@ These are the dependencies currently used by Dash Core. You can find instruction | Dependency | Version used | Minimum required | CVEs | Shared | [Bundled Qt library](https://doc.qt.io/qt-5/configure-options.html#third-party-libraries) | | --- | --- | --- | --- | --- | --- | | Berkeley DB | [4.8.30](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.x | No | | | -| Boost | [1.81.0](https://www.boost.org/users/download/) | [1.64.0](https://github.com/bitcoin/bitcoin/pull/22320) | No | | | +| Boost | [1.81.0](https://www.boost.org/users/download/) | [1.73.0](https://github.com/bitcoin/bitcoin/pull/29066) | No | | | | Clang[ \* ](#note1) | | [5.0+](https://releases.llvm.org/download.html) (C++17 support) | | | | | fontconfig | [2.12.1](https://www.freedesktop.org/software/fontconfig/release/) | | No | Yes | | | FreeType | [2.11.0](https://download.savannah.gnu.org/releases/freetype) | | No | | [Yes](https://github.com/dashpay/dash/blob/develop/depends/packages/qt.mk) (Android only) | From c0154c0d8cfb4ca05b1953586b7ea5fd40b7ab7a Mon Sep 17 00:00:00 2001 From: fanquake Date: Sat, 5 Oct 2024 02:28:12 +0300 Subject: [PATCH 3/3] partial merge bitcoin/bitcoin#27783: Add public Boost headers explicitly 2484cacb7a6367b24e924dba0825c843b1dfc1c3 Add public Boost headers explicitly (Hennadii Stepanov) fade2adb5bb4ce9753e7f25da5fb1521f2f503ec test: Avoid `BOOST_ASSERT` macro (Hennadii Stepanov) Pull request description: To check symbols in the code base, run: ``` git grep boost::multi_index::identity git grep boost::multi_index::indexed_by git grep boost::multi_index::tag git grep boost::make_tuple ``` Hoping on the absence of conflicts with top-prio PRs :) ACKs for top commit: MarcoFalke: lgtm ACK 2484cacb7a6367b24e924dba0825c843b1dfc1c3 TheCharlatan: ACK 2484cacb7a6367b24e924dba0825c843b1dfc1c3 Tree-SHA512: d122ab028eee76ee1c4609ed51ec8db0c8c768edcc2ff2c0e420a48e051aa71e99748cdb5d22985ae6d97c808c77c1a27561f0715f77b256f74c1c310b37694c --- src/miner.h | 5 +- src/test/block_reward_reallocation_tests.cpp | 17 +-- src/test/evo_deterministicmns_tests.cpp | 132 ++++++++++--------- src/test/evo_simplifiedmns_tests.cpp | 2 +- src/test/llmq_dkg_tests.cpp | 8 +- src/test/util/setup_common.cpp | 6 +- src/txmempool.h | 3 + src/wallet/test/coinjoin_tests.cpp | 2 +- test/lint/lint-includes.sh | 3 + 9 files changed, 97 insertions(+), 81 deletions(-) diff --git a/src/miner.h b/src/miner.h index a7012e7126..287d06eb88 100644 --- a/src/miner.h +++ b/src/miner.h @@ -13,8 +13,11 @@ #include #include -#include +#include +#include #include +#include +#include class BlockManager; class CBlockIndex; diff --git a/src/test/block_reward_reallocation_tests.cpp b/src/test/block_reward_reallocation_tests.cpp index d42f9d3bce..3f48a9ce94 100644 --- a/src/test/block_reward_reallocation_tests.cpp +++ b/src/test/block_reward_reallocation_tests.cpp @@ -71,7 +71,7 @@ static std::vector SelectUTXOs(const CChain& active_chain, SimpleUTXO utoxs.erase(it); break; } - BOOST_ASSERT(found); + BOOST_REQUIRE(found); if (selectedAmount >= amount) { changeRet = selectedAmount - amount; break; @@ -102,8 +102,8 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx, for (auto [i, input] : enumerate(tx.vin)) { uint256 hashBlock; CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, input.prevout.hash, Params().GetConsensus(), hashBlock); - BOOST_ASSERT(txFrom); - BOOST_ASSERT(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL)); + BOOST_REQUIRE(txFrom); + BOOST_REQUIRE(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL)); } } @@ -148,7 +148,8 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS CScript coinbasePubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG; - BOOST_ASSERT(DeploymentDIP0003Enforced(WITH_LOCK(cs_main, return m_node.chainman->ActiveChain().Height()), consensus_params)); + BOOST_REQUIRE(DeploymentDIP0003Enforced(WITH_LOCK(cs_main, return m_node.chainman->ActiveChain().Height()), + consensus_params)); // Register one MN CKey ownerKey; @@ -163,7 +164,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()}; dmnman.UpdatedBlockTip(tip); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); BOOST_CHECK_EQUAL(tip->nHeight, 498); BOOST_CHECK(tip->nHeight < Params().GetConsensus().BRRHeight); @@ -176,7 +177,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()}; BOOST_CHECK_EQUAL(tip->nHeight, 499); dmnman.UpdatedBlockTip(tip); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); BOOST_CHECK(tip->nHeight < Params().GetConsensus().BRRHeight); // Creating blocks by different ways const auto pblocktemplate = BlockAssembler(m_node.chainman->ActiveChainstate(), m_node, *m_node.mempool, Params()).CreateNewBlock(coinbasePubKey); @@ -195,7 +196,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()}; BOOST_CHECK_EQUAL(tip->nHeight, Params().GetConsensus().BRRHeight - 1); dmnman.UpdatedBlockTip(tip); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); } { @@ -206,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationS const CBlockIndex* const tip{m_node.chainman->ActiveChain().Tip()}; const bool isV20Active{DeploymentActiveAfter(tip, consensus_params, Consensus::DEPLOYMENT_V20)}; dmnman.UpdatedBlockTip(tip); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); const CAmount block_subsidy = GetBlockSubsidyInner(tip->nBits, tip->nHeight, consensus_params, isV20Active); const CAmount masternode_payment = GetMasternodePayment(tip->nHeight, block_subsidy, isV20Active); const auto pblocktemplate = BlockAssembler(m_node.chainman->ActiveChainstate(), m_node, *m_node.mempool, Params()).CreateNewBlock(coinbasePubKey); diff --git a/src/test/evo_deterministicmns_tests.cpp b/src/test/evo_deterministicmns_tests.cpp index 20ebfeea1f..5677b71a48 100644 --- a/src/test/evo_deterministicmns_tests.cpp +++ b/src/test/evo_deterministicmns_tests.cpp @@ -58,7 +58,7 @@ static std::vector SelectUTXOs(const CChain& active_chain, SimpleUTXO utoxs.erase(it); break; } - BOOST_ASSERT(found); + BOOST_REQUIRE(found); if (selectedAmount >= amount) { changeRet = selectedAmount - amount; break; @@ -89,8 +89,8 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx, for (size_t i = 0; i < tx.vin.size(); i++) { uint256 hashBlock; CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, tx.vin[i].prevout.hash, Params().GetConsensus(), hashBlock); - BOOST_ASSERT(txFrom); - BOOST_ASSERT(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL)); + BOOST_REQUIRE(txFrom); + BOOST_REQUIRE(SignSignature(tempKeystore, *txFrom, tx, i, SIGHASH_ALL)); } } @@ -182,7 +182,7 @@ template static CMutableTransaction MalleateProTxPayout(const CMutableTransaction& tx) { auto opt_protx = GetTxPayload(tx); - BOOST_ASSERT(opt_protx.has_value()); + BOOST_REQUIRE(opt_protx.has_value()); auto& protx = *opt_protx; CKey key; @@ -226,7 +226,7 @@ static bool CheckTransactionSignature(const CTxMemPool& mempool, const CMutableT const auto& txin = tx.vin[i]; uint256 hashBlock; CTransactionRef txFrom = GetTransaction(/* block_index */ nullptr, &mempool, txin.prevout.hash, Params().GetConsensus(), hashBlock); - BOOST_ASSERT(txFrom); + BOOST_REQUIRE(txFrom); CAmount amount = txFrom->vout[txin.prevout.n].nValue; if (!VerifyScript(txin.scriptSig, txFrom->vout[txin.prevout.n].scriptPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, MutableTransactionSignatureChecker(&tx, i, amount))) { @@ -254,19 +254,19 @@ void FuncDIP3Activation(TestChainSetup& setup) auto block = std::make_shared(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate())); chainman.ProcessNewBlock(Params(), block, true, nullptr); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); - BOOST_ASSERT(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash()); - BOOST_ASSERT(!dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(block->GetHash() != chainman.ActiveChain().Tip()->GetBlockHash()); + BOOST_REQUIRE(!dmnman.GetListAtChainTip().HasMN(tx.GetHash())); // This block should activate DIP3 setup.CreateAndProcessBlock({}, setup.coinbaseKey); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1); // Mining a block with a DIP3 transaction should succeed now block = std::make_shared(setup.CreateBlock(txns, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2); BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash()); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); }; void FuncV19Activation(TestChainSetup& setup) @@ -274,7 +274,7 @@ void FuncV19Activation(TestChainSetup& setup) auto& chainman = *Assert(setup.m_node.chainman.get()); auto& dmnman = *Assert(setup.m_node.dmnman); - BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); // create auto utxos = BuildSimpleUtxoMap(setup.m_coinbase_txns); @@ -289,14 +289,14 @@ void FuncV19Activation(TestChainSetup& setup) int nHeight = chainman.ActiveChain().Height(); auto block = std::make_shared(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); - BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); ++nHeight; BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); auto tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(tip_list.HasMN(tx_reg_hash)); auto pindex_create = chainman.ActiveChain().Tip(); auto base_list = dmnman.GetListForBlock(pindex_create); std::vector diffs; @@ -307,14 +307,14 @@ void FuncV19Activation(TestChainSetup& setup) auto tx_upreg = CreateProUpRegTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, tx_reg_hash, owner_key, operator_key_new.GetPublicKey(), owner_key.GetPubKey().GetID(), collateralScript, setup.coinbaseKey); block = std::make_shared(setup.CreateBlock({tx_upreg}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); - BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); ++nHeight; BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(tip_list.HasMN(tx_reg_hash)); diffs.push_back(base_list.BuildDiff(tip_list)); // spend @@ -325,61 +325,62 @@ void FuncV19Activation(TestChainSetup& setup) FillableSigningProvider signing_provider; signing_provider.AddKeyPubKey(collateral_key, collateral_key.GetPubKey()); - BOOST_ASSERT(SignSignature(signing_provider, CTransaction(tx_reg), tx_spend, 0, SIGHASH_ALL)); + BOOST_REQUIRE(SignSignature(signing_provider, CTransaction(tx_reg), tx_spend, 0, SIGHASH_ALL)); block = std::make_shared(setup.CreateBlock({tx_spend}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); - BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); ++nHeight; BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip())); tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash)); - BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); + BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); // mine another block so that it's not the last one before V19 setup.CreateAndProcessBlock({}, setup.coinbaseKey); - BOOST_ASSERT(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(!DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); ++nHeight; BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip())); tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash)); - BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); + BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); // this block should activate V19 setup.CreateAndProcessBlock({}, setup.coinbaseKey); - BOOST_ASSERT(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); ++nHeight; BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip())); tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash)); - BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); + BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); // check mn list/diff CDeterministicMNListDiff dummy_diff = base_list.BuildDiff(tip_list); CDeterministicMNList dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff); // Lists should match - BOOST_ASSERT(dummmy_list == tip_list); + BOOST_REQUIRE(dummmy_list == tip_list); // mine 10 more blocks for (int i = 0; i < 10; ++i) { setup.CreateAndProcessBlock({}, setup.coinbaseKey); - BOOST_ASSERT(DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); + BOOST_REQUIRE( + DeploymentActiveAfter(chainman.ActiveChain().Tip(), Params().GetConsensus(), Consensus::DEPLOYMENT_V19)); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1 + i); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); dmnman.DoMaintenance(); diffs.push_back(tip_list.BuildDiff(dmnman.GetListAtChainTip())); tip_list = dmnman.GetListAtChainTip(); - BOOST_ASSERT(!tip_list.HasMN(tx_reg_hash)); - BOOST_ASSERT(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); + BOOST_REQUIRE(!tip_list.HasMN(tx_reg_hash)); + BOOST_REQUIRE(dmnman.GetListForBlock(pindex_create).HasMN(tx_reg_hash)); } // check mn list/diff @@ -387,19 +388,19 @@ void FuncV19Activation(TestChainSetup& setup) auto v19_list = dmnman.GetListForBlock(v19_index); dummy_diff = v19_list.BuildDiff(tip_list); dummmy_list = v19_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff); - BOOST_ASSERT(dummmy_list == tip_list); + BOOST_REQUIRE(dummmy_list == tip_list); // NOTE: this fails on v19/v19.1 with errors like: // "RemoveMN: Can't delete a masternode ... with a pubKeyOperator=..." dummy_diff = base_list.BuildDiff(tip_list); dummmy_list = base_list.ApplyDiff(chainman.ActiveChain().Tip(), dummy_diff); - BOOST_ASSERT(dummmy_list == tip_list); + BOOST_REQUIRE(dummmy_list == tip_list); dummmy_list = base_list; for (const auto& diff : diffs) { dummmy_list = dummmy_list.ApplyDiff(chainman.ActiveChain().Tip(), diff); } - BOOST_ASSERT(dummmy_list == tip_list); + BOOST_REQUIRE(dummmy_list == tip_list); }; void FuncDIP3Protx(TestChainSetup& setup) @@ -439,18 +440,20 @@ void FuncDIP3Protx(TestChainSetup& setup) // Technically, the payload is still valid... { LOCK(cs_main); - BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true)); - BOOST_ASSERT(CheckProRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true)); + BOOST_REQUIRE(CheckProRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, + chainman.ActiveChainstate().CoinsTip(), true)); + BOOST_REQUIRE(CheckProRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, + chainman.ActiveChainstate().CoinsTip(), true)); } // But the signature should not verify anymore - BOOST_ASSERT(CheckTransactionSignature(*(setup.m_node.mempool), tx)); - BOOST_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2)); + BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx)); + BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2)); setup.CreateAndProcessBlock({tx}, setup.coinbaseKey); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx.GetHash())); nHeight++; } @@ -467,10 +470,10 @@ void FuncDIP3Protx(TestChainSetup& setup) CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); - BOOST_ASSERT(!block.vtx.empty()); + BOOST_REQUIRE(!block.vtx.empty()); auto dmnPayout = FindPayoutDmn(dmnman, block); - BOOST_ASSERT(dmnPayout != nullptr); + BOOST_REQUIRE(dmnPayout != nullptr); BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString()); nHeight++; @@ -493,7 +496,7 @@ void FuncDIP3Protx(TestChainSetup& setup) BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1); for (size_t j = 0; j < 3; j++) { - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(txns[j].GetHash())); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(txns[j].GetHash())); } nHeight++; @@ -507,7 +510,7 @@ void FuncDIP3Protx(TestChainSetup& setup) nHeight++; auto dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]); - BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 1000); + BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 1000); // test ProUpRevTx tx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), utxos, dmnHashes[0], operatorKeys[dmnHashes[0]], setup.coinbaseKey); @@ -517,19 +520,19 @@ void FuncDIP3Protx(TestChainSetup& setup) nHeight++; dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]); - BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->GetBannedHeight() == nHeight); + BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->GetBannedHeight() == nHeight); // test that the revoked MN does not get paid anymore for (size_t i = 0; i < 20; i++) { auto dmnExpectedPayee = dmnman.GetListAtChainTip().GetMNPayee(chainman.ActiveChain().Tip()); - BOOST_ASSERT(dmnExpectedPayee->proTxHash != dmnHashes[0]); + BOOST_REQUIRE(dmnExpectedPayee->proTxHash != dmnHashes[0]); CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); - BOOST_ASSERT(!block.vtx.empty()); + BOOST_REQUIRE(!block.vtx.empty()); auto dmnPayout = FindPayoutDmn(dmnman, block); - BOOST_ASSERT(dmnPayout != nullptr); + BOOST_REQUIRE(dmnPayout != nullptr); BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString()); nHeight++; @@ -545,11 +548,13 @@ void FuncDIP3Protx(TestChainSetup& setup) TxValidationState dummy_state; { LOCK(cs_main); - BOOST_ASSERT(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true)); - BOOST_ASSERT(!CheckProUpRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, chainman.ActiveChainstate().CoinsTip(), true)); + BOOST_REQUIRE(CheckProUpRegTx(dmnman, CTransaction(tx), chainman.ActiveChain().Tip(), dummy_state, + chainman.ActiveChainstate().CoinsTip(), true)); + BOOST_REQUIRE(!CheckProUpRegTx(dmnman, CTransaction(tx2), chainman.ActiveChain().Tip(), dummy_state, + chainman.ActiveChainstate().CoinsTip(), true)); } - BOOST_ASSERT(CheckTransactionSignature(*(setup.m_node.mempool), tx)); - BOOST_ASSERT(!CheckTransactionSignature(*(setup.m_node.mempool), tx2)); + BOOST_REQUIRE(CheckTransactionSignature(*(setup.m_node.mempool), tx)); + BOOST_REQUIRE(!CheckTransactionSignature(*(setup.m_node.mempool), tx2)); // now process the block setup.CreateAndProcessBlock({tx}, setup.coinbaseKey); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); @@ -563,8 +568,8 @@ void FuncDIP3Protx(TestChainSetup& setup) nHeight++; dmn = dmnman.GetListAtChainTip().GetMN(dmnHashes[0]); - BOOST_ASSERT(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100); - BOOST_ASSERT(dmn != nullptr && !dmn->pdmnState->IsBanned()); + BOOST_REQUIRE(dmn != nullptr && dmn->pdmnState->addr.GetPort() == 100); + BOOST_REQUIRE(dmn != nullptr && !dmn->pdmnState->IsBanned()); // test that the revived MN gets payments again bool foundRevived = false; @@ -576,15 +581,15 @@ void FuncDIP3Protx(TestChainSetup& setup) CBlock block = setup.CreateAndProcessBlock({}, setup.coinbaseKey); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); - BOOST_ASSERT(!block.vtx.empty()); + BOOST_REQUIRE(!block.vtx.empty()); auto dmnPayout = FindPayoutDmn(dmnman, block); - BOOST_ASSERT(dmnPayout != nullptr); + BOOST_REQUIRE(dmnPayout != nullptr); BOOST_CHECK_EQUAL(dmnPayout->proTxHash.ToString(), dmnExpectedPayee->proTxHash.ToString()); nHeight++; } - BOOST_ASSERT(foundRevived); + BOOST_REQUIRE(foundRevived); const_cast(Params().GetConsensus()).DIP0003EnforcementHeight = DIP0003EnforcementHeightBackup; } @@ -615,7 +620,7 @@ void FuncTestMempoolReorg(TestChainSetup& setup) SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey); auto block = std::make_shared(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); setup.m_node.dmnman->UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1); BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash()); @@ -757,7 +762,7 @@ void FuncVerifyDB(TestChainSetup& setup) SignTransaction(*(setup.m_node.mempool), tx_collateral, setup.coinbaseKey); auto block = std::make_shared(setup.CreateBlock({tx_collateral}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 1); BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash()); @@ -789,11 +794,11 @@ void FuncVerifyDB(TestChainSetup& setup) auto tx_reg_hash = tx_reg.GetHash(); block = std::make_shared(setup.CreateBlock({tx_reg}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 2); BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash()); - BOOST_ASSERT(dmnman.GetListAtChainTip().HasMN(tx_reg_hash)); + BOOST_REQUIRE(dmnman.GetListAtChainTip().HasMN(tx_reg_hash)); // Now spend the collateral while updating the same MN SimpleUTXOMap collateral_utxos; @@ -801,15 +806,16 @@ void FuncVerifyDB(TestChainSetup& setup) auto proUpRevTx = CreateProUpRevTx(chainman.ActiveChain(), *(setup.m_node.mempool), collateral_utxos, tx_reg_hash, operatorKey, collateralKey); block = std::make_shared(setup.CreateBlock({proUpRevTx}, setup.coinbaseKey, chainman.ActiveChainstate())); - BOOST_ASSERT(chainman.ProcessNewBlock(Params(), block, true, nullptr)); + BOOST_REQUIRE(chainman.ProcessNewBlock(Params(), block, true, nullptr)); dmnman.UpdatedBlockTip(chainman.ActiveChain().Tip()); BOOST_CHECK_EQUAL(chainman.ActiveChain().Height(), nHeight + 3); BOOST_CHECK_EQUAL(block->GetHash(), chainman.ActiveChain().Tip()->GetBlockHash()); - BOOST_ASSERT(!dmnman.GetListAtChainTip().HasMN(tx_reg_hash)); + BOOST_REQUIRE(!dmnman.GetListAtChainTip().HasMN(tx_reg_hash)); // Verify db consistency LOCK(cs_main); - BOOST_ASSERT(CVerifyDB().VerifyDB(chainman.ActiveChainstate(), Params(), chainman.ActiveChainstate().CoinsTip(), *(setup.m_node.evodb), 4, 2)); + BOOST_REQUIRE(CVerifyDB().VerifyDB(chainman.ActiveChainstate(), Params(), chainman.ActiveChainstate().CoinsTip(), + *(setup.m_node.evodb), 4, 2)); } BOOST_AUTO_TEST_SUITE(evo_dip3_activation_tests) diff --git a/src/test/evo_simplifiedmns_tests.cpp b/src/test/evo_simplifiedmns_tests.cpp index a7fe5dbd88..1946ddc7be 100644 --- a/src/test/evo_simplifiedmns_tests.cpp +++ b/src/test/evo_simplifiedmns_tests.cpp @@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots) if (auto service = Lookup(ip, i, false); service.has_value()) { smle.service = service.value(); } else { - BOOST_ASSERT(false); + BOOST_REQUIRE(false); } std::vector vecBytes{static_cast(i)}; diff --git a/src/test/llmq_dkg_tests.cpp b/src/test/llmq_dkg_tests.cpp index 15b3242eea..fe2cb23d94 100644 --- a/src/test/llmq_dkg_tests.cpp +++ b/src/test/llmq_dkg_tests.cpp @@ -14,13 +14,13 @@ BOOST_AUTO_TEST_CASE(llmq_dkgerror) { using namespace llmq; for (auto i : irange::range(ToUnderlying(llmq::DKGError::type::_COUNT))) { - BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 0.0); + BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 0.0); SetSimulatedDKGErrorRate(llmq::DKGError::type(i), 1.0); - BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 1.0); + BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type(i)) == 1.0); } - BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0); + BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0); SetSimulatedDKGErrorRate(llmq::DKGError::type::_COUNT, 1.0); - BOOST_ASSERT(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0); + BOOST_REQUIRE(GetSimulatedErrorRate(llmq::DKGError::type::_COUNT) == 0.0); } diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 9f917bd7ea..72dbd153bc 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -441,13 +441,13 @@ CBlock TestChainSetup::CreateBlock( if (block.vtx[0]->nType == TRANSACTION_COINBASE) { LOCK(cs_main); auto cbTx = GetTxPayload(*block.vtx[0]); - BOOST_ASSERT(cbTx.has_value()); + Assert(cbTx.has_value()); BlockValidationState state; if (!CalcCbTxMerkleRootMNList(block, chainstate.m_chain.Tip(), cbTx->merkleRootMNList, *m_node.dmnman, state, chainstate.CoinsTip())) { - BOOST_ASSERT(false); + Assert(false); } if (!CalcCbTxMerkleRootQuorums(block, chainstate.m_chain.Tip(), *m_node.llmq_ctx->quorum_block_processor, cbTx->merkleRootQuorums, state)) { - BOOST_ASSERT(false); + Assert(false); } CMutableTransaction tmpTx{*block.vtx[0]}; SetTxPayload(tmpTx, *cbTx); diff --git a/src/txmempool.h b/src/txmempool.h index 6067ec8ed3..13f2b964d2 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -31,8 +31,11 @@ #include #include +#include +#include #include #include +#include #include class CBlockIndex; diff --git a/src/wallet/test/coinjoin_tests.cpp b/src/wallet/test/coinjoin_tests.cpp index 45afe2bba5..0615943b4e 100644 --- a/src/wallet/test/coinjoin_tests.cpp +++ b/src/wallet/test/coinjoin_tests.cpp @@ -209,7 +209,7 @@ public: BOOST_FIXTURE_TEST_CASE(coinjoin_manager_start_stop_tests, CTransactionBuilderTestSetup) { CCoinJoinClientManager* cj_man = m_node.cj_ctx->walletman->Get(""); - BOOST_ASSERT(cj_man != nullptr); + BOOST_REQUIRE(cj_man != nullptr); BOOST_CHECK_EQUAL(cj_man->IsMixing(), false); BOOST_CHECK_EQUAL(cj_man->StartMixing(), true); BOOST_CHECK_EQUAL(cj_man->IsMixing(), true); diff --git a/test/lint/lint-includes.sh b/test/lint/lint-includes.sh index 61da0726ed..a2aa3f47ec 100755 --- a/test/lint/lint-includes.sh +++ b/test/lint/lint-includes.sh @@ -51,8 +51,11 @@ fi EXPECTED_BOOST_INCLUDES=( boost/date_time/posix_time/posix_time.hpp boost/multi_index/hashed_index.hpp + boost/multi_index/identity.hpp + boost/multi_index/indexed_by.hpp boost/multi_index/ordered_index.hpp boost/multi_index/sequenced_index.hpp + boost/multi_index/tag.hpp boost/multi_index_container.hpp boost/pool/pool_alloc.hpp boost/process.hpp