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

add: more context on errors #8

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions pkg/clientapi/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *APIClient) RequestBeaconBlock(slot phase0.Slot) (*local_spec.AgnosticBl

if errors.Is(err, context.DeadlineExceeded) {
ticker := time.NewTicker(utils.RoutineFlushTimeout)
log.Warnf("retrying request: %s", routineKey)
log.Warnf("retrying request for beacon block at slot %d: %s", slot, routineKey)
<-ticker.C
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ func (s *APIClient) CreateMissingBlock(slot phase0.Slot) *local_spec.AgnosticBlo
})
proposerValIdx := phase0.ValidatorIndex(0)
if err != nil {
log.Errorf("could not request proposer duty: %s", err)
log.Errorf("could not request proposer duty for slot %d: %s", slot, err)
} else {
for _, duty := range duties.Data {
if duty.Slot == phase0.Slot(slot) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/clientapi/rewards.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *APIClient) RequestBlockRewards(slot phase0.Slot) (spec.BlockRewards, er
err = json.Unmarshal(body, &rewards)

if err != nil {
log.Warnf("error parsing block rewards response boyd %s: %s", string(body), err)
log.Warnf("error parsing block rewards for slot %d, response response body %s: %s", slot, string(body), err)
}

return rewards, err
Expand Down
10 changes: 5 additions & 5 deletions pkg/clientapi/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ func (s *APIClient) RequestBeaconState(slot phase0.Slot) (*local_spec.AgnosticSt
})

if newState == nil {
return nil, fmt.Errorf("unable to retrieve Beacon State from the beacon node, closing requester routine. nil State")
return nil, fmt.Errorf("unable to retrieve beacon state for slot %d from the beacon node, closing requester routine. nil State", slot)
}

if errors.Is(err, context.DeadlineExceeded) {
ticker := time.NewTicker(utils.RoutineFlushTimeout)
log.Warnf("retrying request: %s", routineKey)
log.Warnf("retrying request to retrieve beacon state for slot %d: %s", slot, routineKey)
<-ticker.C

}
Expand Down Expand Up @@ -74,9 +74,9 @@ func (s *APIClient) RequestStateRoot(slot phase0.Slot) *phase0.Root {
})
if err != nil {
if response404(err.Error()) {
log.Warningf("could not find the state root at %d: %s", slot, err)
log.Warningf("could not find the state root at slot %d: %s", slot, err)
} else {
log.Errorf("error for state root at %d: %s", slot, err)
log.Errorf("error for state root at slot %d: %s", slot, err)
}
} else {
return root.Data
Expand All @@ -95,7 +95,7 @@ func (s *APIClient) GetFinalizedEndSlotStateRoot() (phase0.Slot, *phase0.Root) {
})

if err != nil {
log.Panicf("could not determine the current finalized checkpoint")
log.Panicf("could not determine the current finalized checkpoint (head)")
}

finalizedSlot := phase0.Slot(currentFinalized.Data.Finalized.Epoch*local_spec.SlotsPerEpoch - 1)
Expand Down