feat(BB): Initialization of lane constructor code (#244)

This commit is contained in:
David Terpay
2023-08-15 19:28:13 +00:00
committed by GitHub
parent 1ed1adc856
commit 10688927ce
39 changed files with 3279 additions and 2080 deletions
+15 -19
View File
@@ -139,7 +139,7 @@ type TestApp struct {
FeeGrantKeeper feegrantkeeper.Keeper
// custom checkTx handler
checkTxHandler abci.CheckTx
checkTxHandler auction.CheckTx
}
func init() {
@@ -262,43 +262,39 @@ func New(
// NOTE: The lanes are ordered by priority. The first lane is the highest priority
// lane and the last lane is the lowest priority lane.
// Top of block lane allows transactions to bid for inclusion at the top of the next block.
tobConfig := blockbuster.BaseLaneConfig{
tobConfig := blockbuster.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: math.LegacyZeroDec(),
MaxBlockSpace: math.LegacyZeroDec(), // This means the lane has no limit on block space.
MaxTxs: 0, // This means the lane has no limit on the number of transactions it can store.
}
tobLane := auction.NewTOBLane(
tobConfig,
0,
auction.NewDefaultAuctionFactory(app.txConfig.TxDecoder()),
)
// Free lane allows transactions to be included in the next block for free.
freeConfig := blockbuster.BaseLaneConfig{
freeConfig := blockbuster.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: math.LegacyZeroDec(),
IgnoreList: []blockbuster.Lane{
tobLane,
},
MaxTxs: 0,
}
freeLane := free.NewFreeLane(
freeConfig,
free.NewDefaultFreeFactory(app.txConfig.TxDecoder()),
blockbuster.DefaultTxPriority(),
free.DefaultMatchHandler(),
)
// Default lane accepts all other transactions.
defaultConfig := blockbuster.BaseLaneConfig{
defaultConfig := blockbuster.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: math.LegacyZeroDec(),
IgnoreList: []blockbuster.Lane{
tobLane,
freeLane,
},
MaxTxs: 0,
}
defaultLane := base.NewDefaultLane(defaultConfig)
@@ -308,7 +304,7 @@ func New(
freeLane,
defaultLane,
}
mempool := blockbuster.NewMempool(app.Logger(), lanes...)
mempool := blockbuster.NewMempool(app.Logger(), true, lanes...)
app.App.SetMempool(mempool)
// Create a global ante handler that will be called on each transaction when
@@ -337,17 +333,17 @@ func New(
}
app.App.SetAnteHandler(anteHandler)
// Set the proposal handlers on base app
// Set the abci handlers on base app
proposalHandler := abci.NewProposalHandler(
app.Logger(),
app.TxConfig().TxDecoder(),
mempool,
lanes,
)
app.App.SetPrepareProposal(proposalHandler.PrepareProposalHandler())
app.App.SetProcessProposal(proposalHandler.ProcessProposalHandler())
// Set the custom CheckTx handler on BaseApp.
checkTxHandler := abci.NewCheckTxHandler(
checkTxHandler := auction.NewCheckTxHandler(
app.App,
app.txConfig.TxDecoder(),
tobLane,
@@ -396,7 +392,7 @@ func (app *TestApp) CheckTx(req *cometabci.RequestCheckTx) (*cometabci.ResponseC
}
// SetCheckTx sets the checkTxHandler for the app.
func (app *TestApp) SetCheckTx(handler abci.CheckTx) {
func (app *TestApp) SetCheckTx(handler auction.CheckTx) {
app.checkTxHandler = handler
}
-1
View File
@@ -189,7 +189,6 @@ func BroadcastTxs(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain,
require.NoError(t, err)
} else {
require.Error(t, err)
}
}
+2 -2
View File
@@ -5,9 +5,9 @@ import (
"testing"
testutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/skip-mev/pob/tests/integration"
buildertypes "github.com/skip-mev/pob/x/builder/types"
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/skip-mev/pob/tests/integration"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/stretchr/testify/suite"
@@ -16,7 +16,7 @@ import (
var (
// config params
numValidators = 4
numFullNodes = 0
numFullNodes = 0
denom = "stake"
image = ibc.DockerImage{