Documentation
¶
Index ¶
- Constants
- func IntAddr2HexStr(addr *evmutils.Int, version uint32) string
- func MergeResultCache(src *ResultCache, to *ResultCache)
- func MergeResultCache2211(src *ResultCache, to *ResultCache)
- func TruncateNullTail(val []byte) []byte
- type BalanceCache
- type Cache
- type CacheUnderAddress
- type CodeCache
- type ContractStorage
- func (c ContractStorage) CallContract(name string, rtType int32, method string, byteCode []byte, ...) (res *common.ContractResult, stat common.TxStatusCode)
- func (c *ContractStorage) CanTransfer(from, to, val *evmutils.Int) bool
- func (c *ContractStorage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, ...) *evmutils.Int
- func (c *ContractStorage) GetBalance(address *evmutils.Int) (*evmutils.Int, error)
- func (c *ContractStorage) GetBlockHash(block *evmutils.Int) (*evmutils.Int, error)
- func (c *ContractStorage) GetCode(address *evmutils.Int) (code []byte, err error)
- func (c *ContractStorage) GetCodeHash(address *evmutils.Int) (codeHase *evmutils.Int, err error)
- func (c *ContractStorage) GetCodeSize(address *evmutils.Int) (size *evmutils.Int, err error)
- func (c *ContractStorage) GetCurrentBlockVersion() uint32
- func (c ContractStorage) IsCrossVmMode() bool
- func (c *ContractStorage) Load(n string, k string) (*evmutils.Int, error)
- func (c *ContractStorage) SetCrossVmOutParams(index *evmutils.Int, element *evmutils.Int)
- func (c ContractStorage) Store(address string, key string, val []byte)
- type CrossVmParams
- type Hash
- type IExternalStorage
- type Log
- type LogCache
- type Params
- type ResultCache
- type Storage
- func (s *Storage) Balance(address *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) BalanceModify(address *evmutils.Int, value *evmutils.Int, neg bool)
- func (s *Storage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, ...) *evmutils.Int
- func (s *Storage) Destruct(address *evmutils.Int)
- func (s *Storage) GetBlockHash(block *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) GetCode(address *evmutils.Int) ([]byte, error)
- func (s *Storage) GetCodeHash(address *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) GetCodeSize(address *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) GetCurrentBlockVersion() uint32
- func (s *Storage) IntAddr2HexStr(addr *evmutils.Int) string
- func (s *Storage) Log(address *evmutils.Int, topics [][]byte, data []byte, ...)
- func (s *Storage) SLoad(contractAddr *evmutils.Int, k *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) SLoad2217(n *evmutils.Int, k *evmutils.Int) (*evmutils.Int, error)
- func (s *Storage) SStore(n *evmutils.Int, k *evmutils.Int, v *evmutils.Int)
- func (s *Storage) SetCode(address *evmutils.Int, code []byte)
- func (s *Storage) SetCodeHash(address *evmutils.Int, codeHash *evmutils.Int)
- func (s *Storage) SetCodeSize(address *evmutils.Int, size *evmutils.Int)
- type TEntry
- type TStorage
Constants ¶
View Source
const CrossVmCallMethodKey = "CrossVmCallMethod"
const CrossVmOutParamsEndKey = "CrossVMOutParamsEnd" const CrossVmInParamsBeginKey = "CrossVMInParamsBegin" const CrossVmInParamsEndKey = "CrossVMInParamsEnd"
View Source
const CrossVmOutParamsBeginKey = "CrossVMCall"
View Source
const HashLen = 32
Variables ¶
This section is empty.
Functions ¶
func IntAddr2HexStr ¶ added in v2.3.4
func MergeResultCache ¶
func MergeResultCache(src *ResultCache, to *ResultCache)
func MergeResultCache2211 ¶ added in v2.3.0
func MergeResultCache2211(src *ResultCache, to *ResultCache)
Types ¶
type CacheUnderAddress ¶
type ContractStorage ¶
type ContractStorage struct {
OutParams *CrossVmParams
//InParams *CrossVmParams
ResultCache ResultCache
Ctx protocol.TxSimContext
BlockHash *evmutils.Int
Contract *common.Contract // contract info
SystemLog protocol.Logger
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage(extStorage IExternalStorage) *ContractStorage
func (ContractStorage) CallContract ¶ added in v2.3.0
func (c ContractStorage) CallContract(name string, rtType int32, method string, byteCode []byte, parameters map[string][]byte, gasUsed uint64, isCreate bool) (res *common.ContractResult, stat common.TxStatusCode)
func (*ContractStorage) CanTransfer ¶
func (c *ContractStorage) CanTransfer(from, to, val *evmutils.Int) bool
func (*ContractStorage) CreateFixedAddress ¶
func (c *ContractStorage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int
Only versions < 2300 are called
func (*ContractStorage) GetBalance ¶
func (*ContractStorage) GetBlockHash ¶
func (*ContractStorage) GetCode ¶
func (c *ContractStorage) GetCode(address *evmutils.Int) (code []byte, err error)
func (*ContractStorage) GetCodeHash ¶
func (*ContractStorage) GetCodeSize ¶
func (*ContractStorage) GetCurrentBlockVersion ¶ added in v2.2.1
func (c *ContractStorage) GetCurrentBlockVersion() uint32
func (ContractStorage) IsCrossVmMode ¶ added in v2.3.0
func (c ContractStorage) IsCrossVmMode() bool
func (*ContractStorage) Load ¶
func (*ContractStorage) SetCrossVmOutParams ¶ added in v2.3.0
func (c *ContractStorage) SetCrossVmOutParams(index *evmutils.Int, element *evmutils.Int)
func (ContractStorage) Store ¶
func (c ContractStorage) Store(address string, key string, val []byte)
type CrossVmParams ¶ added in v2.3.0
type CrossVmParams struct {
ParamsCache Params
IsCrossVm bool
ParamsBegin int64
LongStrLen int64
LastParamKey string
}
func NewParamsCache ¶ added in v2.3.0
func NewParamsCache() *CrossVmParams
func (*CrossVmParams) GetParam ¶ added in v2.3.0
func (p *CrossVmParams) GetParam(key string) []byte
func (*CrossVmParams) GetParamsCnt ¶ added in v2.3.0
func (p *CrossVmParams) GetParamsCnt() int
func (*CrossVmParams) Reset ¶ added in v2.3.0
func (p *CrossVmParams) Reset()
func (*CrossVmParams) ResetLongStrParamStatus ¶ added in v2.3.0
func (p *CrossVmParams) ResetLongStrParamStatus()
func (*CrossVmParams) SetParam ¶ added in v2.3.0
func (p *CrossVmParams) SetParam(key string, value []byte)
type IExternalStorage ¶
type IExternalStorage interface {
GetBalance(address *evmutils.Int) (*evmutils.Int, error)
GetCode(address *evmutils.Int) ([]byte, error)
GetCodeSize(address *evmutils.Int) (*evmutils.Int, error)
GetCodeHash(address *evmutils.Int) (*evmutils.Int, error)
GetBlockHash(block *evmutils.Int) (*evmutils.Int, error)
GetCurrentBlockVersion() uint32
//CreateAddress(name *evmutils.Int, addrType int32) *evmutils.Int
CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int
CanTransfer(from *evmutils.Int, to *evmutils.Int, amount *evmutils.Int) bool
Load(n string, k string) (*evmutils.Int, error)
Store(address string, key string, val []byte)
SetCrossVmOutParams(index *evmutils.Int, param *evmutils.Int)
IsCrossVmMode() bool
//GetCrossVmInParam(key string) []byte
CallContract(name string, rtType int32, method string, byteCode []byte, parameters map[string][]byte,
gasUsed uint64, isCreate bool) (res *common.ContractResult, stat common.TxStatusCode)
}
Teh External Storage,provding a Storage for touching out of current evm
type Log ¶
type Log struct {
Topics [][]byte
Data []byte
Context environment.Context
}
type ResultCache ¶
type ResultCache struct {
//OriginalData CacheUnderAddress
ReadCache CacheUnderAddress
WriteCache CacheUnderAddress //when version<=232, include read cache; when version>232, only include write
Balance BalanceCache
Logs LogCache
Destructs Cache
ContractEvent []*commonPb.ContractEvent
}
type Storage ¶
type Storage struct {
ResultCache ResultCache
UpperStorage *Storage
ExternalStorage IExternalStorage
TransientCache TStorage
// contains filtered or unexported fields
}
func New ¶
func New(upperStorage *Storage, extStorage IExternalStorage) *Storage
func (*Storage) BalanceModify ¶
func (*Storage) CreateFixedAddress ¶
func (s *Storage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int
func (*Storage) GetBlockHash ¶
func (*Storage) GetCodeHash ¶
func (*Storage) GetCodeSize ¶
func (*Storage) GetCurrentBlockVersion ¶ added in v2.2.1
func (*Storage) IntAddr2HexStr ¶ added in v2.3.4
func (*Storage) Log ¶
func (*Storage) SLoad ¶
SLoad load data from storage, sequence: ResultCache, UpperStorage and ExternalStorage(just for the original evm)
func (*Storage) SLoad2217 ¶ added in v2.3.4
func (*Storage) SStore ¶
func (*Storage) SetCodeHash ¶
Source Files
¶
- cache.go
- contractStorage.go
- iExternalStorage.go
- storage.go
Click to show internal directories.
Click to hide internal directories.