Skip to content

Commit

Permalink
feat(blocksync): sort peers by download rate & multiple requests for …
Browse files Browse the repository at this point in the history
…closer blocks (cometbft#2475)

It can be reviewed commit by commit.

1. Request the block N from peer B immediately after getting
`NoBlockResponse` from peer A
cometbft@a718fb4
2. Sort peers by download rate (the fastest peer is picked first)
cometbft@cf19851
3. Request a block from peer B if we are approaching pool's height (less
than 50 blocks) and the current peer A is slow in sending us the block
cometbft@e06ebfe
cometbft@e97007f

Closes cometbft#2379 

### Benchmarks

Osmosis:

without this PR (baseline): 11.45m
with this PR: 7.29m
~ 36% decrease

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
  • Loading branch information
melekes authored Mar 11, 2024
1 parent 613d602 commit f8366fc
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `[blocksync]` Request a block from peer B if we are approaching pool's height
(less than 50 blocks) and the current peer A is slow in sending us the
block [\#2475](https://github.com/cometbft/cometbft/pull/2475)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `[blocksync]` Request the block N from peer B immediately after getting
`NoBlockResponse` from peer A
[\#2475](https://github.com/cometbft/cometbft/pull/2475)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[blocksync]` Sort peers by download rate (the fastest peer is picked first)
[\#2475](https://github.com/cometbft/cometbft/pull/2475)
Loading

0 comments on commit f8366fc

Please sign in to comment.