common

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: AGPL-3.0 Imports: 15 Imported by: 6

Documentation

Overview

Package common provides things used by various other components

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerAlreadyRunning = errors.New("server already running")

	SlotsPerEpoch    = 32
	DurationPerSlot  = time.Second * 12
	DurationPerEpoch = DurationPerSlot * time.Duration(SlotsPerEpoch)
)
View Source
var (
	ErrInvalidSlot      = errors.New("invalid slot")
	ErrInvalidHash      = errors.New("invalid hash")
	ErrInvalidPubkey    = errors.New("invalid pubkey")
	ErrInvalidSignature = errors.New("invalid signature")
)
View Source
var (
	EthNetworkKiln     = "kiln"
	EthNetworkRopsten  = "ropsten"
	EthNetworkSepolia  = "sepolia"
	EthNetworkGoerli   = "goerli"
	EthNetworkMainnet  = "mainnet"
	EthNetworkZhejiang = "zhejiang"

	// Zhejiang details
	GenesisForkVersionZhejiang    = "0x00000069"
	GenesisValidatorsRootZhejiang = "0x53a92d8f2bb1d85f62d16a156e6ebcd1bcaba652d0900b2c2f387826f3481f6f"
	BellatrixForkVersionZhejiang  = "0x00000071"
)
View Source
var (
	ErrInvalidForkVersion = errors.New("invalid fork version")
	ErrHTTPErrorResponse  = errors.New("got an HTTP error response")
)
View Source
var ErrUnknownNetwork = errors.New("unknown network")
View Source
var TestLog = logrus.WithField("testing", true)

TestLog is used to log information in the test methods

View Source
var ValidPayloadRegisterValidator = types.SignedValidatorRegistration{
	Message: &types.RegisterValidatorRequestMessage{
		FeeRecipient: _HexToAddress("0xdb65fEd33dc262Fe09D9a2Ba8F80b329BA25f941"),
		Timestamp:    1234356,
		GasLimit:     278234191203,
		Pubkey: _HexToPubkey(
			"0x8a1d7b8dd64e0aafe7ea7b6c95065c9364cf99d38470c12ee807d55f7de1529ad29ce2c422e0b65e3d5a05c02caca249"),
	},

	Signature: _HexToSignature(
		"0x8209b5391cd69f392b1f02dbc03bab61f574bb6bb54bf87b59e2a85bdc0756f7db6a71ce1b41b727a1f46ccc77b213bf0df1426177b5b29926b39956114421eaa36ec4602969f6f6370a44de44a6bce6dae2136e5fb594cce2a476354264d1ea"),
}

Functions

func ComputeDomain

func ComputeDomain(domainType types.DomainType, forkVersionHex, genesisValidatorsRootHex string) (domain types.Domain, err error)

ComputeDomain computes the signing domain

func GetEnv

func GetEnv(key, defaultValue string) string

func GetIPXForwardedFor

func GetIPXForwardedFor(r *http.Request) string

func GetMevBoostVersionFromUserAgent added in v0.8.1

func GetMevBoostVersionFromUserAgent(ua string) string

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 GetSliceEnv(key string, defaultValue []string) []string

func LogSetup

func LogSetup(json bool, logLevel string) *logrus.Entry

Types

type BidTraceV2 added in v0.10.0

type BidTraceV2 struct {
	types.BidTrace
	BlockNumber uint64 `json:"block_number,string" db:"block_number"`
	NumTx       uint64 `json:"num_tx,string" db:"num_tx"`
}

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"`
}

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 BuilderEntry

type BuilderEntry struct {
	Address string
	Pubkey  hexutil.Bytes
	URL     *url.URL
}

BuilderEntry represents a builder that is allowed to send blocks Address will be schema://hostname:port

func NewBuilderEntry

func NewBuilderEntry(builderURL string) (entry *BuilderEntry, err error)

NewBuilderEntry creates a new instance based on an input string builderURL can be IP@PORT, PUBKEY@IP:PORT, https://IP, etc.

type EthNetworkDetails

type EthNetworkDetails struct {
	Name                     string
	GenesisForkVersionHex    string
	GenesisValidatorsRootHex string
	BellatrixForkVersionHex  string

	DomainBuilder        types.Domain
	DomainBeaconProposer types.Domain
}

func NewEthNetworkDetails

func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error)

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

Jump to

Keyboard shortcuts

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