vm_context

package
v0.0.3-chain Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: GPL-3.0 Imports: 7 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)
	GetLatestSnapshotBlock() *ledger.SnapshotBlock
	GetLatestAccountBlock(addr *types.Address) (*ledger.AccountBlock, 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)
}

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

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

func (*VmContext) GetGid

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

func (*VmContext) GetLogListHash

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

func (*VmContext) GetSnapshotBlockByHash

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

func (*VmContext) GetSnapshotBlockByHeight

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

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

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

func (*VmContext) IsAddressExisted

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

func (*VmContext) NewStorageIterator

func (context *VmContext) NewStorageIterator(prefix []byte) 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