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

Remove lists from Chits messages #1412

Merged
merged 29 commits into from
Jun 2, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5a1bdb3
If the network is not fuji or mainnet linearize on init
StephenButtolph Mar 20, 2023
f6d6d18
Loop until stop vertex is accepted
StephenButtolph Mar 20, 2023
3c96f9b
If the stop vertex is accepted, transition to snowman bootstrapping
StephenButtolph Mar 20, 2023
9f1f252
merged
StephenButtolph Mar 20, 2023
af9460a
merged
StephenButtolph Apr 13, 2023
75f42a5
wip removing avalanche consensus engine
StephenButtolph Apr 13, 2023
1be3d27
Use require in Avalanche bootstrapping tests
StephenButtolph Apr 13, 2023
9614cec
Merge branch 'cleanup-avalanche-bootstrap-tests' into linearize-on-start
StephenButtolph Apr 13, 2023
853a70c
merged
StephenButtolph Apr 13, 2023
dd8c14f
remove bootstrapping tests from the consensus engine
StephenButtolph Apr 13, 2023
fff4c15
lint
StephenButtolph Apr 13, 2023
83cb219
wip fix tests
StephenButtolph Apr 14, 2023
c56755a
fix tests
StephenButtolph Apr 14, 2023
395e510
Merge branch 'dev' into cleanup-avalanche-bootstrap-tests
StephenButtolph Apr 14, 2023
1d8904b
Merge branch 'cleanup-avalanche-bootstrap-tests' into linearize-on-start
StephenButtolph Apr 14, 2023
50e9ebd
Update metrics
StephenButtolph Apr 14, 2023
ad9b139
Merge branch 'linearize-on-start' of github.com:ava-labs/avalanchego …
StephenButtolph Apr 14, 2023
708b260
remove whitelist vtx tests
StephenButtolph Apr 14, 2023
caa60ba
Remove avalanche consensus
StephenButtolph Apr 15, 2023
5b8ae87
Remove whitelist interface
StephenButtolph Apr 15, 2023
798d62b
Remove more dead code
StephenButtolph Apr 15, 2023
d56f8da
deadcode
StephenButtolph Apr 15, 2023
b113a2b
merged
StephenButtolph Apr 24, 2023
87d0f99
merged
StephenButtolph Apr 24, 2023
06ee7bf
Remove lists from Chits messages
StephenButtolph Apr 24, 2023
869a04a
merged
StephenButtolph Apr 25, 2023
0abb509
Merge branch 'remove-avalanche-consensus' into simplify-chits-message
StephenButtolph Apr 25, 2023
4991f15
merged
StephenButtolph Jun 1, 2023
c824df4
remove old comment
StephenButtolph Jun 1, 2023
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
Prev Previous commit
Next Next commit
Loop until stop vertex is accepted
  • Loading branch information
StephenButtolph committed Mar 20, 2023
commit f6d6d189a9c6791539265e33120952746abe8bd9
66 changes: 8 additions & 58 deletions snow/engine/avalanche/bootstrap/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ package bootstrap

import (
"context"
"errors"
"fmt"
"math"
"time"

"go.uber.org/zap"

Expand All @@ -31,16 +28,9 @@ const (
stripeDistance = 2000
stripeWidth = 5
cacheSize = 100000

// Parameters for delaying bootstrapping to avoid potential CPU burns
bootstrappingDelay = 10 * time.Second
)

var (
_ common.BootstrapableEngine = (*bootstrapper)(nil)

errUnexpectedTimeout = errors.New("unexpected timeout fired")
)
var _ common.BootstrapableEngine = (*bootstrapper)(nil)

func New(
ctx context.Context,
Expand Down Expand Up @@ -79,7 +69,6 @@ func New(
return startSnowmanBootstrapping(ctx, lastReqID)
},
},
executedStateTransitions: math.MaxInt32,
}

if err := b.metrics.Initialize("bs", config.Ctx.AvalancheRegisterer); err != nil {
Expand Down Expand Up @@ -132,10 +121,6 @@ type bootstrapper struct {

// Contains IDs of vertices that have recently been processed
processedCache *cache.LRU[ids.ID, struct{}]
// number of state transitions executed
executedStateTransitions int

awaitingTimeout bool
}

func (b *bootstrapper) Clear() error {
Expand Down Expand Up @@ -319,16 +304,8 @@ func (b *bootstrapper) Disconnected(ctx context.Context, nodeID ids.NodeID) erro
return b.StartupTracker.Disconnected(ctx, nodeID)
}

func (b *bootstrapper) Timeout(ctx context.Context) error {
if !b.awaitingTimeout {
return errUnexpectedTimeout
}
b.awaitingTimeout = false

if !b.Config.BootstrapTracker.IsBootstrapped() {
return b.Restart(ctx, true)
}
return b.OnFinished(ctx, b.Config.SharedCfg.RequestID)
func (*bootstrapper) Timeout(context.Context) error {
return nil
}

func (*bootstrapper) Gossip(context.Context) error {
Expand Down Expand Up @@ -606,7 +583,7 @@ func (b *bootstrapper) ForceAccepted(ctx context.Context, acceptedContainerIDs [
func (b *bootstrapper) checkFinish(ctx context.Context) error {
// If there are outstanding requests for vertices or we still need to fetch vertices, we can't finish
pendingJobs := b.VtxBlocked.MissingIDs()
if b.IsBootstrapped() || len(pendingJobs) > 0 || b.awaitingTimeout {
if b.IsBootstrapped() || len(pendingJobs) > 0 {
return nil
}

Expand All @@ -633,7 +610,7 @@ func (b *bootstrapper) checkFinish(ctx context.Context) error {
b.Ctx.Log.Debug("executing vertices")
}

executedVts, err := b.VtxBlocked.ExecuteAll(
_, err = b.VtxBlocked.ExecuteAll(
ctx,
b.Config.Ctx,
b,
Expand All @@ -651,37 +628,10 @@ func (b *bootstrapper) checkFinish(ctx context.Context) error {
return err
}
if linearized {
b.processedCache.Flush()
return b.OnFinished(ctx, b.Config.SharedCfg.RequestID)
}

previouslyExecuted := b.executedStateTransitions
b.executedStateTransitions = executedVts

// Note that executedVts < c*previouslyExecuted is enforced so that the
// bootstrapping process will terminate even as new vertices are being
// issued.
if executedVts > 0 && executedVts < previouslyExecuted/2 && b.Config.RetryBootstrap {
b.Ctx.Log.Debug("checking for more vertices before finishing bootstrapping")
return b.Restart(ctx, true)
}

// Notify the subnet that this chain is synced
b.Config.BootstrapTracker.Bootstrapped(b.Ctx.ChainID)
b.processedCache.Flush()

// If the subnet hasn't finished bootstrapping, this chain should remain
// syncing.
if !b.Config.BootstrapTracker.IsBootstrapped() {
if !b.Config.SharedCfg.Restarted {
b.Ctx.Log.Info("waiting for the remaining chains in this subnet to finish syncing")
} else {
b.Ctx.Log.Debug("waiting for the remaining chains in this subnet to finish syncing")
}
// Restart bootstrapping after [bootstrappingDelay] to keep up to date
// on the latest tip.
b.Config.Timer.RegisterTimeout(bootstrappingDelay)
b.awaitingTimeout = true
return nil
}
return b.OnFinished(ctx, b.Config.SharedCfg.RequestID)
b.Ctx.Log.Debug("checking for stop vertex before finishing bootstrapping")
return b.Restart(ctx, true)
}