tests

package
v0.0.0-...-3f6d56f Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgId        = "lh-org1.hercules.org"
	ChainId      = "chain1"
	BlockVersion = uint32(1)
)

Variables

This section is empty.

Functions

func InitVmManager

func InitVmManager(store protocol.BlockchainStore, chainConfig *chainconf.ChainConf) (protocol.VmManager, error)

func InitWasmContract

func InitWasmContract(
	contractName string,
	contractVersion string,
	wasmFilePath string,
	orgId string,
	certFilePath string,
	log *logger.CMLogger) (*commonPb.Contract, []byte, error)

func InvokeContractWithParameters

func InvokeContractWithParameters(method string, pbContract *commonPb.Contract, wasmByteCode []byte,
	vmManager protocol.VmManager, snapshot protocol.Snapshot, args map[string][]byte,
	userCertBytes []byte) *commonPb.ContractResult

func PrepareMember

func PrepareMember(orgId string, certBytes []byte) (*accessPb.Member, error)

func PrepareTx

func PrepareTx(sender *accessPb.Member, chainId string,
	contractName string, method string, args map[string][]byte,
	seq uint64, limit *commonPb.Limit) *commonPb.Transaction

func PutContractBytecodeIntoStore

func PutContractBytecodeIntoStore(store *BlockchainStoreMock, name string, bytecode []byte)

func PutContractIdIntoStore

func PutContractIdIntoStore(store *BlockchainStoreMock, name string, pbContract *commonPb.Contract) error

Types

type BlockchainStoreMock

type BlockchainStoreMock struct {
	Cache map[string][]byte
	// contains filtered or unexported fields
}

func (BlockchainStoreMock) ArchiveBlock

func (b BlockchainStoreMock) ArchiveBlock(archiveHeight uint64) error

func (*BlockchainStoreMock) BeginDbTransaction

func (b *BlockchainStoreMock) BeginDbTransaction(txName string) (protocol.SqlDBTransaction, error)

func (*BlockchainStoreMock) BlockExists

func (b *BlockchainStoreMock) BlockExists(blockHash []byte) (bool, error)

func (BlockchainStoreMock) Close

func (b BlockchainStoreMock) Close() error

func (*BlockchainStoreMock) CommitDbTransaction

func (b *BlockchainStoreMock) CommitDbTransaction(txName string) error

func (*BlockchainStoreMock) CreateDatabase

func (b *BlockchainStoreMock) CreateDatabase(contractName string) error

func (*BlockchainStoreMock) DropDatabase

func (b *BlockchainStoreMock) DropDatabase(contractName string) error

func (*BlockchainStoreMock) ExecDdlSql

func (b *BlockchainStoreMock) ExecDdlSql(contractName, sql, version string) error

func (BlockchainStoreMock) GetAccountTxHistory

func (b BlockchainStoreMock) GetAccountTxHistory(accountId []byte) (protocol.TxHistoryIterator, error)

func (BlockchainStoreMock) GetArchivedPivot

func (b BlockchainStoreMock) GetArchivedPivot() uint64

func (*BlockchainStoreMock) GetBlock

func (b *BlockchainStoreMock) GetBlock(height uint64) (*commonPb.Block, error)

func (*BlockchainStoreMock) GetBlockByHash

func (b *BlockchainStoreMock) GetBlockByHash(blockHash []byte) (*commonPb.Block, error)

func (BlockchainStoreMock) GetBlockByTx

func (b BlockchainStoreMock) GetBlockByTx(txId string) (*commonPb.Block, error)

func (*BlockchainStoreMock) GetBlockHeaderByHeight

func (b *BlockchainStoreMock) GetBlockHeaderByHeight(height uint64) (*commonPb.BlockHeader, error)

func (BlockchainStoreMock) GetBlockWithRWSets

func (b BlockchainStoreMock) GetBlockWithRWSets(height uint64) (*store.BlockWithRWSet, error)

func (*BlockchainStoreMock) GetContractByName

func (b *BlockchainStoreMock) GetContractByName(name string) (*commonPb.Contract, error)

func (*BlockchainStoreMock) GetContractBytecode

func (b *BlockchainStoreMock) GetContractBytecode(name string) ([]byte, error)

func (*BlockchainStoreMock) GetContractDbName

func (b *BlockchainStoreMock) GetContractDbName(contractName string) string

func (BlockchainStoreMock) GetContractTxHistory

func (b BlockchainStoreMock) GetContractTxHistory(contractName string) (protocol.TxHistoryIterator, error)

func (BlockchainStoreMock) GetDBHandle

func (b BlockchainStoreMock) GetDBHandle(dbName string) protocol.DBHandle

func (*BlockchainStoreMock) GetDbTransaction

func (b *BlockchainStoreMock) GetDbTransaction(txName string) (protocol.SqlDBTransaction, error)

func (*BlockchainStoreMock) GetHeightByHash

func (b *BlockchainStoreMock) GetHeightByHash(blockHash []byte) (uint64, error)

func (BlockchainStoreMock) GetHistoryForKey

func (b BlockchainStoreMock) GetHistoryForKey(contractName string, key []byte) (protocol.KeyHistoryIterator, error)

func (BlockchainStoreMock) GetLastBlock

func (b BlockchainStoreMock) GetLastBlock() (*commonPb.Block, error)

func (*BlockchainStoreMock) GetLastChainConfig

func (b *BlockchainStoreMock) GetLastChainConfig() (*config.ChainConfig, error)

func (*BlockchainStoreMock) GetLastConfigBlock

func (b *BlockchainStoreMock) GetLastConfigBlock() (*commonPb.Block, error)

func (*BlockchainStoreMock) GetMemberExtraData

func (b *BlockchainStoreMock) GetMemberExtraData(member *pbac.Member) (*pbac.MemberExtraData, error)

func (BlockchainStoreMock) GetTx

func (BlockchainStoreMock) GetTxConfirmedTime

func (b BlockchainStoreMock) GetTxConfirmedTime(txId string) (int64, error)

func (BlockchainStoreMock) GetTxHeight

func (b BlockchainStoreMock) GetTxHeight(txId string) (uint64, error)

func (BlockchainStoreMock) GetTxInfoOnly

func (b BlockchainStoreMock) GetTxInfoOnly(txId string) (*commonPb.TransactionInfo, error)

func (BlockchainStoreMock) GetTxInfoWithRWSet

func (b BlockchainStoreMock) GetTxInfoWithRWSet(txId string) (*commonPb.TransactionInfoWithRWSet, error)

func (BlockchainStoreMock) GetTxRWSet

func (b BlockchainStoreMock) GetTxRWSet(txId string) (*commonPb.TxRWSet, error)

func (BlockchainStoreMock) GetTxRWSetsByHeight

func (b BlockchainStoreMock) GetTxRWSetsByHeight(height uint64) ([]*commonPb.TxRWSet, error)

func (BlockchainStoreMock) GetTxWithInfo

func (b BlockchainStoreMock) GetTxWithInfo(txId string) (*commonPb.TransactionInfo, error)

func (BlockchainStoreMock) GetTxWithRWSet

func (b BlockchainStoreMock) GetTxWithRWSet(txId string) (*commonPb.TransactionWithRWSet, error)

func (*BlockchainStoreMock) InitGenesis

func (b *BlockchainStoreMock) InitGenesis(genesisBlock *store.BlockWithRWSet) error

func (*BlockchainStoreMock) Lock

func (s *BlockchainStoreMock) Lock()

func (*BlockchainStoreMock) PrintDebugInfo

func (s *BlockchainStoreMock) PrintDebugInfo()

func (*BlockchainStoreMock) PutBlock

func (b *BlockchainStoreMock) PutBlock(block *commonPb.Block, txRWSets []*commonPb.TxRWSet) error

func (BlockchainStoreMock) QueryMulti

func (b BlockchainStoreMock) QueryMulti(contractName, sql string, values ...interface{}) (protocol.SqlRows, error)

func (*BlockchainStoreMock) QuerySingle

func (b *BlockchainStoreMock) QuerySingle(contractName, sql string, values ...interface{}) (protocol.SqlRow, error)

func (*BlockchainStoreMock) RLock

func (s *BlockchainStoreMock) RLock()

func (*BlockchainStoreMock) RUnlock

func (s *BlockchainStoreMock) RUnlock()

func (BlockchainStoreMock) ReadObject

func (b BlockchainStoreMock) ReadObject(contractName string, key []byte) ([]byte, error)

func (BlockchainStoreMock) RestoreBlocks

func (b BlockchainStoreMock) RestoreBlocks(serializedBlocks [][]byte) error

func (*BlockchainStoreMock) RollbackDbTransaction

func (b *BlockchainStoreMock) RollbackDbTransaction(txName string) error

func (BlockchainStoreMock) SelectObject

func (b BlockchainStoreMock) SelectObject(contractName string, startKey []byte, limit []byte) (protocol.StateIterator, error)

func (BlockchainStoreMock) TxExists

func (b BlockchainStoreMock) TxExists(txId string) (bool, error)

func (*BlockchainStoreMock) Unlock

func (s *BlockchainStoreMock) Unlock()

type SnapshotMock

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

func BeforeCmdExecute

func BeforeCmdExecute(chainId, contractName, contractVersion, wasmFilePath, configFilePath, userCertFilePath string) (
	*commonPb.Contract, protocol.VmManager, *SnapshotMock, []byte, error)

func (*SnapshotMock) ApplyTxSimContext

func (s *SnapshotMock) ApplyTxSimContext(txSimContext protocol.TxSimContext, txType protocol.ExecOrderTxType,
	b bool, txSuccess bool) (bool, int)

func (*SnapshotMock) BuildDAG

func (s *SnapshotMock) BuildDAG(isSql bool) *common.DAG

func (*SnapshotMock) GetBlockHeight

func (s *SnapshotMock) GetBlockHeight() uint64

func (*SnapshotMock) GetBlockProposer

func (s *SnapshotMock) GetBlockProposer() *pbac.Member

func (*SnapshotMock) GetBlockTimestamp

func (s *SnapshotMock) GetBlockTimestamp() int64

func (*SnapshotMock) GetBlockchainStore

func (s *SnapshotMock) GetBlockchainStore() protocol.BlockchainStore

func (*SnapshotMock) GetBlockchainStoreMock

func (s *SnapshotMock) GetBlockchainStoreMock() *BlockchainStoreMock

func (*SnapshotMock) GetKey

func (s *SnapshotMock) GetKey(_txExecSeq int, contractName string, key []byte) ([]byte, error)

func (*SnapshotMock) GetPreSnapshot

func (s *SnapshotMock) GetPreSnapshot() protocol.Snapshot

func (*SnapshotMock) GetSnapshotSize

func (s *SnapshotMock) GetSnapshotSize() int

func (*SnapshotMock) GetSpecialTxTable

func (s *SnapshotMock) GetSpecialTxTable() []*common.Transaction

func (*SnapshotMock) GetTxRWSetTable

func (s *SnapshotMock) GetTxRWSetTable() []*common.TxRWSet

func (*SnapshotMock) GetTxResultMap

func (s *SnapshotMock) GetTxResultMap() map[string]*common.Result

func (*SnapshotMock) GetTxTable

func (s *SnapshotMock) GetTxTable() []*common.Transaction

func (*SnapshotMock) IsSealed

func (s *SnapshotMock) IsSealed() bool

func (*SnapshotMock) Seal

func (s *SnapshotMock) Seal()

func (*SnapshotMock) SetPreSnapshot

func (s *SnapshotMock) SetPreSnapshot(snapshot protocol.Snapshot)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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