relay

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateRecheckDelay = time.Second
)

Variables

View Source
var (
	ErrUnknownValue            = errors.New("value is unknown")
	ErrPayloadDiffBlockHash    = errors.New("slot payload already delivered with different blockHash")
	ErrHigherSlotDelivered     = errors.New("slot already delivered with higher slot")
	ErrNoPayloadFound          = errors.New("no payload found")
	ErrMissingRequest          = errors.New("req is nil")
	ErrMissingSecretKey        = errors.New("secret key is nil")
	ErrNoBuilderBid            = errors.New("no builder bid")
	ErrTraceMismatch           = errors.New("trace and payload mismatch")
	ErrZeroBid                 = errors.New("zero valued builder bid")
	ErrOldSlot                 = errors.New("requested slot is old")
	ErrBadHeader               = errors.New("invalid block header from datastore")
	ErrInvalidSignature        = errors.New("invalid signature")
	ErrStore                   = errors.New("failed to store")
	ErrMarshal                 = errors.New("failed to marshal")
	ErrInternal                = errors.New("internal server error")
	ErrUnknownValidator        = errors.New("unknown validator")
	ErrVerification            = errors.New("failed to verify")
	ErrInvalidTimestamp        = errors.New("invalid timestamp")
	ErrInvalidSlot             = errors.New("invalid slot")
	ErrEmptyBlock              = errors.New("block is empty")
	ErrWrongPayload            = errors.New("wrong publish payload")
	ErrFailedToPublish         = errors.New("failed to publish block")
	ErrLateRequest             = errors.New("request too late")
	ErrInvalidExecutionPayload = errors.New("invalid execution payload")
)
View Source
var (
	ErrWrongFeeRecipient     = errors.New("wrong fee recipient")
	ErrInvalidWithdrawalSlot = errors.New("invalid withdrawal slot")
	ErrInvalidWithdrawalRoot = errors.New("invalid withdrawal root")
	ErrInvalidRandao         = errors.New("randao is invalid")
)

Functions

func SubmissionToKey

func SubmissionToKey(submission *types.BuilderSubmitBlockRequest) structs.PayloadKey

Types

type Auctioneer

type Auctioneer interface {
	AddBlock(bid structs.BuilderBidExtended) (newMax bool)
	MaxProfitBlock(slot structs.Slot, parentHash types.Hash) (structs.BuilderBidExtended, bool)
}

type Beacon

type Beacon interface {
	PublishBlock(ctx context.Context, block structs.SignedBeaconBlock) error
}

type BlockValidationClient

type BlockValidationClient interface {
	IsSet() bool
	ValidateBlock(ctx context.Context, block *rpctypes.BuilderBlockValidationRequest) (err error)
	ValidateBlockV2(ctx context.Context, block *rpctypes.BuilderBlockValidationRequestV2) (err error)
}

type DataAPIStore

type DataAPIStore interface {
	PutDelivered(context.Context, structs.Slot, structs.DeliveredTrace) error
	GetDeliveredPayloads(ctx context.Context, w io.Writer, headSlot uint64, queryArgs structs.PayloadTraceQuery) error

	PutBuilderBlockSubmission(ctx context.Context, bid structs.BidTraceWithTimestamp, isMostProfitable bool) (err error)
	GetBuilderBlockSubmissions(ctx context.Context, w io.Writer, headSlot uint64, payload structs.SubmissionTraceQuery) error
}

type PayloadCache added in v0.5.0

type PayloadCache interface {
	ContainsOrAdd(structs.PayloadKey, structs.BlockAndTraceExtended) (ok, evicted bool)
	Add(structs.PayloadKey, structs.BlockAndTraceExtended) (evicted bool)
	Get(structs.PayloadKey) (structs.BlockAndTraceExtended, bool)
}

type Relay

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

func NewRelay

func NewRelay(l log.Logger, config *RelayConfig, beacon Beacon, vcache ValidatorCache, vstore ValidatorStore, ver Verifier, beaconState State, pcache PayloadCache, d Datastore, das DataAPIStore, a Auctioneer, bvc BlockValidationClient, wh Warehouse, s Streamer) *Relay

NewRelay relay service

func (*Relay) AttachMetrics

func (r *Relay) AttachMetrics(m *metrics.Metrics)

func (*Relay) Close added in v0.4.4

func (rs *Relay) Close(ctx context.Context)

func (*Relay) GetBlockReceived

func (r *Relay) GetBlockReceived(ctx context.Context, w io.Writer, query structs.SubmissionTraceQuery) error

func (*Relay) GetHeader

GetHeader is called by a block proposer communicating through mev-boost and returns a bid along with an execution payload header

func (*Relay) GetPayload

GetPayload is called by a block proposer communicating through mev-boost and reveals execution payload of given signed beacon block if stored

func (*Relay) GetPayloadDelivered

func (r *Relay) GetPayloadDelivered(ctx context.Context, w io.Writer, query structs.PayloadTraceQuery) error

func (*Relay) RunSubscribersParallel added in v0.5.0

func (rs *Relay) RunSubscribersParallel(ctx context.Context, num uint)

func (*Relay) SubmitBlock

SubmitBlock Accepts block from trusted builder and stores

type RelayConfig

type RelayConfig struct {
	L log.Logger

	BuilderSigningDomain  types.Domain
	ProposerSigningDomain map[structs.ForkVersion]types.Domain
	PubKey                types.PublicKey
	SecretKey             *bls.SecretKey

	GetPayloadResponseDelay    time.Duration
	GetPayloadRequestTimeLimit time.Duration

	PayloadDataTTL       time.Duration
	RegistrationCacheTTL time.Duration

	Distributed, StreamServedBids, PublishBlock bool

	AllowedListedBuilders map[[48]byte]struct{}
}

func (*RelayConfig) OnConfigChange added in v0.6.0

func (rc *RelayConfig) OnConfigChange(c structs.OldNew) (err error)

func (*RelayConfig) ParseInitialConfig added in v0.6.0

func (rc *RelayConfig) ParseInitialConfig(keys []string) (err error)

type RelayMetrics

type RelayMetrics struct {
	MissHeaderCount *prometheus.CounterVec
	CacheHitCount   *prometheus.CounterVec
	RetryCount      *prometheus.CounterVec
}

type State

type State interface {
	KnownValidators() structs.ValidatorsState
	HeadSlot() structs.Slot
	Genesis() structs.GenesisInfo
	Withdrawals(uint64, types.Hash) structs.WithdrawalsState
	Randao(uint64, types.Hash) structs.RandaoState
	ForkVersion(slot structs.Slot) structs.ForkVersion
}

type Streamer added in v0.5.0

type Streamer interface {
	BlockCache() <-chan structs.BlockAndTraceExtended
	PublishBlockCache(ctx context.Context, block structs.BlockAndTraceExtended) error

	BuilderBid() <-chan structs.BuilderBidExtended
	PublishBuilderBid(ctx context.Context, bid structs.BuilderBidExtended) error
}

type ValidatorCache

type ValidatorCache interface {
	Add(types.PublicKey, structs.ValidatorCacheEntry) (evicted bool)
	Get(types.PublicKey) (structs.ValidatorCacheEntry, bool)
	Remove(types.PublicKey) (existed bool)
}

type ValidatorStore

type ValidatorStore interface {
	GetRegistration(context.Context, types.PublicKey) (types.SignedValidatorRegistration, error)
}

type Verifier

type Verifier interface {
	Enqueue(ctx context.Context, sig [96]byte, pubkey [48]byte, msg [32]byte) (err error)
}

type Warehouse added in v0.4.17

type Warehouse interface {
	StoreAsync(ctx context.Context, req wh.StoreRequest) error
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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