Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,37 @@ base_template: &BASE_TEMPLATE
- git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts
# Also, the merge commit is used to lint COMMIT_RANGE="HEAD~..HEAD"

main_template: &MAIN_TEMPLATE
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
ccache_cache:
folder: "/tmp/ccache_dir"
ci_script:
- ./ci/test_run_all.sh

global_task_template: &GLOBAL_TASK_TEMPLATE
<< : *BASE_TEMPLATE
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
container:
# https://cirrus-ci.org/faq/#are-there-any-limits
# Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel
cpu: 2
greedy: true
memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers
ccache_cache:
folder: "/tmp/ccache_dir"
depends_built_cache:
folder: "/tmp/cirrus-ci-build/depends/built"
folder: "depends/built"
fingerprint_script: echo $CIRRUS_TASK_NAME $(git rev-list -1 HEAD ./depends)
depends_sdk_cache:
folder: "/tmp/cirrus-ci-build/depends/sdk-sources"
depends_releases_cache:
folder: "/tmp/cirrus-ci-build/releases"
ci_script:
- ./ci/test_run_all.sh
<< : *MAIN_TEMPLATE

macos_native_task_template: &MACOS_NATIVE_TASK_TEMPLATE
<< : *BASE_TEMPLATE
check_clang_script:
- clang --version
brew_install_script:
- brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
<< : *MAIN_TEMPLATE
compute_credits_template: &CREDITS_TEMPLATE
# https://cirrus-ci.org/pricing/#compute-credits
# Only use credits for pull requests to the main repo
Expand Down Expand Up @@ -169,15 +180,29 @@ task:
FILE_ENV: "./ci/test/00_setup_env_mac.sh"

task:
name: 'macOS 12 native [gui, system sqlite only] [no depends]'
brew_install_script:
- brew install boost libevent qt@5 miniupnpc ccache zeromq qrencode libtool automake gnu-getopt
<< : *GLOBAL_TASK_TEMPLATE
name: 'macOS 12 native x86_64 [gui, system sqlite] [no depends]'
macos_instance:
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
image: monterey-xcode-13.3 # https://cirrus-ci.org/guide/macOS
<< : *MACOS_NATIVE_TASK_TEMPLATE
env:
DANGER_RUN_CI_ON_HOST: "true"
CI_USE_APT_INSTALL: "no"
PACKAGE_MANAGER_INSTALL: "echo" # Nothing to do
FILE_ENV: "./ci/test/00_setup_env_mac_host.sh"
FILE_ENV: "./ci/test/00_setup_env_mac_native_x86_64.sh"

task:
name: 'ARM64 Android APK [focal]'
<< : *BASE_TEMPLATE
android_sdk_cache:
folder: "depends/SDKs/android"
fingerprint_key: "ANDROID_API_LEVEL=28 ANDROID_BUILD_TOOLS_VERSION=28.0.3 ANDROID_NDK_VERSION=23.2.8568313"
depends_sources_cache:
folder: "depends/sources"
fingerprint_script: git rev-list -1 HEAD ./depends
<< : *MAIN_TEMPLATE
container:
image: ubuntu:focal
env:
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
FILE_ENV: "./ci/test/00_setup_env_android.sh"
Comment on lines +194 to +208
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Fix YAML formatting and undeclared alias issues.

The static analysis identifies several problems that need to be addressed:

  1. Duplicate task key: Line 194 creates a duplicate "task" key in the YAML mapping
  2. Undeclared alias: Line 207 references CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV which is not declared
  3. Spacing issues: Multiple lines have incorrect indentation before colons

🏁 Script executed:

#!/bin/bash
# Verify the YAML syntax and check for the undeclared alias
echo "Checking for CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV declaration..."
rg -n "CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV.*:" .cirrus.yml || echo "Alias not found"

echo "Validating YAML syntax..."
python3 -c "
import yaml
import sys
try:
    with open('.cirrus.yml', 'r') as f:
        yaml.safe_load(f)
    print('YAML syntax is valid')
except yaml.YAMLError as e:
    print(f'YAML syntax error: {e}')
    sys.exit(1)
except Exception as e:
    print(f'Error: {e}')
    sys.exit(1)
"

Length of output: 742


🏁 Script executed:

#!/bin/bash
# Check how many times 'task:' appears at the start of a line
echo "Occurrences of 'task:' in .cirrus.yml:"
rg -n '^task:' .cirrus.yml

Length of output: 257


🏁 Script executed:

#!/bin/bash
# Check if a 'tasks:' mapping exists
echo "Searching for 'tasks:' at the beginning of lines in .cirrus.yml"
rg -n '^tasks:' .cirrus.yml || echo "No 'tasks:' mapping found"

Length of output: 239


Group tasks under a top‐level tasks: key and fix undefined alias

  • Introduce a top‐level tasks: sequence so you don’t repeat task: at the root (avoid duplicate mapping keys).
  • Declare the missing anchor &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV alongside your other templates (or remove its usage).
  • Normalize the YAML merge syntax—use <<: *TEMPLATE (no space before the colon).

Example diff:

+.cirrus.yml
+tasks:
+  - task:
       name: 'ARM64 Android APK [focal]'
-      << : *BASE_TEMPLATE
+      <<: *BASE_TEMPLATE
       android_sdk_cache:
         folder: "depends/SDKs/android"
         fingerprint_key: "ANDROID_API_LEVEL=28 ANDROID_BUILD_TOOLS_VERSION=28.0.3 ANDROID_NDK_VERSION=23.2.8568313"
       depends_sources_cache:
         folder: "depends/sources"
         fingerprint_script: git rev-list -1 HEAD ./depends
-      << : *MAIN_TEMPLATE
+      <<: *MAIN_TEMPLATE
       container:
         image: ubuntu:focal
       env:
-        << : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
+        <<: *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
         FILE_ENV: "./ci/test/00_setup_env_android.sh"

And in your templates section (near &BASE_TEMPLATE, &MAIN_TEMPLATE), add:

env_templates:
  CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV: &CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
    # define required environment variables here
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 194-194: duplication of key "task" in mapping

(key-duplicates)


[warning] 196-196: too many spaces before colon

(colons)


[warning] 203-203: too many spaces before colon

(colons)


[warning] 207-207: too many spaces before colon

(colons)


[error] 207-207: found undeclared alias "CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV"

(anchors)

🤖 Prompt for AI Agents
In .cirrus.yml around lines 194 to 208, fix the YAML by grouping all individual
'task:' entries under a single top-level 'tasks:' key to avoid duplicate mapping
keys. Declare the missing alias 'CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV' in the
templates section with an appropriate anchor or remove its usage if not needed.
Also, correct the YAML merge syntax by removing spaces before colons in '<<:
*TEMPLATE' lines and ensure proper indentation throughout the block.

12 changes: 12 additions & 0 deletions ci/dash/lint-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ iwyu_tool.py \
"src/init" \
"src/rpc/fees.cpp" \
"src/rpc/signmessage.cpp" \
"src/util/bip32.cpp" \
"src/util/bytevectorhash.cpp" \
"src/util/error.cpp" \
"src/util/getuniquepath.cpp" \
"src/util/hasher.cpp" \
"src/util/message.cpp" \
"src/util/moneystr.cpp" \
"src/util/serfloat.cpp" \
"src/util/spanparsing.cpp" \
"src/util/strencodings.cpp" \
"src/util/syserror.cpp" \
"src/util/url.cpp" \
-p . "${MAKEJOBS}" \
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
2>&1 | tee "/tmp/iwyu_ci.out"
Expand Down
23 changes: 19 additions & 4 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ static void RegisterMetaTypes()
qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon");
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qRegisterMetaTypeStreamOperators<BitcoinUnit>("BitcoinUnit");
#else
qRegisterMetaType<BitcoinUnit>("BitcoinUnit");
#endif
}

static QString GetLangTerritory()
Expand Down Expand Up @@ -137,21 +141,30 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
const QString translation_path{QLibraryInfo::location(QLibraryInfo::TranslationsPath)};
#else
const QString translation_path{QLibraryInfo::path(QLibraryInfo::TranslationsPath)};
#endif
// Load e.g. qt_de.qm
if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
if (qtTranslatorBase.load("qt_" + lang, translation_path)) {
QApplication::installTranslator(&qtTranslatorBase);
}

// Load e.g. qt_de_DE.qm
if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
if (qtTranslator.load("qt_" + lang_territory, translation_path)) {
QApplication::installTranslator(&qtTranslator);
}

// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in dash.qrc)
if (translatorBase.load(lang, ":/translations/"))
if (translatorBase.load(lang, ":/translations/")) {
QApplication::installTranslator(&translatorBase);
}

// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in dash.qrc)
if (translator.load(lang_territory, ":/translations/"))
if (translator.load(lang_territory, ":/translations/")) {
QApplication::installTranslator(&translator);
}
}

static bool InitSettings()
Expand Down Expand Up @@ -513,9 +526,11 @@ int GuiMain(int argc, char* argv[])
Q_INIT_RESOURCE(dash);
Q_INIT_RESOURCE(dash_locale);

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

BitcoinApplication app;
GUIUtil::LoadFont(QStringLiteral(":/fonts/monospace"));
Expand Down
10 changes: 10 additions & 0 deletions src/univalue/include/univalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class UniValue {
return push_back(tmpVal);
}
bool push_backV(const std::vector<UniValue>& vec);
template <class It>
bool push_backV(It first, It last);

void __pushKV(const std::string& key, const UniValue& val);
bool pushKV(const std::string& key, const UniValue& val);
Expand Down Expand Up @@ -180,6 +182,14 @@ class UniValue {
friend const UniValue& find_value( const UniValue& obj, const std::string& name);
};

template <class It>
bool UniValue::push_backV(It first, It last)
{
if (typ != VARR) return false;
values.insert(values.end(), first, last);
return true;
}

enum jtokentype {
JTOK_ERR = -1,
JTOK_NONE = 0, // eof
Expand Down
5 changes: 4 additions & 1 deletion src/util/asmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#include <clientversion.h>
#include <fs.h>
#include <logging.h>
#include <serialize.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25234: missing changes in ci/dash/lint-tidy.sh (which is ci/test/06_script_b.sh)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

#include <streams.h>

#include <algorithm>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the necessity of the algorithm header.

While the <algorithm> include follows the modernization pattern, I don't see direct usage of standard algorithm functions in the visible code. Please verify this inclusion is necessary for internal implementations or future compatibility.


🏁 Script executed:

#!/bin/bash
# Description: Check if std::algorithm functions are used in this file
# Expected: Find usage of std::sort, std::find, std::min_element, etc.

rg -A 2 -B 2 "std::(sort|find|search|min_element|max_element|copy|transform|for_each|count|binary_search)" src/util/asmap.cpp

Length of output: 127


🏁 Script executed:

#!/bin/bash
# Display the first 200 lines of src/util/asmap.cpp to inspect for any <algorithm> dependencies
echo "====== src/util/asmap.cpp (lines 1–200) ======"
sed -n '1,200p' src/util/asmap.cpp

Length of output: 8483


Remove unused <algorithm> include

The <algorithm> header isn’t referenced anywhere in src/util/asmap.cpp (no calls to sort, find, transform, etc.). You can safely drop it to clean up the include list.

Locations:

  • File: src/util/asmap.cpp, line with #include <algorithm>

Suggested diff:

--- a/src/util/asmap.cpp
+++ b/src/util/asmap.cpp
@@
-#include <algorithm>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#include <algorithm>
🤖 Prompt for AI Agents
In src/util/asmap.cpp at line 13, the #include <algorithm> directive is not used
anywhere in the file. Remove this include statement to clean up unnecessary
headers and reduce compilation overhead.

#include <bit>
#include <cassert>
#include <map>
#include <cstdio>
#include <utility>
#include <vector>

namespace {
Expand Down
4 changes: 3 additions & 1 deletion src/util/bip32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <sstream>
#include <tinyformat.h>
#include <util/bip32.h>
#include <util/strencodings.h>

#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <sstream>

bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
{
Expand Down
1 change: 0 additions & 1 deletion src/util/bip32.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef BITCOIN_UTIL_BIP32_H
#define BITCOIN_UTIL_BIP32_H

#include <attributes.h>
#include <cstdint>
#include <string>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions src/util/bytevectorhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <random.h>
#include <util/bytevectorhash.h>

#include <vector>

ByteVectorHash::ByteVectorHash()
{
GetRandBytes({reinterpret_cast<unsigned char*>(&m_k0), sizeof(m_k0)});
Expand Down
3 changes: 2 additions & 1 deletion src/util/bytevectorhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef BITCOIN_UTIL_BYTEVECTORHASH_H
#define BITCOIN_UTIL_BYTEVECTORHASH_H

#include <stdint.h>
#include <cstdint>
#include <cstddef>
#include <vector>

/**
Expand Down
4 changes: 3 additions & 1 deletion src/util/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
#include <util/error.h>

#include <tinyformat.h>
#include <util/system.h>
#include <util/translation.h>

#include <cassert>
#include <string>

bilingual_str TransactionErrorString(const TransactionError err)
{
switch (err) {
Expand Down
2 changes: 2 additions & 0 deletions src/util/hasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <crypto/siphash.h>
#include <random.h>
#include <span.h>
#include <util/hasher.h>

#include <limits>
Expand Down
6 changes: 6 additions & 0 deletions src/util/hasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
#ifndef BITCOIN_UTIL_HASHER_H
#define BITCOIN_UTIL_HASHER_H

#include <crypto/common.h>
#include <crypto/siphash.h>
#include <primitives/transaction.h>
#include <uint256.h>

#include <cstdint>
#include <cstring>

template <typename C> class Span;

class SaltedTxidHasher
{
private:
Expand Down
18 changes: 11 additions & 7 deletions src/util/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <hash.h> // For CHashWriter
#include <key.h> // For CKey
#include <key_io.h> // For DecodeDestination()
#include <pubkey.h> // For CPubKey
#include <script/standard.h> // For CTxDestination, IsValidDestination(), PKHash
#include <serialize.h> // For SER_GETHASH
#include <hash.h>
#include <key.h>
#include <key_io.h>
#include <pubkey.h>
#include <script/standard.h>
#include <serialize.h>
#include <uint256.h>
#include <util/message.h>
#include <util/strencodings.h> // For DecodeBase64()
#include <util/strencodings.h>

#include <cassert>
#include <optional>
#include <string>
#include <variant>
#include <vector>

/**
Expand Down
3 changes: 2 additions & 1 deletion src/util/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#ifndef BITCOIN_UTIL_MESSAGE_H
#define BITCOIN_UTIL_MESSAGE_H

#include <key.h> // For CKey
#include <uint256.h>

#include <string>

class CKey;

extern const std::string MESSAGE_MAGIC;

/** The result of a signed message verification.
Expand Down
1 change: 1 addition & 0 deletions src/util/moneystr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <util/strencodings.h>
#include <util/string.h>

#include <cstdint>
#include <optional>

std::string FormatMoney(const CAmount n)
Expand Down
1 change: 1 addition & 0 deletions src/util/readwritefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <fs.h>

#include <algorithm>
#include <cstdio>
#include <limits>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/util/serfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BITCOIN_UTIL_SERFLOAT_H
#define BITCOIN_UTIL_SERFLOAT_H

#include <stdint.h>
#include <cstdint>

/* Encode a double using the IEEE 754 binary64 format. All NaNs are encoded as x86/ARM's
* positive quiet NaN with payload 0. */
Expand Down
3 changes: 2 additions & 1 deletion src/util/spanparsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

#include <span.h>

#include <algorithm>
#include <cstddef>
#include <string>
#include <vector>

namespace spanparsing {

Expand Down
9 changes: 5 additions & 4 deletions src/util/strencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <span.h>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Header inclusions modernization looks good.

The header changes properly align with the code usage:

  • <span.h> is needed for Span<const unsigned char> (line 128) and Span<const uint8_t> (line 485)
  • <cassert> replaces <cstdlib> and correctly supports assert() calls (lines 285, 497)
  • <string> and <vector> are used throughout for standard containers
  • <ostream> may be needed for output stream operations

However, I notice std::stringstream is used on line 286 but <sstream> isn't included. Please verify this compiles correctly.

Also applies to: 11-11, 15-17


🏁 Script executed:

#!/bin/bash
# Check if sstream header is needed for stringstream usage
rg -A 3 -B 3 "stringstream" src/util/strencodings.cpp

Length of output: 262


Add missing <sstream> include for std::stringstream

The file uses std::stringstream in FormatParagraph (around line 286) but doesn’t include <sstream>. Please add it to the header list.

• File: src/util/strencodings.cpp
• Location: among the other standard headers at the top of the file

Suggested diff:

 #include <vector>
+#include <sstream>
 #include <span.h>
 #include <ostream>
 #include <string>
 #include <cassert>
🤖 Prompt for AI Agents
In src/util/strencodings.cpp at line 6, the file uses std::stringstream around
line 286 but does not include the <sstream> header. Add #include <sstream> among
the other standard headers at the top of the file to ensure proper compilation
and usage of stringstream.

#include <util/strencodings.h>
#include <util/string.h>

#include <tinyformat.h>

#include <algorithm>
#include <array>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <limits>
#include <optional>
#include <ostream>
#include <string>
#include <vector>

static const std::string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

Expand Down
4 changes: 4 additions & 0 deletions src/util/strencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
#include <util/string.h>

#include <charconv>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <string>
#include <string_view>
#include <system_error>
#include <type_traits>
#include <vector>

/** Used by SanitizeString() */
Expand Down
Loading
Loading