api

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package api contains the API webserver for the proposer and block-builder APIs

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestClosed    = errors.New("request context closed")
	ErrSimulationFailed = errors.New("simulation failed")
)
View Source
var (
	ErrMissingLogOpt                     = errors.New("log parameter is nil")
	ErrMissingBeaconClientOpt            = errors.New("beacon-client is nil")
	ErrMissingDatastoreOpt               = errors.New("proposer datastore is nil")
	ErrRelayPubkeyMismatch               = errors.New("relay pubkey does not match existing one")
	ErrRegistrationWorkersAlreadyStarted = errors.New("validator registration workers already started")
	ErrServerAlreadyStarted              = errors.New("server was already started")
	ErrBuilderAPIWithoutSecretKey        = errors.New("cannot start builder API without secret key")
)
View Source
var (
	ErrMissingRequest   = errors.New("req is nil")
	ErrMissingSecretKey = errors.New("secret key is nil")
)
View Source
var (
	ErrBlockHashMismatch  = errors.New("blockHash mismatch")
	ErrParentHashMismatch = errors.New("parentHash mismatch")
)
View Source
var NilResponse = struct{}{}
View Source
var VersionBellatrix types.VersionString = "bellatrix"
View Source
var ZeroU256 = types.IntToU256(0)

Functions

func BuilderSubmitBlockRequestToSignedBuilderBid

func BuilderSubmitBlockRequestToSignedBuilderBid(req *types.BuilderSubmitBlockRequest, sk *bls.SecretKey, pubkey *types.PublicKey, domain types.Domain) (*types.SignedBuilderBid, error)

func VerifyBuilderBlockSubmission

func VerifyBuilderBlockSubmission(payload *types.BuilderSubmitBlockRequest) error

Types

type BidTraceJSON

type BidTraceJSON struct {
	Slot                 uint64 `json:"slot,string"`
	ParentHash           string `json:"parent_hash"`
	BlockHash            string `json:"block_hash"`
	BuilderPubkey        string `json:"builder_pubkey"`
	ProposerPubkey       string `json:"proposer_pubkey"`
	ProposerFeeRecipient string `json:"proposer_fee_recipient"`
	GasLimit             uint64 `json:"gas_limit,string"`
	GasUsed              uint64 `json:"gas_used,string"`
	Value                string `json:"value"`
}

type BidTraceWithTimestampJSON added in v0.5.1

type BidTraceWithTimestampJSON struct {
	BidTraceJSON

	Timestamp int64 `json:"timestamp,omitempty"`
}

type BlockSimulationRateLimiter

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

func NewBlockSimulationRateLimiter

func NewBlockSimulationRateLimiter(blockSimURL string) *BlockSimulationRateLimiter

type HTTPErrorResp

type HTTPErrorResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RelayAPI

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

RelayAPI represents a single Relay instance

func NewRelayAPI

func NewRelayAPI(opts RelayAPIOpts) (*RelayAPI, error)

NewRelayAPI creates a new service. if builders is nil, allow any builder

func (*RelayAPI) RespondError

func (api *RelayAPI) RespondError(w http.ResponseWriter, code int, message string)

func (*RelayAPI) RespondOK

func (api *RelayAPI) RespondOK(w http.ResponseWriter, response any)

func (*RelayAPI) StartServer

func (api *RelayAPI) StartServer() (err error)

StartServer starts the HTTP server for this instance

type RelayAPIOpts

type RelayAPIOpts struct {
	Log *logrus.Entry

	ListenAddr  string
	BlockSimURL string

	BeaconClient beaconclient.IMultiBeaconClient
	Datastore    *datastore.Datastore
	Redis        *datastore.RedisCache
	DB           database.IDatabaseService

	SecretKey *bls.SecretKey // used to sign bids (getHeader responses)

	// Network specific variables
	EthNetDetails common.EthNetworkDetails

	// APIs to enable
	ProposerAPI     bool
	BlockBuilderAPI bool
	DataAPI         bool
	PprofAPI        bool
}

RelayAPIOpts contains the options for a relay

Jump to

Keyboard shortcuts

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