net: remove -banscore configuration option #19464

pull jonatack wants to merge 2 commits into bitcoin:master from jonatack:remove-banscore-option changing 7 files +17 −15
  1. jonatack commented at 8:44 am on July 8, 2020: member

    per #19219 (comment), #19219 (review) and #19219 (comment). Edit: now split into 3 PRs:

    • net: remove -banscore configuration option (this PR)
    • rpc: deprecate banscore field in getpeerinfo (#19469)
    • gui, doc, doc: no longer display “Ban Score” in GUI Peers window + test/doc fixups (#19512)
  2. DrahtBot added the label GUI on Jul 8, 2020
  3. DrahtBot added the label P2P on Jul 8, 2020
  4. DrahtBot added the label RPC/REST/ZMQ on Jul 8, 2020
  5. DrahtBot added the label Tests on Jul 8, 2020
  6. DrahtBot added the label Validation on Jul 8, 2020
  7. fanquake removed the label GUI on Jul 8, 2020
  8. fanquake removed the label Tests on Jul 8, 2020
  9. fanquake removed the label Validation on Jul 8, 2020
  10. DrahtBot commented at 11:28 am on July 8, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #14053 (Add address-based index (attempt 4?) by marcinja)

    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.

  11. jonatack force-pushed on Jul 8, 2020
  12. jonatack renamed this:
    net, rpc: remove -banscore option, deprecate banscore in getpeerinfo
    net: remove -banscore configuration option
    on Jul 8, 2020
  13. jonatack marked this as ready for review on Jul 8, 2020
  14. MarcoFalke removed the label RPC/REST/ZMQ on Jul 8, 2020
  15. MarcoFalke added the label Settings on Jul 8, 2020
  16. MarcoFalke removed the label P2P on Jul 8, 2020
  17. MarcoFalke added the label P2P on Jul 8, 2020
  18. fanquake referenced this in commit a4eb6a51a7 on Jul 10, 2020
  19. in doc/release-notes-19464.md:7 in f926882076 outdated
    0@@ -0,0 +1,7 @@
    1+Updated settings
    2+----------------
    3+
    4+- The `-banscore` configuration option, which modified the default threshold for
    5+  disconnecting and discouraging misbehaving peers, has been removed as part of
    6+  changes in this release to the handling of misbehaving peers. Refer to the
    7+  section, "Changes regarding misbehaving peers", for details. (#19464)
    


    MarcoFalke commented at 1:15 pm on July 10, 2020:
    Mind adding this to the main release notes file? There shouldn’t be any conflicts and this is not for backport either.

    jonatack commented at 8:35 am on July 11, 2020:
    Done
  20. MarcoFalke commented at 1:15 pm on July 10, 2020: member
    Concept aCK
  21. sidhujag referenced this in commit 1b2b3e3600 on Jul 10, 2020
  22. fjahr commented at 7:01 pm on July 10, 2020: member
    Concept ACK but the commits are cluttered up with quite a bit of edits that produce unnecessary noise.
  23. jonatack force-pushed on Jul 11, 2020
  24. jonatack commented at 8:38 am on July 11, 2020: member
    Thanks @MarcoFalke and @fjahr for reviewing! Updated with your feedback per git range-diff 505b4ed f926882 b71eac1 for easy re-ACK.
  25. in src/net_processing.h:26 in b71eac1604 outdated
    22@@ -23,6 +23,7 @@ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
    23 static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100;
    24 static const bool DEFAULT_PEERBLOOMFILTERS = false;
    25 static const bool DEFAULT_PEERBLOCKFILTERS = false;
    26+static const int BANSCORE_THRESHOLD = 100;
    


    MarcoFalke commented at 9:26 am on July 11, 2020:
    can be moved to the cpp file and made constexpr?

    jonatack commented at 9:46 am on July 11, 2020:

    can be moved to the cpp file and made constexpr?

    good idea


    jonatack commented at 11:13 am on July 11, 2020:
    Done, then moved it back to the header file to be able to use it in the unit tests. This allowed for some nice improvements there.
  26. MarcoFalke approved
  27. MarcoFalke commented at 9:27 am on July 11, 2020: member

    Do the unit and functional tests pass on ff43c0c49eb087d27cd6ecf6b30fe6f6f96df650

    If not, the following two commits should be squashed into it. Or maybe just squash all commit? :man_shrugging:

    Review-only ACK

  28. jonatack commented at 9:32 am on July 11, 2020: member

    Do the unit and functional tests pass on ff43c0c

    The tests had to be updated for the config removal.

  29. jonatack commented at 9:40 am on July 11, 2020: member

    If not, the following two commits should be squashed into it. Or maybe just squash all commit? man_shrugging

    Review-only ACK

    Thanks for ACKing. I took the time to made atomic commits for different actions, step by step, as seen in other contributors’ changesets and as described in CONTRIBUTING.md and in the wikipedia link it contains.

    0In general, [commits should be atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention)
    1and diffs should be easy to read. For this reason, do not mix any formatting
    2fixes or code moves with actual code changes.
    
  30. MarcoFalke commented at 9:52 am on July 11, 2020: member
  31. jonatack force-pushed on Jul 11, 2020
  32. jonatack commented at 10:11 am on July 11, 2020: member

    Please see the second section of https://www.codewithjason.com/atomic-commits-testing/

    Yes, I agree with this and it has been my standard practice. But AFAIK it’s not what is requested in this project’s documentation, and maybe not the most-observed practice in this project – I had to unlearn my practices to adapt to it.

  33. MarcoFalke commented at 10:13 am on July 11, 2020: member

    But AFAIK it’s not what is requested in this project’s documentation

    Ok, then our documentation is wrong and should be fixed.

  34. jonatack commented at 10:15 am on July 11, 2020: member
    I’ll make the commits hygienic.
  35. MarcoFalke added this to the milestone 0.21.0 on Jul 11, 2020
  36. jonatack force-pushed on Jul 11, 2020
  37. jonatack force-pushed on Jul 11, 2020
  38. jonatack force-pushed on Jul 11, 2020
  39. net: remove -banscore configuration option 1d4024bca8
  40. net: rename DEFAULT_BANSCORE_THRESHOLD to DISCOURAGEMENT_THRESHOLD
    and move it from validation to net processing.
    06059b0c2a
  41. jonatack force-pushed on Jul 11, 2020
  42. jonatack referenced this in commit 93a7b7d9a3 on Jul 13, 2020
  43. in doc/release-notes.md:106 in 06059b0c2a
     98@@ -99,6 +99,11 @@ Build System
     99 Updated settings
    100 ----------------
    101 
    102+- The `-banscore` configuration option, which modified the default threshold for
    103+  disconnecting and discouraging misbehaving peers, has been removed as part of
    104+  changes in this release to the handling of misbehaving peers. Refer to the
    105+  section, "Changes regarding misbehaving peers", for details. (#19464)
    106+
    


    vasild commented at 12:13 pm on July 13, 2020:

    Shouldn’t this be in doc/release-notes-19464.md? doc/developer-notes.md says:

    Release notes should be added to a PR-specific release note file at /doc/release-notes-<PR number>.md


    jonatack commented at 2:23 pm on July 13, 2020:
  44. in src/net_processing.h:27 in 06059b0c2a
    22@@ -23,6 +23,8 @@ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
    23 static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100;
    24 static const bool DEFAULT_PEERBLOOMFILTERS = false;
    25 static const bool DEFAULT_PEERBLOCKFILTERS = false;
    26+/** Threshold for marking a node to be discouraged, e.g. disconnected and added to the discouragement filter. */
    27+static const int DISCOURAGEMENT_THRESHOLD{100};
    


    vasild commented at 12:25 pm on July 13, 2020:
    Maybe worth mentioning what is the unit of this?

    jonatack commented at 2:25 pm on July 13, 2020:
    What unit would you suggest? It’s just a score (see Misbehaving in net_processing.cpp), and expected to be removed (see the links in the PR description).
  45. vasild commented at 12:36 pm on July 13, 2020: member

    Should doc/man/bitcoin-qt.1 and doc/man/bitcoind.1 be updated in this PR (they contain references to -banscore)?

    If this PR gets merged now, it means that Bitcoin Core 0.21 will not recognize the -banscore command line option, is this the intention?

  46. jonatack commented at 2:35 pm on July 13, 2020: member

    Thanks for reviewing, @vasild!

    Should doc/man/bitcoin-qt.1 and doc/man/bitcoind.1 be updated in this PR (they contain references to -banscore)?

    AFAIK the manpages are auto-generated; we don’t edit them in PRs.

    If this PR gets merged now, it means that Bitcoin Core 0.21 will not recognize the -banscore command line option, is this the intention?

    Correct. See the links in the PR description for intention and reasoning behind the removal.

    AFAIK there isn’t a deprecation process here like for the RPC API, so either it’s removed as proposed here, or we add a deprecation warning in the help (which everyone will ignore until the option is removed) for a release or two. Presumably this discouragement scoring will disappear anyway by 0.21 or 0.22 which means the -banscore option won’t do anything.

  47. in doc/release-notes.md:105 in 06059b0c2a
     98@@ -99,6 +99,11 @@ Build System
     99 Updated settings
    100 ----------------
    101 
    102+- The `-banscore` configuration option, which modified the default threshold for
    103+  disconnecting and discouraging misbehaving peers, has been removed as part of
    104+  changes in this release to the handling of misbehaving peers. Refer to the
    105+  section, "Changes regarding misbehaving peers", for details. (#19464)
    


    MarcoFalke commented at 5:24 pm on July 13, 2020:
    0  section, "Changes regarding misbehaving peers" in the 0.20.1 release notes, for details. (#19464)
    

    jonatack commented at 6:58 am on July 14, 2020:
    Oh, good catch.

    jonatack commented at 7:00 am on July 14, 2020:
    Will touch it up in the GUI PR to remove the banscore field, mentioned in the PR description.

    jonatack commented at 8:23 am on July 14, 2020:
    Done, thanks again for seeing that.
  48. MarcoFalke commented at 5:28 pm on July 13, 2020: member

    Ideally everything would go in one swish (including state->nMisbehavior), but that can’t happen because it is still needed for RPC. This is a necessary first step.

    review ACK 06059b0c2a6c2db70c87a7715f8a344a13400fa1 📙

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3review ACK 06059b0c2a6c2db70c87a7715f8a344a13400fa1 📙
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUjlzAv+Mu1M+kc3EzVlpVHUNyR9vN531cYpgnWG+gct6oTejWWTBb8snhDrkAID
     8+J4QbpAVd7LBg6CV2NJAl2I0/mTbcSuA66z9DhPwhptKnzocbxf4qXvj5sBnIxg8
     9MOOcRAz5mGVqTom64t2EOme4qKnGvHQROY4srg/Iaf87+Xeur4qBFLuwezGOG9VH
    10xEXSJlaZ0MM9zhLfuJpAIOE0NYiAwPRWnihCofbspg7Mv3duXiOna4gsF7TXV3LA
    11uR/tLwZaZJkQRugKA0Dd5tBFu4+tPqZQ/blyFyGdbSunHVIJnyvLwA7T/nnz0YSO
    12vcgJn8nFYO/MObhyBgWST0Bv6I/MsaB9it7cQnbXQjDtAAd4oUqeOzH5gbZYRSxy
    13MqSRf/4eKcefvx0o5oIuwlva4HjUIwm68t2rn8lK/nSdERRGILCXE//SaIT9NUCc
    14nbOIVLiQvVembkFWEZMWatZm9ty93a5ImbAY7YvyCBSK6/1vqtUClIXAHLU8+6oM
    152HQc/Pec
    16=/Sro
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 7468957afe68f0b446600d6fe8fc55ac3e9656a9dfb3300c2ac5b7e9c089a92c -

  49. vasild approved
  50. vasild commented at 6:16 pm on July 13, 2020: member
    ACK 06059b0c
  51. in test/functional/p2p_leak.py:73 in 06059b0c2a
    69@@ -70,7 +70,7 @@ class CNodeNoVersionBan(CLazyNode):
    70     # NOTE: implementation-specific check here. Remove if bitcoind ban behavior changes
    71     def on_open(self):
    72         super().on_open()
    73-        for i in range(banscore):
    74+        for _ in range(DISCOURAGEMENT_THRESHOLD):
    


    practicalswift commented at 9:45 pm on July 13, 2020:
    Why the change from 10 to 100 iterations here? :)

    jonatack commented at 4:46 am on July 14, 2020:

    Because we can no longer use -banscore to change the default threshold (see removed line in test: self.extra_args = [['-banscore=' + str(banscore)]]), so we have to use DISCOURAGEMENT_THRESHOLD here for the number of veracks sans version to send.

    Note to self: the words “ban” in this functional test should be updated to “discourage”.

  52. in src/test/denialofservice_tests.cpp:290 in 06059b0c2a
    286@@ -288,7 +287,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
    287     dummyNode1.fSuccessfullyConnected = true;
    288     {
    289         LOCK(cs_main);
    290-        Misbehaving(dummyNode1.GetId(), 100);
    291+        Misbehaving(dummyNode1.GetId(), DISCOURAGEMENT_THRESHOLD - 11);
    


    practicalswift commented at 9:46 pm on July 13, 2020:
    Why the change from 100 to 89 here? :)

    jonatack commented at 4:50 am on July 14, 2020:
    See the two removed -banscore lines of this test, particularly the first one: gArgs.ForceSetArg("-banscore", "111"); // because 11 is my favorite number.
  53. practicalswift commented at 9:48 pm on July 13, 2020: contributor
    Concept ACK: giving users knobs without a recommendation about how/when to use them is not friendly :)
  54. MarcoFalke merged this on Jul 14, 2020
  55. MarcoFalke closed this on Jul 14, 2020

  56. MarcoFalke commented at 6:19 am on July 14, 2020: member
    Oh, I see this section won’t end up in the 0.21 release notes, so might want to clarify at some point
  57. jonatack deleted the branch on Jul 14, 2020
  58. jnewbery commented at 8:39 am on July 14, 2020: member

    post-merge ACK.

    The test BOOST_AUTO_TEST_CASE(DoS_banscore) should be removed entirely. It only existed to test manually testing the -banscore config. Nothing else in the test is untested by the previous DoS_banning test.

  59. jonatack commented at 12:17 pm on July 14, 2020: member

    post-merge ACK.

    The test BOOST_AUTO_TEST_CASE(DoS_banscore) should be removed entirely. It only existed to test manually testing the -banscore config. Nothing else in the test is untested by the previous DoS_banning test.

    Good point @jnewbery. Added the removal to the test change commit in #19512.

  60. sidhujag referenced this in commit b8fc13afe4 on Jul 14, 2020
  61. laanwj referenced this in commit 21209c9cce on Jul 15, 2020
  62. sidhujag referenced this in commit 9de76c71bf on Jul 16, 2020
  63. deadalnix referenced this in commit 91502b3998 on Jan 6, 2021
  64. deadalnix referenced this in commit 59fd163cc4 on Jan 6, 2021
  65. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-05 19:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me