Skip to content

Commit

Permalink
feat(beacon): add yoloMode to skip sync check for faster testing
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Feb 24, 2025
1 parent b463aa1 commit ff67a86
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
28 changes: 22 additions & 6 deletions pkg/beacon/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"github.com/sirupsen/logrus"
)

const yoloMode = true

type Default struct {
log logrus.FieldLogger

Expand Down Expand Up @@ -104,13 +106,27 @@ func (d *Default) Start(ctx context.Context) error {

go func() {
for {
// Wait until we have a single healthy node.
nd, err := d.nodes.Healthy(ctx).NotSyncing(ctx).RandomNode(ctx)
if err != nil {
d.log.WithError(err).Error("Waiting for a healthy, non-syncing node before beginning..")
time.Sleep(time.Second * 5)
var nd *Node

continue
var err error

if yoloMode {
nd, err = d.nodes.Healthy(ctx).RandomNode(ctx)
if err != nil {
d.log.WithError(err).Error("Waiting for a healthy, non-syncing node before beginning..")
time.Sleep(time.Second * 5)

continue
}
} else {
// Wait until we have a single healthy node.
nd, err = d.nodes.Healthy(ctx).NotSyncing(ctx).RandomNode(ctx)
if err != nil {
d.log.WithError(err).Error("Waiting for a healthy, non-syncing node before beginning..")
time.Sleep(time.Second * 5)

continue
}
}

nd.Beacon.Wallclock().OnEpochChanged(func(epoch ethwallclock.Epoch) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/beacon/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (n Nodes) NotOptimisticEL(ctx context.Context) Nodes {
}

func (n Nodes) Ready(ctx context.Context) Nodes {
if yoloMode {
return n.Healthy(ctx)
}

return n.
Healthy(ctx).
NotSyncing(ctx).
Expand Down

0 comments on commit ff67a86

Please sign in to comment.