Skip to content

Commit

Permalink
Don't stall syncing if gap is too large (#2801)
Browse files Browse the repository at this point in the history
cc #2793

After trying to analyze the problem, I've decided to leave it to
future-me.
It is very complicated to determine which entries in the list of "blocks
known by a source" should be kept and which can be thrown away. There
are several other TODOs related to that in the code.

For now, this PR fixes the sync stalling.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
tomaka and mergify[bot] authored Oct 4, 2022
1 parent f4ecb9a commit 9e4f257
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions bin/wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Syncing no longer stalls if the gap between the finalized and latest block is more than 100 blocks. ([#2801](https://github.com/paritytech/smoldot/pull/2801))
- CPU-heavy operations such as verifying finality proofs or compiling the runtime will now better respect the CPU rate limit. ([#2803](https://github.com/paritytech/smoldot/pull/2803))

## 0.7.0 - 2022-09-28
Expand Down
20 changes: 11 additions & 9 deletions src/sync/all_forks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,12 @@ impl<TBl, TRq, TSrc> AddBlockVacant<TBl, TRq, TSrc> {
None => break,
};

self.inner
.inner
.inner
.blocks
.remove_sources_known_block(height, &hash);
// TODO: restore this block of code; it is extremely complicated because it is unclear which source-block combinations we can add and keep without making memory usage explode
/*self.inner
.inner
.inner
.blocks
.remove_sources_known_block(height, &hash);*/
self.inner
.inner
.inner
Expand Down Expand Up @@ -1631,10 +1632,11 @@ impl<'a, TBl, TRq, TSrc> AnnouncedBlockUnknown<'a, TBl, TRq, TSrc> {
None => break,
};

self.inner
.inner
.blocks
.remove_sources_known_block(height, &hash);
// TODO: restore this block of code; it is extremely complicated because it is unclear which source-block combinations we can add and keep without making memory usage explode
/*self.inner
.inner
.blocks
.remove_sources_known_block(height, &hash);*/
self.inner
.inner
.blocks
Expand Down

0 comments on commit 9e4f257

Please sign in to comment.