default re-factor with constructor

This commit is contained in:
David Terpay
2023-08-14 18:02:08 -04:00
parent f203db880e
commit 7005d4c8a3
11 changed files with 1305 additions and 392 deletions
+256
View File
@@ -0,0 +1,256 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
blockbuster "github.com/skip-mev/pob/blockbuster"
log "cosmossdk.io/log"
math "cosmossdk.io/math"
mempool "github.com/cosmos/cosmos-sdk/types/mempool"
mock "github.com/stretchr/testify/mock"
types "github.com/cosmos/cosmos-sdk/types"
)
// Lane is an autogenerated mock type for the Lane type
type Lane struct {
mock.Mock
}
// CheckOrder provides a mock function with given fields: ctx, txs
func (_m *Lane) CheckOrder(ctx types.Context, txs []types.Tx) error {
ret := _m.Called(ctx, txs)
var r0 error
if rf, ok := ret.Get(0).(func(types.Context, []types.Tx) error); ok {
r0 = rf(ctx, txs)
} else {
r0 = ret.Error(0)
}
return r0
}
// Compare provides a mock function with given fields: ctx, this, other
func (_m *Lane) Compare(ctx types.Context, this types.Tx, other types.Tx) int {
ret := _m.Called(ctx, this, other)
var r0 int
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) int); ok {
r0 = rf(ctx, this, other)
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// Contains provides a mock function with given fields: tx
func (_m *Lane) Contains(tx types.Tx) bool {
ret := _m.Called(tx)
var r0 bool
if rf, ok := ret.Get(0).(func(types.Tx) bool); ok {
r0 = rf(tx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// CountTx provides a mock function with given fields:
func (_m *Lane) CountTx() int {
ret := _m.Called()
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// GetMaxBlockSpace provides a mock function with given fields:
func (_m *Lane) GetMaxBlockSpace() math.LegacyDec {
ret := _m.Called()
var r0 math.LegacyDec
if rf, ok := ret.Get(0).(func() math.LegacyDec); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(math.LegacyDec)
}
return r0
}
// Insert provides a mock function with given fields: _a0, _a1
func (_m *Lane) Insert(_a0 context.Context, _a1 types.Tx) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// Logger provides a mock function with given fields:
func (_m *Lane) Logger() log.Logger {
ret := _m.Called()
var r0 log.Logger
if rf, ok := ret.Get(0).(func() log.Logger); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(log.Logger)
}
}
return r0
}
// Match provides a mock function with given fields: ctx, tx
func (_m *Lane) Match(ctx types.Context, tx types.Tx) bool {
ret := _m.Called(ctx, tx)
var r0 bool
if rf, ok := ret.Get(0).(func(types.Context, types.Tx) bool); ok {
r0 = rf(ctx, tx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Name provides a mock function with given fields:
func (_m *Lane) Name() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// PrepareLane provides a mock function with given fields: ctx, proposal, maxTxBytes, next
func (_m *Lane) PrepareLane(ctx types.Context, proposal blockbuster.BlockProposal, maxTxBytes int64, next blockbuster.PrepareLanesHandler) (blockbuster.BlockProposal, error) {
ret := _m.Called(ctx, proposal, maxTxBytes, next)
var r0 blockbuster.BlockProposal
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, blockbuster.BlockProposal, int64, blockbuster.PrepareLanesHandler) (blockbuster.BlockProposal, error)); ok {
return rf(ctx, proposal, maxTxBytes, next)
}
if rf, ok := ret.Get(0).(func(types.Context, blockbuster.BlockProposal, int64, blockbuster.PrepareLanesHandler) blockbuster.BlockProposal); ok {
r0 = rf(ctx, proposal, maxTxBytes, next)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(blockbuster.BlockProposal)
}
}
if rf, ok := ret.Get(1).(func(types.Context, blockbuster.BlockProposal, int64, blockbuster.PrepareLanesHandler) error); ok {
r1 = rf(ctx, proposal, maxTxBytes, next)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ProcessLane provides a mock function with given fields: ctx, proposalTxs, next
func (_m *Lane) ProcessLane(ctx types.Context, proposalTxs []types.Tx, next blockbuster.ProcessLanesHandler) (types.Context, error) {
ret := _m.Called(ctx, proposalTxs, next)
var r0 types.Context
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, []types.Tx, blockbuster.ProcessLanesHandler) (types.Context, error)); ok {
return rf(ctx, proposalTxs, next)
}
if rf, ok := ret.Get(0).(func(types.Context, []types.Tx, blockbuster.ProcessLanesHandler) types.Context); ok {
r0 = rf(ctx, proposalTxs, next)
} else {
r0 = ret.Get(0).(types.Context)
}
if rf, ok := ret.Get(1).(func(types.Context, []types.Tx, blockbuster.ProcessLanesHandler) error); ok {
r1 = rf(ctx, proposalTxs, next)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Remove provides a mock function with given fields: _a0
func (_m *Lane) Remove(_a0 types.Tx) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(types.Tx) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Select provides a mock function with given fields: _a0, _a1
func (_m *Lane) Select(_a0 context.Context, _a1 [][]byte) mempool.Iterator {
ret := _m.Called(_a0, _a1)
var r0 mempool.Iterator
if rf, ok := ret.Get(0).(func(context.Context, [][]byte) mempool.Iterator); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(mempool.Iterator)
}
}
return r0
}
// SetAnteHandler provides a mock function with given fields: antehander
func (_m *Lane) SetAnteHandler(antehander types.AnteHandler) {
_m.Called(antehander)
}
// SetIgnoreList provides a mock function with given fields: ignoreList
func (_m *Lane) SetIgnoreList(ignoreList []blockbuster.Lane) {
_m.Called(ignoreList)
}
// NewLane creates a new instance of Lane. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewLane(t interface {
mock.TestingT
Cleanup(func())
}) *Lane {
mock := &Lane{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
+117
View File
@@ -0,0 +1,117 @@
// Code generated by mockery v2.30.1. DO NOT EDIT.
package mocks
import (
context "context"
mempool "github.com/cosmos/cosmos-sdk/types/mempool"
mock "github.com/stretchr/testify/mock"
types "github.com/cosmos/cosmos-sdk/types"
)
// LaneMempool is an autogenerated mock type for the LaneMempool type
type LaneMempool struct {
mock.Mock
}
// Compare provides a mock function with given fields: ctx, this, other
func (_m *LaneMempool) Compare(ctx types.Context, this types.Tx, other types.Tx) int {
ret := _m.Called(ctx, this, other)
var r0 int
if rf, ok := ret.Get(0).(func(types.Context, types.Tx, types.Tx) int); ok {
r0 = rf(ctx, this, other)
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// Contains provides a mock function with given fields: tx
func (_m *LaneMempool) Contains(tx types.Tx) bool {
ret := _m.Called(tx)
var r0 bool
if rf, ok := ret.Get(0).(func(types.Tx) bool); ok {
r0 = rf(tx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// CountTx provides a mock function with given fields:
func (_m *LaneMempool) CountTx() int {
ret := _m.Called()
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// Insert provides a mock function with given fields: _a0, _a1
func (_m *LaneMempool) Insert(_a0 context.Context, _a1 types.Tx) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, types.Tx) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// Remove provides a mock function with given fields: _a0
func (_m *LaneMempool) Remove(_a0 types.Tx) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(types.Tx) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Select provides a mock function with given fields: _a0, _a1
func (_m *LaneMempool) Select(_a0 context.Context, _a1 [][]byte) mempool.Iterator {
ret := _m.Called(_a0, _a1)
var r0 mempool.Iterator
if rf, ok := ret.Get(0).(func(context.Context, [][]byte) mempool.Iterator); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(mempool.Iterator)
}
}
return r0
}
// NewLaneMempool creates a new instance of LaneMempool. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewLaneMempool(t interface {
mock.TestingT
Cleanup(func())
}) *LaneMempool {
mock := &LaneMempool{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}