2022-06-24 02:41:16 +00:00
|
|
|
package testing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
|
|
|
|
v1 "github.com/prysmaticlabs/prysm/v3/proto/engine/v1"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
2022-06-24 02:41:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// MockBuilderService to mock builder.
|
|
|
|
type MockBuilderService struct {
|
|
|
|
HasConfigured bool
|
|
|
|
Payload *v1.ExecutionPayload
|
|
|
|
ErrSubmitBlindedBlock error
|
|
|
|
Bid *ethpb.SignedBuilderBid
|
|
|
|
ErrGetHeader error
|
|
|
|
ErrRegisterValidator error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Configured for mocking.
|
|
|
|
func (s *MockBuilderService) Configured() bool {
|
|
|
|
return s.HasConfigured
|
|
|
|
}
|
|
|
|
|
|
|
|
// SubmitBlindedBlock for mocking.
|
|
|
|
func (s *MockBuilderService) SubmitBlindedBlock(context.Context, *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error) {
|
|
|
|
return s.Payload, s.ErrSubmitBlindedBlock
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetHeader for mocking.
|
|
|
|
func (s *MockBuilderService) GetHeader(context.Context, types.Slot, [32]byte, [48]byte) (*ethpb.SignedBuilderBid, error) {
|
|
|
|
return s.Bid, s.ErrGetHeader
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterValidator for mocking.
|
|
|
|
func (s *MockBuilderService) RegisterValidator(context.Context, []*ethpb.SignedValidatorRegistrationV1) error {
|
|
|
|
return s.ErrRegisterValidator
|
|
|
|
}
|