mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Start Merry-Go-Round write-up and fix visualisations (#463)
* Initial commit * Bit more * Fix illustrations * More on MDG
This commit is contained in:
parent
0039bc13fa
commit
3606166448
25
docs/merry-go-round-sync.md
Normal file
25
docs/merry-go-round-sync.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Merry-Go-Round sync (turbo-geth design)
|
||||||
|
|
||||||
|
Initial discussion here: https://ethresear.ch/t/merry-go-round-sync/7158
|
||||||
|
|
||||||
|
## Participants
|
||||||
|
|
||||||
|
We divide participants into two types: seeders and leechers. Seeders are the ones who have the full copy of the current Ethereum
|
||||||
|
state, and they also keep updating it as new blocks appear. Leechers are the ones that join the Merry-Go-Round network to
|
||||||
|
either acquire the full copy of the state, or "sift" through it to acquire some part of the state (this is what some "Stateless"
|
||||||
|
node might like to do in the beginning).
|
||||||
|
|
||||||
|
## Syncing cycles
|
||||||
|
|
||||||
|
The process of syncing happens in cycles. During each cycle, all participants attempt to distribute the entire content of the
|
||||||
|
Ethereum state to each other. Therefore the duration of one cycle for the Ethereum mainnet is likely to be some hours.
|
||||||
|
Cycle is divided into ticks. For convinience, we can say that each ticks starts after the mining of certain block, and lasts
|
||||||
|
for some predetermined amount of time, let's say, 30 seconds. This definition means that the ticks will often overlap, but not
|
||||||
|
always, as shown onn the picture below.
|
||||||
|
|
||||||
|
![cycles-and-ticks](mgr-sync-1.png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## How will seeders produce sync schedule
|
||||||
|
|
BIN
docs/mgr-sync-1.png
Normal file
BIN
docs/mgr-sync-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 KiB |
@ -333,11 +333,18 @@ func (tr *ResolverStatefulCached) MultiWalk2(db *bolt.DB, blockNr uint64, bucket
|
|||||||
startkey := startkeys[rangeIdx]
|
startkey := startkeys[rangeIdx]
|
||||||
|
|
||||||
err := db.View(func(tx *bolt.Tx) error {
|
err := db.View(func(tx *bolt.Tx) error {
|
||||||
cache := tx.Bucket(dbutils.IntermediateTrieHashBucket).Cursor()
|
cacheBucket := tx.Bucket(dbutils.IntermediateTrieHashBucket)
|
||||||
|
var cache *bolt.Cursor
|
||||||
|
if cacheBucket != nil {
|
||||||
|
cache = cacheBucket.Cursor()
|
||||||
|
}
|
||||||
c := tx.Bucket(bucket).Cursor()
|
c := tx.Bucket(bucket).Cursor()
|
||||||
|
|
||||||
k, v := c.Seek(startkey)
|
k, v := c.Seek(startkey)
|
||||||
cacheK, cacheV := cache.Seek(startkey)
|
var cacheK, cacheV []byte
|
||||||
|
if cache != nil {
|
||||||
|
cacheK, cacheV = cache.Seek(startkey)
|
||||||
|
}
|
||||||
|
|
||||||
var minKey []byte
|
var minKey []byte
|
||||||
var fromCache bool
|
var fromCache bool
|
||||||
|
Loading…
Reference in New Issue
Block a user