Skip to content

Commit

Permalink
chore: improve att error (#12813)
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain authored and prestonvanloon committed Aug 30, 2023
1 parent 47763ed commit 70143ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion beacon-chain/core/helpers/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ func ValidateAttestationTime(attSlot primitives.Slot, genesisTime time.Time, clo
}
attSlotEpoch := slots.ToEpoch(attSlot)
if attSlotEpoch != currentEpoch && attSlotEpoch != prevEpoch {
return fmt.Errorf("attestation slot %d not within current epoch %d or previous epoch %d", attSlot, currentEpoch, prevEpoch)
attError = fmt.Errorf(
"attestation epoch %d not within current epoch %d or previous epoch %d",
attSlot/params.BeaconConfig().SlotsPerEpoch,
currentEpoch,
prevEpoch,
)
return errors.Join(ErrTooLate, attError)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/core/helpers/attestation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func Test_ValidateAttestationTime(t *testing.T) {
-500 * time.Duration(params.BeaconConfig().SecondsPerSlot) * time.Second,
).Add(200 * time.Millisecond),
},
wantedErr: "attestation slot 268 not within current epoch 15 or previous epoch 14",
wantedErr: "attestation epoch 8 not within current epoch 15 or previous epoch 14",
},
{
name: "attestation.slot is well beyond current slot",
Expand Down

0 comments on commit 70143ef

Please sign in to comment.