Documentation
¶
Overview ¶
Package common provides things used by various other components
Index ¶
- Variables
- func ComputeDomain(domainType types.DomainType, forkVersionHex, genesisValidatorsRootHex string) (domain types.Domain, err error)
- func GetEnv(key, defaultValue string) string
- func GetIPXForwardedFor(r *http.Request) string
- func GetSliceEnv(key string, defaultValue []string) []string
- func LogSetup(json bool, logLevel string)
- type BuilderEntry
- type EpochSummary
- type EthNetworkDetails
- type HTTPServerTimeouts
- type SlotSummary
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" GenesisValidatorsRootGoerli = "0x043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb" GenesisForkVersionGoerli = "0x00001020" BellatrixForkVersionGoerli = "0x02001020" GenesisValidatorsRootGoerliShadowFork6 = "0x6985063fa80a61a958ceeac5cf6125991ac297348e42542c85affbe9fb1c7328" GenesisForkVersionGoerliShadowFork6 = "0x13001035" BellatrixForkVersionGoerliShadowFork6 = "0x22001035" // https://github.com/eth-clients/eth2-networks/blob/f3ccbe0cf5798d5cd23e4e6e7119aefa043c0935/shared/mainnet/config.yaml GenesisValidatorsRootMainnet = "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95" GenesisForkVersionMainnet = "0x00000000" BellatrixForkVersionMainnet = "0x02000000" )
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 GetIPXForwardedFor ¶
func GetSliceEnv ¶
Types ¶
type BuilderEntry ¶
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 EpochSummary ¶
type EpochSummary struct {
Epoch uint64 `json:"epoch" db:"epoch"`
// first and last slots are just derived from the epoch
SlotFirst uint64 `json:"slot_first" db:"slot_first"`
SlotLast uint64 `json:"slot_last" db:"slot_last"`
// registered are those that were actually used by the relay (some might be skipped if only one relay and it started in the middle of the epoch)
SlotFirstProcessed uint64 `json:"slot_first_processed" db:"slot_first_processed"`
SlotLastProcessed uint64 `json:"slot_last_processed" db:"slot_last_processed"`
// Validator stats
ValidatorsKnownTotal uint64 `json:"validators_known_total" db:"validators_known_total"`
ValidatorRegistrationsTotal uint64 `json:"validator_registrations_total" db:"validator_registrations_total"`
ValidatorRegistrationsSaved uint64 `json:"validator_registrations_saved" db:"validator_registrations_saved"`
ValidatorRegistrationsReceivedUnverified uint64 `json:"validator_registrations_received_unverified" db:"validator_registrations_received_unverified"`
// The number of requests are the count of all requests to a specific path, even invalid ones
NumRegisterValidatorRequests uint64 `json:"num_register_validator_requests" db:"num_register_validator_requests"`
NumGetHeaderRequests uint64 `json:"num_get_header_requests" db:"num_get_header_requests"`
NumGetPayloadRequests uint64 `json:"num_get_payload_requests" db:"num_get_payload_requests"`
// Responses to successful queries
NumHeaderSentOk uint64 `json:"num_header_sent_ok" db:"num_header_sent_ok"`
NumHeaderSent204 uint64 `json:"num_header_sent_204" db:"num_header_sent_204"`
NumPayloadSent uint64 `json:"num_payload_sent" db:"num_payload_sent"`
NumBuilderBidReceived uint64 `json:"num_builder_bid_received" db:"num_builder_bid_received"`
// Whether all slots were seen
IsComplete bool `json:"is_complete" db:"is_complete"`
}
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
type SlotSummary ¶
type SlotSummary struct {
Slot uint64 `json:"slot" db:"slot"`
Epoch uint64 `json:"epoch" db:"epoch"`
Missed bool `json:"missed" db:"missed"`
// General validator stats
ValidatorsKnownTotal uint64 `json:"validators_known_total" db:"validators_known_total"`
ValidatorRegistrationsTotal uint64 `json:"validator_registrations_total" db:"validator_registrations_total"`
// Slot proposer details
ProposerPubkey string `json:"proposer_pubkey" db:"proposer_pubkey"`
ProposerIsRegistered bool `json:"proposer_is_registered" db:"proposer_is_registered"`
// The number of requests are the count of all requests to a specific path, even invalid ones
NumGetHeaderRequests uint64 `json:"num_get_header_requests" db:"num_get_header_requests"`
NumGetPayloadRequests uint64 `json:"num_get_payload_requests" db:"num_get_payload_requests"`
// Responses to successful queries
NumHeaderSentOk uint64 `json:"num_header_sent_ok" db:"num_header_sent_ok"`
NumHeaderSent204 uint64 `json:"num_header_sent_204" db:"num_header_sent_204"`
NumPayloadSent uint64 `json:"num_payload_sent" db:"num_payload_sent"`
NumBuilderBidReceived uint64 `json:"num_builder_bid_received" db:"num_builder_bid_received"`
}
Click to show internal directories.
Click to hide internal directories.