builder

package
v3.1.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: GPL-3.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = errors.Wrap(ErrNotOK, "recv 400 BadRequest response from API")

ErrBadRequest specifically means that a '400 - BAD REQUEST' response was received from the API.

View Source
var ErrNoContent = errors.New("recv 204 no content response from API, No header is available")

ErrNoContent specifically means that a '204 - No Content' response was received from the API. Typically, a 204 is a success but in this case for the Header API means No header is available

View Source
var ErrNotFound = errors.Wrap(ErrNotOK, "recv 404 NotFound response from API")

ErrNotFound specifically means that a '404 - NOT FOUND' response was received from the API.

View Source
var ErrNotOK = errors.New("did not receive 200 response from API")

ErrNotOK is used to indicate when an HTTP request to the Beacon Node API failed with any non-2xx response code. More specific errors may be returned, but an error in reaction to a non-2xx response will always wrap ErrNotOK.

Functions

This section is empty.

Types

type Attestation

type Attestation struct {
	*eth.Attestation
}

func (*Attestation) MarshalJSON

func (a *Attestation) MarshalJSON() ([]byte, error)

type AttestationData

type AttestationData struct {
	*eth.AttestationData
}

func (*AttestationData) MarshalJSON

func (a *AttestationData) MarshalJSON() ([]byte, error)

type AttesterSlashing

type AttesterSlashing struct {
	*eth.AttesterSlashing
}

func (*AttesterSlashing) MarshalJSON

func (s *AttesterSlashing) MarshalJSON() ([]byte, error)

type BeaconBlockHeader

type BeaconBlockHeader struct {
	*eth.BeaconBlockHeader
}

func (*BeaconBlockHeader) MarshalJSON

func (h *BeaconBlockHeader) MarshalJSON() ([]byte, error)

type BlindedBeaconBlockBellatrix

type BlindedBeaconBlockBellatrix struct {
	*eth.BlindedBeaconBlockBellatrix
}

func (*BlindedBeaconBlockBellatrix) MarshalJSON

func (b *BlindedBeaconBlockBellatrix) MarshalJSON() ([]byte, error)

type BlindedBeaconBlockBodyBellatrix

type BlindedBeaconBlockBodyBellatrix struct {
	*eth.BlindedBeaconBlockBodyBellatrix
}

func (*BlindedBeaconBlockBodyBellatrix) MarshalJSON

func (b *BlindedBeaconBlockBodyBellatrix) MarshalJSON() ([]byte, error)

type BuilderBid

type BuilderBid struct {
	Header *ExecutionPayloadHeader `json:"header,omitempty"`
	Value  Uint256                 `json:"value,omitempty"`
	Pubkey hexutil.Bytes           `json:"pubkey,omitempty"`
}

func (*BuilderBid) ToProto

func (bb *BuilderBid) ToProto() (*eth.BuilderBid, error)

type BuilderClient added in v3.1.2

type BuilderClient interface {
	NodeURL() string
	GetHeader(ctx context.Context, slot types.Slot, parentHash [32]byte, pubkey [48]byte) (*ethpb.SignedBuilderBid, error)
	RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error
	SubmitBlindedBlock(ctx context.Context, sb *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error)
	Status(ctx context.Context) error
}

BuilderClient provides a collection of helper methods for calling Builder API endpoints.

type Checkpoint

type Checkpoint struct {
	*eth.Checkpoint
}

func (*Checkpoint) MarshalJSON

func (c *Checkpoint) MarshalJSON() ([]byte, error)

type Client

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

Client provides a collection of helper methods for calling Builder API endpoints.

func NewClient

func NewClient(host string, opts ...ClientOpt) (*Client, error)

NewClient constructs a new client with the provided options (ex WithTimeout). `host` is the base host + port used to construct request urls. This value can be a URL string, or NewClient will assume an http endpoint if just `host:port` is used.

func (*Client) GetHeader

func (c *Client) GetHeader(ctx context.Context, slot types.Slot, parentHash [32]byte, pubkey [48]byte) (*ethpb.SignedBuilderBid, error)

GetHeader is used by a proposing validator to request an ExecutionPayloadHeader from the Builder node.

func (*Client) NodeURL

func (c *Client) NodeURL() string

NodeURL returns a human-readable string representation of the beacon node base url.

func (*Client) RegisterValidator

func (c *Client) RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error

RegisterValidator encodes the SignedValidatorRegistrationV1 message to json (including hex-encoding the byte fields with 0x prefixes) and posts to the builder validator registration endpoint.

func (*Client) Status

func (c *Client) Status(ctx context.Context) error

Status asks the remote builder server for a health check. A response of 200 with an empty body is the success/healthy response, and an error response may have an error message. This method will return a nil value for error in the happy path, and an error with information about the server response body for a non-200 response.

func (*Client) SubmitBlindedBlock

SubmitBlindedBlock calls the builder API endpoint that binds the validator to the builder and submits the block. The response is the full ExecutionPayload used to create the blinded block.

type ClientOpt

type ClientOpt func(*Client)

ClientOpt is a functional option for the Client type (http.Client wrapper)

func WithObserver

func WithObserver(m observer) ClientOpt

type Deposit

type Deposit struct {
	*eth.Deposit
}

func (*Deposit) MarshalJSON

func (d *Deposit) MarshalJSON() ([]byte, error)

type DepositData

type DepositData struct {
	*eth.Deposit_Data
}

func (*DepositData) MarshalJSON

func (d *DepositData) MarshalJSON() ([]byte, error)

type ErrorMessage

type ErrorMessage struct {
	Code        int      `json:"code"`
	Message     string   `json:"message"`
	Stacktraces []string `json:"stacktraces,omitempty"`
}

type Eth1Data

type Eth1Data struct {
	*eth.Eth1Data
}

func (*Eth1Data) MarshalJSON

func (e *Eth1Data) MarshalJSON() ([]byte, error)

type ExecHeaderResponse

type ExecHeaderResponse struct {
	Version string `json:"version,omitempty"`
	Data    struct {
		Signature hexutil.Bytes `json:"signature,omitempty"`
		Message   *BuilderBid   `json:"message,omitempty"`
	} `json:"data,omitempty"`
}

func (*ExecHeaderResponse) ToProto

func (ehr *ExecHeaderResponse) ToProto() (*eth.SignedBuilderBid, error)

type ExecPayloadResponse

type ExecPayloadResponse struct {
	Version string           `json:"version,omitempty"`
	Data    ExecutionPayload `json:"data,omitempty"`
}

func (*ExecPayloadResponse) ToProto

func (r *ExecPayloadResponse) ToProto() (*v1.ExecutionPayload, error)

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash    hexutil.Bytes   `json:"parent_hash,omitempty"`
	FeeRecipient  hexutil.Bytes   `json:"fee_recipient,omitempty"`
	StateRoot     hexutil.Bytes   `json:"state_root,omitempty"`
	ReceiptsRoot  hexutil.Bytes   `json:"receipts_root,omitempty"`
	LogsBloom     hexutil.Bytes   `json:"logs_bloom,omitempty"`
	PrevRandao    hexutil.Bytes   `json:"prev_randao,omitempty"`
	BlockNumber   Uint64String    `json:"block_number,omitempty"`
	GasLimit      Uint64String    `json:"gas_limit,omitempty"`
	GasUsed       Uint64String    `json:"gas_used,omitempty"`
	Timestamp     Uint64String    `json:"timestamp,omitempty"`
	ExtraData     hexutil.Bytes   `json:"extra_data,omitempty"`
	BaseFeePerGas Uint256         `json:"base_fee_per_gas,omitempty"`
	BlockHash     hexutil.Bytes   `json:"block_hash,omitempty"`
	Transactions  []hexutil.Bytes `json:"transactions,omitempty"`
}

func (*ExecutionPayload) ToProto

func (p *ExecutionPayload) ToProto() (*v1.ExecutionPayload, error)

type ExecutionPayloadHeader

type ExecutionPayloadHeader struct {
	ParentHash       hexutil.Bytes `json:"parent_hash,omitempty"`
	FeeRecipient     hexutil.Bytes `json:"fee_recipient,omitempty"`
	StateRoot        hexutil.Bytes `json:"state_root,omitempty"`
	ReceiptsRoot     hexutil.Bytes `json:"receipts_root,omitempty"`
	LogsBloom        hexutil.Bytes `json:"logs_bloom,omitempty"`
	PrevRandao       hexutil.Bytes `json:"prev_randao,omitempty"`
	BlockNumber      Uint64String  `json:"block_number,omitempty"`
	GasLimit         Uint64String  `json:"gas_limit,omitempty"`
	GasUsed          Uint64String  `json:"gas_used,omitempty"`
	Timestamp        Uint64String  `json:"timestamp,omitempty"`
	ExtraData        hexutil.Bytes `json:"extra_data,omitempty"`
	BaseFeePerGas    Uint256       `json:"base_fee_per_gas,omitempty"`
	BlockHash        hexutil.Bytes `json:"block_hash,omitempty"`
	TransactionsRoot hexutil.Bytes `json:"transactions_root,omitempty"`
	*v1.ExecutionPayloadHeader
}

func (*ExecutionPayloadHeader) MarshalJSON

func (h *ExecutionPayloadHeader) MarshalJSON() ([]byte, error)

func (*ExecutionPayloadHeader) ToProto

func (*ExecutionPayloadHeader) UnmarshalJSON

func (h *ExecutionPayloadHeader) UnmarshalJSON(b []byte) error

type IndexedAttestation

type IndexedAttestation struct {
	*eth.IndexedAttestation
}

func (*IndexedAttestation) MarshalJSON

func (a *IndexedAttestation) MarshalJSON() ([]byte, error)

type ProposerSlashing

type ProposerSlashing struct {
	*eth.ProposerSlashing
}

func (*ProposerSlashing) MarshalJSON

func (s *ProposerSlashing) MarshalJSON() ([]byte, error)

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	*eth.SignedBeaconBlockHeader
}

func (*SignedBeaconBlockHeader) MarshalJSON

func (h *SignedBeaconBlockHeader) MarshalJSON() ([]byte, error)

type SignedBlindedBeaconBlockBellatrix

type SignedBlindedBeaconBlockBellatrix struct {
	*eth.SignedBlindedBeaconBlockBellatrix
}

func (*SignedBlindedBeaconBlockBellatrix) MarshalJSON

func (r *SignedBlindedBeaconBlockBellatrix) MarshalJSON() ([]byte, error)

type SignedValidatorRegistration

type SignedValidatorRegistration struct {
	*eth.SignedValidatorRegistrationV1
}

func (*SignedValidatorRegistration) MarshalJSON

func (r *SignedValidatorRegistration) MarshalJSON() ([]byte, error)

func (*SignedValidatorRegistration) UnmarshalJSON

func (r *SignedValidatorRegistration) UnmarshalJSON(b []byte) error

type SignedVoluntaryExit

type SignedVoluntaryExit struct {
	*eth.SignedVoluntaryExit
}

func (*SignedVoluntaryExit) MarshalJSON

func (sve *SignedVoluntaryExit) MarshalJSON() ([]byte, error)

type SyncAggregate

type SyncAggregate struct {
	*eth.SyncAggregate
}

func (*SyncAggregate) MarshalJSON

func (s *SyncAggregate) MarshalJSON() ([]byte, error)

type Uint256

type Uint256 struct {
	*big.Int
}

func (Uint256) MarshalJSON

func (s Uint256) MarshalJSON() ([]byte, error)

func (Uint256) MarshalText

func (s Uint256) MarshalText() ([]byte, error)

func (Uint256) SSZBytes

func (s Uint256) SSZBytes() []byte

SSZBytes creates an ssz-style (little-endian byte slice) representation of the Uint256

func (*Uint256) UnmarshalJSON

func (s *Uint256) UnmarshalJSON(t []byte) error

func (*Uint256) UnmarshalText

func (s *Uint256) UnmarshalText(t []byte) error

type Uint64String

type Uint64String uint64

func (Uint64String) MarshalText

func (s Uint64String) MarshalText() ([]byte, error)

func (*Uint64String) UnmarshalText

func (s *Uint64String) UnmarshalText(t []byte) error

type ValidatorRegistration

type ValidatorRegistration struct {
	*eth.ValidatorRegistrationV1
}

func (*ValidatorRegistration) MarshalJSON

func (r *ValidatorRegistration) MarshalJSON() ([]byte, error)

func (*ValidatorRegistration) UnmarshalJSON

func (r *ValidatorRegistration) UnmarshalJSON(b []byte) error

type VoluntaryExit

type VoluntaryExit struct {
	*eth.VoluntaryExit
}

func (*VoluntaryExit) MarshalJSON

func (ve *VoluntaryExit) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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