erigonstore

package
v2.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StakingBucketsContractIndex is the system contract for staking buckets storage
	StakingBucketsContractIndex int = iota
	// BucketPoolContractIndex is the system contract for bucket pool storage
	BucketPoolContractIndex
	// BucketIndicesContractIndex is the system contract for bucket indices storage
	BucketIndicesContractIndex
	// EndorsementContractIndex is the system contract for endorsement storage
	EndorsementContractIndex
	// CandidateMapContractIndex is the system contract for candidate map storage
	CandidateMapContractIndex
	// CandidatesContractIndex is the system contract for candidates storage
	CandidatesContractIndex
	// PollCandidateListContractIndex is the system contract for poll candidate storage
	PollCandidateListContractIndex
	// PollLegacyCandidateListContractIndex is the system contract for poll legacy candidate storage
	PollLegacyCandidateListContractIndex
	// PollProbationListContractIndex is the system contract for poll probation list storage
	PollProbationListContractIndex
	// PollUnproductiveDelegateContractIndex is the system contract for poll unproductive delegate storage
	PollUnproductiveDelegateContractIndex
	// PollBlockMetaContractIndex is the system contract for poll block meta storage
	PollBlockMetaContractIndex
	// RewardingContractV1Index is the system contract for rewarding admin storage
	RewardingContractV1Index
	// RewardingContractV2Index is the system contract for rewarding admin storage v2
	RewardingContractV2Index
	// StakingViewContractIndex is the system contract for staking view storage
	StakingViewContractIndex
	// AccountInfoContractIndex is the system contract for account info storage
	AccountInfoContractIndex
	// ContractStakingBucketContractIndex is the system contract for contract staking bucket storage
	ContractStakingBucketContractIndex
	// SystemContractCount is the total number of system contracts
	SystemContractCount
)
View Source
const (
	// AccountIndex is the system contract for account storage
	AccountIndex = -1
)

Variables

View Source
var (
	// ErrObjectStorageNotRegistered is returned when an object storage is not registered
	ErrObjectStorageNotRegistered = errors.New("object storage not registered")
	// ErrObjectStorageAlreadyRegistered is returned when an object storage is already registered
	ErrObjectStorageAlreadyRegistered = errors.New("object storage already registered")
)
View Source
var (
	// ErrErigonStoreClosed is returned when the erigon working set store is closed
	ErrErigonStoreClosed = errors.New("erigon working set store is closed")
)

Functions

func NewContractBackend

func NewContractBackend(intraBlockState *erigonstate.IntraBlockState, org erigonstate.StateReader, height uint64, timestamp time.Time, producer address.Address, g *genesis.Genesis, evmNetworkID uint32, useZeroNonceForFreshAccount bool) *contractBackend

NewContractBackend creates a new contract backend for system contract interaction

Types

type ErigonDB

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

ErigonDB implements the Erigon database

func NewErigonDB

func NewErigonDB(path string) *ErigonDB

NewErigonDB creates a new ErigonDB

func (*ErigonDB) BatchPrune

func (db *ErigonDB) BatchPrune(ctx context.Context, from, to, batch uint64) error

BatchPrune prunes the ErigonWorkingSetStore in batches

func (*ErigonDB) Height

func (db *ErigonDB) Height() (uint64, error)

Height returns the current height of the ErigonDB

func (*ErigonDB) NewErigonStore

func (db *ErigonDB) NewErigonStore(ctx context.Context, height uint64) (*ErigonWorkingSetStore, error)

NewErigonStore creates a new ErigonWorkingSetStore

func (*ErigonDB) NewErigonStoreDryrun

func (db *ErigonDB) NewErigonStoreDryrun(ctx context.Context, height uint64) (*ErigonWorkingSetStore, error)

NewErigonStoreDryrun creates a new ErigonWorkingSetStore for dryrun

func (*ErigonDB) Prune

func (db *ErigonDB) Prune(ctx context.Context, tx kv.RwTx, from, to uint64) error

Prune prunes the ErigonWorkingSetStore from 'from' to 'to'

func (*ErigonDB) Start

func (db *ErigonDB) Start(ctx context.Context) error

Start starts the ErigonDB

func (*ErigonDB) Stop

func (db *ErigonDB) Stop(ctx context.Context)

Stop stops the ErigonDB

type ErigonWorkingSetStore

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

ErigonWorkingSetStore implements the Erigon working set store

func (*ErigonWorkingSetStore) Close

func (store *ErigonWorkingSetStore) Close()

Close closes the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) Commit

func (store *ErigonWorkingSetStore) Commit(ctx context.Context, retention uint64) error

Commit commits the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) CreateGenesisStates

func (store *ErigonWorkingSetStore) CreateGenesisStates(_ context.Context) error

CreateGenesisStates creates the genesis states in the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) DeleteObject

func (store *ErigonWorkingSetStore) DeleteObject(ns string, key []byte, obj any) error

DeleteObject deletes an object from the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) Digest

func (store *ErigonWorkingSetStore) Digest() hash.Hash256

Digest returns the digest of the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) ErigonStore

func (store *ErigonWorkingSetStore) ErigonStore() (any, error)

func (*ErigonWorkingSetStore) Finalize

func (store *ErigonWorkingSetStore) Finalize(ctx context.Context) error

Finalize finalizes the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) FinalizeTx

func (store *ErigonWorkingSetStore) FinalizeTx(ctx context.Context) error

FinalizeTx finalizes the transaction

func (*ErigonWorkingSetStore) GetObject

func (store *ErigonWorkingSetStore) GetObject(ns string, key []byte, obj any) error

GetObject gets an object from the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) IntraBlockState

func (store *ErigonWorkingSetStore) IntraBlockState() *erigonstate.IntraBlockState

IntraBlockState returns the intraBlockState of the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) KVStore

func (store *ErigonWorkingSetStore) KVStore() db.KVStore

KVStore returns nil as ErigonWorkingSetStore does not implement KVStore

func (*ErigonWorkingSetStore) NewObjectStorage

func (store *ErigonWorkingSetStore) NewObjectStorage(ns string, obj any) (ObjectStorage, error)

func (*ErigonWorkingSetStore) NewObjectStorageClean added in v2.3.3

func (store *ErigonWorkingSetStore) NewObjectStorageClean(ns string, obj any) (ObjectStorage, error)

func (*ErigonWorkingSetStore) PutObject

func (store *ErigonWorkingSetStore) PutObject(ns string, key []byte, obj any) (err error)

PutObject puts an object into the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) ResetSnapshots

func (store *ErigonWorkingSetStore) ResetSnapshots()

ResetSnapshots resets the snapshots of the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) RevertSnapshot

func (store *ErigonWorkingSetStore) RevertSnapshot(sn int) error

RevertSnapshot reverts the ErigonWorkingSetStore to a snapshot

func (*ErigonWorkingSetStore) Snapshot

func (store *ErigonWorkingSetStore) Snapshot() int

Snapshot creates a snapshot of the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) Start

func (store *ErigonWorkingSetStore) Start(ctx context.Context) error

Start starts the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) StateReader

func (store *ErigonWorkingSetStore) StateReader() erigonstate.StateReader

StateReader returns the state reader of the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) States

func (store *ErigonWorkingSetStore) States(ns string, obj any, keys [][]byte) (state.Iterator, error)

States gets multiple objects from the ErigonWorkingSetStore

func (*ErigonWorkingSetStore) Stop

func (store *ErigonWorkingSetStore) Stop(ctx context.Context) error

Stop stops the ErigonWorkingSetStore

type GenericValueObjectIterator

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

GenericValueObjectIterator is an iterator for GenericValue objects

func NewGenericValueObjectIterator

func NewGenericValueObjectIterator(keys [][]byte, values []systemcontracts.GenericValue, exists []bool) (*GenericValueObjectIterator, error)

NewGenericValueObjectIterator creates a new GenericValueObjectIterator

func (*GenericValueObjectIterator) Next

func (gvoi *GenericValueObjectIterator) Next(o interface{}) ([]byte, error)

Next returns the next key-value pair from the iterator

func (*GenericValueObjectIterator) Size

func (gvoi *GenericValueObjectIterator) Size() int

Size returns the size of the iterator

type KeySplitter added in v2.3.3

type KeySplitter func(key []byte) (part1 []byte, part2 []byte)

type ObjectStorage

type ObjectStorage interface {
	Store(key []byte, obj any) error
	Load(key []byte, obj any) error
	Delete(key []byte) error
	List() (state.Iterator, error)
	Batch(keys [][]byte) (state.Iterator, error)
}

ObjectStorage defines an interface of object storage

type ObjectStorageRegistry

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

ObjectStorageRegistry is a registry for object storage

func GetObjectStorageRegistry

func GetObjectStorageRegistry() *ObjectStorageRegistry

GetObjectStorageRegistry returns the global object storage registry

func (*ObjectStorageRegistry) ObjectStorage

func (osr *ObjectStorageRegistry) ObjectStorage(ns string, obj any, backend *contractBackend) (ObjectStorage, error)

ObjectStorage returns the object storage for the given namespace and object type

func (*ObjectStorageRegistry) RegisterNamespace

func (osr *ObjectStorageRegistry) RegisterNamespace(ns string, index int, opts ...RegisterOption) error

RegisterNamespace registers a namespace object storage

func (*ObjectStorageRegistry) RegisterNamespacePrefix

func (osr *ObjectStorageRegistry) RegisterNamespacePrefix(prefix string, index int) error

RegisterNamespacePrefix registers a namespace prefix object storage

func (*ObjectStorageRegistry) RegisterObjectStorage

func (osr *ObjectStorageRegistry) RegisterObjectStorage(ns string, obj any, index int, opts ...RegisterOption) error

RegisterObjectStorage registers a generic object storage

type RegisterOption added in v2.3.3

type RegisterOption func(int, *ObjectStorageRegistry)

func WithKVListOption added in v2.3.3

func WithKVListOption() RegisterOption

func WithKeySplitOption added in v2.3.3

func WithKeySplitOption(split KeySplitter) RegisterOption

func WithRewardingHistoryPrefixOption added in v2.3.3

func WithRewardingHistoryPrefixOption(split KeySplitter, prefix ...[]byte) RegisterOption

type SystemContract

type SystemContract struct {
	Address address.Address
	Code    []byte
}

SystemContract represents a system contract with its address and bytecode

Jump to

Keyboard shortcuts

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