[net] Tighten scope in net_processing#13417
Conversation
src/net_processing.cpp
Outdated
There was a problem hiding this comment.
/** is a doxygen trigger. Seems not needed for this and the below.
|
4950ae2 could be a scripted-diff |
src/net_processing.cpp
Outdated
There was a problem hiding this comment.
I know the developer notes don't clarify what "global" is, but unless you have a reason to remove the prefix, I'd suggest keeping it for now to make the diff smaller?
There was a problem hiding this comment.
This commit could also be broken into 1 minor move commit and one rename scripted-diff.
|
Concept ACK |
Note to reviewers: This pull request conflicts with the following ones:
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. |
|
per reviewer feedback I'll reshape these commits to use more scripted-diffs |
f3574c1 to
c4d7d6c
Compare
src/net_processing.cpp
Outdated
There was a problem hiding this comment.
It's a bit strange to forward-declare these methods when the references aren't to be used prior to the actual definition. Maybe comment each method instead?
There was a problem hiding this comment.
I agree that it seems a bit strange to forward-declare these functions here.
There was a problem hiding this comment.
Agree here as well. Could either just not mention it at all or add a comment in-line to each function?
There was a problem hiding this comment.
Now removed - only remaining forward declarations are the ones strictly necessary for compilation
|
utACK c4d7d6c |
|
I realize that C++ doesn't really have a concept of 'global' for variables; it has storage duration (static, automatic, dynamic) and linkage (internal and external). So the guidelines are confusing here. I would prefer to keep the |
|
What @sipa suggests is in line with @MarcoFalke suggestion (don't remember PR) and
👍 |
src/net_processing.cpp
Outdated
There was a problem hiding this comment.
Commit "[net] Tighten scope in net_processing"
Could not include these changes.
c4d7d6c to
a7502b8
Compare
|
Per reviewer feedback I've dropped the commits that did the s/g_// rename |
ab47453 to
e7d2f78
Compare
| Needs rebase |
|
This needs a trivial rebase. I've tested a rebased branch. Seems good. |
|
Thanks. @jnewbery what commit did you rebase onto? I'll use the same to preserve the validity of your testing |
e7d2f78 to
6f72394
Compare
|
@DrahtBot - rebased |
|
utACK 3339ba2 |
3339ba2 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen) 6690a28 Restrict as much as possible in net_processing to translation unit (Jesse Cohen) 1d4df02 [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen) 02bbc05 Rescope g_enable_bip61 to net_processing (Jesse Cohen) Pull request description: As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing. There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet. This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082
1e3bcd2 [net_processing] Add thread safety annotations (Jesse Cohen) f393a53 Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis (Jesse Cohen) Pull request description: (note that this depends on #13417) This commit fully annotates all globals in net_processing with clang thread safety annotations. Subsequent commits will begin transitioning some of this data away from cs_main into locks that are local to net_processing. Static thread safety analysis should it easier to verify correctness of that process. Tree-SHA512: b47aa410cb9ada21072370176aea9a74c575643fa1ee8cf1d43c8e28675eef17f33e5242ac422f840e8178e132ecb58412034c6334b68f1b57c686df80d4e8e2
3339ba2 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen) 6690a28 Restrict as much as possible in net_processing to translation unit (Jesse Cohen) 1d4df02 [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen) 02bbc05 Rescope g_enable_bip61 to net_processing (Jesse Cohen) Pull request description: As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing. There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet. This is somewhat related to other prs bitcoin#12934 bitcoin#13413 bitcoin#13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082 Signed-off-by: Pasta <[email protected]> # Conflicts: # src/init.cpp # src/net_processing.cpp # src/net_processing.h # src/test/test_dash.cpp
1e3bcd2 [net_processing] Add thread safety annotations (Jesse Cohen) f393a53 Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis (Jesse Cohen) Pull request description: (note that this depends on bitcoin#13417) This commit fully annotates all globals in net_processing with clang thread safety annotations. Subsequent commits will begin transitioning some of this data away from cs_main into locks that are local to net_processing. Static thread safety analysis should it easier to verify correctness of that process. Tree-SHA512: b47aa410cb9ada21072370176aea9a74c575643fa1ee8cf1d43c8e28675eef17f33e5242ac422f840e8178e132ecb58412034c6334b68f1b57c686df80d4e8e2
As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing.
There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet.
This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing