vm_context

package
v1.2.3-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	STORAGE_KEY_BALANCE = []byte("$balance")
	STORAGE_KEY_CODE    = []byte("$code")
)

Functions

func BalanceKey

func BalanceKey(tokenTypeId *types.TokenTypeId) []byte

func NewEmptyVmContextByTrie

func NewEmptyVmContextByTrie(t *trie.Trie) vmctxt_interface.VmDatabase

func NewVmContext

func NewVmContext(chain Chain, snapshotBlockHash *types.Hash, prevAccountBlockHash *types.Hash, addr *types.Address) (vmctxt_interface.VmDatabase, error)

Types

type Chain

type Chain interface {
	GetAccount(address *types.Address) (*ledger.Account, error)
	GetGenesisSnapshotBlock() *ledger.SnapshotBlock
	GetLatestSnapshotBlock() *ledger.SnapshotBlock
	GetLatestAccountBlock(addr *types.Address) (*ledger.AccountBlock, error)
	GetAccountBlockByHeight(addr *types.Address, height uint64) (*ledger.AccountBlock, error)
	GetSnapshotBlockHeadByHash(hash *types.Hash) (*ledger.SnapshotBlock, error)
	GetSnapshotBlockBeforeTime(blockCreatedTime *time.Time) (*ledger.SnapshotBlock, error)

	GetSnapshotBlockByHash(hash *types.Hash) (*ledger.SnapshotBlock, error)
	GetSnapshotBlockByHeight(height uint64) (*ledger.SnapshotBlock, error)
	GetSnapshotBlocksByHeight(height uint64, count uint64, forward, containSnapshotContent bool) ([]*ledger.SnapshotBlock, error)

	GetAccountBlockByHash(blockHash *types.Hash) (*ledger.AccountBlock, error)
	GetStateTrie(hash *types.Hash) *trie.Trie

	NewStateTrie() *trie.Trie
	GetConfirmAccountBlock(snapshotHeight uint64, address *types.Address) (*ledger.AccountBlock, error)
	GetContractGid(addr *types.Address) (*types.Gid, error)

	SaList() *chain_cache.AdditionList

	GetReceiveBlockHeights(hash *types.Hash) ([]uint64, error)
}

type ContractGid

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

func (*ContractGid) Addr

func (contractGid *ContractGid) Addr() *types.Address

func (*ContractGid) Gid

func (contractGid *ContractGid) Gid() *types.Gid

type StorageIterator

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

func NewStorageIterator

func NewStorageIterator(trie *trie.Trie, prefix []byte) *StorageIterator

func (*StorageIterator) Next

func (si *StorageIterator) Next() (key, value []byte, ok bool)

type UnsavedCache

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

func NewUnsavedCache

func NewUnsavedCache(trie *trie.Trie) *UnsavedCache

func (*UnsavedCache) ContractGidList

func (cache *UnsavedCache) ContractGidList() []vmctxt_interface.ContractGid

func (*UnsavedCache) GetStorage

func (cache *UnsavedCache) GetStorage(key []byte) []byte

func (*UnsavedCache) LogList

func (cache *UnsavedCache) LogList() ledger.VmLogList

func (*UnsavedCache) SetStorage

func (cache *UnsavedCache) SetStorage(key []byte, value []byte)

func (*UnsavedCache) Storage

func (cache *UnsavedCache) Storage() map[string][]byte

func (*UnsavedCache) Trie

func (cache *UnsavedCache) Trie() *trie.Trie

type VmAccountBlock

type VmAccountBlock struct {
	AccountBlock *ledger.AccountBlock
	VmContext    vmctxt_interface.VmDatabase
}

type VmContext

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

func (*VmContext) AddBalance

func (context *VmContext) AddBalance(tokenTypeId *types.TokenTypeId, amount *big.Int)

func (*VmContext) AddLog

func (context *VmContext) AddLog(log *ledger.VmLog)

func (*VmContext) Address

func (context *VmContext) Address() *types.Address

func (*VmContext) CopyAndFreeze

func (context *VmContext) CopyAndFreeze() vmctxt_interface.VmDatabase

func (*VmContext) CurrentSnapshotBlock

func (context *VmContext) CurrentSnapshotBlock() *ledger.SnapshotBlock

func (*VmContext) DebugGetStorage added in v1.1.2

func (context *VmContext) DebugGetStorage() map[string][]byte

No Balance and Code

func (*VmContext) GetAccountBlockByHash

func (context *VmContext) GetAccountBlockByHash(hash *types.Hash) *ledger.AccountBlock

func (*VmContext) GetBalance

func (context *VmContext) GetBalance(addr *types.Address, tokenTypeId *types.TokenTypeId) *big.Int

func (*VmContext) GetBalanceList

func (context *VmContext) GetBalanceList(snapshotHash types.Hash, tokenTypeId types.TokenTypeId, addressList []types.Address) (map[types.Address]*big.Int, error)

func (*VmContext) GetConsensusGroupList

func (context *VmContext) GetConsensusGroupList(snapshotHash types.Hash) ([]*types.ConsensusGroupInfo, error)

func (*VmContext) GetContractCode

func (context *VmContext) GetContractCode(addr *types.Address) []byte

func (*VmContext) GetGenesisSnapshotBlock

func (context *VmContext) GetGenesisSnapshotBlock() *ledger.SnapshotBlock

func (*VmContext) GetGid

func (context *VmContext) GetGid() *types.Gid

func (*VmContext) GetLogListHash

func (context *VmContext) GetLogListHash() *types.Hash

func (*VmContext) GetOneHourQuota added in v1.2.0

func (context *VmContext) GetOneHourQuota() (uint64, error)

func (*VmContext) GetReceiveBlockHeights added in v1.2.0

func (context *VmContext) GetReceiveBlockHeights(hash *types.Hash) ([]uint64, error)

get current account receive heights of a send block hash

func (*VmContext) GetRegisterList

func (context *VmContext) GetRegisterList(snapshotHash types.Hash, gid types.Gid) ([]*types.Registration, error)

func (*VmContext) GetSnapshotBlockBeforeTime

func (context *VmContext) GetSnapshotBlockBeforeTime(timestamp *time.Time) (*ledger.SnapshotBlock, error)

func (*VmContext) GetSnapshotBlockByHash

func (context *VmContext) GetSnapshotBlockByHash(hash *types.Hash) *ledger.SnapshotBlock

func (*VmContext) GetSnapshotBlockByHeight

func (context *VmContext) GetSnapshotBlockByHeight(height uint64) (*ledger.SnapshotBlock, error)

func (*VmContext) GetSnapshotBlocks

func (context *VmContext) GetSnapshotBlocks(startHeight, count uint64, forward, containSnapshotContent bool) []*ledger.SnapshotBlock

func (*VmContext) GetStorage

func (context *VmContext) GetStorage(addr *types.Address, key []byte) []byte

func (*VmContext) GetStorageBySnapshotHash

func (context *VmContext) GetStorageBySnapshotHash(addr *types.Address, key []byte, snapshotHash *types.Hash) []byte

func (*VmContext) GetStorageHash

func (context *VmContext) GetStorageHash() *types.Hash

func (*VmContext) GetVoteMap

func (context *VmContext) GetVoteMap(snapshotHash types.Hash, gid types.Gid) ([]*types.VoteInfo, error)

func (*VmContext) IsAddressExisted

func (context *VmContext) IsAddressExisted(addr *types.Address) bool

func (*VmContext) NewStorageIterator

func (context *VmContext) NewStorageIterator(addr *types.Address, prefix []byte) vmctxt_interface.StorageIterator

func (*VmContext) NewStorageIteratorBySnapshotHash

func (context *VmContext) NewStorageIteratorBySnapshotHash(addr *types.Address, prefix []byte, snapshotHash *types.Hash) vmctxt_interface.StorageIterator

func (*VmContext) PrevAccountBlock

func (context *VmContext) PrevAccountBlock() *ledger.AccountBlock

func (*VmContext) Reset

func (context *VmContext) Reset()

func (*VmContext) SetContractCode

func (context *VmContext) SetContractCode(code []byte)

func (*VmContext) SetContractGid

func (context *VmContext) SetContractGid(gid *types.Gid, addr *types.Address)

func (*VmContext) SetStorage

func (context *VmContext) SetStorage(key []byte, value []byte)

func (*VmContext) SubBalance

func (context *VmContext) SubBalance(tokenTypeId *types.TokenTypeId, amount *big.Int)

func (*VmContext) UnsavedCache

func (context *VmContext) UnsavedCache() vmctxt_interface.UnsavedCache

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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