depositcache

package
v1.0.0-alpha.26 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2020 License: GPL-3.0 Imports: 16 Imported by: 61

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 NewDepositCache

func NewDepositCache() (*DepositCache, error)

NewDepositCache instantiates a new deposit cache

func (*DepositCache) AllDepositContainers added in v0.3.0

func (dc *DepositCache) AllDepositContainers(ctx context.Context) []*dbpb.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 prior to blockheight and the root that corresponds to the latest deposit at that blockheight.

func (*DepositCache) FinalizedDeposits added in v1.0.0

func (dc *DepositCache) FinalizedDeposits(ctx context.Context) *FinalizedDeposits

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)

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

func (*DepositCache) InsertDepositContainers added in v0.3.0

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

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

func (*DepositCache) InsertFinalizedDeposits added in v1.0.0

func (dc *DepositCache) InsertFinalizedDeposits(ctx context.Context, eth1DepositIndex int64)

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) MarkPubkeyForChainstart

func (dc *DepositCache) MarkPubkeyForChainstart(ctx context.Context, pubkey string)

MarkPubkeyForChainstart sets the pubkey deposit status to true.

func (*DepositCache) NonFinalizedDeposits added in v1.0.0

func (dc *DepositCache) NonFinalizedDeposits(ctx context.Context, 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) []*dbpb.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) PubkeyInChainstart

func (dc *DepositCache) PubkeyInChainstart(ctx context.Context, pubkey string) bool

PubkeyInChainstart returns bool for whether the pubkey passed in has deposited.

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 DepositFetcher

type DepositFetcher interface {
	AllDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit
	DepositByPubkey(ctx context.Context, pubKey []byte) (*ethpb.Deposit, *big.Int)
	DepositsNumberAndRootAtHeight(ctx context.Context, blockHeight *big.Int) (uint64, [32]byte)
	FinalizedDeposits(ctx context.Context) *FinalizedDeposits
	NonFinalizedDeposits(ctx context.Context, untilBlk *big.Int) []*ethpb.Deposit
}

DepositFetcher defines a struct which can retrieve deposit information from a store.

type FinalizedDeposits added in v1.0.0

type FinalizedDeposits struct {
	Deposits        *trieutil.SparseMerkleTrie
	MerkleTrieIndex int64
}

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

type PendingDepositsFetcher

type PendingDepositsFetcher interface {
	PendingContainers(ctx context.Context, untilBlk *big.Int) []*dbpb.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