prysm-pulse/validator/testing/mock_protector.go
Raul Jordan d077483577
Add V3 Suffix to All Prysm Packages (#11083)
* v3 import renamings

* tidy

* fmt

* rev

* Update beacon-chain/core/epoch/precompute/reward_penalty_test.go

* Update beacon-chain/core/helpers/validators_test.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/iface/BUILD.bazel

* Update beacon-chain/db/kv/kv.go

* Update beacon-chain/db/kv/state.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/sync/initial-sync/service.go

* fix deps

* fix bad replacements

* fix bad replacements

* change back

* gohashtree version

* fix deps

Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Potuz <potuz@prysmaticlabs.com>
2022-08-16 12:20:13 +00:00

35 lines
932 B
Go

package testing
import (
"context"
eth "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
)
// MockProtector mocks the protector.
type MockProtector struct {
AllowAttestation bool
AllowBlock bool
VerifyAttestationCalled bool
VerifyBlockCalled bool
StatusCalled bool
}
// CheckAttestationSafety returns bool with allow attestation value.
func (mp MockProtector) CheckAttestationSafety(_ context.Context, _ *eth.IndexedAttestation) bool {
mp.VerifyAttestationCalled = true // skipcq: RVV-B0006
return mp.AllowAttestation
}
// CheckBlockSafety returns bool with allow block value.
func (mp MockProtector) CheckBlockSafety(_ context.Context, _ *eth.SignedBeaconBlockHeader) bool {
mp.VerifyBlockCalled = true // skipcq: RVV-B0006
return mp.AllowBlock
}
// Status returns nil.
func (mp MockProtector) Status() error {
mp.StatusCalled = true // skipcq: RVV-B0006
return nil
}