Commit Graph

145 Commits

Author SHA1 Message Date
MarcoFalke
1db9e6ac76
Merge #19979: Replace LockAssertion with AssertLockHeld, remove LockAssertion
0bd1184adf6610c0bd14f4e9a25c0a200e65ae25 Remove unused LockAssertion struct (Hennadii Stepanov)
ab2a44297fd0796bf5797ae2a477e8e56d9c3c12 Replace LockAssertion with a proper thread safety annotations (Hennadii Stepanov)
73f71e19965e07534eb47701f2b23c9ed59ef475 refactor: Use explicit function type instead of template (Hennadii Stepanov)

Pull request description:

  This PR replaces `LockAssertion` with `AssertLockHeld`, and removes `LockAssertion`.

  This PR is compared with alternatives in https://github.com/bitcoin-core/bitcoin-devwiki/wiki/AssertLockHeld-PRs

ACKs for top commit:
  MarcoFalke:
    ACK 0bd1184adf6610c0bd14f4e9a25c0a200e65ae25
  ajtowns:
    ACK 0bd1184adf6610c0bd14f4e9a25c0a200e65ae25
  vasild:
    ACK 0bd1184ad

Tree-SHA512: ef7780dd689faf0bb479fdb97c49bc652e2dd10c148234bb95502dfbb676442d8565ee37864d923ca21a25f9dc2a335bf46ee82c095e387b59a664ab05c0ae41
2024-10-12 20:06:29 +07:00
MarcoFalke
d0a4198166
Merge #21598: refactor: Remove negative lock annotations from globals
fa5eabe72117f6e3704858e8d5b2c57a120258ed refactor: Remove negative lock annotations from globals (MarcoFalke)

Pull request description:

  They only make sense for mutexes that are private members. Until cs_main is a private member the negative annotations should be replaced by excluded annotations, which are optional.

ACKs for top commit:
  sipa:
    utACK fa5eabe72117f6e3704858e8d5b2c57a120258ed
  ajtowns:
    ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed
  hebasto:
    ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed
  vasild:
    ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed

Tree-SHA512: 06f8a200304f81533010efcc42d9f59b8c4d0ae355920c0a28efb6fa161a3e3e68f2dfffb0c009afd9c2501e6a293c6e5a419a64d718f1f4e79668ab2ab1fcdc
2024-10-12 20:06:28 +07:00
MarcoFalke
55114a682e
Merge #19668: Do not hide compile-time thread safety warnings
ea74e10acf17903e44c85e3678853414653dd4e1 doc: Add best practice for annotating/asserting locks (Hennadii Stepanov)
2ee7743fe723227f2ea1b031eddb14fc6863f4c8 sync.h: Make runtime lock checks require compile-time lock checks (Anthony Towns)
23d71d171e6e22ba5e4a909d597a54595b2a2c1f Do not hide compile-time thread safety warnings (Hennadii Stepanov)
3ddc150857178bfb1c854c05bf9b526777876f56 Add missed thread safety annotations (Hennadii Stepanov)
af9ea55a72c94678b343f5dd98dc78f3a3ac58cb Use LockAssertion utility class instead of AssertLockHeld() (Hennadii Stepanov)

Pull request description:

  On the way of transit from `RecursiveMutex` to `Mutex` (see #19303) it is crucial to have run-time `AssertLockHeld()` assertion that does _not_ hide compile-time Clang Thread Safety Analysis warnings.

  On master (65e4ecabd5b4252154640c7bac38c92a3f3a7018) using `AssertLockHeld()` could hide Clang Thread Safety Analysis warnings, e.g., with the following patch applied:
  ```diff
  --- a/src/txmempool.h
  +++ b/src/txmempool.h
  @@ -607,7 +607,7 @@ public:
       void addUnchecked(const CTxMemPoolEntry& entry, setEntries& setAncestors, bool validFeeEstimate = true) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);

       void removeRecursive(const CTransaction& tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
  -    void removeForReorg(const CCoinsViewCache* pcoins, unsigned int nMemPoolHeight, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
  +    void removeForReorg(const CCoinsViewCache* pcoins, unsigned int nMemPoolHeight, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
       void removeConflicts(const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
       void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs);

  ```
  Clang compiles the code without any thread safety warnings.

  See "Add missed thread safety annotations" commit for the actual thread safety warnings that are fixed in this PR.

ACKs for top commit:
  MarcoFalke:
    ACK ea74e10acf 🎙
  jnewbery:
    ACK ea74e10acf17903e44c85e3678853414653dd4e1
  ajtowns:
    ACK ea74e10acf17903e44c85e3678853414653dd4e1

Tree-SHA512: 8cba996e526751a1cb0e613c0cc1b10f027a3e9945fbfb4bd30f6355fd36b9f9c2e1e95ed3183fc254b42df7c30223278e18e5bdb5e1ef85db7fef067595d447
2024-10-12 20:06:28 +07:00
fanquake
237279950b
Merge bitcoin/bitcoin#23001: doc: Enable TLS in links in documentation
9bdda50151dd808cbad094d457bf0ed7939a7c87 Enable TLS in links in documentation (Jeremy Rand)

Pull request description:

  This PR enables TLS in several documentation links, which improves security.

ACKs for top commit:
  fanquake:
    ACK 9bdda50151dd808cbad094d457bf0ed7939a7c87

Tree-SHA512: 9d04d8771a9daf3c3b9914ff324e2eabfdf3ff5ae7f7dc92b84a1f3527010ceb860e73873a8f24d6051763eb472d9ea324ccbd6129a40318a520ca88c05f0586
2024-09-12 20:24:08 +05:30
Kittywhiskers Van Gogh
8020bfa8c1
merge bitcoin#24665: document clang tidy named args 2024-09-03 14:57:50 +00:00
Kittywhiskers Van Gogh
b0d2484a0b
merge bitcoin#23522: Improve fs::PathToString documentation 2024-08-06 18:00:38 +00:00
MarcoFalke
8daef64f04
Merge #20691: ci, doc: Travis CI features and mentions cleanup
95487b055328b590ba83f258de9637ab0f9a2f17 doc: Drop mentions of Travis CI as it is no longer used (Hennadii Stepanov)
09d105ef0f8b4b06bf248721a1209c9e16e9db75 ci: Drop travis_fold feature as Travis CI is no longer used (Hennadii Stepanov)

Pull request description:

  As Travis CI is no longer used, this PR:
  - drops `travis_fold` feature
  - drops mentions of Travis CI in docs

ACKs for top commit:
  MarcoFalke:
    ACK 95487b055328b590ba83f258de9637ab0f9a2f17

Tree-SHA512: 2e259bb8b1e37bcefc1251737bb2716f06ddb57c490010b373825c4e70f42ca38efae69a2f63f21f577d7cee3725b94097bdddbd313f8ebf499281cf97c53cef
2024-03-27 00:48:26 +07:00
Kittywhiskers Van Gogh
83b1c378a0
partial bitcoin#20842: consolidate typo & url fixing
includes:
- e8640849c775efcf202dbd34736fed8d61379c49
2024-02-19 10:17:12 -06:00
Kittywhiskers Van Gogh
f8e4bbb5ce
docs: add missing block of description style not picked up by Doxygen
The changes are a portion of bitcoin#17873, the rest of which is merged
into `developer-notes.md`, leaving this change out for some reason.
2024-02-19 10:17:12 -06:00
Kittywhiskers Van Gogh
bfa8b97731
docs: update Doxygen documentation URLs to doxygen.nl domain
These changes were introduced in bitcoin#15514 (Update Transifex links),
which ordinarily do not apply to Dash as it uses its own Transifex
account but not mentioned in the name are updates to Doxygen URLs.
2024-02-19 10:17:11 -06:00
laanwj
e556af3ef8
Merge bitcoin/bitcoin#24416: doc: Avoid ADL for function calls
52a797bfe5ced4329f2272be417c35730ec8839f doc: Avoid ADL for function calls (Hennadii Stepanov)

Pull request description:

  It happened two times recently, when [ADL](https://en.cppreference.com/w/cpp/language/adl) popped up unexpectedly and brought some confusion:
  - https://github.com/bitcoin/bitcoin/pull/24338/files#r805989994
  > Any idea why this even compiles?
  - https://www.erisian.com.au/bitcoin-core-dev/log-2022-02-18.html#l-51:
  > 2022-02-18T03:24:14  \<dongcarl\> Does anyone know why this compiles? 6d3d2caa37
  > 2022-02-18T03:24:14  \<dongcarl\> GetUTXOStatsWithHasher and MakeUTXOHasher are both in the `kernel::` namespace and I never added a `using` declaration on top...
  > 2022-02-18T03:25:53  \<sipa\> https://en.cppreference.com/w/cpp/language/adl ?

  Let's document our intention to avoid similar cases in the future.

ACKs for top commit:
  laanwj:
    Anyhow, ACK 52a797bfe5ced4329f2272be417c35730ec8839f, there is no need to hold merge up on this, documenting it is a step forward.

Tree-SHA512: f52688b5d8f6130302185206ec6ea4731b099a75294ea2d477901a52d6d58473e3427e658aea408c140c2824c37a0399ec7376aded2a91197895ea52d51f0018
2024-01-19 11:02:23 -06:00
MarcoFalke
8aebca8e19
Merge bitcoin/bitcoin#24808: doc: update RPC argument and field naming guideline in developer notes
8b3f1e30f0f7bcd1a58efe29f57015ce03f64c50 Update RPC argument and field naming guideline in developer notes (Jon Atack)

Pull request description:

  Clarify the doc per the IRC discussion today at https://www.erisian.com.au/bitcoin-core-dev/log-2022-04-08.html#l-229.

ACKs for top commit:
  mzumsande:
    Code Review ACK 8b3f1e30f0f7bcd1a58efe29f57015ce03f64c50 - I agree with the added guideline.

Tree-SHA512: d0d06bc8d9587c0dc72545843097e48a4e27a9437ceca03c71d0aa4a9b8434971014687d8d2dd012b71e92b26d4ad116697365be3f2a8ed14daecfdb1d0982ef
2024-01-02 11:17:47 -06:00
Wladimir J. van der Laan
f706a562a7 Merge #19258: doc: improve subtree check instructions
a4a3fc4cd2e6f53cdffcc2962fd152a4e40c7413 doc: improve subtree check instructions (Sjors Provoost)

Pull request description:

  Running `git-subtree-check.sh` requires adding the subtree repository as a remote. I learned that several years ago and then forgot again.

  This PR also improves the error message if the subtree commit can't be found.

ACKs for top commit:
  laanwj:
    ACK a4a3fc4cd2e6f53cdffcc2962fd152a4e40c7413
  fanquake:
    ACK a4a3fc4cd2e6f53cdffcc2962fd152a4e40c7413 - this looks ok.

Tree-SHA512: 959bd923726c172d17f9f97f8a56988bf2df5a94d3131e5152a66150b941394cee9e82fdc6b86e09c0ba91d123a496599f07ca454212168d8d301738394c12c8
2023-12-06 11:40:14 -06:00
Konstantin Akimov
d9e766a7c5 Merge #18645: [doc] Update thread information in developer docs
808ef36b89ea9ce72116bbd7ee479b984367dc60 [doc] Update thread information in developer docs (John Newbery)

Pull request description:

  - DumpAddresses thread was removed in #5964
  - Shutdown thread was removed in #5679
  - Add new threads (scheduler, RPC worker, indexer, tor control)
  - Small changes to documentation of other threads

ACKs for top commit:
  MarcoFalke:
    ACK 808ef36b89
  hebasto:
    ACK 808ef36b89ea9ce72116bbd7ee479b984367dc60.

Tree-SHA512: 85b6ace7bcc4dee030c63461bef1ded1a9581d4fa249c59f6fcd5d33d89c4357a6b8b35888ce0960f276d397b5e38a21e6c5d4b7b79544827a28c950e097b36d
2023-08-29 22:00:59 -05:00
MarcoFalke
52581d3f2b Merge #18208: rpc: Change RPCExamples to bech32
3e32499909ca8127baaa9b40ad113b25ee151bbd Change example addresses to bech32 (Yusuf Sahin HAMZA)

Pull request description:

  This is a follow-up PR to #18197 that fixes RPCExamples.

  Fixes #18185.

ACKs for top commit:
  MarcoFalke:
    ACK 3e32499909ca8127baaa9b40ad113b25ee151bbd
  jonatack:
    ACK 3e32499

Tree-SHA512: c7a6410ef8b6e169016c2c5eac3e6b9501caabd0e8a0871ec31e56bfc44589f056d3f5cb55b5a13bba36f6c15136c2352f883e30e4dcc0997ffd36b27f9173b9
2023-05-31 18:14:23 -05:00
Sebastian Falbesoner
c06e887385 Merge #18122: rpc: update validateaddress RPCExamples to bech32
rpc: update validateaddress RPCExamples to bech32

also contains the following changes:
- rpc: factor out example bech32 address for RPCExamples
- doc: update developer notes wrt RPCExamples addresses
 (mention the EXAMPLE_ADDRESS constant as an example for an invalid bech32
  address suitable for RPCExamples help documentation)
2023-05-31 18:14:23 -05:00
MarcoFalke
df51c199b4 Merge #17819: doc: developer notes guideline on RPCExamples addresses
42ec4994892e67e3430f867af069aafcc2e08593 doc: developer notes guideline on RPCExamples addresses (Jon Atack)

Pull request description:

  to make explicit the use of invalid addresses for user safety and to encourage
  the use of bech32 addresses by default. See https://github.com/bitcoin/bitcoin/pull/17578#discussion_r361752570 and https://github.com/bitcoin/bitcoin/pull/17578#discussion_r362564492.

  Fix a typo to appease the linter.

ACKs for top commit:
  promag:
    ACK 42ec4994892e67e3430f867af069aafcc2e08593, no strong opinion as whether this belongs to developer notes or not but why not.
  fjahr:
    ACK 42ec499
  michaelfolkson:
    ACK 42ec4994892e67e3430f867af069aafcc2e08593

Tree-SHA512: 64f90e227d256aa194c4fd48435440bdc233a51213dd4a6ac5b05d04263f729c6b4bb5f3afd3b87719b20cb1b159d5a9673d58a11b72823a4a6a16e8a26ae10e
2023-05-31 18:14:23 -05:00
MarcoFalke
fc930dc0f4 Merge #18278: interfaces: Describe and follow some code conventions
3dc27a15242a22b5301904375e5880372e9b7f4d doc: Add internal interface conventions to developer notes (Russell Yanofsky)
1dca9dc4c772fa0a4ec52c4d88b7cd3d243aea7b refactor: Change createWallet, fillPSBT argument order (Russell Yanofsky)
96dfe5ced64979e51649d20555aa182defc80119 refactor: Change Chain::broadcastTransaction param order (Russell Yanofsky)
6ceb21909ce66b7b4762a855889acd46bb6b77f3 refactor: Rename Chain::Notifications methods to be consistent with other interfaces methods (Russell Yanofsky)
1c2ab1a6d29f2c6c065dae4f4a4e2ad1286311b3 refactor: Rename Node::disconnect methods (Russell Yanofsky)
77e4b0657298c715c835d8d2eb11e173852e6815 refactor: Get rid of Wallet::IsWalletFlagSet method (Russell Yanofsky)

Pull request description:

  This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).

  This PR doesn't change behavior at all, it just cleans up code in [`src/interfaces`](https://github.com/bitcoin/bitcoin/tree/master/src/interfaces) to simplify #10102, and [documents](https://github.com/ryanofsky/bitcoin/blob/pr/ipc-conv/doc/developer-notes.md#internal-interface-guidelines) coding conventions there better

ACKs for top commit:
  hebasto:
    re-ACK 3dc27a15242a22b5301904375e5880372e9b7f4d, the only change since the [previous](https://github.com/bitcoin/bitcoin/pull/18278#pullrequestreview-372582146) review is rebasing.
  MarcoFalke:
    ACK 3dc27a15242a22b5301904375e5880372e9b7f4d 🕍

Tree-SHA512: 62e6a0f2488e3924e559d2074ed460b92e7a0a5d98eab492221cb20d59d04bbe32aef2a8aeba5e4ea9168cfa91acd5bc973dce6677be0180bd7a919354df53ed
2023-05-31 12:01:04 -05:00
fanquake
4a9f92059f Merge #17873: doc: Add to Doxygen documentation guidelines
c902c4c0c6a26de8cb69a469503bf4a0bd73903c doc: Add to Doxygen documentation guidelines (Jon Layton)

Pull request description:

  Completes the up-for-grabs PR #16948.

  Changes can be tested here: [doc/developer-notes.md](https://github.com/jonatack/bitcoin/blob/doxygen-developer-notes-improvements/doc/developer-notes.md)

  Co-authored-by: Jon Layton <me@jonl.io>

ACKs for top commit:
  fanquake:
    ACK c902c4c0c6a26de8cb69a469503bf4a0bd73903c - quick read, checked the new links work.
  laanwj:
    ACK c902c4c0c6a26de8cb69a469503bf4a0bd73903c

Tree-SHA512: 3b4cebba23061ad5243b2288c2006bf8527e74c689223825f96a44014875d15b2ab6ff54b8aa342ca657a14cf6ce3ab7d6e25bea5befd91162bc2645a74ddb7e
2023-05-24 12:43:57 -05:00
Kittywhiskers Van Gogh
898fef5c01 merge bitcoin#21404: Remove MakeUnique<T>() 2022-10-20 16:08:45 -05:00
Wladimir J. van der Laan
b3488835af Merge #17044: init: Remove auto-import of bootstrap.dat and associated code
104f7de5934f13b837fcf21f6d6b2559799eabe2 remove old bootstrap relevant code (tryphe)

Pull request description:

  This picks up #15954

  I fixed the code and added at a functional test utilizing the scripts in `contrib/linearize` as suggested by @MarcoFalke .

ACKs for top commit:
  laanwj:
    ACK 104f7de5934f13b837fcf21f6d6b2559799eabe2

Tree-SHA512: acac9f285f9785fcbc3afc78118461e45bec2962f90ab90e9f82f3ad28adc90a44f0443b712458ccf486e46d891eb8a67f53e7bee5fa6d89e4387814fe03f117
2022-08-24 14:29:45 -04:00
Konstantin Akimov
0a951622f1
Bitcoin backport #16227 refactoring CWallet (#4903)
* Add HaveKey and HaveCScript to SigningProvider

* Remove CKeyStore and squash into CBasicKeyStore

* Move HaveKey static function from keystore to rpcwallet where it is used

* scripted-diff: rename CBasicKeyStore to FillableSigningProvider

-BEGIN VERIFY SCRIPT-
git grep -l "CBasicKeyStore" | xargs sed -i -e 's/CBasicKeyStore/FillableSigningProvider/g'
-END VERIFY SCRIPT-

* Move KeyOriginInfo to its own header file

* Move various SigningProviders to signingprovider.{cpp,h}

Moves all of the various SigningProviders out of sign.{cpp,h} and
keystore.{cpp,h}. As such, keystore.{cpp,h} is also removed.

Includes and the Makefile are updated to reflect this. Includes were largely
changed using:
git grep -l "keystore.h" | xargs sed -i -e 's;keystore.h;script/signingprovider.h;g'

* Remove CCryptoKeyStore and move all of it's functionality into CWallet

Instead of having a separate CCryptoKeyStore that handles the encryption
stuff, just roll it all into CWallet.

* Fixed cases of mess CWallet functions with CCryptoKeyStore and conflicts

* Move WatchOnly stuff from SigningProvider to CWallet

* Fixes for lint cirtular dependencies to calm linter

Co-authored-by: Andrew Chow <achow101-github@achow101.com>
2022-07-12 22:46:31 -05:00
fanquake
f286654862 Merge #17752: doc: fix directory path for secp256k1 subtree in developer-notes
a5089f62bda9a39c1d6cbba285477670f1aa1f3f fix directory path for secp256k1 subtree in developer-notes (hackerrdave)

Pull request description:

  Documentation update to fix the directory path of the `secp256k1` subtree in the developer notes

ACKs for top commit:
  laanwj:
    ACK a5089f62bda9a39c1d6cbba285477670f1aa1f3f

Tree-SHA512: d0986721d7091af26edaee769db78c9aabac25bbaddb2a1bfa96c7208187226e280e9c38897b5227ee6c9e40d5a1af86bb7c58e72c6a30a94a478c4bf54c086e
2022-06-14 16:48:08 +07:00
Wladimir J. van der Laan
a334f590ff Merge #17617: doc: unify unix epoch time descriptions
d94d34f05f4ae3efa07de409489d68bbcc216346 doc: update developer notes wrt unix epoch time (Jon Atack)
e2f32cb5c5c7f2b1d1fc7003587b6573fb59526a qa: unify unix epoch time descriptions (Jon Atack)

Pull request description:

  Closes #17613.

  Updated call sites: mocktime, getblockheader, getblock, pruneblockchain,
  getchaintxstats, getblocktemplate, setmocktime, getpeerinfo, setban,
  getnodeaddresses, getrawtransaction, importmulti, listtransactions,
  listsinceblock, gettransaction, getwalletinfo, getaddressinfo

  Commands for testing manually:
  ```
  bitcoind -help-debug | grep -A1 mocktime
  bitcoin-cli help getblockheader
  bitcoin-cli help getblock
  bitcoin-cli help pruneblockchain
  bitcoin-cli help getchaintxstats
  bitcoin-cli help getblocktemplate
  bitcoin-cli help setmocktime
  bitcoin-cli help getpeerinfo
  bitcoin-cli help setban
  bitcoin-cli help getnodeaddresses
  bitcoin-cli help getrawtransaction
  bitcoin-cli help importmulti
  bitcoin-cli help listtransactions
  bitcoin-cli help listsinceblock
  bitcoin-cli help gettransaction
  bitcoin-cli help getwalletinfo
  bitcoin-cli help getaddressinfo
  ```

ACKs for top commit:
  laanwj:
    re-ACK d94d34f05f4ae3efa07de409489d68bbcc216346

Tree-SHA512: 060713ea4e20ab72c580f06c5c7e3ef344ad9c2c9cb034987d980a54e3ed2ac0268eb3929806daa5caa7797c45f5305254fd499767db7f22862212cf77acf236
2022-06-08 12:35:11 +07:00
Kittywhiskers Van Gogh
6d8839473c merge bitcoin#20255: Add Assume() identity function 2022-05-13 18:06:06 +05:30
UdjinM6
eb42d8eee4
Merge pull request #4749 from PastaPastaPasta/develop-trivial-2022-04-03-pr2
trivial backports 2022 04 03 pr2
2022-04-07 13:17:05 +03:00
fanquake
87caa91a99 Merge bitcoin/bitcoin#22409: configure: keep relative paths in debug info
0bc666b053b8f4883c3f5de43959e2bbd91b95c5 doc: add info for debugging with relative paths (S3RK)
a8b515c317f0b5560f62c72a8f4eb6560d8f1c75 configure: keep relative paths in debug info (S3RK)

Pull request description:

  This is a follow-up for #20353 that fixes #21885

  It also adds a small section to assist debugging without absolute paths in debug info.

ACKs for top commit:
  kallewoof:
    Tested ACK 0bc666b053b8f4883c3f5de43959e2bbd91b95c5
  Zero-1729:
    Light crACK 0bc666b053b8f4883c3f5de43959e2bbd91b95c5

Tree-SHA512: d4b75183c3d3a0f59fe786841fb230581de87f6fe04cf7224e4b89c520d45513ba729d4ad8c0e62dd1dbaaa7a25741f04d036bc047f92842e76c9cc31ea47fb2
2022-04-03 18:41:33 -05:00
MarcoFalke
f40055446b Merge bitcoin/bitcoin#21930: doc: update enumerator naming in developer notes
77f37f58ad2f349cecb2eda28b415267d3d7d76e doc: update enum naming in developer notes (Jon Atack)

Pull request description:

  Per our current doc, the general rule is we follow the C++ Core Guidelines, which for enumerator naming stipulate:

  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps
  ```
  Don’t use ALL_CAPS for enumerators
  Reason: Avoid clashes with macros.
  ```

  but our examples (and often, codebase) are contradictory to it (and perhaps to common usage), which can be confusing when a contributor needs to choose a style to use. This patch:

  - updates the enumerator examples to snake_case per CPP Core Guidelines
  - clarifies for contributors that in this project enumerators may be snake_case, PascalCase or ALL_CAPS, and to use what seems appropriate.

ACKs for top commit:
  practicalswift:
    cr ACK 77f37f58ad2f349cecb2eda28b415267d3d7d76e
  ryanofsky:
    ACK 77f37f58ad2f349cecb2eda28b415267d3d7d76e. I think this is good because it modernizes the example and clarifies current conventions.
  promag:
    ACK 77f37f58ad2f349cecb2eda28b415267d3d7d76e.

Tree-SHA512: 7facc607fe5e1abab0f635864340143f13c2e4bb074eb17eac7d829dcd0cf244c5c617fc49d35e8774e8af1fa1205eeebe0cca81f538a2a61f6a7ba200878bc6
2022-04-03 18:41:05 -05:00
Wladimir J. van der Laan
a61b615218 Merge #19367: doc: Span pitfalls
fab57e2b9bc4577fcfcd9fbddbc35d96046c5d88 doc: Mention Span in developer-notes.md (Pieter Wuille)
3502a60418858a8281ddf2f9cd59daa8f01d2fa8 doc: Document Span pitfalls (Pieter Wuille)

Pull request description:

  This is an attempt to document pitfalls with the use of `Span`, following up on comments like https://github.com/bitcoin/bitcoin/pull/18468#issuecomment-622846597 and https://github.com/bitcoin/bitcoin/pull/18468#discussion_r442998211

ACKs for top commit:
  laanwj:
    ACK fab57e2b9bc4577fcfcd9fbddbc35d96046c5d88

Tree-SHA512: 8f6f277d6d88921852334853c2b7ced97e83d3222ce40c9fe12dfef508945f26269b90ae091439ebffddf03f939797cb28126b2387f77959069ef8909c25ab53
2022-04-03 18:09:07 -05:00
MarcoFalke
f80a99c3b0
Merge #17833: doc: Added running functional tests in valgrind
155a11f897c7dfdc891587cc7ddd7c153cbc2a8f doc: Added running functional tests in valgrind (Elichai Turkel)

Pull request description:

  Technically the notes only show an "example" of how to run valgrind with the suppression file,
  but now that https://github.com/bitcoin/bitcoin/pull/17633 is merged then maybe this can encourage more people to run also the functional tests in valgrind

Top commit has no ACKs.

Tree-SHA512: b8417249b720d0ed5e10b732648f2e07e8889bfc7aa7e94192d1c049b4b7837971678d30c535f273c227848f1290cf11e14369fd6c1924b734f2e47e2af41401
2022-04-03 12:58:55 +05:30
fanquake
db662cf843
Merge #17134: doc: Add switch on enum example to developer notes
c8961c7d9fed07190628cf01f9dfad971a942b99 doc: Add switch on enum example (Hennadii Stepanov)
11e3d5eb1d4a4b399b180083ec52484d53ebf724 util: Add AllowShortCaseLabelsOnASingleLine option (Hennadii Stepanov)

Pull request description:

  This PR documents a recurring issue:
  - #15938
  - #17105

ACKs for top commit:
  laanwj:
    Seems like good advice to me. ACK c8961c7d9fed07190628cf01f9dfad971a942b99
  practicalswift:
    ACK c8961c7d9fed07190628cf01f9dfad971a942b99
  promag:
    ACK c8961c7d9fed07190628cf01f9dfad971a942b99, no excuse now, thanks!

Tree-SHA512: 530da5117094ed1bfaa6e447089521bd2c86b0742758dbacec4e4f934dc07b0e24f15a1448c4d58e49905e8fd3797d87bcae5669a346d33ed4c2878a04891699
2022-04-02 09:19:20 +05:30
Munkybooty
926d4a774f
lint: Fix typos flagged by codespell (#4639) 2021-12-29 00:45:54 +03:00
fanquake
27dfe903e4
Merge bitcoin/bitcoin#18568: doc: Clarify developer notes about constant naming
05f9770c1fa64bd9730cd6e18ec333e0801c00d6 doc: Clarify developer notes about constant naming (Russell Yanofsky)

Pull request description:

  I'm pretty sure developer notes were intended to say constants should be upper case and variables should be lower case, but right now they are ambiguous about whether to write:

  ```c++
  extern const int SYMBOL;
  ```

  or:

  ```c++
  extern const int g_symbol;
  ```

  First convention above is better than the second convention because it tells you without having to look anything up that the value of `SYMBOL` won't change at runtime. Also I haven't seen other c++ projects using the second convention.

ACKs for top commit:
  MarcoFalke:
    cr ACK 05f9770c1fa64bd9730cd6e18ec333e0801c00d6
  practicalswift:
    ACK 05f9770c1fa64bd9730cd6e18ec333e0801c00d6
  jarolrod:
    ACK 05f9770c1fa64bd9730cd6e18ec333e0801c00d6 🥃

Tree-SHA512: 766d0e25d9db818d45df4ad6386987014f2053584cbced4b755ceef8bda6b7e2cfeb34eb8516423bd03b140faaf577614d5e3be2799f7eed0eb439187ab85323
2021-12-28 00:27:11 -05:00
fanquake
d202707939
Merge #17539: doc: Update and improve Developer Notes
794fe91395c79f46a6d920bc08de5a0551b359a3 doc: Update and improve Developer Notes (Hennadii Stepanov)

Pull request description:

  This PR:
  - removes outdated things, e.g., global pointer `pwalletMain` etc
  - adds "Sanitizers" to the TOC
  - makes filenames, `peer.dat` and `debug.log`, monospaced
  - specifies that _compile-time_ constant names are all uppercase
  - rewords using `explicit` with constructors

ACKs for top commit:
  jamesob:
    lazy ACK 794fe91395
  practicalswift:
    ACK 794fe91395c79f46a6d920bc08de5a0551b359a3 -- nice improvements!

Tree-SHA512: 2c5f035b1627f5fac8dc2453199d9e46bd101f86771de567cd95698de3c61cc459444ec1a68710e1d280195e1e40b42d9f40906297d12f12bf37749eca58297d
2021-12-28 00:27:08 -05:00
fanquake
a4e2c74b50 Merge #16530: doc: Fix grammar and punctuation in developer notes
b2ea20d3302275a62bbdfdb96169c6788fe7b9c1 doc: Fix grammar and punctuation in developer notes (Kristian Kramer)

Pull request description:

  This pull request is regarding minor grammar and punctuation errors in the developer notes. There were no modifications to the existing code, only alterations to fix the grammar and punctuation in the text to make the developer notes more understandable and easier to read.

ACKs for top commit:
  fanquake:
    ACK b2ea20d3302275a62bbdfdb96169c6788fe7b9c1

Tree-SHA512: eef990b7e7645b44a1ab0b057f4df35894c307fd23cc861a10d3cc80e7fe7fe8f5b94467f8224cc8a7aaa226f82be3a1f0460a45f3e25e5dab1e1d333c9edbc0
2021-11-30 00:01:38 -05:00
Wladimir J. van der Laan
617941fd8b
Merge #15642: [rpc] Remove deprecated rpc warnings
947f73ceba7d74153fe83b538e42be1dfe77aea4 [docs] remove reference to signrawtransaction in the developer docs. (John Newbery)
7b6616b78bd9f76502002db1a209a0363979e506 [rpc] Remove deprecated functionality message from validateaddress help (John Newbery)
839c3f7c4937eb8a3e1e5ab2dafff26688af1078 [rpc] Remove signrawtransaction warning (John Newbery)

Pull request description:

  Removes some deprecated code from the RPCs:

  - signrawtransaction was deprecated in 0.17 and removed in 0.18. A warning message was left in place to advise users to use signrawtransactionwithwallet and signrawtransactionwithkey. That warning can now be removed.
  - validateaddress had some functionality deprecated in 0.17 and removed in 0.18. The help text for that functionality was not removed in 0.18 and can be removed now.

Tree-SHA512: 981678a697954ff2c392752e5a183b4b12c4eb94f55766ee1aa97a70d300668237db8fc5748c2772869d0155ba4a93e38817887b98160ee972a6f6ee94e3f7d9
2021-10-16 06:23:15 +05:30
fanquake
53b2f81892
Merge #16186: doc/lint: Fix spelling errors identified by codespell 1.15.0
b748bf6f50dda6bb57eadf697edc320b2695e01a Fix spelling errors identified by codespell 1.15.0 (Ben Woosley)

Pull request description:

  Note all changes are to comments / documentation.

  After this commit, the only remaining output is:

  ```
    $ test/lint/lint-spelling.sh
    src/test/base32_tests.cpp:14: fo  ==> of, for
    src/test/base64_tests.cpp:14: fo  ==> of, for
    ^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/lint-spelling.ignore-words.txt
  ```

  Note:
  * I ignore several valid alternative spellings ~, but changed homogenous
  to homogeneous as the latter is a more specific term according to the
  Google dictionary definitions I found~
  * homogenous is present in tinyformat, hence should be addressed upstream
  * process' is correct only if there are plural processes

ACKs for commit b748bf:
  practicalswift:
    ACK b748bf6f50dda6bb57eadf697edc320b2695e01a
  fanquake:
    ACK b748bf6f50

Tree-SHA512: 9add7044643ce015e0a44d8b27a3f300d72c485ffff550fb6491a17f14528085289ec5caddfe02f291ea9b2cded38a0dd3079652a054e2d7fe2ff4f7b53db5d7
2021-10-05 20:34:00 +03:00
Wladimir J. van der Laan
46c3eaab48
Merge #17281: doc: Add developer note on c_str()
1cf9b35c0dac5f685b7ae62ded16284803816570 doc: Add developer note on c_str() (Wladimir J. van der Laan)

Pull request description:

  Add a note when to use and when not to use `c_str()`.

ACKs for top commit:
  elichai:
    ACK 1cf9b35c0dac5f685b7ae62ded16284803816570
  MarcoFalke:
    Looking nice ACK 1cf9b35c0dac5f685b7ae62ded16284803816570

Tree-SHA512: 38cb5e54695782c23a82d03db214a8999b5bb52553f4fbe5322281686f42616981a217ba987feb6d87f3e6b95919cadd8484efe69ecc364ba1731aaf173626c9
2021-09-15 13:54:39 -04:00
MarcoFalke
1c7188fab1
Merge #15922: doc: Explain how to pass in non-fundamental types into functions
faede747b3 doc: Explain how to pass in non-fundamental types into functions (MarcoFalke)

Pull request description:

  There is a common misconception in C++ that one ampersand is better than no ampersand and two ampersands are better than one.

ACKs for commit faede7:
  practicalswift:
    ACK faede747b3493544f25d601b8e02c833e54c8751
  jonasschnelli:
    ACK faede747b3493544f25d601b8e02c833e54c8751

Tree-SHA512: be12c23287398e4525f16e13de30e51a42d9e38284644eed5b67fa23197b09436d75a3aa8db08555ee91a38a0f159d2722b8a9927ce0bc906e600d2a7976086b
2021-09-12 14:15:10 -04:00
Wladimir J. van der Laan
86de06e86a Merge #15243: [doc] add notes on release notes
65bc38d1c1f666e2c2d773111921b115d4249563 [doc] add notes on release notes (John Newbery)

Pull request description:

  Explains when and how release notes should be written.

Tree-SHA512: 94085d5a30499f41e6d1821b9f157aea40b3cff61a8ba606fed1b239e794ffe6769f985f53400715d712d12aadaa8db8cfca08dd1700a1fe17df86e0e554eac2
2021-08-24 19:14:50 -04:00
MarcoFalke
33384816b5 Merge #14519: tests: add utility to easily profile node performance with perf
13782b8ba8 docs: add perf section to developer docs (James O'Beirne)
58180b5fd4 tests: add utility to easily profile node performance with perf (James O'Beirne)

Pull request description:

  Adds a context manager to easily (and selectively) profile node performance during functional test execution using `perf`.

  While writing some tests, I encountered some odd bitcoind slowness. I wrote up a utility (`TestNode.profile_with_perf`) that generates performance diagnostics for a node by running `perf` during the execution of a particular region of test code.

  `perf` usage is detailed in the excellent (and sadly unmerged) https://github.com/bitcoin/bitcoin/pull/12649; all due props to @eklitzke.

  ### Example

  ```python
  with node.profile_with_perf("large-msgs"):
      for i in range(200):
          node.p2p.send_message(some_large_msg)
      node.p2p.sync_with_ping()
  ```

  This generates a perf data file in the test node's datadir (`/tmp/testtxmpod0y/node0/node-0-TestName-large-msgs.perf.data`).

  Running `perf report` generates nice output about where the node spent most of its time while running that part of the test:

  ```bash
  $ perf report -i /tmp/testtxmpod0y/node0/node-0-TestName-large-msgs.perf.data --stdio \
    | c++filt \
    | less

  # To display the perf.data header info, please use --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 135  of event 'cycles:pp'
  # Event count (approx.): 1458205679493582
  #
  # Children      Self  Command          Shared Object        Symbol
  # ........  ........  ...............  ...................  ........................................................................................................................................................................................................................................................................
  #
      70.14%     0.00%  bitcoin-net      bitcoind             [.] CNode::ReceiveMsgBytes(char const*, unsigned int, bool&)
                  |
                  ---CNode::ReceiveMsgBytes(char const*, unsigned int, bool&)

      70.14%     0.00%  bitcoin-net      bitcoind             [.] CNetMessage::readData(char const*, unsigned int)
                  |
                  ---CNetMessage::readData(char const*, unsigned int)
                     CNode::ReceiveMsgBytes(char const*, unsigned int, bool&)

      35.52%     0.00%  bitcoin-net      bitcoind             [.] std::vector<char, zero_after_free_allocator<char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, zero_after_free_allocator<char> > >, unsigned long, char const&)
                  |
                  ---std::vector<char, zero_after_free_allocator<char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, zero_after_free_allocator<char> > >, unsigned long, char const&)
                     CNetMessage::readData(char const*, unsigned int)
                     CNode::ReceiveMsgBytes(char const*, unsigned int, bool&)

  ...
  ```

Tree-SHA512: 9ac4ceaa88818d5eca00994e8e3c8ad42ae019550d6583972a0a4f7b0c4f61032e3d0c476b4ae58756bc5eb8f8015a19a7fc26c095bd588f31d49a37ed0c6b3e
2021-08-18 22:24:36 -03:00
Wladimir J. van der Laan
debac13960 Partial Merge #14831: Scripts and tools: Use #!/usr/bin/env bash instead of #!/bin/bash.
688f665a5e526fda0fb797bf617412fe9cbe64fd Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes. (vim88)

Pull request description:

  As it was discussed in [#13510](https://github.com/bitcoin/bitcoin/pull/13510), it is better to use `#!/usr/bin/env bash` instead of `#!/bin/bash`.

Tree-SHA512: 25f71eb9a6a0cdc91568b5c6863205c5fe095f77a69e633503a2ac7805bd9013af8538e538c0c666ce96a28e3f43ce7a8df5f08d4ff007723bb588d85674f2da
2021-08-15 11:08:08 -04:00
MarcoFalke
fc40144859 Merge #14395: Fix typos and cleanup
4a9f064ea1 Fix typos (Dimitris Apostolou)

Pull request description:

Tree-SHA512: 011133fb524c3c3cfd272aad0fe9103192b1cc00ac8b14d5b224368fffdb3893e8a19fe281e59ea1aba81bd5e5ab4b7b2de5c3f269e4a7aee66959727cd82cec

# Conflicts:
#	doc/init.md
2021-07-22 16:02:34 -04:00
UdjinM6
95f89eec56
Fix more spelling errors 2021-07-19 12:52:03 -05:00
MarcoFalke
289c8772a8 Merge bitcoin/bitcoin#22204: doc: remove obsolete okSafeMode RPC guideline from developer notes
6780a095d8526a46c3c2b20a14831687e9fc2462 doc: remove obsolete `okSafeMode` RPC guideline from developer notes (Sebastian Falbesoner)

Pull request description:

  Since the flag has been removed from the RPC command table in commit ec6902d0ea (PR #11179), this guideline is not relevant anymore and can be removed.

ACKs for top commit:
  MarcoFalke:
    ACK 6780a095d8526a46c3c2b20a14831687e9fc2462. Also, safe mode was removed completely in commit 2ae705d841

Tree-SHA512: 2a6b002ae302e979ce403171b79a892e32f5083792c3b0b8204edb5eb08c6b24ab77bbeeae0e3bb6d6564a6f1678cfce00eb7b5b82063b7741f89a96b0c0aef3
2021-07-15 19:39:10 -05:00
MarcoFalke
5a7e219d81 Merge #20986: docs: update developer notes to discourage very long lines
aa929abf8dc022e900755234c857541faeea8239 [docs] Update developer notes to discourage very long lines (John Newbery)

Pull request description:

  Mandatory rules on line lengths are bad - there will always be cases where a longer line is more readable than the alternative.

  However, very long lines for no good reason _do_ hurt readability. For example, this declaration in validation.h is 274 chars:

  ```c++
      bool ConnectTip(BlockValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock, ConnectTrace& connectTrace, DisconnectedBlockTransactions& disconnectpool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
  ```

  That won't fit on one line without wrapping on my 27" monitor with a comfortable font size. Much easier to read is something like:

  ```c++
      bool ConnectTip(BlockValidationState& state, const CChainParams& chainparams,
                      CBlockIndex* pindexNew, const std::shared_ptr<const CBlock>& pblock,
                      ConnectTrace& connectTrace, DisconnectedBlockTransactions& disconnectpool)
          EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool.cs);
  ```

  Therefore, _discourage_ (don't forbid) line lengths greater than 100 characters in our developer style guide.

  100 chars is somewhat arbitrary. The old standard was 80, but that seems very limiting with modern displays.

ACKs for top commit:
  fanquake:
    ACK aa929abf8dc022e900755234c857541faeea8239 - this is basically just something to point too when a PR has unreasonably long lines for no particularly reason.
  practicalswift:
    ACK aa929abf8dc022e900755234c857541faeea8239
  amitiuttarwar:
    ACK aa929abf8dc022e900755234c857541faeea8239
  theStack:
    ACK aa929abf8dc022e900755234c857541faeea8239
  glozow:
    ACK aa929abf8d

Tree-SHA512: 17f1b11f811137497ede8851ede93fa612dc622922b5ad7ac8f065ea026d9a718db5b92325754b74d24012b4d45c4e2cd5cd439a6a8d34bbabf5da927d783970
2021-07-15 19:39:10 -05:00
Kittywhiskers Van Gogh
da33c9619c
partial merge #17398: Update leveldb to 1.22+ (#4230)
* Update to leveldb upstream using subtree merge

* Import crc32c using subtree merge as as 'src/crc32c'

* build: Update build system for new leveldb

Upstream leveldb switched build systems, which means we need to define
a few different values.

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* doc: Add crc32c subtree to developer notes

* test: Add crc32c to subtree check linter

* test: Add crc32c exception to various linters and generation scripts

* build: Add LCOV exception for crc32c

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>

* build: CRC32C build system integration

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-07-15 15:42:55 -05:00
fanquake
f74aea23f1
Merge #18577: doc: Correct scripted-diff example link
478c11dde326e2ff0480c14f76f9f6b52a7bdfd0 Correct scripted-diff example link (Yahia Chiheb)

Pull request description:

ACKs for top commit:
  fanquake:
    ACK 478c11dde326e2ff0480c14f76f9f6b52a7bdfd0

Tree-SHA512: 3bc741a79db9bd7abb17ef11f697b768565ec01303a5823ee6a7d8dfa6e888a99a15e9eda69f97a912abc3fd56a54f698f9a580596511bc9bcf62a6870b273f6
2021-07-14 18:44:45 -05:00
Wladimir J. van der Laan
41aba0a27a Merge #17411: doc: Add some better examples for scripted diff
adbe15504713ddba6e9c024c59d977675d49e350 doc: Add some better examples for scripted diff (Wladimir J. van der Laan)

Pull request description:

  The current example isn't too great, for example it uses `find` instead of `git ls-files`. Add a subsection with suggestions and examples.

  Feel free to propose some other great examples to add.

ACKs for top commit:
  hebasto:
    re-ACK adbe15504713ddba6e9c024c59d977675d49e350

Tree-SHA512: 38f03716a122a1791c93abc052ea7572a3d2108b3d0d93dc95d3c4a7eb190c6b639d1cc66e4f74d378c4b11d6951dbd901d0973792f8f13cbeb9d9dcf4f8e037
2021-07-13 20:43:16 -05:00
UdjinM6
3004c3498b
Merge pull request #4245 from PastaPastaPasta/backport-triv-pr9
backport: 'trivial' pr9
2021-07-14 02:52:00 +03:00