Documentation
¶
Index ¶
- Variables
- type Attestation
- type AttestationData
- type AttesterSlashing
- type BeaconBlockHeader
- type Bid
- type BuilderBidCapella
- type BuilderClient
- type Checkpoint
- type Client
- func (c *Client) GetHeader(ctx context.Context, slot primitives.Slot, parentHash [32]byte, ...) (SignedBid, error)
- func (c *Client) NodeURL() string
- func (c *Client) RegisterValidator(ctx context.Context, svr []*zondpb.SignedValidatorRegistrationV1) error
- func (c *Client) Status(ctx context.Context) error
- func (c *Client) SubmitBlindedBlock(ctx context.Context, sb interfaces.ReadOnlySignedBeaconBlock) (interfaces.ExecutionData, error)
- type ClientOpt
- type Deposit
- type DepositData
- type DilithiumToExecutionChange
- type ErrorMessage
- type Eth1Data
- type ExecHeaderResponseCapella
- type ExecPayloadResponseCapella
- type ExecutionPayloadCapella
- type ExecutionPayloadHeaderCapella
- type IndexedAttestation
- type ProposerSlashing
- type SignedBeaconBlockHeader
- type SignedBid
- type SignedDilithiumToExecutionChange
- type SignedVoluntaryExit
- type SyncAggregate
- type Uint64String
- type Uint256
- type VersionResponse
- type VoluntaryExit
- type Withdrawal
Constants ¶
This section is empty.
Variables ¶
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.
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
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.
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 {
*zond.Attestation
}
Attestation is a field of Beacon Block Body.
func (*Attestation) MarshalJSON ¶
func (a *Attestation) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of Attestation.
type AttestationData ¶
type AttestationData struct {
*zond.AttestationData
}
AttestationData is a field of IndexedAttestation.
func (*AttestationData) MarshalJSON ¶
func (a *AttestationData) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of AttestationData.
type AttesterSlashing ¶
type AttesterSlashing struct {
*zond.AttesterSlashing
}
AttesterSlashing is a field of a Beacon Block Body.
func (*AttesterSlashing) MarshalJSON ¶
func (s *AttesterSlashing) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of AttesterSlashing.
type BeaconBlockHeader ¶
type BeaconBlockHeader struct {
*zond.BeaconBlockHeader
}
BeaconBlockHeader is a field of SignedBeaconBlockHeader.
func (*BeaconBlockHeader) MarshalJSON ¶
func (h *BeaconBlockHeader) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of BeaconBlockHeader.
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 WrappedBuilderBidCapella ¶
func WrappedBuilderBidCapella(p *zondpb.BuilderBidCapella) (Bid, error)
WrappedBuilderBidCapella is a constructor which wraps a protobuf bid into an interface.
type BuilderBidCapella ¶
type BuilderBidCapella struct {
Header *ExecutionPayloadHeaderCapella `json:"header"`
Value Uint256 `json:"value"`
Pubkey hexutil.Bytes `json:"pubkey"`
}
BuilderBidCapella is field of ExecHeaderResponseCapella.
func (*BuilderBidCapella) ToProto ¶
func (bb *BuilderBidCapella) ToProto() (*zond.BuilderBidCapella, error)
ToProto returns a BuilderBidCapella Proto.
type BuilderClient ¶
type BuilderClient interface {
NodeURL() string
GetHeader(ctx context.Context, slot primitives.Slot, parentHash [32]byte, pubkey [field_params.DilithiumPubkeyLength]byte) (SignedBid, error)
RegisterValidator(ctx context.Context, svr []*zondpb.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 {
*zond.Checkpoint
}
Checkpoint is a field of AttestationData.
func (*Checkpoint) MarshalJSON ¶
func (c *Checkpoint) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of Checkpoint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a collection of helper methods for calling Builder API endpoints.
func NewClient ¶
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 [field_params.DilithiumPubkeyLength]byte) (SignedBid, error)
GetHeader is used by a proposing validator to request an execution payload header from the Builder node.
func (*Client) NodeURL ¶
NodeURL returns a human-readable string representation of the beacon node base url.
func (*Client) RegisterValidator ¶
func (c *Client) RegisterValidator(ctx context.Context, svr []*zondpb.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 ¶
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 ¶
func (c *Client) SubmitBlindedBlock(ctx context.Context, sb interfaces.ReadOnlySignedBeaconBlock) (interfaces.ExecutionData, error)
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 ¶
Deposit is a field of Beacon Block Body.
func (*Deposit) MarshalJSON ¶
MarshalJSON returns a JSON byte array representation of Deposit.
type DepositData ¶
type DepositData struct {
*zond.Deposit_Data
}
DepositData is a field of Deposit.
func (*DepositData) MarshalJSON ¶
func (d *DepositData) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of DepositData.
type DilithiumToExecutionChange ¶
type DilithiumToExecutionChange struct {
*zond.DilithiumToExecutionChange
}
DilithiumToExecutionChange is a field in SignedDilithiumToExecutionChange.
func (*DilithiumToExecutionChange) MarshalJSON ¶
func (ch *DilithiumToExecutionChange) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of DilithiumToExecutionChange.
type ErrorMessage ¶
type ErrorMessage struct {
Code int `json:"code"`
Message string `json:"message"`
Stacktraces []string `json:"stacktraces,omitempty"`
}
ErrorMessage is a JSON representation of the builder API's returned error message.
type Eth1Data ¶
Eth1Data is a field of Beacon Block Body.
func (*Eth1Data) MarshalJSON ¶
MarshalJSON returns a JSON byte array representation of Eth1Data.
type ExecHeaderResponseCapella ¶
type ExecHeaderResponseCapella struct {
Data struct {
Signature hexutil.Bytes `json:"signature"`
Message *BuilderBidCapella `json:"message"`
} `json:"data"`
}
ExecHeaderResponseCapella is the response of builder API /zond/v1/builder/header/{slot}/{parent_hash}/{pubkey} for Capella.
func (*ExecHeaderResponseCapella) ToProto ¶
func (ehr *ExecHeaderResponseCapella) ToProto() (*zond.SignedBuilderBidCapella, error)
ToProto returns a SignedBuilderBidCapella Proto from ExecHeaderResponseCapella.
type ExecPayloadResponseCapella ¶
type ExecPayloadResponseCapella struct {
Version string `json:"version"`
Data ExecutionPayloadCapella `json:"data"`
}
ExecPayloadResponseCapella is the builder API /zond/v1/builder/blinded_blocks for Capella.
func (*ExecPayloadResponseCapella) ToProto ¶
func (r *ExecPayloadResponseCapella) ToProto() (*v1.ExecutionPayloadCapella, error)
ToProto returns a ExecutionPayloadCapella Proto.
type ExecutionPayloadCapella ¶
type ExecutionPayloadCapella struct {
ParentHash hexutil.Bytes `json:"parent_hash"`
FeeRecipient hexutil.BytesZ `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"`
}
ExecutionPayloadCapella is a field of ExecPayloadResponseCapella.
func FromProtoCapella ¶
func FromProtoCapella(payload *v1.ExecutionPayloadCapella) (ExecutionPayloadCapella, error)
FromProtoCapella converts a proto execution payload type for capella to our builder compatible payload type.
func (*ExecutionPayloadCapella) ToProto ¶
func (p *ExecutionPayloadCapella) ToProto() (*v1.ExecutionPayloadCapella, error)
ToProto returns a ExecutionPayloadCapella Proto.
type ExecutionPayloadHeaderCapella ¶
type ExecutionPayloadHeaderCapella struct {
ParentHash hexutil.Bytes `json:"parent_hash"`
FeeRecipient hexutil.BytesZ `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
}
ExecutionPayloadHeaderCapella is a field in BuilderBidCapella.
func (*ExecutionPayloadHeaderCapella) MarshalJSON ¶
func (h *ExecutionPayloadHeaderCapella) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte representation of ExecutionPayloadHeaderCapella.
func (*ExecutionPayloadHeaderCapella) ToProto ¶
func (h *ExecutionPayloadHeaderCapella) ToProto() (*v1.ExecutionPayloadHeaderCapella, error)
ToProto returns a ExecutionPayloadHeaderCapella Proto
func (*ExecutionPayloadHeaderCapella) UnmarshalJSON ¶
func (h *ExecutionPayloadHeaderCapella) UnmarshalJSON(b []byte) error
UnmarshalJSON takes a JSON byte array and sets ExecutionPayloadHeaderCapella.
type IndexedAttestation ¶
type IndexedAttestation struct {
*zond.IndexedAttestation
}
IndexedAttestation is a field of AttesterSlashing.
func (*IndexedAttestation) MarshalJSON ¶
func (a *IndexedAttestation) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of IndexedAttestation.
type ProposerSlashing ¶
type ProposerSlashing struct {
*zond.ProposerSlashing
}
ProposerSlashing is a field in BlindedBeaconBlockBodyCapella.
func (*ProposerSlashing) MarshalJSON ¶
func (s *ProposerSlashing) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of ProposerSlashing.
type SignedBeaconBlockHeader ¶
type SignedBeaconBlockHeader struct {
*zond.SignedBeaconBlockHeader
}
SignedBeaconBlockHeader is a field of ProposerSlashing.
func (*SignedBeaconBlockHeader) MarshalJSON ¶
func (h *SignedBeaconBlockHeader) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of SignedBeaconBlockHeader.
type SignedBid ¶
SignedBid is an interface describing the method set of a signed builder bid.
func WrappedSignedBuilderBidCapella ¶
func WrappedSignedBuilderBidCapella(p *zondpb.SignedBuilderBidCapella) (SignedBid, error)
WrappedSignedBuilderBidCapella is a constructor which wraps a protobuf signed bit into an interface.
type SignedDilithiumToExecutionChange ¶
type SignedDilithiumToExecutionChange struct {
*zond.SignedDilithiumToExecutionChange
}
SignedDilithiumToExecutionChange is a field in Beacon Block Body for capella and above.
func (*SignedDilithiumToExecutionChange) MarshalJSON ¶
func (ch *SignedDilithiumToExecutionChange) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of SignedDilithiumToExecutionChange.
type SignedVoluntaryExit ¶
type SignedVoluntaryExit struct {
*zond.SignedVoluntaryExit
}
SignedVoluntaryExit is a field of Beacon Block Body.
func (*SignedVoluntaryExit) MarshalJSON ¶
func (sve *SignedVoluntaryExit) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of SignedVoluntaryExit.
type SyncAggregate ¶
type SyncAggregate struct {
*zond.SyncAggregate
}
SyncAggregate is a field of Beacon Block Body.
func (*SyncAggregate) MarshalJSON ¶
func (s *SyncAggregate) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of SyncAggregate.
type Uint64String ¶
type Uint64String uint64
Uint64String is a custom type that allows marshalling from text to uint64 and vice versa.
func (Uint64String) MarshalText ¶
func (s Uint64String) MarshalText() ([]byte, error)
MarshalText returns a byte representation of the text from Uint64String.
func (*Uint64String) UnmarshalText ¶
func (s *Uint64String) UnmarshalText(t []byte) error
UnmarshalText takes a byte array and unmarshals the text in Uint64String.
type Uint256 ¶
Uint256 a wrapper representation of big.Int
func (Uint256) MarshalJSON ¶
MarshalJSON returns a json byte representation of Uint256.
func (Uint256) MarshalText ¶
MarshalText returns a text byte representation of Uint256.
func (Uint256) SSZBytes ¶
SSZBytes creates an ssz-style (little-endian byte slice) representation of the Uint256.
func (*Uint256) UnmarshalJSON ¶
UnmarshalJSON takes in a byte array and unmarshals the value in Uint256
func (*Uint256) UnmarshalText ¶
UnmarshalText takes in a byte array and unmarshals the text in Uint256
type VersionResponse ¶
type VersionResponse struct {
Version string `json:"version"`
}
VersionResponse is a JSON representation of a field in the builder API header response.
type VoluntaryExit ¶
type VoluntaryExit struct {
*zond.VoluntaryExit
}
VoluntaryExit is a field in SignedVoluntaryExit
func (*VoluntaryExit) MarshalJSON ¶
func (ve *VoluntaryExit) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON byte array representation of VoluntaryExit