streamingfast / node-manager

Wrapping process to operate blockchain nodes.
https://dfuse.io
Apache License 2.0
7 stars 9 forks source link

When mindreader merges directly, it does not check block continuity #16

Closed sduchesneau closed 2 years ago

sduchesneau commented 2 years ago

The proper way to check block continuity is implemented in the merger, using the forkDB from bstream/forkable package.

The mindreader simply writes blocks to a file when using the batch mode or when processing blocks older than mergeThresholdBlockAge.

There used to be a simple continuity checker that ensured that "new block is (last block - 1)" but it was removed because it fails in 2 cases:

  1. geth sometimes sending an old bad block (https://github.com/streamingfast/sf-ethereum/issues/4) that should be simply ignored (or included silently, no problem there). Hard failing in this case causes more harm.
  2. chains that do not have continuous block numbers (ex: block 50's parent is block 45)

The good approach will be to import the logic from the merger when we want to produce merged blocks directly (for reprocessing in batch mode, or catching up from far behind)

sduchesneau commented 2 years ago

this has been implemented, the merger code is now used.