2021-09-29 18:17:37 +00:00
|
|
|
package slasher
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
|
2021-09-29 18:17:37 +00:00
|
|
|
"google.golang.org/grpc/codes"
|
|
|
|
"google.golang.org/grpc/status"
|
|
|
|
)
|
|
|
|
|
|
|
|
// IsSlashableBlock returns a proposer slashing if an input
|
|
|
|
// signed beacon block header is found to be slashable.
|
|
|
|
func (s *Server) IsSlashableBlock(
|
|
|
|
ctx context.Context, req *ethpb.SignedBeaconBlockHeader,
|
|
|
|
) (*ethpb.ProposerSlashingResponse, error) {
|
|
|
|
proposerSlashing, err := s.SlashingChecker.IsSlashableBlock(ctx, req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, status.Errorf(codes.Internal, "Could not determine if block is slashable: %v", err)
|
|
|
|
}
|
|
|
|
if proposerSlashing == nil {
|
|
|
|
return ðpb.ProposerSlashingResponse{
|
|
|
|
ProposerSlashings: []*ethpb.ProposerSlashing{},
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
return ðpb.ProposerSlashingResponse{
|
|
|
|
ProposerSlashings: []*ethpb.ProposerSlashing{proposerSlashing},
|
|
|
|
}, nil
|
|
|
|
}
|