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

Implement resource discovery by "Flood with Random Walk" algorithm #1711

Merged
merged 26 commits into from
May 29, 2024

Conversation

goshawk-3
Copy link
Contributor

@goshawk-3 goshawk-3 commented May 7, 2024

Resolves #1528
Resolves #1722

Acceptance criteria:

  • GetBlocks message flow works properly as usual. It should not trigger flood_request
  • GetData/GetResource uses flood_request to retrieve a resource (block/transaction) from a distant peer.
  • GetData/GetResource limits a flood_request by hops_limit setting.
  • certificate cache is cleaned up properly
  • Mempool message returns mempool
  • Ensure bandwidth is not increased on GetResource msg

NB: Testing the impl of this approach revealed a race condition that was (most probably) previously happening too. It'll be addressed with #1722

@goshawk-3 goshawk-3 marked this pull request as ready for review May 10, 2024 07:52
Copy link
Contributor

@fed-franz fed-franz left a comment

Choose a reason for hiding this comment

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

I'd suggest to use a counter TTL instead of timestamp.
Generally speaking, relying on timestamps in a distributed network is never a great approach, since it relies on local node clocks to be synchronized.
While we're considering having nodes use NTP, we should not rely on it if not necessary.
Additionally, using a counter allows to better control the maimum number of hops the request will go through, regardless of the latency.

node-data/src/message.rs Show resolved Hide resolved
node/src/databroker.rs Outdated Show resolved Hide resolved
node/src/network.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
@goshawk-3 goshawk-3 requested a review from fed-franz May 16, 2024 12:18
node-data/src/message.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Show resolved Hide resolved
node/src/chain/fsm.rs Show resolved Hide resolved
node/src/chain/fsm.rs Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
node/src/network.rs Outdated Show resolved Hide resolved
goshawk-3 added 4 commits May 21, 2024 11:24
- Use request_block_by_height to initialize a presync procedure
- Update default hops_limit to 128
- Update DEFAULT_CERT_CACHE_EXPIRY to 1min
- Fix the condition for detecting sync target is reached
@goshawk-3 goshawk-3 requested a review from fed-franz May 21, 2024 08:55
node/src/network.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
@goshawk-3 goshawk-3 requested a review from fed-franz May 27, 2024 09:17
Copy link
Contributor

@fed-franz fed-franz left a comment

Choose a reason for hiding this comment

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

LGTM

@goshawk-3 goshawk-3 merged commit 74b1a5b into master May 29, 2024
8 checks passed
@goshawk-3 goshawk-3 deleted the fix-1528 branch May 29, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants