Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Prove+document ConstevalFormatString/tinyformat parity #30933

Merged

Conversation

hodlinator
Copy link
Contributor

@hodlinator hodlinator commented Sep 19, 2024

Clarifies and puts the extent of parity under test.

Broken out from #30546 based on #30546 (comment) and #30546 (comment).

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 19, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30933.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK l0rinc, maflcko, ryanofsky

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #31375 (multiprocess: Add bitcoin wrapper executable by ryanofsky)
  • #31061 (refactor: Check translatable format strings at compile-time by maflcko)
  • #29418 (rpc: provide per message stats for global traffic via new RPC "getnetmsgstats" by vasild)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot added the Tests label Sep 19, 2024
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from fe2ca49 to 99db776 Compare September 19, 2024 22:24
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/30403435103

Hints

Make sure to run all tests locally, according to the documentation.

The failure may happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
test/lint/run-lint-format-strings.py Outdated Show resolved Hide resolved
@hodlinator hodlinator marked this pull request as draft September 20, 2024 10:05
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch 2 times, most recently from 2955b1a to dbbc2e5 Compare September 20, 2024 11:11
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
decltype(fmt)::Detail_CheckNumFormatSpecifiers(fmt.fmt);

// Prove parity with tinyformat
switch (NumArgs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the idea of testing the validator together with the implementation!

But I"m not in love with the current approach.

Why are we testing PassFmt<1>("d"); with foo - I don"t think it helps with understanding how formatter works.

Also PassFmt<1>("%s") made sense when we were only validating the number of args, but we"ve extended it since, I think we should extend examples with the actual parameters, e.g.

  • PassFmt("%s", "test");
  • PassFmt("d", 42);
  • PassFmt("$s %2$s %1$s", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");

In which case each example would document the format that we"re exercising more specifically.

It would also obviate the parameter count by examples, would all be runtime (seems to me that would simplify a lot) and comparison would simply depend on the behavior of tfm::format, e.g. validation would be something like:

template <typename... Args>
inline bool ValidateFmt(const char* fmt, const char* expected_error, const Args&... args)
{
    try {
        tfm::format(fmt, args...);
        ConstevalFormatString<sizeof...(Args)>::Detail_CheckNumFormatSpecifiers(fmt);
        return true;
    } catch (const tfm::format_error&) {
        using ErrType = const char*;
        auto check_throw = [expected_error](const ErrType& str) { return str == expected_error; };
        BOOST_CHECK_EXCEPTION(ConstevalFormatString<sizeof...(Args)>::Detail_CheckNumFormatSpecifiers(fmt), ErrType, check_throw);
        return false;
    }
}

template <typename... Args>
void PassFmt(const char* fmt, const Args&... args) { BOOST_CHECK(ValidateFmt(fmt, nullptr, args...)); }

template <typename... Args>
void FailFmt(const char* fmt, const char* expected_error, const Args&... args) { BOOST_CHECK(!ValidateFmt(fmt, expected_error, args...)); }

and usage would be something like

    PassFmt("%%");
    PassFmt("%s", "test");

    auto err_num{"Format specifier count must match the argument count!"};
    FailFmt("%s", err_num);
    FailFmt("%s", err_num, "test", "extra");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like parts of your direction here, and have taken the time to try it out in 2fb2e72. My aim is to retain the tests of leaving out one arg though (which your suggestion doesn"t include). I"m not enough of a variadic template arg magician to figure out how to skip the last argument, which forces me to still lean on maflcko"s tuple_cat approach, leaving it feeling somewhat half-baked.

Copy link
Contributor

Choose a reason for hiding this comment

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

My aim is to retain the tests of leaving out one arg though (which your suggestion doesn"t include)

I didn"t include it since I though a single instance of those is enough in the tests.

I would prefer having concrete typed examples over retesting -1 and +1 args (for which explicit examples should likely suffice)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, seems fine to drop the Args-1, because tinyformat doesn"t have to throw on invalid stuff anyway (it does not for many other "invalid" things). Seems fine to just test the happy case.

Copy link
Contributor Author

@hodlinator hodlinator Dec 3, 2024

Choose a reason for hiding this comment

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

I prefer retaining negative tests to increase certainty and would rather not do the PassFmt<1>("%s") -> PassFmt("%s", "test") refactor in this PR if that"s okay with you.

Edit: I double-checked that tinyformat errors on both too many and too few conversion/format specifiers, and agree the negative case isn"t necessary - removed in latest push.

@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch 2 times, most recently from 071342d to a911efc Compare September 24, 2024 20:16
@hodlinator
Copy link
Contributor Author

(Just added co-authorship of maflcko in latest push from 071342d -> a911efc).

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
@maflcko
Copy link
Member

maflcko commented Oct 2, 2024

Are you still working on this?

I am asking now, because there shouldn"t be any conflicts after rebase, I think.

@hodlinator
Copy link
Contributor Author

hodlinator commented Oct 2, 2024

@maflcko

Are you still working on this?

I"m waiting on #30928 #31174 before un-drafting this.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK a911efc. I didn"t dig into previous discussion and it seems possible another approach to extending the tests might have advantages over this one. But the code change looks good and seems like an easy way of leveraging existing test cases to check for compatibility with tinyformat.

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from a911efc to cac3f9c Compare December 3, 2024 23:11
Copy link
Contributor Author

@hodlinator hodlinator left a comment

Choose a reason for hiding this comment

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

So, I was a bit late reacting to the merge of #31174, but here we are - rebased and ready for review again.

Added a commit regarding non-parity of "%n" as suggested in #31174 (comment).

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
Copy link
Contributor Author

@hodlinator hodlinator left a comment

Choose a reason for hiding this comment

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

Latest push:

  • Adds using util::detail::CheckNumFormatSpecifiers;, decreasing noise in the rest of the changes.
  • Adds BOOST_CHECK_NO_THROW to both CheckNumFormatSpecifiers and tinyformat calls in PassFmt.
  • Makes comments more descriptive/useful.
  • Adds context to commit message of the last commit.

Also updated PR summary:
"Makes unequivocally clear the extent of parity." -> "Clarifies and puts the extent of parity under test."

@@ -11,18 +11,30 @@ using namespace util;

BOOST_AUTO_TEST_SUITE(util_string_tests)

template <unsigned NumArgs>
std::string TfmFormatZeroes(const char* fmt)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have not fuzzed tinyformat but that seems like a good guess.

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

nothing blocking, just a nit.

re-ACK 2951532 💼

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: re-ACK 2951532a2ca09ac8ebdea066fa20826fdb6fa8e5 💼
LJt7P3harWblu2dLt4t2t8Z3yPelpL/kKq/KB7AoO45V3vTgMr8HXd6YbZiCCx5Y3BTDTIlVohJmss9B0+l9DA==

Comment on lines 141 to 142
// Ensure that tinyformat will throws if format string contains wrong number
// of specifiers. PassFmt relies on this to verify tinyformat successfully
// formats the strings, and will need to be updated if tinyformat is changed
// not to throw on failure.
Copy link
Member

@maflcko maflcko Dec 6, 2024

Choose a reason for hiding this comment

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

nit in 920782a: possible typo. Also could remove the note that the test may need to be updated if the underlying tested module is changed (This should be obvious). Even more so, given that tinyformat likely won"t be changed before its removal with C++26.

Suggested change
// Ensure that tinyformat will throws if format string contains wrong number
// of specifiers. PassFmt relies on this to verify tinyformat successfully
// formats the strings, and will need to be updated if tinyformat is changed
// not to throw on failure.
// Ensure that tinyformat throws if format string contains wrong number
// of specifiers. PassFmt relies on this to verify tinyformat successfully
// formats the strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

re: #30933 (comment)

Good catch on the typo, and suggestion is ok, but disagree with:

Also could remove the note that the test may need to be updated if the underlying tested module is changed (This should be obvious). Even more so, given that tinyformat likely won"t be changed before its removal with C++26.

I agree it should not be necessary to say that changes to tinyformat could break assumptions made by a tinyformat_tests.cpp test file, but it doesn"t seem obvious that a change to tinyformat would break assumptions made by util_string_tests.cpp tests. And there is an open PR which could break this in #30928 commit 49f7307, so it"s not just a theoretical concern. Fine to change this, but I think it"s better if the comment clearly explains why this check is here.

@DrahtBot DrahtBot requested a review from ryanofsky December 6, 2024 14:14
src/test/util_string_tests.cpp Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
// formats the strings, and will need to be updated if tinyformat is changed
// not to throw on failure.
BOOST_CHECK_EXCEPTION(TfmFormatZeroes<2>("%s"), tfm::format_error,
HasReason{"tinyformat: Not enough conversion specifiers in format string"});
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: don"t feel strongly about it, just noting that HasReason can do partial matches, we can also check something shorter like:

Suggested change
HasReason{"tinyformat: Not enough conversion specifiers in format string"});
HasReason{"Not enough conversion specifiers"});

(which would enable this being a one-liner)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, it"s a trade-off, holding off on changing this.

src/test/util_string_tests.cpp Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
@@ -15,6 +15,8 @@
FALSE_POSITIVES = [
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION)"),
("src/test/translation_tests.cpp", "strprintf(format, arg)"),
("src/test/util_string_tests.cpp", 'tfm::format(std::string{"%*s"}, "hi", "hi")'),
Copy link
Contributor

Choose a reason for hiding this comment

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

What"s the added value for extending this linter as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was getting CI failures, so added these exceptions. I considered extending the linter implementation to handle them correctly, but part of the raison d"étre of ConstevalFormatString is getting further towards being able to remove the linter in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah like these new ones you mean?

[20:48:24.756] src/test/util_string_tests.cpp: Expected 0 argument(s) after format string but found 1 argument(s): tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi")
[20:48:24.756] src/test/util_string_tests.cpp: Expected 0 argument(s) after format string but found 1 argument(s): tfm::format(ConstevalFormatString<2>{"%.*s"}, "hi", "hi")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly :D

Fixed in latest push.

@maflcko I realize you were concerned about touching this linter in #30933 (comment), do you have an alternate approach suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

@maflcko I realize you were concerned about touching this linter in #30933 (comment), do you have an alternate approach suggestion?

The file should just be deleted. I went ahead and did that in #31061 (comment)

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 2951532 just adding using declaration and improving comments since last reviewe

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
Comment on lines 141 to 142
// Ensure that tinyformat will throws if format string contains wrong number
// of specifiers. PassFmt relies on this to verify tinyformat successfully
// formats the strings, and will need to be updated if tinyformat is changed
// not to throw on failure.
Copy link
Contributor

Choose a reason for hiding this comment

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

re: #30933 (comment)

Good catch on the typo, and suggestion is ok, but disagree with:

Also could remove the note that the test may need to be updated if the underlying tested module is changed (This should be obvious). Even more so, given that tinyformat likely won"t be changed before its removal with C++26.

I agree it should not be necessary to say that changes to tinyformat could break assumptions made by a tinyformat_tests.cpp test file, but it doesn"t seem obvious that a change to tinyformat would break assumptions made by util_string_tests.cpp tests. And there is an open PR which could break this in #30928 commit 49f7307, so it"s not just a theoretical concern. Fine to change this, but I think it"s better if the comment clearly explains why this check is here.

@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from 2951532 to 8ee0140 Compare December 6, 2024 15:15
@l0rinc
Copy link
Contributor

l0rinc commented Dec 6, 2024

ACK 8ee0140

@DrahtBot DrahtBot requested review from ryanofsky and maflcko December 6, 2024 15:41
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from 8ee0140 to b07cb44 Compare December 6, 2024 20:44
hodlinator and others added 2 commits December 6, 2024 21:45
Also adds BOOST_CHECK_NO_THROW() while touching that line, clarifying part of what we are checking for.

Also removed redundant inline from template functions in .cpp file.
Co-Authored-By: Lőrinc <[email protected]>
Co-Authored-By: MarcoFalke <*~=`"#}+{/-|&$^[email protected]>
Co-Authored-By: Ryan Ofsky <[email protected]>
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from b07cb44 to d155ccc Compare December 6, 2024 20:46
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 6, 2024

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/34054153748

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

hodlinator and others added 2 commits December 6, 2024 21:56
- For "%n", which is supposed to write to the argument for printf.
- For string/integer mismatches of width/precision specifiers.

Co-Authored-By: Ryan Ofsky <[email protected]>
Proves tinyformat doesn"t trigger an exception for \0 characters.

Co-Authored-By: Lőrinc <[email protected]>
@hodlinator hodlinator force-pushed the 2024/09/tinyformat_consteval_parity branch from d155ccc to c93bf0e Compare December 6, 2024 20:56
Copy link
Contributor Author

@hodlinator hodlinator left a comment

Choose a reason for hiding this comment

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

Had to re-push after fully grokking #30933 (comment).

src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
src/test/util_string_tests.cpp Outdated Show resolved Hide resolved
@@ -15,6 +15,8 @@
FALSE_POSITIVES = [
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS), COPYRIGHT_HOLDERS_SUBSTITUTION)"),
("src/test/translation_tests.cpp", "strprintf(format, arg)"),
("src/test/util_string_tests.cpp", 'tfm::format(std::string{"%*s"}, "hi", "hi")'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly :D

Fixed in latest push.

@maflcko I realize you were concerned about touching this linter in #30933 (comment), do you have an alternate approach suggestion?

Copy link
Contributor

@l0rinc l0rinc left a comment

Choose a reason for hiding this comment

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

ACK c93bf0e
Changes:

  • Unified templates
  • Adjusted non-parity of tfm::format of ConstevalFormatString

Would be curious if we could extend this to fuzzing as well - but it can be explored in a different PR as well

// tinyformat throws but ConstevalFormatString does not.
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%n"}, 0), tfm::format_error,
HasReason{"tinyformat: %n conversion spec not supported"});
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi"), tfm::format_error,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: personally I"m not a fan of "funny" variable names - can we do "X" or "abc" or "text" or something instead? Not a blocker, just a preference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Might go with something like this (slightly useful) if I re-touch:

Suggested change
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi"), tfm::format_error,
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*s"}, "one", "two"), tfm::format_error,


// Non-parity between tinyformat and ConstevalFormatString.
// tinyformat throws but ConstevalFormatString does not.
BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%n"}, 0), tfm::format_error,
Copy link
Contributor

Choose a reason for hiding this comment

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

these are basically TODOs for follow-up PRs, right?
Can we add ConstevalFormatString parity check for the FUZZ tests as well (guess that should reveal other cases where it"s misaligned)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess a version of ConstevalFormatString/CheckNumFormatSpecifiers() could be checked in a test together with tfm::format, but I"m not sure it would be a fuzz-test, as tfm::format() takes args specified at compile time.

It could conceivably be a pretty advanced fuzz-test that generated C++ code and compiled it as part of the test, not sure if we have that class of tests already or if this would be new, and if it would be accepted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not validate it during runtime via CheckNumFormatSpecifiers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CheckNumFormatSpecifiers is currently a template, but sure, could be changed to take the number of specifiers at runtime instead.

If we want to check parity in a fuzzing context we should probably check tfm::format() as well, with the same input?

Copy link
Member

Choose a reason for hiding this comment

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

It could conceivably be a pretty advanced fuzz-test that generated C++ code and compiled it as part of the test, not sure if we have that class of tests already or if this would be new, and if it would be accepted.

I don"t think you need to generate C++ code and compile it. It should be possible to just write it directly. See:

#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <util/translation.h>

#include <algorithm>
#include <cstdint>
#include <string>
#include <vector>

template <unsigned NumArgs>
void Check(const std::string& fmt)
{
    try {
        util::detail::CheckNumFormatSpecifiers<NumArgs>(fmt.c_str());
        try {
            std::apply([&](auto... args) { tfm::format(tfm::RuntimeFormat{fmt}, args...); }, std::array<int, NumArgs>{});
        } catch (const std::exception& e) {
            std::string_view what{e.what()};
            if (what == "tinyformat: %n conversion spec not supported") return;
            std::cout << "mismatch: " << what << std::endl;
            std::cout << """ << fmt << """ << std::endl;
            assert(false);
        }
    } catch (...) {
        // fine
    }
}

FUZZ_TARGET(str_printf)
{
    FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
    const std::string format_string = fuzzed_data_provider.ConsumeRandomLengthString(64);

    const int digits_in_format_specifier = std::count_if(format_string.begin(), format_string.end(), IsDigit);

    // Avoid triggering the following crash bug:
    // * strprintf("�7654321000000:", 1);
    //
    // Avoid triggering the following OOM bug:
    // * strprintf("%.222222200000000$", 1.1);
    //
    // Upstream bug report: https://github.com/c42f/tinyformat/issues/70
    if (format_string.find("%") != std::string::npos && digits_in_format_specifier >= 7) {
        return;
    }

    // Avoid triggering the following crash bug:
    // * strprintf("%1$*1$*", -11111111);
    //
    // Upstream bug report: https://github.com/c42f/tinyformat/issues/70
    if (format_string.find("%") != std::string::npos && format_string.find("$") != std::string::npos && format_string.find("*") != std::string::npos && digits_in_format_specifier > 0) {
        return;
    }

    // Avoid triggering the following crash bug:
    // * strprintf("%.1s", (char*)nullptr);
    //
    // (void)strprintf(format_string, (char*)nullptr);
    //
    // Upstream bug report: https://github.com/c42f/tinyformat/issues/70

    Check<0>(format_string);
    Check<1>(format_string);
    Check<2>(format_string);
    Check<3>(format_string);
    Check<4>(format_string);
    Check<5>(format_string);
}

Copy link
Member

@maflcko maflcko Dec 11, 2024

Choose a reason for hiding this comment

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

For clarity, running the fuzz test will actually spit out some ways to trick the consteval check, because it doesn"t fully implement tinyformat at compile time. For example, the consteval check doesn"t ignore c99 length modifiers.

diff --git a/src/test/util_string_tests.cpp b/src/test/util_string_tests.cpp
index 340c650fe3..2284e775c6 100644
--- a/src/test/util_string_tests.cpp
+++ b/src/test/util_string_tests.cpp
@@ -129,6 +129,16 @@ BOOST_AUTO_TEST_CASE(ConstevalFormatString_NumSpec)
 
     // Non-parity between tinyformat and ConstevalFormatString.
     // tinyformat throws but ConstevalFormatString does not.
+    BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%h"}, 0), tfm::format_error,
+                          HasReason{"tinyformat: Conversion spec incorrectly terminated by end of string"});
+    BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%7#%o"}, 0), tfm::format_error,
+                          HasReason{"tinyformat: Too many conversion specifiers in format string"});
+    BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*9%*"}, 0, 0), tfm::format_error,
+                          HasReason{"tinyformat: Not enough arguments to read variable width or precision"});
+    BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%7#%8$"}, 0), tfm::format_error,
+                          HasReason{"tinyformat: Positional argument out of range"});
+    BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%6#%1$%%"}, 0), tfm::format_error,
+                          HasReason{"tinyformat: Non-positional argument used after a positional one"});
     BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<1>{"%n"}, 0), tfm::format_error,
         HasReason{"tinyformat: %n conversion spec not supported"});
     BOOST_CHECK_EXCEPTION(tfm::format(ConstevalFormatString<2>{"%*s"}, "hi", "hi"), tfm::format_error,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn"t think to lock-down the number of args in that way and still get value from fuzzing. Turned out great!

Are you going to open a PR for this or what do you suggest as next step?

Copy link
Member

Choose a reason for hiding this comment

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

I just left a comment for context and clarity, but I won"t be working on this myself. If someone wants to work on this, it is up-for-grabs.

src/test/util_string_tests.cpp Show resolved Hide resolved
@DrahtBot DrahtBot removed the CI failed label Dec 6, 2024
@maflcko
Copy link
Member

maflcko commented Dec 7, 2024

re-ACK c93bf0e 🗜

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: re-ACK c93bf0e6e2cd0e9dc979ed996e41cc1034bc1ad1 🗜
2bT04GVn2EBycqrMStGo3ZV6cz0SmTdEN2rHArqcWSDe5w8c/2B7Zg6UJUSGT5QzDPVgUPspDPW773Kb5GMiAg==

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK c93bf0e. Just a few cleanups tweaking function declarations and commit comments and consolidating some test cases since last review.

@ryanofsky ryanofsky merged commit 6769368 into bitcoin:master Dec 11, 2024
18 checks passed
@hodlinator hodlinator deleted the 2024/09/tinyformat_consteval_parity branch December 11, 2024 11:16
TheCharlatan added a commit to TheCharlatan/rust-bitcoinkernel that referenced this pull request Jan 17, 2025
…38671edce58

538671edce58 kernel: Add pure kernel bitcoin-chainstate
0f79e00c5b3e kernel: Add functions to get the block hash from a block
6f7a47f53b10 kernel: Add block index utility functions to C header
5af7950c744b kernel: Add function to read block undo data from disk to C header
b456fb6c0b34 kernel: Add functions to read block from disk to C header
b6c157fee16d kernel: Add function for copying  block data to C header
011cd3f59677 kernel: Add functions for the block validation state to C header
9532bfb81739 kernel: Add validation interface to C header
8dde5a04ebc8 kernel: Add interrupt function to C header
729d2d393972 kernel: Add import blocks function to C header
dfa7109e8f0a kernel: Add chainstate load options for in-memory dbs in C header
d012fe0147fc kernel: Add options for reindexing in C header
6d12d7868c17 kernel: Add block validation to C header
8ad7b67c6527 Kernel: Add chainstate loading to kernel C header
5d09bf543704 kernel: Add chainstate manager option for setting worker threads
9cea88cb6077 kernel: Add chainstate manager object to C header
c74f2c8a2340 kernel: Add notifications context option to C header
b90b7e07b803 kerenl: Add chain params context option to C header
438f55f06500 kernel: Add kernel library context object
870c37278035 kernel: Add logging to kernel library C header
7aed64b54dba kernel: Introduce initial kernel C header API
f9032a4abb74 Merge bitcoin/bitcoin#31242: wallet, desc spkm: Return SigningProvider only if we have the privkey
9dc4eedb670b Merge bitcoin/bitcoin#31673: doc: fix minor typos in comments
b30cc71e853c doc: fix typos
df8bf657450d Merge bitcoin/bitcoin#31483: kernel: Move kernel-related cache constants to kernel cache
335798c49637 Merge bitcoin/bitcoin#31397: p2p: track and use all potential peers for orphan resolution
98939ce7b744 Merge bitcoin/bitcoin#31655: refactor: Avoid UB in SHA3_256::Write
712cab3a8f8a Merge bitcoin/bitcoin#31061: refactor: Check translatable format strings at compile-time
2a92702bafca init: Use size_t consistently for cache sizes
65cde3621dbb kernel: Move default cache constants to caches
8826cae28549 kernel: Move non-kernel db cache size constants
e758b26b85da kernel: Move kernel-specific cache size options to kernel
d5e2c4a4097c fuzz: Add fuzz test for checked and saturating add and left shift
c03a2795a8e0 util: Add integer left shift helpers
fa3efb572909 refactor: Introduce struct to hold a runtime format string
fa6adb013440 lint: Remove unused and broken format string linter
fadc6b9bac82 refactor: Check translatable format strings at compile-time
fa1d5acb8d8e refactor: Use TranslateFn type consistently
e7c479495509 Merge bitcoin/bitcoin#31630: doc: Archive 28.1 release notes
7cd862aab94f Merge bitcoin/bitcoin#31646: test: avoid internet traffic
eeee6cf2ffb2 refactor: Delay translation of _() literals
fabeca3458b3 refactor: Avoid UB in SHA3_256::Write
fad4032b219e refactor: Drop unused UCharCast
2ed161c5ce64 test: avoid generating non-loopback traffic from p2p_dns_seeds.py
a5746dc559c2 test: avoid generating non-loopback traffic from feature_config_args.py
6b3f6eae70bb test: avoid generating non-loopback traffic from p2p_seednode.py
bb5f76ee013e doc: Archive 28.1 release notes
35bf426e0221 Merge bitcoin/bitcoin#28724: wallet: Cleanup accidental encryption keys in watchonly wallets
216840659780 Merge bitcoin/bitcoin#31608: doc: Clarify min macOS and Xcode version
2f6c7e7f6c05 Merge bitcoin/bitcoin#31612: ci: build msan"s libc++ with _LIBCPP_ABI_BOUNDED_*
528354e213a9 Merge bitcoin/bitcoin#31616: init,log: Unify block index log line
4bedfb5c8338 Merge bitcoin/bitcoin#31623: tracing: Rename the `MIN` macro to `_TRACEPOINT_TEST_MIN` in log_raw_p2p_msgs
e5c268084ebb Merge bitcoin/bitcoin#31627: depends: Fix spacing issue
d695d1391718 Merge bitcoin/bitcoin#31611: doc: upgrade license to 2025.
37af8bfb34d6 Merge bitcoin/bitcoin#31549: fuzz: Abort if system time is called without mock time being set
54115d8de5c0 Merge bitcoin/bitcoin#31617: build, test: Build `db_tests.cpp` regardless of `USE_BDB`
0a77441158cd Merge bitcoin/bitcoin#31451: wallet: migration, avoid loading legacy wallet after failure when BDB isn"t compiled
56725f882937 Merge bitcoin/bitcoin#31462: test: raise explicit error if any of the needed release binaries is missing
8a46286da667 depends: Fix spacing issue
e04be3731f49 init,log: Unify block index and chainstate loading log line
8bd5f8a38ce9 [refactor] init: Simplify coinsdb cache calculation
f93f0c93961b tracing: Rename the `MIN` macro to `_TRACEPOINT_TEST_MIN` in log_raw_p2p_msgs
66aa6a47bd8e Merge bitcoin/bitcoin#30391: BlockAssembler: return selected packages virtual size and fee
7c123c08ddce  miner: add package feerate vector to CBlockTemplate
fd2d96d9087b build, test: Build `db_tests.cpp` regardless of `USE_BDB`
fb37acd932b0 ci: build msan"s libc++ with _LIBCPP_ABI_BOUNDED_*
1ea7e45a1f44 test: raise explicit error if any of the needed release binaries is missing
433412fd8478 Merge bitcoin/bitcoin#31596: doc: Clarify comments about endianness after #30526
c506f2cee7b8 Merge bitcoin/bitcoin#31581: test: have miner_tests use  Mining interface
a96b84cb1b76 fuzz: Abort when calling system time without setting mock time
ff21870e20b2 fuzz: Add SetMockTime() to necessary targets
41a2ce9b7d73 Merge bitcoin/bitcoin#31464: util: Add missing types in make_secure_unique
86d7135e36ef [p2p] only attempt 1p1c when both txns provided by the same peer
f7658d9b1475 [cleanup] remove p2p_inv from AddTxAnnouncement
063c1324c143 [functional test] getorphantxs reflects multiple announcers
0da693f7e129 [functional test] orphan handling with multiple announcers
b6ea4a9afe2d [p2p] try multiple peers for orphan resolution
1d2e1d709ce3 [refactor] move creation of unique_parents to helper function
c6893b0f0b7b [txdownload] remove unique_parents that we already have
163aaf285af9 [fuzz] orphanage multiple announcer functions
22b023b09da3 [unit test] multiple orphan announcers
96c1a822a274 [unit test] TxOrphanage EraseForBlock
04448ce32a3b [txorphanage] add GetTx so that orphan vin can be read
e810842acda6 [txorphanage] support multiple announcers
62a9ff187076 [refactor] change type of unique_parents to Txid
6951ddcefd9e [txrequest] GetCandidatePeers
6475849c4020 Merge bitcoin/bitcoin#31435: lint: Move assertion linter into lint runner
b537a2c02a99 doc: upgrade license to 2025.
49fc2258cf39 Merge bitcoin/bitcoin#31526: doc: Install `net/py-pyzmq` port on FreeBSD for `interface_zmq.py`
ac918c7cc0e9 Merge bitcoin/bitcoin#31552: depends: Update capnproto to 1.1.0
fa029a78780f doc: Clarify min macOS and Xcode version
a0f0c48ae20e Merge bitcoin/bitcoin#31584: txmempool: fix typos in comments
558783625ca7 Merge bitcoin/bitcoin#31586: doc: Update NetBSD Build Guide
3e936789b167 Merge bitcoin/bitcoin#31592: ci: Run functional tests in msan task
5af642bf48bb Merge bitcoin/bitcoin#31604: test: fix typo in mempool_ephemeral_dust
29bca9713d21 test: fix typo in mempool_ephemeral_dust
4036ee3f2bf5 Merge bitcoin/bitcoin#31542: test: Embed univalue json tests in binary
f6a6d912059c test: add check for getting SigningProvider for a CPubKey
62a95f5af9b9 test: refactor: move `CreateDescriptor` helper to wallet test util module
5db7d4d3d28b doc: Correct docstring describing max block tree db cache
6aa0e70ccbd5 Merge bitcoin/bitcoin#31524: refactor: Allow std::byte in Read(LE/BE)
3e0a992a3f0f doc: Clarify comments about endianness after #30526
604bf2ea37f8 Merge bitcoin/bitcoin#28121: include verbose "reject-details" field in testmempoolaccept response
04249682e381 test: use Mining interface in miner_tests
fa0411ee305f ci: Run functional tests in msan task
2bdaf52ed125 doc: Update NetBSD Build Guide
34e8ee23b83e txmempool: fix typos in comments
228aba2c4d9a Merge bitcoin/bitcoin#31555: descriptor: remove unreachable verification for `pkh`
9b9752217f2d Merge bitcoin/bitcoin#31570: test: descriptor: fix test for `MaxSatisfactionWeight`
87c9ebd88920 Merge bitcoin/bitcoin#31563: rpc: Extend scope of validation mutex in generateblock
df5c643f92d4 Merge bitcoin/bitcoin#31556: validation: Send correct notification during snapshot completion
fa3de038f744 Merge bitcoin/bitcoin#31537: qa: Limit `-maxconnections` in tests
ba0cb7d5a54f Merge bitcoin/bitcoin#31468: test: Avoid intermittent error in assert_equal(pruneheight_new, 248)
69e35f5c60ad Merge bitcoin/bitcoin#31403: test: Call generate RPCs through test framework only
17db84dbb8db Merge bitcoin/bitcoin#31251: test: report detailed msg during utf8 response decoding error
e6f14241f6d3 Merge bitcoin/bitcoin#31540: refactor: std::span compat fixes
a137b0bd6b21 Merge bitcoin/bitcoin#31215: rpc: increase the defaults for -rpcthreads and -rpcworkqueue
67bfe28995eb Merge bitcoin/bitcoin#31531: rpc: Add signet_challenge field to getblockchaininfo and getmininginfo
ad174c281758 Merge bitcoin/bitcoin#31497: Remove unused variable assignment
b29d68f942e3 test: descriptor: fix test for `MaxSatisfactionWeight`
9355578a7797 Merge bitcoin/bitcoin#31534: coins: warn on shutdown for big UTXO set flushes
f95fb793726b Merge bitcoin/bitcoin#28521: net, net_processing: additional and consistent disconnect logging
bc43ecaf6dc0 test: add functional test for balance after snapshot completion
226d03dd610d validation: Send correct notification during snapshot completion
fa63b8232f38 test: generateblocks called by multiple threads
fa62c8b1f04a rpc: Extend scope of validation mutex in generateblock
366ae00b779a descriptor: Assume `ParseScript` is not being called with a P2WPKH context
e36640859089 descriptor: remove unreachable verification for `pkh`
5709718b8301 coins: warn on shutdown for big UTXO set flushes
b0b8d96d93ea depends: Update capnproto to 1.1.0
fc7b21484703 Merge bitcoin/bitcoin#31529: guix: latest 2.31 glibc
273440d5c9dc Merge bitcoin/bitcoin#31535: doc: Install `py3-zmq` port on OpenBSD for `interface_zmq.py`
4cdf50c4ba81 Merge bitcoin/bitcoin#31544: cmake: Remove unused `BUILD_TESTING` variable from "dev-mode" preset
faf7eac364fb test: clang-format -i src/univalue/test/unitester.cpp
fafa9cc7a599 test: Embed univalue json tests in binary
fa044857caf7 test: Re-enable univalue test fail18.json
63b6b638aa5e build: Use character literals for generated headers to avoid narrowing
ecaa786cc103 rpc: add signet_challenge field to getblockchaininfo and getmininginfo
e196190a284f cmake: Remove unused `BUILD_TESTING` variable from "dev-mode" preset
bb57017b2945 Merge bitcoin/bitcoin#31521: fuzz: Fix misplaced SeedRand::ZEROS
5bbbc0d0eeb8 Merge bitcoin/bitcoin#31325: Make m_tip_block std::optional
d9d5bc2e7466 qa: Limit `-maxconnections` in tests
fa494a1d53f3 refactor: Specify const in std::span constructor, where needed
faaf4800aa75 Allow std::span in stream serialization
faa5391f7703 refactor: test: Return std::span from StringBytes
fa8622347535 refactor: Avoid passing span iterators when data pointers are expected
faae6fa5f614 refactor: Simplify SpanPopBack
facc4f120b06 refactor: Replace fwd-decl with proper include
fac3a782eaf3 refactor: Avoid needless, unsafe c-style cast
c1252b14d714 Merge bitcoin/bitcoin#31520: #31318 followups
be1a2e5dfbdf doc: Install `py3-zmq` port on OpenBSD for `interface_zmq.py`
fa0c473d4c82 Merge bitcoin/bitcoin#31196: Prune mining interface
ea53568a0685 Merge bitcoin/bitcoin#31393: refactor: Move GuessVerificationProgress into ChainstateManager
b8710201fbd0 guix: disable timezone tools & profiling in glibc
23b8a424fb06 guix: bump glibc 2.31 to 7b27c450c34563a28e634cccb399cd415e71ebfe
0a76c292ac8f doc: Install `net/py-pyzmq` port on FreeBSD for `interface_zmq.py`
fadd568931a2 fuzz: Fix misplaced SeedRand::ZEROS
fa83bec78ef3 refactor: Allow std::byte in Read(LE/BE)
4f06ae05ed6f refactor: fix typo in node/types.h
366fbf152c6c test: drop extraneous bracket in mining util
c991cea1a0c3 Remove processNewBlock() from mining interface
9a47852d88cf Remove getTransactionsUpdated() from mining interface
bfc4e029d41e Remove testBlockValidity() from mining interface
477b35746074 Merge bitcoin/bitcoin#31493: refactor: Use immediate lambda to work around GCC bug 117966
a60d5702fd5c Merge bitcoin/bitcoin#31486: fuzz: Abort when using global PRNG without re-seed
a95a8ba3a3f4 Merge bitcoin/bitcoin#31197: refactor: mining interface 30955 followups
cd3d9fa5ea87 Merge bitcoin/bitcoin#31318: Drop script_pub_key arg from createNewBlock
785486a97558 Merge bitcoin/bitcoin#31489: fuzz: Fix test_runner error reporting
1251a2364202 Merge bitcoin/bitcoin#31458: build: use `-mbig-obj` for Windows debug builds
d2136d32bb47 Merge bitcoin/bitcoin#31502: depends: Fix `CXXFLAGS` on NetBSD
58436d4af381 Merge bitcoin/bitcoin#31503: cmake: Link `bitcoin_consensus` as a library
38dcf0f98271 Merge bitcoin/bitcoin#31498: depends: Ignore prefix directory on OpenBSD
fae63bf13033 fuzz: Clarify that only SeedRandomStateForTest(SeedRand::ZEROS) is allowed
81cea5d4ee0e Ensure m_tip_block is never ZERO
e058544d0e83 Make m_tip_block an std::optional
f86678156a3d Check leaves size maximum in MerkleComputation
4d572882463b refactor: use CTransactionRef in submitSolution
2e81791d9072 Drop TransactionMerklePath default position arg
39d3b538e6a2 Rename merkle branch to path
fa18acb457e9 fuzz: Abort when using global PRNG without re-seed
fa9e0489f579 refactor: Use immediate lambda to work around GCC bug 117966
46e207d3296c cmake: Link `bitcoin_consensus` as a library
a10bb400e8cb depends: Fix CXXFLAGS on NetBSD
3353d4a5e9fc depends: Ignore prefix directory on OpenBSD
b9766c9977e5 Remove unused variable assignment
b042c4f0538c Merge bitcoin/bitcoin#31223: net, init: derive default onion port if a user specified a -port
e8f0e6efaf55 lint: output-only - Avoid repeated arrows, trim
facb4d010ca5 refactor: Move GuessVerificationProgress into ChainstateManager
2b9ff4a66d31 build: use `-mbig-obj` for mingw-w64 Debug builds
fa0e30b93aad fuzz: Fix test_runner error reporting
d73f37dda221 Merge bitcoin/bitcoin#31346: Set notifications m_tip_block in LoadChainTip()
fa7809aeab83 fuzz: Add missing SeedRandomStateForTest(SeedRand::ZEROS)
78f1bff7099b Merge bitcoin/bitcoin#31477: ci: Bump centos gcc to 12
84890e0291f0 Merge bitcoin/bitcoin#31484: depends: update capnproto to 1.0.2
d5ab5a47f0e6 Merge bitcoin/bitcoin#31452: wallet: Migrate non-HD keys to combo() descriptor
fa0998f0a028 test: Avoid intermittent error in assert_equal(pruneheight_new, 248)
fa9aacf614f6 lint: Move assertion linter into lint runner
beac62e541c8 Merge bitcoin/bitcoin#31480: refactor: Fix "modernize-use-starts-ends-with" clang-tidy warning
5cd9e95eea12 depends: update capnproto to 1.0.2
df27ee9f024f refactor: Fix "modernize-use-starts-ends-with" clang-tidy warning
435ad572a1af Merge bitcoin/bitcoin#31479: lint: Disable signature output in git log
ea9e64ff3cb0 Merge bitcoin/bitcoin#31461: depends: add `-g` to *BSD_debug flags
29ddee1796a6 Merge bitcoin/bitcoin#31478: docs: remove repetitive words
e2d3372e558d lint: Disable signature output in git log
fa47baa03bcf ci: Bump centos gcc
015aad8d6a69 docs: remove repetitive words
589ed1a8eafe wallet: migration, avoid loading wallet after failure when it wasn"t loaded before
62bd61de110b Merge bitcoin/bitcoin#31450: guix: disable gcov in base-linux-gcc
676936845b1f Merge bitcoin/bitcoin#30933: test: Prove+document ConstevalFormatString/tinyformat parity
8ad2c9027420 Merge bitcoin/bitcoin#31343: test: avoid internet traffic in rpc_net.py
a582ee681c74 Merge bitcoin/bitcoin#29982: test: Fix intermittent issue in wallet_backwards_compatibility.py
fa397177acfa util: Add missing types in make_secure_unique
b6f0593f4330 doc: add release note about testmempoolaccept debug-message
f9cac6352371 test: cover testmempoolaccept debug-message in RBF test
b7ec69c25cf3 depends: add -g to *BSD_debug flags
37e49c2c7ca5 Merge bitcoin/bitcoin#31448: fuzz: add cstdlib to FuzzedDataProvider
62b2d23edbad wallet: Migrate non-HD keys to combo() descriptor
9039d8f1a1df Merge bitcoin/bitcoin#31374: wallet: fix crash during watch-only wallet migration
bb7e686341e4 fuzz: add cstdlib to FuzzedDataProvider
f6496a838828 guix: disable gcov in base-linux-gcc
35000e34cf33 Merge bitcoin/bitcoin#31433: test: #31212 follow up (spelling, refactor)
18d0cfb194cc Merge bitcoin/bitcoin#31306: ci: Update Clang in "tidy" job
c93bf0e6e2cd test: Add missing %c character test
76cca4aa6fcd test: Document non-parity between tinyformat and ConstevalFormatstring
533013cba206 test: Prove+document ConstevalFormatString/tinyformat parity
b81a4659950a refactor test: Profit from using namespace + using detail function
cdd207c0e480 test: add coverage for migrating standalone imported keys
297a876c9809 test: add coverage for migrating watch-only script
932cd1e92b6d wallet: fix crash during watch-only wallet migration
41d934c72df6 chore: Typo Overriden -> Overridden
c9fb38a590e3 refactor test: Cleaner combine_logs.py logic
22723c809a8a Merge bitcoin/bitcoin#31072: refactor: Clean up messy strformat and bilingual_str usages
b1f0f3c288af Merge bitcoin/bitcoin#31406: test: fix `test_invalid_tx_in_compactblock` in `p2p_compactblocks`
1a35447595d5 Merge bitcoin/bitcoin#31417: test: Avoid F541 (f-string without any placeholders)
eb2ebe6f30ac Merge bitcoin/bitcoin#31231: cmake: Fix `IF_CHECK_PASSED` option handling
5b283fa1477d Merge bitcoin/bitcoin#31431: util: use explicit cast in MultiIntBitSet::Fill()
37946c0aafee Set notifications m_tip_block in LoadChainTip()
fa6e599cf9fb test: Call generate through test framework only
2eccb8bc5e22 Merge bitcoin/bitcoin#31248: test: Rework wallet_migration.py to use previous releases
7239ddb7cec3 test: make sure node has all transactions
6d973f86f755 Merge bitcoin/bitcoin#31408: test: Avoid logging error when logging error
6a1e613e853d Merge bitcoin/bitcoin#31427: lint: bump MLC to v0.19.0
edb41e4814cc util: use explicit cast in MultiIntBitSet::Fill()
31e59d94c67b iwyu: Drop backported mapping
fe9bc5abef3d ci: Update Clang in "tidy" job
083770adbe7d Merge bitcoin/bitcoin#31414: test: orphan parent is re-requested from 2nd peer
f6afca46a1d7 lint: use clearer wording on error message
811a65d3c6b3 lint: bump MLC to v0.19.0
fae76393bdbf test: Avoid F541 (f-string without any placeholders)
e8cc790fe2a2 Merge bitcoin/bitcoin#30445: test: addrman: tried 3 times and never a success so `isTerrible=true`
f9650e18ea6e rbf: remove unecessary newline at end of error string
221c789e9169 rpc: include verbose reject-details field in testmempoolaccept response
0184d33b3d28 scripted-diff: Replace strprintf(Untranslated) with Untranslated(strprintf)
17372d788e6c Merge bitcoin/bitcoin#30906: refactor: prohibit direct flags access in CCoinsCacheEntry and remove invalid tests
006e4d1d5984 refactor: Use + instead of strformat to concatenate translated & untranslated strings
831d2bfcf941 refactor: Don"t embed translated string in untranslated string.
058021969b54 refactor: Avoid concatenation of format strings
11f68cc81084 Merge bitcoin/bitcoin#31212: util: Improve documentation and negation of args
893ccea7e47d Merge bitcoin/bitcoin#31419: test: fix MIN macro redefinition
39950e148d80 Merge bitcoin/bitcoin#31295: refactor: Prepare compile-time check of bilingual format strings
00c1dbd26ddb test: fix MIN macro-redefinition
ae69fc37e4ff Merge bitcoin/bitcoin#31391: util: Drop boost posix_time in ParseISO8601DateTime
52fd1511a774 test: drop scriptPubKeyIn arg from CreateNewBlock
ff41b9e296ab Drop script_pub_key arg from createNewBlock
7ab733ede444 rpc: rename coinbase_script to coinbase_output_script
0f84cdd26614 func: test orphan parent is re-requested from 2nd peer
95a0104f2e98 test: Add tests for directories in place of config files
e85abe92c7cc args: Catch directories in place of config files
e4b6b1822ce0 test: Add tests for -noconf
483f0dacc413 args: Properly support -noconf
312ec64cc061 test refactor: feature_config_args.py - Stop nodes at the end of tests, not at the beginning
7402658bc2b9 test: -norpccookiefile
39cbd4f37c3d args: Support -norpccookiefile for bitcoind and bitcoin-cli
e82ad88452bc logs: Use correct path and more appropriate macros in cookie-related code
6e28c76907ca test: Harden testing of cookie file existence
75bacabb55f3 test: combine_logs.py - Output debug.log paths on error
cccca8a77f3c test: Avoid logging error when logging error
ee1b9bef000b test: replace `is not` to `!=` when comparing block hash
faf70cc9941c Remove wallet::ParseISO8601DateTime, use ParseISO8601DateTime instead
50cce20013c9 test, refactor: Compact ccoins_access and ccoins_spend
0a159f091477 test, refactor: Remove remaining unbounded flags from coins_tests
c0b4b2c1eef9 test: Validate error messages on fail
d5f8d607ab1f test: Group values and states in tests into CoinEntry wrappers
ca74aa7490a5 test, refactor: Migrate GetCoinsMapEntry to return MaybeCoin
15aaa81c3818 coins, refactor: Remove direct GetFlags access
6b733699cfc7 coins, refactor: Assume state after SetClean in AddFlags to prevent dangling pointers
fc8c282022e6 coins, refactor: Make AddFlags, SetDirty, SetFresh static
cd0498eabc91 coins, refactor: Split up AddFlags to remove invalid states
2222aecd5f80 util: Implement ParseISO8601DateTime based on C++20
06443b8f28bc net: clarify if we ever sent or received from peer
1d01ad4d73e0 net: add LogIP() helper, use in net_processing
937ef9eb408e net_processing: use CNode::DisconnectMsg helper
ad224429f823 net: additional disconnection logging
988721d37a3c test: avoid internet traffic in rpc_net.py
bffd92f00f5b args: Support -nopid
12f8d848fd91 args: Disallow -nodatadir
6ff966276009 scripted-diff: Avoid printing version information for -noversion
1807df3d9fb0 test: addrman: tried 3 times and never a success so `isTerrible=true`
55347a5018b2 test: Rework migratewallet to use previous release (v28.0)
e8a2054edc81 doc args: Document narrow scope of -color
1dd3af8fbc35 Add release note for #31223
997757dd2b4d test: add functional test for -port behavior
fa3e07430478 refactor: Tidy fixups
fa72646f2b19 move-only: Detail_CheckNumFormatSpecifiers and G_TRANSLATION_FUN
faff8403f0aa refactor: Pick translated string after format
0e2b12b92a28 net, init: derive default onion port if a user specified a -port
f42ec0f3bfbe wallet: Check specified wallet exists before migration
a2c45ae5480a test: report failure during utf8 response decoding
493656763f73 desc spkm: Return SigningProvider only if we have the privkey
97a18c85458b cmake: Fix `IF_CHECK_PASSED` option handling
e56fc7ce6a92 rpc: increase the defaults for -rpcthreads and -rpcworkqueue
69e95c2b4f99 tests: Test cleanup of mkeys from wallets without privkeys
2b9279b50a36 wallet: Remove unused encryption keys from watchonly wallets
813a16a46332 wallet: Add HasCryptedKeys
ec777917d6eb test: Fix intermittent issue in wallet_backwards_compatibility.py
REVERT: f157b0cbc7d9 kernel: Add pure kernel bitcoin-chainstate
REVERT: 692d1c23c272 kernel: Add functions to get the block hash from a block
REVERT: aad02fb561ae kernel: Add block index utility functions to C header
REVERT: 13f4911b0646 kernel: Add function to read block undo data from disk to C header
REVERT: 29fdbf260348 kernel: Add functions to read block from disk to C header
REVERT: 2ca304c1def7 kernel: Add function for copying  block data to C header
REVERT: 705c7f125fd9 kernel: Add functions for the block validation state to C header
REVERT: 92363c9469c0 kernel: Add validation interface to C header
REVERT: 7c539908113b kernel: Add interrupt function to C header
REVERT: 522d0886d8ff kernel: Add import blocks function to C header
REVERT: 1ae86e2ffe12 kernel: Add chainstate load options for in-memory dbs in C header
REVERT: 09620eeeae6c kernel: Add options for reindexing in C header
REVERT: b4fbf1931725 kernel: Add block validation to C header
REVERT: ce6ddde95eee Kernel: Add chainstate loading to kernel C header
REVERT: f5d21c94dc5a kernel: Add chainstate manager option for setting worker threads
REVERT: 783f56f0a290 kernel: Add chainstate manager object to C header
REVERT: 262039e4094c kernel: Add notifications context option to C header
REVERT: dc0d406dd5e9 kerenl: Add chain params context option to C header
REVERT: b5f84de7ad2d kernel: Add kernel library context object
REVERT: dad0009c86c1 kernel: Add logging to kernel library C header
REVERT: 27e25aa941c6 kernel: Introduce initial kernel C header API

git-subtree-dir: libbitcoinkernel-sys/bitcoin
git-subtree-split: 538671edce5813a62405b9bd5c50c39263c58435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants