Documentation
¶
Index ¶
- Constants
- Variables
- func NewContractBackend(intraBlockState *erigonstate.IntraBlockState, org erigonstate.StateReader, ...) *contractBackend
- type ErigonDB
- func (db *ErigonDB) BatchPrune(ctx context.Context, from, to, batch uint64) error
- func (db *ErigonDB) Height() (uint64, error)
- func (db *ErigonDB) NewErigonStore(ctx context.Context, height uint64) (*ErigonWorkingSetStore, error)
- func (db *ErigonDB) NewErigonStoreDryrun(ctx context.Context, height uint64) (*ErigonWorkingSetStore, error)
- func (db *ErigonDB) Prune(ctx context.Context, tx kv.RwTx, from, to uint64) error
- func (db *ErigonDB) Start(ctx context.Context) error
- func (db *ErigonDB) Stop(ctx context.Context)
- type ErigonWorkingSetStore
- func (store *ErigonWorkingSetStore) Close()
- func (store *ErigonWorkingSetStore) Commit(ctx context.Context, retention uint64) error
- func (store *ErigonWorkingSetStore) CreateGenesisStates(_ context.Context) error
- func (store *ErigonWorkingSetStore) DeleteObject(ns string, key []byte, obj any) error
- func (store *ErigonWorkingSetStore) Digest() hash.Hash256
- func (store *ErigonWorkingSetStore) ErigonStore() (any, error)
- func (store *ErigonWorkingSetStore) Finalize(ctx context.Context) error
- func (store *ErigonWorkingSetStore) FinalizeTx(ctx context.Context) error
- func (store *ErigonWorkingSetStore) GetObject(ns string, key []byte, obj any) error
- func (store *ErigonWorkingSetStore) IntraBlockState() *erigonstate.IntraBlockState
- func (store *ErigonWorkingSetStore) KVStore() db.KVStore
- func (store *ErigonWorkingSetStore) NewObjectStorage(ns string, obj any) (ObjectStorage, error)
- func (store *ErigonWorkingSetStore) NewObjectStorageClean(ns string, obj any) (ObjectStorage, error)
- func (store *ErigonWorkingSetStore) PutObject(ns string, key []byte, obj any) (err error)
- func (store *ErigonWorkingSetStore) ResetSnapshots()
- func (store *ErigonWorkingSetStore) RevertSnapshot(sn int) error
- func (store *ErigonWorkingSetStore) Snapshot() int
- func (store *ErigonWorkingSetStore) Start(ctx context.Context) error
- func (store *ErigonWorkingSetStore) StateReader() erigonstate.StateReader
- func (store *ErigonWorkingSetStore) States(ns string, obj any, keys [][]byte) (state.Iterator, error)
- func (store *ErigonWorkingSetStore) Stop(ctx context.Context) error
- type GenericValueObjectIterator
- type KeySplitter
- type ObjectStorage
- type ObjectStorageRegistry
- func (osr *ObjectStorageRegistry) ObjectStorage(ns string, obj any, backend *contractBackend) (ObjectStorage, error)
- func (osr *ObjectStorageRegistry) RegisterNamespace(ns string, index int, opts ...RegisterOption) error
- func (osr *ObjectStorageRegistry) RegisterNamespacePrefix(prefix string, index int) error
- func (osr *ObjectStorageRegistry) RegisterObjectStorage(ns string, obj any, index int, opts ...RegisterOption) error
- type RegisterOption
- type SystemContract
Constants ¶
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 )
const (
// AccountIndex is the system contract for account storage
AccountIndex = -1
)
Variables ¶
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") )
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 (*ErigonDB) BatchPrune ¶
BatchPrune prunes the ErigonWorkingSetStore in batches
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
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
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 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 ¶
SystemContract represents a system contract with its address and bytecode