Documentation ¶
Index ¶
- Constants
- Variables
- func CountMockCalls(totalCalls []mock.Call, methodName string) int
- func CreateLocalServer(t *testing.T) (*rpc.Server, net.Listener)
- func CreateNode(isAggregator bool, blockManagerConfig *config.BlockManagerConfig) (*node.Node, error)
- 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 GetManager(conf config.BlockManagerConfig, settlementlc settlement.LayerI, ...) (*block.Manager, error)
- func GetManagerConfig() config.BlockManagerConfig
- func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypto.PrivKey, ...) (*block.Manager, error)
- func GetMockDALC(logger log.Logger) da.DataAvailabilityLayerClient
- 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 HostDescr
- type Logger
- type MockLogger
- type MockStore
- type SubscribeMock
- type TestNet
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 )
const (
DefaultTestBatchSize = 5
)
Variables ¶
Functions ¶
func CountMockCalls ¶ added in v1.1.0
CountMockCalls returns the number of times a mock specific function was called
func CreateLocalServer ¶ added in v1.1.0
func CreateNode ¶ added in v1.1.0
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 ¶ added in v1.1.0
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 GetManager ¶ added in v1.1.0
func GetManagerConfig ¶ added in v1.1.0
func GetManagerConfig() config.BlockManagerConfig
func GetManagerWithProposerKey ¶ added in v1.1.0
func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypto.PrivKey, settlementlc settlement.LayerI, dalc da.DataAvailabilityLayerClient, genesisHeight int64, storeInitialHeight int64, storeLastBlockHeight int64, proxyAppConns proxy.AppConns, mockStore store.Store) (*block.Manager, error)
--------------------------------------------------------------------------
utils
--------------------------------------------------------------------------
func GetMockDALC ¶ added in v1.1.0
func GetMockDALC(logger log.Logger) da.DataAvailabilityLayerClient
func GetRandomBytes ¶ added in v1.1.0
func GetRandomTx ¶ added in v1.1.0
func GetRandomValidatorSet ¶ added in v1.1.0
func GetRandomValidatorSet() *tmtypes.ValidatorSet
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 ¶ added in v1.1.0
type DALayerClientRetrieveBatchesError struct {
localda.DataAvailabilityLayerClient
}
DALayerClientRetrieveBatchesError is a mock data availability layer client that can be used to test error handling
func (*DALayerClientRetrieveBatchesError) RetrieveBatches ¶ added in v1.1.0
func (m *DALayerClientRetrieveBatchesError) RetrieveBatches(_ *da.DASubmitMetaData) da.ResultRetrieveBatch
RetrieveBatches retrieves batches from the data availability layer
type DALayerClientSubmitBatchError ¶ added in v1.1.0
type DALayerClientSubmitBatchError struct {
localda.DataAvailabilityLayerClient
}
DALayerClientSubmitBatchError is a mock data availability layer client that can be used to test error handling
func (*DALayerClientSubmitBatchError) SubmitBatch ¶ added in v1.1.0
func (s *DALayerClientSubmitBatchError) SubmitBatch(_ *types.Batch) da.ResultSubmitBatch
SubmitBatch submits a batch to the data availability layer
type Logger ¶ added in v1.1.0
Logger is a simple, yet thread-safe, logger intended for use in unit tests.
func NewLogger ¶ added in v1.1.0
NewLogger create a Logger that outputs data using given testing.T instance.
type MockLogger ¶ added in v1.1.0
type MockLogger struct {
DebugLines, InfoLines, ErrLines []string
}
MockLogger is a fake logger that accumulates all the inputs.
It can be used in tests to ensure that certain messages was logged with correct severity.
func (*MockLogger) Debug ¶ added in v1.1.0
func (t *MockLogger) Debug(msg string, keyvals ...interface{})
Debug saves a debug message.
func (*MockLogger) Error ¶ added in v1.1.0
func (t *MockLogger) Error(msg string, keyvals ...interface{})
Error saves an error message.
func (*MockLogger) Info ¶ added in v1.1.0
func (t *MockLogger) Info(msg string, keyvals ...interface{})
Info saves an info message.
type MockStore ¶ added in v1.1.0
type MockStore struct { ShouldFailSetHeight bool ShoudFailUpdateState bool ShouldFailUpdateStateWithBatch bool *store.DefaultStore // contains filtered or unexported fields }
MockStore is a mock store for testing
func NewMockStore ¶ added in v1.1.0
func NewMockStore() *MockStore
NewMockStore returns a new mock store
func (*MockStore) NextHeight ¶ added in v1.1.0
type SubscribeMock ¶ added in v1.1.0
type SubscribeMock struct {
// contains filtered or unexported fields
}
SubscribeMock is a mock to provide a subscription like behavior for testing
func NewSubscribeMock ¶ added in v1.1.0
func NewSubscribeMock(messageCh chan interface{}) *SubscribeMock
func (*SubscribeMock) Chan ¶ added in v1.1.0
func (s *SubscribeMock) Chan() <-chan interface{}
func (*SubscribeMock) Unsubscribe ¶ added in v1.1.0
func (s *SubscribeMock) Unsubscribe()
type TestNet ¶ added in v1.1.0
func StartTestNetwork ¶ added in v1.1.0
func (TestNet) WaitForDHT ¶ added in v1.1.0
func (tn TestNet) WaitForDHT()