Skip to content

Commit

Permalink
fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
rkapka committed Jun 26, 2024
1 parent 3461924 commit 191bbf7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
20 changes: 18 additions & 2 deletions beacon-chain/slasher/detect_attestations.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,31 @@ func (s *Service) checkDoubleVotes(
// This is a double vote.
doubleVotesTotal.Inc()

existing, ok := existingAttWrapper.IndexedAttestation.(*ethpb.IndexedAttestation)
existingWrapper, ok := existingAttWrapper.IndexedAttestation.(*slashertypes.WrappedIndexedAtt)
if !ok {
return nil, fmt.Errorf(
"existing attestation has wrong type (expected %T, got %T)",
&slashertypes.WrappedIndexedAtt{},
existingAttWrapper.IndexedAttestation,
)
}
existing, ok := existingWrapper.IndexedAtt.(*ethpb.IndexedAttestation)
if !ok {
return nil, fmt.Errorf(
"existing attestation has wrong type (expected %T, got %T)",
&ethpb.IndexedAttestation{},
existingAttWrapper.IndexedAttestation,
)
}
incoming, ok := incomingAttWrapper.IndexedAttestation.(*ethpb.IndexedAttestation)
incomingWrapper, ok := incomingAttWrapper.IndexedAttestation.(*slashertypes.WrappedIndexedAtt)
if !ok {
return nil, fmt.Errorf(
"incoming attestation has wrong type (expected %T, got %T)",
&slashertypes.WrappedIndexedAtt{},
incomingAttWrapper.IndexedAttestation,
)
}
incoming, ok := incomingWrapper.IndexedAtt.(*ethpb.IndexedAttestation)
if !ok {
return nil, fmt.Errorf(
"incoming attestation has wrong type (expected %T, got %T)",
Expand Down
4 changes: 2 additions & 2 deletions testing/endtoend/evaluators/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var ValidatorsSlashedAfterEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
// SlashedValidatorsLoseBalanceAfterEpoch checks if the validators slashed lose the right balance.
var SlashedValidatorsLoseBalanceAfterEpoch = func(n primitives.Epoch) e2eTypes.Evaluator {
return e2eTypes.Evaluator{
Name: "slashed_validators_lose_valance_epoch_%d",
Name: "slashed_validators_lose_balance_epoch_%d",
Policy: policies.AfterNthEpoch(n),
Evaluation: validatorsLoseBalance,
}
Expand Down Expand Up @@ -109,7 +109,7 @@ func validatorsLoseBalance(_ *e2eTypes.EvaluationContext, conns ...*grpc.ClientC
slashedBal := params.BeaconConfig().MaxEffectiveBalance - slashedPenalty + params.BeaconConfig().EffectiveBalanceIncrement/10
if valResp.EffectiveBalance >= slashedBal {
return fmt.Errorf(
"expected slashed validator %d to balance less than %d, received %d",
"expected slashed validator %d balance to be less than %d, received %d",
i,
slashedBal,
valResp.EffectiveBalance,
Expand Down
2 changes: 1 addition & 1 deletion testing/slasher/simulator/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (s *Simulator) simulateBlocksAndAttestations(ctx context.Context) {
}
log.WithFields(logrus.Fields{
"numAtts": len(atts),
"numSlashable": len(propSlashings),
"numSlashable": len(attSlashings),
}).Infof("Producing attestations for slot %d", slot)
for _, sl := range attSlashings {
slashingRoot, err := sl.HashTreeRoot()
Expand Down

0 comments on commit 191bbf7

Please sign in to comment.