Documentation ¶
Index ¶
- Constants
- Variables
- func BaseParam(parameters map[string][]byte)
- func GetBlockVersion() uint32
- type GoLogger
- func (GoLogger) Debug(args ...interface{})
- func (GoLogger) DebugDynamic(l func() string)
- func (GoLogger) Debugf(format string, args ...interface{})
- func (GoLogger) Debugw(msg string, keysAndValues ...interface{})
- func (GoLogger) Error(args ...interface{})
- func (GoLogger) Errorf(format string, args ...interface{})
- func (GoLogger) Errorw(msg string, keysAndValues ...interface{})
- func (GoLogger) Fatal(args ...interface{})
- func (GoLogger) Fatalf(format string, args ...interface{})
- func (GoLogger) Fatalw(msg string, keysAndValues ...interface{})
- func (GoLogger) Info(args ...interface{})
- func (GoLogger) InfoDynamic(l func() string)
- func (GoLogger) Infof(format string, args ...interface{})
- func (GoLogger) Infow(msg string, keysAndValues ...interface{})
- func (GoLogger) Panic(args ...interface{})
- func (GoLogger) Panicf(format string, args ...interface{})
- func (GoLogger) Panicw(msg string, keysAndValues ...interface{})
- func (GoLogger) Warn(args ...interface{})
- func (GoLogger) Warnf(format string, args ...interface{})
- func (GoLogger) Warnw(msg string, keysAndValues ...interface{})
- type TxContextMockTest
- func (s *TxContextMockTest) CallContract(caller, contract *commonPb.Contract, method string, byteCode []byte, ...) (*commonPb.ContractResult, protocol.ExecOrderTxType, commonPb.TxStatusCode)
- func (s *TxContextMockTest) Del(name string, key []byte) error
- func (s *TxContextMockTest) Get(name string, key []byte) ([]byte, error)
- func (*TxContextMockTest) GetAccessControl() (protocol.AccessControlProvider, error)
- func (s *TxContextMockTest) GetBlockFingerprint() string
- func (*TxContextMockTest) GetBlockHeight() uint64
- func (s *TxContextMockTest) GetBlockProposer() *acPb.Member
- func (s *TxContextMockTest) GetBlockTimestamp() int64
- func (s *TxContextMockTest) GetBlockVersion() uint32
- func (*TxContextMockTest) GetBlockchainStore() protocol.BlockchainStore
- func (s *TxContextMockTest) GetChainNodesInfoProvider() (protocol.ChainNodesInfoProvider, error)
- func (s *TxContextMockTest) GetConsensusStateWrapper() protocol.ConsensusStateWrapper
- func (s *TxContextMockTest) GetContractByName(name string) (*commonPb.Contract, error)
- func (s *TxContextMockTest) GetContractBytecode(name string) ([]byte, error)
- func (s *TxContextMockTest) GetCreator(namespace string) *acPb.Member
- func (s *TxContextMockTest) GetCrossInfo() uint64
- func (s *TxContextMockTest) GetCurrentResult() []byte
- func (s *TxContextMockTest) GetDepth() int
- func (s *TxContextMockTest) GetGasRemaining() uint64
- func (s *TxContextMockTest) GetHistoryIterForKey(contractName string, key []byte) (protocol.KeyHistoryIterator, error)
- func (s *TxContextMockTest) GetIterHandle(index int32) (interface{}, bool)
- func (s *TxContextMockTest) GetKeys(keys []*vmPb.BatchKey) ([]*vmPb.BatchKey, error)
- func (s *TxContextMockTest) GetLastChainConfig() *configPb.ChainConfig
- func (s *TxContextMockTest) GetNoRecord(contractName string, key []byte) ([]byte, error)
- func (s *TxContextMockTest) GetSender() *acPb.Member
- func (s *TxContextMockTest) GetSnapshot() protocol.Snapshot
- func (s *TxContextMockTest) GetStateKvHandle(i int32) (protocol.StateIterator, bool)
- func (s *TxContextMockTest) GetStateSqlHandle(i int32) (protocol.SqlRows, bool)
- func (s *TxContextMockTest) GetStrAddrFromPbMember(pbMember *acPb.Member) (string, error)
- func (s *TxContextMockTest) GetTx() *commonPb.Transaction
- func (*TxContextMockTest) GetTxExecSeq() int
- func (s *TxContextMockTest) GetTxRWMapByContractName(contractName string) (map[string]*commonPb.TxRead, map[string]*commonPb.TxWrite)
- func (TxContextMockTest) GetTxRWSet(runVmSuccess bool) *commonPb.TxRWSet
- func (s *TxContextMockTest) GetTxResult() *commonPb.Result
- func (s *TxContextMockTest) HasUsed(runtimeType commonPb.RuntimeType) bool
- func (s *TxContextMockTest) Put(name string, key []byte, value []byte) error
- func (s *TxContextMockTest) PutIntoReadSet(contractName string, key []byte, value []byte)
- func (s *TxContextMockTest) PutRecord(contractName string, value []byte, sqlType protocol.SqlType)
- func (s *TxContextMockTest) RecordRuntimeTypeIntoCrossInfo(runtimeType commonPb.RuntimeType)
- func (s *TxContextMockTest) RemoveRuntimeTypeFromCrossInfo()
- func (s *TxContextMockTest) Select(name string, startKey []byte, limit []byte) (protocol.StateIterator, error)
- func (s *TxContextMockTest) SetIterHandle(index int32, iter interface{})
- func (s *TxContextMockTest) SetStateKvHandle(i int32, iterator protocol.StateIterator)
- func (s *TxContextMockTest) SetStateSqlHandle(i int32, rows protocol.SqlRows)
- func (*TxContextMockTest) SetTxExecSeq(i int)
- func (s *TxContextMockTest) SetTxResult(txResult *commonPb.Result)
- func (s *TxContextMockTest) SubtractGas(gasUsed uint64) error
Constants ¶
const ( // ContractNameTest is test contract name // ContractNameTest = "contract_test09" ContractNameTest = "contract_test106" // ContractNameAddr contract addr ContractNameAddr = "xxxxxxaddressfehis" // ContractVersionTest is test contract version ContractVersionTest = "v1.0.0" )
Variables ¶
var CertFilePath = "./testdata/admin1.sing.crt"
CertFilePath is the test cert file path
var TxIds = []string{ uuid.Generate().String(), uuid.Generate().String(), uuid.Generate().String(), uuid.Generate().String(), uuid.Generate().String(), uuid.Generate().String(), uuid.Generate().String(), }
TxIds is a list of tx ids
Functions ¶
Types ¶
type GoLogger ¶
type GoLogger struct{}
GoLogger is a golang system log implementation of protocol.Logger, it's for unit test
func (GoLogger) DebugDynamic ¶
DebugDynamic is the dynamic debug log
func (GoLogger) Debugf ¶
Debugf is the debugf log
func (GoLogger) Debugw ¶
Debugw is the debugw log
func (GoLogger) Errorf ¶
Errorf is the errorf log
func (GoLogger) Errorw ¶
Errorw is the errorw log
func (GoLogger) Fatalf ¶
Fatalf is the fatalf log
func (GoLogger) Fatalw ¶
Fatalw is the fatalw log
func (GoLogger) InfoDynamic ¶
InfoDynamic is the dynamic info log
func (GoLogger) Infof ¶
Infof is the infof log
func (GoLogger) Infow ¶
Infow is the infow log
func (GoLogger) Panicf ¶
Panicf is the panicf log
func (GoLogger) Panicw ¶
Panicw is the panicw log
func (GoLogger) Warnf ¶
Warnf is the warnf log
type TxContextMockTest ¶
type TxContextMockTest struct { CacheMap map[string][]byte // contains filtered or unexported fields }
TxContextMockTest mock tx context test
func InitContextTest ¶
func InitContextTest() *TxContextMockTest
InitContextTest initialize TxContext and Contract
func (*TxContextMockTest) CallContract ¶
func (s *TxContextMockTest) CallContract(caller, contract *commonPb.Contract, method string, byteCode []byte, parameter map[string][]byte, gasUsed uint64, refTxType commonPb.TxType) (*commonPb.ContractResult, protocol.ExecOrderTxType, commonPb.TxStatusCode)
CallContract cross contract call, return (contract result, gas used)
func (*TxContextMockTest) Del ¶
func (s *TxContextMockTest) Del(name string, key []byte) error
Del delete key from cache
func (*TxContextMockTest) Get ¶
func (s *TxContextMockTest) Get(name string, key []byte) ([]byte, error)
Get returns key from cache, record this operation to read set
func (*TxContextMockTest) GetAccessControl ¶
func (*TxContextMockTest) GetAccessControl() (protocol.AccessControlProvider, error)
GetAccessControl returns access control
func (*TxContextMockTest) GetBlockFingerprint ¶
func (s *TxContextMockTest) GetBlockFingerprint() string
GetBlockFingerprint returns unique id for block
func (*TxContextMockTest) GetBlockHeight ¶
func (*TxContextMockTest) GetBlockHeight() uint64
GetBlockHeight returns block height
func (*TxContextMockTest) GetBlockProposer ¶
func (s *TxContextMockTest) GetBlockProposer() *acPb.Member
GetBlockProposer returns block proposer
func (*TxContextMockTest) GetBlockTimestamp ¶
func (s *TxContextMockTest) GetBlockTimestamp() int64
GetBlockTimestamp returns block timestamp
func (*TxContextMockTest) GetBlockVersion ¶
func (s *TxContextMockTest) GetBlockVersion() uint32
GetBlockVersion returns block version
func (*TxContextMockTest) GetBlockchainStore ¶
func (*TxContextMockTest) GetBlockchainStore() protocol.BlockchainStore
GetBlockchainStore returns related blockchain store
func (*TxContextMockTest) GetChainNodesInfoProvider ¶
func (s *TxContextMockTest) GetChainNodesInfoProvider() (protocol.ChainNodesInfoProvider, error)
GetChainNodesInfoProvider returns chain nodes info provider
func (*TxContextMockTest) GetConsensusStateWrapper ¶
func (s *TxContextMockTest) GetConsensusStateWrapper() protocol.ConsensusStateWrapper
GetConsensusStateWrapper 获得共识状态 @return protocol.ConsensusStateWrapper
func (*TxContextMockTest) GetContractByName ¶
func (s *TxContextMockTest) GetContractByName(name string) (*commonPb.Contract, error)
GetContractByName returns contract name
func (*TxContextMockTest) GetContractBytecode ¶
func (s *TxContextMockTest) GetContractBytecode(name string) ([]byte, error)
GetContractBytecode returns contract bytecode
func (*TxContextMockTest) GetCreator ¶
func (s *TxContextMockTest) GetCreator(namespace string) *acPb.Member
GetCreator returns creator
func (*TxContextMockTest) GetCrossInfo ¶
func (s *TxContextMockTest) GetCrossInfo() uint64
GetCrossInfo get contract call link information
func (*TxContextMockTest) GetCurrentResult ¶
func (s *TxContextMockTest) GetCurrentResult() []byte
GetCurrentResult returns current result
func (*TxContextMockTest) GetDepth ¶
func (s *TxContextMockTest) GetDepth() int
GetDepth returns cross contract call depth
func (*TxContextMockTest) GetGasRemaining ¶ added in v3.0.1
func (s *TxContextMockTest) GetGasRemaining() uint64
GetGasRemaining return gas remaining in txSimContext
func (*TxContextMockTest) GetHistoryIterForKey ¶
func (s *TxContextMockTest) GetHistoryIterForKey(contractName string, key []byte) (protocol.KeyHistoryIterator, error)
GetHistoryIterForKey returns history iter for key
func (*TxContextMockTest) GetIterHandle ¶
func (s *TxContextMockTest) GetIterHandle(index int32) (interface{}, bool)
GetIterHandle returns iter
func (*TxContextMockTest) GetKeys ¶
GetKeys GetKeys
func (*TxContextMockTest) GetLastChainConfig ¶
func (s *TxContextMockTest) GetLastChainConfig() *configPb.ChainConfig
GetLastChainConfig returns last chain config
func (*TxContextMockTest) GetNoRecord ¶
func (s *TxContextMockTest) GetNoRecord(contractName string, key []byte) ([]byte, error)
GetNoRecord read data from state, but not record into read set, only used for framework
func (*TxContextMockTest) GetSender ¶
func (s *TxContextMockTest) GetSender() *acPb.Member
GetSender returns sender
func (*TxContextMockTest) GetSnapshot ¶
func (s *TxContextMockTest) GetSnapshot() protocol.Snapshot
GetSnapshot 获得快照 @return protocol.Snapshot
func (*TxContextMockTest) GetStateKvHandle ¶
func (s *TxContextMockTest) GetStateKvHandle(i int32) (protocol.StateIterator, bool)
GetStateKvHandle returns state kv handle
func (*TxContextMockTest) GetStateSqlHandle ¶
func (s *TxContextMockTest) GetStateSqlHandle(i int32) (protocol.SqlRows, bool)
GetStateSqlHandle returns get state sql
func (*TxContextMockTest) GetStrAddrFromPbMember ¶
func (s *TxContextMockTest) GetStrAddrFromPbMember(pbMember *acPb.Member) (string, error)
GetStrAddrFromPbMember calculate string address from pb Member
func (*TxContextMockTest) GetTx ¶
func (s *TxContextMockTest) GetTx() *commonPb.Transaction
GetTx returns tx
func (*TxContextMockTest) GetTxExecSeq ¶
func (*TxContextMockTest) GetTxExecSeq() int
GetTxExecSeq returns tx exec seq
func (*TxContextMockTest) GetTxRWMapByContractName ¶
func (s *TxContextMockTest) GetTxRWMapByContractName( contractName string, ) (map[string]*commonPb.TxRead, map[string]*commonPb.TxWrite)
GetTxRWMapByContractName get the read-write map of the specified contract of the current transaction
func (TxContextMockTest) GetTxRWSet ¶
func (TxContextMockTest) GetTxRWSet(runVmSuccess bool) *commonPb.TxRWSet
GetTxRWSet returns tx rwset
func (*TxContextMockTest) GetTxResult ¶
func (s *TxContextMockTest) GetTxResult() *commonPb.Result
GetTxResult returns tx result
func (*TxContextMockTest) HasUsed ¶
func (s *TxContextMockTest) HasUsed(runtimeType commonPb.RuntimeType) bool
HasUsed judge whether the specified common.RuntimeType has appeared in the previous depth in the current cross-link
func (*TxContextMockTest) Put ¶
func (s *TxContextMockTest) Put(name string, key []byte, value []byte) error
Put key into cache
func (*TxContextMockTest) PutIntoReadSet ¶
func (s *TxContextMockTest) PutIntoReadSet(contractName string, key []byte, value []byte)
PutIntoReadSet put into read set
func (*TxContextMockTest) PutRecord ¶
func (s *TxContextMockTest) PutRecord(contractName string, value []byte, sqlType protocol.SqlType)
PutRecord put record
func (*TxContextMockTest) RecordRuntimeTypeIntoCrossInfo ¶
func (s *TxContextMockTest) RecordRuntimeTypeIntoCrossInfo(runtimeType commonPb.RuntimeType)
RecordRuntimeTypeIntoCrossInfo add new vm runtime
func (*TxContextMockTest) RemoveRuntimeTypeFromCrossInfo ¶
func (s *TxContextMockTest) RemoveRuntimeTypeFromCrossInfo()
RemoveRuntimeTypeFromCrossInfo remove runtime from cross info
func (*TxContextMockTest) Select ¶
func (s *TxContextMockTest) Select(name string, startKey []byte, limit []byte) (protocol.StateIterator, error)
Select range query for key [start, limit)
func (*TxContextMockTest) SetIterHandle ¶
func (s *TxContextMockTest) SetIterHandle(index int32, iter interface{})
SetIterHandle returns iter
func (*TxContextMockTest) SetStateKvHandle ¶
func (s *TxContextMockTest) SetStateKvHandle(i int32, iterator protocol.StateIterator)
SetStateKvHandle set state kv handle
func (*TxContextMockTest) SetStateSqlHandle ¶
func (s *TxContextMockTest) SetStateSqlHandle(i int32, rows protocol.SqlRows)
SetStateSqlHandle set state sql
func (*TxContextMockTest) SetTxExecSeq ¶
func (*TxContextMockTest) SetTxExecSeq(i int)
SetTxExecSeq set tx exec seq
func (*TxContextMockTest) SetTxResult ¶
func (s *TxContextMockTest) SetTxResult(txResult *commonPb.Result)
SetTxResult set tx result
func (*TxContextMockTest) SubtractGas ¶ added in v3.0.1
func (s *TxContextMockTest) SubtractGas(gasUsed uint64) error
SubtractGas subtract gas from txSimContext