Skip to content

computeBootstrapDelay should use timestamps to estimate the delay instead of epochs #964

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

Open
Kubuxu opened this issue May 2, 2025 · 2 comments

Comments

@Kubuxu
Copy link
Contributor

Kubuxu commented May 2, 2025

If the node starts with EC state behind, it can wait for the bootstrap even though it is unnecessary.
Instead, we should use now() vs head.Timestamp() + (bootstrap - head.Epoch)* mani.EC.Period.

go-f3/f3.go

Lines 136 to 160 in 163115a

func (m *F3) computeBootstrapDelay() (time.Duration, error) {
manifest := m.manifest.Load()
if manifest == nil || manifest.Pause {
return 0, nil
}
ts, err := m.ec.GetHead(m.runningCtx)
if err != nil {
err := fmt.Errorf("failed to get the EC chain head: %w", err)
return 0, err
}
currentEpoch := ts.Epoch()
if currentEpoch >= manifest.BootstrapEpoch {
return 0, nil
}
epochDelay := manifest.BootstrapEpoch - currentEpoch
start := ts.Timestamp().Add(time.Duration(epochDelay) * manifest.EC.Period)
delay := m.clock.Until(start)
// Add additional delay to skip over null epochs. That way we wait the full 900 epochs.
if delay <= 0 {
delay = manifest.EC.Period + delay%manifest.EC.Period
}
return delay, nil
}

@github-project-automation github-project-automation bot moved this to Todo in F3 May 2, 2025
@masih
Copy link
Member

masih commented May 2, 2025

I was wondering if EC state is behind, should it start at all. But then at the time of finalization we'd wait for chain sync anwyay. What about getting proposal when EC is behind?

@Kubuxu
Copy link
Contributor Author

Kubuxu commented May 2, 2025

The point is to start F3 so it can start fetching the cert chain, so we can easily sync the canonical chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants