-
Notifications
You must be signed in to change notification settings - Fork 37.7k
fuzz: add mempool_utils.cpp #26250
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
fuzz: add mempool_utils.cpp #26250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
src/Makefile.test_fuzz.include
Outdated
@@ -17,5 +17,6 @@ libtest_fuzz_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) | |||
libtest_fuzz_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) | |||
libtest_fuzz_a_SOURCES = \ | |||
test/fuzz/fuzz.cpp \ | |||
test/fuzz/mempool_utils.cpp \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can nest more folders. Maybe src/test/fuzz/util/mempool.cpp
to differentiate utils from tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some nesting.
src/test/fuzz/mempool_utils.cpp
Outdated
// policy/feerate.cpp:28:34: runtime error: signed integer overflow: 34873208148477500 * 1000 cannot be represented in type 'long' | ||
// | ||
// Reproduce using CFeeRate(348732081484775, 10).GetFeePerK() | ||
const CAmount fee = std::min<CAmount>(ConsumeMoney(fuzzed_data_provider), std::numeric_limits<CAmount>::max() / static_cast<CAmount>(100000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated:
const CAmount fee = std::min<CAmount>(ConsumeMoney(fuzzed_data_provider), std::numeric_limits<CAmount>::max() / static_cast<CAmount>(100000)); | |
const CAmount fee{ConsumeMoney(fuzzed_data_provider, /*max=*/std::numeric_limits<CAmount>::max() / CAmount{100'000})}; |
It should be possible to just pass the max. (Can do in a separate commit, if you want)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added another commit for this.
53366df
to
6703800
Compare
Moving the mempool code (Boost) out of util.h, results in a ~10% speedup (for me) when compiling the fuzz tests.
6703800
to
8a6b6df
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review ACK 8a6b6df 🍮
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK 8a6b6dfcd8d26b62c3a13beba72440635fcc5e19 🍮
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgJuAv+MyuzOk4R07Q6iwAbpfd78pnXvv/5J2YAj5mpWWifj9ZAJL72sYk/K1I8
5K4ukFrthMelgGVV7Hkz7KcSEQu/rRpjHRRILFuYsnxGwhVYi4RCH0w+s4jrotBc
onA2qBJaft8ULZtZg1wDS+Lkl8VLQ9bwkYmUkZgJf9vaUQwMYFlO70QkqidubjcR
+lslpo9UkFD4uH8q9YLClPvGWWxpjB/6x8/CKDEVt7Yfu1cQypX6kmgrG4T2Kmgi
6FrJDAM0ECts/di/V1TLhRsGdQrSMhDxx0UawygzgaLTBc38ezG7sE17ram+ems+
cpE+mDhWu56QWG6hCrpIyRH2pkDcjymAwIjfEug9EromErGocKKpY1nK5BVaqNbl
KKhrNnZ4x+DBhvgBxCiGzfGFP2oGgDAKPY4Ke22LjdpdC1szqBcLMdWVyPCKrJBc
VzypwHcwe8rGkqZaVmGzIGB7PSEfJCEhvscA31Z7vFBsuHqTiz/OROgV+J4+/qPr
fQ8WY0tK
=GxLp
-----END PGP SIGNATURE-----
|
||
#include <primitives/transaction.h> | ||
#include <test/fuzz/FuzzedDataProvider.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those two includes could be fwd-decls, but it doesn't matter because everywhere where this header is included, the full includes already exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post-merge concept ACK
Moving the heavy (Boost) mempool code out of fuzz/util.h. Means that (for ex) a crypto_common fuzz unit doesn't need to care about seeing endless Boost headers. This results in a ~10% speedup (for me) when compiling the fuzz tests. Your results may vary.