docs/design/review.md
This document contains some of our research on how other codebases designed various parts of their stack.
Sentry, a pluggable p2p node following the Erigon gRPC architecture:
vorot93 first started by implementing a rust devp2p stack in devp2pRanger, an ethereum p2p client capable of interacting with peers without a full node:
ethp2p, a clean room implementation of the eth wire protocol, for use in ranger.Erigon Header Downloader:
erigon#1016 and finished in erigon#1145. At a high level, the downloader concurrently requested headers by hash, then sorted, validated and fused the responses into chain segments. Smaller segments were fused into larger as the gaps between them were filled. The downloader is also used to maintain hardcoded hashes (later renamed to preverified) to bootstrap the sync.erigon#1471, erigon#1559 and erigon#2035.erigon#3075 terminal td was introduced to the algorithm to stop forward syncing. For the downward sync (post merge), the downloader was now delegated to EthBackendServererigon#3092 which downloads the header batches from tip until local head is reached. Refactored later in erigon#3340 and erigon#3717.Akula Headers & Stage Downloader:
akula#89. The headers stage invoked the downloader which created a staged stream for header download. The rough description of the process would be request -> receive response -> retry if necessary -> verify response -> verify attachment -> save -> refill (flush?). Same as erigon, it used to rely on preverified hashes to bootstrap the download process.akula#bbde8d. It dispatched multiple requests, collected & verified responses and afterwards inserted the headers. The same logic was refactored in akula#38381e.akula#cdc083.akula#fcc1a08. The majority of code from this commit is akula's headers stage as we know it today.