Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve cfcheckpt requests #18877

Merged
merged 3 commits into from
May 12, 2020
Merged

Conversation

jnewbery
Copy link
Contributor

@jnewbery jnewbery commented May 5, 2020

Serve cfcheckpt messages if basic block filter index is enabled and -peercfilters is set.

NODE_COMPACT_FILTERS is not signaled to peers, but functionality can be used for testing and serving pre-configured clients.

@prusnak
Copy link
Contributor

prusnak commented May 5, 2020

Seems the lint target fails in the Travis CI.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 5, 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.

src/init.cpp Outdated Show resolved Hide resolved
@jnewbery jnewbery force-pushed the 2020-04-serve-getcfcheckpt branch from 6fdf2ea to 18ad397 Compare May 6, 2020 03:41
@jnewbery
Copy link
Contributor Author

jnewbery commented May 6, 2020

Note to reviewers: the Travis failures are timeouts and can be ignored. This PR is ready for review.

Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

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

Concept ACK

src/protocol.h Show resolved Hide resolved
src/net_processing.cpp Outdated Show resolved Hide resolved
src/net_processing.cpp Outdated Show resolved Hide resolved
src/net_processing.cpp Outdated Show resolved Hide resolved
src/net_processing.cpp Outdated Show resolved Hide resolved
src/net_processing.cpp Show resolved Hide resolved
wait_until,
)

class CompactFiltersTest(BitcoinTestFramework):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this test verify the following spec requirement "StopHash MUST be known to belong to a block accepted by the receiving peer. This is the case if the peer had previously sent a headers or inv message with any descendent blocks" ?

This point is unclear to me with regards to the receiver requirement, what should we do in case of peer asking for a StopHash non-yet-announced to them. Do we check StopHash inferior ou equal to its pindexBestHeaderSent somewhere ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it matters. If a BIP 157 client pre-emptively requests a filter header for a block that the server hasn't yet accepted, then they would be disconnected.

Generally we don't consider block propagation timing to be a privacy/topology leak, since new block events are rare and too expensive to be controlled by an observer.

Requesting a block that the server hasn't accepted yet is logically equivalent to requesting a non-existent block, which is tested in p2p_cfilters.

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally we don't consider block propagation timing to be a privacy/topology leak, since new block events are rare and too expensive to be controlled by an observer.

I think relying on event scarcity in case of block variance may not hold, so I would rather consider the heavily-optimized block propagation as an obstruction for an attacker to fingerprint topology with confidence.

Requesting a block that the server hasn't accepted yet is logically equivalent to requesting a non-existent block, which is tested in p2p_cfilters.

I think there is logically a difference between accepting a block and header announcement, but AFAIK there is no types of connections for which we don't announce headers so doesn't make a difference in practice, I agree.

@jnewbery jnewbery force-pushed the 2020-04-serve-getcfcheckpt branch from fccc857 to f874115 Compare May 7, 2020 15:59
@jnewbery
Copy link
Contributor Author

jnewbery commented May 7, 2020

Rebased on master to fix the spurious travis failures, and addressed @jkczyz's review comments. Thanks for the review!

@jnewbery jnewbery force-pushed the 2020-04-serve-getcfcheckpt branch from f874115 to 2a15f99 Compare May 7, 2020 16:51
@jnewbery
Copy link
Contributor Author

jnewbery commented May 7, 2020

Addressed @ariard's review comments.

Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

Concept ACK

src/net_processing.cpp Outdated Show resolved Hide resolved
src/init.cpp Outdated Show resolved Hide resolved
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Code review, built/ran tests, and running a mainnet node with -peercfilters=1 -blockfilterindex=1... which took a bit more than an hour to build ~./bitcoin/indexes/blockfilter/basic for the first time, which at current tip height of 629407 takes 5.0 GB of disk space -- not strictly related to this PR, but I wanted to test it. Verified the behavior for "Error: Cannot set -peercfilters without -blockfilterindex." A few non-blocking comments follow below.

src/net_processing.cpp Show resolved Hide resolved
test/functional/p2p_cfilters.py Outdated Show resolved Hide resolved
src/net_processing.cpp Show resolved Hide resolved
test/functional/p2p_cfilters.py Outdated Show resolved Hide resolved
test/functional/p2p_cfilters.py Outdated Show resolved Hide resolved
Copy link
Contributor

@fjahr fjahr left a comment

Choose a reason for hiding this comment

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

ACK fccc857

Reviewed code, ran tests, and modified them to see them fail.

Had another nit. And this is also not a blocker for me but I would like to repeat my comment from the PR Review Club that I would prefer that we have a consistent name for this feature for user-facing communication. The connection between -blockfilterindex and -peercfilters does not seem obvious. I am happy with either naming scheme as long as it's consistent.

test/functional/p2p_cfilters.py Outdated Show resolved Hide resolved
@jnewbery jnewbery force-pushed the 2020-04-serve-getcfcheckpt branch from 2a15f99 to 6691493 Compare May 8, 2020 02:32
@jnewbery
Copy link
Contributor Author

jnewbery commented May 8, 2020

Addressed all review comments from @fjahr and @jonatack . Thanks for the review!

@ariard
Copy link
Contributor

ariard commented May 8, 2020

Code Review ACK 6691493, changes since last review are switch to int instead of uint32_t, renaming to peerblockfilters, test modifications, better comments.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Re-built and tested successfully. A few comments following the change from -peercfilters to -peerblockfilters.

test/functional/p2p_cfilters.py Outdated Show resolved Hide resolved
src/init.cpp Outdated Show resolved Hide resolved
test/functional/test_runner.py Outdated Show resolved Hide resolved
@jnewbery
Copy link
Contributor Author

jnewbery commented May 8, 2020

Thanks for review @jonatack . I've addressed all your comments.

@jkczyz
Copy link
Contributor

jkczyz commented May 8, 2020

Thanks for review @jonatack . I've addressed all your comments.

Needs push. Also, please update the flag name in commit messages.

@fjahr
Copy link
Contributor

fjahr commented May 10, 2020

re-ACK 2308385

Only change was fixing merge conflict in init.cpp:

$ git range-diff f54753293fe7355e4280944d766f22054b560ba1..967e2b10a51b831e49abd9171e3f05843e00e76b 5b24f6084ede92d0f493ff416b4726245140b2c1..23083856a551ca13e8b142791c296ecb25cc4e7f

@jkczyz
Copy link
Contributor

jkczyz commented May 10, 2020

re-ACK 2308385

Only change required in init.cpp for #16224.

@ariard
Copy link
Contributor

ariard commented May 11, 2020

re-Code Review ACK 2308385

@luke-jr
Copy link
Member

luke-jr commented May 11, 2020

This remains Concept NACK since it is harmful to Bitcoin and should not be merged, no matter how well-reviewed.

@NicolasDorier
Copy link
Contributor

NicolasDorier commented May 11, 2020

I also believe neutrino is harmful to bitcoin https://medium.com/@nicolasdorier/neutrino-is-dangerous-for-my-self-sovereignty-18fac5bcdc25

However, I believe it can be useful to whitelisted peers. (I think you should add a permission flag for that)

Concept NACK, except if protected by a permission flag to force its use only to specific trusted peers.

@ThomasBucaioni
Copy link

All three test suites passed here.

@clarkmoody
Copy link

Tested ACK 2308385

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

ACK 2308385

@maflcko
Copy link
Member

maflcko commented May 12, 2020

re-ACK 2308385 🌳

Only change since my previous review #18876 (comment)

  • Rename setting
  • Small code and test refactoring
Show signature and timestamp

Signature:

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

re-ACK 23083856a5 🌳

Only change since my previous review https://github.com/bitcoin/bitcoin/pull/18876#issuecomment-627322015

* Rename setting
* Small code and test refactoring
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgPkAv/fzn4E/8T8kcqmj3aMGV6rY1b0Kg0cqRZKVMrfapyWIJxuQ0+WiB7Leyl
TbKLG8hXCWHy/GNdtkJjhXKtQDH4NA/m+jlIhTMIYCsi1YZ9IPzKLPm9NvuEQSp0
MRmfkDFH/RMIgxSDROm96+StbWlunDDjXvy7recX7hLJ1pMAfufEiyVbqDHwuCjw
K9lG2YbdBWwUxo6zP1iQkBV+DwTl0GNuEtF47e6oQUozAWNosBw0efBEDGNN41c6
Li1aPBXnZUHd/Uwioxz0Ar0+N06VWz0b5Uz4NDOK//Bqu4sf3djZY4WEF/TdlrSs
sXy8LIhyL3uCnSWKUL2L4zoKkYjImJthLk8MIdcFnFLotQO/Za1yDZ/ur/yKI7ee
bYqLh7vbW8oupsKigJr25jtPZY1+p5EmdeFh+/4JYsSG/Da5gGryQ+AcWAi9Hk1/
7U4XhAwiwyLEvadJpPJGuCuFKZXl89KCCKKTY8x/nuNzWuvzSNqv183muNIhrCqk
IIprWPI3
=Dnd8
-----END PGP SIGNATURE-----

Timestamp of file with hash 286f8e8c18188195dc7b2da1cd9ec5c45e6b4ff0cfa7173476f9af073c383815 -

@maflcko
Copy link
Member

maflcko commented May 12, 2020

Concept NACK, except if protected by a permission flag to force its use only to specific trusted peers.

The implementation here is incomplete. The follow-ups in #18876 need to be merged as well. And if another setting is seen to be needed for this to be safely shipped, this should also be done in a follow-up. However, I think we shouldn't block progress here based on Bitcoin Core related implementation details that can easily be fixed up later. There is enough time until the release to hash this out. (See #18947) If by then the implementation is still incomplete, it should be reverted.

Given that, I think this is ready for merge, both code-wise and conceptually.

@maflcko maflcko merged commit e45fb7e into bitcoin:master May 12, 2020
@jnewbery jnewbery deleted the 2020-04-serve-getcfcheckpt branch May 12, 2020 14:54
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 12, 2020
2308385 [test] Add test for cfcheckpt (Jim Posen)
f9e00bb [net processing] Message handling for getcfcheckpt. (Jim Posen)
9ccaaba [init] Add -peerblockfilters option (Jim Posen)

Pull request description:

  Serve cfcheckpt messages if basic block filter index is enabled and `-peercfilters` is set.

  `NODE_COMPACT_FILTERS` is not signaled to peers, but functionality can be used for testing and serving pre-configured clients.

ACKs for top commit:
  jonatack:
    Code review re-ACK 2308385 the only change since my review @ 967e2b1 is an update required for bitcoin#16224 that was merged yesterday.
  fjahr:
    re-ACK 2308385
  jkczyz:
    re-ACK 2308385
  ariard:
    re-Code Review ACK 2308385
  clarkmoody:
    Tested ACK 2308385
  MarcoFalke:
    re-ACK 2308385 🌳
  theStack:
    ACK bitcoin@2308385

Tree-SHA512: 8c751bbd7d1c31a413096462ae025c3d2f3163c7016cbec472a5f5ec267f8dd19a2dfc4d749876d7409c1db546e6fdd16461c6863effcfa0d3e993edcfa92a08
@jonasschnelli
Copy link
Contributor

jonasschnelli commented May 13, 2020

post merge concept ACK.

However, I think this merge was too fast. A 6 day window for a first concrete step in filter serving after BIP157 is IMO too fast for a reasonable discussion. I also still miss conceptual reviews from long term p2p contributors. There is no rush IMO.

Edit: I probably underestimated the effort that went into #16442 (this PR is mostly recycled code from 16442) which could legitimate a quicker merge.

@maflcko
Copy link
Member

maflcko commented May 14, 2020

Edit: I probably underestimated the effort that went into #16442 (this PR is mostly recycled code from 16442) which could legitimate a quicker merge.

Thanks. Just wanted to reply that.

For reference, the permission flag pr is here, btw: #18972

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 9, 2020
When a node is configured with --blockfilterindex=basic and
-peerblockfilters it can serve compact block filters to its peers.

This commit adds the configuration option handling. Future commits
add compact block serving and service bits signaling.

Github-Pull: bitcoin#18877
Rebased-From: 9ccaaba
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 9, 2020
If -peerblockfilters is configured, handle requests for cfcheckpt.

Github-Pull: bitcoin#18877
Rebased-From: f9e00bb
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 9, 2020
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 19, 2020
Summary:
```
Serve cfcheckpt messages if basic block filter index is enabled and
-peercfilters is set.

NODE_COMPACT_FILTERS is not signaled to peers, but functionality can be
used for testing and serving pre-configured clients.
```

Backport of core [[bitcoin/bitcoin#18877 | PR18877]].

Depends on D8461 and D8462.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8463
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Aug 22, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 16, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 18, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Sep 19, 2021
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Oct 12, 2021
gades pushed a commit to cosanta/cosanta-core that referenced this pull request May 30, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet