Skip to content

Conversation

jnewbery
Copy link
Contributor

Continues the work of moving net_processing logic into PeerLogicValidation. See #19704 and #19607 (comment) for motivation.

This PR also renames PeerLogicValidation to PeerManager as suggested in #10756 (review).

@theStack
Copy link
Contributor

The PR title only addresses one of the many commits (the last one), I assume you either wanted to only include this commit or change the title to be more general to also include all other changes.

@jnewbery
Copy link
Contributor Author

The PR title only addresses one of the many commits (the last one), I assume you either wanted to only include this commit or change the title to be more general to also include all other changes.

The object of this PR is to move Misbehaving to PeerLogicValidation. The other commits are necessary to do that because they all eventually call in to Misbehaving: https://doxygen.bitcoincore.org/net__processing_8cpp.html#ad2983e754c4d90bd68adf91b208664f5

@theStack
Copy link
Contributor

The PR title only addresses one of the many commits (the last one), I assume you either wanted to only include this commit or change the title to be more general to also include all other changes.

The object of this PR is to move Misbehaving to PeerLogicValidation. The other commits are necessary to do that because they all eventually call in to Misbehaving: https://doxygen.bitcoincore.org/net__processing_8cpp.html#ad2983e754c4d90bd68adf91b208664f5

Thanks for clarifying, that makes sense. (And it's the first time in my life that a generated caller graph by Doxygen actually is of any help and not confusing ;-))
Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 24, 2020

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

Conflicts

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.

@maflcko
Copy link
Member

maflcko commented Aug 25, 2020

Concept ACK

@maflcko
Copy link
Member

maflcko commented Aug 26, 2020

( Note to myself: commit eb17009 with this diff #19704 (comment) should pass the unit tests again )

@jnewbery
Copy link
Contributor Author

( Note to myself: commit eb17009 with this diff #19704 (comment) should pass the unit tests again )

Thanks @MarcoFalke . I've cherrypicked that commit into this branch, which reduced further the number of parameters in some of these moved functions.

@jnewbery jnewbery force-pushed the 2020-08-misbehaving-in-plv branch from 072bee4 to f062ca2 Compare August 28, 2020 17:41
@jnewbery
Copy link
Contributor Author

Rebased

@practicalswift
Copy link
Contributor

Concept ACK

@maflcko
Copy link
Member

maflcko commented Aug 29, 2020

Almost ACK. Please use a scripted diff where appropriate:

 7:  534b4a2d86 !  7:  fffffffffff [net processing] Rename PeerLogicValidation to PeerManager
    @@ Metadata
     Author: John Newbery <john@johnnewbery.com>
     
      ## Commit message ##
    -    [net processing] Rename PeerLogicValidation to PeerManager
    +    scripted-diff: [net processing] Rename PeerLogicValidation to PeerManager
    +
    +    -BEGIN VERIFY SCRIPT-
    +    sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l PeerLogicValidation ./src ./test)
    +    -END VERIFY SCRIPT-
     
         PeerLogicValidation was originally net_processing's implementation to
         the validation interface. It has since grown to contain much of

ACK b9486cc 🍳

Exclusively move-only and rename-only changes. The only risk I see would be
uninteded changes due to shadowing, but that shouldn't be a problem because all
local symbols are aliases to the global ones anyway. (m_mempool == ::mempool,
m_params == Params(), ...)

  • d45f2bb --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
  • e4f6ec6 --word-diff-regex=. -U0
  • 534b4a2 I have not reviewed this. Why is this not a scripted diff ???
  • 66f20e7 --word-diff-regex=. -U0
  • f9a76b6 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
  • e83b149 --word-diff-regex=. -U0
  • 689b2b3 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
  • f789dd7 --word-diff-regex=. -U0
  • b9486cc --word-diff-regex=. -U0 (also reviewed with b9486cc --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space)
Show signature and timestamp

Signature:

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

ACK b9486cc514 🍳

Exclusively move-only and rename-only changes. The only risk I see would be
uninteded changes due to shadowing, but that shouldn't be a problem because all
local symbols are aliases to the global ones anyway. (m_mempool == ::mempool,
m_params == Params(), ...)

* d45f2bb682 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
* e4f6ec6aa3 --word-diff-regex=. -U0
* 534b4a2d86 I have not reviewed this. Why is this not a scripted diff ???
* 66f20e7738 --word-diff-regex=. -U0
* f9a76b620b --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space 
* e83b1497a7 --word-diff-regex=. -U0
* 689b2b3926 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
* f789dd7214 --word-diff-regex=. -U0
* b9486cc514 --word-diff-regex=. -U0 (also reviewed with b9486cc514 --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space)
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUi44wv9EqnP0JBiaYaFXQOP16rPsjbXFLjfNTDcxy44OW6fdjz+y3twK6r5dSvj
QIsy5XuOL9Wb+RONSaBIfuABsKHZPxP3gPP6PrWd/ukD4ypUyvbi97UrCYGgaGkb
A0H6n4OIF2o9QXo+pu/fLFfPucuy/CWML5BrhUAmVwjjB7WLs5wFfGyX7nleL9nd
pM4R/JK9wgttCScaVBhF+hvWJazV86UqtktLU++AR675mH4YjRBx2Ng3BQRrmeD5
bScdeICbZ9uKYKDjZiyegfwmr7ni+zP7vIc1LVNbCEXBYzfMSyeB3+fKwQl0+bRt
ihgTP9FhuMcfGt6NLTAr5/J/Ar4IFlFYWceB7n/DG38Tt0cK1cs+9yiTyhRXttsK
ZL5u1oYqA9OMf6tLm1Ey0MvNgYRJ7iQMj1xM4BWZJlztUdaOseOT4tTaY9yQYuQg
lZJwmTGfUXodw65qfU07ARGigKsCQzL9qchrzHlyc+oQHSAcwrSTMmFKlPxit53W
pmMky4Ak
=kiZz
-----END PGP SIGNATURE-----

Timestamp of file with hash 5be0c45ea49e947755a8bba146134d0a71a0de60deb5f538b4a22c3d9a457df9 -

@jnewbery jnewbery force-pushed the 2020-08-misbehaving-in-plv branch from b9486cc to ab9e416 Compare August 29, 2020 09:34
@jnewbery
Copy link
Contributor Author

Thanks for the review @MarcoFalke ! I've taken your suggestion of making the rename a scripted diff (and added a follow-up commit that fixes the indentation).

@maflcko
Copy link
Member

maflcko commented Aug 29, 2020

re-ACK ab9e416 🔋

Show signature and timestamp

Signature:

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

re-ACK ab9e416812 🔋
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgOmAv/XiLCgaJ+N1uXLqQGle28I8T65NwC7lN8op1+AcF0HdvG4P/nr9XAKJGO
HGutxFBbwYhY0gdFiShEKPI/LdTIPF+HEARqQ3bt4HCM1XxFf01UZOKIRjDpEOIl
Zij/8/JIbYQnrl5ROhLlDc89QQKxOyfcviYkshahiXK3QUEDbLrb8axuWl4OJ7jR
eXvlwHqY54k8DbT8ofjCxaHpADgWjLWxsjW4a3QhYM0MnI+KI8g0UryLBvGs2A23
X6VTgJ0hXQX+QJTLVUjy0jwIalrBVWpMXRcDa+LF6PTsZnFKIH3i9ej2p+91MHJk
2kxiAUFYcbpYIhhAi21m4TUSwZ2OjxXPv1Fa3X122caj2eHmotlrH+ACo6/O0uWe
3QWyAB5caNLs0KAxtCC5F7A2caYKjlVw/BnR8krn8PQXP+H3kjZAjUzDQkT9xOhx
eHAVHR5w7+dDbuZQ39fdC9inTJqXSYzwtvfMPpxpCIPECleG0SxvrtRTw5UWzOnU
OUb2Ix1f
=ffIE
-----END PGP SIGNATURE-----

Timestamp of file with hash 8ca020057d8fe8423b0403eeebc5772bea83a87127a66a83c6409a6a47884972 -

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 7ed1612

@maflcko
Copy link
Member

maflcko commented Sep 6, 2020

re-ACK 7ed1612 only change is in commit message 💮

Show signature and timestamp

Signature:

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

re-ACK 7ed1612715 only change is in commit message 💮
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUjjSAv/eL83MPVWHHsG87sMVTjfZH87F5ioMxNs/Rj/ZwuFkj3yMLwXFPDlJMsw
cBoTZS/i1PBCZwueOjGJd5E5RFY98FsLsUG6zsxcnxZvbiUCnGvc6gnPqHnFLDzN
yJGDOLlFrT9NRMsuo+sQ9fZ0dGRB3UmXkX9g3PRIFqLAvW9++ZHgHsHFWEDaWjXo
eZ40OcEAZ0/y8OiZLNcyP5m/XUrmirxLQvLBbnBa7knP9ieE8Gz1XIgTPXrbJxno
PzPIwFrB0z6iyKB1v8HW1mO/qK+zGTKkPAjev0KucuFmlApTp+WcH98yBvhazuQQ
GMBk64LQLOhb2RiHTrjKHUXfcr05gc68or4LbB40E/8FoSHWu5H3U6h3rUgOWp5+
xklUznWZix1ajWjIJxDBDALKgxJNkDQrtRTVX0fCjjrgLkYsZo22ciMjE9VNg4z9
1x+aja5E7olxX6mLq61JvXLA+fLUrLYOa5kUs3+vcSjr1FkEGKOB8jYUcsnwx1Ot
jvSFZpV0
=Ghuq
-----END PGP SIGNATURE-----

Timestamp of file with hash 3fb7d2e970f192a638e72cead0f90dc92194e177f7fcf6b6a23b27665d46f3a5 -

We don't have a project style for ordering class members, but it always
makes sense to have no more than one of each public/protected/private
specifier.

Also move documentation for MaybeDiscourageAndDisconnect to the header.
Keep a references to chainparams, rather than calling the global
Params() function every time it's needed. This is fine, since
globalChainParams does not get updated once it's been set, and it's
available at the point of constructing the PeerLogicValidation object.
…ager

-BEGIN VERIFY SCRIPT-
sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l PeerLogicValidation ./src ./test)
sed -i 's/peer_logic/peerman/g' $(git grep -l peer_logic ./src ./test)
-END VERIFY SCRIPT-

PeerLogicValidation was originally net_processing's implementation to
the validation interface. It has since grown to contain much of
net_processing's logic. Therefore rename it to reflect its
responsibilities.

Suggested in
bitcoin#10756 (review).
@jnewbery jnewbery force-pushed the 2020-08-misbehaving-in-plv branch from 7ed1612 to bb6a32c Compare September 7, 2020 10:21
@jnewbery
Copy link
Contributor Author

jnewbery commented Sep 7, 2020

rebased on master.

Also updated NodeContext.peer_logic to NodeContext.peerman to be consistent with the new class name.

@maflcko
Copy link
Member

maflcko commented Sep 7, 2020

re-ACK bb6a32c only change is rebase due to conflict in struct NodeContext and variable rename 🤸

Show signature and timestamp

Signature:

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

re-ACK bb6a32ce99 only change is rebase due to conflict in struct NodeContext and variable rename 🤸
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUj5EwwAgJp5hQNNMrXFOSwWHrMZfCS1OfNXgNYhlArGTaksEIeWnJDhRQ4IsH+V
Y/9eTNx/HALYtCI6B+JcJ9BKpKFyvkCcBAReHCvpq0f47Q97bBcfn6630pH03c++
joxTTZxFv8shXm5VTvr+5GFDJFQZ6UvnoPqByZHvLvB69knjpHqX6E46m2Ki5QYE
pK5FKoD2wFMjj82+YDoELfVx98r6zw0h7uVeFQbBH4I0EL28RYsXTj5WAAF+wWCj
Nzfx+ELzNtjpPQ4Kp4PItWSpJWa96+7HD/UmZB6dWcqE38sLF+nMWFHR1r1oDRCW
s45QqvuQUYDgQW42OnxNd4O8t0vMO6yc0VM5VWd7w7jEDzh03MQSBzrhOIr9Cnd9
QolSfQmFuvSHnXCoyM8NHC4CW6FFarQU0mjmb765p1sX5Z6im01ivS15c1KCKuCA
SmsoydGdO7GtKV6ZdG8ut+ztkvBK1146HxpxZBmDjIC9P0nnHzzYIjAztq/qd4sv
iU/NLnck
=HoQu
-----END PGP SIGNATURE-----

Timestamp of file with hash 65490dd75525720cc364871d69f74f20cb23d460478111dc409134823950f8b3 -

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

re-ACK bb6a32c, only rebased, and added renaming s/peer_logic/peerman/ into scripted-diff since my previous review (verified with git range-diff).

@maflcko maflcko merged commit 147d50d into bitcoin:master Sep 7, 2020
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 18, 2021
Summary:
```
We don't have a project style for ordering class members, but it always
makes sense to have no more than one of each public/protected/private
specifier.

Also move documentation for MaybeDiscourageAndDisconnect to the header.
```

Partial backport of core [[bitcoin/bitcoin#19791 | PR19791]] (1/9):
bitcoin/bitcoin@824bbd1

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8940
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 22, 2021
Summary:
```
Keep a references to chainparams, rather than calling the global
Params() function every time it's needed. This is fine, since
globalChainParams does not get updated once it's been set, and it's
available at the point of constructing the PeerLogicValidation object.
```

Partial backport of core [[bitcoin/bitcoin#19791 | PR19791]] (2/9):
bitcoin/bitcoin@2297b26

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8942
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 23, 2021
…ager

Summary:
```
-BEGIN VERIFY SCRIPT-
sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l
PeerLogicValidation ./src ./test)
sed -i 's/peer_logic/peerman/g' $(git grep -l peer_logic ./src ./test)
-END VERIFY SCRIPT-

PeerLogicValidation was originally net_processing's implementation to
the validation interface. It has since grown to contain much of
net_processing's logic. Therefore rename it to reflect its
responsibilities.
```

Partial backport (3/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@58bd369

Since the name conflicts with avalanche's PeerManager in tests, the full
namespaced class name is used.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9037
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 23, 2021
Summary:
Partial backport (4/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@d777835

Depends on D9037.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9038
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 23, 2021
Summary:
Partial backport (5/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@b70cd89

Depends on D9038.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9043
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 23, 2021
Summary:
Partial backport (6/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@e662e2d

Depends on D9043.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9044
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 25, 2021
Summary:
Partial backport (7/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@3115e00

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9047
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 25, 2021
Summary:
Partial backport (8/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@aa114b1

Depends on D9047.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D9048
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 26, 2021
Summary:
Completes backport (9/9) of core [[bitcoin/bitcoin#19791 | PR19791]]:
bitcoin/bitcoin@bb6a32c

Depends on D9048.

Also moves the other `Misbehaving()` prototype (specific to our
codebase) as a private method.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9049
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.

6 participants