-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
polygon/sync: fix issues found during testing #9873
Conversation
import "fmt" | ||
|
||
func syncLogPrefix(message string) string { | ||
return fmt.Sprintf("[sync] %s", message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be solved by a new logger?
polygon/sync/sync.go
Outdated
tip = newTip | ||
} | ||
var prevTip *types.Header | ||
for tip != prevTip { // loop until we converge at latest checkpoint & milestone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it because commitExecution is so slow that a new checkpoint might arrive?
nit: I prefer comments on a separate line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, also other things can be slow - fetching headers, bodies, persisting the blocks - ie depending on timing by the time we finished iteration 1 there may be new checkpoints and milestones ready for us to fetch - btw this matches the initial spec design we have
polygon/sync/block_downloader.go
Outdated
@@ -110,20 +108,37 @@ func (d *blockDownloader) downloadBlocksUsingWaypoints(ctx context.Context, wayp | |||
return nil, nil | |||
} | |||
|
|||
d.logger.Info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .Debug
polygon/sync/block_downloader.go
Outdated
} | ||
|
||
d.logger.Info(syncLogPrefix("finished downloading blocks using waypoints")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .Debug
polygon/sync/storage.go
Outdated
@@ -54,6 +58,8 @@ func (s *executionClientStorage) Flush(ctx context.Context) error { | |||
} | |||
|
|||
func (s *executionClientStorage) Run(ctx context.Context) error { | |||
s.logger.Info(syncLogPrefix("running execution client storage component")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .Debug
polygon/sync/sync.go
Outdated
@@ -209,25 +221,36 @@ func (s *Sync) onNewBlockHashesEvent( | |||
// | |||
|
|||
func (s *Sync) Run(ctx context.Context) error { | |||
s.logger.Info(syncLogPrefix("running sync component")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .Debug
polygon/sync/tip_events.go
Outdated
@@ -91,6 +94,8 @@ func (te *TipEvents) Events() <-chan Event { | |||
} | |||
|
|||
func (te *TipEvents) Run(ctx context.Context) error { | |||
te.logger.Info(syncLogPrefix("running tip events component")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be .Debug
be452b3
to
b12b070
Compare
Fixes problems found during bor-mainnet sync tests: * sync.Run was missing a for loop for initial sync convergences * temporarily disabling ForkChoiceUpdate execution since we are yet to solve and add missing state sync events and spans * no need to flush storage inside block downloader (better async performance) * logging improvements
b12b070
to
28013e1
Compare
Fixes problems found during bor-mainnet sync tests: