aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2020-11-16Merge #20033: refactor: minor whitespace fixups, s/const/constexpr/ and ↵MarcoFalke
remove template (followup to #19845) 89836a82eec63f93bbe6c3bd6a52be26e71ab54d style: minor improvements as a followup to #19845 (Vasil Dimov) Pull request description: Address suggestions: https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125 ACKs for top commit: jonatack: re-ACK 89836a8 change since previous review is replacing std::runtime_error with std::exception, built/ran unit tests with gcc debian 10.2.0-15, then broke a few v3 net_tests involving `BOOST_CHECK_EXCEPTION`, rebuilt, ran `src/test/test_bitcoin -t net_tests -l all` and checked the error reporting. hebasto: re-ACK 89836a82eec63f93bbe6c3bd6a52be26e71ab54d theStack: ACK 89836a82eec63f93bbe6c3bd6a52be26e71ab54d Tree-SHA512: 36477fdccabe5a8ad91fbabb4655cc363a3a7ca237a98ae6dd4a9fae4a4113762040f864d4ca13a47d081f7d16e5bd487edbfb61ab50a37e4a0424e9bec30b24
2020-11-12fuzz: Use ConsumeRandomLengthBitVector(...) in src/test/fuzz/connman and ↵practicalswift
src/test/fuzz/net
2020-11-12tests: Add fuzzing harness for CAddrManpracticalswift
2020-11-12Merge #20188: tests: Add fuzzing harness for CConnmanMarcoFalke
79ef8324d4c85ed16a304e98805724b8a59022ac tests: Add fuzzing harness for CConnman (practicalswift) Pull request description: Add fuzzing harness for `CConnman`. See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for 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: review ACK 79ef8324d4c85ed16a304e98805724b8a59022ac Tree-SHA512: eb9ffae20e939b818f8b9def064544b9a8fcd127ca22d1a54af1afedf1d24143be42419f3a03d684be59a5ff07b29d8bfa34ef2aaf1d9f9f75c4c1aaa90a29a8
2020-11-11fuzz: Improve coverage for CPartialMerkleTree fuzzing harnesspracticalswift
2020-11-10Merge #20332: test: Mock IBD in net_processing fuzzersMarcoFalke
fa4234d877ea3193bfd0e18ff68dcb8fb84b47b5 test: Mock IBD in net_processing fuzzers (MarcoFalke) Pull request description: Without this the fuzzers fail to detect trivial crasher bugs, such as https://github.com/bitcoin/bitcoin/pull/20317#issuecomment-723047111 ACKs for top commit: practicalswift: Tested ACK fa4234d877ea3193bfd0e18ff68dcb8fb84b47b5 Tree-SHA512: ce5da5c0a604b7559805a98ffdde882b44ca4f91b003b493d6e1be230714ce4cccb11dbfc1fc175f9d8fc779551c0a4103ceb4b473552928207d7d78ae329e10
2020-11-09fuzz: Assert roundtrip equality for both addrv1 and addrv2 versions of CServicepracticalswift
2020-11-09fuzz: Check for addrv1 compatibility before using addrv1 ↵practicalswift
serializer/deserializer on CSubNet
2020-11-07test: Mock IBD in net_processing fuzzersMarcoFalke
2020-11-05Merge #20303: fuzz: Assert expected DecodeHexTx behaviour when using legacy ↵MarcoFalke
decoding d7901ab8d2fdd2f6e68c4fa48078111bf5f0fa73 fuzz: Assert expected DecodeHexTx behaviour when using legacy decoding (practicalswift) Pull request description: Assert expected `DecodeHexTx` behaviour when using legacy decoding. As suggested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/20290#issuecomment-720989597. ACKs for top commit: MarcoFalke: review ACK d7901ab8d2fdd2f6e68c4fa48078111bf5f0fa73 Tree-SHA512: 3285680059e6fa73b0fb2c52b775f6319de1ac616f731206662b742764dc888cdfd1ac1f1fcfdfd5418d2006475a852d1c1a56a7035f772f0a6b2a84f5de93bc
2020-11-04fuzz: Assert expected DecodeHexTx behaviour when using legacy decodingpracticalswift
2020-11-04Merge #20300: fuzz: Add missing ECC_Start to descriptor_parse testMarcoFalke
5cafe2b25c1d2f6825b3c8103c280020929dd645 fuzz: Add missing ECC_Start to descriptor_parse test (Ivan Metlushko) Pull request description: Fixes fuzzing harness. I also observed that the corpus for this test consists only of `xprv...` keys while we are using regtest parameters. So for proper fuzzing we need either A) to update the corpus and replace `xprv...` with `tprv...` B) switch to main net in the test ACKs for top commit: MarcoFalke: review ACK 5cafe2b25c1d2f6825b3c8103c280020929dd645 practicalswift: Tested ACK 5cafe2b25c1d2f6825b3c8103c280020929dd645 Tree-SHA512: 7415a98a445ce0f96219637d2362fecfc1191ad104f55d79ca92b0c92cde165e00646be5bf3fda956385e3cb22540eca457e575048493367cdf0e00a27d7cdb8
2020-11-04fuzz: Add missing ECC_Start to descriptor_parse testIvan Metlushko
2020-11-04Merge #20245: test: Run script_assets_test even if built --with-libs=noMarcoFalke
fa3967efdb07f1d22372f4ee2e602ea1fad04a57 test: Replace ARRAYLEN with C++11 ranged for loop (MarcoFalke) fafc5290538fde76c3780976f4b2c11dc9f24d19 test: Run AssetTest even if built --with-libs=no (MarcoFalke) faf58ab139949ca35b33217d010b350c9a59c61d ci: Add --with-libs=no to one ci config (MarcoFalke) Pull request description: `script_assets_test` doesn't call libbitcoinconsensus, so it seems confusing to require it ACKs for top commit: fanquake: ACK fa3967efdb07f1d22372f4ee2e602ea1fad04a57 - looks ok to me. Tree-SHA512: 8744fef64c5d7dc19a0ef4ae9b3df5b3f356253bf000f12723064794c5e50df071824d436059985f1112d94c1b530b65cbeb6b8435114a91b195480620eafc59
2020-11-03Merge #20290: fuzz: Fix DecodeHexTx fuzzing harness issueMarcoFalke
28f8cb13d4d5a3d6aefa6e192e55f9aa87579e52 fuzz: Fix DecodeHexTx fuzzing harness issue (practicalswift) Pull request description: Fix `DecodeHexTx` fuzzing harness issue. Before this patch: ``` $ src/test/fuzz/decode_tx decode_tx: test/fuzz/decode_tx.cpp:29: void test_one_input(const std::vector<uint8_t> &): Assertion `result_try_witness_and_maybe_no_witness' failed. … ``` After this patch: ``` $ src/test/fuzz/decode_tx … ``` ACKs for top commit: MarcoFalke: review ACK 28f8cb13d4d5a3d6aefa6e192e55f9aa87579e52 Tree-SHA512: 2ed11b2f00a4c6fa3e8eea76a2a37d89a4b8d52815264676fe3de0a26ad7906cfafda9b843ceede2fd428815472e01fd1f87afb851282a8c7839bd4c87dc382b
2020-11-03Merge #20289: fuzz: Check for addrv1 compatibility before using addrv1 ↵MarcoFalke
serializer/deserializer on CService c2cf8a18c25bf19ade51fedfa5c352bd7145edb0 fuzz: Check for addrv1 compatibility before using addrv1 serializer on CService (practicalswift) Pull request description: Check for addrv1 compatibility before using addrv1 serializer/deserializer on `CService`: Before this patch: ``` $ src/test/fuzz/service_deserialize service_deserialize: test/fuzz/deserialize.cpp:85: void (anonymous namespace)::AssertEqualAfterSerializeDeserialize(const T &, const int) [T = CService]: Assertion `Deserialize<T>(Serialize(obj, version)) == obj' failed. ``` After this patch: ``` $ src/test/fuzz/service_deserialize … ``` Related change: #20247 ACKs for top commit: MarcoFalke: review ACK c2cf8a18c25bf19ade51fedfa5c352bd7145edb0 Tree-SHA512: dba6ddc60e8ef621011d844281461f1741de08c4af1a2b7156c810af44306cef7ec582de5974752db02ca085cfd23da0296d70b694e59ee262589d829fa0626e
2020-11-03Merge #20187: Addrman: test-before-evict bugfix and improvements for ↵fanquake
block-relay-only peers 16d9bfc4172b4f6ce24a3cd1a1cfa3933cd26751 Avoid test-before-evict evictions of current peers (Suhas Daftuar) e8b215a086d91a8774210bb6ce8d1560aaaf0789 Refactor test for existing peer connection into own function (Suhas Daftuar) 4fe338ab3ed73b3ffb20eedf95500c56ec2920e1 Call CAddrMan::Good() on block-relay-only peer addresses (Suhas Daftuar) daf55531260833d597ee599e2d289ea1be0b1d9c Avoid calling CAddrMan::Connected() on block-relay-only peer addresses (Suhas Daftuar) Pull request description: This PR does two things: * Block-relay-only interaction with addrman. * Calling `CAddrMan::Connected()` on an address that was a block-relay-only peer causes the time we report in `addr` messages containing that peer to be updated; particularly now that we use anchor connections with a our block-relay-only peers, this risks leaking information about those peers. So, stop this. * Avoiding calling `CAddrMan::Good()` on block-relay-only peer addresses causes the addrman logic around maintaining the new and tried table to be less good, and in particular makes it so that block-relay-only peer addresses are more likely to be evicted from the addrman (for no good reason I can think of). So, mark those addresses as good when we connect. * Fix test-before-evict bug. There's a bug where if we get a collision in the tried table with an existing address that is one of our current peers, and the connection is long-lived enough, then `SelectTriedCollisions()` might return that existing peer address to us as a test-before-evict connection candidate. However, our logic for new outbound connections would later prevent us from actually making a connection; the result would be that when we get a collision with a long-lived current peer, that peer's address is likely to get evicted from the tried table. Fix this by checking to see if a test-before-evict candidate is a peer we're currently connected to, and if so, mark it as `Good()`. ACKs for top commit: sipa: utACK 16d9bfc4172b4f6ce24a3cd1a1cfa3933cd26751 amitiuttarwar: code review ACK 16d9bfc417 mzumsande: Code-Review ACK 16d9bfc4172b4f6ce24a3cd1a1cfa3933cd26751. jnewbery: utACK 16d9bfc4172b4f6ce24a3cd1a1cfa3933cd26751 ariard: Code Review ACK 16d9bfc. jonatack: Tested ACK 16d9bfc4172b4f6ce24a3cd1a1cfa3933cd26751 Tree-SHA512: 188ccb814e436937cbb91d29d73c316ce83f4b9c22f1cda56747f0949a093e10161ae724e87e4a2d85ac40f85f5f6b4e87e97d350a1ac44f80c57783f4423324
2020-11-02fuzz: Fix DecodeHexTx fuzzing harness issuepracticalswift
2020-11-02fuzz: Check for addrv1 compatibility before using addrv1 serializer on CServicepracticalswift
2020-11-02Merge #20165: Only relay Taproot spends if next block has it activeMarcoFalke
3d0556d41087f945ed0a47a5d770076ad42ce432 Increase feature_taproot inactive test coverage (Pieter Wuille) 525cbd425e2f6a1dbd0febc53d7ada22cec4661f Only relay Taproot spends if next block has it active (Pieter Wuille) Pull request description: There should be no change to mempool transaction behavior for witness v1 transactions as long as no activation is defined. Until that point, we should treat the consensus rules as under debate, and for soft-fork safety, that means spends should be treated as non-standard. It's possible to go further: don't relay them unless the consensus rules are actually active for the next block. This extends non-relay to the period where a deployment is defined, started, locked in, or failed. I see no downsides to this, and the code change is very simple. ACKs for top commit: Sjors: utACK 3d0556d41087f945ed0a47a5d770076ad42ce432 MarcoFalke: review ACK 3d0556d41087f945ed0a47a5d770076ad42ce432 🏓 jnewbery: utACK 3d0556d41087f945ed0a47a5d770076ad42ce432 Tree-SHA512: ca625a2981716b4b44e8f3722718fd25fd04e25bf3ca1684924b8974fca49f7c1d438fdd9dcdfbc091a442002e20d441d42c41a0e2096e74a61068da6c60267a
2020-11-02Merge #20080: Strip any trailing `/` in -datadir and -blocksdir pathsSamuel Dobson
ad5cef5dfdd5802fc187a52e74d940a52f420a51 doc: Update data directory path comments (Hennadii Stepanov) b19e88230f0e93e95e883e65376963cb9c36f606 util: Add StripRedundantLastElementsOfPath function (Hennadii Stepanov) Pull request description: Wallet names in `listwalletdir` RPC are correct now, even if the `-datadir` path has any number of trailing `/`. This PR is an alternative to #19933. Fixes #19928. ACKs for top commit: MarcoFalke: review ACK ad5cef5dfd 🔙 promag: Code review ACK ad5cef5dfdd5802fc187a52e74d940a52f420a51. meshcollider: Code review + test run ACK ad5cef5dfdd5802fc187a52e74d940a52f420a51 Tree-SHA512: bccabbd6c18243d48d15b2b27201cc0f5984623dcbc635c8740cf74523f359844c36eadd40391142874fcf452a43880bb6afbf89815ae736e499f9a98143a661
2020-10-31style: minor improvements as a followup to #19845Vasil Dimov
Address suggestions: https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125
2020-10-30Only relay Taproot spends if next block has it activePieter Wuille
2020-10-29Merge #20242: fuzz: Properly initialize PrecomputedTransactionDataWladimir J. van der Laan
fa56d56d4e9b69fdd02e631b9a2380cfd3095144 fuzz: Properly initialize PrecomputedTransactionData (MarcoFalke) Pull request description: Fixes: ``` script_flags: script/interpreter.cpp:1512: bool SignatureHashSchnorr(uint256 &, const ScriptExecutionData &, const T &, uint32_t, uint8_t, SigVersion, const PrecomputedTransactionData &) [T = CTransaction]: Assertion `cache.m_bip341_taproot_ready && cache.m_spent_outputs_ready' failed. ==34989== ERROR: libFuzzer: deadly signal #0 0x55e90077ff11 in __sanitizer_print_stack_trace (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x20cf11) #1 0x55e9006cb068 in fuzzer::PrintStackTrace() (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x158068) #2 0x55e9006b01b3 in fuzzer::Fuzzer::CrashCallback() (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x13d1b3) #3 0x7f6fb89383bf (/lib/x86_64-linux-gnu/libpthread.so.0+0x153bf) #4 0x7f6fb855018a in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618a) #5 0x7f6fb852f858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x25858) #6 0x7f6fb852f728 (/lib/x86_64-linux-gnu/libc.so.6+0x25728) #7 0x7f6fb8540f35 in __assert_fail (/lib/x86_64-linux-gnu/libc.so.6+0x36f35) #8 0x55e9008275bd in bool SignatureHashSchnorr<CTransaction>(uint256&, ScriptExecutionData const&, CTransaction const&, unsigned int, unsigned char, SigVersion, PrecomputedTransactionData const&) /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/script/interpreter.cpp:1512:5 #9 0x55e900825a3f in GenericTransactionSignatureChecker<CTransaction>::CheckSchnorrSignature(Span<unsigned char const>, Span<unsigned char const>, SigVersion, ScriptExecutionData const&, ScriptError_t*) const /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/script/interpreter.cpp:1699:10 #10 0x55e900832503 in VerifyWitnessProgram(CScriptWitness const&, int, std::vector<unsigned char, std::allocator<unsigned char> > const&, unsigned int, BaseSignatureChecker const&, ScriptError_t*, bool) /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/script/interpreter.cpp:1900:26 #11 0x55e90082ecb5 in VerifyScript(CScript const&, CScript const&, CScriptWitness const*, unsigned int, BaseSignatureChecker const&, ScriptError_t*) /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/script/interpreter.cpp:1977:18 #12 0x55e9007a9b61 in test_one_input(std::vector<unsigned char, std::allocator<unsigned char> > const&) /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags.cpp:51:30 #13 0x55e9007d0b49 in LLVMFuzzerTestOneInput /tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/fuzz.cpp:36:5 #14 0x55e9006b1871 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x13e871) #15 0x55e9006b0fb5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x13dfb5) #16 0x55e9006b38d7 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x1408d7) #17 0x55e9006b3c39 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x140c39) #18 0x55e9006a290e in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x12f90e) #19 0x55e9006cb752 in main (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x158752) #20 0x7f6fb85310b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #21 0x55e9006776ad in _start (/tmp/bitcoin-core/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/fuzz/script_flags+0x1046ad) ACKs for top commit: laanwj: Code review ACK fa56d56d4e9b69fdd02e631b9a2380cfd3095144 Tree-SHA512: 5637b0a0d982360df32d8cd39e913395967af02ec746508fc5f2fd649695c58bfaaf18ef76f4ca9da764d34fdd63dfe188317dd41b2ed57534bd4055a05ae870
2020-10-27util: Add StripRedundantLastElementsOfPath functionHennadii Stepanov
Co-authored-by: saibato <saibato.naga@pm.me> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-10-27Avoid calling CAddrMan::Connected() on block-relay-only peer addressesSuhas Daftuar
Connected() updates the time we serve in addr messages, so avoid leaking block-relay-only peer connections by avoiding these calls.
2020-10-26fuzz: Check for addrv1 compatibility before using addrv1 serializerpracticalswift
2020-10-26test: Replace ARRAYLEN with C++11 ranged for loopMarcoFalke
2020-10-26test: Run AssetTest even if built --with-libs=noMarcoFalke
2020-10-26fuzz: Properly initialize PrecomputedTransactionDataMarcoFalke
2020-10-20tests: Add fuzzing harness for CConnmanpracticalswift
2020-10-18test: Fix -Wunused-function warning if configured --without-libsHennadii Stepanov
This is a move-only change.
2020-10-15Merge #20131: test: Remove unused nVersion=1 in p2p testsWladimir J. van der Laan
faad92fe1c3cca9795226bd167130976930ddab8 test: Remove unused nVersion=1 in p2p tests (MarcoFalke) Pull request description: After commit ddefb5c0b759950942ac03f28c43b548af7b4033 nVersion is no longer used in p2p logic when sending messages. Only when receiving messages, but in this test no messages are received. ACKs for top commit: laanwj: Code review ACK faad92fe1c3cca9795226bd167130976930ddab8 fanquake: ACK faad92fe1c3cca9795226bd167130976930ddab8 Tree-SHA512: 9a7029187aaa5a7929a4a2199646131ff1ea72df6a855ce7022dd3bb2647dd525356dbc5e460c77007eebcdeab400a689db8cb77e8239af3b539c117a4e0d16e
2020-10-15Merge #19953: Implement BIP 340-342 validation (Schnorr/taproot/tapscript)Wladimir J. van der Laan
0e2a5e448f426219a6464b9aaadcc715534114e6 tests: dumping and minimizing of script assets data (Pieter Wuille) 4567ba034c5ae6e6cc161360f7425c9e844738f0 tests: add generic qa-asset-based script verification unit test (Pieter Wuille) f06e6d03452cf5e0b1a0863afb08c9e6d3ef452e tests: functional tests for Schnorr/Taproot/Tapscript (Pieter Wuille) 3c226639eb134314a0640d34e4ccb6148dbde22f tests: add BIP340 Schnorr signature support to test framework (Pieter Wuille) 206fb180ec6ee5f916afc6f574000d716daf79b7 --- [TAPROOT] Tests --- (Pieter Wuille) d7ff237f2996a4c11fdf9399187c2d2b26bf9809 Activate Taproot/Tapscript on regtest (BIP 341, BIP 342) (Pieter Wuille) e9a021d7e6a454d610a45cb9b3995f0d96a5fbb6 Make Taproot spends standard + policy limits (Pieter Wuille) 865d2c37e2e44678498b7f425b65e01b1e231cde --- [TAPROOT] Regtest activation and policy --- (Pieter Wuille) 72422ce396b8eba7b1a72c171c2f07dae691d1b5 Implement Tapscript script validation rules (BIP 342) (Johnson Lau) 330de894a9a48515d9a473448b6c67adc3d188be Use ScriptExecutionData to pass through annex hash (Pieter Wuille) 8bbed4b7acf4c76eaea8c0e10f3cbf6ba4e53809 Implement Taproot validation (BIP 341) (Pieter Wuille) 0664f5fe1f77f08d235aa3750b59428257b0b91d Support for Schnorr signatures and integration in SignatureCheckers (BIP 340) (Pieter Wuille) 5de246ca8159dcffaa4c136a60c8bfed2028e2ee Implement Taproot signature hashing (BIP 341) (Johnson Lau) 9eb590894f15ff40806039bfd32972fbc260e30d Add TaggedHash function (BIP 340) (Pieter Wuille) 450d2b23710ad296eede81339195376021ab5500 --- [TAPROOT] BIP340/341/342 consensus rules --- (Pieter Wuille) 5d62e3a68b6ea9bb03556ee1fbf5678f20be01a2 refactor: keep spent outputs in PrecomputedTransactionData (Pieter Wuille) 8bd2b4e78452ff69c08c37acf164a6b80e503f13 refactor: rename scriptPubKey in VerifyWitnessProgram to exec_script (Pieter Wuille) 107b57df9fa8b2d625d2b342dc77722282a6ae4c scripted-diff: put ECDSA in name of signature functions (Pieter Wuille) f8c099e2207c90d758e7a659d6a55fa7ccb7ceaa --- [TAPROOT] Refactors --- (Pieter Wuille) Pull request description: This is an implementation of the Schnorr/taproot consensus rules proposed by BIPs [340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), [341](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), and [342](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki). See the list of commits [below](https://github.com/bitcoin/bitcoin/pull/19953#issuecomment-691815830). No signing or wallet support of any kind is included, as testing is done entirely through the Python test framework. This is a successor to https://github.com/bitcoin/bitcoin/pull/17977 (see discussion following [this comment](https://github.com/bitcoin/bitcoin/pull/17977#issuecomment-682285983)), and will have further changes squashed/rebased. The history of this PR can be found in #19997. ACKs for top commit: instagibbs: reACK https://github.com/bitcoin/bitcoin/pull/19953/commits/0e2a5e448f426219a6464b9aaadcc715534114e6 benthecarman: reACK 0e2a5e4 kallewoof: reACK 0e2a5e448f426219a6464b9aaadcc715534114e6 jonasnick: ACK 0e2a5e448f426219a6464b9aaadcc715534114e6 almost only looked at bip340/libsecp related code jonatack: ACK 0e2a5e448f426219a6464b9aaadcc715534114e6 modulo the last four commits (tests) that I plan to finish reviewing tomorrow fjahr: reACK 0e2a5e448f426219a6464b9aaadcc715534114e6 achow101: ACK 0e2a5e448f426219a6464b9aaadcc715534114e6 Tree-SHA512: 1b00314450a2938a22bccbb4e177230cf08bd365d72055f9d526891f334b364c997e260c10bc19ca78440b6767712c9feea7faad9a1045dd51a5b96f7ca8146e
2020-10-14Merge #19988: Overhaul transaction request logicWladimir J. van der Laan
fd9a0060f028a4c01bd88f58777dea34bdcbafd1 Report and verify expirations (Pieter Wuille) 86f50ed10f66b5535f0162cf0026456a9e3f8963 Delete limitedmap as it is unused now (Pieter Wuille) cc16fff3e476a9378d2176b3c1b83ad12b1b052a Make txid delay penalty also apply to fetches of orphan's parents (Pieter Wuille) 173a1d2d3f824b83777ac713e89bee69fd87692d Expedite removal of tx requests that are no longer needed (Pieter Wuille) de11b0a4eff20da3e3ca52dc90948b5253d329c5 Reduce MAX_PEER_TX_ANNOUNCEMENTS for non-PF_RELAY peers (Pieter Wuille) 242d16477df1a024c7126bad23dde39cad217eca Change transaction request logic to use txrequest (Pieter Wuille) 5b03121d60527a193a84c339151481f9c9c1962b Add txrequest fuzz tests (Pieter Wuille) 3c7fe0e5a0ee1abf4dc263ae5310e68253c866e1 Add txrequest unit tests (Pieter Wuille) da3b8fde03f2e8060bb7ff3bff17175dab85f0cd Add txrequest module (Pieter Wuille) Pull request description: This replaces the transaction request logic with an encapsulated class that maintains all the state surrounding it. By keeping it stand alone, it can be easily tested (using included unit tests and fuzz tests). The major changes are: * Announcements from outbound (and whitelisted) peers are now always preferred over those from inbound peers. This used to be the case for the first request (by delaying the first request from inbound peers), and a bias afters. The 2s delay for requests from inbound peers still exists, but after that, if viable outbound peers remain for any given transaction, they will always be tried first. * No more hard cap of 100 in flight transactions per peer, as there is less need for it (memory usage is linear in the number of announcements, but independent from the number in flight, and CPU usage isn't affected by it). Furthermore, if only one peer announces a transaction, and it has over 100 in flight already, we still want to request it from them. The cap is replaced with a rule that announcements from such overloaded peers get an additional 2s delay (possibly combined with the existing 2s delays for inbound connections, and for txid peers when wtxid peers are available). * The limit of 100000 tracked announcements is reduced to 5000; this was excessive. This can be bypassed using the PF_RELAY permission (to accommodate locally dumping a batch of many transactions). This replaces #19184, rebased on #18044 and with many small changes. ACKs for top commit: ariard: Code Review ACK fd9a006. I've reviewed the new TxRequestTracker, its integration in net_processing, unit/functional/fuzzing test coverage. I looked more for soundness of new specification rather than functional consistency with old transaction request logic. MarcoFalke: Approach ACK fd9a0060f028a4c01bd88f58777dea34bdcbafd1 🏹 naumenkogs: Code Review ACK fd9a006. I've reviewed everything, mostly to see how this stuff works at the lower level (less documentation-wise, more implementation-wise), and to try breaking it with unexpected sequences of events. jnewbery: utACK fd9a0060f028a4c01bd88f58777dea34bdcbafd1 jonatack: WIP light ACK fd9a0060f028a4c01bd88f58777dea34bdcbafd1 have read the code, verified that each commit is hygienic, e.g. debug build clean and tests green, and have been running a node on and off with this branch and grepping the net debug log. Am still unpacking the discussion hidden by GitHub by fetching it via the API and connecting the dots, storing notes and suggestions in a local branch; at this point none are blockers. ryanofsky: Light code review ACK fd9a0060f028a4c01bd88f58777dea34bdcbafd1, looking at txrequest implementation, unit test implementation, and net_processing integration, just trying to understand how it works and looking for anything potentially confusing in the implementation. Didn't look at functional tests or catch up on review discussion. Just a sanity check review focused on: Tree-SHA512: ea7b52710371498b59d9c9cfb5230dd544fe9c6cb699e69178dea641646104f38a0b5ec7f5f0dbf1eb579b7ec25a31ea420593eff3b7556433daf92d4b0f0dd7
2020-10-14Merge #20129: tests: don't export in6addr_loopbackMarcoFalke
8e4d62280e3d3fa729e71d557ba457a3e08349f8 tests: don't export in6addr_loopback (Vasil Dimov) Pull request description: Don't export `in6addr_loopback` because that upsets `contrib/devtools/symbol-check.py` Fixes https://github.com/bitcoin/bitcoin/issues/20127 ACKs for top commit: sipa: utACK 8e4d62280e3d3fa729e71d557ba457a3e08349f8 hebasto: ACK 8e4d62280e3d3fa729e71d557ba457a3e08349f8 Tree-SHA512: 216ffb53df55d2888317a81d18745308aaf93a3f3b45aa778166f7c91edb9741c28424d6333b35cefb5ece42b74e20ea21c761d93d8432798e7ec12097c2758f
2020-10-12tests: dumping and minimizing of script assets dataPieter Wuille
This adds a --dumptests flag to the feature_taproot.py test, to dump all its generated test cases to files, in a format compatible with the script_assets_test unit test. A fuzzer for said format is added as well, whose primary purpose is coverage-based minimization of those dumps.
2020-10-12tests: add generic qa-asset-based script verification unit testPieter Wuille
This adds a unit test that does generic script verification tests, with positive/negative witnesses/scriptsigs, under various flags. The test data is large (several MB) so it's stored in the qa-assets repo.
2020-10-12Use ScriptExecutionData to pass through annex hashPieter Wuille
Instead of recomputing the annex hash every time a signature is verified, compute it once and cache it in a new ScriptExecutionData structure.
2020-10-12Support for Schnorr signatures and integration in SignatureCheckers (BIP 340)Pieter Wuille
This enables the schnorrsig module in libsecp256k1, adds the relevant types and functions to src/pubkey, as well as in higher-level `SignatureChecker` classes. The (verification side of the) BIP340 test vectors is also added.
2020-10-12Report and verify expirationsPieter Wuille
2020-10-12Delete limitedmap as it is unused nowPieter Wuille
2020-10-12Add txrequest fuzz testsPieter Wuille
This adds a fuzz test that reimplements a naive reimplementation of TxRequestTracker (with up to 16 fixed peers and 16 fixed txhashes), and compares the real implementation against it.
2020-10-12Add txrequest unit testsPieter Wuille
Add unit tests for TxRequestTracker. Several scenarios are tested, randomly interleaved with eachother. Includes a test by Antoine Riard (ariard).
2020-10-12Merge #19998: net: Add CNode::ConnectedThroughNetwork member functionWladimir J. van der Laan
3984b78cd7f49e409377f2175a56e8e4bd71d1d8 test: Add tests for CNode::ConnectedThroughNetwork (Hennadii Stepanov) 49fba9c1aa699d3aa47ea4dafe07b47c8d0aac6e net: Add CNode::ConnectedThroughNetwork member function (Hennadii Stepanov) d4dde24034d7467883b290111da60527ab8048f8 net: Add CNode::m_inbound_onion data member (Hennadii Stepanov) Pull request description: This PR: - adds `CNode::ConnectedThroughNetwork` member function - is based on #19991, and only last two commits belong to it - is required for https://github.com/bitcoin-core/gui/pull/86 and #20002 ACKs for top commit: jonatack: re-ACK 3984b78cd7f49e409377f2175a56e8e4bd71d1d8 per `git diff 3989fcf 3984b78c` laanwj: Code review ACK 3984b78cd7f49e409377f2175a56e8e4bd71d1d8 Tree-SHA512: 23a9c8bca8dca75113b5505fe443b294f2d42d03c98c7e34919da12d8396beb8d0ada3a58ae16e3da04b7044395f72cf9c216625afc078256cd6c897ac42bf3d
2020-10-12test: Remove unused nVersion=1 in p2p testsMarcoFalke
After commit ddefb5c0b759950942ac03f28c43b548af7b4033 nVersion is no longer used in p2p logic when sending messages. Only when receiving messages, but in this test no messages are received.
2020-10-12tests: don't export in6addr_loopbackVasil Dimov
Don't export `in6addr_loopback` because that upsets `contrib/devtools/symbol-check.py` Fixes https://github.com/bitcoin/bitcoin/issues/20127
2020-10-11Merge #19954: Complete the BIP155 implementation and upgrade to TORv3fanquake
dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5 tor: make a TORv3 hidden service instead of TORv2 (Vasil Dimov) 353a3fdaad055eea42a0baf7326bdd591f541170 net: advertise support for ADDRv2 via new message (Vasil Dimov) 201a4596d92d640d5eb7e76cc8d959228fa09dbb net: CAddress & CAddrMan: (un)serialize as ADDRv2 (Vasil Dimov) 1d3ec2a1fda7446323786a52da1fd109c01aa6fb Support bypassing range check in ReadCompactSize (Pieter Wuille) Pull request description: This PR contains the two remaining commits from #19031 to complete the [BIP155](https://github.com/bitcoin/bips/blob/master/bip-0155.mediawiki) implementation: `net: CAddress & CAddrMan: (un)serialize as ADDRv2` `net: advertise support for ADDRv2 via new message` plus one more commit: `tor: make a TORv3 hidden service instead of TORv2` ACKs for top commit: jonatack: re-ACK dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5 per `git diff 9b56a68 dcf0cb4` only change since last review is an update to the release notes which partially picked up the suggested text. Running a node on this branch and addnode-ing to 6 other Tor v3 nodes, I see "addrv2" and "sendaddrv2" messages in getpeerinfo in both the "bytesrecv_per_msg" and "bytessent_per_msg" JSON objects. sipa: ACK dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5 hebasto: re-ACK dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5, the node works flawlessly in all of the modes: Tor-only, clearnet-only, mixed. laanwj: Edit: I have to retract this ACK for now, I'm having some problems with this PR on a FreeBSD node. It drops all outgoing connections with this dcf0cb477699d11afd0ff37c8bfb2b1b4f7f1ee5 merged on master (12a1c3ad1a43634d2a98717e49e3f02c4acea2fe). ariard: Code Review ACK dcf0cb4 Tree-SHA512: 28d4d0d817b8664d2f4b18c0e0f31579b2f0f2d23310ed213f1f436a4242afea14dfbf99e07e15889bc5c5c71ad50056797e9307ff8a90e96704f588a6171308
2020-10-09net: advertise support for ADDRv2 via new messageVasil Dimov
Introduce a new message `sendaddrv2` to signal support for ADDRv2. Send the new message immediately after sending the `VERACK` message. Add support for receiving and parsing ADDRv2 messages. Send ADDRv2 messages (instead of ADDR) to a peer if he has advertised support for it. Co-authored-by: Carl Dong <contact@carldong.me>
2020-10-09net: CAddress & CAddrMan: (un)serialize as ADDRv2Vasil Dimov
Change the serialization of `CAddrMan` to serialize its addresses in ADDRv2/BIP155 format by default. Introduce a new `CAddrMan` format version (3). Add support for ADDRv2 format in `CAddress` (un)serialization. Co-authored-by: Carl Dong <contact@carldong.me>