aboutsummaryrefslogtreecommitdiff
path: root/src/init
AgeCommit message (Collapse)Author
2023-04-03Merge bitcoin/bitcoin#27254: refactor: Extract util/fs from util/systemfanquake
00e9b97f37e0bdf4c647236838c10b68b7ad5be3 refactor: Move fs.* to util/fs.* (TheCharlatan) 106b46d9d25b5228ef009fbbe6f9a7ae35090d15 Add missing fs.h includes (TheCharlatan) b202b3dd6393b415fa68e18dc49c9431dc6b58b2 Add missing cstddef include in assumptions.h (TheCharlatan) 18fb36367a28819bd5ab402344802796a1248979 refactor: Extract util/fs_helpers from util/system (Ben Woosley) Pull request description: This pull request is part of the `libbitcoinkernel` project https://github.com/bitcoin/bitcoin/issues/24303 https://github.com/bitcoin/bitcoin/projects/18 and more specifically its "Step 2: Decouple most non-consensus code from libbitcoinkernel". This commit was originally authored by empact and is taken from its parent PR #25152. #### Context There is an ongoing effort to decouple the `ArgsManager` used for command line parsing user-provided arguments from the libbitcoinkernel library (https://github.com/bitcoin/bitcoin/pull/25290, https://github.com/bitcoin/bitcoin/pull/25487, https://github.com/bitcoin/bitcoin/pull/25527, https://github.com/bitcoin/bitcoin/pull/25862, https://github.com/bitcoin/bitcoin/pull/26177, and https://github.com/bitcoin/bitcoin/pull/27125). The `ArgsManager` is defined in `system.h`. A similar pull request extracting functionality from `system.h` has been merged in https://github.com/bitcoin/bitcoin/pull/27238. #### Changes Next to providing better code organization, this PR removes some reliance of the tree of libbitcoinkernel header includes on `system.h` (and thus the `ArgsManager` definition) by moving filesystem related functions out of the `system.*` files. There is already a pair of `fs.h` / `fs.cpp` in the top-level `src/` directory. They were not combined with the files introduced here, to keep the patch cleaner and more importantly because they are often included without the utility functions. The new files are therefore named `fs_helpers` and the existing `fs` files are moved into the util directory. Further commits splitting more functionality out of `system.h` are still in #25152 and will be submitted in separate PRs once this PR has been processed. ACKs for top commit: hebasto: ACK 00e9b97f37e0bdf4c647236838c10b68b7ad5be3 Tree-SHA512: 31422f148d14ba3c843b99b1550a6fd77c77f350905ca324f93d4f97b652246bc58fa9696c64d1201979cf88733e40be02d262739bb7d417cf22bf506fdb7666
2023-03-23Merge bitcoin/bitcoin#26957: bench: update logging benchmarksAndrew Chow
8c47d599b87d6b2d43e7d37ce0aaf4f541535bb9 doc: improve -debuglogfile help to be a bit clearer (jonatack) 20d89d6802b67e2b8c864bedf23673d008e3faab bench: document expected results in logging benchmarks (jonatack) d8deba8c36a42481b1c1e73009d7c9cc2cb25f70 bench: add LogPrintfCategory and LogPrintLevel benchmarks (Jon Atack) 102b2033493f0d61e9763d094cb8a0017f7e3a10 bench: order the logging benchmark code by output (Jon Atack) 4b3fdbf6fe20dc70c8dbdaacce161bc4e76b9c84 bench: update logging benchmark naming for clarity (Jon Atack) 4684aa8733e831d7858d43bec4271d5d026ba183 bench: allow logging benchmarks to be order-independent (Larry Ruane) Pull request description: Update our logging benchmarks for evaluating ongoing work like #25203 and refactoring proposals like #26619 and #26697. - make the logging benchmarks order-independent (Larry Ruane) - add missing benchmarks for the `LogPrintLevel` and `LogPrintfCategory` macros that our logging is migrating to; at some later point it should be feasible to drop some of the previous logging benchmarks - update the logging benchmark naming to be clear which benchmark corresponds to which log macro, and update the ordering to be the same as the output - add clarifying documentation to the logging benchmarks - improve the `-debuglogfile` config option help to be clearer; can be tested by running `./src/bitcoind -help | grep -A4 '\-debuglogfile'` Reviewers can run the logging benchmarks with: ```bash ./src/bench/bench_bitcoin -filter='LogP*.*' ``` ACKs for top commit: LarryRuane: ACK 8c47d599b87d6b2d43e7d37ce0aaf4f541535bb9 martinus: code review & tested ACK 8c47d599b87d6b2d43e7d37ce0aaf4f541535bb9, here are my benchmark results: achow101: ACK 8c47d599b87d6b2d43e7d37ce0aaf4f541535bb9 Tree-SHA512: 705f8720c9ceaf14a1945039c7578a0c17a12215cbc44908099af4ac444561c3f95d833c5a91b325cdd4470737d8a01e2da64db2d542dd7c9a3747fbfdbf213e
2023-03-23refactor: Move fs.* to util/fs.*TheCharlatan
The fs.* files are already part of the libbitcoin_util library. With the introduction of the fs_helpers.* it makes sense to move fs.* into the util/ directory as well.
2023-03-23refactor: Extract util/fs_helpers from util/systemBen Woosley
This is an extraction of filesystem related functions from util/system into their own utility file. The background of this commit is an ongoing effort to decouple the libbitcoinkernel library from the ArgsManager defined in system.h. Moving these functions out of system.h allows including them from a separate source file without including the ArgsManager definitions from system.h.
2023-03-07doc: improve -debuglogfile help to be a bit clearerjonatack
2023-02-27refactor: Stop using gArgs global in system.cppRyan Ofsky
Most of the code in util/system.cpp that was hardcoded to use the global ArgsManager instance `gArgs` has been changed to work with explicit ArgsManager instances (for example in https://github.com/bitcoin/bitcoin/pull/20092). But a few hardcoded references to `gArgs` remain. This commit removes the last ones so these functions aren't reading or writing global state.
2023-02-27refactor: Use new GetConfigFilePath functionRyan Ofsky
New function was introduced by willcl-ark <will@256k1.dev> in commit 56e370fbb9413260723c598048392219b1055ad0 from https://github.com/bitcoin/bitcoin/pull/27073 and removes some duplicate code.
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-08-20Update -debug and -debugexclude help docs for severity level loggingJon Atack
2022-08-20Create -loglevel configuration optionklementtan
- add a -loglevel=<level>|<category:level> config option to allow users to set a global -loglevel and category-specific log levels. LogPrintLevel messages with a higher severity level than -loglevel will not be printed in the debug log. - for now, this config option is debug-only during the migration to severity-based logging - update unit and functional tests Co-authored-by: "Jon Atack <jon@atack.com>"
2022-08-04Merge bitcoin/bitcoin#24675: util: Use ArgsManager::GetPathArg more widelyfanquake
b01f336708019f8c8274ea701d3446e4123e7af2 util, refactor: Drop explicit conversion to fs::path (Hennadii Stepanov) 138c668e2b4d64279ddefbe07c1d9b7c3d3c537c util, refactor: Use GetPathArg to read "-rpccookiefile" value (Hennadii Stepanov) 1276090705060fcc97072481c2383bbaaa556194 util, refactor: Use GetPathArg to read "-conf" value (Hennadii Stepanov) Pull request description: This PR is a continuation of bitcoin/bitcoin#24265 and bitcoin/bitcoin#24306. Now the following command-line arguments / configure options been read with the `GetPathArg` method: - `-conf`, also `includeconf` values been normalized - `-rpccookiefile` ACKs for top commit: jarolrod: Code Review ACK b01f336708019f8c8274ea701d3446e4123e7af2 ryanofsky: Code review ACK b01f336708019f8c8274ea701d3446e4123e7af. Changes since last review: just dropping first commit (NormalizedPathFromString) as suggested Tree-SHA512: 2d26d50b73542acdbcc63a32068977b2a49a017d31ca337471a0446f964eb0a6e3e4e3bb1ebe6771566a260f2cae3bc2ebe93b4b523183cea0d51768daab85c9
2022-06-14scripted-diff: Avoid incompatibility with CMake AUTOUIC featureHennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i "s|node/ui_interface|node/interface_ui|g" $(git grep -l "node/ui_interface" ./src) git mv src/node/ui_interface.cpp src/node/interface_ui.cpp git mv src/node/ui_interface.h src/node/interface_ui.h sed -i "s|BITCOIN_NODE_UI_INTERFACE_H|BITCOIN_NODE_INTERFACE_UI_H|g" src/node/interface_ui.h -END VERIFY SCRIPT-
2022-06-02Move init::SanityCheck to kernel::SanityCheckCarl Dong
2022-06-02init: Initialize globals with kernel::Context's lifeCarl Dong
...instead of explicitly calling init::{Set,Unset}Globals. Cool thing about this is that in both the testing and bitcoin-chainstate codepaths, we no longer need to explicitly unset globals. The kernel::Context goes out of scope and the globals are unset "automatically". Also construct kernel::Context outside of AppInitSanityChecks()
2022-05-28compat: remove glibcxx sanity checksfanquake
These checks were added in #4339, (see also #4081), to test our back-compat stubs, however, those stubs no-longer exist (#22930), meaning that these checks are now just testing some specific standard library behaviour, without a particular rationale, or reason, compared to any other standard library functions we use. There has also been some discussion about the sanity checks in the context of the libbitcoinkernel refactoring, see https://github.com/bitcoin/bitcoin/pull/25065#discussion_r880668218. Removing the checks removes the need to worry about atleast the glibcxx checks. Also remove the list of check from the doc in init.h, because it is incomplete, and anyone who wants to know what checks are included can look at the function.
2022-04-21util, refactor: Use GetPathArg to read "-conf" valueHennadii Stepanov
Also "includeconf" values been normalized.
2022-04-20refactor: fix includes in src/initfanquake
2022-03-02Use GetPathArg where possiblePavol Rusnak
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
2022-01-06Add src/node/* code to node:: namespaceRussell Yanofsky
2021-12-22scripted-diff: Rename interfaces::WalletClient to interfaces::WalletLoaderRussell Yanofsky
Name has been confusing since it was introduced, and it was pointed in recent review club as https://bitcoincore.reviews/10102 that it was particularly unclear how interfaces::WalletClient was different from interfaces::Wallet. -BEGIN VERIFY SCRIPT- ren() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } ren WalletClient WalletLoader ren walletClient walletLoader ren wallet_client wallet_loader ren "wallet clients release the wallet" "wallet pointer owners release the wallet" ren "wallet client" "wallet loader" ren "Wallet client" "Wallet loader" -END VERIFY SCRIPT-
2021-12-14refactor: remove unneeded calls to strprintf()fanquake
2021-10-26Merge bitcoin/bitcoin#23006: multiprocess: Add new bitcoin-gui, bitcoin-qt, ↵MarcoFalke
bitcoin-wallet init implementations d5f985e51f2863fda0c0d632e836eba42a5c3e15 multiprocess: Add new bitcoin-gui, bitcoin-qt, bitcoin-wallet init implementations (Russell Yanofsky) Pull request description: Add separate `interfaces::Init` subclasses for `bitcoin-wallet`, `bitcoin-gui`, and `bitcoin-qt` binaries instead of sharing `bitcoind` and `bitcoin-node` init subclasses in different binaries. After this, the new init subclasses can be customized in #10102, so node and wallet code is dropped from the `bitcoin-gui` binary and wallet code is dropped from into the `bitcoin-node` binary. --- This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). ACKs for top commit: lsilva01: reACK d5f985e hebasto: re-ACK d5f985e51f2863fda0c0d632e836eba42a5c3e15, only suggested changes since my [previous](https://github.com/bitcoin/bitcoin/pull/23006#pullrequestreview-787537444) review. Tree-SHA512: 6784210bd9ce3a6fbc66852680d0e9bc513c072dc538aeb7f48cb6a41580d3f567ccef04f975ee767a714a4b05d4d87273e94a79abda1b9c25d5ac4bbe752006
2021-10-05refactor: Block unsafe fs::path std::string conversion callsRussell Yanofsky
There is no change in behavior. This just helps prepare for the transition from boost::filesystem to std::filesystem by avoiding calls to methods which will be unsafe after the transaction to std::filesystem to due lack of a boost::filesystem::path::imbue equivalent and inability to set a predictable locale. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Co-authored-by: Kiminuo <kiminuo@protonmail.com> Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2021-09-16multiprocess: Add new bitcoin-gui, bitcoin-qt, bitcoin-wallet init ↵Russell Yanofsky
implementations Add separate init implementations instead of sharing existing bitcoind and bitcoin-node ones, so they can start to be differentiated in upcoming commits with node and wallet code no longer linked into the bitcoin-gui binary and wallet code no longer linked into the bitcoin-node binary.
2021-08-17Start using init makeNode, makeChain, etc methodsRussell Yanofsky
Use interfaces::Init::make* methods instead of interfaces::Make* functions, so interfaces can be constructed differently in different executables without having to change any code. (So for example bitcoin-gui can make an interfaces::Node pointer that communicates with a bitcoin-node subprocess, while bitcoin-qt can make an interfaces::Node pointer that starts node code in the same process.)
2021-06-10Make SetupServerArgs callable without NodeContextRussell Yanofsky
bitcoin-gui code needs to call SetupServerArgs but will not have a NodeContext object if it is communicating with an external bitcoin-node process.
2021-05-24scripted-diff: Replace `GetDataDir()` calls with `gArgs.GetDataDirNet()` callsKiminuo
-BEGIN VERIFY SCRIPT- git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir()/gArgs.GetDataDirNet()/g'; -END VERIFY SCRIPT-
2021-04-23multiprocess: Add echoipc RPC method and testRussell Yanofsky
Add simple interfaces::Echo IPC interface with one method that just takes and returns a string, to test multiprocess framework and provide an example of how it can be used to spawn and call between processes.
2021-04-23multiprocess: Add bitcoin-node process spawning supportRussell Yanofsky
Add bitcoin-node startup code to let it spawn and be spawned by other processes
2021-04-19Move common package version code to init/commonRussell Yanofsky
2021-04-19Move common logging start code to init/commonRussell Yanofsky
2021-04-19Move common logging GetArgs code to init/commonRussell Yanofsky
2021-04-19Move common logging AddArg code to init/commonRussell Yanofsky
2021-04-19Move common sanity check code to init/commonRussell Yanofsky
2021-04-19Move common global init code to init/commonRussell Yanofsky