Skip to content

Conversation

ryanofsky
Copy link
Contributor

@ryanofsky ryanofsky commented Nov 12, 2021

There are no code changes, this is just adding namespace and using declarations and node:: or wallet:: qualifiers in some places.

Motivations for this change are:

  • To make it easier to see when node and wallet code is being accessed places where it shouldn't be. For example if GUI code is accessing node and wallet internals or if wallet and node code are referencing each other.
  • To make source code organization clearer (#15732), being able to know that wallet:: code is in src/wallet/, node:: code is in src/node/, init:: code is in src/init/, util:: code is in src/util/, etc.

Reviewing with git log -p -n1 -U0 --word-diff-regex=. can be helpful to verify this is only updating declarations, not changing code.

@ryanofsky
Copy link
Contributor Author

Updated 768b695 -> 8c85a48 (pr/names.1 -> pr/names.2, compare) with tweaks to clean up and fix errors in dummy wallet and multiprocess builds https://cirrus-ci.com/task/5598684416049152 and https://cirrus-ci.com/task/6161634369470464

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 13, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24024 (Remove cs_main lock annotation from ChainstateManager.m_blockman by ryanofsky)
  • #23732 (refactor: Remove gArgs from bdb.h and sqlite.h by kiminuo)
  • #23599 (Tidy up RPCTxSerializationFlags by MarcoFalke)
  • #23544 (rpc, wallet: addhdseed, infer seed when importing descriptor with xpub by Sjors)
  • #23417 (wallet, spkm: Move key management from DescriptorScriptPubKeyMan to wallet level KeyManager by achow101)
  • #23373 (test: Parse command line arguments from unit and fuzz tests, make addrman consistency check ratio easier to change by vasild)
  • #23367 (Optimize coin selection by dropping BnB upper limit by S3RK)
  • #23319 (rpc: Return fee and prevout (utxos) to getrawtransaction by dougEfresh)
  • #22341 (rpc: add getxpub by Sjors)
  • #20205 (wallet: Properly support a wallet id by achow101)
  • #19602 (wallet: Migrate legacy wallets to descriptor wallets by achow101)
  • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
  • #10102 (Multiprocess bitcoin by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot mentioned this pull request Nov 13, 2021
Copy link
Contributor

@lsilva01 lsilva01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 8c85a48
The use of namespaces makes the code more organized and clearer.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jan 4, 2022
TODO doesn't really make sense. It would turn some public global
variables into private global variables, but really they shouldn't be
global variables at all. They should be block manager member variables
or chainstate manager member variables.

TODO was added by MarcoFalke <falke.marco@gmail.com> in
fa247a3 in bitcoin#21727 and noticed by Samuel
Dobson <dobsonsa68@gmail.com>
bitcoin#23497 (comment)
@ryanofsky
Copy link
Contributor Author

Rebased 76e3dda -> 4ee6861 (pr/names.13 -> pr/names.14, compare) due to conflicts with #23936 and #23581

@maflcko
Copy link
Member

maflcko commented Jan 5, 2022

If you remove the last commit, a conflict with #23974 can be avoided

@ryanofsky
Copy link
Contributor Author

ryanofsky commented Jan 5, 2022

If you remove the last commit, a conflict with #23974 can be avoided

Sure, dropped commit.

Updated 4ee6861 -> c776907 (pr/names.14 -> pr/names.15, compare) dropping commit
Rebased c776907 -> e5b6aef (pr/names.15 -> pr/names.16, compare) due to conflict with #23974

maflcko pushed a commit that referenced this pull request Jan 6, 2022
…_node.a

172096e scripted-diff: Rename libbitcoin_server.a to libbitcoin_node.a (Russell Yanofsky)

Pull request description:

  Goal along with namespacing PR #23497 is to make code organization more obvious and have `src/node/` code in `node::` namespace in `libbitcoin_node.a` library

ACKs for top commit:
  MarcoFalke:
    cr ACK 172096e

Tree-SHA512: a2e787eeaa3ab769b0f5376473072cae584d237aa8b67b677bea833bb36b0134a0eca17eb01722389639473b8463f4953bc3a5e4801a6b2c8965ac1075cba005
CBlockFileInfo class is declared in src/chain.h, so move ToString
definition to src/chain.cpp instead of src/node/blockstorage.cpp
@achow101
Copy link
Member

ACK e5b6aef

@maflcko
Copy link
Member

maflcko commented Jan 11, 2022

Concept ACK e5b6aef 🍨

Show signature

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Concept ACK e5b6aef61221b621ad77b5f075a16897e08835bf 🍨
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUjJRwv/Ra0FnQ2CgmimyjQbDwPhXhsHl4FbFarePo1urtKhZ/yzz2lVLmwrkcZg
3cfd6brTclPTRxU8D+E8V95fqXLurfM1rZJ9tt380MezX/toYLwhdA1r26k7UR4P
iilscs/uld+uGYCSMjDMWHfWSR6Fz3ckGCdzr1yvMeKi2pbaakd4kF7ICwtDnPOs
BLJatB+aAulZ0bKJWYYdhwgCzqUMrgf0w5ojBJ51TnTMXXburtmSqjcppcDuU3Fy
sVJ4QncxUGBtC0e61hM4zKs88pu4yO72iBkiuTTRfZNoMhM0FZ++Thiw+PB8bULG
nSlQlN5CMllRHs1Yy3JzzTaLkKsFJ5B1/Frrg8yv8AI6+HMwxdN2H/+RA21Grvqi
EZtS9rRPgg8rMB/5cB53/1HPr7tQXtzO2fulFRoJwFEbAV0W0n2fzoFvNu7rpJYJ
hVkO+9Zr8xxCX80gpjplvyV3sK0Zw0G+jOELhxqXmPDyIqgLarhZ7a/tx6asYO+M
em97A1l/
=31o2
-----END PGP SIGNATURE-----

@maflcko maflcko merged commit c561f2f into bitcoin:master Jan 11, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 12, 2022
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Jan 17, 2022
Updated auxpow code for the new namespaces (e.g. where it uses miner
functions that are now in node::), and added the wallet/rpc/auxpow code
to the wallet:: namespace.  This is in relation to upstream
bitcoin/bitcoin#23497.
domob1812 added a commit to domob1812/namecoin-core that referenced this pull request Jan 17, 2022
Updated name code for the new namespaces from upstream
bitcoin/bitcoin#23497.  The wallet/rpc/name code
was added to wallet::.
mzumsande pushed a commit to mzumsande/bitcoin that referenced this pull request Jan 17, 2022
Goal along with namespacing PR bitcoin#23497 is to have src/node/ code in
node:: namespace in libbitcoin_node.a library

-BEGIN VERIFY SCRIPT-
bash -c ' # Bash shell needed for brace expansion {a,b}
git mv build_msvc/libbitcoin_{server,node}
git mv build_msvc/libbitcoin_node/libbitcoin_{server,node}.vcxproj.in
ren() { git grep -l "$1" src build_msvc | xargs sed -i "s/$1/$2/g"; }
ren LIBBITCOIN_{SERVER,NODE}
ren libbitcoin_{server,node}
'
-END VERIFY SCRIPT-
rebroad pushed a commit to rebroad/bitcoin that referenced this pull request Feb 3, 2022
Goal along with namespacing PR bitcoin#23497 is to have src/node/ code in
node:: namespace in libbitcoin_node.a library

-BEGIN VERIFY SCRIPT-
bash -c ' # Bash shell needed for brace expansion {a,b}
git mv build_msvc/libbitcoin_{server,node}
git mv build_msvc/libbitcoin_node/libbitcoin_{server,node}.vcxproj.in
ren() { git grep -l "$1" src build_msvc | xargs sed -i "s/$1/$2/g"; }
ren LIBBITCOIN_{SERVER,NODE}
ren libbitcoin_{server,node}
'
-END VERIFY SCRIPT-
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 5, 2022
Summary:
Overall PR:
> There are no code changes, this is just adding namespace and `using` declarations and `node::` or `wallet::` qualifiers in some places.
>
> Motivations for this change are:
>
>  -  To make it easier to see when node and wallet code is being accessed places where it shouldn't be. For example if GUI code is accessing node and wallet internals or if wallet and node code are referencing each other.
>  -  To make source code organization clearer (core#15732), being able to know that `wallet::` code is in `src/wallet/`, `node:: code` is in `src/node/`, `init::` code is in `src/init/`, `util::` code is in `src/util/`, etc.
>

Notes:
 - CBlockIndexWorkComparator is not part of the node namespace for Bitcoin ABC because it is defined in its own header file rather than src/node/blockstorage.h
 - some fuzzers and minisketchwrapper.* changes are not applicable due to missing backports (see [[bitcoin/bitcoin#23114 | core#23114]]).

This is a partial backport of [[bitcoin/bitcoin#23497 | core#23497]]
bitcoin/bitcoin@90fc8b0

Test Plan: `ninja all check-all bitcoin-fuzzers bench-bitcoin`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12763
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 6, 2022
Summary:
> CBlockFileInfo class is declared in src/chain.h, so move ToString
> definition to src/chain.cpp instead of src/node/blockstorage.cpp

`CBlockFileInfo` was moved to its own header file in D1654, so "where class is declared" is a new blockfileinfo.cpp file.
The class is used in txdb.h and validation.h, which are both in the `server` library, so put this new file in this library as well.

This is a partial backport of [[bitcoin/bitcoin#23497 | core#23497]]
bitcoin/bitcoin@e5b6aef

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D12768
@bitcoin bitcoin locked and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants