mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-14 14:08:19 +00:00
68 lines
1.9 KiB
Go
68 lines
1.9 KiB
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
)
|
|
|
|
// ChainService defines the mock interface for testing
|
|
type ChainService struct {
|
|
State *pb.BeaconState
|
|
Root []byte
|
|
FinalizedCheckPoint *ethpb.Checkpoint
|
|
}
|
|
|
|
// ReceiveBlock mocks ReceiveBlock method in chain service.
|
|
func (ms *ChainService) ReceiveBlock(ctx context.Context, block *ethpb.BeaconBlock) error {
|
|
return nil
|
|
}
|
|
|
|
// ReceiveBlockNoPubsub mocks ReceiveBlockNoPubsub method in chain service.
|
|
func (ms *ChainService) ReceiveBlockNoPubsub(ctx context.Context, block *ethpb.BeaconBlock) error {
|
|
return nil
|
|
}
|
|
|
|
// ReceiveBlockNoPubsubForkchoice mocks ReceiveBlockNoPubsubForkchoice method in chain service.
|
|
func (ms *ChainService) ReceiveBlockNoPubsubForkchoice(ctx context.Context, block *ethpb.BeaconBlock) error {
|
|
return nil
|
|
}
|
|
|
|
// HeadSlot mocks HeadSlot method in chain service.
|
|
func (ms *ChainService) HeadSlot() uint64 {
|
|
return ms.State.Slot
|
|
|
|
}
|
|
|
|
// HeadRoot mocks HeadRoot method in chain service.
|
|
func (ms *ChainService) HeadRoot() []byte {
|
|
return ms.Root
|
|
|
|
}
|
|
|
|
// HeadBlock mocks HeadBlock method in chain service.
|
|
func (ms *ChainService) HeadBlock() *ethpb.BeaconBlock {
|
|
return nil
|
|
}
|
|
|
|
// HeadState mocks HeadState method in chain service.
|
|
func (ms *ChainService) HeadState() *pb.BeaconState {
|
|
return ms.State
|
|
}
|
|
|
|
// FinalizedCheckpt mocks FinalizedCheckpt method in chain service.
|
|
func (ms *ChainService) FinalizedCheckpt() *ethpb.Checkpoint {
|
|
return ms.FinalizedCheckPoint
|
|
}
|
|
|
|
// ReceiveAttestation mocks ReceiveAttestation method in chain service.
|
|
func (ms *ChainService) ReceiveAttestation(context.Context, *ethpb.Attestation) error {
|
|
return nil
|
|
}
|
|
|
|
// ReceiveAttestationNoPubsub mocks ReceiveAttestationNoPubsub method in chain service.
|
|
func (ms *ChainService) ReceiveAttestationNoPubsub(context.Context, *ethpb.Attestation) error {
|
|
return nil
|
|
}
|