Documentation ¶
Index ¶
- Constants
- Variables
- func SubmissionToKey(submission *types.BuilderSubmitBlockRequest) structs.PayloadKey
- func SubmitBlockRequestToBlockBidAndTrace(signedBuilderBid *types.SignedBuilderBid, ...) structs.BlockBidAndTrace
- func SubmitBlockRequestToSignedBuilderBid(req *types.BuilderSubmitBlockRequest, sk *bls.SecretKey, ...) (*types.SignedBuilderBid, error)
- func VerifySignature(obj types.HashTreeRoot, d types.Domain, pkBytes, sigBytes []byte) (bool, error)
- func VerifySignatureBytes(msg [32]byte, sigBytes, pkBytes []byte) (ok bool, err error)
- type Datastore
- type FlowControl
- type ProcessManager
- func (rm *ProcessManager) AttachMetrics(m *metrics.Metrics)
- func (rm *ProcessManager) Get(k string) (value uint64, ok bool)
- func (rm *ProcessManager) GetStoreChan() chan StoreReq
- func (rm *ProcessManager) GetVerifyChan(stack uint) chan VerifyReq
- func (rm *ProcessManager) LoadAll(m map[string]uint64)
- func (rm *ProcessManager) ParallelStore(datas Datastore, ttl time.Duration)
- func (rm *ProcessManager) RunCleanup(checkinterval uint64, cleanupInterval time.Duration)
- func (rm *ProcessManager) RunStore(store Datastore, ttl time.Duration, num uint)
- func (rm *ProcessManager) RunVerify(num uint)
- func (rm *ProcessManager) Set(k string, value uint64)
- func (rm *ProcessManager) VerifyChan() chan VerifyReq
- func (rm *ProcessManager) VerifyParallel()
- type ProcessManagerMetrics
- type RegistrationManager
- type Relay
- func (r *Relay) AttachMetrics(m *metrics.Metrics)
- func (rs *Relay) GetHeader(ctx context.Context, request structs.HeaderRequest) (*types.GetHeaderResponse, error)
- func (rs *Relay) GetPayload(ctx context.Context, payloadRequest *types.SignedBlindedBeaconBlock) (*types.GetPayloadResponse, error)
- func (rs *Relay) GetValidators() structs.BuilderGetValidatorsResponseEntrySlice
- func (rs *Relay) RegisterValidator(ctx context.Context, payload []structs.SignedValidatorRegistration) error
- func (rs *Relay) RegisterValidatorSingular(ctx context.Context, payload structs.SignedValidatorRegistration) error
- func (rs *Relay) SubmitBlock(ctx context.Context, submitBlockRequest *types.BuilderSubmitBlockRequest) error
- type RelayConfig
- type RelayMetrics
- type Resp
- type State
- type StoreReq
- type TimestampRegistry
- type VerifyReq
Constants ¶
const ( ResponseQueueSubmit = iota ResponseQueueRegister ResponseQueueOther )
const ( ResponseTypeVerify = iota ResponseTypeOthers ResponseTypeStored )
const BLST_SUCCESS = 0x0
Variables ¶
Functions ¶
func SubmissionToKey ¶
func SubmissionToKey(submission *types.BuilderSubmitBlockRequest) structs.PayloadKey
func SubmitBlockRequestToBlockBidAndTrace ¶
func SubmitBlockRequestToBlockBidAndTrace(signedBuilderBid *types.SignedBuilderBid, submitBlockRequest *types.BuilderSubmitBlockRequest) structs.BlockBidAndTrace
func SubmitBlockRequestToSignedBuilderBid ¶
func SubmitBlockRequestToSignedBuilderBid(req *types.BuilderSubmitBlockRequest, sk *bls.SecretKey, pubkey *types.PublicKey, domain types.Domain) (*types.SignedBuilderBid, error)
***** Relay Domain ***** SubmitBlockRequestToSignedBuilderBid converts a builders block submission to a bid compatible with mev-boost
func VerifySignature ¶
Types ¶
type Datastore ¶
type Datastore interface { CheckSlotDelivered(context.Context, uint64) (bool, error) PutDelivered(context.Context, structs.Slot, structs.DeliveredTrace, time.Duration) error GetDelivered(context.Context, structs.PayloadQuery) (structs.BidTraceWithTimestamp, error) PutPayload(context.Context, structs.PayloadKey, *structs.BlockBidAndTrace, time.Duration) error GetPayload(context.Context, structs.PayloadKey) (*structs.BlockBidAndTrace, error) PutHeader(ctx context.Context, hd structs.HeaderData, ttl time.Duration) error GetMaxProfitHeader(ctx context.Context, slot uint64) (structs.HeaderAndTrace, error) PutRegistrationRaw(context.Context, structs.PubKey, []byte, time.Duration) error GetRegistration(context.Context, structs.PubKey) (types.SignedValidatorRegistration, error) }
type FlowControl ¶
type FlowControl struct { RespCh chan Resp FailureCh chan struct{} ExitCh chan error // contains filtered or unexported fields }
func NewFlowControl ¶
func NewFlowControl(respCh chan Resp, numElements int) (fc *FlowControl)
NewFlowControl takes responseChannel that should be big enougth to store *all* the responses So the external channel should be passed here from pool However, if it's not (nil respCh) the per flow channel is created to handle numElements*3
func (*FlowControl) Close ¶
func (fc *FlowControl) Close()
func (*FlowControl) Exit ¶
func (fc *FlowControl) Exit(err error)
func (*FlowControl) Fail ¶
func (fc *FlowControl) Fail()
func (*FlowControl) SentVerificationInc ¶
func (fc *FlowControl) SentVerificationInc()
func (*FlowControl) SentVerifications ¶
func (fc *FlowControl) SentVerifications() uint32
type ProcessManager ¶
type ProcessManager struct { LastRegTime map[string]uint64 // [pubkey]timestamp VerifySubmitBlockCh chan VerifyReq VerifyRegisterValidatorCh chan VerifyReq VerifyOtherCh chan VerifyReq StoreCh chan StoreReq // contains filtered or unexported fields }
func NewProcessManager ¶
func NewProcessManager(verifySize, storeSize uint) *ProcessManager
func (*ProcessManager) AttachMetrics ¶
func (rm *ProcessManager) AttachMetrics(m *metrics.Metrics)
func (*ProcessManager) GetStoreChan ¶
func (rm *ProcessManager) GetStoreChan() chan StoreReq
func (*ProcessManager) GetVerifyChan ¶
func (rm *ProcessManager) GetVerifyChan(stack uint) chan VerifyReq
func (*ProcessManager) LoadAll ¶
func (rm *ProcessManager) LoadAll(m map[string]uint64)
func (*ProcessManager) ParallelStore ¶
func (rm *ProcessManager) ParallelStore(datas Datastore, ttl time.Duration)
func (*ProcessManager) RunCleanup ¶
func (rm *ProcessManager) RunCleanup(checkinterval uint64, cleanupInterval time.Duration)
func (*ProcessManager) RunStore ¶
func (rm *ProcessManager) RunStore(store Datastore, ttl time.Duration, num uint)
func (*ProcessManager) RunVerify ¶
func (rm *ProcessManager) RunVerify(num uint)
func (*ProcessManager) Set ¶
func (rm *ProcessManager) Set(k string, value uint64)
func (*ProcessManager) VerifyChan ¶
func (rm *ProcessManager) VerifyChan() chan VerifyReq
func (*ProcessManager) VerifyParallel ¶
func (rm *ProcessManager) VerifyParallel()
type ProcessManagerMetrics ¶
type ProcessManagerMetrics struct { VerifyTiming *prometheus.HistogramVec MapSize prometheus.Gauge RunningWorkers *prometheus.GaugeVec }
type RegistrationManager ¶
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
func NewRelay ¶
func NewRelay(l log.Logger, config RelayConfig, beaconState State, d Datastore, regMngr RegistrationManager) *Relay
NewRelay relay service
func (*Relay) AttachMetrics ¶
func (*Relay) GetHeader ¶
func (rs *Relay) GetHeader(ctx context.Context, request structs.HeaderRequest) (*types.GetHeaderResponse, error)
GetHeader is called by a block proposer communicating through mev-boost and returns a bid along with an execution payload header
func (*Relay) GetPayload ¶
func (rs *Relay) GetPayload(ctx context.Context, payloadRequest *types.SignedBlindedBeaconBlock) (*types.GetPayloadResponse, error)
GetPayload is called by a block proposer communicating through mev-boost and reveals execution payload of given signed beacon block if stored
func (*Relay) GetValidators ¶
func (rs *Relay) GetValidators() structs.BuilderGetValidatorsResponseEntrySlice
GetValidators returns a list of registered block proposers in current and next epoch
func (*Relay) RegisterValidator ¶
func (rs *Relay) RegisterValidator(ctx context.Context, payload []structs.SignedValidatorRegistration) error
***** Builder Domain ***** RegisterValidator is called is called by validators communicating through mev-boost who would like to receive a block from us when their slot is scheduled
func (*Relay) RegisterValidatorSingular ¶
func (*Relay) SubmitBlock ¶
func (rs *Relay) SubmitBlock(ctx context.Context, submitBlockRequest *types.BuilderSubmitBlockRequest) error
SubmitBlock Accepts block from trusted builder and stores
type RelayConfig ¶
type RelayConfig struct { BuilderSigningDomain types.Domain ProposerSigningDomain types.Domain PubKey types.PublicKey SecretKey *bls.SecretKey // RegisterValidatorMaxNum is needed to set size of the buffer queue // describing the queue of results before it would be processed by registerSync RegisterValidatorMaxNum uint64 TTL time.Duration }
type RelayMetrics ¶
type RelayMetrics struct {
Timing *prometheus.HistogramVec
}
type Resp ¶
Resp respone structure - potential candidate for structure pool as it's almost constant size
type State ¶
type State interface {
Beacon() *structs.BeaconState
}
type StoreReq ¶
type StoreReq struct { RawPayload json.RawMessage Pubkey types.PublicKey ID int Response chan Resp }
StoreReq is similar to VerifyReq jsut for storing payloads
type TimestampRegistry ¶
type VerifyReq ¶
type VerifyReq struct { Signature [96]byte Pubkey [48]byte Msg [32]byte // Unique identifier of payload // if needed to be passed back in response ID int Response chan Resp }
VerifyReq is a request structure used in communication between api calls and fixed set of worker goroutines it's using return channel pattern, meaning that after sent the sender locks on that channel to get the response