depositcache

package
v4.0.0-...-ae7b6de Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package depositcache is the source of validator deposits maintained in-memory by the beacon node – deposits processed from the eth1 powchain are then stored in this cache to be accessed by any other service during a beacon node's runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositCache

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

DepositCache stores all in-memory deposit objects. This stores all the deposit related data that is required by the beacon-node.

func New

func New() (*DepositCache, error)

New instantiates a new deposit cache

func (*DepositCache) AllDepositContainers

func (dc *DepositCache) AllDepositContainers(ctx context.Context) []*ethpb.DepositContainer

AllDepositContainers returns all historical deposit containers.

func (*DepositCache) AllDeposits

func (dc *DepositCache) AllDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit

AllDeposits returns a list of historical deposits until the given block number (inclusive). If no block is specified then this method returns all historical deposits.

func (*DepositCache) DepositByPubkey

func (dc *DepositCache) DepositByPubkey(ctx context.Context, pubKey []byte) (*ethpb.Deposit, *big.Int)

DepositByPubkey looks through historical deposits and finds one which contains a certain public key within its deposit data.

func (*DepositCache) DepositsNumberAndRootAtHeight

func (dc *DepositCache) DepositsNumberAndRootAtHeight(ctx context.Context, blockHeight *big.Int) (uint64, [32]byte)

DepositsNumberAndRootAtHeight returns number of deposits made up to blockheight and the root that corresponds to the latest deposit at that blockheight.

func (*DepositCache) FinalizedDeposits

func (dc *DepositCache) FinalizedDeposits(ctx context.Context) (cache.FinalizedDeposits, error)

FinalizedDeposits returns the finalized deposits trie.

func (*DepositCache) InsertDeposit

func (dc *DepositCache) InsertDeposit(ctx context.Context, d *ethpb.Deposit, blockNum uint64, index int64, depositRoot [32]byte) error

InsertDeposit into the database. If deposit or block number are nil then this method does nothing.

func (*DepositCache) InsertDepositContainers

func (dc *DepositCache) InsertDepositContainers(ctx context.Context, ctrs []*ethpb.DepositContainer)

InsertDepositContainers inserts a set of deposit containers into our deposit cache.

func (*DepositCache) InsertFinalizedDeposits

func (dc *DepositCache) InsertFinalizedDeposits(ctx context.Context,
	eth1DepositIndex int64, _ common.Hash, _ uint64) error

InsertFinalizedDeposits inserts deposits up to eth1DepositIndex (inclusive) into the finalized deposits cache.

func (*DepositCache) InsertPendingDeposit

func (dc *DepositCache) InsertPendingDeposit(ctx context.Context, d *ethpb.Deposit, blockNum uint64, index int64, depositRoot [32]byte)

InsertPendingDeposit into the database. If deposit or block number are nil then this method does nothing.

func (*DepositCache) NonFinalizedDeposits

func (dc *DepositCache) NonFinalizedDeposits(ctx context.Context, lastFinalizedIndex int64, untilBlk *big.Int) []*ethpb.Deposit

NonFinalizedDeposits returns the list of non-finalized deposits until the given block number (inclusive). If no block is specified then this method returns all non-finalized deposits.

func (*DepositCache) PendingContainers

func (dc *DepositCache) PendingContainers(ctx context.Context, untilBlk *big.Int) []*ethpb.DepositContainer

PendingContainers returns a list of deposit containers until the given block number (inclusive).

func (*DepositCache) PendingDeposits

func (dc *DepositCache) PendingDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit

PendingDeposits returns a list of deposits until the given block number (inclusive). If no block is specified then this method returns all pending deposits.

func (*DepositCache) PrunePendingDeposits

func (dc *DepositCache) PrunePendingDeposits(ctx context.Context, merkleTreeIndex int64)

PrunePendingDeposits removes any deposit which is older than the given deposit merkle tree index.

func (*DepositCache) PruneProofs

func (dc *DepositCache) PruneProofs(ctx context.Context, untilDepositIndex int64) error

PruneProofs removes proofs from all deposits whose index is equal or less than untilDepositIndex.

func (*DepositCache) RemovePendingDeposit

func (dc *DepositCache) RemovePendingDeposit(ctx context.Context, d *ethpb.Deposit)

RemovePendingDeposit from the database. The deposit is indexed by the Index. This method does nothing if deposit ptr is nil.

type FinalizedDeposits

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

FinalizedDeposits stores the trie of deposits that have been included in the beacon state up to the latest finalized checkpoint.

func (*FinalizedDeposits) Deposits

func (fd *FinalizedDeposits) Deposits() cache.MerkleTree

Deposits returns the cached internal deposit tree.

func (*FinalizedDeposits) MerkleTrieIndex

func (fd *FinalizedDeposits) MerkleTrieIndex() int64

MerkleTrieIndex represents the last finalized index in the finalized deposit container.

type PendingDepositsFetcher

type PendingDepositsFetcher interface {
	PendingContainers(ctx context.Context, untilBlk *big.Int) []*ethpb.DepositContainer
}

PendingDepositsFetcher specifically outlines a struct that can retrieve deposits which have not yet been included in the chain.

Jump to

Keyboard shortcuts

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