Commit Graph

42405 Commits

Author SHA1 Message Date
fae7e3791c test: Correct the random seed log on a prevector test failure
rand_cache is unused since commit
16329224e7, so it can be removed

rand_seed is wrong since commit
022cf47dd7, because it is no longer
printing the seed that was used to seed the global random context in
tests. Instead, it prints a (random-ish) value derived from the global
random context via InsecureRand256().

Finally, the for loop creating new prevector_tester objects will always
use the same seed since commit fae43a97ca,
because repeated calls to SeedInsecureRand/SeedRandomForTest will always
reseed the global with the same "static const" seed.

Fix all issues by
* removing the unused rand_cache,
* removing the call to SeedRandomForTest which restored the same seed on
  every call in the process, and
* Reseeding the global random context with the (random-ish) rand_seed.
2024-08-21 23:27:08 +02:00
85b7cbfcbe test: unittest chainstatemanager_args 2024-08-21 19:29:25 +01:00
17707db939 Fix maybe-uninitialized warning in IsSpentKey 2024-08-21 14:06:49 -04:00
bc87ad9854 Merge bitcoin/bitcoin#30636: test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate
917e70a620 test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate (Sebastian Falbesoner)

Pull request description:

  Inspired by some manual testing I did for #28553, this PR checks that RPCs which explicitly query the UTXO set database (i.e. `gettxoutsetinfo`, `scantxoutset` and `gettxout`) operate on the snapshot chainstate as expected.

ACKs for top commit:
  fjahr:
    utACK 917e70a620
  achow101:
    ACK 917e70a620
  tdb3:
    ACK 917e70a620

Tree-SHA512: 40ecd1c5dd879234df1667fa5444a1fbbee9b7c456f597dc982d1a2bce46fe9107711b005ab829e570ef919a4914792f72f342d71d92bad2ae9434b5e68d5bd3
2024-08-21 13:30:00 -04:00
5b4f34006d devtools, utxo-snapshot: Fix block height out of range
Handle the Block height out of range error gracefully by checking if
the node has synchronized to or beyond the required block height,
otherwise without this validation the node would keep the network
disabled if the user selected that option.

Provide a user-friendly message if the block height is out of range
and exit the script cleanly.
2024-08-21 12:52:52 -03:00
60b816439e Merge bitcoin/bitcoin#30644: fuzz: Faster utxo_snapshot fuzz target
fa899fb7aa fuzz: Speed up utxo_snapshot fuzz target (MarcoFalke)
fa386642b4 fuzz: Speed up utxo_snapshot by lazy re-init (MarcoFalke)
fa645c7a86 fuzz: Remove unused DataStream object (MarcoFalke)
fae8c73d9e test: Disallow fee_estimator construction in ChainTestingSetup (MarcoFalke)

Pull request description:

  Two commits to speed up unit and fuzz tests.

  Can be tested by running the fuzz target and looking at the time it took, or by looking at the flamegraph. For example:

  ```
  FUZZ=utxo_snapshot perf record -g --call-graph dwarf ./src/test/fuzz/fuzz  -runs=100
  hotspot ./perf.data

ACKs for top commit:
  TheCharlatan:
    Re-ACK fa899fb7aa
  marcofleon:
    Re ACK fa899fb7aa
  brunoerg:
    ACK fa899fb7aa

Tree-SHA512: d3a771bb12d7ef491eee61ca47325dd1cea5c20b6ad42554babf13ec98d03bef8e7786159d077e59cc7ab8112495037b0f6e55edae65b871c7cf1708687cf717
2024-08-20 22:41:53 -04:00
60055f1abc test: replace deprecated secp256k1 context flags usage
The flags SECP256K1_CONTEXT_{SIGN,VERIFY} have been deprecated since
libsecp256k1 version 0.2 (released in December 2022), with the
recommendation to use SECP256K1_CONTEXT_NONE instead.
2024-08-21 00:41:56 +02:00
59ff17e5af miner: adjust clock to timewarp rule 2024-08-20 18:51:37 +02:00
e929054e12 Add timewarp attack mitigation test 2024-08-20 18:49:59 +02:00
e85f386c4b consensus: enable BIP94 on regtest 2024-08-20 13:25:00 +02:00
917e70a620 test: assumeutxo: check that UTXO-querying RPCs operate on snapshot chainstate 2024-08-20 12:43:58 +02:00
dd154b0568 consensus: lower regtest nPowTargetTimespan to 144
This currently has no effect due to fPowNoRetargeting,
except for the getnetworkhashps when called with -1.

It will when the next commit enforces the timewarp attack mitigation on regtest.
2024-08-20 10:07:30 +02:00
fa899fb7aa fuzz: Speed up utxo_snapshot fuzz target
This speeds up the fuzz target, which allows "valid" inputs. It does not
affect the "INVALID" fuzz target.
2024-08-20 07:54:04 +02:00
d79ea809d2 Merge bitcoin/bitcoin#30647: Move maximum timewarp attack threshold back to 600s from 7200s
16e95bda86 Move maximum timewarp attack threshold back to 600s from 7200s (Matt Corallo)

Pull request description:

  In 6bfa26048d the testnet4 timewarp attack fix block time variation was increased from the Great Consensus Cleanup value of 600s to 7200s on the thesis that this allows miners to always create blocks with the current time. Sadly, doing so does allow for some nonzero inflation, even if not a huge amount.

  While it could be that some hardware ignores the timestamp provided to it over Stratum and forces the block header timestamp to the current time, I'm not aware of any such hardware, and it would also likely suffer from random invalid blocks due to relying on NTP anyway, making its existence highly unlikely.

  This leaves the only concern being pools, but most of those rely on work generated by Bitcoin Core (in one way or another, though when spy mining possibly not), and it seems likely that they will also not suffer any lost work. While its possible that a pool does generate invalid work due to spy mining or otherwise custom logic, it seems unlikely that a substantial portion of hashrate would do so, making the difference somewhat academic (any pool that screws this up will only do so once and the network would come out just fine).

  Further, while we may end up deciding these assumptions were invalid and we should instead use 7200s, it seems prudent to try with the value we "want" on testnet4, giving us the ability to learn if the compatibility concerns are an issue before we go to mainnet.

ACKs for top commit:
  fjahr:
    tACK 16e95bda86
  achow101:
    ACK 16e95bda86
  murchandamus:
    crACK 16e95bda86

Tree-SHA512: ae46d03b728b6e23cb6ace64c9813bc01c01e38dd7f159cf0fab53b331ef84b3b811edab225453ccdfedb53b242f55b0efd69829782657490fe393d24dacbeb2
2024-08-19 15:15:02 -04:00
41051290ab cmake: Ignore build subdirectories within source directory 2024-08-16 21:24:08 +01:00
6ce50fd9d0 doc: Update for CMake-based build system
Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
Co-authored-by: pablomartin4btc <pablomartin4btc@gmail.com>
2024-08-16 21:24:08 +01:00
9730288a0c ci: Migrate CI scripts to CMake 2024-08-16 21:19:13 +01:00
c360837ca5 cmake, lint: Adjust lint_includes_build_config 2024-08-16 21:19:12 +01:00
3885441ee0 cmake: Add presets for native Windows builds 2024-08-16 21:19:12 +01:00
7681746b20 cmake: Add vcpkg manifest file 2024-08-16 21:19:12 +01:00
8b6f1c4353 cmake: Add Coverage and CoverageFuzz scripts 2024-08-16 21:19:12 +01:00
65bdbc1ff2 cmake: Add docs build target 2024-08-16 21:19:12 +01:00
fb75ebbc33 cmake: Add compiler diagnostic flags 2024-08-16 21:19:12 +01:00
e821f0a37a cmake: Migrate Guix build scripts to CMake 2024-08-16 21:19:11 +01:00
747adb6ffe cmake: Add Maintenance module 2024-08-16 21:19:11 +01:00
1f60b30df0 cmake: Add APPEND_{CPP,C,CXX,LD}FLAGS cache variables
The content of those variables is appended to the each target after the
flags added by the build system.
2024-08-16 21:19:11 +01:00
2b43c45b13 cmake: Add AddWindowsResources module 2024-08-16 21:19:11 +01:00
973a3b0c5d cmake: Implement install build target 2024-08-16 21:19:11 +01:00
84ac35cfd4 cmake: Add cross-compiling support
To configure CMake for cross-compiling, use
`--toolchain depends/${HOST}/toolchain.cmake` command-line option.
2024-08-16 21:19:11 +01:00
0d01c228a7 build: Generate toolchain.cmake in depends 2024-08-16 21:19:10 +01:00
91a799247d depends: Add host-specific cmake_system_version variables 2024-08-16 21:19:10 +01:00
9b31209b4c depends: Rename cmake_system -> cmake_system_name 2024-08-16 21:19:10 +01:00
4a5208a81d Revert "build, qt: Do not install *.prl files"
This reverts commit 1155978d8f.
2024-08-16 21:19:10 +01:00
6522af62af depends: Amend handling flags environment variables
If any of {C,CXX,CPP,LD}FLAGS is specified it should be assigned to
a non-type-specific variable.
2024-08-16 21:19:10 +01:00
90cec4d251 cmake: Add MULTIPROCESS option 2024-08-16 21:19:10 +01:00
bb1a450dcb cmake: Build bitcoin-chainstate executable 2024-08-16 21:19:09 +01:00
aed38ea58c cmake: Build bitcoinkernel library
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
2024-08-16 21:19:09 +01:00
975d67369b cmake: Build test_bitcoin-qt executable 2024-08-16 19:28:59 +01:00
10fcc668a3 cmake: Add WITH_DBUS option 2024-08-16 19:27:42 +01:00
5bb5a4bc75 cmake: Add libqrencode optional package support 2024-08-16 19:27:42 +01:00
57a6e2ef4a cmake: Build bitcoin-qt executable 2024-08-16 19:27:42 +01:00
30f642952c cmake: Add WERROR option 2024-08-16 19:27:42 +01:00
c98d4a4c34 cmake: Add REDUCE_EXPORTS option 2024-08-16 19:27:42 +01:00
a01cb6e63f cmake: Add HARDENING option 2024-08-16 19:27:42 +01:00
a8a2e364ac cmake: Add Python-based tests 2024-08-16 19:27:41 +01:00
3d85379570 cmake: Add fuzzing options 2024-08-16 19:27:41 +01:00
908530e312 cmake: Add SANITIZERS option 2024-08-16 19:27:41 +01:00
8bb0e85631 cmake: Build bench_bitcoin executable 2024-08-16 19:27:41 +01:00
801735163a cmake: Add external signer support 2024-08-16 19:27:41 +01:00
353e0c9e96 cmake: Add systemtap-sdt optional package support 2024-08-16 19:27:41 +01:00