aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz
AgeCommit message (Collapse)Author
2021-05-19Merge bitcoin/bitcoin#21659: net: flag relevant Sock methods with [[nodiscard]]W. J. van der Laan
e286cd0d7b4e12c8efe5e7ac3066a100e0ba2c0a net: flag relevant Sock methods with [[nodiscard]] (Vasil Dimov) Pull request description: Flag relevant Sock methods with `[[nodiscard]]` to avoid issues like the one fixed in https://github.com/bitcoin/bitcoin/pull/21631. ACKs for top commit: practicalswift: cr ACK e286cd0d7b4e12c8efe5e7ac3066a100e0ba2c0a: the only changes made are additions of `[[nodiscard]]` and `(void)` where appropriate laanwj: Code review ACK e286cd0d7b4e12c8efe5e7ac3066a100e0ba2c0a Tree-SHA512: addc361968d24912bb625b42f4db557791556bf0ffad818252a89a32d76ac22758ec70f8282dcfbfd77eebec20a8e6bb7557c8ed08d50a58de95378c34955973
2021-05-19Merge bitcoin/bitcoin#21506: p2p, refactor: make NetPermissionFlags an enum ↵W. J. van der Laan
class 7075f604e8d0b21b2255fa57e20cd365dc10a288 scripted-diff: update noban documentation in net_processing.cpp (Jon Atack) a95540cf435029f06e56749802d71315ca76b0dd scripted-diff: rename NetPermissionFlags enumerators (Jon Atack) 810d0929c1626bba141af3f779a3c9cd6ece7e75 p2p, refactor: make NetPermissionFlags a uint32 enum class (Jon Atack) 7b55a9449778c5ac89799ce4c607c8c8d797ddfb p2p: NetPermissions::HasFlag() pass flags param by value (Jon Atack) 91f6e6e6d1720e1154ad3f70a5098e9028efa84a scripted-diff: add NetPermissionFlags scopes where not already present (Jon Atack) Pull request description: While reviewing #20196, I noticed the `NetPermissionFlags` enums are frequently called as if they were scoped, yet are still global. This patch upgrades `NetPermissionFlags` to a scoped class enum and updates the enumerator naming, similarly to #19771. See https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#enum-enumerations for more info. This change would eliminate the class of bugs like https://github.com/bitcoin/bitcoin/pull/20196#discussion_r610770148 and #21644, as only defined operations on the flags would compile. ACKs for top commit: laanwj: Code review ACK 7075f604e8d0b21b2255fa57e20cd365dc10a288 vasild: ACK 7075f604e8d0b21b2255fa57e20cd365dc10a288 Tree-SHA512: 7fcea66ee499f059efc78c934b5f729b3c8573fe304dee2c27c837c2f662b89324790568246d75b2a574cf9f059b42d3551d928996862f4358055eb43521e6f4
2021-05-14Merge bitcoin/bitcoin#21929: fuzz: Remove incorrect float round-trip ↵W. J. van der Laan
serialization test fae814c9a6c8ce4822f1fc6b88cfbbde7cc2d49c fuzz: Remove incorrect float round-trip serialization test (MarcoFalke) Pull request description: It tests the wrong way of the round-trip: `int -> float -> int`, but only `float -> int -> float` is allowed and used. See also `src/test/fuzz/float.cpp`. Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34118 ACKs for top commit: laanwj: Anyhow, ACK fae814c9a6c8ce4822f1fc6b88cfbbde7cc2d49c Tree-SHA512: 8412a7985be2225109f382b7c7ea6d6fcfbea15711671fdf2f41dd1a9adbb3b4489592863751d78bedaff98e9b0b13571d9cae06ffd92db8fbf7ce0f47874a41
2021-05-12scripted-diff: rename NetPermissionFlags enumeratorsJon Atack
- drop redundant PF_ permission flags prefixes - drop ALL_CAPS naming per https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps - rename IsImplicit to Implicit -BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s 'PF_NONE' 'None' s 'PF_BLOOMFILTER' 'BloomFilter' s 'PF_RELAY' 'Relay' s 'PF_FORCERELAY' 'ForceRelay' s 'PF_DOWNLOAD' 'Download' s 'PF_NOBAN' 'NoBan' s 'PF_MEMPOOL' 'Mempool' s 'PF_ADDR' 'Addr' s 'PF_ISIMPLICIT' 'Implicit' s 'PF_ALL' 'All' -END VERIFY SCRIPT-
2021-05-12fuzz: Remove incorrect float round-trip serialization testMarcoFalke
2021-05-12fuzz: Run const CScript member functions only onceMarcoFalke
2021-05-11fuzz: Avoid timeout in EncodeBase58MarcoFalke
2021-05-11Merge bitcoin/bitcoin#21892: fuzz: Avoid excessively large min fee rate in ↵MarcoFalke
tx_pool 99993f066405863c66ccaec0a8427129f4515768 fuzz: Avoid excessively large min fee rate in tx_pool (MarcoFalke) Pull request description: Any fee rate above 1 BTC / kvB is clearly nonsense, so no need to fuzz this. Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34078 ACKs for top commit: practicalswift: cr ACK 99993f066405863c66ccaec0a8427129f4515768: patch looks correct despite no `fa` prefix in commit hash Tree-SHA512: bd3651d354b13d889ad1708d2b385ad0479de036de74a237346eefad5dbfb1df76ec02b55ec00487ec598657ef6102f992302b14c4e47f913a9962f81f4157e6
2021-05-11Merge bitcoin/bitcoin#21909: fuzz: Limit max insertions in timedata fuzz testMarcoFalke
fa95555a491dc01952703f476836e607ac34eab4 fuzz: Limit max insertions in timedata fuzz test (MarcoFalke) Pull request description: It is debatable whether a size of the median filter other than `200` (the only size used in production) should be fuzzed. For now add a minimal patch to cap the max insertions. Otherwise the complexity is N^2 log(N), where N is the size of the fuzz input. Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34167 ACKs for top commit: practicalswift: cr ACK fa95555a491dc01952703f476836e607ac34eab4: patch looks correct Tree-SHA512: be7737e9f4c906053e355641de84dde31fed37ed6be4c5e92e602ca7675dffdaf06b7063b9235ef541b05d3d5fd689c99479317473bb15cb5271b8baabffd0f2
2021-05-11Merge bitcoin/bitcoin#21644: p2p, bugfix: use NetPermissions::HasFlag() in ↵W. J. van der Laan
CConnman::Bind() 36fb036d25e2a3016b36873456e5a9e6251ffef8 p2p: allow NetPermissions::ClearFlag() only with PF_ISIMPLICIT (Jon Atack) 4e0d5788ba5771c81bc0ff2e6523cf9accddae46 test: add net permissions noban/download unit test coverage (Jon Atack) dde69f20a01acca64ac21cb13993c6e4f8709f23 p2p, bugfix: use NetPermissions::HasFlag() in CConnman::Bind() (Jon Atack) Pull request description: This is a bugfix follow-up to #16248 and #19191 that was noticed in #21506. Both v0.21 and master are affected. Since #19191, noban is a multi-flag that implies download, so the conditional in `CConnman::Bind()` using a bitwise AND on noban will return the same result for both the noban status and the download status. This means that download peers are incorrectly not being added to local addresses because they are mistakenly seen as noban peers. The second commit adds unit test coverage to illustrate and test the noban/download relationship and the `NetPermissions` operations involving them. The final commit adds documentation and disallows calling `NetPermissions::ClearFlag()` with any second param other than `NetPermissionFlags` "implicit" -- per current usage in the codebase -- because `ClearFlag()` should not be called with any second param that is a subflag of a multiflag, e.g. "relay" or "download," as that would leave the result in an invalid state corresponding to none of the existing NetPermissionFlags. Thanks to Vasil Dimov for noticing this. ACKs for top commit: theStack: re-ACK 36fb036d25e2a3016b36873456e5a9e6251ffef8 ☕ vasild: ACK 36fb036d25e2a3016b36873456e5a9e6251ffef8 hebasto: ACK 36fb036d25e2a3016b36873456e5a9e6251ffef8, I have reviewed the code and it looks OK, I agree it can be merged. kallewoof: Code review ACK 36fb036d25e2a3016b36873456e5a9e6251ffef8 Tree-SHA512: 5fbc7ddbf31d06b35bf238f4d77ef311e6b6ef2e1bb9893f32f889c1a0f65774a3710dcb21d94317fe6166df9334a9f2d42630809e7fe8cbd797dd6f6fc49491
2021-05-11fuzz: Limit max insertions in timedata fuzz testMarcoFalke
2021-05-10Merge bitcoin/bitcoin#21891: fuzz: Remove strprintf test cases that are ↵W. J. van der Laan
known to fail facfc0f65dd0a7d54c0f6d56bff793e57b12ee12 fuzz: Remove strprintf test cases that are known to fail (MarcoFalke) Pull request description: They are still waiting to be fixed (see https://github.com/c42f/tinyformat/issues/70 ), so no need for us to carry them around in our source code. They can be added back once upstream is fixed. Hopefully fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34082 ACKs for top commit: laanwj: Code review ACK facfc0f65dd0a7d54c0f6d56bff793e57b12ee12 Tree-SHA512: d9d3d35555b6d58740a041ae45797ca85149f60990e2ed632c5dadf363e1d2362d2447681d7ceaa1fbffcd6e7bc8da5bc15d3923b68829a86c25b364a599afc8
2021-05-09fuzz: Avoid excessively large min fee rate in tx_poolMarcoFalke
2021-05-09fuzz: Remove strprintf test cases that are known to failMarcoFalke
2021-05-09fuzz: Limit ParseISO8601DateTime fuzzing to 32-bitMarcoFalke
2021-05-08fuzz: Remove unused --enable-danger-fuzz-link-all optionMarcoFalke
2021-05-07fuzz: Add WRITE_ALL_FUZZ_TARGETS_AND_ABORTMarcoFalke
2021-05-06Merge bitcoin/bitcoin#21798: fuzz: Create a block template in tx_pool targetsMarcoFalke
fa03d0acd6bd8bb6d3d5227512f042ff537ad993 fuzz: Create a block template in tx_pool targets (MarcoFalke) fa61ce5cf5c1d73d352173806571bcd7799ed2ee fuzz: Limit mocktime to MTP in tx_pool targets (MarcoFalke) fab646b8ea293bb2b03707c6ef6790982625e492 fuzz: Use correct variant of ConsumeRandomLengthString instead of hardcoding a maximum size (MarcoFalke) fae2c8bc54e6c0fe69a82bd1b232c52edd1acd34 fuzz: Allow to pass min/max to ConsumeTime (MarcoFalke) Pull request description: Relatively simple check to ensure a block can always be created from the mempool ACKs for top commit: practicalswift: Tested ACK fa03d0acd6bd8bb6d3d5227512f042ff537ad993 Tree-SHA512: e613376ccc88591cbe594db14ea21ebc9b2b191f6325b3aa4ee0cd379695352ad3b480e286134ef6ee30f043d486cf9792a1bc7e44445c41045ac8c3b931c7ff
2021-05-05fuzz: Create a block template in tx_pool targetsMarcoFalke
2021-05-05Merge bitcoin/bitcoin#21817: refactor: Replace &foo[0] with foo.data()MarcoFalke
fac30eec42c486ec1bfd696293040a7aa0f04625 refactor: Replace &foo[0] with foo.data() (MarcoFalke) faece47c4706783e0460ed977390a44630b2d44c refactor: Avoid &foo[0] on C-Style arrays (MarcoFalke) face9611093377e8502d91f2ff56f9319a56357c refactor: Use only one temporary buffer in CreateObfuscateKey (MarcoFalke) fa05dddc42770809fdae4d9c35155f8117960019 refactor: Use CPubKey vector constructor where possible (MarcoFalke) fabb6dfe6e734eadd91448122f2ce8c1612c39a6 script: Replace address-of idiom with vector data() method (Guido Vranken) Pull request description: The main theme of this refactor is to replace `&foo[0]` with `foo.data()`. The first commit is taken from #21781 with the rationale: * In CSignatureCache::ComputeEntryECDSA, change the way a vector pointer is resolved to prevent invoking undefined behavior if the vector is empty. The other commits aim to remove all `&foo[0]`, where `foo` is any kind of byte representation. The rationale: * Sometimes alternative code without any raw data pointers is easier to read (refer to the respective commit message for details) * If the raw data pointer is needed, `foo.data()` should be preferred, as pointed out in the developer notes. This addresses the instances that have been missed in commit 592404f03f2b734351d734f0c9ca1fdce997321b, and https://github.com/bitcoin/bitcoin/pull/9804 ACKs for top commit: laanwj: Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625 practicalswift: cr ACK fac30eec42c486ec1bfd696293040a7aa0f04625: patch looks correct promag: Code review ACK fac30eec42c486ec1bfd696293040a7aa0f04625. Tree-SHA512: e7e73146edbc78911a8e8c728b0a1c6b0ed9a88a008e650aa5dbffe72425bd42c76df70199a9cf7e02637448d7593e0eac52fd0f91f59240283e1390ee21bfa5
2021-05-04fuzz: Limit toxic test globals to their respective scopeMarcoFalke
2021-05-04refactor: Replace &foo[0] with foo.data()MarcoFalke
2021-05-03Merge bitcoin/bitcoin#21810: fuzz: Various RPC fuzzer follow-upsMarcoFalke
5252f86eb616a1112e427c268c8e8825f2a63d67 fuzz: Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of #ifdef forests (practicalswift) 54549dda310e2becee9cb4997d1408a90e91934f fuzz: RPC fuzzer post-merge follow-ups. Remove unused includes. Update list of fuzzed RPC commands. (practicalswift) Pull request description: Various RPC fuzzer follow-ups: * Remove unused includes. * Update list of fuzzed RPC commands. * Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of `#ifdef` forests. Context: https://github.com/bitcoin/bitcoin/pull/21169#pullrequestreview-646723483 ACKs for top commit: MarcoFalke: Concept ACK 5252f86eb616a1112e427c268c8e8825f2a63d67 Tree-SHA512: 286d70798131706ffb157758e1c73f7f00ed96ce120c7d9dc849e672b283f1362df47b206cfec9da44d5debb5869225e721761dcd5c38a7d5d1019dc6c912ab2
2021-04-30Merge bitcoin/bitcoin#19521: Coinstats IndexW. J. van der Laan
5f96d7d22d8e05876c6fc014e70488699950fe38 rpc: gettxoutsetinfo rejects hash_serialized_2 for specific height (Fabian Jahr) 23fe50436be641d7417152adc683192649ba206a test: Add test for coinstatsindex behavior in reorgs (Fabian Jahr) 90c966b0f3cfbd6bce5883f46d8527c6853a86a2 rpc: Allow gettxoutsetinfo and getblockstats for stale blocks (Fabian Jahr) b9362392aef2689bc106c20925859ede555d082b index, rpc: Add use_index option for gettxoutsetinfo (Fabian Jahr) bb7788b121a30489bc81a1f46dde6a9b19ae4ec1 test: Test coinstatsindex robustness across restarts (Fabian Jahr) e0938c29099635150014ffc9bb0cafa8049ec55a test: Add tests for block_info in gettxoutsetinfo (Fabian Jahr) 2501576eccb08af80471c7b7b843b189ad6758c0 rpc, index: Add verbose amounts tracking to Coinstats index (Fabian Jahr) 655d929836a71af23d2035d2e2e99ad8b8c340c3 test: add coinstatsindex getindexinfo coverage, improve current tests (Jon Atack) ca01bb8d689f93e1c7669b0ba7a4994c0206dabd rpc: Add Coinstats index to getindexinfo (Fabian Jahr) 57a026c30fef3138bb8db46e6865acb9dc2674f8 test: Add unit test for Coinstats index (Fabian Jahr) 6a4c0c09ab4d073a26c3c4a02783d5dcd88f6eef test: Add functional test for Coinstats index (Fabian Jahr) 3f166ecc125fce6ccd995687fa16572090a5d099 rpc: gettxoutsetinfo can be requested for specific blockheights (Fabian Jahr) 3c914d58ff323255b32e717d0ce28209ec0abdaa index: Coinstats index can be activated with command line flag (Fabian Jahr) dd58a4de21469d6d848ae309edc47f558628221d index: Add Coinstats index (Fabian Jahr) a8a46c4b3cfda4b95c92a36f8cebd3606377e57d refactor: Simplify ApplyStats and ApplyHash (Fabian Jahr) 9c8a265fd21a87228c18a1661df99fedc1866baf refactor: Pass hash_type to CoinsStats in stats object (Fabian Jahr) 2e2648a9021dfbb6e17dfa81472f057dacbc34e0 crypto: Make MuHash Remove method efficient (Fabian Jahr) Pull request description: This is part of the coinstats index project tracked in #18000 While the review of the new UTXO set hash algorithm (MuHash) takes longer recently #19328 was merged which added the possibility to run `gettxoutsetinfo` with a specific hash type. As the first type it added `hash_type=none` which skips the hashing of the UTXO set altogether. This alone did not make `gettxoutsetinfo` much faster but it allows the use of an index for the remaining coin statistics even before a new hashing algorithm has been added. Credit to Sjors for the idea to take this intermediate step. Features summary: - Users can start their node with the option `-coinstatsindex` which syncs the index in the background - After the index is synced the user can use `gettxoutsetinfo` with `hash_type=none` or `hash_type=muhash` and will get the response instantly out of the index - The user can specify a height or block hash when calling `gettxoutsetinfo` to see coin statistics at a specific block height ACKs for top commit: Sjors: re-tACK 5f96d7d22d8e05876c6fc014e70488699950fe38 jonatack: Code review re-ACK 5f96d7d22d8e05876c6fc014e70488699950fe38 per `git range-diff 13d27b4 07201d3 5f96d7d` promag: Tested ACK 5f96d7d22d8e05876c6fc014e70488699950fe38. Light code review ACK 5f96d7d22d8e05876c6fc014e70488699950fe38. Tree-SHA512: cbca78bee8e9605c19da4fbcd184625fb280200718396c694a56c7daab6f44ad23ca9fb5456d09f245d8b8d9659fdc2b3f3ce5e953c1c6cf4003dbc74c0463c2
2021-04-29fuzz: Reduce maintenance requirements by allowing RPC annotations also for ↵practicalswift
conditionally available RPC commands (such as wallet commands) without the fragility of #ifdef forests
2021-04-28Merge bitcoin/bitcoin#18847: compressor: use a prevector in CompressScript ↵MarcoFalke
serialization [ZAP1] 83a425d25af033086744c1c8c892015014ed46bd compressor: use a prevector in compressed script serialization (William Casarin) Pull request description: This function was doing millions of unnecessary heap allocations during IBD. I'm start to catalog unnecessary heap allocations as a pet project of mine: as-zero-as-possible-alloc IBD. This is one small step. before: ![May01-174536](https://user-images.githubusercontent.com/45598/80850964-9a38de80-8bd3-11ea-8eec-08cd38ee1fa1.png) after: ![May01-174610](https://user-images.githubusercontent.com/45598/80850974-a91f9100-8bd3-11ea-94a1-e2077391f6f4.png) ~should I type alias this?~ *I type aliased it* This is a part of the Zero Allocations Project #18849 (ZAP1). This code came up as a place where many allocations occur. ACKs for top commit: Empact: ACK https://github.com/bitcoin/bitcoin/pull/18847/commits/83a425d25af033086744c1c8c892015014ed46bd elichai: tACK 83a425d25af033086744c1c8c892015014ed46bd sipa: utACK 83a425d25af033086744c1c8c892015014ed46bd Tree-SHA512: f0ffa6ab0ea1632715b0b76362753f9f6935f05cdcc80d85566774401155a3c57ad45a687942a1806d3503858f0bb698da9243746c8e2edb8fdf13611235b0e0
2021-04-28fuzz: Limit mocktime to MTP in tx_pool targetsMarcoFalke
This is needed for the next commit to generate blocks. Also, apply the same mocking strategies to both targets.
2021-04-28fuzz: Use correct variant of ConsumeRandomLengthString instead of hardcoding ↵MarcoFalke
a maximum size This is technically a breaking change. This allows the fuzz engine to pick the right size, also larger sizes, if needed.
2021-04-28fuzz: Allow to pass min/max to ConsumeTimeMarcoFalke
2021-04-28fuzz: RPC fuzzer post-merge follow-ups. Remove unused includes. Update list ↵practicalswift
of fuzzed RPC commands.
2021-04-28Merge bitcoin/bitcoin#20772: fuzz: bolster ExtractDestination(s) checksMarcoFalke
a29f522ba4aa71582b54025c5682b4c1687ae9f3 fuzz: bolster ExtractDestination(s) checks (Michael Dietz) Pull request description: ACKs for top commit: practicalswift: Tested ACK a29f522ba4aa71582b54025c5682b4c1687ae9f3 Tree-SHA512: 0fc194edb7b0fce77c7bb725fe65dec7976598edcd53882b5a0eb7cd83281a3ddcd2b3de00282468be659a7e5bc9991eb482816418f55b30e657cdc5a3bd7438
2021-04-28Merge bitcoin/bitcoin#21169: fuzz: Add RPC interface fuzzing. Increase ↵MarcoFalke
fuzzing coverage from 65% to 70%. 545404e7e1c72985557ccffe865cea269143e5dd fuzz: Add RPC interface fuzzing. Increase fuzzing coverage from 65% to 70%. (practicalswift) Pull request description: Add RPC interface fuzzing. This PR increases overall fuzzing line coverage from [~65%](https://marcofalke.github.io/btc_cov/fuzz.coverage/) to ~70% 🎉 To test this PR: ``` $ make distclean $ ./autogen.sh $ CC=clang CXX=clang++ ./configure --enable-fuzz --with-sanitizers=address,fuzzer,undefined $ make -C src/ test/fuzz/fuzz $ FUZZ=rpc src/test/fuzz/fuzz ``` See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for more information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets). Happy fuzzing :) ACKs for top commit: MarcoFalke: Concept ACK 545404e7e1c72985557ccffe865cea269143e5dd Tree-SHA512: 35fc1b508af42bf480ee3762326b09ff2eecdb7960a1917ad16345fadd5c0c21d666dafe736176e5a848ff6492483c782e4ea914cd9000faf50190df051950fd
2021-04-28fuzz: Add RPC interface fuzzing. Increase fuzzing coverage from 65% to 70%.practicalswift
2021-04-25fuzz: Ensure prevout is consensus-validMarcoFalke
2021-04-25Merge bitcoin/bitcoin#21563: net: Restrict period when cs_vNodes mutex is lockedMarcoFalke
8c8237a4a10feb2ac9ce46f67b5d14bf879b670f net, refactor: Fix style in CConnman::StopNodes (Hennadii Stepanov) 229ac1892d807a1eea5a7c24ae0fe27dc913b1bd net: Combine two loops into one, and update comments (Hennadii Stepanov) a3d090d1103cd6c25daf07afdf4e65febca6d3f7 net: Restrict period when cs_vNodes mutex is locked (Hennadii Stepanov) Pull request description: This PR restricts the period when the `cs_vNodes` mutex is locked, prevents the only case when `cs_vNodes` could be locked before the `::cs_main`. This change makes the explicit locking of recursive mutexes in the explicit order redundant. ACKs for top commit: jnewbery: utACK 8c8237a4a10feb2ac9ce46f67b5d14bf879b670f vasild: ACK 8c8237a4a10feb2ac9ce46f67b5d14bf879b670f ajtowns: utACK 8c8237a4a10feb2ac9ce46f67b5d14bf879b670f - logic seems sound MarcoFalke: review ACK 8c8237a4a10feb2ac9ce46f67b5d14bf879b670f 👢 Tree-SHA512: a8277924339622b188b12d260a100adf5d82781634cf974320cf6007341f946a7ff40351137c2f5369aed0d318f38aac2d32965c9b619432440d722a4e78bb73
2021-04-22net: Restrict period when cs_vNodes mutex is lockedHennadii Stepanov
2021-04-19refactor: Pass hash_type to CoinsStats in stats objectFabian Jahr
2021-04-18p2p: allow NetPermissions::ClearFlag() only with PF_ISIMPLICITJon Atack
NetPermissions::ClearFlag() is currently only called in the codebase with an `f` value of NetPermissionFlags::PF_ISIMPLICIT. If that should change in the future, ClearFlag() should not be called with `f` being a subflag of a multiflag, e.g. NetPermissionFlags::PF_RELAY or NetPermissionFlags::PF_DOWNLOAD, as that would leave `flags` in an invalid state corresponding to none of the existing NetPermissionFlags. Therefore, allow only calling ClearFlag with the implicit flag for now. Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
2021-04-15fuzz: use ConsumeBool() instead of !ConsumeBool()Vasil Dimov
The former is shorter and ends up with a "random" bool anyway.
2021-04-15fuzz: split FuzzedSock interface and implementationVasil Dimov
Move the `FuzzedSock`'s implementation from `src/test/fuzz/util.h` to `src/test/fuzz/util.cpp`. A separate interface and implementation make the code more readable for consumers who don't need to (better not) know the implementation details.
2021-04-15fuzz: make FuzzedSock::Wait() sometimes simulate an occurred eventVasil Dimov
2021-04-15fuzz: set errno from FuzzedSock::Wait() if it simulates a failureVasil Dimov
2021-04-15style: remove extra white spaceVasil Dimov
2021-04-15Merge #21677: fuzz: Avoid use of low file descriptor ids (which may be in ↵MarcoFalke
use) in FuzzedSock 6262182b3f1c9540291fb8de3bf7a785e7113c55 Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and StaticContentsSock (practicalswift) Pull request description: Avoid use of low file descriptor ids (which may be in use) in `FuzzedSock`. Context: https://github.com/bitcoin/bitcoin/pull/21630/files#r610694541 ACKs for top commit: vasild: ACK 6262182b3f1c9540291fb8de3bf7a785e7113c55 Tree-SHA512: e622acb4d01446c3db01adbbbb779038be7247e13f3f4e72c614bc2880c3efd710fd3b189f87abb00f236fa5ddf91f4c215f420ca4eb08a97aaba31593254c3d
2021-04-15Merge #21377: Speedy trial support for versionbitsfanquake
ffe33dfbd4c3b11e3475b022b6c1dd077613de79 chainparams: drop versionbits threshold to 90% for mainnnet and signet (Anthony Towns) f054f6bcd2c2ce5fea84cf8681013f85a444e7ea versionbits: simplify state transitions (Anthony Towns) 55ac5f568a3b73d6f1ef4654617fb76e8bcbccdf versionbits: Add explicit NEVER_ACTIVE deployments (Anthony Towns) dd07e6da48040dc7eae46bc7941db48d98a669fd fuzz: test versionbits delayed activation (Anthony Towns) dd85d5411c1702c8ae259610fe55050ba212e21e tests: test versionbits delayed activation (Anthony Towns) 73d4a706393e6dbd6b6d6b6428f8d3233ac0a2d8 versionbits: Add support for delayed activation (Anthony Towns) 9e6b65f6fa205eee5c3b99343988adcb8d320460 tests: clean up versionbits test (Anthony Towns) 593274445004506c921d5d851361aefb3434d744 tests: test ComputeBlockVersion for all deployments (Anthony Towns) 63879f0a4760c0c0f784029849cb5d21ee088abb tests: pull ComputeBlockVersion test into its own function (Anthony Towns) Pull request description: BIP9-based implementation of "speedy trial" activation specification, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-March/018583.html Edge cases are tested by fuzzing added in #21380. ACKs for top commit: instagibbs: tACK https://github.com/bitcoin/bitcoin/pull/21377/commits/ffe33dfbd4c3b11e3475b022b6c1dd077613de79 jnewbery: utACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 MarcoFalke: review ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 💈 achow101: re-ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 gmaxwell: ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 benthecarman: ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 Sjors: ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 jonatack: Initial approach ACK ffe33dfbd4c3b11e3475b022b6c1dd077613de79 after a first pass of review, building and testing each commit, mostly looking at the changes and diffs. Will do a more high-level review iteration. A few minor comments follow to pick/choose/ignore. ariard: Code Review ACK ffe33df Tree-SHA512: f79a7146b2450057ee92155cbbbcec12cd64334236d9239c6bd7d31b32eec145a9781c320f178da7b44ababdb8808b84d9d22a40e0851e229ba6d224e3be747c
2021-04-14Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and ↵practicalswift
StaticContentsSock
2021-04-13net: flag relevant Sock methods with [[nodiscard]]Vasil Dimov
2021-04-13Merge #21330: Deal with missing data in signature hashes more consistentlyfanquake
725d7ae0494d4a45f5a840bbbd19c008a7363965 Use PrecomputedTransactionData in signet check (Pieter Wuille) 497718b467330b2c6bb0d44786020c55f1aa75f9 Treat amount<0 also as missing data for P2WPKH/P2WSH (Pieter Wuille) 3820090bd619ac85ab35eff376c03136fe4a9f04 Make all SignatureChecker explicit about missing data (Pieter Wuille) b77b0cc507bdc716e5236b1d9880e648147e0af9 Add MissingDataBehavior and make TransactionSignatureChecker handle it (Pieter Wuille) Pull request description: Currently we have 2 levels of potentially-missing data in the transaction signature hashes: * P2WPKH/P2WSH hashes need the spent amount * P2TR hashes need all spent outputs (amount + scriptPubKey) Missing amounts are treated as -1 (thus leading to unexpected signature failures), while missing outputs in P2TR validation cause assertion failure. This is hard to extend for signing support, and also quite ugly in general. In this PR, an explicit configuration option to {Mutable,}TransactionSignatureChecker is added (MissingDataBehavior enum class) to either select ASSERT_FAIL or FAIL. Validation code passes ASSERT_FAIL (as at validation time all data should always be passed, and anything else is a serious bug in the code), while signing code uses FAIL. The existence of the ASSERT_FAIL option is really just an abundance of caution. Always using FAIL should be just fine, but if there were for some reason a code path in consensus code was introduced that misses certain data, I think we prefer as assertion failure over silently introducing a consensus change. Potentially useful follow-ups (not for this PR, in my preference): * Having an explicit script validation error code for missing data. * Having a MissingDataBehavior::SUCCEED option as well, for use in script/sign.cpp DataFromTransaction (if a signature is present in a witness, and we don't have enough data to fully validate it, we should probably treat it as valid and not touch it). ACKs for top commit: sanket1729: reACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 Sjors: ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 achow101: re-ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 benthecarman: ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 fjahr: Code review ACK 725d7ae0494d4a45f5a840bbbd19c008a7363965 Tree-SHA512: d67dc51bae9ca7ef6eb9acccefd682529f397830f77d74cd305500a081ef55aede0e9fa380648c3a8dd4857aa7eeb1ab54fe808979d79db0784ac94ceb31b657
2021-04-12versionbits: simplify state transitionsAnthony Towns
This removes the DEFINED->FAILED transition and changes the STARTED->FAILED transition to only occur if signalling didn't pass the threshold. This ensures that it is always possible for activation to occur, no matter what settings are chosen, or the speed at which blocks are found.
2021-04-12versionbits: Add explicit NEVER_ACTIVE deploymentsAnthony Towns
Previously we used deployments that would timeout prior to Bitcoin's invention, which allowed the deployment to still be activated in unit tests. This switches those deployments to be truly never active.