validator

package
v4.0.0-...-b8b0360 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	GenesisTimeFetcher    blockchain.TimeFetcher
	SyncChecker           sync.Checker
	HeadFetcher           blockchain.HeadFetcher
	CoreService           *core.Service
	OptimisticModeFetcher blockchain.OptimisticModeFetcher
	Stater                lookup.Stater
	ChainInfoFetcher      blockchain.ChainInfoFetcher
	BeaconDB              db.ReadOnlyDatabase
	FinalizationFetcher   blockchain.FinalizationFetcher
}

Server defines a server implementation for HTTP endpoints, providing access data relevant to the Ethereum Beacon Chain.

func (*Server) GetValidatorCount

func (vs *Server) GetValidatorCount(w http.ResponseWriter, r *http.Request)

GetValidatorCount is a HTTP handler that serves the GET /eth/v1/beacon/states/{state_id}/validator_count endpoint. It returns the total validator count according to the given statuses provided as a query parameter.

The state ID is expected to be a valid Beacon Chain state identifier. The status query parameter can be an array of strings with the following values: pending_initialized, pending_queued, active_ongoing, active_exiting, active_slashed, exited_unslashed, exited_slashed, withdrawal_possible, withdrawal_done, active, pending, exited, withdrawal. The response is a JSON object containing the total validator count for the specified statuses.

Example usage:

GET /eth/v1/beacon/states/12345/validator_count?status=active&status=pending

The above request will return a JSON response like:

{
	"execution_optimistic": "false",
	"finalized": "true",
	"data": [
		{
			"status": "active",
			"count": "13"
		},
		{
			"status": "pending",
			"count": "6"
		}
	]
}

func (*Server) GetValidatorPerformance

func (vs *Server) GetValidatorPerformance(w http.ResponseWriter, r *http.Request)

GetValidatorPerformance is an HTTP handler for GetValidatorPerformance.

type ValidatorCount

type ValidatorCount struct {
	Status string `json:"status"`
	Count  string `json:"count"`
}

type ValidatorCountResponse

type ValidatorCountResponse struct {
	ExecutionOptimistic string            `json:"execution_optimistic"`
	Finalized           string            `json:"finalized"`
	Data                []*ValidatorCount `json:"data"`
}

type ValidatorPerformanceRequest

type ValidatorPerformanceRequest struct {
	PublicKeys [][]byte                    `json:"public_keys,omitempty"`
	Indices    []primitives.ValidatorIndex `json:"indices,omitempty"`
}

type ValidatorPerformanceResponse

type ValidatorPerformanceResponse struct {
	PublicKeys                    [][]byte `json:"public_keys,omitempty"`
	CorrectlyVotedSource          []bool   `json:"correctly_voted_source,omitempty"`
	CorrectlyVotedTarget          []bool   `json:"correctly_voted_target,omitempty"`
	CorrectlyVotedHead            []bool   `json:"correctly_voted_head,omitempty"`
	CurrentEffectiveBalances      []uint64 `json:"current_effective_balances,omitempty"`
	BalancesBeforeEpochTransition []uint64 `json:"balances_before_epoch_transition,omitempty"`
	BalancesAfterEpochTransition  []uint64 `json:"balances_after_epoch_transition,omitempty"`
	MissingValidators             [][]byte `json:"missing_validators,omitempty"`
	InactivityScores              []uint64 `json:"inactivity_scores,omitempty"`
}

Jump to

Keyboard shortcuts

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