Skip to content

Commit

Permalink
terence and radek feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kasey committed Oct 11, 2023
1 parent 8e525ea commit 7c5a49c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/db/kv/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *Store) SaveBackfillStatus(ctx context.Context, bf *dbval.BackfillStatus
// BackfillStatus retrieves the most recently saved version of the BackfillStatus protobuf struct.
// This is used to persist information about backfill status across restarts.
func (s *Store) BackfillStatus(ctx context.Context) (*dbval.BackfillStatus, error) {
ctx, span := trace.StartSpan(ctx, "BeaconDB.SaveBackfillStatus")
ctx, span := trace.StartSpan(ctx, "BeaconDB.BackfillStatus")
defer span.End()
bf := &dbval.BackfillStatus{}
err := s.db.View(func(tx *bolt.Tx) error {
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/db/kv/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ var ErrNotFoundBackfillBlockRoot = errors.Wrap(ErrNotFound, "BackfillBlockRoot")
var ErrNotFoundFeeRecipient = errors.Wrap(ErrNotFound, "fee recipient")

var errEmptyBlockSlice = errors.New("[]blocks.ROBlock is empty")
var errIncorrectBlockParent = errors.New("Unexpected missing or forked blocks in a []ROBlock")
var errFinalizedChildNotFound = errors.New("Unable to find finalized root descending from backfill batch")
var errNotConnectedToFinalized = errors.New("Unable to finalize backfill blocks, finalized parent_root does not match")
var errIncorrectBlockParent = errors.New("unexpected missing or forked blocks in a []ROBlock")
var errFinalizedChildNotFound = errors.New("unable to find finalized root descending from backfill batch")
var errNotConnectedToFinalized = errors.New("unable to finalize backfill blocks, finalized parent_root does not match")
2 changes: 1 addition & 1 deletion beacon-chain/db/kv/wss.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (s *Store) SaveOrigin(ctx context.Context, serState, serBlock []byte) error
}

if err = s.SaveBackfillStatus(ctx, bf); err != nil {
return errors.Wrap(err, "unable to save backfill status data to db for checkpoint sync.")
return errors.Wrap(err, "unable to save backfill status data to db for checkpoint sync")
}

log.Infof("saving checkpoint block to db, w/ root=%#x", blockRoot)
Expand Down
7 changes: 4 additions & 3 deletions beacon-chain/p2p/peers/assigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ type FinalizedCheckpointer interface {

// NewAssigner assists in the correct construction of an Assigner by code in other packages,
// assuring all the important private member fields are given values.
// The finalized parameter is used to specify a minimum finalized epoch that the peers must agree on.
// The FinalizedCheckpointer is used to retrieve the latest finalized checkpoint each time peers are requested.
// Peers that report an older finalized checkpoint are filtered out.
func NewAssigner(s *Status, fc FinalizedCheckpointer) *Assigner {
return &Assigner{
ps: s,
Expand Down Expand Up @@ -45,7 +46,7 @@ func (a *Assigner) freshPeers() ([]peer.ID, error) {
if len(peers) < required {
log.WithFields(logrus.Fields{
"suitable": len(peers),
"required": required}).Info("Unable to assign peer while suitable peers < required ")
"required": required}).Warn("Unable to assign peer while suitable peers < required ")
return nil, ErrInsufficientSuitable
}
return peers, nil
Expand All @@ -57,10 +58,10 @@ func (a *Assigner) freshPeers() ([]peer.ID, error) {
// the number of outbound requests to each peer from a given component.
func (a *Assigner) Assign(busy map[peer.ID]bool, n int) ([]peer.ID, error) {
best, err := a.freshPeers()
ps := make([]peer.ID, 0, n)
if err != nil {
return nil, err
}
ps := make([]peer.ID, 0, n)
for _, p := range best {
if !busy[p] {
ps = append(ps, p)
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/sync/backfill/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
log "github.com/sirupsen/logrus"
)

// ErrChainBroken is usedbatch with no results, skipping importer when a backfill batch can't be imported to the db because it is not known to be the ancestor
// ErrChainBroken indicates a backfill batch can't be imported to the db because it is not known to be the ancestor
// of the canonical chain.
var ErrChainBroken = errors.New("batch is not the ancestor of a known finalized root")

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/sync/backfill/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

var errMaxBatches = errors.New("backfill batch requested in excess of max outstanding batches")
var errEndSequence = errors.New("sequence has terminated, no more backfill batches will be produced")
var errCannotDecreaseMinimum = errors.New("The minimum backfill slot can only be increased, not decreased")
var errCannotDecreaseMinimum = errors.New("the minimum backfill slot can only be increased, not decreased")

type batchSequencer struct {
batcher batcher
Expand Down

0 comments on commit 7c5a49c

Please sign in to comment.