From 833eaacadebc628388551db391577680b2202ae1 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 22 Apr 2025 11:48:20 +0200 Subject: [PATCH] ci: use 24.04 instead of lunar for tidy and fuzz ci --- .cirrus.yml | 12 ++++++------ ci/test/00_setup_env_native_fuzz.sh | 2 +- ci/test/00_setup_env_native_tidy.sh | 2 +- src/.bear-tidy-config | 3 ++- src/assetsdir.cpp | 2 +- src/assetsdir.h | 2 +- src/confidential_validation.h | 4 ++-- src/primitives/confidential.h | 2 -- src/primitives/transaction.cpp | 2 -- src/primitives/transaction.h | 4 ---- src/qt/bitcoinamountfield.h | 4 ++-- src/qt/bitcoinunits.cpp | 2 +- src/rpc/mining.cpp | 4 ++-- src/rpc/rawtransaction.cpp | 3 ++- src/script/interpreter.cpp | 2 +- src/script/script.cpp | 3 +++ src/script/script.h | 1 + src/wallet/coinselection.cpp | 2 +- src/wallet/rpc/elements.cpp | 6 +++--- 19 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 57417a7466..b4902039d1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -82,13 +82,13 @@ task: << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV task: - name: 'tidy [lunar]' + name: 'tidy [24.04]' << : *GLOBAL_TASK_TEMPLATE container: cpu: 2 memory: 5G docker_arguments: - CI_IMAGE_NAME_TAG: ubuntu:lunar + CI_IMAGE_NAME_TAG: ubuntu:24.04 FILE_ENV: "./ci/test/00_setup_env_native_tidy.sh" # For faster CI feedback, immediately schedule the linters << : *CREDITS_TEMPLATE @@ -253,11 +253,11 @@ task: MAKEJOBS: "-j2" # Avoid excessive memory use due to MSan task: - name: '[MSan, depends] [lunar]' + name: '[MSan, depends] [24.04]' << : *GLOBAL_TASK_TEMPLATE container: docker_arguments: - CI_IMAGE_NAME_TAG: ubuntu:lunar + CI_IMAGE_NAME_TAG: ubuntu:24.04 FILE_ENV: "./ci/test/00_setup_env_native_msan.sh" env: << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV @@ -281,13 +281,13 @@ task: FILE_ENV: "./ci/test/00_setup_env_native_asan.sh" task: - name: '[fuzzer,address,undefined,integer, no depends] [lunar]' + name: '[fuzzer,address,undefined,integer, no depends] [24.04]' << : *GLOBAL_TASK_TEMPLATE container: cpu: 8 # Increase CPU and memory to avoid timeout memory: 16G docker_arguments: - CI_IMAGE_NAME_TAG: ubuntu:jammy + CI_IMAGE_NAME_TAG: ubuntu:24.04 FILE_ENV: "./ci/test/00_setup_env_native_fuzz.sh" env: << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index b65e84ff94..9e692b3dad 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -6,7 +6,7 @@ export LC_ALL=C.UTF-8 -export CI_IMAGE_NAME_TAG="ubuntu:23.04" # Version 23.04 will reach EOL in Jan 2024, and can be replaced by "ubuntu:24.04" (or anything else that ships the wanted clang version). +export CI_IMAGE_NAME_TAG="ubuntu:24.04" export CONTAINER_NAME=ci_native_fuzz export PACKAGES="clang-16 llvm-16 libclang-rt-16-dev python3 libevent-dev bsdmainutils libboost-dev libsqlite3-dev" export NO_DEPENDS=1 diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh index 2fa61b8465..ed7a6b07c4 100755 --- a/ci/test/00_setup_env_native_tidy.sh +++ b/ci/test/00_setup_env_native_tidy.sh @@ -6,7 +6,7 @@ export LC_ALL=C.UTF-8 -export CI_IMAGE_NAME_TAG="ubuntu:lunar" # Version 23.04 will reach EOL in Jan 2024, and can be replaced by "ubuntu:24.04" (or anything else that ships the wanted clang version). +export CI_IMAGE_NAME_TAG="ubuntu:24.04" export CONTAINER_NAME=ci_native_tidy export PACKAGES="clang-16 libclang-16-dev llvm-16-dev libomp-16-dev clang-tidy-16 bear cmake libevent-dev libboost-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev systemtap-sdt-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev" export NO_DEPENDS=1 diff --git a/src/.bear-tidy-config b/src/.bear-tidy-config index 111ef6ee44..434d9228f4 100644 --- a/src/.bear-tidy-config +++ b/src/.bear-tidy-config @@ -4,7 +4,8 @@ "include_only_existing_source": true, "paths_to_include": [], "paths_to_exclude": [ - "src/leveldb" + "src/leveldb", + "src/secp256k1" ] }, "format": { diff --git a/src/assetsdir.cpp b/src/assetsdir.cpp index 385ba8d5c4..4c3711135d 100644 --- a/src/assetsdir.cpp +++ b/src/assetsdir.cpp @@ -74,7 +74,7 @@ std::string CAssetsDir::GetLabel(const CAsset& asset) const std::string CAssetsDir::GetIdentifier(const CAsset& asset) const { - const std::string label = GetMetadata(asset).GetLabel(); + std::string label = GetMetadata(asset).GetLabel(); if (!label.empty()) return label; return asset.GetHex(); } diff --git a/src/assetsdir.h b/src/assetsdir.h index b551b8b71e..1e74cfe095 100644 --- a/src/assetsdir.h +++ b/src/assetsdir.h @@ -10,7 +10,7 @@ class AssetMetadata { std::string label; public: - AssetMetadata() : label("") {}; + AssetMetadata() : label() {}; AssetMetadata(std::string _label) : label(_label) {}; const std::string& GetLabel() const diff --git a/src/confidential_validation.h b/src/confidential_validation.h index 36ec2d7455..d6ffeb4fc5 100644 --- a/src/confidential_validation.h +++ b/src/confidential_validation.h @@ -28,10 +28,10 @@ CAmountMap GetFeeMap(const CTransaction& tx); class CCheck { protected: - ScriptError error; + ScriptError error{SCRIPT_ERR_UNKNOWN_ERROR}; public: - CCheck() : error(SCRIPT_ERR_UNKNOWN_ERROR) {} + CCheck() {} virtual ~CCheck() {} virtual bool operator()() = 0; diff --git a/src/primitives/confidential.h b/src/primitives/confidential.h index 00bcab16e8..4d68dab07b 100644 --- a/src/primitives/confidential.h +++ b/src/primitives/confidential.h @@ -10,8 +10,6 @@ #include #include -extern bool g_con_elementsmode; - /** * Confidential assets, values, and nonces all share enough code in common * that it makes sense to define a common abstract base class. */ diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index d051afc41f..3707d422c6 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -17,8 +17,6 @@ #include #include -bool g_con_elementsmode = false; - const int32_t CTransaction::CURRENT_VERSION = 2; std::string COutPoint::ToString() const diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 7bd76ffbc9..3003491411 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -33,10 +33,6 @@ */ static const int SERIALIZE_TRANSACTION_NO_WITNESS = 0x40000000; -// ELEMENTS: -// Globals to avoid circular dependencies. -extern bool g_con_elementsmode; - /** An outpoint - a combination of a transaction hash and an index n into its vout */ class COutPoint { diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 733540437e..4524b47502 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -29,10 +29,10 @@ class BitcoinAmountField: public QWidget Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) public: - explicit BitcoinAmountField(std::set allowed_assets, QWidget *parent = 0); + explicit BitcoinAmountField(std::set allowed_assets, QWidget *parent = nullptr); explicit BitcoinAmountField(QWidget *parent = nullptr); - std::pair fullValue(bool *valid=0) const; + std::pair fullValue(bool *valid = nullptr) const; void setFullValue(const CAsset& asset, const CAmount& value); CAmount value(bool *value=nullptr) const; diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 73bc96d272..f72048dbbb 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -32,7 +32,7 @@ QList BitcoinUnits::availableUnits() // ELEMENTS std::string peggedAssetWithUnit(BitcoinUnits::Unit unit) { - const std::string default_asset_name = gArgs.GetArg("-defaultpeggedassetname", ""); + std::string default_asset_name = gArgs.GetArg("-defaultpeggedassetname", ""); if (default_asset_name != "") { switch(unit) { diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 8455895c94..2d11007fda 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -1495,9 +1495,9 @@ static RPCHelpMan finalizecompactblock() PartiallyDownloadedBlock partialBlock(&dummy_pool); // "Extra" list is really our combined list that will be put into place using InitData - std::vector> extra_txn; + std::vector> extra_txn(found.size()); for (const auto& found_tx : found) { - extra_txn.push_back(std::make_pair(found_tx->GetWitnessHash(), found_tx)); + extra_txn.emplace_back(found_tx->GetWitnessHash(), found_tx); } std::shared_ptr pblock = std::make_shared(); if (partialBlock.InitData(cmpctblock, extra_txn) != READ_STATUS_OK) { diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 9770e40d82..861a400c20 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1759,10 +1759,10 @@ static RPCHelpMan combinepsbt() // Find if (and which) psbt has all the output blinding stuff set unsigned int base_psbt_index = 0; bool has_fully_blinded = false; + int unblinded_count = 0; for (unsigned int i = 0; i < psbtxs.size(); ++i) { const auto& psbt = psbtxs[i]; bool is_fully_blinded = true; - int unblinded_count = 0; for (const auto& psbt_out : psbt.outputs) { if (psbt_out.IsBlinded()) { is_fully_blinded &= psbt_out.IsFullyBlinded(); @@ -1797,6 +1797,7 @@ static RPCHelpMan combinepsbt() } } if (is_fully_blinded) { + LogPrintf("Cannot combine PSETs. Num unblinded outputs: %d\n", unblinded_count); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Cannot combine PSETs as the values and blinders would become imbalanced"); } } diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 33f4e1b607..f99a436588 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -3096,7 +3096,7 @@ bool GenericTransactionSignatureChecker::CheckSimplicity(const valtype& progr assert(txdata->m_simplicity_tx_data); assert(simplicityTapEnv); - if (!simplicity_elements_execSimplicity(&error, 0, txdata->m_simplicity_tx_data.get(), nIn, simplicityTapEnv, txdata->m_hash_genesis_block.data(), budget, 0, program.data(), program.size(), witness.data(), witness.size())) { + if (!simplicity_elements_execSimplicity(&error, nullptr, txdata->m_simplicity_tx_data.get(), nIn, simplicityTapEnv, txdata->m_hash_genesis_block.data(), budget, nullptr, program.data(), program.size(), witness.data(), witness.size())) { assert(!"simplicity_elements_execSimplicity internal error"); } simplicity_elements_freeTapEnv(simplicityTapEnv); diff --git a/src/script/script.cpp b/src/script/script.cpp index e3738ecfbc..0e33ef20bf 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -9,6 +9,9 @@ #include +// ELEMENTS +bool g_con_elementsmode = false; + std::string GetOpName(opcodetype opcode) { switch (opcode) diff --git a/src/script/script.h b/src/script/script.h index 91d6c81418..04d2b31147 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -21,6 +21,7 @@ #include #include +// ELEMENTS: global elements mode declaration, initialized in script.cpp // IsUnspendable() compatibility extern bool g_con_elementsmode; diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp index 2f8d534c96..5855087479 100644 --- a/src/wallet/coinselection.cpp +++ b/src/wallet/coinselection.cpp @@ -830,7 +830,7 @@ CAmountMap SelectionResult::GetChange(const CAmount min_viable_change, const CAm // - input fees are covered by GetSelectedEffectiveValue() // - non_input_fee is included in m_target // - change_fee - const CAmountMap change = m_use_effective + CAmountMap change = m_use_effective ? GetSelectedEffectiveValue() - m_target - CAmountMap{{::policyAsset, change_fee}} : GetSelectedValue() - m_target; diff --git a/src/wallet/rpc/elements.cpp b/src/wallet/rpc/elements.cpp index bb767fb5aa..525960af4e 100644 --- a/src/wallet/rpc/elements.cpp +++ b/src/wallet/rpc/elements.cpp @@ -375,12 +375,12 @@ RPCHelpMan initpegoutwallet() } // Strip off leading key origin - if (xpub_str.find("]") != std::string::npos) { - xpub_str = xpub_str.substr(xpub_str.find("]")+1, std::string::npos); + if (xpub_str.find(']') != std::string::npos) { + xpub_str = xpub_str.substr(xpub_str.find(']') + 1, std::string::npos); } // Strip off following range - xpub_str = xpub_str.substr(0, xpub_str.find("/")); + xpub_str = xpub_str.substr(0, xpub_str.find('/')); xpub = DecodeExtPubKey(xpub_str);