Documentation ¶
Index ¶
- type AccountsAdapterStub
- type DataHandlerStub
- type HasherMock
- type MarshallerStub
- type MiniBlockHandlerStub
- type PubKeyConverterStub
- type ShardCoordinatorMock
- type UserAccountMock
- func (uas *UserAccountMock) AddressBytes() []byte
- func (uas *UserAccountMock) GetBalance() *big.Int
- func (uas *UserAccountMock) GetNonce() uint64
- func (uas *UserAccountMock) IncreaseNonce(_ uint64)
- func (uas *UserAccountMock) IsInterfaceNil() bool
- func (uas *UserAccountMock) RetrieveValueFromDataTrieTracker([]byte) ([]byte, error)
- type WSConnStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountsAdapterStub ¶
type AccountsAdapterStub struct { UserAccountHandler vmcommon.AccountHandler LoadAccountCalled func(address []byte) (vmcommon.AccountHandler, error) }
AccountsAdapterStub -
func (*AccountsAdapterStub) IsInterfaceNil ¶
func (aas *AccountsAdapterStub) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
func (*AccountsAdapterStub) LoadAccount ¶
func (aas *AccountsAdapterStub) LoadAccount(address []byte) (vmcommon.AccountHandler, error)
LoadAccount calls a custom load account function if defined, otherwise returns UserAccountMock, nil
type DataHandlerStub ¶
type DataHandlerStub struct {
ProcessDataCalled func(args *indexer.ArgsSaveBlockData) (*schema.BlockResult, error)
}
func (*DataHandlerStub) ProcessData ¶
func (dhs *DataHandlerStub) ProcessData(args *indexer.ArgsSaveBlockData) (*schema.BlockResult, error)
type HasherMock ¶
type HasherMock struct { }
HasherMock that will be used for testing
func (*HasherMock) Compute ¶
func (hs *HasherMock) Compute(string) []byte
Compute outputs a constant dummy hash
func (*HasherMock) IsInterfaceNil ¶
func (hs *HasherMock) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
type MarshallerStub ¶
type MarshallerStub struct { MarshalCalled func(obj interface{}) ([]byte, error) UnmarshalCalled func(obj interface{}, buff []byte) error }
MarshallerStub that will be used for testing
func (*MarshallerStub) IsInterfaceNil ¶
func (mm *MarshallerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
func (*MarshallerStub) Marshal ¶
func (mm *MarshallerStub) Marshal(obj interface{}) ([]byte, error)
Marshal calls a custom marshall function if defined, otherwise returns json marshal
func (*MarshallerStub) Unmarshal ¶
func (mm *MarshallerStub) Unmarshal(obj interface{}, buff []byte) error
Unmarshal calls a custom unmarshall function if defined, otherwise returns json unmarshal
type MiniBlockHandlerStub ¶
type MiniBlockHandlerStub struct {
ProcessMiniBlockCalled func(header data.HeaderHandler, body data.BodyHandler) ([]*schema.MiniBlock, error)
}
MiniBlockHandlerStub that will be used for testing
func (*MiniBlockHandlerStub) ProcessMiniBlocks ¶
func (mbhs *MiniBlockHandlerStub) ProcessMiniBlocks(header data.HeaderHandler, body data.BodyHandler) ([]*schema.MiniBlock, error)
ProcessMiniBlocks calls a custom mini blocks process function if defined, otherwise returns nil, nil
type PubKeyConverterStub ¶
type PubKeyConverterStub struct { DecodeCalled func(humanReadable string) ([]byte, error) EncodeCalled func(pkBytes []byte) string }
PubKeyConverterStub that will be used for testing
func (*PubKeyConverterStub) Decode ¶
func (pkcs *PubKeyConverterStub) Decode(humanReadable string) ([]byte, error)
Decode calls a custom decode function if defined, otherwise returns an empty byte slice, nil err
func (*PubKeyConverterStub) Encode ¶
func (pkcs *PubKeyConverterStub) Encode(pkBytes []byte) string
Encode calls a custom encode function if defined, otherwise returns "moa1"+input, nil err
func (*PubKeyConverterStub) IsInterfaceNil ¶
func (pkcs *PubKeyConverterStub) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
type ShardCoordinatorMock ¶
type ShardCoordinatorMock struct {
SelfID uint32
}
ShardCoordinatorMock -
func (*ShardCoordinatorMock) ComputeId ¶
func (scm *ShardCoordinatorMock) ComputeId([]byte) uint32
ComputeId returns 0
func (*ShardCoordinatorMock) IsInterfaceNil ¶
func (scm *ShardCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
func (*ShardCoordinatorMock) SelfId ¶
func (scm *ShardCoordinatorMock) SelfId() uint32
SelfId returns SelfID member
type UserAccountMock ¶
UserAccountMock -
func (*UserAccountMock) AddressBytes ¶
func (uas *UserAccountMock) AddressBytes() []byte
AddressBytes returns a byte slice of ("addr" + CurrentBalance)
func (*UserAccountMock) GetBalance ¶
func (uas *UserAccountMock) GetBalance() *big.Int
GetBalance increments CurrentBalance and returns it as a big int
func (*UserAccountMock) GetNonce ¶
func (uas *UserAccountMock) GetNonce() uint64
GetNonce increments CurrentNonce and returns it
func (*UserAccountMock) IncreaseNonce ¶
func (uas *UserAccountMock) IncreaseNonce(_ uint64)
IncreaseNonce -
func (*UserAccountMock) IsInterfaceNil ¶
func (uas *UserAccountMock) IsInterfaceNil() bool
IsInterfaceNil returns true if interface is nil, false otherwise
func (*UserAccountMock) RetrieveValueFromDataTrieTracker ¶
func (uas *UserAccountMock) RetrieveValueFromDataTrieTracker([]byte) ([]byte, error)
RetrieveValueFromDataTrieTracker -
type WSConnStub ¶
type WSConnStub struct { io.Closer WriteMessageCalled func(messageType int, data []byte) error ReadMessageCalled func() (messageType int, p []byte, err error) CloseCalled func() error }
func (*WSConnStub) Close ¶
func (wsc *WSConnStub) Close() error
func (*WSConnStub) ReadMessage ¶
func (wsc *WSConnStub) ReadMessage() (messageType int, p []byte, err error)
func (*WSConnStub) WriteMessage ¶
func (wsc *WSConnStub) WriteMessage(messageType int, data []byte) error