aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/addrman.cpp
AgeCommit message (Collapse)Author
2022-07-26refactor: Use type-safe std::chrono for addrman timeMarcoFalke
2022-07-26scripted-diff: Rename addrman time symbolsMarcoFalke
-BEGIN VERIFY SCRIPT- ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); } ren nLastTry m_last_try ren nLastSuccess m_last_success ren nLastGood m_last_good ren nLastCountAttempt m_last_count_attempt ren nSinceLastTry since_last_try ren nTimePenalty time_penalty ren nUpdateInterval update_interval ren fCurrentlyOnline currently_online -END VERIFY SCRIPT-
2022-04-20[net] Move asmap into NetGroupManagerJohn Newbery
2022-02-21test: Fix Wambiguous-reversed-operator compiler warningsMarcoFalke
2022-01-11fuzz: addrman fuzz tests: override-able check ratioVasil Dimov
Make it possible to override from the command line (without recompiling) the addrman check ratio in addrman fuzz tests instead of hardcoding it to 0: ``` FUZZ=addrman ./src/test/fuzz/fuzz --checkaddrman=5 ```
2021-11-19scripted-diff: Use clang-tidy syntax for C++ named argumentsMarcoFalke
-BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's:((\(|\{|,)(\n| )*)\/\* ?([^=* ]+) ?\*\/ ?:\1/*\4=*/:g' $( git ls-files ./src/test ./src/wallet/test ) -END VERIFY SCRIPT-
2021-11-12fuzz: replace every fuzzer-controlled loop with a LIMITED_WHILE loopAndrew Poelstra
Blindly chose a cap of 10000 iterations for every loop, except for the two in script_ops.cpp and scriptnum_ops.cpp which appeared to (sometimes) be deserializing individual bytes; capped those to one million to ensure that sometimes we try working with massive scripts. There was also one fuzzer-controlled loop in timedata.cpp which was already capped, so I left that alone. git grep 'while (fuzz' should now run clean except for timedata.cpp
2021-10-22Make AddrMan support multiple ports per IPPieter Wuille
2021-10-05[fuzz] Update comment in FillAddrman()John Newbery
Suggested here: https://github.com/bitcoin/bitcoin/pull/22974#discussion_r711119626
2021-10-05[fuzz] Make Fill() a free function in fuzz/addrman.cppJohn Newbery
Also rename it to FillAddrman and pass an addrman reference as an argument. Change FillAddrman to only use addrman's public interface methods.
2021-10-05[fuzz] Make RandAddr() a free function in fuzz/addrman.cppJohn Newbery
It doesn't require access to CAddrManDeterministic
2021-10-05[fuzz] Pass FuzzedDataProvider& into Fill() in addrman fuzz testsJohn Newbery
Use a (reference) parameter instead of a data member of CAddrManDeterministic. This will allow us to make Fill() a free function in a later commit. Also remove CAddrManDeterministic.m_fuzzed_data_provider since it's no longer used.
2021-10-05[fuzz] Create a FastRandomContext in addrman fuzz testsJohn Newbery
Don't reach inside the object-under-test to use its random context.
2021-09-28scripted-diff: Rename CAddrInfo to AddrInfoAmiti Uttarwar
-BEGIN VERIFY SCRIPT- git grep -l CAddrInfo src/ | xargs sed -i 's/CAddrInfo/AddrInfo/g' -END VERIFY SCRIPT-
2021-09-28scripted-diff: Rename CAddrMan to AddrManAmiti Uttarwar
-BEGIN VERIFY SCRIPT- git grep -l CAddrMan src/ test/ | xargs sed -i 's/CAddrMan/AddrMan/g' -END VERIFY SCRIPT-
2021-09-28[addrman] Introduce CAddrMan::Impl to encapsulate addrman implementation.Amiti Uttarwar
Introduce the pimpl pattern for CAddrMan to separate the implementation details from the externally used object representation. This reduces compile-time dependencies and conceptually clarifies AddrMan's interface from the implementation specifics. Since the unit & fuzz tests currently rely on accessing CAddrMan internals, this commit introduces addrman_impl.h, which is exclusively imported by addrman.cpp and test files. Review hint: git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2021-09-21fuzz: Move all addrman fuzz targets to one fileMarcoFalke
Can be reviewed with --color-moved=dimmed-zebra
2021-09-16fuzz: allow lower number of sourcesMartin Zumsande
2021-09-16fuzz: Use public interface to fill addrman tried tablesMartin Zumsande
After the performance improvement for Good(), the direct method is only 2x faster as opposed to 60x before.
2021-09-07[asmap] Remove SanityCheckASMap() from netaddressJohn Newbery
SanityCheckASMap(asmap, bits) simply calls through to SanityCheckASMap(asmap) in util/asmap. Update all callers to simply call that function.
2021-08-27[fuzz] Add ConsumeAsmap() functionJohn Newbery
2021-08-27[addrman] Set m_asmap in CAddrMan initializer listJohn Newbery
This allows us to make it const.
2021-08-19[addrman] Remove all public uses of CAddrMan.Clear() from the testsJohn Newbery
Just use unique_ptr<CAddrMan>s and reset the pointer if a frest addrman is required. Also make CAddrMan::Clear() private to ensure that no call sites are missed.
2021-08-15[addrman] Merge the two Add() functionsAmiti Uttarwar
Merge the two definitions of this overloaded function to reduce code duplication.
2021-08-12[addrman] Make addrman consistency checks a runtime optionJohn Newbery
Currently addrman consistency checks are a compile time option, and are not enabled in our CI. It's unlikely anyone is running these consistency checks. Make them a runtime option instead, where users can enable addrman consistency checks every n operations (similar to mempool tests). Update the addrman unit tests to do internal consistency checks every 100 operations (checking on every operations causes the test runtime to increase by several seconds). Also assert on a failed addrman consistency check to terminate program execution.
2021-08-05[addrman] Add deterministic argument to CAddrMan ctorJohn Newbery
Removes the need for tests to update nKey and insecure_rand after constructing a CAddrMan.
2021-08-04fuzz: check that ser+unser produces the same AddrManVasil Dimov
2021-08-02fuzz: move init code to the CAddrManDeterministic constructorVasil Dimov
Move the addrman init code from the test case to a newly added `CAddrManDeterministic` constructor. This way it can be reused by other tests.
2021-08-02Merge bitcoin/bitcoin#21940: refactor: Mark CAddrMan::Select and GetAddr constMarcoFalke
fae108ceb53f61d7338ba205873623ede3c1d3be Fix incorrect whitespace in addrman (MarcoFalke) fa32024d51c098441623e246f304a80f011e29d1 Add missing GUARDED_BY to CAddrMan::insecure_rand (MarcoFalke) fab755b77f88873f01cbd988051de7ad3f0150de fuzz: Actually use const addrman (MarcoFalke) fae0c79351ce34186249d44af0c5c9c7521f4b6c refactor: Mark CAddrMan::GetAddr const (MarcoFalke) fa02934c8c9d290ea4d12683e8680c70967a4d3a refactor: Mark CAddrMan::Select const (MarcoFalke) Pull request description: To clarify that a call to this only changes the random state and nothing else. ACKs for top commit: jnewbery: Code review ACK fae108ceb53f61d7338ba205873623ede3c1d3be theStack: re-ACK fae108ceb53f61d7338ba205873623ede3c1d3be 🍦 Tree-SHA512: 3ffb211d4715cc3daeb3bfcdb3fcc6b108ca96df5fa565510436fac0e8da86c93b30c9c4aad0563e27d84f615fcd729481072009a4e2360c8b3d40787ab6506a
2021-07-23Add missing GUARDED_BY to CAddrMan::insecure_randMarcoFalke
2021-07-22Merge bitcoin/bitcoin#22493: fuzz: Extend addrman fuzz test with deserializeMarcoFalke
aaaa9c6019790a1a21a7b4ef01693ac9390ae6d0 fuzz: Extend addrman fuzz test with deserialize (MarcoFalke) Pull request description: Requested on IRC: ``` [18:01] <vasild> => I think there is a good chance fuzzing addrman unserialize will find more bugs [18:04] <sipa> definitely ACKs for top commit: jonatack: ACK aaaa9c6019790a1a21a7b4ef01693ac9390ae6d0 per `git diff fa74025 aaaa9c6` vasild: ACK aaaa9c6019790a1a21a7b4ef01693ac9390ae6d0 Tree-SHA512: f57d0aecf22a933e48d3181d7398218949588dd0de31218d1d28c825649e55fd60b0de6fbc92d2497cf5639a4adc2061c9bf8216546a2be916feac4f03f16e8f
2021-07-21fuzz: Actually use const addrmanMarcoFalke
2021-07-20[addrman] Remove unused test_before_evict argument from Good()John Newbery
This has never been used in the public interface method since it was introduced in #9037.
2021-07-19fuzz: Extend addrman fuzz test with deserializeMarcoFalke
2021-06-14Make CAddrMan::Check privateHennadii Stepanov
Change in the addrman.h header is move-only.
2021-06-13fuzz: Call const member functions in addrman fuzz test only onceMarcoFalke
2021-05-19p2p: allow CAddrMan::GetAddr() by network, add doxygenJon Atack
2021-03-20fuzz: Use ConsumeWeakEnum in addrman for service flagsMarcoFalke
2021-02-22scripted-diff: Rename MakeFuzzingContext to MakeNoLogFileContextMarcoFalke
-BEGIN VERIFY SCRIPT- # Rename sed -i -e 's/MakeFuzzingContext/MakeNoLogFileContext/g' $(git grep -l MakeFuzzingContext) # Bump the copyright of touched files in this scripted diff to avoid touching them again later ./contrib/devtools/copyright_header.py update ./src/test/fuzz/ -END VERIFY SCRIPT-
2021-01-11fuzz: Introduce CallOneOf helper to replace switch-caseMarcoFalke
Can be reviewed with --ignore-all-space
2020-12-10fuzz: Link all targets onceMarcoFalke
2020-11-19fuzz: Make addrman fuzzing harness deterministicpracticalswift
2020-11-12tests: Add fuzzing harness for CAddrManpracticalswift