boost

package
v0.0.0-...-84dde57 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// proposer endpoints
	PathStatus      = "/primev/v0/status"
	PathSubmitBlock = "/primev/v1/builder/blocks"

	// searcher endpoints
	PathSearcherConnect = "/ws"
)

Router paths

View Source
const (
	KeySearcherAddress key = iota
)
View Source
const (
	Version = "0.0.1"
)

Variables

View Source
var (
	ErrBlockUnprocessable = errors.New("V001: block unprocessable")
)
View Source
var (
	ErrParamNotFound = errors.New("not found")
)

Functions

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *metrics

Types

type API

type API struct {
	Service BoostService
	Worker  *Worker
	Rollup  rollup.Rollup
	Log     log.Logger

	BuilderToken   string
	MetricsEnabled bool
	InclusionList  bool
	// contains filtered or unexported fields
}

func (*API) ConnectedSearcher

func (a *API) ConnectedSearcher(w http.ResponseWriter, r *http.Request)

connectSearcher is the handler to connect a searcher to the builder for the websocket execution hints TODO(@ckartik): Move the handling of searcher connection to service layer

GET /ws?token=abcd where "abcd" is the authentication token of the searcher The handler authenticates based on the following criteria: 1. The token is valid 2. The searcher behind the token has active subscription 3. The searcher behind the token is not already connected

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Boost

type Boost interface {
	SubmitBlock(context.Context, *capella.SubmitBlockRequest, time.Time) error
	GetWorkChannel() chan SuperPayload
}

type BoostService

type BoostService interface {
	// Primev APIs
	// Example(context.Context, *types.ExRequest) error
	SubmitBlock(context.Context, *capella.SubmitBlockRequest, time.Time) error
}

type CommitmentResponse

type CommitmentResponse struct {
	Commitment string `json:"commitment"`
}

type Config

type Config struct {
	Log                  log.Logger
	InclusionProofActive bool
}

Config provides all available options for auction-gateway

type DefaultBoost

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

func NewBoost

func NewBoost(config Config) (*DefaultBoost, error)

NewGateway new auction gateway service

func (*DefaultBoost) GetWorkChannel

func (rs *DefaultBoost) GetWorkChannel() chan SuperPayload

func (*DefaultBoost) Log

func (rs *DefaultBoost) Log() log.Logger

func (*DefaultBoost) SubmitBlock

func (as *DefaultBoost) SubmitBlock(ctx context.Context, msg *capella.SubmitBlockRequest, now time.Time) (err error)

type DefaultService

type DefaultService struct {
	Log    log.Logger
	Config Config
	Boost
	// contains filtered or unexported fields
}

func (*DefaultService) Ready

func (s *DefaultService) Ready() <-chan struct{}

func (*DefaultService) Run

func (s *DefaultService) Run(ctx context.Context) (err error)

type IDResponse

type IDResponse struct {
	ID string `json:"id"`
}

type Metadata

type Metadata struct {
	Builder            string      `json:"builder"`
	Number             int64       `json:"number"`
	BlockHash          string      `json:"blockHash"`
	Timestamp          string      `json:"timestamp"`
	BaseFee            uint32      `json:"baseFee"`
	Transactions       Transaction `json:"standard_transactions"`
	ClientTransactions []string    `json:"personal_transactions,omitempty"`
	SentTimestamp      time.Time   `json:"sent_timestamp"` // Timestamp of block sent to the searcher
	RecTimestamp       time.Time   `json:"rec_timestamp"`  // Timestamp of block received by the builder instance
}

type SearcherConnection

type SearcherConnection struct {
	Conn        *websocket.Conn
	WorkChannel chan SuperPayload
}

type SuperPayload

type SuperPayload struct {
	InternalMetadata Metadata
	SearcherTxns     map[string][]string
}

type Transaction

type Transaction struct {
	Count          int64 `json:"count"`
	MinPriorityFee int64 `json:"MinPriorityFee"`
	MaxPriorityFee int64 `json:"MaxPriorityFee"`
}

type VersionResponse

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

type Worker

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

func NewWorker

func NewWorker(workQueue chan SuperPayload, logger log.Logger) *Worker

func (*Worker) GetHeartbeat

func (w *Worker) GetHeartbeat() int64

func (*Worker) Ready

func (w *Worker) Ready() <-chan struct{}

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) (err error)

TODO(@ckartik): Add a channel to request health status of worker

Jump to

Keyboard shortcuts

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