mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
a867f6175b
* external slasher protection fails loudly * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge branch 'master' of github.com:prysmaticlabs/prysm into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * Merge refs/heads/master into external-slasher-fail-loud * ivan feedback * Merge branch 'external-slasher-fail-loud' of github.com:prysmaticlabs/prysm into external-slasher-fail-loud * lint fix * ivan feedback
49 lines
1.4 KiB
Go
Generated
49 lines
1.4 KiB
Go
Generated
package testing
|
|
|
|
import (
|
|
"context"
|
|
|
|
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
)
|
|
|
|
// MockProtector mocks the protector.
|
|
type MockProtector struct {
|
|
AllowAttestation bool
|
|
AllowBlock bool
|
|
VerifyAttestationCalled bool
|
|
CommitAttestationCalled bool
|
|
VerifyBlockCalled bool
|
|
CommitBlockCalled bool
|
|
StatusCalled bool
|
|
}
|
|
|
|
// CheckAttestationSafety returns bool with allow attestation value.
|
|
func (mp MockProtector) CheckAttestationSafety(ctx context.Context, attestation *eth.IndexedAttestation) bool {
|
|
mp.VerifyAttestationCalled = true
|
|
return mp.AllowAttestation
|
|
}
|
|
|
|
// CommitAttestation returns bool with allow attestation value.
|
|
func (mp MockProtector) CommitAttestation(ctx context.Context, attestation *eth.IndexedAttestation) bool {
|
|
mp.CommitAttestationCalled = true
|
|
return mp.AllowAttestation
|
|
}
|
|
|
|
// CheckBlockSafety returns bool with allow block value.
|
|
func (mp MockProtector) CheckBlockSafety(ctx context.Context, blockHeader *eth.BeaconBlockHeader) bool {
|
|
mp.VerifyBlockCalled = true
|
|
return mp.AllowBlock
|
|
}
|
|
|
|
// CommitBlock returns bool with allow block value.
|
|
func (mp MockProtector) CommitBlock(ctx context.Context, blockHeader *eth.SignedBeaconBlockHeader) bool {
|
|
mp.CommitBlockCalled = true
|
|
return mp.AllowBlock
|
|
}
|
|
|
|
// Status returns nil.
|
|
func (mp MockProtector) Status() error {
|
|
mp.StatusCalled = true
|
|
return nil
|
|
}
|