mock

package
v1.0.34 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCountingDB

func NewCountingDB() *countingDB

func NewMultiShardsCoordinatorMock

func NewMultiShardsCoordinatorMock(nrShard uint32) *multipleShardsCoordinatorMock

func NewMultipleShardsCoordinatorMock added in v1.0.3

func NewMultipleShardsCoordinatorMock() *multipleShardsCoordinatorMock

Types

type AccountsFactoryStub

type AccountsFactoryStub struct {
	CreateAccountCalled func(address state.AddressContainer, tracker state.AccountTracker) (state.AccountHandler, error)
}

func (*AccountsFactoryStub) CreateAccount

func (afs *AccountsFactoryStub) CreateAccount(address state.AddressContainer, tracker state.AccountTracker) (state.AccountHandler, error)

func (*AccountsFactoryStub) IsInterfaceNil

func (afs *AccountsFactoryStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type BelNevMock

type BelNevMock struct {
	VerifyMock               func(msg []byte, bitmap []byte) error
	CommitmentHashMock       func(index uint16) ([]byte, error)
	CreateCommitmentMock     func() ([]byte, []byte)
	AggregateCommitmentsMock func(bitmap []byte) error
	CreateSignatureShareMock func(msg []byte, bitmap []byte) ([]byte, error)
	VerifySignatureShareMock func(index uint16, sig []byte, msg []byte, bitmap []byte) error
	AggregateSigsMock        func(bitmap []byte) ([]byte, error)
	SignatureShareMock       func(index uint16) ([]byte, error)
	StoreCommitmentMock      func(index uint16, value []byte) error
	StoreCommitmentHashMock  func(uint16, []byte) error
	CommitmentMock           func(uint16) ([]byte, error)
	CreateCalled             func(pubKeys []string, index uint16) (crypto.MultiSigner, error)
	ResetCalled              func(pubKeys []string, index uint16) error
	// contains filtered or unexported fields
}

BelNevMock is used to mock belare neven multisignature scheme

func NewMultiSigner

func NewMultiSigner(nrConsens uint32) *BelNevMock

func (*BelNevMock) AggregateCommitments

func (bnm *BelNevMock) AggregateCommitments(bitmap []byte) error

AggregateCommitments aggregates the list of commitments

func (*BelNevMock) AggregateSigs

func (bnm *BelNevMock) AggregateSigs(bitmap []byte) ([]byte, error)

AggregateSigs aggregates all collected partial signatures

func (*BelNevMock) Commitment

func (bnm *BelNevMock) Commitment(index uint16) ([]byte, error)

Commitment returns the commitment from the list with the specified position

func (*BelNevMock) CommitmentHash

func (bnm *BelNevMock) CommitmentHash(index uint16) ([]byte, error)

CommitmentHash returns the commitment hash from the list on the specified position

func (*BelNevMock) Create

func (bnm *BelNevMock) Create(pubKeys []string, index uint16) (crypto.MultiSigner, error)

Create creates a multiSigner using receiver as template and initializes corresponding fields with the given params

func (*BelNevMock) CreateCommitment

func (bnm *BelNevMock) CreateCommitment() (commSecret []byte, commitment []byte)

CreateCommitment creates a secret commitment and the corresponding public commitment point

func (*BelNevMock) CreateSignatureShare

func (bnm *BelNevMock) CreateSignatureShare(msg []byte, bitmap []byte) ([]byte, error)

CreateSignatureShare creates a partial signature

func (*BelNevMock) IsInterfaceNil

func (bnm *BelNevMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BelNevMock) Reset

func (bnm *BelNevMock) Reset(pubKeys []string, index uint16) error

Reset

func (*BelNevMock) SetAggregatedSig

func (bnm *BelNevMock) SetAggregatedSig(aggSig []byte) error

SetAggregatedSig sets the aggregated signature according to the given byte array

func (*BelNevMock) SignatureShare

func (bnm *BelNevMock) SignatureShare(index uint16) ([]byte, error)

SignatureShare

func (*BelNevMock) StoreCommitment

func (bnm *BelNevMock) StoreCommitment(index uint16, value []byte) error

StoreCommitment adds a commitment to the list on the specified position

func (*BelNevMock) StoreCommitmentHash

func (bnm *BelNevMock) StoreCommitmentHash(index uint16, commHash []byte) error

StoreCommitmentHash adds a commitment hash to the list on the specified position

func (*BelNevMock) StoreSignatureShare

func (bnm *BelNevMock) StoreSignatureShare(index uint16, sig []byte) error

StoreSignatureShare adds the partial signature of the signer with specified position

func (*BelNevMock) Verify

func (bnm *BelNevMock) Verify(msg []byte, bitmap []byte) error

Verify returns nil if the aggregateed signature is verified for the given public keys

func (*BelNevMock) VerifySignatureShare

func (bnm *BelNevMock) VerifySignatureShare(index uint16, sig []byte, msg []byte, bitmap []byte) error

VerifySignatureShare verifies the partial signature of the signer with specified position

type BlockProcessorMock

type BlockProcessorMock struct {
	NrCommitBlockCalled              uint32
	Marshalizer                      marshal.Marshalizer
	ProcessBlockCalled               func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error
	CommitBlockCalled                func(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error
	RevertAccountStateCalled         func()
	CreateBlockCalled                func(round uint64, haveTime func() bool) (data.BodyHandler, error)
	RestoreBlockIntoPoolsCalled      func(header data.HeaderHandler, body data.BodyHandler) error
	CreateBlockHeaderCalled          func(body data.BodyHandler, round uint64, haveTime func() bool) (data.HeaderHandler, error)
	MarshalizedDataToBroadcastCalled func(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)
	DecodeBlockBodyCalled            func(dta []byte) data.BodyHandler
	DecodeBlockHeaderCalled          func(dta []byte) data.HeaderHandler
	AddLastNotarizedHdrCalled        func(shardId uint32, processedHdr data.HeaderHandler)
	SetConsensusDataCalled           func(randomness []byte, round uint64, epoch uint32, shardId uint32)
}

BlockProcessorMock mocks the implementation for a blockProcessor

func (BlockProcessorMock) AddLastNotarizedHdr

func (blProcMock BlockProcessorMock) AddLastNotarizedHdr(shardId uint32, processedHdr data.HeaderHandler)

func (*BlockProcessorMock) CommitBlock

func (blProcMock *BlockProcessorMock) CommitBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler) error

CommitBlock mocks the commit of a block

func (*BlockProcessorMock) CreateBlockBody added in v1.0.3

func (blProcMock *BlockProcessorMock) CreateBlockBody(round uint64, haveTime func() bool) (data.BodyHandler, error)

CreateTxBlockBody mocks the creation of a transaction block body

func (BlockProcessorMock) CreateBlockHeader added in v1.0.3

func (blProcMock BlockProcessorMock) CreateBlockHeader(body data.BodyHandler, round uint64, haveTime func() bool) (data.HeaderHandler, error)

func (BlockProcessorMock) DecodeBlockBody

func (blProcMock BlockProcessorMock) DecodeBlockBody(dta []byte) data.BodyHandler

DecodeBlockBody method decodes block body from a given byte array

func (BlockProcessorMock) DecodeBlockHeader

func (blProcMock BlockProcessorMock) DecodeBlockHeader(dta []byte) data.HeaderHandler

DecodeBlockHeader method decodes block header from a given byte array

func (*BlockProcessorMock) IsInterfaceNil

func (blProcMock *BlockProcessorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (BlockProcessorMock) MarshalizedDataToBroadcast

func (blProcMock BlockProcessorMock) MarshalizedDataToBroadcast(header data.HeaderHandler, body data.BodyHandler) (map[uint32][]byte, map[string][][]byte, error)

func (*BlockProcessorMock) ProcessBlock

func (blProcMock *BlockProcessorMock) ProcessBlock(blockChain data.ChainHandler, header data.HeaderHandler, body data.BodyHandler, haveTime func() time.Duration) error

ProcessBlock mocks pocessing a block

func (*BlockProcessorMock) RestoreBlockIntoPools

func (blProcMock *BlockProcessorMock) RestoreBlockIntoPools(header data.HeaderHandler, body data.BodyHandler) error

func (*BlockProcessorMock) RevertAccountState

func (blProcMock *BlockProcessorMock) RevertAccountState()

RevertAccountState mocks revert of the accounts state

func (BlockProcessorMock) SetConsensusData added in v1.0.20

func (blProcMock BlockProcessorMock) SetConsensusData(randomness []byte, round uint64, epoch uint32, shardId uint32)

type CacherStub

type CacherStub struct {
	ClearCalled           func()
	PutCalled             func(key []byte, value interface{}) (evicted bool)
	GetCalled             func(key []byte) (value interface{}, ok bool)
	HasCalled             func(key []byte) bool
	PeekCalled            func(key []byte) (value interface{}, ok bool)
	HasOrAddCalled        func(key []byte, value interface{}) (ok, evicted bool)
	RemoveCalled          func(key []byte)
	RemoveOldestCalled    func()
	KeysCalled            func() [][]byte
	LenCalled             func() int
	MaxSizeCalled         func() int
	RegisterHandlerCalled func(func(key []byte))
}

func (*CacherStub) Clear

func (cs *CacherStub) Clear()

func (*CacherStub) Get

func (cs *CacherStub) Get(key []byte) (value interface{}, ok bool)

func (*CacherStub) Has

func (cs *CacherStub) Has(key []byte) bool

func (*CacherStub) HasOrAdd

func (cs *CacherStub) HasOrAdd(key []byte, value interface{}) (ok, evicted bool)

func (*CacherStub) IsInterfaceNil

func (cs *CacherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherStub) Keys

func (cs *CacherStub) Keys() [][]byte

func (*CacherStub) Len

func (cs *CacherStub) Len() int

func (*CacherStub) MaxSize

func (cs *CacherStub) MaxSize() int

func (*CacherStub) Peek

func (cs *CacherStub) Peek(key []byte) (value interface{}, ok bool)

func (*CacherStub) Put

func (cs *CacherStub) Put(key []byte, value interface{}) (evicted bool)

func (*CacherStub) RegisterHandler

func (cs *CacherStub) RegisterHandler(handler func(key []byte))

func (*CacherStub) Remove

func (cs *CacherStub) Remove(key []byte)

func (*CacherStub) RemoveOldest

func (cs *CacherStub) RemoveOldest()

type FeeHandlerStub

type FeeHandlerStub struct {
	SetMinGasPriceCalled        func(minasPrice uint64)
	SetMinGasLimitCalled        func(minGasLimit uint64)
	ComputeGasLimitCalled       func(tx process.TransactionWithFeeHandler) uint64
	ComputeFeeCalled            func(tx process.TransactionWithFeeHandler) *big.Int
	CheckValidityTxValuesCalled func(tx process.TransactionWithFeeHandler) error
}

func (*FeeHandlerStub) CheckValidityTxValues

func (fhs *FeeHandlerStub) CheckValidityTxValues(tx process.TransactionWithFeeHandler) error

func (*FeeHandlerStub) ComputeFee

func (*FeeHandlerStub) ComputeGasLimit

func (fhs *FeeHandlerStub) ComputeGasLimit(tx process.TransactionWithFeeHandler) uint64

func (*FeeHandlerStub) IsInterfaceNil

func (fhs *FeeHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*FeeHandlerStub) SetMinGasLimit

func (fhs *FeeHandlerStub) SetMinGasLimit(minGasLimit uint64)

func (*FeeHandlerStub) SetMinGasPrice

func (fhs *FeeHandlerStub) SetMinGasPrice(minGasPrice uint64)

type ForkDetectorMock

type ForkDetectorMock struct {
	AddHeaderCalled                         func(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte) error
	RemoveHeadersCalled                     func(nonce uint64, hash []byte)
	CheckForkCalled                         func() (bool, uint64, []byte)
	GetHighestFinalBlockNonceCalled         func() uint64
	ProbableHighestNonceCalled              func() uint64
	ResetProbableHighestNonceIfNeededCalled func()
	ResetProbableHighestNonceCalled         func()
}

ForkDetectorMock is a mock implementation for the ForkDetector interface

func (*ForkDetectorMock) AddHeader

func (f *ForkDetectorMock) AddHeader(header data.HeaderHandler, hash []byte, state process.BlockHeaderState, finalHeaders []data.HeaderHandler, finalHeadersHashes [][]byte) error

AddHeader is a mock implementation for AddHeader

func (*ForkDetectorMock) CheckFork

func (f *ForkDetectorMock) CheckFork() (bool, uint64, []byte)

CheckFork is a mock implementation for CheckFork

func (*ForkDetectorMock) GetHighestFinalBlockNonce

func (f *ForkDetectorMock) GetHighestFinalBlockNonce() uint64

GetHighestFinalBlockNonce is a mock implementation for GetHighestFinalBlockNonce

func (*ForkDetectorMock) IsInterfaceNil

func (fdm *ForkDetectorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ForkDetectorMock) ProbableHighestNonce

func (f *ForkDetectorMock) ProbableHighestNonce() uint64

GetProbableHighestNonce is a mock implementation for GetProbableHighestNonce

func (*ForkDetectorMock) RemoveHeaders added in v1.0.3

func (f *ForkDetectorMock) RemoveHeaders(nonce uint64, hash []byte)

RemoveHeaders is a mock implementation for RemoveHeaders

func (*ForkDetectorMock) ResetProbableHighestNonce

func (fdm *ForkDetectorMock) ResetProbableHighestNonce()

func (*ForkDetectorMock) ResetProbableHighestNonceIfNeeded added in v1.0.11

func (fdm *ForkDetectorMock) ResetProbableHighestNonceIfNeeded()

type HasherSpongeMock added in v1.0.20

type HasherSpongeMock struct {
}

HasherSpongeMock that will be used for testing

func (HasherSpongeMock) Compute added in v1.0.20

func (sha HasherSpongeMock) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (HasherSpongeMock) EmptyHash added in v1.0.20

func (sha HasherSpongeMock) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (HasherSpongeMock) Size added in v1.0.20

func (HasherSpongeMock) Size() int

Size returns the required size in bytes

type HeaderResolverMock

type HeaderResolverMock struct {
	RequestDataFromHashCalled    func(hash []byte) error
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
	RequestDataFromNonceCalled   func(nonce uint64) error
}

func (*HeaderResolverMock) IsInterfaceNil

func (hrm *HeaderResolverMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HeaderResolverMock) ProcessReceivedMessage

func (hrm *HeaderResolverMock) ProcessReceivedMessage(message p2p.MessageP2P) error

func (*HeaderResolverMock) RequestDataFromHash

func (hrm *HeaderResolverMock) RequestDataFromHash(hash []byte) error

func (*HeaderResolverMock) RequestDataFromNonce

func (hrm *HeaderResolverMock) RequestDataFromNonce(nonce uint64) error

type InterimProcessorContainerMock

type InterimProcessorContainerMock struct {
	GetCalled  func(key block.Type) (process.IntermediateTransactionHandler, error)
	KeysCalled func() []block.Type
}

func (*InterimProcessorContainerMock) Add

func (*InterimProcessorContainerMock) AddMultiple

func (ppcm *InterimProcessorContainerMock) AddMultiple(keys []block.Type, preprocessors []process.IntermediateTransactionHandler) error

func (*InterimProcessorContainerMock) Get

func (*InterimProcessorContainerMock) IsInterfaceNil

func (ppcm *InterimProcessorContainerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*InterimProcessorContainerMock) Keys

func (ppcm *InterimProcessorContainerMock) Keys() []block.Type

func (*InterimProcessorContainerMock) Len

func (ppcm *InterimProcessorContainerMock) Len() int

func (*InterimProcessorContainerMock) Remove

func (ppcm *InterimProcessorContainerMock) Remove(key block.Type)

func (*InterimProcessorContainerMock) Replace

type IntermediateTransactionHandlerMock

type IntermediateTransactionHandlerMock struct {
	AddIntermediateTransactionsCalled        func(txs []data.TransactionHandler) error
	CreateAllInterMiniBlocksCalled           func() map[uint32]*block.MiniBlock
	VerifyInterMiniBlocksCalled              func(body block.Body) error
	SaveCurrentIntermediateTxToStorageCalled func() error
	CreateBlockStartedCalled                 func()
	CreateMarshalizedDataCalled              func(txHashes [][]byte) ([][]byte, error)
	GetAllCurrentFinishedTxsCalled           func() map[string]data.TransactionHandler
}

func (*IntermediateTransactionHandlerMock) AddIntermediateTransactions

func (ith *IntermediateTransactionHandlerMock) AddIntermediateTransactions(txs []data.TransactionHandler) error

func (*IntermediateTransactionHandlerMock) CreateAllInterMiniBlocks

func (ith *IntermediateTransactionHandlerMock) CreateAllInterMiniBlocks() map[uint32]*block.MiniBlock

func (*IntermediateTransactionHandlerMock) CreateBlockStarted

func (ith *IntermediateTransactionHandlerMock) CreateBlockStarted()

func (*IntermediateTransactionHandlerMock) CreateMarshalizedData

func (ith *IntermediateTransactionHandlerMock) CreateMarshalizedData(txHashes [][]byte) ([][]byte, error)

func (*IntermediateTransactionHandlerMock) GetAllCurrentFinishedTxs

func (ith *IntermediateTransactionHandlerMock) GetAllCurrentFinishedTxs() map[string]data.TransactionHandler

func (*IntermediateTransactionHandlerMock) IsInterfaceNil

func (ith *IntermediateTransactionHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*IntermediateTransactionHandlerMock) SaveCurrentIntermediateTxToStorage

func (ith *IntermediateTransactionHandlerMock) SaveCurrentIntermediateTxToStorage() error

func (*IntermediateTransactionHandlerMock) VerifyInterMiniBlocks

func (ith *IntermediateTransactionHandlerMock) VerifyInterMiniBlocks(body block.Body) error

type KeyGenMock

type KeyGenMock struct {
}

func (*KeyGenMock) GeneratePair

func (keyGen *KeyGenMock) GeneratePair() (crypto.PrivateKey, crypto.PublicKey)

func (*KeyGenMock) IsInterfaceNil

func (keyGen *KeyGenMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*KeyGenMock) PrivateKeyFromByteArray

func (keyGen *KeyGenMock) PrivateKeyFromByteArray(b []byte) (crypto.PrivateKey, error)

func (*KeyGenMock) PublicKeyFromByteArray

func (keyGen *KeyGenMock) PublicKeyFromByteArray(b []byte) (crypto.PublicKey, error)

func (*KeyGenMock) Suite

func (keyGen *KeyGenMock) Suite() crypto.Suite

type MiniBlocksResolverMock

type MiniBlocksResolverMock struct {
	RequestDataFromHashCalled      func(hash []byte) error
	RequestDataFromHashArrayCalled func(hashes [][]byte) error
	ProcessReceivedMessageCalled   func(message p2p.MessageP2P) error
	GetMiniBlocksCalled            func(hashes [][]byte) (block.MiniBlockSlice, [][]byte)
	GetMiniBlocksFromPoolCalled    func(hashes [][]byte) (block.MiniBlockSlice, [][]byte)
}

func (*MiniBlocksResolverMock) GetMiniBlocks

func (hrm *MiniBlocksResolverMock) GetMiniBlocks(hashes [][]byte) (block.MiniBlockSlice, [][]byte)

func (*MiniBlocksResolverMock) GetMiniBlocksFromPool

func (hrm *MiniBlocksResolverMock) GetMiniBlocksFromPool(hashes [][]byte) (block.MiniBlockSlice, [][]byte)

func (*MiniBlocksResolverMock) IsInterfaceNil

func (hrm *MiniBlocksResolverMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MiniBlocksResolverMock) ProcessReceivedMessage

func (hrm *MiniBlocksResolverMock) ProcessReceivedMessage(message p2p.MessageP2P) error

func (*MiniBlocksResolverMock) RequestDataFromHash

func (hrm *MiniBlocksResolverMock) RequestDataFromHash(hash []byte) error

func (*MiniBlocksResolverMock) RequestDataFromHashArray

func (hrm *MiniBlocksResolverMock) RequestDataFromHashArray(hashes [][]byte) error

type MockDB

type MockDB struct {
}

func (MockDB) Close

func (MockDB) Close() error

func (MockDB) Destroy

func (MockDB) Destroy() error

func (MockDB) Get

func (MockDB) Get(key []byte) ([]byte, error)

func (MockDB) Has

func (MockDB) Has(key []byte) error

func (MockDB) Init

func (MockDB) Init() error

func (MockDB) IsInterfaceNil

func (s MockDB) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (MockDB) Put

func (MockDB) Put(key, val []byte) error

func (MockDB) Remove

func (MockDB) Remove(key []byte) error

type NodesCoordinatorMock

type NodesCoordinatorMock struct {
	ComputeValidatorsGroupCalled        func(randomness []byte, round uint64, shardId uint32) ([]sharding.Validator, error)
	GetValidatorsPublicKeysCalled       func(randomness []byte, round uint64, shardId uint32) ([]string, error)
	GetValidatorsRewardsAddressesCalled func(randomness []byte, round uint64, shardId uint32) ([]string, error)
}

func (*NodesCoordinatorMock) ComputeValidatorsGroup added in v1.0.20

func (ncm *NodesCoordinatorMock) ComputeValidatorsGroup(
	randomness []byte,
	round uint64,
	shardId uint32,
) (validatorsGroup []sharding.Validator, err error)

func (*NodesCoordinatorMock) GetAllValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetAllValidatorsPublicKeys() map[uint32][][]byte

func (*NodesCoordinatorMock) GetOwnPublicKey

func (ncm *NodesCoordinatorMock) GetOwnPublicKey() []byte

func (*NodesCoordinatorMock) GetSelectedPublicKeys

func (ncm *NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte, shardId uint32) (publicKeys []string, err error)

func (*NodesCoordinatorMock) GetValidatorWithPublicKey

func (ncm *NodesCoordinatorMock) GetValidatorWithPublicKey(publicKey []byte) (sharding.Validator, uint32, error)

func (*NodesCoordinatorMock) GetValidatorsIndexes

func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(publicKeys []string) []uint64

func (*NodesCoordinatorMock) GetValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsPublicKeys(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

func (*NodesCoordinatorMock) GetValidatorsRewardsAddresses added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsRewardsAddresses(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

func (*NodesCoordinatorMock) IsInterfaceNil

func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodesCoordinatorMock) SetNodesPerShards

func (ncm *NodesCoordinatorMock) SetNodesPerShards(map[uint32][]sharding.Validator) error

type OneSCExecutorMockVM

type OneSCExecutorMockVM struct {
	GasForOperation uint64
	// contains filtered or unexported fields
}

OneSCExecutorMockVM contains one hardcoded SC with the following behaviour (written in golang): ------------------------------------- var a int

func init(initial int){
    a = initial
}
func Add(value int){
    a += value
}
func Get() int{
    return a
}

-------------------------------------

func NewOneSCExecutorMockVM

func NewOneSCExecutorMockVM(blockchainHook vmcommon.BlockchainHook, hasher hashing.Hasher) (*OneSCExecutorMockVM, error)

func (*OneSCExecutorMockVM) G0Call added in v1.0.3

func (vm *OneSCExecutorMockVM) G0Call(input *vmcommon.ContractCallInput) (*big.Int, error)

func (*OneSCExecutorMockVM) G0Create added in v1.0.3

func (vm *OneSCExecutorMockVM) G0Create(input *vmcommon.ContractCreateInput) (*big.Int, error)

func (*OneSCExecutorMockVM) RunSmartContractCall

func (vm *OneSCExecutorMockVM) RunSmartContractCall(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

func (*OneSCExecutorMockVM) RunSmartContractCreate

func (vm *OneSCExecutorMockVM) RunSmartContractCreate(input *vmcommon.ContractCreateInput) (*vmcommon.VMOutput, error)

type PoolsHolderStub

type PoolsHolderStub struct {
	HeadersCalled              func() storage.Cacher
	HeadersNoncesCalled        func() dataRetriever.Uint64SyncMapCacher
	PeerChangesBlocksCalled    func() storage.Cacher
	TransactionsCalled         func() dataRetriever.ShardedDataCacherNotifier
	UnsignedTransactionsCalled func() dataRetriever.ShardedDataCacherNotifier
	MiniBlocksCalled           func() storage.Cacher
	MetaBlocksCalled           func() storage.Cacher
}

func (*PoolsHolderStub) Headers

func (phs *PoolsHolderStub) Headers() storage.Cacher

func (*PoolsHolderStub) HeadersNonces added in v1.0.12

func (phs *PoolsHolderStub) HeadersNonces() dataRetriever.Uint64SyncMapCacher

func (*PoolsHolderStub) IsInterfaceNil

func (phs *PoolsHolderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PoolsHolderStub) MetaBlocks added in v1.0.12

func (phs *PoolsHolderStub) MetaBlocks() storage.Cacher

func (*PoolsHolderStub) MiniBlocks

func (phs *PoolsHolderStub) MiniBlocks() storage.Cacher

func (*PoolsHolderStub) PeerChangesBlocks

func (phs *PoolsHolderStub) PeerChangesBlocks() storage.Cacher

func (*PoolsHolderStub) Transactions

func (*PoolsHolderStub) UnsignedTransactions

func (phs *PoolsHolderStub) UnsignedTransactions() dataRetriever.ShardedDataCacherNotifier

type PrivateKeyMock

type PrivateKeyMock struct {
}

func (*PrivateKeyMock) GeneratePublic

func (sk *PrivateKeyMock) GeneratePublic() crypto.PublicKey

func (*PrivateKeyMock) IsInterfaceNil

func (sk *PrivateKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PrivateKeyMock) Scalar

func (sk *PrivateKeyMock) Scalar() crypto.Scalar

func (*PrivateKeyMock) Suite

func (sk *PrivateKeyMock) Suite() crypto.Suite

func (*PrivateKeyMock) ToByteArray

func (sk *PrivateKeyMock) ToByteArray() ([]byte, error)

type PublicKeyMock

type PublicKeyMock struct {
}

func (*PublicKeyMock) IsInterfaceNil

func (sspk *PublicKeyMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PublicKeyMock) Point

func (sspk *PublicKeyMock) Point() crypto.Point

func (*PublicKeyMock) Suite

func (sspk *PublicKeyMock) Suite() crypto.Suite

func (*PublicKeyMock) ToByteArray

func (sspk *PublicKeyMock) ToByteArray() ([]byte, error)

type ResolversContainerStub

type ResolversContainerStub struct {
	GetCalled     func(key string) (dataRetriever.Resolver, error)
	AddCalled     func(key string, val dataRetriever.Resolver) error
	ReplaceCalled func(key string, val dataRetriever.Resolver) error
	RemoveCalled  func(key string)
	LenCalled     func() int
}

func (*ResolversContainerStub) Add

func (*ResolversContainerStub) AddMultiple

func (rcs *ResolversContainerStub) AddMultiple(keys []string, resolvers []dataRetriever.Resolver) error

func (*ResolversContainerStub) Get

func (*ResolversContainerStub) IsInterfaceNil

func (rcs *ResolversContainerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ResolversContainerStub) Len

func (rcs *ResolversContainerStub) Len() int

func (*ResolversContainerStub) Remove

func (rcs *ResolversContainerStub) Remove(key string)

func (*ResolversContainerStub) Replace

func (rcs *ResolversContainerStub) Replace(key string, val dataRetriever.Resolver) error

type ResolversFinderStub

type ResolversFinderStub struct {
	ResolversContainerStub
	IntraShardResolverCalled func(baseTopic string) (dataRetriever.Resolver, error)
	MetaChainResolverCalled  func(baseTopic string) (dataRetriever.Resolver, error)
	CrossShardResolverCalled func(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)
}

func (*ResolversFinderStub) CrossShardResolver

func (rfs *ResolversFinderStub) CrossShardResolver(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)

func (*ResolversFinderStub) IntraShardResolver

func (rfs *ResolversFinderStub) IntraShardResolver(baseTopic string) (dataRetriever.Resolver, error)

func (*ResolversFinderStub) MetaChainResolver

func (rfs *ResolversFinderStub) MetaChainResolver(baseTopic string) (dataRetriever.Resolver, error)

type RounderMock

type RounderMock struct {
	IndexField         int64
	TimeStampField     time.Time
	TimeDurationField  time.Duration
	RemainingTimeField time.Duration
}

func (*RounderMock) Index

func (rm *RounderMock) Index() int64

func (*RounderMock) IsInterfaceNil

func (rm *RounderMock) IsInterfaceNil() bool

func (*RounderMock) RemainingTime

func (rm *RounderMock) RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration

func (*RounderMock) TimeDuration

func (rm *RounderMock) TimeDuration() time.Duration

func (*RounderMock) TimeStamp

func (rm *RounderMock) TimeStamp() time.Time

func (*RounderMock) UpdateRound

func (rm *RounderMock) UpdateRound(time.Time, time.Time)

type SCProcessorMock

type SCProcessorMock struct {
	ComputeTransactionTypeCalled          func(tx *transaction.Transaction) (process.TransactionType, error)
	ExecuteSmartContractTransactionCalled func(tx *transaction.Transaction, acntSrc, acntDst state.AccountHandler, round uint64) error
	DeploySmartContractCalled             func(tx *transaction.Transaction, acntSrc state.AccountHandler, round uint64) error
	ProcessSmartContractResultCalled      func(scr *smartContractResult.SmartContractResult) error
}

func (*SCProcessorMock) ComputeTransactionType

func (sc *SCProcessorMock) ComputeTransactionType(
	tx *transaction.Transaction,
) (process.TransactionType, error)

func (*SCProcessorMock) DeploySmartContract

func (sc *SCProcessorMock) DeploySmartContract(
	tx *transaction.Transaction,
	acntSrc state.AccountHandler,
	round uint64,
) error

func (*SCProcessorMock) ExecuteSmartContractTransaction

func (sc *SCProcessorMock) ExecuteSmartContractTransaction(
	tx *transaction.Transaction,
	acntSrc, acntDst state.AccountHandler,
	round uint64,
) error

func (*SCProcessorMock) IsInterfaceNil

func (sc *SCProcessorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SCProcessorMock) ProcessSmartContractResult

func (sc *SCProcessorMock) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error

type ServiceContainerMock

type ServiceContainerMock struct {
	IndexerCalled      func() indexer.Indexer
	TPSBenchmarkCalled func() statistics.TPSBenchmark
}

ServiceContainerMock is a mock implementation of the Core interface

func (*ServiceContainerMock) Indexer

func (scm *ServiceContainerMock) Indexer() indexer.Indexer

Indexer returns a mock implementation for core.Indexer

func (*ServiceContainerMock) IsInterfaceNil

func (scm *ServiceContainerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ServiceContainerMock) TPSBenchmark

func (scm *ServiceContainerMock) TPSBenchmark() statistics.TPSBenchmark

TPSBenchmark returns a mock implementation for core.TPSBenchmark

type ShardedDataStub

type ShardedDataStub struct {
	RegisterHandlerCalled         func(func(key []byte))
	ShardDataStoreCalled          func(cacheId string) (c storage.Cacher)
	AddDataCalled                 func(key []byte, data interface{}, cacheId string)
	SearchFirstDataCalled         func(key []byte) (value interface{}, ok bool)
	RemoveDataCalled              func(key []byte, cacheId string)
	RemoveDataFromAllShardsCalled func(key []byte)
	MergeShardStoresCalled        func(sourceCacheId, destCacheId string)
	MoveDataCalled                func(sourceCacheId, destCacheId string, key [][]byte)
	ClearCalled                   func()
	ClearShardStoreCalled         func(cacheId string)
	RemoveSetOfDataFromPoolCalled func(keys [][]byte, destCacheId string)
	CreateShardStoreCalled        func(destCacheId string)
}

func (*ShardedDataStub) AddData

func (sd *ShardedDataStub) AddData(key []byte, data interface{}, cacheId string)

func (*ShardedDataStub) Clear

func (sd *ShardedDataStub) Clear()

func (*ShardedDataStub) ClearShardStore

func (sd *ShardedDataStub) ClearShardStore(cacheId string)

func (*ShardedDataStub) CreateShardStore

func (sd *ShardedDataStub) CreateShardStore(cacheId string)

func (*ShardedDataStub) IsInterfaceNil

func (sd *ShardedDataStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardedDataStub) MergeShardStores

func (sd *ShardedDataStub) MergeShardStores(sourceCacheId, destCacheId string)

func (*ShardedDataStub) MoveData added in v1.0.3

func (sd *ShardedDataStub) MoveData(sourceCacheId, destCacheId string, key [][]byte)

func (*ShardedDataStub) RegisterHandler

func (sd *ShardedDataStub) RegisterHandler(handler func(key []byte))

func (*ShardedDataStub) RemoveData

func (sd *ShardedDataStub) RemoveData(key []byte, cacheId string)

func (*ShardedDataStub) RemoveDataFromAllShards

func (sd *ShardedDataStub) RemoveDataFromAllShards(key []byte)

func (*ShardedDataStub) RemoveSetOfDataFromPool

func (sd *ShardedDataStub) RemoveSetOfDataFromPool(keys [][]byte, cacheId string)

func (*ShardedDataStub) SearchFirstData

func (sd *ShardedDataStub) SearchFirstData(key []byte) (value interface{}, ok bool)

func (*ShardedDataStub) ShardDataStore

func (sd *ShardedDataStub) ShardDataStore(cacheId string) (c storage.Cacher)

type SmartContractResultsProcessorMock

type SmartContractResultsProcessorMock struct {
	ProcessSmartContractResultCalled func(scr *smartContractResult.SmartContractResult) error
}

func (*SmartContractResultsProcessorMock) IsInterfaceNil

func (scrp *SmartContractResultsProcessorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SmartContractResultsProcessorMock) ProcessSmartContractResult

func (scrp *SmartContractResultsProcessorMock) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error

type SpecialAddressHandlerMock added in v1.0.20

type SpecialAddressHandlerMock struct {
	ElrondCommunityAddressCalled func() []byte
	LeaderAddressCalled          func() []byte
	BurnAddressCalled            func() []byte
	ShardIdForAddressCalled      func([]byte) (uint32, error)
	AdrConv                      state.AddressConverter
	ShardCoordinator             sharding.Coordinator
	NodesCoordinator             sharding.NodesCoordinator
	// contains filtered or unexported fields
}

func NewSpecialAddressHandlerMock added in v1.0.20

func NewSpecialAddressHandlerMock(
	addrConv state.AddressConverter,
	shardCoordinator sharding.Coordinator,
	nodesCoordinator sharding.NodesCoordinator,
) *SpecialAddressHandlerMock

func (*SpecialAddressHandlerMock) BurnAddress added in v1.0.20

func (sh *SpecialAddressHandlerMock) BurnAddress() []byte

func (*SpecialAddressHandlerMock) ClearMetaConsensusData added in v1.0.20

func (sh *SpecialAddressHandlerMock) ClearMetaConsensusData()

func (*SpecialAddressHandlerMock) ConsensusMetaRewardData added in v1.0.20

func (sh *SpecialAddressHandlerMock) ConsensusMetaRewardData() []*data.ConsensusRewardData

func (*SpecialAddressHandlerMock) ConsensusShardRewardData added in v1.0.20

func (sh *SpecialAddressHandlerMock) ConsensusShardRewardData() *data.ConsensusRewardData

func (*SpecialAddressHandlerMock) ElrondCommunityAddress added in v1.0.20

func (sh *SpecialAddressHandlerMock) ElrondCommunityAddress() []byte

func (*SpecialAddressHandlerMock) Epoch added in v1.0.20

func (sh *SpecialAddressHandlerMock) Epoch() uint32

func (*SpecialAddressHandlerMock) IsCurrentNodeInConsensus added in v1.0.28

func (sh *SpecialAddressHandlerMock) IsCurrentNodeInConsensus() bool

IsCurrentNodeInConsensus calculate if current node was in consensus group

func (*SpecialAddressHandlerMock) IsInterfaceNil added in v1.0.20

func (sh *SpecialAddressHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SpecialAddressHandlerMock) LeaderAddress added in v1.0.20

func (sh *SpecialAddressHandlerMock) LeaderAddress() []byte

func (*SpecialAddressHandlerMock) NumConsensusParticipantMeta added in v1.0.28

func (sh *SpecialAddressHandlerMock) NumConsensusParticipantMeta() uint64

func (*SpecialAddressHandlerMock) Round added in v1.0.20

func (sh *SpecialAddressHandlerMock) Round() uint64

func (*SpecialAddressHandlerMock) SetElrondCommunityAddress added in v1.0.20

func (sh *SpecialAddressHandlerMock) SetElrondCommunityAddress(elrond []byte)

func (*SpecialAddressHandlerMock) SetMetaConsensusData added in v1.0.20

func (sh *SpecialAddressHandlerMock) SetMetaConsensusData(randomness []byte, round uint64, epoch uint32) error

func (*SpecialAddressHandlerMock) SetShardConsensusData added in v1.0.20

func (sh *SpecialAddressHandlerMock) SetShardConsensusData(randomness []byte, round uint64, epoch uint32, shardId uint32) error

func (*SpecialAddressHandlerMock) ShardIdForAddress added in v1.0.20

func (sh *SpecialAddressHandlerMock) ShardIdForAddress(addr []byte) (uint32, error)

type SyncTimerMock

type SyncTimerMock struct {
	ClockOffsetCalled func() time.Duration
	CurrentTimeCalled func() time.Time
}

SyncTimerMock mocks the implementation for a SyncTimer

func (*SyncTimerMock) ClockOffset

func (stm *SyncTimerMock) ClockOffset() time.Duration

ClockOffset method gets the current time offset

func (*SyncTimerMock) CurrentTime

func (stm *SyncTimerMock) CurrentTime() time.Time

CurrentTime method gets the current time on which is added the current offset

func (*SyncTimerMock) FormattedCurrentTime

func (stm *SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime method gets the formatted current time on which is added a given offset

func (*SyncTimerMock) IsInterfaceNil

func (stm *SyncTimerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncTimerMock) StartSync

func (stm *SyncTimerMock) StartSync()

StartSync method does the time synchronization at every syncPeriod time elapsed. This should be started as a go routine

type TxPoolsCleanerMock

type TxPoolsCleanerMock struct {
	CleanCalled         func(duration time.Duration) (bool, error)
	NumRemovedTxsCalled func() uint64
}

func (*TxPoolsCleanerMock) Clean

func (tpc *TxPoolsCleanerMock) Clean(duration time.Duration) (bool, error)

Clean will check if in pools exits transactions with nonce low that transaction sender account nonce and if tx have low nonce will be removed from pools

func (*TxPoolsCleanerMock) IsInterfaceNil

func (tpc *TxPoolsCleanerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TxPoolsCleanerMock) NumRemovedTxs

func (tpc *TxPoolsCleanerMock) NumRemovedTxs() uint64

NumRemovedTxs will return the number of removed txs from pools

type TxProcessorMock

type TxProcessorMock struct {
	ProcessTransactionCalled         func(transaction *transaction.Transaction, round uint64) error
	SetBalancesToTrieCalled          func(accBalance map[string]*big.Int) (rootHash []byte, err error)
	ProcessSmartContractResultCalled func(scr *smartContractResult.SmartContractResult) error
}

func (*TxProcessorMock) IsInterfaceNil

func (etm *TxProcessorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TxProcessorMock) ProcessSmartContractResult

func (etm *TxProcessorMock) ProcessSmartContractResult(scr *smartContractResult.SmartContractResult) error

func (*TxProcessorMock) ProcessTransaction

func (etm *TxProcessorMock) ProcessTransaction(transaction *transaction.Transaction, round uint64) error

func (*TxProcessorMock) SetBalancesToTrie

func (etm *TxProcessorMock) SetBalancesToTrie(accBalance map[string]*big.Int) (rootHash []byte, err error)

type TxTypeHandlerMock

type TxTypeHandlerMock struct {
	ComputeTransactionTypeCalled func(tx data.TransactionHandler) (process.TransactionType, error)
}

func (*TxTypeHandlerMock) ComputeTransactionType

func (th *TxTypeHandlerMock) ComputeTransactionType(tx data.TransactionHandler) (process.TransactionType, error)

func (*TxTypeHandlerMock) IsInterfaceNil

func (th *TxTypeHandlerMock) IsInterfaceNil() bool

type UnsignedTxHandlerMock

type UnsignedTxHandlerMock struct {
	CleanProcessedUtxsCalled    func()
	ProcessTransactionFeeCalled func(cost *big.Int)
	CreateAllUTxsCalled         func() []data.TransactionHandler
	VerifyCreatedUTxsCalled     func() error
	AddTxFeeFromBlockCalled     func(tx data.TransactionHandler)
}

func (*UnsignedTxHandlerMock) AddRewardTxFromBlock

func (ut *UnsignedTxHandlerMock) AddRewardTxFromBlock(tx data.TransactionHandler)

func (*UnsignedTxHandlerMock) CleanProcessedUTxs

func (ut *UnsignedTxHandlerMock) CleanProcessedUTxs()

func (*UnsignedTxHandlerMock) CreateAllUTxs

func (ut *UnsignedTxHandlerMock) CreateAllUTxs() []data.TransactionHandler

func (*UnsignedTxHandlerMock) IsInterfaceNil

func (ut *UnsignedTxHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*UnsignedTxHandlerMock) ProcessTransactionFee

func (ut *UnsignedTxHandlerMock) ProcessTransactionFee(cost *big.Int)

func (*UnsignedTxHandlerMock) VerifyCreatedUTxs

func (ut *UnsignedTxHandlerMock) VerifyCreatedUTxs() error

type VMContainerMock

type VMContainerMock struct {
	GetCalled         func(key []byte) (vmcommon.VMExecutionHandler, error)
	AddCalled         func(key []byte, val vmcommon.VMExecutionHandler) error
	AddMultipleCalled func(keys [][]byte, preprocessors []vmcommon.VMExecutionHandler) error
	ReplaceCalled     func(key []byte, val vmcommon.VMExecutionHandler) error
	RemoveCalled      func(key []byte)
	LenCalled         func() int
	KeysCalled        func() [][]byte
}

func (*VMContainerMock) Add

func (*VMContainerMock) AddMultiple

func (V *VMContainerMock) AddMultiple(keys [][]byte, vms []vmcommon.VMExecutionHandler) error

func (*VMContainerMock) Get

func (*VMContainerMock) IsInterfaceNil

func (V *VMContainerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*VMContainerMock) Keys

func (V *VMContainerMock) Keys() [][]byte

func (*VMContainerMock) Len

func (V *VMContainerMock) Len() int

func (*VMContainerMock) Remove

func (V *VMContainerMock) Remove(key []byte)

func (*VMContainerMock) Replace

func (V *VMContainerMock) Replace(key []byte, val vmcommon.VMExecutionHandler) error

type VMExecutionHandlerStub

type VMExecutionHandlerStub struct {
	G0CreateCalled               func(input *vmcommon.ContractCreateInput) (*big.Int, error)
	G0CallCalled                 func(input *vmcommon.ContractCallInput) (*big.Int, error)
	RunSmartContractCreateCalled func(input *vmcommon.ContractCreateInput) (*vmcommon.VMOutput, error)
	RunSmartContractCallCalled   func(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
}

func (*VMExecutionHandlerStub) G0Call

func (vm *VMExecutionHandlerStub) G0Call(input *vmcommon.ContractCallInput) (*big.Int, error)

G0Call yields the initial gas cost of calling an existing smart contract

func (*VMExecutionHandlerStub) G0Create

func (vm *VMExecutionHandlerStub) G0Create(input *vmcommon.ContractCreateInput) (*big.Int, error)

G0Create yields the initial gas cost of creating a new smart contract

func (*VMExecutionHandlerStub) RunSmartContractCall

func (vm *VMExecutionHandlerStub) RunSmartContractCall(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

RunSmartContractCall Computes the result of a smart contract call and how the system must change after the execution

func (*VMExecutionHandlerStub) RunSmartContractCreate

func (vm *VMExecutionHandlerStub) RunSmartContractCreate(input *vmcommon.ContractCreateInput) (*vmcommon.VMOutput, error)

Computes how a smart contract creation should be performed

Jump to

Keyboard shortcuts

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