lib

package
v0.2.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBoostRPCServer

func NewBoostRPCServer(opts BoostRPCServerOptions) (*http.Server, error)

NewBoostRPCServer creates a new boost server

func NewHTTPServer

func NewHTTPServer(ctx context.Context, log logrus.Ext1FieldLogger, rpcSrv *gethRpc.Server, addr string, timeout Timeout, cors []string) *http.Server

NewHTTPServer creates a new HTTP server interface for a RPC server

func NewRPCServer

func NewRPCServer(namespace string, backend interface{}, authenticated bool) (*gethRpc.Server, error)

NewRPCServer creates a new RPC server

Types

type BlindedBeaconBlock

type BlindedBeaconBlock struct {
	Slot          string          `json:"slot"`
	ProposerIndex string          `json:"proposer_index"`
	ParentRoot    string          `json:"parent_root"`
	StateRoot     string          `json:"state_root"`
	Body          json.RawMessage `json:"body"`
}

BlindedBeaconBlock forked from https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#beaconblock

type BlindedBeaconBlockBodyPartial

type BlindedBeaconBlockBodyPartial struct {
	ExecutionPayload      ExecutionPayloadHeaderOnlyBlockHash `json:"execution_payload_header"`
	ExecutionPayloadCamel ExecutionPayloadHeaderOnlyBlockHash `json:"executionPayloadHeader"`
}

BlindedBeaconBlockBodyPartial a partial block body only containing a payload, in both snake_case and camelCase

type BoostRPCServerOptions

type BoostRPCServerOptions struct {
	ListenAddr string
	RelayURLs  []string
	Cors       []string
	Log        *logrus.Entry

	GetHeaderTimeout   time.Duration // maximum wait time for a relay response to getHeaderV1
	UserRequestTimeout Timeout
}

BoostRPCServerOptions contains the router configuration for NewRouter

type BoostService

type BoostService struct {
	// contains filtered or unexported fields
}

BoostService TODO

func (*BoostService) GetHeaderV1

func (m *BoostService) GetHeaderV1(ctx context.Context, blockHash *string) (*GetHeaderResponse, error)

GetHeaderV1 TODO

func (*BoostService) GetPayloadV1

func (m *BoostService) GetPayloadV1(ctx context.Context, block string) (*ExecutionPayloadV1, error)

GetPayloadV1 TODO

func (*BoostService) SetFeeRecipientV1

func (m *BoostService) SetFeeRecipientV1(ctx context.Context, message SetFeeRecipientMessage, publicKey, signature string) (*bool, error)

SetFeeRecipientV1 - returns true if at least one relay returns true

type Error

type Error struct {
	Err error
	ID  int
}

Error that can be returned by the RPC server with an error code.

func (*Error) Error

func (e *Error) Error() string

Error returns the string of the error.

func (*Error) ErrorCode

func (e *Error) ErrorCode() int

ErrorCode returns the ID of the error.

type ExecutionPayloadHeaderOnlyBlockHash

type ExecutionPayloadHeaderOnlyBlockHash struct {
	BlockHash      string `json:"block_hash"`
	BlockHashCamel string `json:"blockHash"`
}

ExecutionPayloadHeaderOnlyBlockHash an execution payload with only a block hash, used for BlindedBeaconBlockBodyPartial

type ExecutionPayloadHeaderV1

type ExecutionPayloadHeaderV1 struct {
	ParentHash       common.Hash    `json:"parentHash" gencodec:"required"`
	FeeRecipient     common.Address `json:"feeRecipient" gencodec:"required"`
	StateRoot        common.Hash    `json:"stateRoot" gencodec:"required"`
	ReceiptsRoot     common.Hash    `json:"receiptsRoot" gencodec:"required"`
	LogsBloom        []byte         `json:"logsBloom" gencodec:"required"`
	PrevRandao       common.Hash    `json:"prevRandao" gencodec:"required"`
	BlockNumber      uint64         `json:"blockNumber" gencodec:"required"`
	GasLimit         uint64         `json:"gasLimit" gencodec:"required"`
	GasUsed          uint64         `json:"gasUsed" gencodec:"required"`
	Timestamp        uint64         `json:"timestamp" gencodec:"required"`
	ExtraData        []byte         `json:"extraData" gencodec:"required"`
	BaseFeePerGas    *big.Int       `json:"baseFeePerGas" gencodec:"required"`
	BlockHash        common.Hash    `json:"blockHash" gencodec:"required"`
	TransactionsRoot common.Hash    `json:"transactionsRoot" gencodec:"required"`
}

ExecutionPayloadHeaderV1 as defined in https://github.com/flashbots/mev-boost/blob/main/docs/specification.md#executionpayloadheaderv1

func (ExecutionPayloadHeaderV1) MarshalJSON

func (e ExecutionPayloadHeaderV1) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ExecutionPayloadHeaderV1) UnmarshalJSON

func (e *ExecutionPayloadHeaderV1) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ExecutionPayloadV1

type ExecutionPayloadV1 struct {
	ParentHash    common.Hash    `json:"parentHash" gencodec:"required"`
	FeeRecipient  common.Address `json:"feeRecipient" gencodec:"required"`
	StateRoot     common.Hash    `json:"stateRoot" gencodec:"required"`
	ReceiptsRoot  common.Hash    `json:"receiptsRoot" gencodec:"required"`
	LogsBloom     []byte         `json:"logsBloom" gencodec:"required"`
	PrevRandao    common.Hash    `json:"prevRandao" gencodec:"required"`
	BlockNumber   uint64         `json:"blockNumber" gencodec:"required"`
	GasLimit      uint64         `json:"gasLimit" gencodec:"required"`
	GasUsed       uint64         `json:"gasUsed" gencodec:"required"`
	Timestamp     uint64         `json:"timestamp" gencodec:"required"`
	ExtraData     []byte         `json:"extraData" gencodec:"required"`
	BaseFeePerGas *big.Int       `json:"baseFeePerGas" gencodec:"required"`
	BlockHash     common.Hash    `json:"blockHash" gencodec:"required"`
	Transactions  *[]string      `json:"transactions" gencodec:"required"`
}

ExecutionPayloadV1 as defined in https://github.com/flashbots/mev-boost/blob/main/docs/specification.md#executionpayloadv1

func (ExecutionPayloadV1) MarshalJSON

func (e ExecutionPayloadV1) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ExecutionPayloadV1) UnmarshalJSON

func (e *ExecutionPayloadV1) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type GetHeaderResponse

type GetHeaderResponse struct {
	Message   GetHeaderResponseMessage `json:"message" gencodec:"required"`
	PublicKey []byte                   `json:"publicKey" gencodec:"required"`
	Signature []byte                   `json:"signature" gencodec:"required"`
}

GetHeaderResponse as defined in https://github.com/flashbots/mev-boost/blob/main/docs/specification.md#response-1

func (GetHeaderResponse) MarshalJSON

func (g GetHeaderResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*GetHeaderResponse) UnmarshalJSON

func (g *GetHeaderResponse) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type GetHeaderResponseMessage

type GetHeaderResponseMessage struct {
	Header ExecutionPayloadHeaderV1 `json:"header" gencodec:"required"`
	Value  *big.Int                 `json:"value" gencodec:"required"`
}

GetHeaderResponseMessage as defined in https://github.com/flashbots/mev-boost/blob/main/docs/specification.md#response-1

func (GetHeaderResponseMessage) MarshalJSON

func (g GetHeaderResponseMessage) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*GetHeaderResponseMessage) UnmarshalJSON

func (g *GetHeaderResponseMessage) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type SetFeeRecipientMessage

type SetFeeRecipientMessage struct {
	FeeRecipient string `json:"feeRecipient"`
	Timestamp    string `json:"timestamp"`
}

SetFeeRecipientMessage as defined in https://github.com/flashbots/mev-boost/blob/main/docs/specification.md#request

type SignedBlindedBeaconBlock

type SignedBlindedBeaconBlock struct {
	Message   *BlindedBeaconBlock `json:"message"`
	Signature string              `json:"signature"`
}

SignedBlindedBeaconBlock forked from https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/phase0/beacon-chain.md#signedbeaconblockheader

type Timeout

type Timeout struct {
	Read       time.Duration // Timeout for body reads. None if 0.
	ReadHeader time.Duration // Timeout for header reads. None if 0.
	Write      time.Duration // Timeout for writes. None if 0.
	Idle       time.Duration // Timeout to disconnect idle client connections. None if 0.
}

Timeout is used to configure the RPC server timeouts for user requests

Jump to

Keyboard shortcuts

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