mock

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestLog = logrus.NewEntry(logrus.New())

TestLog is used to log information in the test methods

Functions

func HexToAddress

func HexToAddress(s string) (ret bellatrix.ExecutionAddress)

HexToAddress converts a hexadecimal string to an Ethereum address

func HexToBytes

func HexToBytes(hex string) []byte

HexToBytes converts a hexadecimal string to a byte array

func HexToHash

func HexToHash(s string) (ret phase0.Hash32)

HexToHash converts a hexadecimal string to an Ethereum hash

func HexToPubkey

func HexToPubkey(s string) (ret phase0.BLSPubKey)

HexToPubkey converts a hexadecimal string to a BLS Public Key

func HexToSignature

func HexToSignature(s string) (ret phase0.BLSSignature)

HexToSignature converts a hexadecimal string to a BLS Signature

Types

type Relay

type Relay struct {
	RelayEntry types.RelayEntry

	// Default responses placeholders, used if overrider does not exist
	GetHeaderResponse  *builderSpec.VersionedSignedBuilderBid
	GetPayloadResponse *builderApi.VersionedSubmitBlindedBlockResponse

	// Server section
	Server        *httptest.Server
	ResponseDelay time.Duration
	// contains filtered or unexported fields
}

Relay is used to fake a relay's behavior. You can override each of its handler by setting the instance's HandlerOverride_METHOD_TO_OVERRIDE to your own handler.

func NewRelay

func NewRelay(t *testing.T) *Relay

NewRelay creates a mocked relay which implements the backend.BoostBackend interface A secret key must be provided to sign default and custom response messages

func (*Relay) DefaultHandleGetPayload

func (m *Relay) DefaultHandleGetPayload(w http.ResponseWriter)

DefaultHandleGetPayload returns the default handler for handleGetPayload

func (*Relay) GetRequestCount

func (m *Relay) GetRequestCount(path string) int

GetRequestCount returns the number of Request made to a specific URL

func (*Relay) MakeGetHeaderResponse

func (m *Relay) MakeGetHeaderResponse(value uint64, blockHash, parentHash, publicKey string, version spec.DataVersion) *builderSpec.VersionedSignedBuilderBid

MakeGetHeaderResponse is used to create the default or can be used to create a custom response to the getHeader method

func (*Relay) MakeGetPayloadResponse

func (m *Relay) MakeGetPayloadResponse(parentHash, blockHash, feeRecipient string, blockNumber uint64, version spec.DataVersion) *builderApi.VersionedSubmitBlindedBlockResponse

MakeGetPayloadResponse is used to create the default or can be used to create a custom response to the getPayload method

func (*Relay) OverrideHandleGetPayload

func (m *Relay) OverrideHandleGetPayload(method func(w http.ResponseWriter, req *http.Request))

func (*Relay) OverrideHandleRegisterValidator

func (m *Relay) OverrideHandleRegisterValidator(method func(w http.ResponseWriter, req *http.Request))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL