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

[Docs] Add PoS downloader diagram #4084

Merged
merged 2 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/pos_downloader.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2022-05-05T14:54:57.332Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36" etag="F0bu5vUQjcQ5rGePYll9" version="18.0.0" type="device"><diagram id="SWHnDe6nQBYVYo2iqZuK" name="Page-1">7V3bdpu6Fv2aPMYDSSDgsYm7m+6T3ZN9kn3pIzGKzYiDHMC1068/EiAbJBljyi0e6UNrxH3NqaW51pLoBbp+2X6JvNXiD+qT5QU0/O0Fml5AaDuY/c0b3rIG4Nowa5lHgZ+37Rvug58kbzTy1nXgk7h0YELpMglW5cYZDUMyS0ptXhTRTfmwJ7os33XlzYnScD/zlmrrP4GfLPJWbJn7HTckmC/ErQF2sz0vnjg6f5V44fl0U2hCny/QdURpkv162V6TJbeeMEx23m8H9u6eLCJhUueEN/i6AtNvP/96umXPgaLkBi4unewqP7zlOn/j/GGTN2GCeBO8LL2QbV3FiRclOUgG21YfIX+qHyRKyLbQlD/SF0JfSBK9sUPEXsPK7ZNTxLTz7U3B3mbetiiYWhzn5RDPd9feG4H9yO1wgk1cxSb3JPRJFLPG+4QTRjYRe1f2UFeL5IXdaArYT28ZzEP2e8YsQyLWwC0SMF59yne8BL7PT7+KSBz89B6XwqYrGoRJ+krW1YU15ddaJzTOjA5SECL6TK7pkrLrTkOaIvMULJdS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loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions eth/stagedsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ So, when we are generating indexes or hashed state, we do a multi-step process.

This optimization sometimes leads to dramatic (orders of magnitude) write speed improvements.

## What happens after the Merge?

In the Proof-of-Stake world staged sync becomes somewhat more complicated, as the following diagram shows.
![](/docs/pos_downloader.png)

## Stages (for the up to date list see [`stagedsync.go`](/eth/stagedsync/stagedsync.go) and [`stagebuilder.go`](/eth/stagedsync/stagebuilder.go)):

Each stage consists of 2 functions `ExecFunc` that progesses the stage forward and `UnwindFunc` that unwinds the stage backwards.
Expand Down
3 changes: 2 additions & 1 deletion eth/stagedsync/stage_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ func SpawnStageHeaders(
}
}

// HeadersPOS processes Proof-of-Stake requests (newPayload, forkchoiceUpdated)
// HeadersPOS processes Proof-of-Stake requests (newPayload, forkchoiceUpdated).
// It also saves PoS headers downloaded by (*HeaderDownload)StartPoSDownloader into the DB.
func HeadersPOS(
s *StageState,
u Unwinder,
Expand Down