package slasher import ( "context" "github.com/prysmaticlabs/prysm/config/params" ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1" ) type MockSlashingChecker struct { AttesterSlashingFound bool ProposerSlashingFound bool } func (s *MockSlashingChecker) IsSlashableBlock(ctx context.Context, proposal *ethpb.SignedBeaconBlockHeader) (*ethpb.ProposerSlashing, error) { if s.ProposerSlashingFound { return ðpb.ProposerSlashing{ Header_1: ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ Slot: 0, ProposerIndex: 0, ParentRoot: params.BeaconConfig().ZeroHash[:], StateRoot: params.BeaconConfig().ZeroHash[:], BodyRoot: params.BeaconConfig().ZeroHash[:], }, Signature: params.BeaconConfig().EmptySignature[:], }, Header_2: ðpb.SignedBeaconBlockHeader{ Header: ðpb.BeaconBlockHeader{ Slot: 0, ProposerIndex: 0, ParentRoot: params.BeaconConfig().ZeroHash[:], StateRoot: params.BeaconConfig().ZeroHash[:], BodyRoot: params.BeaconConfig().ZeroHash[:], }, Signature: params.BeaconConfig().EmptySignature[:], }, }, nil } return nil, nil } func (s *MockSlashingChecker) IsSlashableAttestation(ctx context.Context, attestation *ethpb.IndexedAttestation) ([]*ethpb.AttesterSlashing, error) { if s.AttesterSlashingFound { return []*ethpb.AttesterSlashing{ { Attestation_1: ðpb.IndexedAttestation{ Data: ðpb.AttestationData{}, }, Attestation_2: ðpb.IndexedAttestation{ Data: ðpb.AttestationData{}, }, }, }, nil } return nil, nil }