mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
df33ce3309
* slasher beacon node changes * remaining beacon node items * moar changes * gaz * flag fix * rem slashable * builds * imports * fix up * pruning faster test * deepsource * fix wrong item * node node feature flags * broken test * preston review * more preston comments * comment Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
58 lines
1.6 KiB
Go
58 lines
1.6 KiB
Go
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
|
|
}
|