mock

package
v1.0.56 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: GPL-3.0 Imports: 26 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 BlackListHandlerStub

type BlackListHandlerStub struct {
	AddCalled   func(key string) error
	HasCalled   func(key string) bool
	SweepCalled func()
}

func (*BlackListHandlerStub) Add

func (blhs *BlackListHandlerStub) Add(key string) error

func (*BlackListHandlerStub) Has

func (blhs *BlackListHandlerStub) Has(key string) bool

func (*BlackListHandlerStub) IsInterfaceNil

func (blhs *BlackListHandlerStub) IsInterfaceNil() bool

func (*BlackListHandlerStub) Sweep

func (blhs *BlackListHandlerStub) Sweep()

type BlockChainHookHandlerMock

type BlockChainHookHandlerMock struct {
	AddTempAccountCalled    func(address []byte, balance *big.Int, nonce uint64)
	CleanTempAccountsCalled func()
	TempAccountCalled       func(address []byte) state.AccountHandler
	SetCurrentHeaderCalled  func(hdr data.HeaderHandler)
}

func (*BlockChainHookHandlerMock) AddTempAccount

func (e *BlockChainHookHandlerMock) AddTempAccount(address []byte, balance *big.Int, nonce uint64)

func (*BlockChainHookHandlerMock) CleanTempAccounts

func (e *BlockChainHookHandlerMock) CleanTempAccounts()

func (*BlockChainHookHandlerMock) IsInterfaceNil

func (e *BlockChainHookHandlerMock) IsInterfaceNil() bool

func (*BlockChainHookHandlerMock) SetCurrentHeader

func (e *BlockChainHookHandlerMock) SetCurrentHeader(hdr data.HeaderHandler)

func (*BlockChainHookHandlerMock) TempAccount

func (e *BlockChainHookHandlerMock) TempAccount(address []byte) state.AccountHandler

type BlockChainMock

type BlockChainMock struct {
	GetGenesisHeaderCalled          func() data.HeaderHandler
	SetGenesisHeaderCalled          func(handler data.HeaderHandler) error
	GetGenesisHeaderHashCalled      func() []byte
	SetGenesisHeaderHashCalled      func([]byte)
	GetCurrentBlockHeaderCalled     func() data.HeaderHandler
	SetCurrentBlockHeaderCalled     func(data.HeaderHandler) error
	GetCurrentBlockHeaderHashCalled func() []byte
	SetCurrentBlockHeaderHashCalled func([]byte)
	GetCurrentBlockBodyCalled       func() data.BodyHandler
	SetCurrentBlockBodyCalled       func(data.BodyHandler) error
	GetLocalHeightCalled            func() int64
	SetLocalHeightCalled            func(int64)
	GetNetworkHeightCalled          func() int64
	SetNetworkHeightCalled          func(int64)
	HasBadBlockCalled               func([]byte) bool
	PutBadBlockCalled               func([]byte)
}

BlockChainMock is a mock implementation of the blockchain interface

func (*BlockChainMock) GetCurrentBlockBody

func (bc *BlockChainMock) GetCurrentBlockBody() data.BodyHandler

GetCurrentBlockBody returns the tx block body pointer

func (*BlockChainMock) GetCurrentBlockHeader

func (bc *BlockChainMock) GetCurrentBlockHeader() data.HeaderHandler

GetCurrentBlockHeader returns current block header pointer

func (*BlockChainMock) GetCurrentBlockHeaderHash

func (bc *BlockChainMock) GetCurrentBlockHeaderHash() []byte

GetCurrentBlockHeaderHash returns the current block header hash

func (*BlockChainMock) GetGenesisHeader

func (bc *BlockChainMock) GetGenesisHeader() data.HeaderHandler

GetGenesisHeader returns the genesis block header pointer

func (*BlockChainMock) GetGenesisHeaderHash

func (bc *BlockChainMock) GetGenesisHeaderHash() []byte

GetGenesisHeaderHash returns the genesis block header hash

func (*BlockChainMock) GetLocalHeight added in v1.0.39

func (bc *BlockChainMock) GetLocalHeight() int64

GetLocalHeight returns the height of the local chain

func (*BlockChainMock) GetNetworkHeight added in v1.0.39

func (bc *BlockChainMock) GetNetworkHeight() int64

GetNetworkHeight sets the perceived height of the network chain

func (*BlockChainMock) HasBadBlock added in v1.0.39

func (bc *BlockChainMock) HasBadBlock(blockHash []byte) bool

HasBadBlock returns true if the provided hash is blacklisted as a bad block, or false otherwise

func (*BlockChainMock) IsInterfaceNil

func (bc *BlockChainMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BlockChainMock) PutBadBlock added in v1.0.39

func (bc *BlockChainMock) PutBadBlock(blockHash []byte)

PutBadBlock adds the given serialized block to the bad block cache, blacklisting it

func (*BlockChainMock) SetCurrentBlockBody

func (bc *BlockChainMock) SetCurrentBlockBody(body data.BodyHandler) error

SetCurrentBlockBody sets the tx block body pointer

func (*BlockChainMock) SetCurrentBlockHeader

func (bc *BlockChainMock) SetCurrentBlockHeader(header data.HeaderHandler) error

SetCurrentBlockHeader sets current block header pointer

func (*BlockChainMock) SetCurrentBlockHeaderHash

func (bc *BlockChainMock) SetCurrentBlockHeaderHash(hash []byte)

SetCurrentBlockHeaderHash returns the current block header hash

func (*BlockChainMock) SetGenesisHeader

func (bc *BlockChainMock) SetGenesisHeader(genesisBlock data.HeaderHandler) error

SetGenesisHeader sets the genesis block header pointer

func (*BlockChainMock) SetGenesisHeaderHash

func (bc *BlockChainMock) SetGenesisHeaderHash(hash []byte)

SetGenesisHeaderHash sets the genesis block header hash

func (*BlockChainMock) SetLocalHeight added in v1.0.39

func (bc *BlockChainMock) SetLocalHeight(height int64)

SetLocalHeight sets the height of the local chain

func (*BlockChainMock) SetNetworkHeight added in v1.0.39

func (bc *BlockChainMock) SetNetworkHeight(height int64)

SetNetworkHeight sets the perceived height of the network chain

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(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)
	RestoreBlockIntoPoolsCalled             func(header data.HeaderHandler, body data.BodyHandler) error
	ApplyBodyToHeaderCalled                 func(header data.HeaderHandler, body data.BodyHandler) 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)
	CreateNewHeaderCalled                   func() data.HeaderHandler
	RevertStateToBlockCalled                func(header data.HeaderHandler) error
	RestoreLastNotarizedHrdsToGenesisCalled func()
}

BlockProcessorMock mocks the implementation for a blockProcessor

func (BlockProcessorMock) AddLastNotarizedHdr

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

func (BlockProcessorMock) ApplyBodyToHeader added in v1.0.39

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

func (*BlockProcessorMock) ApplyProcessedMiniBlocks

func (blProcMock *BlockProcessorMock) ApplyProcessedMiniBlocks(miniBlocks map[string]map[string]struct{})

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(initialHdrData data.HeaderHandler, haveTime func() bool) (data.BodyHandler, error)

CreateTxBlockBody mocks the creation of a transaction block body

func (*BlockProcessorMock) CreateNewHeader

func (blProcMock *BlockProcessorMock) CreateNewHeader() data.HeaderHandler

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

func (blProcMock *BlockProcessorMock) RestoreLastNotarizedHrdsToGenesis()

func (*BlockProcessorMock) RevertAccountState

func (blProcMock *BlockProcessorMock) RevertAccountState()

RevertAccountState mocks revert of the accounts state

func (*BlockProcessorMock) RevertStateToBlock

func (blProcMock *BlockProcessorMock) RevertStateToBlock(header data.HeaderHandler) error

RevertStateToBlock recreates the state tries to the root hashes indicated by the provided header

func (BlockProcessorMock) SetConsensusData added in v1.0.20

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

type BoostrapStorerMock

type BoostrapStorerMock struct {
	PutCalled             func(round int64, bootData bootstrapStorage.BootstrapData) error
	GetCalled             func(round int64) (bootstrapStorage.BootstrapData, error)
	GetHighestRoundCalled func() int64
}

func (*BoostrapStorerMock) Get

func (*BoostrapStorerMock) GetHighestRound

func (bsm *BoostrapStorerMock) GetHighestRound() int64

func (*BoostrapStorerMock) IsInterfaceNil

func (bsm *BoostrapStorerMock) IsInterfaceNil() bool

func (*BoostrapStorerMock) Put

func (bsm *BoostrapStorerMock) Put(round int64, bootData bootstrapStorage.BootstrapData) error

func (*BoostrapStorerMock) SaveLastRound

func (bsm *BoostrapStorerMock) SaveLastRound(round int64) error

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 ChainStorerMock

type ChainStorerMock struct {
	AddStorerCalled func(key dataRetriever.UnitType, s storage.Storer)
	GetStorerCalled func(unitType dataRetriever.UnitType) storage.Storer
	HasCalled       func(unitType dataRetriever.UnitType, key []byte) error
	GetCalled       func(unitType dataRetriever.UnitType, key []byte) ([]byte, error)
	PutCalled       func(unitType dataRetriever.UnitType, key []byte, value []byte) error
	GetAllCalled    func(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)
	DestroyCalled   func() error
}

ChainStorerMock is a mock implementation of the ChianStorer interface

func (*ChainStorerMock) AddStorer

func (bc *ChainStorerMock) AddStorer(key dataRetriever.UnitType, s storage.Storer)

AddStorer will add a new storer to the chain map

func (*ChainStorerMock) Destroy

func (bc *ChainStorerMock) Destroy() error

Destroy removes the underlying files/resources used by the storage service

func (*ChainStorerMock) Get

func (bc *ChainStorerMock) Get(unitType dataRetriever.UnitType, key []byte) ([]byte, error)

Get returns the value for the given key if found in the selected storage unit, nil otherwise. It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorerMock) GetAll

func (bc *ChainStorerMock) GetAll(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)

GetAll gets all the elements with keys in the keys array, from the selected storage unit It can report an error if the provided unit type is not supported, if there is a missing key in the unit, or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) GetStorer

func (bc *ChainStorerMock) GetStorer(unitType dataRetriever.UnitType) storage.Storer

GetStorer returns the storer from the chain map or nil if the storer was not found

func (*ChainStorerMock) Has

func (bc *ChainStorerMock) Has(unitType dataRetriever.UnitType, key []byte) error

Has returns true if the key is found in the selected Unit or false otherwise It can return an error if the provided unit type is not supported or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) IsInterfaceNil

func (bc *ChainStorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChainStorerMock) Put

func (bc *ChainStorerMock) Put(unitType dataRetriever.UnitType, key []byte, value []byte) error

Put stores the key, value pair in the selected storage unit It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

type FeeHandlerStub

type FeeHandlerStub struct {
	SetMaxGasLimitPerBlockCalled func(maxGasLimitPerBlock uint64)
	SetMinGasPriceCalled         func(minGasPrice uint64)
	SetMinGasLimitCalled         func(minGasLimit uint64)
	MaxGasLimitPerBlockCalled    func() 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) MaxGasLimitPerBlock

func (fhs *FeeHandlerStub) MaxGasLimitPerBlock() uint64

func (*FeeHandlerStub) SetMaxGasLimitPerBlock

func (fhs *FeeHandlerStub) SetMaxGasLimitPerBlock(maxGasLimitPerBlock uint64)

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, isNotarizedShardStuck bool) error
	RemoveHeadersCalled                   func(nonce uint64, hash []byte)
	CheckForkCalled                       func() *process.ForkInfo
	GetHighestFinalBlockNonceCalled       func() uint64
	ProbableHighestNonceCalled            func() uint64
	ResetProbableHighestNonceCalled       func()
	ResetForkCalled                       func()
	GetNotarizedHeaderHashCalled          func(nonce uint64) []byte
	RestoreFinalCheckPointToGenesisCalled 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, isNotarizedShardStuck bool) error

AddHeader is a mock implementation for AddHeader

func (*ForkDetectorMock) CheckFork

func (f *ForkDetectorMock) CheckFork() *process.ForkInfo

CheckFork is a mock implementation for CheckFork

func (*ForkDetectorMock) GetHighestFinalBlockNonce

func (f *ForkDetectorMock) GetHighestFinalBlockNonce() uint64

GetHighestFinalBlockNonce is a mock implementation for GetHighestFinalBlockNonce

func (*ForkDetectorMock) GetNotarizedHeaderHash

func (fdm *ForkDetectorMock) GetNotarizedHeaderHash(nonce uint64) []byte

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

func (fdm *ForkDetectorMock) ResetFork()

func (*ForkDetectorMock) ResetProbableHighestNonce

func (fdm *ForkDetectorMock) ResetProbableHighestNonce()

func (*ForkDetectorMock) RestoreFinalCheckPointToGenesis added in v1.0.41

func (f *ForkDetectorMock) RestoreFinalCheckPointToGenesis()

type GasHandlerMock

type GasHandlerMock struct {
	InitCalled                          func()
	SetGasConsumedCalled                func(gasConsumed uint64, hash []byte)
	SetGasRefundedCalled                func(gasRefunded uint64, hash []byte)
	GasConsumedCalled                   func(hash []byte) uint64
	GasRefundedCalled                   func(hash []byte) uint64
	TotalGasConsumedCalled              func() uint64
	TotalGasRefundedCalled              func() uint64
	RemoveGasConsumedCalled             func(hashes [][]byte)
	RemoveGasRefundedCalled             func(hashes [][]byte)
	ComputeGasConsumedByMiniBlockCalled func(miniBlock *block.MiniBlock, mapHashTx map[string]data.TransactionHandler) (uint64, uint64, error)
	ComputeGasConsumedByTxCalled        func(txSenderShardId uint32, txReceiverSharedId uint32, txHandler data.TransactionHandler) (uint64, uint64, error)
}

func (*GasHandlerMock) ComputeGasConsumedByMiniBlock

func (ghm *GasHandlerMock) ComputeGasConsumedByMiniBlock(miniBlock *block.MiniBlock, mapHashTx map[string]data.TransactionHandler) (uint64, uint64, error)

func (*GasHandlerMock) ComputeGasConsumedByTx

func (ghm *GasHandlerMock) ComputeGasConsumedByTx(txSenderShardId uint32, txReceiverShardId uint32, txHandler data.TransactionHandler) (uint64, uint64, error)

func (*GasHandlerMock) GasConsumed

func (ghm *GasHandlerMock) GasConsumed(hash []byte) uint64

func (*GasHandlerMock) GasRefunded

func (ghm *GasHandlerMock) GasRefunded(hash []byte) uint64

func (*GasHandlerMock) Init

func (ghm *GasHandlerMock) Init()

func (*GasHandlerMock) IsInterfaceNil

func (ghm *GasHandlerMock) IsInterfaceNil() bool

func (*GasHandlerMock) RemoveGasConsumed

func (ghm *GasHandlerMock) RemoveGasConsumed(hashes [][]byte)

func (*GasHandlerMock) RemoveGasRefunded

func (ghm *GasHandlerMock) RemoveGasRefunded(hashes [][]byte)

func (*GasHandlerMock) SetGasConsumed

func (ghm *GasHandlerMock) SetGasConsumed(gasConsumed uint64, hash []byte)

func (*GasHandlerMock) SetGasRefunded

func (ghm *GasHandlerMock) SetGasRefunded(gasRefunded uint64, hash []byte)

func (*GasHandlerMock) TotalGasConsumed

func (ghm *GasHandlerMock) TotalGasConsumed() uint64

func (*GasHandlerMock) TotalGasRefunded

func (ghm *GasHandlerMock) TotalGasRefunded() uint64

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, _ func(buffToSend []byte)) 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, _ func(buffToSend []byte)) 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 PeerChangesHandler

type PeerChangesHandler struct {
	PeerChangesCalled       func() []block.PeerData
	VerifyPeerChangesCalled func(peerChanges []block.PeerData) error
}

func (*PeerChangesHandler) IsInterfaceNil

func (p *PeerChangesHandler) IsInterfaceNil() bool

func (*PeerChangesHandler) PeerChanges

func (p *PeerChangesHandler) PeerChanges() []block.PeerData

func (*PeerChangesHandler) VerifyPeerChanges

func (p *PeerChangesHandler) VerifyPeerChanges(peerChanges []block.PeerData) 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 RequestedItemsHandlerStub

type RequestedItemsHandlerStub struct {
	AddCalled   func(key string) error
	HasCalled   func(key string) bool
	SweepCalled func()
}

func (*RequestedItemsHandlerStub) Add

func (rihs *RequestedItemsHandlerStub) Add(key string) error

func (*RequestedItemsHandlerStub) Has

func (rihs *RequestedItemsHandlerStub) Has(key string) bool

func (*RequestedItemsHandlerStub) IsInterfaceNil

func (rihs *RequestedItemsHandlerStub) IsInterfaceNil() bool

func (*RequestedItemsHandlerStub) Sweep

func (rihs *RequestedItemsHandlerStub) Sweep()

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 data.TransactionHandler) (process.TransactionType, error)
	ExecuteSmartContractTransactionCalled func(tx data.TransactionHandler, acntSrc, acntDst state.AccountHandler, round uint64) error
	DeploySmartContractCalled             func(tx data.TransactionHandler, acntSrc state.AccountHandler, round uint64) error
	ProcessSmartContractResultCalled      func(scr *smartContractResult.SmartContractResult) error
}

func (*SCProcessorMock) ComputeTransactionType

func (sc *SCProcessorMock) ComputeTransactionType(
	tx data.TransactionHandler,
) (process.TransactionType, error)

func (*SCProcessorMock) DeploySmartContract

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

func (*SCProcessorMock) ExecuteSmartContractTransaction

func (sc *SCProcessorMock) ExecuteSmartContractTransaction(
	tx data.TransactionHandler,
	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 SCToProtocolStub

type SCToProtocolStub struct {
	UpdateProtocolCalled func(body block.Body, nonce uint64) error
}

func (*SCToProtocolStub) IsInterfaceNil

func (s *SCToProtocolStub) IsInterfaceNil() bool

func (*SCToProtocolStub) UpdateProtocol

func (s *SCToProtocolStub) UpdateProtocol(body block.Body, nonce uint64) error

type ScQueryMock added in v1.0.41

type ScQueryMock struct {
	ExecuteQueryCalled func(query *process.SCQuery) (*vmcommon.VMOutput, error)
}

func (*ScQueryMock) ExecuteQuery added in v1.0.41

func (s *ScQueryMock) ExecuteQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

func (*ScQueryMock) IsInterfaceNil added in v1.0.41

func (s *ScQueryMock) IsInterfaceNil() bool

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 SignerMock

type SignerMock struct {
	SignStub   func(private crypto.PrivateKey, msg []byte) ([]byte, error)
	VerifyStub func(public crypto.PublicKey, msg []byte, sig []byte) error
}

func (*SignerMock) IsInterfaceNil

func (s *SignerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SignerMock) Sign

func (s *SignerMock) Sign(private crypto.PrivateKey, msg []byte) ([]byte, error)

func (*SignerMock) Verify

func (s *SignerMock) Verify(public crypto.PublicKey, msg []byte, sig []byte) error

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 StorageBootstrapperMock

type StorageBootstrapperMock struct {
	LoadFromStorageCalled func() error
}

func (*StorageBootstrapperMock) IsInterfaceNil

func (sbm *StorageBootstrapperMock) IsInterfaceNil() bool

func (*StorageBootstrapperMock) LoadFromStorage

func (sbm *StorageBootstrapperMock) LoadFromStorage() 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 TransactionCoordinatorMock

type TransactionCoordinatorMock struct {
	ComputeTransactionTypeCalled                         func(tx data.TransactionHandler) (process.TransactionType, error)
	RequestMiniBlocksCalled                              func(header data.HeaderHandler)
	RequestBlockTransactionsCalled                       func(body block.Body)
	IsDataPreparedForProcessingCalled                    func(haveTime func() time.Duration) error
	SaveBlockDataToStorageCalled                         func(body block.Body) error
	RestoreBlockDataFromStorageCalled                    func(body block.Body) (int, error)
	RemoveBlockDataFromPoolCalled                        func(body block.Body) error
	ProcessBlockTransactionCalled                        func(body block.Body, round uint64, haveTime func() time.Duration) error
	CreateBlockStartedCalled                             func()
	CreateMbsAndProcessCrossShardTransactionsDstMeCalled func(header data.HeaderHandler, processedMiniBlocksHashes map[string]struct{}, maxTxRemaining uint32, maxMbRemaining uint32, round uint64, haveTime func() bool) (block.MiniBlockSlice, uint32, bool)
	CreateMbsAndProcessTransactionsFromMeCalled          func(maxTxRemaining uint32, maxMbRemaining uint32, round uint64, haveTime func() bool) block.MiniBlockSlice
	CreateMarshalizedDataCalled                          func(body block.Body) (map[uint32]block.MiniBlockSlice, map[string][][]byte)
	GetAllCurrentUsedTxsCalled                           func(blockType block.Type) map[string]data.TransactionHandler
	VerifyCreatedBlockTransactionsCalled                 func(body block.Body) error
}

func (*TransactionCoordinatorMock) ComputeTransactionType

func (*TransactionCoordinatorMock) CreateBlockStarted

func (tcm *TransactionCoordinatorMock) CreateBlockStarted()

func (*TransactionCoordinatorMock) CreateMarshalizedData

func (tcm *TransactionCoordinatorMock) CreateMarshalizedData(body block.Body) (map[uint32]block.MiniBlockSlice, map[string][][]byte)

func (*TransactionCoordinatorMock) CreateMbsAndProcessCrossShardTransactionsDstMe

func (tcm *TransactionCoordinatorMock) CreateMbsAndProcessCrossShardTransactionsDstMe(header data.HeaderHandler, processedMiniBlocksHashes map[string]struct{}, maxTxRemaining uint32, maxMbRemaining uint32, round uint64, haveTime func() bool) (block.MiniBlockSlice, uint32, bool)

func (*TransactionCoordinatorMock) CreateMbsAndProcessTransactionsFromMe

func (tcm *TransactionCoordinatorMock) CreateMbsAndProcessTransactionsFromMe(maxTxRemaining uint32, maxMbRemaining uint32, round uint64, haveTime func() bool) block.MiniBlockSlice

func (*TransactionCoordinatorMock) GetAllCurrentUsedTxs

func (tcm *TransactionCoordinatorMock) GetAllCurrentUsedTxs(blockType block.Type) map[string]data.TransactionHandler

func (*TransactionCoordinatorMock) IsDataPreparedForProcessing

func (tcm *TransactionCoordinatorMock) IsDataPreparedForProcessing(haveTime func() time.Duration) error

func (*TransactionCoordinatorMock) IsInterfaceNil

func (tcm *TransactionCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TransactionCoordinatorMock) ProcessBlockTransaction

func (tcm *TransactionCoordinatorMock) ProcessBlockTransaction(body block.Body, round uint64, haveTime func() time.Duration) error

func (*TransactionCoordinatorMock) RemoveBlockDataFromPool

func (tcm *TransactionCoordinatorMock) RemoveBlockDataFromPool(body block.Body) error

func (*TransactionCoordinatorMock) RequestBlockTransactions

func (tcm *TransactionCoordinatorMock) RequestBlockTransactions(body block.Body)

func (*TransactionCoordinatorMock) RequestMiniBlocks

func (tcm *TransactionCoordinatorMock) RequestMiniBlocks(header data.HeaderHandler)

func (*TransactionCoordinatorMock) RestoreBlockDataFromStorage

func (tcm *TransactionCoordinatorMock) RestoreBlockDataFromStorage(body block.Body) (int, error)

func (*TransactionCoordinatorMock) SaveBlockDataToStorage

func (tcm *TransactionCoordinatorMock) SaveBlockDataToStorage(body block.Body) error

func (*TransactionCoordinatorMock) VerifyCreatedBlockTransactions

func (tcm *TransactionCoordinatorMock) VerifyCreatedBlockTransactions(body block.Body) error

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 Uint64ByteSliceConverterMock

type Uint64ByteSliceConverterMock struct {
	ToByteSliceCalled func(uint64) []byte
	ToUint64Called    func([]byte) (uint64, error)
}

Uint64ByteSliceConverterMock converts byte slice to/from uint64

func (*Uint64ByteSliceConverterMock) IsInterfaceNil

func (u *Uint64ByteSliceConverterMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Uint64ByteSliceConverterMock) ToByteSlice

func (u *Uint64ByteSliceConverterMock) ToByteSlice(p uint64) []byte

ToByteSlice is a mock implementation for Uint64ByteSliceConverter

func (*Uint64ByteSliceConverterMock) ToUint64

func (u *Uint64ByteSliceConverterMock) ToUint64(p []byte) (uint64, error)

ToUint64 is a mock implementation for Uint64ByteSliceConverter

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

type ValidatorMock

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

func NewValidatorMock

func NewValidatorMock(stake *big.Int, rating int32, pubKey []byte, address []byte) *ValidatorMock

func (*ValidatorMock) Address

func (vm *ValidatorMock) Address() []byte

func (*ValidatorMock) PubKey

func (vm *ValidatorMock) PubKey() []byte

func (*ValidatorMock) Rating added in v1.0.41

func (vm *ValidatorMock) Rating() int32

func (*ValidatorMock) Stake added in v1.0.41

func (vm *ValidatorMock) Stake() *big.Int

type ValidatorStatisticsProcessorMock added in v1.0.39

type ValidatorStatisticsProcessorMock struct {
	UpdatePeerStateCalled           func(header data.HeaderHandler) ([]byte, error)
	RevertPeerStateCalled           func(header data.HeaderHandler) error
	IsInterfaceNilCalled            func() bool
	RevertPeerStateToSnapshotCalled func(snapshot int) error
	CommitCalled                    func() ([]byte, error)
	RootHashCalled                  func() ([]byte, error)
}

func (*ValidatorStatisticsProcessorMock) Commit added in v1.0.39

func (vsp *ValidatorStatisticsProcessorMock) Commit() ([]byte, error)

func (*ValidatorStatisticsProcessorMock) IsInterfaceNil added in v1.0.39

func (vsp *ValidatorStatisticsProcessorMock) IsInterfaceNil() bool

func (*ValidatorStatisticsProcessorMock) RevertPeerState added in v1.0.39

func (vsp *ValidatorStatisticsProcessorMock) RevertPeerState(header data.HeaderHandler) error

func (*ValidatorStatisticsProcessorMock) RevertPeerStateToSnapshot added in v1.0.39

func (vsp *ValidatorStatisticsProcessorMock) RevertPeerStateToSnapshot(snapshot int) error

func (*ValidatorStatisticsProcessorMock) RootHash added in v1.0.41

func (vsp *ValidatorStatisticsProcessorMock) RootHash() ([]byte, error)

func (*ValidatorStatisticsProcessorMock) UpdatePeerState added in v1.0.39

func (vsp *ValidatorStatisticsProcessorMock) UpdatePeerState(header data.HeaderHandler) ([]byte, error)

Jump to

Keyboard shortcuts

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