mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Change Logging of Failed Attestations (#2599)
* change logging * review comments * gazelle
This commit is contained in:
parent
d672a06026
commit
56130404fc
@ -38,6 +38,8 @@ go_test(
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -309,11 +309,13 @@ func (a *Service) updateAttestation(ctx context.Context, headRoot [32]byte, beac
|
||||
}
|
||||
|
||||
if i >= len(committee) {
|
||||
return fmt.Errorf("bitfield points to an invalid index in the committee: bitfield %08b", bitfield)
|
||||
log.Debugf("bitfield points to an invalid index in the committee: bitfield %08b", bitfield)
|
||||
return nil
|
||||
}
|
||||
|
||||
if int(committee[i]) >= len(beaconState.ValidatorRegistry) {
|
||||
return fmt.Errorf("index doesn't exist in validator registry: index %d", committee[i])
|
||||
log.Debugf("index doesn't exist in validator registry: index %d", committee[i])
|
||||
return nil
|
||||
}
|
||||
|
||||
// If the attestation came from this attester. We use the slot committee to find the
|
||||
|
@ -14,7 +14,9 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/sirupsen/logrus"
|
||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -366,6 +368,7 @@ func TestUpdateLatestAttestation_CacheEnabledAndHit(t *testing.T) {
|
||||
|
||||
func TestUpdateLatestAttestation_InvalidIndex(t *testing.T) {
|
||||
beaconDB := internal.SetupDB(t)
|
||||
hook := logTest.NewGlobal()
|
||||
defer internal.TeardownDB(t, beaconDB)
|
||||
ctx := context.Background()
|
||||
|
||||
@ -403,9 +406,11 @@ func TestUpdateLatestAttestation_InvalidIndex(t *testing.T) {
|
||||
|
||||
wanted := "bitfield points to an invalid index in the committee"
|
||||
|
||||
if err := service.UpdateLatestAttestation(ctx, attestation); !strings.Contains(err.Error(), wanted) {
|
||||
t.Errorf("Wanted: %s but got %s", wanted, err)
|
||||
if err := service.UpdateLatestAttestation(ctx, attestation); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
testutil.AssertLogsContain(t, hook, wanted)
|
||||
}
|
||||
|
||||
func TestBatchUpdate_FromSync(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user