services

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: GPL-3.0 Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderIndexFlag = beacon.BuilderIndexFlag

BuilderIndexFlag separates builder indices from validator indices A validator/builder index with this flag set is a builder index

Variables

View Source
var ErrTooManyPageRequests = fmt.Errorf("too many concurrent page requests")

ErrTooManyPageRequests is returned when the concurrency limit is reached.

Functions

func InitChainService added in v1.11.0

func InitChainService(ctx context.Context, logger logrus.FieldLogger)

InitChainService is used to initialize the global beaconchain service

func StartCallRateLimiter

func StartCallRateLimiter(proxyCount uint, rateLimit uint, burstLimit uint) error

StartFrontendCache is used to start the global frontend cache service

func StartFrontendCache

func StartFrontendCache(logger logrus.FieldLogger) error

StartFrontendCache is used to start the global frontend cache service

func StartTxSignaturesService

func StartTxSignaturesService() error

StartTxSignaturesService is used to start the global transaction signatures service

Types

type BuilderOnboardingProjection added in v1.24.0

type BuilderOnboardingProjection struct {
	GloasForkEpoch phase0.Epoch
	GloasForkTime  time.Time

	// Deposits holds every (canonical) builder-credential deposit on chain, in deposit-index order,
	// each annotated with its projected fate.
	Deposits []*ProjectedBuilderDeposit

	OnboardedNewCount     uint64
	OnboardedTopUpCount   uint64
	TooEarlyCount         uint64
	InvalidSignatureCount uint64
	KeptAsValidatorCount  uint64

	// QueueEstimation is the epoch the current queue fully drains (0 = unknown / empty); and a
	// secondary stat: all queued deposits (any credentials) processed before the fork epoch.
	QueueEstimation               phase0.Epoch
	TotalQueueProcessedBeforeFork uint64

	// HasSafetyEstimate / DepositSafe answer "is it safe to deposit right now". DepositSafe is true
	// when a deposit submitted now would still be queued at the fork (and so onboarded as a builder);
	// when false the queue is too short and it would be processed as a validator before the fork.
	HasSafetyEstimate       bool
	DepositSafe             bool
	NewDepositEstimateEpoch phase0.Epoch
	NewDepositEstimateTime  time.Time

	// Truncated reports that the deposit enumeration hit projectionFetchCap (some deposits omitted).
	Truncated bool
}

BuilderOnboardingProjection is the projected outcome, computed pre-Gloas, of the one-time builder onboarding at the Gloas fork transition. Its primary data source is the on-chain builder-credential deposits (so deposits made in the epoch before the fork — not yet reflected in the once-per-epoch queue snapshot — and already-applied deposits are both covered); the pending deposit queue is used only to cross-check queue position and the churn-based processing estimate. It is an estimate: a snapshot of current deposits and churn that does not model future deposits.

type BuilderWithIndex added in v1.21.0

type BuilderWithIndex struct {
	Index      gloas.BuilderIndex
	Builder    *gloas.Builder
	Superseded bool
}

type BuildoorInventory added in v1.23.0

type BuildoorInventory struct {
	// contains filtered or unexported fields
}

func NewBuildoorInventory added in v1.23.0

func NewBuildoorInventory(ctx context.Context) *BuildoorInventory

func (*BuildoorInventory) GetBuilderName added in v1.23.0

func (b *BuildoorInventory) GetBuilderName(builderIndex uint64) string

func (*BuildoorInventory) GetBuilderURL added in v1.23.0

func (b *BuildoorInventory) GetBuilderURL(builderIndex uint64) string

func (*BuildoorInventory) StartUpdater added in v1.23.0

func (b *BuildoorInventory) StartUpdater()

type CallRateLimiter

type CallRateLimiter struct {
	// contains filtered or unexported fields
}
var GlobalCallRateLimiter *CallRateLimiter

func (*CallRateLimiter) CheckCallLimit

func (crl *CallRateLimiter) CheckCallLimit(r *http.Request, callCost uint) error

type ChainService

type ChainService struct {
	// contains filtered or unexported fields
}
var GlobalBeaconService *ChainService

func (*ChainService) CheckBlockOrphanedStatus

func (bs *ChainService) CheckBlockOrphanedStatus(ctx context.Context, blockRoot phase0.Root) dbtypes.SlotStatus

func (*ChainService) GetActiveBuildersByIndexes added in v1.24.0

func (bs *ChainService) GetActiveBuildersByIndexes(ctx context.Context, indexes []gloas.BuilderIndex) map[gloas.BuilderIndex]*gloas.Builder

GetActiveBuildersByIndexes batch-resolves the builder currently occupying each of the given indexes (cache first, then a single batched DB query for misses). Builder indexes can be reused (EIP-8282), so callers compare the returned builder's pubkey against the pubkey they expect to tell whether that pubkey still owns the index or was superseded.

func (*ChainService) GetBeaconIndexer added in v1.11.0

func (bs *ChainService) GetBeaconIndexer() *beacon.Indexer

func (*ChainService) GetBlobSidecarsByBlockRoot

func (bs *ChainService) GetBlobSidecarsByBlockRoot(ctx context.Context, blockroot []byte) ([]*deneb.BlobSidecar, error)

GetBlobSidecarsByBlockRoot retrieves the blob sidecars for a given block root. It first tries to find a client that has the block root in its cache, and if not found, it falls back to a random ready client. It then retrieves the blob sidecars for the block root and returns them.

func (*ChainService) GetBlockBlob added in v1.11.0

func (bs *ChainService) GetBlockBlob(ctx context.Context, blockroot phase0.Root, blobIndex uint64) (*deneb.Blob, error)

GetBlockBlob retrieves the blob data for a given block root and blob index. It uses GetBlobsByBlockroot which works for both pre-Fulu and Fulu+ blocks.

func (*ChainService) GetBuilderBalances added in v1.21.0

func (bs *ChainService) GetBuilderBalances() []phase0.Gwei

GetBuilderBalances returns the current builder balances (epoch-start adjusted for in-epoch withdrawals).

func (*ChainService) GetBuilderBids added in v1.24.2

func (bs *ChainService) GetBuilderBids(ctx context.Context, builderIndex uint64, minSlot uint64, maxSlot *uint64, limit uint32) []*dbtypes.BlockBid

GetBuilderBids returns the bids submitted by a builder index within the [minSlot, maxSlot] slot window (maxSlot nil = open), newest first, merging the indexer's in-memory bid cache with the DB. The most recent bids live only in the cache until they are flushed, so a DB-only query would miss them; callers must always go through this accessor rather than db.GetBidsByBuilderIndex directly.

func (*ChainService) GetBuilderByIndex added in v1.21.0

func (bs *ChainService) GetBuilderByIndex(index gloas.BuilderIndex) *gloas.Builder

GetBuilderByIndex returns the builder by index

func (*ChainService) GetBuilderDepositIndexer added in v1.24.0

func (bs *ChainService) GetBuilderDepositIndexer() *syscontracts.BuilderDepositIndexer

func (*ChainService) GetBuilderDepositsByFilter added in v1.24.0

func (bs *ChainService) GetBuilderDepositsByFilter(ctx context.Context, filter *dbtypes.BuilderDepositFilter, pageOffset uint64, pageSize uint32) ([]*CombinedBuilderDeposit, uint64, uint64)

GetBuilderDepositsByFilter returns builder deposit requests merged from the pending EL request txs (not yet dequeued) and the included CL requests (cache + DB), each paired with its matching request tx.

func (*ChainService) GetBuilderExitIndexer added in v1.24.0

func (bs *ChainService) GetBuilderExitIndexer() *syscontracts.BuilderExitIndexer

func (*ChainService) GetBuilderExitsByFilter added in v1.24.0

func (bs *ChainService) GetBuilderExitsByFilter(ctx context.Context, filter *dbtypes.BuilderExitFilter, pageOffset uint64, pageSize uint32) ([]*CombinedBuilderExit, uint64, uint64)

GetBuilderExitsByFilter returns builder exit requests merged from the pending EL request txs (not yet dequeued) and the included CL requests (cache + DB), each paired with its matching request tx.

func (*ChainService) GetBuilderIndexByPubkey added in v1.24.0

func (bs *ChainService) GetBuilderIndexByPubkey(pubkey phase0.BLSPubKey) (gloas.BuilderIndex, bool)

GetBuilderIndexByPubkey resolves a builder index from its pubkey via the dedicated builder pubkey cache (separate from validators, see GetValidatorIndexByPubkey).

func (*ChainService) GetBuilderOnboardingProjection added in v1.24.0

func (bs *ChainService) GetBuilderOnboardingProjection(ctx context.Context) *BuilderOnboardingProjection

GetBuilderOnboardingProjection projects the builders that would be onboarded at the Gloas fork transition from the builder-credential deposits made before the fork. It returns nil when Gloas is not scheduled (no finite fork epoch) or the chain head/queue cannot be resolved. It is meant for the builder deposits page before the fork, where the real builder_deposits table is still empty.

It enumerates every 0xB0-credential deposit and classifies each: deposits already applied or that the churn queue would process before the fork become regular validators ("too early"); the rest register builders (or top up earlier ones), drop on an invalid proof-of-possession, or stay as validator deposits when they share a pubkey with a validator — mirroring onboard_builders_from_pending_deposits over the deposits that survive to the fork.

func (*ChainService) GetBuilderTenureEndEpoch added in v1.24.2

func (bs *ChainService) GetBuilderTenureEndEpoch(ctx context.Context, index gloas.BuilderIndex, depositEpoch phase0.Epoch) *phase0.Epoch

GetBuilderTenureEndEpoch returns the epoch at which the builder with the given deposit epoch stopped owning its index, i.e. the deposit epoch of the next builder that took over the same index (EIP-8282 index reuse). It returns nil when the builder is the current occupant of the index (no successor), meaning its tenure is still open.

The successor is the smallest deposit epoch strictly greater than depositEpoch among all builders (current cache occupant plus every persisted row) that have held the index. Callers convert the returned tenure to a slot window to scope index-keyed data (blocks, bids, withdrawals) to a specific builder's lifetime rather than mixing data from every builder that reused the index.

func (*ChainService) GetBuilderURL added in v1.23.0

func (bs *ChainService) GetBuilderURL(builderIndex uint64) string

func (*ChainService) GetBuildersByPubkeys added in v1.24.2

func (bs *ChainService) GetBuildersByPubkeys(ctx context.Context, pubkeys [][]byte) map[string]BuilderWithIndex

GetBuildersByPubkeys batch-resolves builders by their pubkey (their stable identity), merging the in-memory cache (current occupants) with the DB (which also holds superseded builders). The result is keyed by string(pubkey). This is the correct way to attribute a builder deposit/exit to its builder: the pubkey uniquely identifies the builder, whereas the persisted builder_index on the request row is a point-in-time snapshot that can be nil (never resolved) or belong to a reused index.

func (*ChainService) GetCanonicalForkIds added in v1.13.0

func (bs *ChainService) GetCanonicalForkIds() []uint64

func (*ChainService) GetCanonicalForkKeys added in v1.14.0

func (bs *ChainService) GetCanonicalForkKeys() []beacon.ForkKey

func (*ChainService) GetChainState added in v1.11.0

func (bs *ChainService) GetChainState() *consensus.ChainState

func (*ChainService) GetConsensusClientForks added in v1.11.0

func (bs *ChainService) GetConsensusClientForks() []*ConsensusClientFork

func (*ChainService) GetConsensusClients added in v1.10.0

func (bs *ChainService) GetConsensusClients() []*consensus.Client

func (*ChainService) GetConsolidationIndexer added in v1.12.1

func (bs *ChainService) GetConsolidationIndexer() *syscontracts.ConsolidationIndexer

func (*ChainService) GetConsolidationQueueByFilter added in v1.19.0

func (bs *ChainService) GetConsolidationQueueByFilter(ctx context.Context, filter *ConsolidationQueueFilter, offset uint64, limit uint64) ([]*ConsolidationQueueEntry, uint64)

func (*ChainService) GetConsolidationRequestOperationsByFilter added in v1.13.0

func (bs *ChainService) GetConsolidationRequestOperationsByFilter(ctx context.Context, filter *dbtypes.ConsolidationRequestFilter, pageOffset uint64, pageSize uint32) ([]*dbtypes.ConsolidationRequest, uint64)

func (*ChainService) GetConsolidationRequestsByFilter added in v1.12.0

func (bs *ChainService) GetConsolidationRequestsByFilter(ctx context.Context, filter *CombinedConsolidationRequestFilter, pageOffset uint64, pageSize uint32) ([]*CombinedConsolidationRequest, uint64, uint64)

func (*ChainService) GetDbBlocksByFilter

func (bs *ChainService) GetDbBlocksByFilter(ctx context.Context, filter *dbtypes.BlockFilter, pageIdx uint64, pageSize uint32, withScheduledCount uint64) []*dbtypes.AssignedSlot

GetDbBlocksByFilter retrieves a filtered range of blocks from cache & database. The filter parameter specifies the filter criteria. The pageIdx parameter specifies the page index. The pageSize parameter specifies the page size. The withScheduledCount parameter specifies the number of scheduled slots to include. The returned slice contains the retrieved blocks.

func (*ChainService) GetDbBlocksByParentRoot

func (bs *ChainService) GetDbBlocksByParentRoot(ctx context.Context, parentRoot phase0.Root) []*dbtypes.Slot

func (*ChainService) GetDbBlocksForSlots

func (bs *ChainService) GetDbBlocksForSlots(ctx context.Context, firstSlot uint64, slotLimit uint32, withMissing bool, withOrphaned bool) []*dbtypes.Slot

GetDbBlocksForSlots retrieves blocks for a range of slots from cache & database. The firstSlot parameter specifies the starting slot. The slotLimit parameter limits the number of slots to retrieve. The withMissing parameter indicates whether to include missing blocks. The withOrphaned parameter indicates whether to include orphaned blocks. The returned slice contains the retrieved blocks.

func (*ChainService) GetDbEpochs

func (bs *ChainService) GetDbEpochs(ctx context.Context, firstEpoch uint64, limit uint32) []*dbtypes.Epoch

func (*ChainService) GetDepositOperationsByFilter added in v1.15.0

func (bs *ChainService) GetDepositOperationsByFilter(ctx context.Context, filter *dbtypes.DepositFilter, txFilter *dbtypes.DepositTxFilter, pageOffset uint64, pageSize uint32) ([]*dbtypes.DepositWithTx, uint64)

func (*ChainService) GetDepositRequestsByFilter added in v1.15.0

func (bs *ChainService) GetDepositRequestsByFilter(ctx context.Context, filter *CombinedDepositRequestFilter, pageOffset uint64, pageSize uint32) ([]*CombinedDepositRequest, uint64)

func (*ChainService) GetEnsResolver added in v1.24.2

func (bs *ChainService) GetEnsResolver() *EnsResolver

GetEnsResolver returns the ENS resolver service (always non-nil; a no-op when the feature is disabled).

func (*ChainService) GetExecutionChainState added in v1.19.0

func (bs *ChainService) GetExecutionChainState() *execution.ChainState

func (*ChainService) GetExecutionClients added in v1.10.0

func (bs *ChainService) GetExecutionClients() []*execution.Client

func (*ChainService) GetFilteredBuilderSet added in v1.21.0

func (bs *ChainService) GetFilteredBuilderSet(ctx context.Context, filter *dbtypes.BuilderFilter, withBalance bool) ([]BuilderWithIndex, uint64)

GetFilteredBuilderSet returns builders matching the filter criteria.

A builder's identity is its pubkey; the builder index is a reusable slot (EIP-8282). When an index is reused the previous occupant's DB row is flagged Superseded and a new row is inserted. This function therefore treats each pubkey as a distinct entry rather than deduplicating by index:

  • The in-memory cache only ever holds the current (non-superseded) occupant of each index and is the freshest source for it.
  • Superseded predecessors live only in the DB. Per product decision they are hidden by default and only returned when the caller explicitly requests the Superseded status.

func (*ChainService) GetFilteredQueuedDeposits added in v1.15.0

func (bs *ChainService) GetFilteredQueuedDeposits(ctx context.Context, filter *QueuedDepositFilter) []*IndexedDepositQueueEntry

func (*ChainService) GetFilteredValidatorSet added in v1.14.0

func (bs *ChainService) GetFilteredValidatorSet(ctx context.Context, filter *dbtypes.ValidatorFilter, withBalance bool) ([]v1.Validator, uint64)

getValidatorsByWithdrawalAddressForRoot returns validators with a specific withdrawal address for a given blockRoot

func (*ChainService) GetFinalizedEpoch

func (bs *ChainService) GetFinalizedEpoch() (phase0.Epoch, phase0.Root)

func (*ChainService) GetGenesis

func (bs *ChainService) GetGenesis() (*v1.Genesis, error)

func (*ChainService) GetHeadForks

func (bs *ChainService) GetHeadForks(readyOnly bool) []*beacon.ForkHead

func (*ChainService) GetHighestElBlockNumber added in v1.14.0

func (bs *ChainService) GetHighestElBlockNumber(ctx context.Context, overrideForkId *beacon.ForkKey) uint64

func (*ChainService) GetIndexedDepositQueue added in v1.15.0

func (bs *ChainService) GetIndexedDepositQueue(ctx context.Context, headBlock *beacon.Block) *IndexedDepositQueue

func (*ChainService) GetParentForkIds added in v1.12.1

func (bs *ChainService) GetParentForkIds(forkId beacon.ForkKey) []beacon.ForkKey

func (*ChainService) GetRecentEpochStats added in v1.15.0

func (bs *ChainService) GetRecentEpochStats(overrideForkId *beacon.ForkKey) (*beacon.EpochStatsValues, phase0.Epoch)

func (*ChainService) GetSlashingsByFilter

func (bs *ChainService) GetSlashingsByFilter(ctx context.Context, filter *dbtypes.SlashingFilter, pageIdx uint64, pageSize uint32) ([]*dbtypes.Slashing, uint64)

func (*ChainService) GetSlotCommittees added in v1.24.0

func (bs *ChainService) GetSlotCommittees(ctx context.Context, slot phase0.Slot) [][]phase0.ValidatorIndex

GetSlotCommittees returns the attester committees for a slot (global validator indices, in committee order), from the in-memory epoch cache for unfinalized epochs or the blockdb duties store for finalized ones. Returns nil if unavailable.

func (*ChainService) GetSlotDetailsByBlockroot

func (bs *ChainService) GetSlotDetailsByBlockroot(ctx context.Context, blockroot phase0.Root) (*CombinedBlockResponse, error)

GetSlotDetailsByBlockroot retrieves the combined block details for a given block root. It first checks if the block root is present in the beacon indexer's block cache. If found, it constructs a CombinedBlockResponse using the block information from the cache. If not found, it checks if the block root is present in the orphaned block database. If found, it constructs a CombinedBlockResponse with the orphaned block information. If not found and blockDb is configured, it retrieves the block body from the block database. If not found in either cache or db, it retrieves the block header and block body from a random ready client and constructs a CombinedBlockResponse with the retrieved information.

func (*ChainService) GetSlotDetailsBySlot

func (bs *ChainService) GetSlotDetailsBySlot(ctx context.Context, slot phase0.Slot) (*CombinedBlockResponse, error)

GetSlotDetailsBySlot retrieves the combined block details for a given slot. It first checks if there are any blocks in the beacon indexer's block cache for the given slot. If found, it constructs a CombinedBlockResponse using the block information from the cache. If not found, it retrieves the block header and block body from a random ready client using the slot and constructs a CombinedBlockResponse with the retrieved information.

func (*ChainService) GetSlotPtc added in v1.24.0

func (bs *ChainService) GetSlotPtc(ctx context.Context, slot phase0.Slot) []phase0.ValidatorIndex

GetSlotPtc returns the PTC members for a slot (global validator indices), from the in-memory epoch cache or the blockdb duties store. Returns nil if unavailable.

func (*ChainService) GetSnooperManager added in v1.17.0

func (bs *ChainService) GetSnooperManager() *snooper.SnooperManager

func (*ChainService) GetSystemContractAddress added in v1.19.0

func (bs *ChainService) GetSystemContractAddress(systemContract string) common.Address

func (*ChainService) GetSystemContractAddresses added in v1.20.3

func (bs *ChainService) GetSystemContractAddresses() map[common.Address]string

GetSystemContractAddresses returns a map of all known system contract addresses to their human-readable labels (with EIP tags). Includes deposit, withdrawal request, consolidation request, beacon roots, and block hash history contracts.

func (*ChainService) GetTxIndexer added in v1.19.9

func (bs *ChainService) GetTxIndexer() *txindexer.TxIndexer

func (*ChainService) GetValidatorByIndex added in v1.13.0

func (bs *ChainService) GetValidatorByIndex(index phase0.ValidatorIndex, withBalance bool) *v1.Validator

func (*ChainService) GetValidatorInclusionDistance added in v1.20.4

func (bs *ChainService) GetValidatorInclusionDistance(validatorIndex phase0.ValidatorIndex, lookbackEpochs phase0.Epoch) (count uint64, totalDelay uint64)

GetValidatorInclusionDistance returns the attestation count and total inclusion delay for a validator over the last lookbackEpochs epochs, using only cached blocks.

func (*ChainService) GetValidatorIndexByPubkey added in v1.13.0

func (bs *ChainService) GetValidatorIndexByPubkey(pubkey phase0.BLSPubKey) (phase0.ValidatorIndex, bool)

func (*ChainService) GetValidatorLiveness added in v1.13.0

func (bs *ChainService) GetValidatorLiveness(validatorIndex phase0.ValidatorIndex, lookbackEpochs phase0.Epoch) uint64

func (*ChainService) GetValidatorName

func (bs *ChainService) GetValidatorName(index uint64) string

func (*ChainService) GetValidatorNameAt added in v1.24.3

func (bs *ChainService) GetValidatorNameAt(index uint64, slot phase0.Slot) string

GetValidatorNameAt returns the validator name assignment valid at the given slot. Identical to GetValidatorName on networks without name history.

func (*ChainService) GetValidatorNameAtTime added in v1.24.3

func (bs *ChainService) GetValidatorNameAtTime(index uint64, ts int64) string

GetValidatorNameAtTime returns the validator name assignment valid at the given unix time. Used for rows that only carry an execution layer block time instead of a slot.

func (*ChainService) GetValidatorNamesCount

func (bs *ChainService) GetValidatorNamesCount() uint64

func (*ChainService) GetValidatorProposalStats added in v1.22.2

func (bs *ChainService) GetValidatorProposalStats(ctx context.Context, lookbackEpochs phase0.Epoch) map[phase0.ValidatorIndex]*ValidatorProposalStat

GetValidatorProposalStats returns expected vs canonical proposals per validator over the last lookbackEpochs epochs. A duty counts as "proposed" only if the canonical block for the duty slot was authored by the assigned proposer.

func (*ChainService) GetValidatorPtcStats added in v1.22.2

func (bs *ChainService) GetValidatorPtcStats(ctx context.Context, lookbackEpochs phase0.Epoch) map[phase0.ValidatorIndex]*ValidatorPtcStat

GetValidatorPtcStats returns expected vs included PTC votes per validator over the last lookbackEpochs epochs, computed on demand from in-memory state: PTC duties from EpochStats.PtcDuties + payload attestations from cached canonical block bodies. Slots whose voting block is not in the in-memory block cache are skipped entirely (no expected, no included). PTC is Gloas+ only; nil is returned for pre-Gloas epochs.

func (*ChainService) GetValidatorStatusMap added in v1.14.0

func (bs *ChainService) GetValidatorStatusMap() map[v1.ValidatorState]uint64

func (*ChainService) GetValidatorVotingActivity added in v1.13.0

func (bs *ChainService) GetValidatorVotingActivity(validatorIndex phase0.ValidatorIndex) ([]beacon.ValidatorActivity, phase0.Epoch)

func (*ChainService) GetVoluntaryExitsByFilter

func (bs *ChainService) GetVoluntaryExitsByFilter(ctx context.Context, filter *dbtypes.VoluntaryExitFilter, pageIdx uint64, pageSize uint32) ([]*dbtypes.VoluntaryExit, uint64)

func (*ChainService) GetWithdrawalIndexer added in v1.12.1

func (bs *ChainService) GetWithdrawalIndexer() *syscontracts.WithdrawalIndexer

func (*ChainService) GetWithdrawalQueueByFilter added in v1.19.0

func (bs *ChainService) GetWithdrawalQueueByFilter(ctx context.Context, filter *WithdrawalQueueFilter, pageOffset uint64, pageSize uint32) ([]*WithdrawalQueueEntry, uint64, phase0.Gwei)

func (*ChainService) GetWithdrawalRequestOperationsByFilter added in v1.13.0

func (bs *ChainService) GetWithdrawalRequestOperationsByFilter(ctx context.Context, filter *dbtypes.WithdrawalRequestFilter, pageOffset uint64, pageSize uint32) ([]*dbtypes.WithdrawalRequest, uint64)

func (*ChainService) GetWithdrawalRequestsByFilter added in v1.12.0

func (bs *ChainService) GetWithdrawalRequestsByFilter(ctx context.Context, filter *CombinedWithdrawalRequestFilter, pageOffset uint64, pageSize uint32) ([]*CombinedWithdrawalRequest, uint64, uint64)

func (*ChainService) GetWithdrawalsByFilter added in v1.21.0

func (bs *ChainService) GetWithdrawalsByFilter(ctx context.Context, filter *dbtypes.WithdrawalFilter, pageIdx uint64, pageSize uint32) ([]*dbtypes.Withdrawal, uint64)

func (*ChainService) IsProjectedValidatorIndex added in v1.23.0

func (bs *ChainService) IsProjectedValidatorIndex(index phase0.ValidatorIndex) bool

IsProjectedValidatorIndex reports whether the given index currently resolves to a validator projected from the pending_deposits queue (not yet on chain), i.e. its index is an estimate. Returns false for real validators and unknown indexes.

func (*ChainService) StartService added in v1.11.0

func (cs *ChainService) StartService() error

StartService is used to start the beaconchain service

func (*ChainService) StopService added in v1.14.0

func (bs *ChainService) StopService()

func (*ChainService) StreamActiveValidatorData added in v1.14.0

func (bs *ChainService) StreamActiveValidatorData(activeOnly bool, cb beacon.ValidatorSetStreamer) error

type CombinedBlockResponse

type CombinedBlockResponse struct {
	Root            phase0.Root
	Header          *phase0.SignedBeaconBlockHeader
	Block           *all.SignedBeaconBlock
	Payload         *all.SignedExecutionPayloadEnvelope
	BlockAccessList []byte
	Orphaned        bool
}

type CombinedBuilderDeposit added in v1.24.0

type CombinedBuilderDeposit struct {
	Request             *dbtypes.BuilderDeposit
	RequestOrphaned     bool
	Transaction         *dbtypes.BuilderDepositTx
	TransactionOrphaned bool
}

CombinedBuilderDeposit pairs a consensus-layer builder deposit request with its matching execution-layer request tx (either may be nil when only one side is known).

type CombinedBuilderExit added in v1.24.0

type CombinedBuilderExit struct {
	Request             *dbtypes.BuilderExit
	RequestOrphaned     bool
	Transaction         *dbtypes.BuilderExitTx
	TransactionOrphaned bool
}

CombinedBuilderExit pairs a consensus-layer builder exit request with its matching execution-layer request tx (either may be nil when only one side is known).

type CombinedConsolidationRequest added in v1.13.0

type CombinedConsolidationRequest struct {
	Request             *dbtypes.ConsolidationRequest
	RequestOrphaned     bool
	Transaction         *dbtypes.ConsolidationRequestTx
	TransactionOrphaned bool
}

func (*CombinedConsolidationRequest) ResolveSourceName added in v1.24.3

func (ccr *CombinedConsolidationRequest) ResolveSourceName(bs *ChainService) string

ResolveSourceName returns the display name for the request's source validator.

func (*CombinedConsolidationRequest) ResolveTargetName added in v1.24.3

func (ccr *CombinedConsolidationRequest) ResolveTargetName(bs *ChainService) string

ResolveTargetName returns the display name for the request's target validator.

func (*CombinedConsolidationRequest) SourceAddress added in v1.13.0

func (ccr *CombinedConsolidationRequest) SourceAddress() []byte

func (*CombinedConsolidationRequest) SourceIndex added in v1.13.0

func (ccr *CombinedConsolidationRequest) SourceIndex() *uint64

func (*CombinedConsolidationRequest) SourcePubkey added in v1.13.0

func (ccr *CombinedConsolidationRequest) SourcePubkey() []byte

func (*CombinedConsolidationRequest) TargetIndex added in v1.13.0

func (ccr *CombinedConsolidationRequest) TargetIndex() *uint64

func (*CombinedConsolidationRequest) TargetPubkey added in v1.13.0

func (ccr *CombinedConsolidationRequest) TargetPubkey() []byte

type CombinedConsolidationRequestFilter added in v1.13.0

type CombinedConsolidationRequestFilter struct {
	Filter  *dbtypes.ConsolidationRequestFilter
	Request uint8 // 0: all, 1: tx only, 2: request only
}

type CombinedDepositRequest added in v1.15.0

type CombinedDepositRequest struct {
	Request             *dbtypes.Deposit
	RequestOrphaned     bool
	Transaction         *dbtypes.DepositTx
	TransactionOrphaned bool
	IsQueued            bool
	QueueEntry          *IndexedDepositQueueEntry
}

func (*CombinedDepositRequest) Amount added in v1.15.0

func (ccr *CombinedDepositRequest) Amount() uint64

func (*CombinedDepositRequest) DepositIndex added in v1.15.0

func (ccr *CombinedDepositRequest) DepositIndex() uint64

func (*CombinedDepositRequest) PublicKey added in v1.15.0

func (ccr *CombinedDepositRequest) PublicKey() []byte

func (*CombinedDepositRequest) ResolveValidatorName added in v1.24.3

func (ccr *CombinedDepositRequest) ResolveValidatorName(bs *ChainService, index uint64) string

ResolveValidatorName returns the display name for the deposit's validator, resolved at the deposit's inclusion slot (or the deposit transaction's EL block time while the deposit is not included yet).

func (*CombinedDepositRequest) SourceAddress added in v1.15.0

func (ccr *CombinedDepositRequest) SourceAddress() []byte

func (*CombinedDepositRequest) WithdrawalCredentials added in v1.15.0

func (ccr *CombinedDepositRequest) WithdrawalCredentials() []byte

type CombinedDepositRequestFilter added in v1.15.0

type CombinedDepositRequestFilter struct {
	Filter *dbtypes.DepositTxFilter
}

type CombinedWithdrawalRequest added in v1.13.0

type CombinedWithdrawalRequest struct {
	Request             *dbtypes.WithdrawalRequest
	RequestOrphaned     bool
	Transaction         *dbtypes.WithdrawalRequestTx
	TransactionOrphaned bool
}

func (*CombinedWithdrawalRequest) Amount added in v1.13.0

func (cwr *CombinedWithdrawalRequest) Amount() uint64

func (*CombinedWithdrawalRequest) ResolveValidatorName added in v1.24.3

func (cwr *CombinedWithdrawalRequest) ResolveValidatorName(bs *ChainService) string

ResolveValidatorName returns the display name for the request's validator, resolved at the request's inclusion slot (or the request transaction's EL block time while the request is still pending).

func (*CombinedWithdrawalRequest) SourceAddress added in v1.13.0

func (cwr *CombinedWithdrawalRequest) SourceAddress() []byte

func (*CombinedWithdrawalRequest) ValidatorIndex added in v1.13.0

func (cwr *CombinedWithdrawalRequest) ValidatorIndex() *uint64

func (*CombinedWithdrawalRequest) ValidatorPubkey added in v1.13.0

func (cwr *CombinedWithdrawalRequest) ValidatorPubkey() []byte

type CombinedWithdrawalRequestFilter added in v1.13.0

type CombinedWithdrawalRequestFilter struct {
	Filter  *dbtypes.WithdrawalRequestFilter
	Request uint8 // 0: all, 1: tx only, 2: request only
}

type ConsensusClientFork added in v1.11.0

type ConsensusClientFork struct {
	Slot phase0.Slot
	Root phase0.Root

	ReadyClients []*beacon.Client
	AllClients   []*beacon.Client
}

type ConsolidationQueueEntry added in v1.19.0

type ConsolidationQueueEntry struct {
	QueuePos         uint64
	SrcIndex         phase0.ValidatorIndex
	TgtIndex         phase0.ValidatorIndex
	SrcValidator     *v1.Validator
	TgtValidator     *v1.Validator
	SrcValidatorName string
	TgtValidatorName string
}

type ConsolidationQueueFilter added in v1.19.0

type ConsolidationQueueFilter struct {
	MinSrcIndex   *uint64
	MaxSrcIndex   *uint64
	MinTgtIndex   *uint64
	MaxTgtIndex   *uint64
	PublicKey     []byte
	ValidatorName string
	ReverseOrder  bool
}

type DasGuardian added in v1.18.0

type DasGuardian struct {
	// contains filtered or unexported fields
}

func NewDasGuardian added in v1.18.0

func NewDasGuardian(ctx context.Context, logger logrus.FieldLogger) (*DasGuardian, error)

func (*DasGuardian) Close added in v1.18.0

func (d *DasGuardian) Close() error

func (*DasGuardian) ScanNode added in v1.18.0

func (d *DasGuardian) ScanNode(ctx context.Context, nodeEnr string, slots []uint64) (*dasguardian.DasGuardianScanResult, error)

func (*DasGuardian) ScanNodeWithCallback added in v1.18.0

func (d *DasGuardian) ScanNodeWithCallback(ctx context.Context, nodeEnr string, slotCallback SlotSelectorCallback) (*dasguardian.DasGuardianScanResult, error)

type EnsResolver added in v1.24.2

type EnsResolver struct {
	// contains filtered or unexported fields
}

EnsResolver resolves execution addresses to their primary ENS name. Resolution is batched, asynchronous and persisted to the ens_names table. Handlers call ResolveNames once per page to warm the in-memory cache and feed the resolve queue.

func NewEnsResolver added in v1.24.2

func NewEnsResolver(ctx context.Context, logger logrus.FieldLogger, execPool *execution.Pool) *EnsResolver

func (*EnsResolver) GetDebugStats added in v1.24.2

func (e *EnsResolver) GetDebugStats() *EnsResolverStats

GetDebugStats returns a snapshot of the resolver's queue, cache and probed registries for the /debug/cache page. Safe to call when the resolver is disabled (nil-safe).

func (*EnsResolver) ResolveNames added in v1.24.2

func (e *EnsResolver) ResolveNames(ctx context.Context, addrs [][]byte) map[string]string

ResolveNames returns the known primary names for the given addresses (keyed by lowercase 0x-hex), warming the cache with one batched DB query for cache misses and enqueuing unresolved or stale addresses for asynchronous resolution.

It is called by page handlers in the (uncached) build path — never from templates.

func (*EnsResolver) StartUpdater added in v1.24.2

func (e *EnsResolver) StartUpdater()

StartUpdater applies defaults, initializes the cache/queue and starts the worker.

type EnsResolverStats added in v1.24.2

type EnsResolverStats struct {
	Enabled              bool
	Probed               bool
	QueueLen             int
	QueueCap             int
	CacheLen             int
	CacheCap             int
	ConfiguredRegistries int
	Registries           []string // usable (bytecode-probed) registries, in priority order
	MulticallReady       bool
	MulticallAddress     string
	RefreshPositive      time.Duration
	RefreshNegative      time.Duration
}

EnsResolverStats is a snapshot of the ENS resolver's runtime state for the debug page.

type FrontendCachePageError

type FrontendCachePageError struct {
	// contains filtered or unexported fields
}

func (FrontendCachePageError) Error

func (e FrontendCachePageError) Error() string

func (FrontendCachePageError) Name

func (e FrontendCachePageError) Name() string

func (FrontendCachePageError) Stack

func (e FrontendCachePageError) Stack() string

type FrontendCacheProcessingPage

type FrontendCacheProcessingPage struct {
	CallCtx context.Context

	PageKey      string
	CacheTimeout time.Duration
	// contains filtered or unexported fields
}

type FrontendCacheService

type FrontendCacheService struct {
	// contains filtered or unexported fields
}
var GlobalFrontendCache *FrontendCacheService

func (*FrontendCacheService) GetPageTypeStats added in v1.20.4

func (fc *FrontendCacheService) GetPageTypeStats() []*cache.PageTypeStats

GetPageTypeStats returns per-page-type cache statistics.

func (*FrontendCacheService) GetStats added in v1.20.4

func (fc *FrontendCacheService) GetStats() *FrontendCacheStats

GetStats returns frontend cache statistics.

func (*FrontendCacheService) GetTieredCacheStats added in v1.20.4

func (fc *FrontendCacheService) GetTieredCacheStats() *cache.TieredCacheStats

GetTieredCacheStats returns the underlying tiered cache statistics.

func (*FrontendCacheService) ProcessCachedPage

func (fc *FrontendCacheService) ProcessCachedPage(pageKey string, caching bool, returnValue interface{}, buildFn PageDataHandlerFn) (interface{}, error)

func (*FrontendCacheService) RemoveCacheByPrefix added in v1.24.0

func (fc *FrontendCacheService) RemoveCacheByPrefix(pageKeyPrefix string) error

RemoveCacheByPrefix evicts every cached page whose key starts with pageKeyPrefix, so the next request rebuilds them from fresh data. This is used to actively invalidate all variants of a page (e.g. every sort order) after the underlying data has been force-refreshed, instead of waiting for each page's cache timeout to expire.

type FrontendCacheStats added in v1.20.4

type FrontendCacheStats struct {
	CachingEnabled     bool
	PageCallCounter    uint64
	ProcessingPages    int
	ProcessingPageKeys []string
	ConcurrencyLimit   int
	ConcurrencyUsed    int
	PageTypeSemLimit   int
	PageTypeSemaphores map[string]int // page type -> current usage
}

FrontendCacheStats holds statistics about the frontend cache service.

type IndexedDepositQueue added in v1.15.0

type IndexedDepositQueue struct {
	Queue           []*IndexedDepositQueueEntry
	TotalNew        uint64
	TotalGwei       phase0.Gwei
	QueueEstimation phase0.Epoch

	// LastIncludedDepositIndex is the EL index of the most recent deposit included on chain as of
	// the queue snapshot (nil if unknown). Deposits with a higher index were included after the
	// snapshot (e.g. in the current epoch) and are not yet reflected in the queue; deposits with a
	// lower index that are absent from the queue have already been applied.
	LastIncludedDepositIndex *uint64
	// contains filtered or unexported fields
}

func (*IndexedDepositQueue) EstimateAppendedDepositEpoch added in v1.24.0

func (q *IndexedDepositQueue) EstimateAppendedDepositEpoch(amount phase0.Gwei) phase0.Epoch

EstimateAppendedDepositEpoch projects the epoch in which a deposit of the given amount would be processed by process_pending_deposits if it were appended to the tail of the queue right now. It continues the same churn simulation used for the existing entries from its residual state. It returns 0 (unknown) when the churn parameters are unavailable (e.g. no active balance yet).

type IndexedDepositQueueEntry added in v1.15.0

type IndexedDepositQueueEntry struct {
	QueuePos       uint64
	DepositIndex   *uint64
	EpochEstimate  phase0.Epoch
	PendingDeposit *electra.PendingDeposit
	// Postponed marks a deposit that process_pending_deposits reorders to the back of
	// the queue (its validator is exiting), so it no longer follows the queue's
	// slot<->index order and is resolved by slot rather than by position. Its
	// EpochEstimate is left unset as it does not flow through the normal churn queue.
	Postponed bool
}

type PageDataHandlerFn

type PageDataHandlerFn = func(pageCall *FrontendCacheProcessingPage) interface{}

type ProjectedBuilderDeposit added in v1.24.0

type ProjectedBuilderDeposit struct {
	Deposit *dbtypes.DepositWithTx

	// Result is the onboarding outcome (dbtypes.BuilderDepositRequestResult*): NewBuilder, TopUp, or
	// InvalidSignature. Left Unknown for deposits that never reach onboarding (too early / kept).
	Result uint8

	// EstimateEpoch is the projected epoch the deposit is processed (0 = unknown).
	EstimateEpoch phase0.Epoch

	// Fate flags (at most one set; none set => onboarded as a builder):
	TooEarly         bool // processed before the fork -> becomes a regular validator, not a builder
	AlreadyProcessed bool // refinement of TooEarly: already applied (vs projected to apply before fork)
	KeptAsValidator  bool // shares a pubkey with a validator -> applied as a validator deposit
	InvalidSignature bool // invalid proof-of-possession -> dropped at onboarding

	// Queue cross-check (the queue lags up to an epoch, so recent deposits may be unqueued).
	IsQueued bool
	QueuePos uint64
}

ProjectedBuilderDeposit is one builder-credential (0xB0) deposit on chain together with its projected fate at the upcoming Gloas fork transition. When none of the fate flags is set the deposit is projected to be onboarded as a builder (Result distinguishes new vs top-up).

func (*ProjectedBuilderDeposit) Onboarded added in v1.24.0

func (d *ProjectedBuilderDeposit) Onboarded() bool

Onboarded reports whether the deposit is projected to be onboarded as a builder at the fork.

type QueuedDepositFilter added in v1.15.0

type QueuedDepositFilter struct {
	MinIndex          uint64
	MaxIndex          uint64
	NoIndex           bool
	PublicKey         []byte
	WithdrawalAddress []byte
	WithdrawalCreds   []byte
	MinAmount         uint64
	MaxAmount         uint64
}

type RPCError added in v1.19.1

type RPCError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

RPCError represents a JSON-RPC 2.0 error

type RPCProxy added in v1.19.1

type RPCProxy struct {
	// contains filtered or unexported fields
}

RPCProxy implements a filtered JSON-RPC proxy with rate limiting

func NewRPCProxy added in v1.19.1

func NewRPCProxy(config *RPCProxyConfig) *RPCProxy

NewRPCProxy creates a new RPC proxy instance

func (*RPCProxy) ServeHTTP added in v1.19.1

func (rp *RPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the HTTP handler for the RPC proxy

type RPCProxyConfig added in v1.19.1

type RPCProxyConfig struct {
	// Upstream execution client endpoint
	UpstreamURL string

	// Rate limiting
	RequestsPerMinute int // Requests per minute per IP
	BurstLimit        int // Maximum burst requests

	// Method filtering
	AllowedMethods []string // Whitelist of allowed methods

	// Request timeout
	Timeout time.Duration

	// Logging
	LogRequests bool
}

RPCProxyConfig holds the configuration for the RPC proxy

type RPCRequest added in v1.19.1

type RPCRequest struct {
	ID      interface{} `json:"id"`
	Jsonrpc string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params,omitempty"`
}

RPCRequest represents a JSON-RPC 2.0 request

type RPCResponse added in v1.19.1

type RPCResponse struct {
	ID      interface{} `json:"id"`
	Jsonrpc string      `json:"jsonrpc"`
	Result  interface{} `json:"result,omitempty"`
	Error   *RPCError   `json:"error,omitempty"`
}

RPCResponse represents a JSON-RPC 2.0 response

type RateLimiter added in v1.19.1

type RateLimiter struct {
	// contains filtered or unexported fields
}

RateLimiter implements a token bucket rate limiter per IP

func NewRateLimiter added in v1.19.1

func NewRateLimiter(requestsPerMinute, burstLimit int) *RateLimiter

NewRateLimiter creates a new rate limiter

func (*RateLimiter) Allow added in v1.19.1

func (rl *RateLimiter) Allow(ip string) bool

Allow checks if a request from the given IP is allowed

type SlotSelectorCallback added in v1.18.0

type SlotSelectorCallback func(nodeStatus *dasguardian.StatusV2) ([]uint64, error)

SlotSelectorCallback is a function type that receives node status and returns selected slots

type TokenBucket added in v1.19.1

type TokenBucket struct {
	// contains filtered or unexported fields
}

TokenBucket represents a token bucket for rate limiting

type TxSignaturesLookup

type TxSignaturesLookup struct {
	Bytes     types.TxSignatureBytes
	Signature string
	Name      string
	Status    types.TxSignatureLookupStatus
}

type TxSignaturesService

type TxSignaturesService struct {
	// contains filtered or unexported fields
}
var GlobalTxSignaturesService *TxSignaturesService

func (*TxSignaturesService) LookupSignatures

type ValidatorNames

type ValidatorNames struct {
	// contains filtered or unexported fields
}

func NewValidatorNames

func NewValidatorNames(ctx context.Context, beaconIndexer *beacon.Indexer, chainState *consensus.ChainState) *ValidatorNames

func (*ValidatorNames) GetValidatorName

func (vn *ValidatorNames) GetValidatorName(index uint64) string

func (*ValidatorNames) GetValidatorNameAt added in v1.24.3

func (vn *ValidatorNames) GetValidatorNameAt(index uint64, slot phase0.Slot) string

GetValidatorNameAt returns the name assignment valid at the given slot. Falls back to the current name when no history snapshot covers the slot or index, so networks without name history behave identically to GetValidatorName.

func (*ValidatorNames) GetValidatorNameAtTime added in v1.24.3

func (vn *ValidatorNames) GetValidatorNameAtTime(index uint64, ts int64) string

GetValidatorNameAtTime returns the name assignment valid at the given unix time. Used for rows that only carry an execution layer block time instead of a slot.

func (*ValidatorNames) GetValidatorNameByPubkey

func (vn *ValidatorNames) GetValidatorNameByPubkey(pubkey []byte) string

func (*ValidatorNames) GetValidatorNamesCount

func (vn *ValidatorNames) GetValidatorNamesCount() uint64

func (*ValidatorNames) LoadValidatorNames

func (vn *ValidatorNames) LoadValidatorNames() chan bool

func (*ValidatorNames) StartUpdater

func (vn *ValidatorNames) StartUpdater()

func (*ValidatorNames) UpdateDb added in v1.11.0

func (vn *ValidatorNames) UpdateDb(ctx context.Context) error

type ValidatorProposalStat added in v1.22.2

type ValidatorProposalStat struct {
	Expected uint64
	Proposed uint64
}

ValidatorProposalStat tracks the number of expected vs actually proposed canonical blocks for a validator.

type ValidatorPtcStat added in v1.22.2

type ValidatorPtcStat struct {
	Expected uint64
	Included uint64
}

ValidatorPtcStat tracks the number of expected vs actually included PTC votes for a validator.

type ValidatorWithIndex added in v1.14.0

type ValidatorWithIndex struct {
	Index     phase0.ValidatorIndex
	Validator *phase0.Validator
}

type WithdrawalQueueEntry added in v1.19.0

type WithdrawalQueueEntry struct {
	ValidatorIndex          phase0.ValidatorIndex
	Validator               *v1.Validator
	ValidatorName           string
	WithdrawableEpoch       phase0.Epoch
	Amount                  phase0.Gwei
	EstimatedWithdrawalTime phase0.Slot
}

type WithdrawalQueueFilter added in v1.19.0

type WithdrawalQueueFilter struct {
	MinValidatorIndex *uint64
	MaxValidatorIndex *uint64
	ValidatorName     string
	PublicKey         []byte
}

Jump to

Keyboard shortcuts

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