mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountsStub added in v0.0.2

type AccountsStub struct {
	AddJournalEntryCalled    func(je state.JournalEntry)
	GetExistingAccountCalled func(addressContainer []byte) (state.AccountHandler, error)
	LoadAccountCalled        func(container []byte) (state.AccountHandler, error)
	SaveAccountCalled        func(account state.AccountHandler) error
	RemoveAccountCalled      func(addressContainer []byte) error
	CommitCalled             func() ([]byte, error)
	JournalLenCalled         func() int
	RevertToSnapshotCalled   func(snapshot int) error
	RootHashCalled           func() ([]byte, error)
	RecreateTrieCalled       func(rootHash []byte) error
	PruneTrieCalled          func(rootHash []byte, identifier data.TriePruningIdentifier)
	CancelPruneCalled        func(rootHash []byte, identifier data.TriePruningIdentifier)
	SnapshotStateCalled      func(rootHash []byte)
	SetStateCheckpointCalled func(rootHash []byte)
	IsPruningEnabledCalled   func() bool
	GetAllLeavesCalled       func(rootHash []byte) (map[string][]byte, error)
	RecreateAllTriesCalled   func(rootHash []byte) (map[string]data.Trie, error)
	GetNumCheckpointsCalled  func() uint32
}

AccountsStub -

func (*AccountsStub) AddJournalEntry added in v0.0.2

func (as *AccountsStub) AddJournalEntry(je state.JournalEntry)

AddJournalEntry -

func (*AccountsStub) CancelPrune added in v0.0.2

func (as *AccountsStub) CancelPrune(rootHash []byte, identifier data.TriePruningIdentifier)

CancelPrune -

func (*AccountsStub) Commit added in v0.0.2

func (as *AccountsStub) Commit() ([]byte, error)

Commit -

func (*AccountsStub) GetAllLeaves added in v0.0.2

func (as *AccountsStub) GetAllLeaves(rootHash []byte) (map[string][]byte, error)

GetAllLeaves -

func (*AccountsStub) GetExistingAccount added in v0.0.2

func (as *AccountsStub) GetExistingAccount(addressContainer []byte) (state.AccountHandler, error)

GetExistingAccount -

func (*AccountsStub) GetNumCheckpoints added in v0.0.2

func (as *AccountsStub) GetNumCheckpoints() uint32

GetNumCheckpoints -

func (*AccountsStub) IsInterfaceNil added in v0.0.2

func (as *AccountsStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AccountsStub) IsPruningEnabled added in v0.0.2

func (as *AccountsStub) IsPruningEnabled() bool

IsPruningEnabled -

func (*AccountsStub) JournalLen added in v0.0.2

func (as *AccountsStub) JournalLen() int

JournalLen -

func (*AccountsStub) LoadAccount added in v0.0.2

func (as *AccountsStub) LoadAccount(address []byte) (state.AccountHandler, error)

LoadAccount -

func (*AccountsStub) PruneTrie added in v0.0.2

func (as *AccountsStub) PruneTrie(rootHash []byte, identifier data.TriePruningIdentifier)

PruneTrie -

func (*AccountsStub) RecreateAllTries added in v0.0.2

func (as *AccountsStub) RecreateAllTries(rootHash []byte) (map[string]data.Trie, error)

RecreateAllTries -

func (*AccountsStub) RecreateTrie added in v0.0.2

func (as *AccountsStub) RecreateTrie(rootHash []byte) error

RecreateTrie -

func (*AccountsStub) RemoveAccount added in v0.0.2

func (as *AccountsStub) RemoveAccount(addressContainer []byte) error

RemoveAccount -

func (*AccountsStub) RevertToSnapshot added in v0.0.2

func (as *AccountsStub) RevertToSnapshot(snapshot int) error

RevertToSnapshot -

func (*AccountsStub) RootHash added in v0.0.2

func (as *AccountsStub) RootHash() ([]byte, error)

RootHash -

func (*AccountsStub) SaveAccount added in v0.0.2

func (as *AccountsStub) SaveAccount(account state.AccountHandler) error

SaveAccount -

func (*AccountsStub) SetStateCheckpoint added in v0.0.2

func (as *AccountsStub) SetStateCheckpoint(rootHash []byte)

SetStateCheckpoint -

func (*AccountsStub) SnapshotState added in v0.0.2

func (as *AccountsStub) SnapshotState(rootHash []byte)

SnapshotState -

type ApiResolverStub

type ApiResolverStub struct {
	ExecuteSCQueryHandler             func(query *process.SCQuery) (*vmcommon.VMOutput, error)
	StatusMetricsHandler              func() external.StatusMetricsHandler
	ComputeTransactionGasLimitHandler func(tx *transaction.Transaction) (uint64, error)
}

ApiResolverStub -

func (*ApiResolverStub) ComputeTransactionGasLimit

func (ars *ApiResolverStub) ComputeTransactionGasLimit(tx *transaction.Transaction) (uint64, error)

ComputeTransactionGasLimit -

func (*ApiResolverStub) ExecuteSCQuery

func (ars *ApiResolverStub) ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

ExecuteSCQuery -

func (*ApiResolverStub) IsInterfaceNil

func (ars *ApiResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ApiResolverStub) StatusMetrics

func (ars *ApiResolverStub) StatusMetrics() external.StatusMetricsHandler

StatusMetrics -

type NodeStub

type NodeStub struct {
	AddressHandler             func() (string, error)
	ConnectToAddressesHandler  func([]string) error
	StartConsensusHandler      func() error
	GetBalanceHandler          func(address string) (*big.Int, error)
	GenerateTransactionHandler func(sender string, receiver string, amount string, code string) (*transaction.Transaction, error)
	CreateTransactionHandler   func(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64,
		gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32) (*transaction.Transaction, []byte, error)
	ValidateTransactionHandler                     func(tx *transaction.Transaction) error
	GetTransactionHandler                          func(hash string) (*transaction.ApiTransactionResult, error)
	SendBulkTransactionsHandler                    func(txs []*transaction.Transaction) (uint64, error)
	GetAccountHandler                              func(address string) (state.UserAccountHandler, error)
	GetCurrentPublicKeyHandler                     func() string
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	GetHeartbeatsHandler                           func() []data.PubKeyHeartbeat
	ValidatorStatisticsApiCalled                   func() (map[string]*state.ValidatorApiResponse, error)
	DirectTriggerCalled                            func(epoch uint32) error
	IsSelfTriggerCalled                            func() bool
	GetQueryHandlerCalled                          func(name string) (debug.QueryHandler, error)
	GetValueForKeyCalled                           func(address string, key string) (string, error)
	GetPeerInfoCalled                              func(pid string) ([]core.QueryP2PPeerInfo, error)
	GetBlockByHashCalled                           func(hash string, withTxs bool) (*block.APIBlock, error)
	GetBlockByNonceCalled                          func(nonce uint64, withTxs bool) (*block.APIBlock, error)
}

NodeStub -

func (*NodeStub) CreateTransaction

func (ns *NodeStub) CreateTransaction(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64,
	gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32) (*transaction.Transaction, []byte, error)

CreateTransaction -

func (*NodeStub) DecodeAddressPubkey

func (ns *NodeStub) DecodeAddressPubkey(pk string) ([]byte, error)

DecodeAddressPubkey -

func (*NodeStub) DirectTrigger

func (ns *NodeStub) DirectTrigger(epoch uint32) error

DirectTrigger -

func (*NodeStub) EncodeAddressPubkey

func (ns *NodeStub) EncodeAddressPubkey(pk []byte) (string, error)

EncodeAddressPubkey -

func (*NodeStub) GetAccount

func (ns *NodeStub) GetAccount(address string) (state.UserAccountHandler, error)

GetAccount -

func (*NodeStub) GetBalance

func (ns *NodeStub) GetBalance(address string) (*big.Int, error)

GetBalance -

func (*NodeStub) GetBlockByHash added in v0.0.2

func (ns *NodeStub) GetBlockByHash(hash string, withTxs bool) (*block.APIBlock, error)

GetBlockByHash -

func (*NodeStub) GetBlockByNonce added in v0.0.2

func (ns *NodeStub) GetBlockByNonce(nonce uint64, withTxs bool) (*block.APIBlock, error)

GetBlockByNonce -

func (*NodeStub) GetHeartbeats

func (ns *NodeStub) GetHeartbeats() []data.PubKeyHeartbeat

GetHeartbeats -

func (*NodeStub) GetPeerInfo

func (ns *NodeStub) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)

GetPeerInfo -

func (*NodeStub) GetQueryHandler

func (ns *NodeStub) GetQueryHandler(name string) (debug.QueryHandler, error)

GetQueryHandler -

func (*NodeStub) GetTransaction

func (ns *NodeStub) GetTransaction(hash string) (*transaction.ApiTransactionResult, error)

GetTransaction -

func (*NodeStub) GetValueForKey

func (ns *NodeStub) GetValueForKey(address string, key string) (string, error)

GetValueForKey -

func (*NodeStub) IsInterfaceNil

func (ns *NodeStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodeStub) IsSelfTrigger

func (ns *NodeStub) IsSelfTrigger() bool

IsSelfTrigger -

func (*NodeStub) SendBulkTransactions

func (ns *NodeStub) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions -

func (*NodeStub) StartConsensus

func (ns *NodeStub) StartConsensus() error

StartConsensus -

func (*NodeStub) ValidateTransaction

func (ns *NodeStub) ValidateTransaction(tx *transaction.Transaction) error

ValidateTransaction --

func (*NodeStub) ValidatorStatisticsApi

func (ns *NodeStub) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)

ValidatorStatisticsApi -

type SyncTimerMock

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

SyncTimerMock is a mock implementation of SyncTimer interface

func (*SyncTimerMock) ClockOffset

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

ClockOffset is a mock implementation for ClockOffset

func (*SyncTimerMock) Close

func (stm *SyncTimerMock) Close() error

Close -

func (*SyncTimerMock) CurrentTime

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

CurrentTime is a mock implementation for CurrentTime

func (*SyncTimerMock) FormattedCurrentTime

func (stm *SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime is a mock implementation for FormattedCurrentTime

func (*SyncTimerMock) IsInterfaceNil

func (stm *SyncTimerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncTimerMock) StartSyncingTime

func (stm *SyncTimerMock) StartSyncingTime()

StartSyncingTime is a mock implementation for StartSyncingTime

Jump to

Keyboard shortcuts

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