Commit Graph

451 Commits

Author SHA1 Message Date
MacroFake
2222ec71fd
util: Move error message formatting of NonFatalCheckError to cpp
This allows to strip down the header file
2022-11-16 12:21:33 +01:00
fanquake
3a0b352c63
refactor: move url.h/cpp from lib util to lib common 2022-10-31 10:17:04 +00:00
MacroFake
bd478890c5
Merge bitcoin/bitcoin#26388: ci: Use macos-ventura-xcode:14.1 image for "macOS native" task
da16893474 ci: Use `macos-ventura-xcode:14.1` image for "macOS native" task (Hennadii Stepanov)
702836530f ci: Make `getopt` path architecture agnostic (Hennadii Stepanov)

Pull request description:

  The "macOS native" CI task always uses the recent OS image.

  This PR updates it up to the recent macOS release.

  Cirrus Labs [stopped](https://github.com/bitcoin/bitcoin/pull/25160#issuecomment-1162829773) updating macOS images for `x86_64`, therefore, an `arm64` image been used.

  Also `make test-security-check` has been dropped as it ["isn't even expected to pass"](https://github.com/bitcoin/bitcoin/issues/26386#issuecomment-1290318628) on `arm64` in CI.

ACKs for top commit:
  Sjors:
    utACK da16893

Tree-SHA512: 36785d33b7f11b3cdbc53bcfbf97d88bf821fad248c825982dd9f8e3413809a4ef11190eaf950e60fdf479b62ff66920c35d9ea42d534723f015742eec7e19b6
2022-10-27 16:15:20 +02:00
Hennadii Stepanov
da16893474
ci: Use macos-ventura-xcode:14.1 image for "macOS native" task 2022-10-25 13:39:03 +01:00
Hennadii Stepanov
702836530f
ci: Make getopt path architecture agnostic 2022-10-25 09:49:07 +01:00
MacroFake
aaaa7bd0ba
iwyu: Add missing includes 2022-10-18 14:12:52 +02:00
MacroFake
9ca39d69df
Merge bitcoin/bitcoin#26254: iwyu: Add zmq source files
13afcc0cd4 iwyu: Add zmq source files (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  fanquake:
    ACK 13afcc0cd4

Tree-SHA512: 7af95e991fc2782aeba2edfef0a2f75f9c361058295586adb062087aa31c47cfcce2425aee9dd5153e18e018cf1f9272c9617c671b7262db55f241526c3fcb15
2022-10-10 18:08:45 +02:00
Hennadii Stepanov
13afcc0cd4
iwyu: Add zmq source files 2022-10-10 15:44:02 +01:00
MacroFake
fa04376554
Remove clang-format from lint task
clang-format could be used in scripted diffs, but remained largely
unused.
2022-10-05 10:52:42 +02:00
fanquake
a23f8c8978
Merge bitcoin/bitcoin#26234: ci: Allow PIP_PACKAGES on centos
fa6054e952 ci: Allow PIP_PACKAGES on centos (MacroFake)
fac085a05c ci: Remove unused package (MacroFake)

Pull request description:

  This was added in 7fc5e865b9 but I can't see a reason why this should be forbidden.

  This is also needed for other changes (bumping the minimum python version).

ACKs for top commit:
  hebasto:
    re-ACK fa6054e952

Tree-SHA512: e8ead9ee00079024eb1e8c6e7b31c78cf2a3392159b444765c2ea9a58bed2a7550bf71083210692a45bb8ed7896cb882b72bf70baa13a2384864b2b510b73005
2022-10-04 21:39:29 +01:00
MacroFake
fa6054e952
ci: Allow PIP_PACKAGES on centos
This was added in 7fc5e865b9 but I can't
see a reason why this should be forbidden.
2022-10-04 11:53:31 +02:00
MacroFake
fac085a05c
ci: Remove unused package
Address feedback from https://github.com/bitcoin/bitcoin/pull/24561/files#r985719812
2022-10-04 11:51:33 +02:00
Hennadii Stepanov
ac1d99240a
ci: Move git config commands into script where they are used 2022-10-04 08:51:55 +01:00
MacroFake
d8ded8bc08 ci: Use git2.34 for lint task 2022-09-28 19:58:13 +02:00
Jon Atack
8f2010de6e Bump codespell version to 2.2.1 2022-09-15 12:53:32 +02:00
MacroFake
fa875349e2
Fix iwyu 2022-08-20 09:33:01 +02:00
MacroFake
7d82f86341
Merge bitcoin/bitcoin#25650: script: default to necessary tags in test/get_previous_releases.py
21a9e94dbb ci: remove hardcoded tag list from ci scripts (josibake)
d530ba390e doc: update test/README.md (josibake)
614d4682ba script: default to necessary tags in get_previous_releases.py (josibake)

Pull request description:

  Almost every time I need to use this script, I forget the tag list is needed and that a specific set of tags is needed for the backwards compatibility tests to work. I end up wasting time reading through the script and googling to find the tag list before remembering it is in `test/README.md`

  I assume (hope) I'm not the only one this happens to, so I figured it would make more sense to have the script default to downloading/building the necessary tags. This has the added benefit of making the script the source of truth: the script already needs to be updated with the SHA256_SUM of the binary for every new tag that is added, so it makes sense to use `SHA256_SUMS` list as the necessary tag list. This means there is less risk of the README and the script drifting (i.e updating the readme with a new tag and forgetting to update the script, or updating the script and forgetting to update the README). Now all that needs to happen is to update the `SHA256_SUMS` list in the script and everything Just Works (TM)

ACKs for top commit:
  Sjors:
    re-tACK 21a9e94dbb

Tree-SHA512: 97b488227a89a6827584edd251820a7074fad75dfd7f26f1aa5f858e2521d2e02effd0f11e6dc4676e1155d3d5aba6ff94a4b58ffef80dc201376afd5927deb9
2022-08-05 10:51:06 +02:00
Carl Dong
41c5201a90 validationcaches: Add and use ValidationCacheSizes
Also:

- Make DEFAULT_MAX_SIG_CACHE_SIZE into constexpr
  DEFAULT_MAX_SIG_CACHE_BYTES to utilize the compile-time integer
  arithmetic overflow checking available to constexpr.
- Fix comment (MiB instead of MB) for DEFAULT_MAX_SIG_CACHE_BYTES.
- Pass in max_size_bytes parameter to InitS*Cache(), modify log line to
  no longer allude to maxsigcachesize being split evenly between the two
  validation caches.
- Fix possible integer truncation and add a comment.

[META] I've kept the integer types as int64_t in order to not introduce
       unintended behaviour changes, in the next commit we will make
       them size_t.
2022-08-03 12:03:27 -04:00
MacroFake
ddddd6913b
sort after scripted-diff 2022-08-02 15:31:05 +02:00
MacroFake
fac812ca83
scripted-diff: Move mempool_args to src/node
It is part of the node library. Also, it won't be moved to the kernel
lib, as it will be pruned of ArgsManager.

-BEGIN VERIFY SCRIPT-
 # Move module
 git mv src/mempool_args.cpp src/node/
 git mv src/mempool_args.h   src/node/
 # Replacements
 sed -i 's:mempool_args\.h:node/mempool_args.h:g'     $(git grep -l mempool_args)
 sed -i 's:mempool_args\.cpp:node/mempool_args.cpp:g' $(git grep -l mempool_args)
 sed -i 's:MEMPOOL_ARGS_H:NODE_MEMPOOL_ARGS_H:g'      $(git grep -l MEMPOOL_ARGS_H)
-END VERIFY SCRIPT-
2022-08-02 15:31:01 +02:00
MacroFake
fa468bdfb6
Return optional error from ApplyArgsManOptions
Also pass in a (for now unused) reference to the params.

Both changes are needed for the next commit.
2022-08-02 15:21:50 +02:00
MacroFake
eeb5a94e27
Merge bitcoin/bitcoin#25528: ci: run USDT interface tests in the CI
cc7335edc8 ci: run USDT interface test in a VM (0xb10c)
dba6f82342 test: adopt USDT utxocache interface tests (0xb10c)
220a5a2841 test: hook into PID in tracing tests (0xb10c)

Pull request description:

  Changes a CI task that runs test the previously not run `test/functional/interface_usdt_*.py` functional tests (added in https://github.com/bitcoin/bitcoin/pull/24358).

  This task is run as CirussCI `compute_engine_instance` VM as hooking into the tracepoints is not possible in CirrusCI docker containers (https://github.com/bitcoin/bitcoin/issues/23296#issuecomment-1024920845). We use an unoffical PPA and untrusted  `bpfcc-tools` package in the CI as the Ubuntu jammy and Debian bullseye packages are outdated. We hope use an official package when new Ubuntu/Debian releases are available for the use with Google Compute Engine.

  We make sure to hook into `bitcoind` binaries in USDT interface tests via their PID, instead of their path. This makes sure multiple functional tests running in parallel don't interfere with each other.

  The utxocache USDT interface tests is adopted to a change of the functional test framework that wasn't detected as the tests weren't run in the CI. As the tracepoints expose internals, it can happen that we need to adopt the interface test when internals change. This is a bit awkward, and if it happens to frequently, we should consider generalizing the tests a bit more. For now it's fine, I think.

  See the individual commit messages for more details on the changes.

  Fixes https://github.com/bitcoin/bitcoin/issues/24782
  Fixes https://github.com/bitcoin/bitcoin/issues/23296

  I'd like to hear from reviewers:
  - Are we OK with using the [`hadret/bpfcc`](https://launchpad.net/~hadret/+archive/ubuntu/bpfcc) PPA for now? There is a clear plan when to drop it and as is currently, it could only impact the newly added VM task.
  - ~~Adding a new task increases CI runtime and costs. Should an existing `container` CI task be ported to a VM and reused instead?~~ Yes, see https://github.com/bitcoin/bitcoin/pull/25528#issuecomment-1179509525

ACKs for top commit:
  MarcoFalke:
    cr ACK cc7335edc8

Tree-SHA512: b7fddccc0a77d82371229d048abe0bf2c4ccaa45906497ef3040cf99e7f05561890aef4c253c40e4afc96bb838c9787fae81c8454c6fd9db583276e005a4ccb3
2022-08-01 11:27:29 +02:00
fanquake
3fe58a98d3
tidy: run clang-tidy in quiet mode 2022-07-29 16:12:45 +01:00
fanquake
5671217477
Merge bitcoin/bitcoin#24974: refactor: Make FEELER_SLEEP_WINDOW type safe (std::chrono)
fa74e726c4 refactor: Make FEELER_SLEEP_WINDOW type safe (std::chrono) (MacroFake)
fa3b3cb9b5 Expose underlying clock in CThreadInterrupt (MacroFake)

Pull request description:

  This gets rid of the `value*1000` manual conversion.

ACKs for top commit:
  naumenkogs:
    utACK fa74e726c4
  dergoegge:
    Code review ACK fa74e726c4

Tree-SHA512: 90409c05c25f0dd2f1c4dead78f707ebfd78b7d84ea4db9fcefd9c4958a1a3338ac657cd9e99eb8b47d52d4485fa3c947dce4ee1559fb56ae65878685e1ed9a3
2022-07-26 15:09:21 +01:00
MacroFake
fa2247a9f9
refactor: Make CTransaction constructor explicit
It involves calculating two hashes, so the performance impact should be
made explicit.

Also, add the module to iwyu.
2022-07-25 12:16:54 +02:00
josibake
21a9e94dbb
ci: remove hardcoded tag list from ci scripts 2022-07-21 12:02:08 +02:00
fanquake
cc5b39e44e
ci: better pin to dwarf4 in valgrind job
Use `-gdwarf` and also set CFLAGS. I was seeing Valgrind issues otherwise.
2022-07-21 10:16:46 +01:00
Ryan Ofsky
1e761a0169 ci: Enable IWYU in src/kernel directory
Suggested https://github.com/bitcoin/bitcoin/pull/25308#discussion_r892505713
2022-07-19 16:54:52 -04:00
MacroFake
1111ddeedf
Remove unused includes from dbwrapper.h 2022-07-19 14:32:53 +02:00
MacroFake
fa869ce2c2
Add missing includes to node/chainstate
This is needed for the next commit
2022-07-19 14:12:14 +02:00
glozow
821f5c824f
Merge bitcoin/bitcoin#25487: [kernel 3b/n] Decouple {Dump,Load}Mempool from ArgsManager
cb3e9a1e3f Move {Load,Dump}Mempool to kernel namespace (Carl Dong)
aa30676541 Move DEFAULT_PERSIST_MEMPOOL out of libbitcoinkernel (Carl Dong)
06b88ffb8a LoadMempool: Pass in load_path, stop using gArgs (Carl Dong)
b857ac60d9 test/fuzz: Invoke LoadMempool via CChainState (Carl Dong)
b3267258b0 Move FopenFn to fsbridge namespace (Carl Dong)
ae1e8e3756 mempool: Use NodeClock+friends for LoadMempool (Carl Dong)
f9e8e5719f mempool: Improve comments for [GS]etLoadTried (Carl Dong)
813962da0b scripted-diff: Rename m_is_loaded -> m_load_tried (Carl Dong)
413f4bb52b DumpMempool: Pass in dump_path, stop using gArgs (Carl Dong)
bd4407817e DumpMempool: Use std::chrono instead of weird int64_t arthmetics (Carl Dong)
c84390b741 test/mempool_persist: Test manual savemempool when -persistmempool=0 (Carl Dong)

Pull request description:

  This is part of the `libbitcoinkernel` project: #24303, https://github.com/bitcoin/bitcoin/projects/18

  -----

  This PR moves `{Dump,Load}Mempool` into its own `kernel/mempool_persist` module and introduces `ArgsManager` `node::` helpers in `node/mempool_persist_args`to remove the scattered calls to `GetBoolArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)`.

  More context can be gleaned from the commit messages.

  -----

  One thing I was reflecting on as I wrote this was that in the long run, I think we should probably invert the validation <-> mempool relationship. Instead of mempool not depending on validation, it might make more sense to have validation not depend on mempool. Not super urgent since `libbitcoinkernel` will include both validation and mempool, but perhaps something for the future.

ACKs for top commit:
  glozow:
    re ACK cb3e9a1e3f via `git range-diff 7ae032e...cb3e9a1`
  MarcoFalke:
    ACK cb3e9a1e3f 🔒
  ryanofsky:
    Code review ACK cb3e9a1e3f

Tree-SHA512: 979d7237c3abb5a1dd9b5ad3dbf3b954f906a6d8320ed7b923557f41a4472deccae3e8a6bca0018c8e7a3c4a93afecc502acd1e26756f2054f157f1c0edd939d
2022-07-18 16:09:27 +01:00
fanquake
70d807c355
refactor: integrate no_nul into univalue unitester 2022-07-18 09:15:18 +01:00
Carl Dong
cb3e9a1e3f Move {Load,Dump}Mempool to kernel namespace
Also:
1. Add the newly introduced kernel/mempool_persist.cpp to IWYU CI script
2. Add chrono mapping for iwyu
2022-07-15 12:26:20 -04:00
MacroFake
fa3b3cb9b5
Expose underlying clock in CThreadInterrupt
Overloading sleep_for is not needed, as

* seconds and minutes can be converted to milliseconds by the compiler,
  not needing a duration_cast
* std::condition_variable::wait_for will convert milliseconds to the
  duration type of the underlying clock

So simply expose the clock.
2022-07-13 15:20:49 +02:00
0xb10c
cc7335edc8
ci: run USDT interface test in a VM
Our CI tasks are run by CirrusCI in Docker containers in a Google
Compute Engine based Kubernetes environment. These containers have
limited capabilities - especially CAP_SYS_ADMIN is missing. See
https://github.com/bitcoin/bitcoin/issues/23296#issuecomment-1024920845

We need elevated privileges to hook into the USDT tracepoints. We use a
CirrusCI "compute_engine_instance" (a VM, not a container) where we have
the required privileges. The ubunut-mininmal-2204-lts was choosen with
debian-11 being an alternative. Both pack an outdated 'bpfcc-tools'
package (v0.18.0) from 2020. This version prints warnings to stderr
during BPF bytecode compilation, which causes our functional test runner
to fail. This is fixed in newer verison.

Until debian-12 or a newer Ubuntu release is avaliable as image in GCE
(https://cloud.google.com/compute/docs/images/os-details), we use a
third-party and untrusted PPA that releases up-to-date versions of the
package.

The official iovisor (authors of BCC) PPA is outdated too. An
alternative would be to compile BCC from source in the CI.

Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-07-08 19:41:58 +02:00
fanquake
07f2c25d04
refactor: add most of src/util to iwyu
These files change infrequently, and not much header shuffling is required.

We don't add everything in src/util/ yet, because IWYU makes some
dubious suggestions, which I'm going to follow up with upstream.
2022-07-08 11:06:01 +01:00
MacroFake
bac52a1cfe
Merge bitcoin/bitcoin#25447: fuzz: add low-level target for txorphanage
6eb0909cb7 fuzz: add low-level target for txorphanage (chinggg)

Pull request description:

  This adds a low-level fuzz target for orphan transaction handling by creating random transactions and calling all functions in `TxOrphanage`.
  It cannot simulate real-world `orphan/unorphan` scenarios effectively since it does not maintain any state about the node and the chain. A high-level fuzz target which construct well-designed transaction graphs will be added later.

ACKs for top commit:
  MarcoFalke:
    review ACK 6eb0909cb7 🐈

Tree-SHA512: b4d64f5941df77d13981f75ec170cef6ffabe782797c982ede7f34134be01dc0026dd7c0bee614bc1d64715e90a933d2a8c95974d402e32eaba8e24cc928299e
2022-07-07 14:03:52 +02:00
chinggg
6eb0909cb7 fuzz: add low-level target for txorphanage 2022-07-06 22:13:54 +08:00
sogoagain
31346a3196 [ci] apply cache size limit and print ccache statistics in "ARM64 Android APK" 2022-07-04 22:18:41 +09:00
Hennadii Stepanov
0bb7a1f71d
ci: Improve naming related to "macOS 12 native x86_64" task 2022-06-22 10:15:16 +02:00
fanquake
d873ff96e5
refactor: cleanups post unsubtree'ing univalue
Mostly changes to remove src/univalue exceptions from the various linters,
and the required code changes to make them happy. As well as minor doc
changes.
2022-06-15 12:56:44 +01:00
MacroFake
2ab4a80480
Merge bitcoin/bitcoin#25254: Move minRelayTxFee to policy/settings
fa4068b4e2 Move minRelayTxFee to policy/settings (MacroFake)

Pull request description:

  Seems a bit confusing to put policy stuff into validation, so fix that.

  Also fix includes via `iwyu`.

ACKs for top commit:
  ariard:
    ACK fa4068b, the includes move compiles well locally.
  ryanofsky:
    Code review ACK fa4068b4e2. Make sense to move the global variable to policy/settings and the default constant to policy/policy. Ariard points out other constants that could be moved, which seems fine, but it seems like moving the global variable to be with other related global variables is more significant.

Tree-SHA512: adf9619002610d1877f3aef0a9e6115fc4c2ad64135a3e5100824c650b560c47f47ac28894c6214a50a7888355252a9f6f7cec98c23a771a1964160ef1ca77de
2022-06-07 11:31:10 +02:00
MacroFake
f66633d9cb
Merge bitcoin/bitcoin#25288: test: Reliably don't start itself (lint-all.py runs all tests twice)
f26a496dfd test: clean up all-lint.py (Martin Leitner-Ankerl)
64d72c4c87 test: rename lint-all.py to all-lint.py (Martin Leitner-Ankerl)

Pull request description:

  When running `./test/lint/lint-all.py`, the script runs all tests but
  also calls itself because the comparison with `__file__` doesn't work.

  Comparing resolved paths gives reliable comparison, and lint-all.py doesn't call itself any more

ACKs for top commit:
  laanwj:
    Code review ACK f26a496dfd

Tree-SHA512: b44abdd685f7b48a6a9f48e96d97138b635c31c1c7ab543cb5636b5f49690ccd56fa6fec01ae7fcc16af01a613372ee77632f70c32059919b373aa8051953791
2022-06-07 10:37:34 +02:00
Martin Leitner-Ankerl
64d72c4c87 test: rename lint-all.py to all-lint.py
That way it is impossible for the script to call itself.
2022-06-07 10:22:45 +02:00
Hennadii Stepanov
c47944f4e9
ci: Reuse some configure options in "ARM64 Android APK" task 2022-05-31 18:49:53 +02:00
Hennadii Stepanov
7739438811
ci, android: Update NDK up to r23c 2022-05-31 18:45:13 +02:00
Hennadii Stepanov
ca0c3e5077
ci, android: Update Command-line Tools from 2.1 up to 7.0 2022-05-31 18:43:11 +02:00
Hennadii Stepanov
8790da3c1e
ci: Drop unneeded packages in "ARM64 Android APK" task 2022-05-31 15:48:25 +02:00
MacroFake
fa4068b4e2
Move minRelayTxFee to policy/settings
Also fix includes using iwyu
2022-05-31 15:05:57 +02:00
Hennadii Stepanov
3ffc190321
ci: Install documented packages for "Win64" CI task 2022-05-28 11:34:11 +02:00