builder

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: GPL-3.0 Imports: 28 Imported by: 12

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 BLSToExecutionChange

type BLSToExecutionChange struct {
	*eth.BLSToExecutionChange
}

func (*BLSToExecutionChange) MarshalJSON

func (ch *BLSToExecutionChange) MarshalJSON() ([]byte, error)

type BeaconBlockHeader

type BeaconBlockHeader struct {
	*eth.BeaconBlockHeader
}

func (*BeaconBlockHeader) MarshalJSON

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

type Bid

type Bid interface {
	Header() (interfaces.ExecutionData, error)
	Value() []byte
	Pubkey() []byte
	Version() int
	IsNil() bool
	HashTreeRoot() ([32]byte, error)
	HashTreeRootWith(hh *ssz.Hasher) error
}

Bid is an interface describing the method set of a builder bid.

func WrappedBuilderBid

func WrappedBuilderBid(p *ethpb.BuilderBid) (Bid, error)

WrappedBuilderBid is a constructor which wraps a protobuf bid into an interface.

func WrappedBuilderBidCapella

func WrappedBuilderBidCapella(p *ethpb.BuilderBidCapella) (Bid, error)

WrappedBuilderBidCapella is a constructor which wraps a protobuf bid into an interface.

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 BlindedBeaconBlockBodyCapella

type BlindedBeaconBlockBodyCapella struct {
	*eth.BlindedBeaconBlockBodyCapella
}

func (*BlindedBeaconBlockBodyCapella) MarshalJSON

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

type BlindedBeaconBlockCapella

type BlindedBeaconBlockCapella struct {
	*eth.BlindedBeaconBlockCapella
}

func (*BlindedBeaconBlockCapella) MarshalJSON

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

type BuilderBid

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

func (*BuilderBid) ToProto

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

type BuilderBidCapella

type BuilderBidCapella struct {
	Header *ExecutionPayloadHeaderCapella `json:"header"`
	Value  Uint256                        `json:"value"`
	Pubkey hexutil.Bytes                  `json:"pubkey"`
}

func (*BuilderBidCapella) ToProto

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

type BuilderClient

type BuilderClient interface {
	NodeURL() string
	GetHeader(ctx context.Context, slot primitives.Slot, parentHash [32]byte, pubkey [48]byte) (SignedBid, error)
	RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error
	SubmitBlindedBlock(ctx context.Context, sb interfaces.ReadOnlySignedBeaconBlock) (interfaces.ExecutionData, 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 primitives.Slot, parentHash [32]byte, pubkey [48]byte) (SignedBid, error)

GetHeader is used by a proposing validator to request an execution payload header 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 execution payload 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"`
	Data    struct {
		Signature hexutil.Bytes `json:"signature"`
		Message   *BuilderBid   `json:"message"`
	} `json:"data"`
}

func (*ExecHeaderResponse) ToProto

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

type ExecHeaderResponseCapella

type ExecHeaderResponseCapella struct {
	Data struct {
		Signature hexutil.Bytes      `json:"signature"`
		Message   *BuilderBidCapella `json:"message"`
	} `json:"data"`
}

func (*ExecHeaderResponseCapella) ToProto

type ExecPayloadResponse

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

func (*ExecPayloadResponse) ToProto

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

type ExecPayloadResponseCapella

type ExecPayloadResponseCapella struct {
	Version string                  `json:"version"`
	Data    ExecutionPayloadCapella `json:"data"`
}

func (*ExecPayloadResponseCapella) ToProto

type ExecutionPayload

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

func (*ExecutionPayload) ToProto

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

type ExecutionPayloadCapella

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

func (*ExecutionPayloadCapella) ToProto

type ExecutionPayloadHeader

type ExecutionPayloadHeader struct {
	ParentHash       hexutil.Bytes `json:"parent_hash"`
	FeeRecipient     hexutil.Bytes `json:"fee_recipient"`
	StateRoot        hexutil.Bytes `json:"state_root"`
	ReceiptsRoot     hexutil.Bytes `json:"receipts_root"`
	LogsBloom        hexutil.Bytes `json:"logs_bloom"`
	PrevRandao       hexutil.Bytes `json:"prev_randao"`
	BlockNumber      Uint64String  `json:"block_number"`
	GasLimit         Uint64String  `json:"gas_limit"`
	GasUsed          Uint64String  `json:"gas_used"`
	Timestamp        Uint64String  `json:"timestamp"`
	ExtraData        hexutil.Bytes `json:"extra_data"`
	BaseFeePerGas    Uint256       `json:"base_fee_per_gas"`
	BlockHash        hexutil.Bytes `json:"block_hash"`
	TransactionsRoot hexutil.Bytes `json:"transactions_root"`
	*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 ExecutionPayloadHeaderCapella

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

func (*ExecutionPayloadHeaderCapella) MarshalJSON

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

func (*ExecutionPayloadHeaderCapella) ToProto

func (*ExecutionPayloadHeaderCapella) UnmarshalJSON

func (h *ExecutionPayloadHeaderCapella) 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 SignedBLSToExecutionChange

type SignedBLSToExecutionChange struct {
	*eth.SignedBLSToExecutionChange
}

func (*SignedBLSToExecutionChange) MarshalJSON

func (ch *SignedBLSToExecutionChange) MarshalJSON() ([]byte, error)

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	*eth.SignedBeaconBlockHeader
}

func (*SignedBeaconBlockHeader) MarshalJSON

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

type SignedBid

type SignedBid interface {
	Message() (Bid, error)
	Signature() []byte
	Version() int
	IsNil() bool
}

SignedBid is an interface describing the method set of a signed builder bid.

func WrappedSignedBuilderBid

func WrappedSignedBuilderBid(p *ethpb.SignedBuilderBid) (SignedBid, error)

WrappedSignedBuilderBid is a constructor which wraps a protobuf signed bit into an interface.

func WrappedSignedBuilderBidCapella

func WrappedSignedBuilderBidCapella(p *ethpb.SignedBuilderBidCapella) (SignedBid, error)

WrappedSignedBuilderBidCapella is a constructor which wraps a protobuf signed bit into an interface.

type SignedBlindedBeaconBlockBellatrix

type SignedBlindedBeaconBlockBellatrix struct {
	*eth.SignedBlindedBeaconBlockBellatrix
}

func (*SignedBlindedBeaconBlockBellatrix) MarshalJSON

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

type SignedBlindedBeaconBlockCapella

type SignedBlindedBeaconBlockCapella struct {
	*eth.SignedBlindedBeaconBlockCapella
}

func (*SignedBlindedBeaconBlockCapella) MarshalJSON

func (b *SignedBlindedBeaconBlockCapella) 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 VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
}

type VoluntaryExit

type VoluntaryExit struct {
	*eth.VoluntaryExit
}

func (*VoluntaryExit) MarshalJSON

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

type Withdrawal

type Withdrawal struct {
	Index          Uint256       `json:"index"`
	ValidatorIndex Uint256       `json:"validator_index"`
	Address        hexutil.Bytes `json:"address"`
	Amount         Uint256       `json:"amount"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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