Documentation ¶
Overview ¶
Package common provides things used by various other components
Index ¶
- Variables
- func BoostBidToBidTrace(bidTrace *boostTypes.BidTrace) *apiv1.BidTrace
- func BuilderSubmitBlockRequestToSignedBuilderBid(req *boostTypes.BuilderSubmitBlockRequest, sk *bls.SecretKey, ...) (*boostTypes.SignedBuilderBid, error)
- func CapellaBuilderSubmitBlockRequestToSignedBuilderBid(req *capella.SubmitBlockRequest, sk *bls.SecretKey, pubkey *phase0.BLSPubKey, ...) (*capella.SignedBuilderBid, error)
- func CapellaPayloadToPayloadHeader(p *consensuscapella.ExecutionPayload) (*consensuscapella.ExecutionPayloadHeader, error)
- func ComputeDomain(domainType types.DomainType, forkVersionHex, genesisValidatorsRootHex string) (domain types.Domain, err error)
- func CreateTestBlockSubmission(t *testing.T, builderPubkey string, value *big.Int, ...) (payload *BuilderSubmitBlockRequest, getPayloadResponse *GetPayloadResponse, ...)
- func GetEnv(key, defaultValue string) string
- func GetEnvStrSlice(key string, defaultValue []string) []string
- func GetIPXForwardedFor(r *http.Request) string
- func GetMevBoostVersionFromUserAgent(ua string) string
- func GetSliceEnv(key string, defaultValue []string) []string
- func LoadGzippedBytes(t *testing.T, filename string) []byte
- func LoadGzippedJSON(t *testing.T, filename string, dst any)
- func LogSetup(json bool, logLevel string) *logrus.Entry
- func SlotPos(slot uint64) uint64
- func StrToPhase0Hash(s string) (ret phase0.Hash32, err error)
- func StrToPhase0Pubkey(s string) (ret phase0.BLSPubKey, err error)
- func U256StrToUint256(s types.U256Str) *uint256.Int
- type BidTraceV2
- type BidTraceV2JSON
- type BidTraceV2WithTimestampJSON
- type BuilderBlockValidationRequest
- type BuilderGetValidatorsResponseEntry
- type BuilderStatus
- type BuilderSubmitBlockRequest
- func (b *BuilderSubmitBlockRequest) BlockHash() string
- func (b *BuilderSubmitBlockRequest) BlockNumber() uint64
- func (b *BuilderSubmitBlockRequest) BuilderPubkey() phase0.BLSPubKey
- func (b *BuilderSubmitBlockRequest) ExecutionPayloadBlockHash() string
- func (b *BuilderSubmitBlockRequest) ExecutionPayloadParentHash() string
- func (b *BuilderSubmitBlockRequest) ExecutionPayloadResponse() (*GetPayloadResponse, error)
- func (b *BuilderSubmitBlockRequest) GasLimit() uint64
- func (b *BuilderSubmitBlockRequest) GasUsed() uint64
- func (b *BuilderSubmitBlockRequest) HasExecutionPayload() bool
- func (b *BuilderSubmitBlockRequest) MarshalJSON() ([]byte, error)
- func (b *BuilderSubmitBlockRequest) Message() *apiv1.BidTrace
- func (b *BuilderSubmitBlockRequest) NumTx() int
- func (b *BuilderSubmitBlockRequest) ParentHash() string
- func (b *BuilderSubmitBlockRequest) ProposerFeeRecipient() string
- func (b *BuilderSubmitBlockRequest) ProposerPubkey() string
- func (b *BuilderSubmitBlockRequest) Random() string
- func (b *BuilderSubmitBlockRequest) Signature() phase0.BLSSignature
- func (b *BuilderSubmitBlockRequest) Slot() uint64
- func (b *BuilderSubmitBlockRequest) Timestamp() uint64
- func (b *BuilderSubmitBlockRequest) UnmarshalJSON(data []byte) error
- func (b *BuilderSubmitBlockRequest) Value() *big.Int
- func (b *BuilderSubmitBlockRequest) Withdrawals() []*consensuscapella.Withdrawal
- type CreateTestBlockSubmissionOpts
- type EthNetworkDetails
- type GetHeaderResponse
- type GetPayloadResponse
- type HTTPErrorResp
- type HTTPServerTimeouts
- type Profile
- type SignedBeaconBlock
- type SignedBlindedBeaconBlock
- func (s *SignedBlindedBeaconBlock) BlockHash() string
- func (s *SignedBlindedBeaconBlock) BlockNumber() uint64
- func (s *SignedBlindedBeaconBlock) MarshalJSON() ([]byte, error)
- func (s *SignedBlindedBeaconBlock) Message() boostTypes.HashTreeRoot
- func (s *SignedBlindedBeaconBlock) ProposerIndex() uint64
- func (s *SignedBlindedBeaconBlock) Signature() []byte
- func (s *SignedBlindedBeaconBlock) Slot() uint64
- type VersionedExecutionPayload
Constants ¶
This section is empty.
Variables ¶
var ( ErrServerAlreadyRunning = errors.New("server already running") SecondsPerSlot = uint64(cli.GetEnvInt("SEC_PER_SLOT", 12)) DurationPerSlot = time.Duration(SecondsPerSlot) * time.Second SlotsPerEpoch = uint64(cli.GetEnvInt("SLOTS_PER_EPOCH", 32)) DurationPerEpoch = DurationPerSlot * time.Duration(SlotsPerEpoch) )
var ( ErrInvalidSlot = errors.New("invalid slot") ErrInvalidHash = errors.New("invalid hash") ErrInvalidPubkey = errors.New("invalid pubkey") ErrInvalidSignature = errors.New("invalid signature") )
var ( ErrUnknownNetwork = errors.New("unknown network") ErrEmptyPayload = errors.New("empty payload") EthNetworkRopsten = "ropsten" EthNetworkSepolia = "sepolia" EthNetworkGoerli = "goerli" EthNetworkMainnet = "mainnet" EthNetworkZhejiang = "zhejiang" EthNetworkCustom = "custom" CapellaForkVersionRopsten = "0x03001020" CapellaForkVersionSepolia = "0x90000072" CapellaForkVersionGoerli = "0x03001020" CapellaForkVersionMainnet = "0x03000000" // Zhejiang details GenesisForkVersionZhejiang = "0x00000069" GenesisValidatorsRootZhejiang = "0x53a92d8f2bb1d85f62d16a156e6ebcd1bcaba652d0900b2c2f387826f3481f6f" BellatrixForkVersionZhejiang = "0x00000071" CapellaForkVersionZhejiang = "0x00000072" ForkVersionStringBellatrix = "bellatrix" ForkVersionStringCapella = "capella" ForkVersionStringDeneb = "deneb" )
var ( ErrMissingRequest = errors.New("req is nil") ErrMissingSecretKey = errors.New("secret key is nil") ErrInvalidTransaction = errors.New("invalid transaction") )
var ( ErrInvalidForkVersion = errors.New("invalid fork version") ErrHTTPErrorResponse = errors.New("got an HTTP error response") ErrIncorrectLength = errors.New("incorrect length") )
var NilResponse = struct{}{}
var TestLog = logrus.WithField("testing", true)
TestLog is used to log information in the test methods
var ValidPayloadRegisterValidator = boostTypes.SignedValidatorRegistration{ Message: &boostTypes.RegisterValidatorRequestMessage{ FeeRecipient: _HexToAddress("0xdb65fEd33dc262Fe09D9a2Ba8F80b329BA25f941"), Timestamp: 1606824043, GasLimit: 30000000, Pubkey: _HexToPubkey( "0x84e975405f8691ad7118527ee9ee4ed2e4e8bae973f6e29aa9ca9ee4aea83605ae3536d22acc9aa1af0545064eacf82e"), }, Signature: _HexToSignature( "0xaf12df007a0c78abb5575067e5f8b089cfcc6227e4a91db7dd8cf517fe86fb944ead859f0781277d9b78c672e4a18c5d06368b603374673cf2007966cece9540f3a1b3f6f9e1bf421d779c4e8010368e6aac134649c7a009210780d401a778a5"), }
var ZeroU256 = boostTypes.IntToU256(0)
Functions ¶
func BoostBidToBidTrace ¶ added in v0.20.0
func BoostBidToBidTrace(bidTrace *boostTypes.BidTrace) *apiv1.BidTrace
func BuilderSubmitBlockRequestToSignedBuilderBid ¶ added in v0.20.0
func BuilderSubmitBlockRequestToSignedBuilderBid(req *boostTypes.BuilderSubmitBlockRequest, sk *bls.SecretKey, pubkey *boostTypes.PublicKey, domain boostTypes.Domain) (*boostTypes.SignedBuilderBid, error)
func CapellaBuilderSubmitBlockRequestToSignedBuilderBid ¶ added in v0.20.0
func CapellaBuilderSubmitBlockRequestToSignedBuilderBid(req *capella.SubmitBlockRequest, sk *bls.SecretKey, pubkey *phase0.BLSPubKey, domain boostTypes.Domain) (*capella.SignedBuilderBid, error)
func CapellaPayloadToPayloadHeader ¶ added in v0.20.0
func CapellaPayloadToPayloadHeader(p *consensuscapella.ExecutionPayload) (*consensuscapella.ExecutionPayloadHeader, error)
func ComputeDomain ¶
func ComputeDomain(domainType types.DomainType, forkVersionHex, genesisValidatorsRootHex string) (domain types.Domain, err error)
ComputeDomain computes the signing domain
func CreateTestBlockSubmission ¶ added in v0.20.0
func CreateTestBlockSubmission(t *testing.T, builderPubkey string, value *big.Int, opts *CreateTestBlockSubmissionOpts) (payload *BuilderSubmitBlockRequest, getPayloadResponse *GetPayloadResponse, getHeaderResponse *GetHeaderResponse)
func GetEnvStrSlice ¶ added in v0.20.0
GetEnvStrSlice returns a slice of strings from a comma-separated env var
func GetIPXForwardedFor ¶
func GetMevBoostVersionFromUserAgent ¶ added in v0.8.1
GetMevBoostVersionFromUserAgent returns the mev-boost version from an user agent string Example ua: "mev-boost/1.0.1 go-http-client" -> returns "1.0.1". If no version is found, returns "-"
func GetSliceEnv ¶
func LoadGzippedBytes ¶ added in v0.26.0
func LoadGzippedJSON ¶ added in v0.26.0
func SlotPos ¶ added in v0.20.0
SlotPos returns the slot's position in the epoch (1-based, i.e. 1..32)
func StrToPhase0Hash ¶ added in v0.20.0
func StrToPhase0Pubkey ¶ added in v0.20.0
Types ¶
type BidTraceV2 ¶ added in v0.10.0
type BidTraceV2 struct { apiv1.BidTrace BlockNumber uint64 `json:"block_number,string" db:"block_number"` NumTx uint64 `json:"num_tx,string" db:"num_tx"` }
func (BidTraceV2) MarshalJSON ¶ added in v0.20.0
func (b BidTraceV2) MarshalJSON() ([]byte, error)
func (*BidTraceV2) UnmarshalJSON ¶ added in v0.20.0
func (b *BidTraceV2) UnmarshalJSON(data []byte) error
type BidTraceV2JSON ¶ added in v0.10.0
type BidTraceV2JSON 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"` NumTx uint64 `json:"num_tx,string"` BlockNumber uint64 `json:"block_number,string"` }
func (*BidTraceV2JSON) CSVHeader ¶ added in v0.10.0
func (b *BidTraceV2JSON) CSVHeader() []string
func (*BidTraceV2JSON) ToCSVRecord ¶ added in v0.10.0
func (b *BidTraceV2JSON) ToCSVRecord() []string
type BidTraceV2WithTimestampJSON ¶ added in v0.10.0
type BidTraceV2WithTimestampJSON struct { BidTraceV2JSON Timestamp int64 `json:"timestamp,string,omitempty"` TimestampMs int64 `json:"timestamp_ms,string,omitempty"` OptimisticSubmission bool `json:"optimistic_submission"` }
func (*BidTraceV2WithTimestampJSON) CSVHeader ¶ added in v0.14.0
func (b *BidTraceV2WithTimestampJSON) CSVHeader() []string
func (*BidTraceV2WithTimestampJSON) ToCSVRecord ¶ added in v0.14.0
func (b *BidTraceV2WithTimestampJSON) ToCSVRecord() []string
type BuilderBlockValidationRequest ¶ added in v0.20.0
type BuilderBlockValidationRequest struct { BuilderSubmitBlockRequest RegisteredGasLimit uint64 `json:"registered_gas_limit,string"` }
func (*BuilderBlockValidationRequest) MarshalJSON ¶ added in v0.20.0
func (r *BuilderBlockValidationRequest) MarshalJSON() ([]byte, error)
type BuilderGetValidatorsResponseEntry ¶ added in v0.20.0
type BuilderGetValidatorsResponseEntry struct { Slot uint64 `json:"slot,string"` ValidatorIndex uint64 `json:"validator_index,string"` Entry *boostTypes.SignedValidatorRegistration `json:"entry"` }
type BuilderStatus ¶ added in v0.24.0
BuilderStatus configures how builder blocks are processed.
type BuilderSubmitBlockRequest ¶ added in v0.20.0
type BuilderSubmitBlockRequest struct { Bellatrix *boostTypes.BuilderSubmitBlockRequest Capella *capella.SubmitBlockRequest }
func TestBuilderSubmitBlockRequest ¶ added in v0.24.0
func TestBuilderSubmitBlockRequest(sk *bls.SecretKey, bid *BidTraceV2) BuilderSubmitBlockRequest
func (*BuilderSubmitBlockRequest) BlockHash ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) BlockHash() string
func (*BuilderSubmitBlockRequest) BlockNumber ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) BlockNumber() uint64
func (*BuilderSubmitBlockRequest) BuilderPubkey ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) BuilderPubkey() phase0.BLSPubKey
func (*BuilderSubmitBlockRequest) ExecutionPayloadBlockHash ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ExecutionPayloadBlockHash() string
func (*BuilderSubmitBlockRequest) ExecutionPayloadParentHash ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ExecutionPayloadParentHash() string
func (*BuilderSubmitBlockRequest) ExecutionPayloadResponse ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ExecutionPayloadResponse() (*GetPayloadResponse, error)
func (*BuilderSubmitBlockRequest) GasLimit ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) GasLimit() uint64
func (*BuilderSubmitBlockRequest) GasUsed ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) GasUsed() uint64
func (*BuilderSubmitBlockRequest) HasExecutionPayload ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) HasExecutionPayload() bool
func (*BuilderSubmitBlockRequest) MarshalJSON ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) MarshalJSON() ([]byte, error)
func (*BuilderSubmitBlockRequest) Message ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Message() *apiv1.BidTrace
func (*BuilderSubmitBlockRequest) NumTx ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) NumTx() int
func (*BuilderSubmitBlockRequest) ParentHash ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ParentHash() string
func (*BuilderSubmitBlockRequest) ProposerFeeRecipient ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ProposerFeeRecipient() string
func (*BuilderSubmitBlockRequest) ProposerPubkey ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) ProposerPubkey() string
func (*BuilderSubmitBlockRequest) Random ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Random() string
func (*BuilderSubmitBlockRequest) Signature ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Signature() phase0.BLSSignature
func (*BuilderSubmitBlockRequest) Slot ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Slot() uint64
func (*BuilderSubmitBlockRequest) Timestamp ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Timestamp() uint64
func (*BuilderSubmitBlockRequest) UnmarshalJSON ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) UnmarshalJSON(data []byte) error
func (*BuilderSubmitBlockRequest) Value ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Value() *big.Int
func (*BuilderSubmitBlockRequest) Withdrawals ¶ added in v0.20.0
func (b *BuilderSubmitBlockRequest) Withdrawals() []*consensuscapella.Withdrawal
type CreateTestBlockSubmissionOpts ¶ added in v0.20.0
type EthNetworkDetails ¶
type EthNetworkDetails struct { Name string GenesisForkVersionHex string GenesisValidatorsRootHex string BellatrixForkVersionHex string CapellaForkVersionHex string DomainBuilder boostTypes.Domain DomainBeaconProposerBellatrix boostTypes.Domain DomainBeaconProposerCapella boostTypes.Domain }
func NewEthNetworkDetails ¶
func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error)
func (*EthNetworkDetails) String ¶ added in v0.20.0
func (e *EthNetworkDetails) String() string
type GetHeaderResponse ¶ added in v0.20.0
type GetHeaderResponse struct { Bellatrix *boostTypes.GetHeaderResponse Capella *spec.VersionedSignedBuilderBid }
func BuildGetHeaderResponse ¶ added in v0.20.0
func BuildGetHeaderResponse(payload *BuilderSubmitBlockRequest, sk *bls.SecretKey, pubkey *boostTypes.PublicKey, domain boostTypes.Domain) (*GetHeaderResponse, error)
func (*GetHeaderResponse) BlockHash ¶ added in v0.20.0
func (p *GetHeaderResponse) BlockHash() phase0.Hash32
func (*GetHeaderResponse) Empty ¶ added in v0.20.0
func (p *GetHeaderResponse) Empty() bool
func (*GetHeaderResponse) MarshalJSON ¶ added in v0.20.0
func (p *GetHeaderResponse) MarshalJSON() ([]byte, error)
func (*GetHeaderResponse) UnmarshalJSON ¶ added in v0.20.0
func (p *GetHeaderResponse) UnmarshalJSON(data []byte) error
func (*GetHeaderResponse) Value ¶ added in v0.20.0
func (p *GetHeaderResponse) Value() *big.Int
type GetPayloadResponse ¶ added in v0.20.0
type GetPayloadResponse struct { Bellatrix *boostTypes.GetPayloadResponse Capella *api.VersionedExecutionPayload }
func BuildGetPayloadResponse ¶ added in v0.20.0
func BuildGetPayloadResponse(payload *BuilderSubmitBlockRequest) (*GetPayloadResponse, error)
func (*GetPayloadResponse) MarshalJSON ¶ added in v0.20.0
func (p *GetPayloadResponse) MarshalJSON() ([]byte, error)
func (*GetPayloadResponse) UnmarshalJSON ¶ added in v0.20.0
func (p *GetPayloadResponse) UnmarshalJSON(data []byte) error
type HTTPErrorResp ¶ added in v0.20.0
type HTTPServerTimeouts ¶
type HTTPServerTimeouts struct { Read time.Duration // Timeout for body reads. None if 0. ReadHeader time.Duration // Timeout for header reads. None if 0. Write time.Duration // Timeout for writes. None if 0. Idle time.Duration // Timeout to disconnect idle client connections. None if 0. }
HTTPServerTimeouts are various timeouts for requests to the mev-boost HTTP server
type Profile ¶ added in v0.24.0
type Profile struct { Decode uint64 Prechecks uint64 Simulation uint64 RedisUpdate uint64 Total uint64 }
Profile captures performance metrics for the block submission handler. Each field corresponds to the number of microseconds in each stage. The `Total` field is the number of microseconds taken for entire flow.
type SignedBeaconBlock ¶ added in v0.20.0
type SignedBeaconBlock struct { Bellatrix *boostTypes.SignedBeaconBlock Capella *consensuscapella.SignedBeaconBlock }
func SignedBlindedBeaconBlockToBeaconBlock ¶ added in v0.20.0
func SignedBlindedBeaconBlockToBeaconBlock(signedBlindedBeaconBlock *SignedBlindedBeaconBlock, executionPayload *VersionedExecutionPayload) *SignedBeaconBlock
func (*SignedBeaconBlock) BlockHash ¶ added in v0.20.0
func (s *SignedBeaconBlock) BlockHash() string
func (*SignedBeaconBlock) MarshalJSON ¶ added in v0.20.0
func (s *SignedBeaconBlock) MarshalJSON() ([]byte, error)
func (*SignedBeaconBlock) Slot ¶ added in v0.20.0
func (s *SignedBeaconBlock) Slot() uint64
type SignedBlindedBeaconBlock ¶ added in v0.20.0
type SignedBlindedBeaconBlock struct { Bellatrix *boostTypes.SignedBlindedBeaconBlock Capella *apiv1capella.SignedBlindedBeaconBlock }
func (*SignedBlindedBeaconBlock) BlockHash ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) BlockHash() string
func (*SignedBlindedBeaconBlock) BlockNumber ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) BlockNumber() uint64
func (*SignedBlindedBeaconBlock) MarshalJSON ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) MarshalJSON() ([]byte, error)
func (*SignedBlindedBeaconBlock) Message ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) Message() boostTypes.HashTreeRoot
func (*SignedBlindedBeaconBlock) ProposerIndex ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) ProposerIndex() uint64
func (*SignedBlindedBeaconBlock) Signature ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) Signature() []byte
func (*SignedBlindedBeaconBlock) Slot ¶ added in v0.20.0
func (s *SignedBlindedBeaconBlock) Slot() uint64
type VersionedExecutionPayload ¶ added in v0.20.0
type VersionedExecutionPayload struct { Bellatrix *boostTypes.GetPayloadResponse Capella *api.VersionedExecutionPayload }
func (*VersionedExecutionPayload) MarshalJSON ¶ added in v0.20.0
func (e *VersionedExecutionPayload) MarshalJSON() ([]byte, error)
func (*VersionedExecutionPayload) NumTx ¶ added in v0.20.0
func (e *VersionedExecutionPayload) NumTx() int
func (*VersionedExecutionPayload) UnmarshalJSON ¶ added in v0.20.0
func (e *VersionedExecutionPayload) UnmarshalJSON(data []byte) error