Documentation ¶
Index ¶
- Constants
- Variables
- func CountMockCalls(totalCalls []mock.Call, methodName string) int
- func GenerateBatch(startHeight uint64, endHeight uint64, proposerKey crypto.PrivKey) (*types.Batch, error)
- func GenerateBlocks(startHeight uint64, num uint64, proposerKey crypto.PrivKey) ([]*types.Block, error)
- func GenerateBlocksWithTxs(startHeight uint64, num uint64, proposerKey crypto.PrivKey, nTxs int) ([]*types.Block, error)
- func GenerateCommits(blocks []*types.Block, proposerKey crypto.PrivKey) ([]*types.Commit, error)
- func GenerateGenesis(initialHeight int64) *tmtypes.GenesisDoc
- func GenerateRandomValidatorSet() *tmtypes.ValidatorSet
- func GenerateState(initialHeight int64, lastBlockHeight int64) types.State
- func GetABCIProxyAppMock(logger log.Logger) proxy.AppConns
- func GetAppMock(excludeMethods ...ABCIMethod) *mocks.Application
- func GetRandomBlock(height uint64, nTxs int) *types.Block
- func GetRandomBytes(n int) []byte
- func GetRandomTx() types.Tx
- func GetRandomValidatorSet() *tmtypes.ValidatorSet
- type ABCIMethod
- type DALayerClientRetrieveBatchesError
- type DALayerClientSubmitBatchError
- type MockStore
- type SubscribeMock
Constants ¶
const ( // DefaultBatchSize is the default batch size for testing DefaultBatchSize = 5 // BlockVersion is the default block version for testing BlockVersion = 1 // AppVersion is the default app version for testing AppVersion = 2 )
Variables ¶
Functions ¶
func CountMockCalls ¶
CountMockCalls returns the number of times a mock specific function was called
func GenerateBatch ¶
func GenerateBatch(startHeight uint64, endHeight uint64, proposerKey crypto.PrivKey) (*types.Batch, error)
GenerateBatch generates a batch out of random blocks
func GenerateBlocks ¶
func GenerateBlocks(startHeight uint64, num uint64, proposerKey crypto.PrivKey) ([]*types.Block, error)
GenerateBlocks generates random blocks.
func GenerateBlocksWithTxs ¶
func GenerateCommits ¶
GenerateCommits generates commits based on passed blocks.
func GenerateGenesis ¶
func GenerateGenesis(initialHeight int64) *tmtypes.GenesisDoc
GenerateGenesis generates a genesis for testing.
func GenerateRandomValidatorSet ¶
func GenerateRandomValidatorSet() *tmtypes.ValidatorSet
GenerateRandomValidatorSet generates random validator sets
func GenerateState ¶
GenerateState generates an initial state for testing.
func GetABCIProxyAppMock ¶
GetABCIProxyAppMock returns a dummy abci proxy app mock for testing
func GetAppMock ¶
func GetAppMock(excludeMethods ...ABCIMethod) *mocks.Application
GetAppMock returns a dummy abci app mock for testing
func GetRandomBytes ¶
func GetRandomTx ¶
func GetRandomValidatorSet ¶
func GetRandomValidatorSet() *tmtypes.ValidatorSet
TODO(tzdybal): extract to some common place
Types ¶
type ABCIMethod ¶
type ABCIMethod string
ABCIMethod is a string representing an ABCI method
const ( // InitChain is the string representation of the InitChain ABCI method InitChain ABCIMethod = "InitChain" // CheckTx is the string representation of the CheckTx ABCI method CheckTx ABCIMethod = "CheckTx" // BeginBlock is the string representation of the BeginBlockMethod ABCI method BeginBlock ABCIMethod = "BeginBlock" // DeliverTx is the string representation of the DeliverTx ABCI method DeliverTx ABCIMethod = "DeliverTx" // EndBlock is the string representation of the EndBlock ABCI method EndBlock ABCIMethod = "EndBlock" // Commit is the string representation of the Commit ABCI method Commit ABCIMethod = "Commit" // Info is the string representation of the Info ABCI method Info ABCIMethod = "Info" )
type DALayerClientRetrieveBatchesError ¶
type DALayerClientRetrieveBatchesError struct {
mockda.DataAvailabilityLayerClient
}
DALayerClientRetrieveBatchesError is a mock data availability layer client that can be used to test error handling
func (*DALayerClientRetrieveBatchesError) RetrieveBatches ¶
func (m *DALayerClientRetrieveBatchesError) RetrieveBatches(_ uint64) da.ResultRetrieveBatch
RetrieveBatches retrieves batches from the data availability layer
type DALayerClientSubmitBatchError ¶
type DALayerClientSubmitBatchError struct {
mockda.DataAvailabilityLayerClient
}
DALayerClientSubmitBatchError is a mock data availability layer client that can be used to test error handling
func (*DALayerClientSubmitBatchError) SubmitBatch ¶
func (s *DALayerClientSubmitBatchError) SubmitBatch(_ *types.Batch) da.ResultSubmitBatch
SubmitBatch submits a batch to the data availability layer
type MockStore ¶
type MockStore struct { ShouldFailSetHeight bool ShoudFailUpdateState bool ShouldFailUpdateStateWithBatch bool *store.DefaultStore // contains filtered or unexported fields }
MockStore is a mock store for testing
type SubscribeMock ¶
type SubscribeMock struct {
// contains filtered or unexported fields
}
SubscribeMock is a mock to provide a subscription like behavior for testing
func NewSubscribeMock ¶
func NewSubscribeMock(messageCh chan interface{}) *SubscribeMock
func (*SubscribeMock) Chan ¶
func (s *SubscribeMock) Chan() <-chan interface{}
func (*SubscribeMock) Unsubscribe ¶
func (s *SubscribeMock) Unsubscribe()