svm

package
v0.2.14-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SVM

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

SVM is an entry point for all SVM operations.

func New

func New(allStates, processorDb database.Database, logger log.Log) *SVM

New creates a new `SVM` instance from the given `state` and `logger`.

func (*SVM) AddressExists

func (svm *SVM) AddressExists(addr types.Address) bool

AddressExists checks if an account address exists in this node's global state.

func (*SVM) ApplyLayer

func (svm *SVM) ApplyLayer(layerID types.LayerID, transactions []*types.Transaction, rewards map[types.Address]uint64) ([]*types.Transaction, error)

ApplyLayer applies the given rewards to some miners as well as a vector of transactions for the given layer. to miners vector for layer. It returns an error on failure, as well as a vector of failed transactions.

func (*SVM) GetAllAccounts

func (svm *SVM) GetAllAccounts() (*types.MultipleAccountsState, error)

GetAllAccounts returns a dump of all accounts in global state.

func (*SVM) GetBalance

func (svm *SVM) GetBalance(addr types.Address) uint64

GetBalance Retrieve the balance from the given address or 0 if object not found.

func (*SVM) GetLayerApplied

func (svm *SVM) GetLayerApplied(txID types.TransactionID) *types.LayerID

GetLayerApplied gets the layer id at which this tx was applied.

func (*SVM) GetLayerStateRoot

func (svm *SVM) GetLayerStateRoot(layer types.LayerID) (types.Hash32, error)

GetLayerStateRoot returns the state root at a given layer.

func (*SVM) GetNonce

func (svm *SVM) GetNonce(addr types.Address) uint64

GetNonce gets the current nonce of the given addr, if the address is not found it returns 0.

func (*SVM) GetStateRoot

func (svm *SVM) GetStateRoot() types.Hash32

GetStateRoot gets the current state root hash.

func (*SVM) Rewind

func (svm *SVM) Rewind(layer types.LayerID) (types.Hash32, error)

Rewind loads the given layer state from persistent storage. On success, it also returns the current state root hash *after* rewinding.

func (*SVM) SetupGenesis

func (svm *SVM) SetupGenesis(conf *config.GenesisConfig) error

SetupGenesis creates new accounts and adds balances as dictated by `conf`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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