deprecating blockbuster

This commit is contained in:
David Terpay 2023-08-15 11:15:34 -04:00
parent 9d349910d1
commit 4cbf8d0f1a
No known key found for this signature in database
GPG Key ID: 627EFB00DADF0CD1
31 changed files with 200 additions and 200 deletions

View File

@ -22,7 +22,7 @@ Skip's POB provides developers with a set of a few core primitives:
on-chain in a transparent, enforceable way. At its core, BlockBuster is an app-side mempool + set
of proposal handlers (`PrepareProposal`/`ProcessProposal`) that allow developers to configure
modular lanes of transactions in their blocks with distinct validation/ordering logic. For more
information, see the [BlockBuster README](/blockbuster/README.md).
information, see the [BlockBuster README](/block/README.md).
* `x/builder`: This Cosmos SDK module gives applications the ability to process
MEV bundled transactions in addition to having the ability to define how searchers
and block proposers are rewarded. In addition, the module defines a `AuctionDecorator`,
@ -59,20 +59,20 @@ $ go install github.com/skip-mev/pob
>* Builder module that pairs with the auction lane to process auction transactions and distribute revenue
> to the auction house.
>
> To build your own custom BlockBuster Lane, please see the [BlockBuster README](/blockbuster/README.md).
> To build your own custom BlockBuster Lane, please see the [BlockBuster README](/block/README.md).
1. Import the necessary dependencies into your application. This includes the
blockbuster proposal handlers +mempool, keeper, builder types, and builder module. This
block proposal handlers +mempool, keeper, builder types, and builder module. This
tutorial will go into more detail into each of the dependencies.
```go
import (
...
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/abci"
"github.com/skip-mev/pob/blockbuster/lanes/mev"
"github.com/skip-mev/pob/blockbuster/lanes/base"
"github.com/skip-mev/pob/blockbuster/lanes/free"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/abci"
"github.com/skip-mev/pob/block/lanes/mev"
"github.com/skip-mev/pob/block/lanes/base"
"github.com/skip-mev/pob/block/lanes/free"
buildermodule "github.com/skip-mev/pob/x/builder"
builderkeeper "github.com/skip-mev/pob/x/builder/keeper"
...
@ -129,18 +129,18 @@ $ go install github.com/skip-mev/pob
}
```
c. Instantiate the blockbuster mempool with the application's desired lanes.
c. Instantiate the block mempool with the application's desired lanes.
```go
// Set the blockbuster mempool into the app.
// Set the block mempool into the app.
// Create the lanes.
//
// 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.
//
// blockbuster.BaseLaneConfig is utilized for basic encoding/decoding of transactions.
tobConfig := blockbuster.BaseLaneConfig{
// block.BaseLaneConfig is utilized for basic encoding/decoding of transactions.
tobConfig := block.BaseLaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
@ -160,7 +160,7 @@ $ go install github.com/skip-mev/pob
)
// Free lane allows transactions to be included in the next block for free.
freeConfig := blockbuster.BaseLaneConfig{
freeConfig := block.BaseLaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
@ -168,7 +168,7 @@ $ go install github.com/skip-mev/pob
// IgnoreList is a list of lanes that if a transaction should be included in, it will be
// ignored by the lane. For example, if a transaction should belong to the tob lane, it
// will be ignored by the free lane.
IgnoreList: []blockbuster.Lane{
IgnoreList: []block.Lane{
tobLane,
},
}
@ -178,12 +178,12 @@ $ go install github.com/skip-mev/pob
)
// Default lane accepts all other transactions.
defaultConfig := blockbuster.BaseLaneConfig{
defaultConfig := block.BaseLaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: sdk.ZeroDec(),
IgnoreList: []blockbuster.Lane{
IgnoreList: []block.Lane{
tobLane,
freeLane,
},
@ -191,17 +191,17 @@ $ go install github.com/skip-mev/pob
defaultLane := base.NewDefaultLane(defaultConfig)
// Set the lanes into the mempool.
lanes := []blockbuster.Lane{
lanes := []block.Lane{
tobLane,
freeLane,
defaultLane,
}
mempool := blockbuster.NewMempool(lanes...)
mempool := block.NewMempool(lanes...)
app.App.SetMempool(mempool)
```
d. Instantiate the antehandler chain for the application with awareness of the
blockbuster mempool. This will allow the application to verify the validity
block mempool. This will allow the application to verify the validity
of a transaction respecting the desired logic of a given lane. In this walkthrough,
we want the `FeeDecorator` to be ignored for all transactions that should belong to the
free lane. Additionally, we want to add the `x/builder` module's `AuctionDecorator` to the
@ -211,8 +211,8 @@ $ go install github.com/skip-mev/pob
```go
import (
...
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
builderante "github.com/skip-mev/pob/x/builder/ante"
...
)

View File

@ -6,8 +6,8 @@ import (
"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
"github.com/skip-mev/pob/lanes/terminator"
)
@ -17,14 +17,14 @@ type (
ProposalHandler struct {
logger log.Logger
txDecoder sdk.TxDecoder
prepareLanesHandler blockbuster.PrepareLanesHandler
processLanesHandler blockbuster.ProcessLanesHandler
prepareLanesHandler block.PrepareLanesHandler
processLanesHandler block.ProcessLanesHandler
}
)
// NewProposalHandler returns a new abci++ proposal handler. This proposal handler will
// iteratively call each of the lanes in the chain to prepare and process the proposal.
func NewProposalHandler(logger log.Logger, txDecoder sdk.TxDecoder, lanes []blockbuster.Lane) *ProposalHandler {
func NewProposalHandler(logger log.Logger, txDecoder sdk.TxDecoder, lanes []block.Lane) *ProposalHandler {
return &ProposalHandler{
logger: logger,
txDecoder: txDecoder,
@ -48,7 +48,7 @@ func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler {
}
}()
proposal, err := h.prepareLanesHandler(ctx, blockbuster.NewProposal(req.MaxTxBytes))
proposal, err := h.prepareLanesHandler(ctx, block.NewProposal(req.MaxTxBytes))
if err != nil {
h.logger.Error("failed to prepare proposal", "err", err)
return &abci.ResponsePrepareProposal{Txs: make([][]byte, 0)}, err
@ -114,7 +114,7 @@ func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler {
//
// In the case where any of the lanes fail to prepare the partial proposal, the lane that failed
// will be skipped and the next lane in the chain will be called to prepare the proposal.
func ChainPrepareLanes(chain ...blockbuster.Lane) blockbuster.PrepareLanesHandler {
func ChainPrepareLanes(chain ...block.Lane) block.PrepareLanesHandler {
if len(chain) == 0 {
return nil
}
@ -124,7 +124,7 @@ func ChainPrepareLanes(chain ...blockbuster.Lane) blockbuster.PrepareLanesHandle
chain = append(chain, terminator.Terminator{})
}
return func(ctx sdk.Context, partialProposal blockbuster.BlockProposal) (finalProposal blockbuster.BlockProposal, err error) {
return func(ctx sdk.Context, partialProposal block.BlockProposal) (finalProposal block.BlockProposal, err error) {
lane := chain[0]
lane.Logger().Info("preparing lane", "lane", lane.Name())
@ -182,7 +182,7 @@ func ChainPrepareLanes(chain ...blockbuster.Lane) blockbuster.PrepareLanesHandle
// ChainProcessLanes chains together the proposal verification logic from each lane
// into a single function. The first lane in the chain is the first lane to be verified and
// the last lane in the chain is the last lane to be verified.
func ChainProcessLanes(chain ...blockbuster.Lane) blockbuster.ProcessLanesHandler {
func ChainProcessLanes(chain ...block.Lane) block.ProcessLanesHandler {
if len(chain) == 0 {
return nil
}

View File

@ -14,8 +14,8 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/abci"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
"github.com/skip-mev/pob/lanes/base"
"github.com/skip-mev/pob/lanes/free"
"github.com/skip-mev/pob/lanes/mev"
@ -57,7 +57,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
// Set up the default lane with no transactions
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("1"), nil)
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{})
s.Require().NoError(err)
@ -81,7 +81,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("1"), map[sdk.Tx]bool{tx: true})
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NotNil(resp)
s.Require().NoError(err)
@ -119,7 +119,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx1))
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx2))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NotNil(resp)
s.Require().NoError(err)
@ -157,7 +157,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx1))
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx2))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NotNil(resp)
s.Require().NoError(err)
@ -171,7 +171,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), nil)
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{})
s.Require().NoError(err)
@ -201,7 +201,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), nil)
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NoError(err)
@ -239,7 +239,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
s.Require().NoError(defaultLane.Insert(sdk.Context{}, bundleTxs[0]))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NoError(err)
@ -278,7 +278,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
s.Require().NoError(defaultLane.Insert(sdk.Context{}, bundleTxs[0]))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
s.Require().NoError(err)
@ -317,7 +317,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
s.Require().NoError(defaultLane.Insert(sdk.Context{}, bundleTxs[0]))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).PrepareProposalHandler()
proposal := s.getTxBytes(tx, bundleTxs[0])
size := int64(len(proposal[0]) - 1)
@ -353,7 +353,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
})
s.Require().NoError(freeLane.Insert(sdk.Context{}, freeTx))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler()
proposal := s.getTxBytes(freeTx)
@ -419,7 +419,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
})
freeLane.Insert(sdk.Context{}, freeTx)
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler()
proposal := s.getTxBytes(tx, bundleTxs[0], bundleTxs[1], bundleTxs[2], bundleTxs[3], freeTx, normalTx)
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 1000000000})
@ -453,7 +453,7 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
proposalHandler := abci.NewProposalHandler(
log.NewTestLogger(s.T()),
s.encodingConfig.TxConfig.TxDecoder(),
[]blockbuster.Lane{panicLane, defaultLane},
[]block.Lane{panicLane, defaultLane},
).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 1000000})
@ -486,7 +486,7 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
proposalHandler := abci.NewProposalHandler(
log.NewTestLogger(s.T()),
s.encodingConfig.TxConfig.TxDecoder(),
[]blockbuster.Lane{defaultLane, panicLane},
[]block.Lane{defaultLane, panicLane},
).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 1000000})
@ -520,7 +520,7 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
proposalHandler := abci.NewProposalHandler(
log.NewTestLogger(s.T()),
s.encodingConfig.TxConfig.TxDecoder(),
[]blockbuster.Lane{panicLane, panicLane2, defaultLane},
[]block.Lane{panicLane, panicLane2, defaultLane},
).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 1000000})
@ -554,7 +554,7 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
proposalHandler := abci.NewProposalHandler(
log.NewTestLogger(s.T()),
s.encodingConfig.TxConfig.TxDecoder(),
[]blockbuster.Lane{defaultLane, panicLane, panicLane2},
[]block.Lane{defaultLane, panicLane, panicLane2},
).PrepareProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 1000000})
@ -573,7 +573,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
freeLane := s.setUpFreeLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.0"), map[sdk.Tx]bool{})
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: nil})
s.Require().NoError(err)
@ -586,7 +586,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
freeLane := s.setUpFreeLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.0"), map[sdk.Tx]bool{})
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: [][]byte{{0x01, 0x02, 0x03}}})
s.Require().Error(err)
@ -606,7 +606,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
)
s.Require().NoError(err)
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, panicLane}).ProcessProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, panicLane}).ProcessProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: [][]byte{txbz}})
s.Require().Error(err)
s.Require().Equal(&cometabci.ResponseProcessProposal{Status: cometabci.ResponseProcessProposal_REJECT}, resp)
@ -639,7 +639,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("1"), map[sdk.Tx]bool{tx: true})
s.Require().NoError(defaultLane.Insert(sdk.Context{}, tx))
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{defaultLane}).ProcessProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{defaultLane}).ProcessProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: s.getTxBytes(tx, tx2)})
s.Require().NotNil(resp)
s.Require().Error(err)
@ -678,13 +678,13 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
// Set up the default lane
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), nil)
defaultLane.SetProcessLaneHandler(blockbuster.NoOpProcessLaneHandler())
defaultLane.SetProcessLaneHandler(block.NoOpProcessLaneHandler())
// Set up the TOB lane
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
mevLane.SetProcessLaneHandler(blockbuster.NoOpProcessLaneHandler())
mevLane.SetProcessLaneHandler(block.NoOpProcessLaneHandler())
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).ProcessProposalHandler()
proposalHandler := s.setUpProposalHandlers([]block.Lane{mevLane, defaultLane}).ProcessProposalHandler()
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: s.getTxBytes(bidTx, bundle[0], bundle[1], normalTx, normalTx2)})
s.Require().NotNil(resp)
s.Require().Error(err)
@ -725,7 +725,7 @@ func (s *ProposalsTestSuite) setUpAnteHandler(expectedExecution map[sdk.Tx]bool)
}
func (s *ProposalsTestSuite) setUpDefaultLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *base.DefaultLane {
cfg := blockbuster.LaneConfig{
cfg := block.LaneConfig{
Logger: log.NewTestLogger(s.T()),
TxEncoder: s.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: s.encodingConfig.TxConfig.TxDecoder(),
@ -737,7 +737,7 @@ func (s *ProposalsTestSuite) setUpDefaultLane(maxBlockSpace math.LegacyDec, expe
}
func (s *ProposalsTestSuite) setUpTOBLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *mev.MEVLane {
cfg := blockbuster.LaneConfig{
cfg := block.LaneConfig{
Logger: log.NewTestLogger(s.T()),
TxEncoder: s.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: s.encodingConfig.TxConfig.TxDecoder(),
@ -749,7 +749,7 @@ func (s *ProposalsTestSuite) setUpTOBLane(maxBlockSpace math.LegacyDec, expected
}
func (s *ProposalsTestSuite) setUpFreeLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *free.FreeLane {
cfg := blockbuster.LaneConfig{
cfg := block.LaneConfig{
Logger: log.NewTestLogger(s.T()),
TxEncoder: s.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: s.encodingConfig.TxConfig.TxDecoder(),
@ -761,7 +761,7 @@ func (s *ProposalsTestSuite) setUpFreeLane(maxBlockSpace math.LegacyDec, expecte
}
func (s *ProposalsTestSuite) setUpPanicLane(maxBlockSpace math.LegacyDec) *constructor.LaneConstructor[string] {
cfg := blockbuster.LaneConfig{
cfg := block.LaneConfig{
Logger: log.NewTestLogger(s.T()),
TxEncoder: s.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: s.encodingConfig.TxConfig.TxDecoder(),
@ -775,14 +775,14 @@ func (s *ProposalsTestSuite) setUpPanicLane(maxBlockSpace math.LegacyDec) *const
constructor.DefaultMatchHandler(),
)
lane.SetPrepareLaneHandler(blockbuster.PanicPrepareLaneHandler())
lane.SetProcessLaneHandler(blockbuster.PanicProcessLaneHandler())
lane.SetPrepareLaneHandler(block.PanicPrepareLaneHandler())
lane.SetProcessLaneHandler(block.PanicProcessLaneHandler())
return lane
}
func (s *ProposalsTestSuite) setUpProposalHandlers(lanes []blockbuster.Lane) *abci.ProposalHandler {
mempool := blockbuster.NewLanedMempool(log.NewTestLogger(s.T()), true, lanes...)
func (s *ProposalsTestSuite) setUpProposalHandlers(lanes []block.Lane) *abci.ProposalHandler {
mempool := block.NewLanedMempool(log.NewTestLogger(s.T()), true, lanes...)
return abci.NewProposalHandler(
log.NewTestLogger(s.T()),

View File

@ -69,13 +69,13 @@ implementations of lanes: MEV lane, free lane, and a default lane.
2. Free lane allows base app to not charge certain types of transactions
any fees. For example, delegations and/or re-delegations might be charged no
fees. What qualifies as a free transaction is determined
[here](https://github.com/skip-mev/pob/blob/main/blockbuster/lanes/free/factory.go).
[here](https://github.com/skip-mev/pob/blob/main/block/lanes/free/factory.go).
3. Default lane accepts all other transactions and is considered to be
analogous to how mempools and proposals are constructed today.
* Instantiate the mempool in base app.
```go
mempool := blockbuster.NewMempool(lanes...)
mempool := block.NewMempool(lanes...)
app.App.SetMempool(mempool)
```
@ -158,7 +158,7 @@ given lane be ordered in a block / mempool.
2. Inclusion function to determine what types of transactions belong in the lane.
3. Unique block building/verification mechanism.
The general interface that each lane must implement can be found [here](https://github.com/skip-mev/pob/blob/main/blockbuster/lane.go):
The general interface that each lane must implement can be found [here](https://github.com/skip-mev/pob/blob/main/block/lane.go):
```go
// Lane defines an interface used for block construction
@ -226,8 +226,8 @@ an custom `TxPriority` that orders transactions in the mempool based on their
bid.
```go
func TxPriority(config Factory) blockbuster.TxPriority[string] {
return blockbuster.TxPriority[string]{
func TxPriority(config Factory) block.TxPriority[string] {
return block.TxPriority[string]{
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
bidInfo, err := config.GetAuctionBidInfo(tx)
if err != nil {
@ -270,8 +270,8 @@ func TxPriority(config Factory) blockbuster.TxPriority[string] {
// NewMempool returns a new auction mempool.
func NewMempool(txEncoder sdk.TxEncoder, maxTx int, config Factory) *TOBMempool {
return &TOBMempool{
index: blockbuster.NewPriorityMempool(
blockbuster.PriorityNonceMempoolConfig[string]{
index: block.NewPriorityMempool(
block.PriorityNonceMempoolConfig[string]{
TxPriority: TxPriority(config),
MaxTx: maxTx,
},

View File

@ -2,8 +2,8 @@ package constructor
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
)
// PrepareLane will prepare a partial proposal for the lane. It will select transactions from the
@ -12,10 +12,10 @@ import (
// error. The proposal will only be modified if it passes all of the invarient checks.
func (l *LaneConstructor[C]) PrepareLane(
ctx sdk.Context,
proposal blockbuster.BlockProposal,
proposal block.BlockProposal,
maxTxBytes int64,
next blockbuster.PrepareLanesHandler,
) (blockbuster.BlockProposal, error) {
next block.PrepareLanesHandler,
) (block.BlockProposal, error) {
txs, txsToRemove, err := l.prepareLaneHandler(ctx, proposal, maxTxBytes)
if err != nil {
return proposal, err
@ -48,7 +48,7 @@ func (l *LaneConstructor[C]) CheckOrder(ctx sdk.Context, txs []sdk.Tx) error {
// the verification logic of the lane (processLaneHandler). If the transactions are valid, we
// return the transactions that do not belong to this lane to the next lane. If the transactions
// are invalid, we return an error.
func (l *LaneConstructor[C]) ProcessLane(ctx sdk.Context, txs []sdk.Tx, next blockbuster.ProcessLanesHandler) (sdk.Context, error) {
func (l *LaneConstructor[C]) ProcessLane(ctx sdk.Context, txs []sdk.Tx, next block.ProcessLanesHandler) (sdk.Context, error) {
remainingTxs, err := l.processLaneHandler(ctx, txs)
if err != nil {
return ctx, err

View File

@ -4,16 +4,16 @@ import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
)
// DefaultPrepareLaneHandler returns a default implementation of the PrepareLaneHandler. It
// selects all transactions in the mempool that are valid and not already in the partial
// proposal. It will continue to reap transactions until the maximum block space for this
// lane has been reached. Additionally, any transactions that are invalid will be returned.
func (l *LaneConstructor[C]) DefaultPrepareLaneHandler() blockbuster.PrepareLaneHandler {
return func(ctx sdk.Context, proposal blockbuster.BlockProposal, maxTxBytes int64) ([][]byte, []sdk.Tx, error) {
func (l *LaneConstructor[C]) DefaultPrepareLaneHandler() block.PrepareLaneHandler {
return func(ctx sdk.Context, proposal block.BlockProposal, maxTxBytes int64) ([][]byte, []sdk.Tx, error) {
var (
totalSize int64
txs [][]byte
@ -96,7 +96,7 @@ func (l *LaneConstructor[C]) DefaultPrepareLaneHandler() blockbuster.PrepareLane
// fails to verify, the entire proposal is rejected. If the handler comes across a transaction
// that does not match the lane's matcher, it will return the remaining transactions in the
// proposal.
func (l *LaneConstructor[C]) DefaultProcessLaneHandler() blockbuster.ProcessLaneHandler {
func (l *LaneConstructor[C]) DefaultProcessLaneHandler() block.ProcessLaneHandler {
return func(ctx sdk.Context, txs []sdk.Tx) ([]sdk.Tx, error) {
var err error
@ -123,7 +123,7 @@ func (l *LaneConstructor[C]) DefaultProcessLaneHandler() blockbuster.ProcessLane
// lane.
// 2. Transactions that belong to other lanes cannot be interleaved with transactions that
// belong to this lane.
func (l *LaneConstructor[C]) DefaultCheckOrderHandler() blockbuster.CheckOrderHandler {
func (l *LaneConstructor[C]) DefaultCheckOrderHandler() block.CheckOrderHandler {
return func(ctx sdk.Context, txs []sdk.Tx) error {
seenOtherLaneTx := false
@ -149,7 +149,7 @@ func (l *LaneConstructor[C]) DefaultCheckOrderHandler() blockbuster.CheckOrderHa
// DefaultMatchHandler returns a default implementation of the MatchHandler. It matches all
// transactions.
func DefaultMatchHandler() blockbuster.MatchHandler {
func DefaultMatchHandler() block.MatchHandler {
return func(ctx sdk.Context, tx sdk.Tx) bool {
return true
}

View File

@ -6,7 +6,7 @@ import (
"cosmossdk.io/log"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/block"
)
// LaneConstructor is a generic implementation of a lane. It is meant to be used
@ -18,42 +18,42 @@ type LaneConstructor[C comparable] struct {
// cfg stores functionality required to encode/decode transactions, maintains how
// many transactions are allowed in this lane's mempool, and the amount of block
// space this lane is allowed to consume.
cfg blockbuster.LaneConfig
cfg block.LaneConfig
// laneName is the name of the lane.
laneName string
// LaneMempool is the mempool that is responsible for storing transactions
// that are waiting to be processed.
blockbuster.LaneMempool
block.LaneMempool
// matchHandler is the function that determines whether or not a transaction
// should be processed by this lane.
matchHandler blockbuster.MatchHandler
matchHandler block.MatchHandler
// prepareLaneHandler is the function that is called when a new proposal is being
// requested and the lane needs to submit transactions it wants included in the block.
prepareLaneHandler blockbuster.PrepareLaneHandler
prepareLaneHandler block.PrepareLaneHandler
// checkOrderHandler is the function that is called when a new proposal is being
// verified and the lane needs to verify that the transactions included in the proposal
// respect the ordering rules of the lane and does not interleave transactions from other lanes.
checkOrderHandler blockbuster.CheckOrderHandler
checkOrderHandler block.CheckOrderHandler
// processLaneHandler is the function that is called when a new proposal is being
// verified and the lane needs to verify that the transactions included in the proposal
// are valid respecting the verification logic of the lane.
processLaneHandler blockbuster.ProcessLaneHandler
processLaneHandler block.ProcessLaneHandler
}
// NewLaneConstructor returns a new lane constructor. When creating this lane, the type
// of the lane must be specified. The type of the lane is directly associated with the
// type of the mempool that is used to store transactions that are waiting to be processed.
func NewLaneConstructor[C comparable](
cfg blockbuster.LaneConfig,
cfg block.LaneConfig,
laneName string,
laneMempool blockbuster.LaneMempool,
matchHandlerFn blockbuster.MatchHandler,
laneMempool block.LaneMempool,
matchHandlerFn block.MatchHandler,
) *LaneConstructor[C] {
lane := &LaneConstructor[C]{
cfg: cfg,
@ -106,7 +106,7 @@ func (l *LaneConstructor[C]) ValidateBasic() error {
// SetPrepareLaneHandler sets the prepare lane handler for the lane. This handler
// is called when a new proposal is being requested and the lane needs to submit
// transactions it wants included in the block.
func (l *LaneConstructor[C]) SetPrepareLaneHandler(prepareLaneHandler blockbuster.PrepareLaneHandler) {
func (l *LaneConstructor[C]) SetPrepareLaneHandler(prepareLaneHandler block.PrepareLaneHandler) {
if prepareLaneHandler == nil {
panic("prepare lane handler cannot be nil")
}
@ -118,7 +118,7 @@ func (l *LaneConstructor[C]) SetPrepareLaneHandler(prepareLaneHandler blockbuste
// is called when a new proposal is being verified and the lane needs to verify
// that the transactions included in the proposal are valid respecting the verification
// logic of the lane.
func (l *LaneConstructor[C]) SetProcessLaneHandler(processLaneHandler blockbuster.ProcessLaneHandler) {
func (l *LaneConstructor[C]) SetProcessLaneHandler(processLaneHandler block.ProcessLaneHandler) {
if processLaneHandler == nil {
panic("process lane handler cannot be nil")
}
@ -130,7 +130,7 @@ func (l *LaneConstructor[C]) SetProcessLaneHandler(processLaneHandler blockbuste
// is called when a new proposal is being verified and the lane needs to verify
// that the transactions included in the proposal respect the ordering rules of
// the lane and does not include transactions from other lanes.
func (l *LaneConstructor[C]) SetCheckOrderHandler(checkOrderHandler blockbuster.CheckOrderHandler) {
func (l *LaneConstructor[C]) SetCheckOrderHandler(checkOrderHandler block.CheckOrderHandler) {
if checkOrderHandler == nil {
panic("check order handler cannot be nil")
}
@ -166,7 +166,7 @@ func (l *LaneConstructor[C]) Name() string {
// SetIgnoreList sets the ignore list for the lane. The ignore list is a list
// of lanes that the lane should ignore when processing transactions.
func (l *LaneConstructor[C]) SetIgnoreList(lanes []blockbuster.Lane) {
func (l *LaneConstructor[C]) SetIgnoreList(lanes []block.Lane) {
l.cfg.IgnoreList = lanes
}

View File

@ -7,8 +7,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
)
type (
@ -25,7 +25,7 @@ type (
// retrieve the priority of a given transaction and to compare the priority
// of two transactions. The index utilizes this struct to order transactions
// in the mempool.
txPriority blockbuster.TxPriority[C]
txPriority block.TxPriority[C]
// txEncoder defines the sdk.Tx encoder that allows us to encode transactions
// to bytes.
@ -39,8 +39,8 @@ type (
// DefaultTxPriority returns a default implementation of the TxPriority. It prioritizes
// transactions by their fee.
func DefaultTxPriority() blockbuster.TxPriority[string] {
return blockbuster.TxPriority[string]{
func DefaultTxPriority() block.TxPriority[string] {
return block.TxPriority[string]{
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
feeTx, ok := tx.(sdk.FeeTx)
if !ok {
@ -81,10 +81,10 @@ func DefaultTxPriority() blockbuster.TxPriority[string] {
}
// NewConstructorMempool returns a new ConstructorMempool.
func NewConstructorMempool[C comparable](txPriority blockbuster.TxPriority[C], txEncoder sdk.TxEncoder, maxTx int) *ConstructorMempool[C] {
func NewConstructorMempool[C comparable](txPriority block.TxPriority[C], txEncoder sdk.TxEncoder, maxTx int) *ConstructorMempool[C] {
return &ConstructorMempool[C]{
index: blockbuster.NewPriorityMempool(
blockbuster.PriorityNonceMempoolConfig[C]{
index: block.NewPriorityMempool(
block.PriorityNonceMempoolConfig[C]{
TxPriority: txPriority,
MaxTx: maxTx,
},

View File

@ -1,4 +1,4 @@
package blockbuster
package block
import (
"cosmossdk.io/log"

View File

@ -1,4 +1,4 @@
package blockbuster
package block
import (
"context"
@ -40,7 +40,7 @@ type (
}
)
// NewLanedMempool returns a new Blockbuster mempool. The blockbuster mempool is
// NewLanedMempool returns a new Blockbuster mempool. The block mempool is
// comprised of a registry of lanes. Each lane is responsible for selecting
// transactions according to its own selection logic. The lanes are ordered
// according to their priority. The first lane in the registry has the highest

View File

@ -1,4 +1,4 @@
package blockbuster_test
package block_test
import (
"math/rand"
@ -10,8 +10,8 @@ import (
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
"github.com/skip-mev/pob/lanes/base"
"github.com/skip-mev/pob/lanes/free"
"github.com/skip-mev/pob/lanes/mev"
@ -33,8 +33,8 @@ type BlockBusterTestSuite struct {
freeLane *free.FreeLane
gasTokenDenom string
lanes []blockbuster.Lane
mempool blockbuster.Mempool
lanes []block.Lane
mempool block.Mempool
// account set up
accounts []testutils.Account
@ -58,7 +58,7 @@ func (suite *BlockBusterTestSuite) SetupTest() {
//
// TOB lane set up
suite.gasTokenDenom = "stake"
mevConfig := blockbuster.LaneConfig{
mevConfig := block.LaneConfig{
Logger: log.NewNopLogger(),
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
@ -71,7 +71,7 @@ func (suite *BlockBusterTestSuite) SetupTest() {
)
// Free lane set up
freeConfig := blockbuster.LaneConfig{
freeConfig := block.LaneConfig{
Logger: log.NewNopLogger(),
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
@ -85,7 +85,7 @@ func (suite *BlockBusterTestSuite) SetupTest() {
)
// Base lane set up
baseConfig := blockbuster.LaneConfig{
baseConfig := block.LaneConfig{
Logger: log.NewNopLogger(),
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
@ -97,8 +97,8 @@ func (suite *BlockBusterTestSuite) SetupTest() {
)
// Mempool set up
suite.lanes = []blockbuster.Lane{suite.mevLane, suite.freeLane, suite.baseLane}
suite.mempool = blockbuster.NewLanedMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
suite.lanes = []block.Lane{suite.mevLane, suite.freeLane, suite.baseLane}
suite.mempool = block.NewLanedMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
// Accounts set up
suite.accounts = testutils.RandomAccounts(suite.random, 10)

View File

@ -1,4 +1,4 @@
package blockbuster
package block
import (
"context"

View File

@ -1,4 +1,4 @@
package blockbuster
package block
import (
"crypto/sha256"
@ -7,7 +7,7 @@ import (
"cosmossdk.io/log"
"cosmossdk.io/math"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block/utils"
)
var _ BlockProposal = (*Proposal)(nil)

View File

@ -1,4 +1,4 @@
package blockbuster
package block
import (
"fmt"

View File

@ -5,7 +5,7 @@ package mocks
import (
context "context"
blockbuster "github.com/skip-mev/pob/blockbuster"
block "github.com/skip-mev/pob/block"
log "cosmossdk.io/log"
@ -152,23 +152,23 @@ func (_m *Lane) Name() string {
}
// 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) {
func (_m *Lane) PrepareLane(ctx types.Context, proposal block.BlockProposal, maxTxBytes int64, next block.PrepareLanesHandler) (block.BlockProposal, error) {
ret := _m.Called(ctx, proposal, maxTxBytes, next)
var r0 blockbuster.BlockProposal
var r0 block.BlockProposal
var r1 error
if rf, ok := ret.Get(0).(func(types.Context, blockbuster.BlockProposal, int64, blockbuster.PrepareLanesHandler) (blockbuster.BlockProposal, error)); ok {
if rf, ok := ret.Get(0).(func(types.Context, block.BlockProposal, int64, block.PrepareLanesHandler) (block.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 {
if rf, ok := ret.Get(0).(func(types.Context, block.BlockProposal, int64, block.PrepareLanesHandler) block.BlockProposal); ok {
r0 = rf(ctx, proposal, maxTxBytes, next)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(blockbuster.BlockProposal)
r0 = ret.Get(0).(block.BlockProposal)
}
}
if rf, ok := ret.Get(1).(func(types.Context, blockbuster.BlockProposal, int64, blockbuster.PrepareLanesHandler) error); ok {
if rf, ok := ret.Get(1).(func(types.Context, block.BlockProposal, int64, block.PrepareLanesHandler) error); ok {
r1 = rf(ctx, proposal, maxTxBytes, next)
} else {
r1 = ret.Error(1)
@ -178,21 +178,21 @@ func (_m *Lane) PrepareLane(ctx types.Context, proposal blockbuster.BlockProposa
}
// 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) {
func (_m *Lane) ProcessLane(ctx types.Context, proposalTxs []types.Tx, next block.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 {
if rf, ok := ret.Get(0).(func(types.Context, []types.Tx, block.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 {
if rf, ok := ret.Get(0).(func(types.Context, []types.Tx, block.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 {
if rf, ok := ret.Get(1).(func(types.Context, []types.Tx, block.ProcessLanesHandler) error); ok {
r1 = rf(ctx, proposalTxs, next)
} else {
r1 = ret.Error(1)
@ -237,7 +237,7 @@ func (_m *Lane) SetAnteHandler(antehander types.AnteHandler) {
}
// SetIgnoreList provides a mock function with given fields: ignoreList
func (_m *Lane) SetIgnoreList(ignoreList []blockbuster.Lane) {
func (_m *Lane) SetIgnoreList(ignoreList []block.Lane) {
_m.Called(ignoreList)
}

View File

@ -4,7 +4,7 @@ import (
"testing"
"cosmossdk.io/math"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block/utils"
)
func TestGetMaxTxBytesForLane(t *testing.T) {

View File

@ -8,8 +8,8 @@ import (
"cosmossdk.io/log"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils/mocks"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils/mocks"
"github.com/skip-mev/pob/lanes/base"
testutils "github.com/skip-mev/pob/testutils"
)
@ -41,7 +41,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
// Create a proposal
maxTxBytes := int64(len(txBz) - 1)
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is empty
@ -75,7 +75,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
// Create a proposal
maxTxBytes := int64(len(txBz))
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().Error(err)
// Ensure the proposal is empty
@ -109,7 +109,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
// Create a proposal
maxTxBytes := int64(len(txBz))
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is not empty and contains the transaction
@ -144,7 +144,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
s.Require().NoError(err)
maxTxBytes := int64(len(txBz))
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is empty
@ -196,7 +196,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
s.Require().NoError(err)
maxTxBytes := int64(len(txBz1)) + int64(len(txBz2))
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is ordered correctly
@ -245,7 +245,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
s.Require().NoError(err)
maxTxBytes := int64(len(txBz1)) + int64(len(txBz2))
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is ordered correctly
@ -294,7 +294,7 @@ func (s *BaseTestSuite) TestPrepareLane() {
s.Require().NoError(err)
maxTxBytes := int64(len(txBz1)) + int64(len(txBz2)) - 1
proposal, err := lane.PrepareLane(sdk.Context{}, blockbuster.NewProposal(maxTxBytes), maxTxBytes, blockbuster.NoOpPrepareLanesHandler())
proposal, err := lane.PrepareLane(sdk.Context{}, block.NewProposal(maxTxBytes), maxTxBytes, block.NoOpPrepareLanesHandler())
s.Require().NoError(err)
// Ensure the proposal is ordered correctly
@ -323,7 +323,7 @@ func (s *BaseTestSuite) TestProcessLane() {
tx1: true,
})
_, err = lane.ProcessLane(sdk.Context{}, proposal, blockbuster.NoOpProcessLanesHandler())
_, err = lane.ProcessLane(sdk.Context{}, proposal, block.NoOpProcessLanesHandler())
s.Require().NoError(err)
})
@ -345,7 +345,7 @@ func (s *BaseTestSuite) TestProcessLane() {
tx1: false,
})
_, err = lane.ProcessLane(sdk.Context{}, proposal, blockbuster.NoOpProcessLanesHandler())
_, err = lane.ProcessLane(sdk.Context{}, proposal, block.NoOpProcessLanesHandler())
s.Require().Error(err)
})
@ -389,7 +389,7 @@ func (s *BaseTestSuite) TestProcessLane() {
tx3: true,
})
_, err = lane.ProcessLane(sdk.Context{}, proposal, blockbuster.NoOpProcessLanesHandler())
_, err = lane.ProcessLane(sdk.Context{}, proposal, block.NoOpProcessLanesHandler())
s.Require().Error(err)
})
}
@ -487,7 +487,7 @@ func (s *BaseTestSuite) TestCheckOrder() {
mocklane.On("Match", sdk.Context{}, tx2).Return(false)
lane := s.initLane(math.LegacyMustNewDecFromStr("1"), nil)
lane.SetIgnoreList([]blockbuster.Lane{mocklane})
lane.SetIgnoreList([]block.Lane{mocklane})
proposal := []sdk.Tx{
tx1,
@ -502,7 +502,7 @@ func (s *BaseTestSuite) initLane(
maxBlockSpace math.LegacyDec,
expectedExecution map[sdk.Tx]bool,
) *base.DefaultLane {
config := blockbuster.NewBaseLaneConfig(
config := block.NewBaseLaneConfig(
log.NewTestLogger(s.T()),
s.encodingConfig.TxConfig.TxEncoder(),
s.encodingConfig.TxConfig.TxDecoder(),

View File

@ -1,8 +1,8 @@
package base
import (
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
)
const (
@ -10,7 +10,7 @@ const (
LaneName = "default"
)
var _ blockbuster.Lane = (*DefaultLane)(nil)
var _ block.Lane = (*DefaultLane)(nil)
// DefaultLane defines a default lane implementation. The default lane orders
// transactions by the transaction fees. The default lane accepts any transaction
@ -23,7 +23,7 @@ type DefaultLane struct {
}
// NewDefaultLane returns a new default lane.
func NewDefaultLane(cfg blockbuster.LaneConfig) *DefaultLane {
func NewDefaultLane(cfg block.LaneConfig) *DefaultLane {
lane := constructor.NewLaneConstructor[string](
cfg,
LaneName,

View File

@ -3,7 +3,7 @@ package base_test
import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block/constructor"
testutils "github.com/skip-mev/pob/testutils"
)

View File

@ -3,8 +3,8 @@ package free
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
)
const (
@ -12,7 +12,7 @@ const (
LaneName = "free"
)
var _ blockbuster.Lane = (*FreeLane)(nil)
var _ block.Lane = (*FreeLane)(nil)
// FreeLane defines the lane that is responsible for processing free transactions.
// By default, transactions that are staking related are considered free.
@ -22,9 +22,9 @@ type FreeLane struct {
// NewFreeLane returns a new free lane.
func NewFreeLane(
cfg blockbuster.LaneConfig,
txPriority blockbuster.TxPriority[string],
matchFn blockbuster.MatchHandler,
cfg block.LaneConfig,
txPriority block.TxPriority[string],
matchFn block.MatchHandler,
) *FreeLane {
lane := constructor.NewLaneConstructor[string](
cfg,
@ -45,7 +45,7 @@ func NewFreeLane(
// DefaultMatchHandler returns the default match handler for the free lane. The
// default implementation matches transactions that are staking related. In particular,
// any transaction that is a MsgDelegate, MsgBeginRedelegate, or MsgCancelUnbondingDelegation.
func DefaultMatchHandler() blockbuster.MatchHandler {
func DefaultMatchHandler() block.MatchHandler {
return func(ctx sdk.Context, tx sdk.Tx) bool {
for _, msg := range tx.GetMsgs() {
switch msg.(type) {

View File

@ -5,8 +5,8 @@ import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
"github.com/skip-mev/pob/x/builder/types"
)
@ -14,8 +14,8 @@ import (
// and whose bundled transactions are valid and include them in the proposal. It
// will return no transactions if no valid bids are found. If any of the bids are invalid,
// it will return them and will only remove the bids and not the bundled transactions.
func (l *MEVLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
return func(ctx sdk.Context, proposal blockbuster.BlockProposal, maxTxBytes int64) ([][]byte, []sdk.Tx, error) {
func (l *MEVLane) PrepareLaneHandler() block.PrepareLaneHandler {
return func(ctx sdk.Context, proposal block.BlockProposal, maxTxBytes int64) ([][]byte, []sdk.Tx, error) {
// Define all of the info we need to select transactions for the partial proposal.
var (
txs [][]byte
@ -147,7 +147,7 @@ func (l *MEVLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
// ProcessLaneHandler will ensure that block proposals that include transactions from
// the mev lane are valid.
func (l *MEVLane) ProcessLaneHandler() blockbuster.ProcessLaneHandler {
func (l *MEVLane) ProcessLaneHandler() block.ProcessLaneHandler {
return func(ctx sdk.Context, txs []sdk.Tx) ([]sdk.Tx, error) {
if len(txs) == 0 {
return txs, nil
@ -178,7 +178,7 @@ func (l *MEVLane) ProcessLaneHandler() blockbuster.ProcessLaneHandler {
// - there are no other bid transactions in the proposal
// - transactions from other lanes are not interleaved with transactions from the bid
// transaction.
func (l *MEVLane) CheckOrderHandler() blockbuster.CheckOrderHandler {
func (l *MEVLane) CheckOrderHandler() block.CheckOrderHandler {
return func(ctx sdk.Context, txs []sdk.Tx) error {
if len(txs) == 0 {
return nil

View File

@ -5,7 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/x/builder/types"
)
@ -24,7 +24,7 @@ type (
GetAuctionBidInfo(tx sdk.Tx) (*types.BidInfo, error)
// MatchHandler defines a function that checks if a transaction matches the auction lane.
MatchHandler() blockbuster.MatchHandler
MatchHandler() block.MatchHandler
}
// DefaultAuctionFactory defines a default implmentation for the auction factory interface for processing auction transactions.
@ -95,7 +95,7 @@ func (config *DefaultAuctionFactory) GetAuctionBidInfo(tx sdk.Tx) (*types.BidInf
}, nil
}
func (config *DefaultAuctionFactory) MatchHandler() blockbuster.MatchHandler {
func (config *DefaultAuctionFactory) MatchHandler() block.MatchHandler {
return func(ctx sdk.Context, tx sdk.Tx) bool {
bidInfo, err := config.GetAuctionBidInfo(tx)
return bidInfo != nil && err == nil

View File

@ -4,8 +4,8 @@ import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
)
const (
@ -27,7 +27,7 @@ type (
// MEVLaneI defines the interface for the mev auction lane. This interface
// is utilized by both the x/builder module and the checkTx handler.
MEVLaneI interface {
blockbuster.Lane
block.Lane
Factory
GetTopAuctionTx(ctx context.Context) sdk.Tx
}
@ -45,7 +45,7 @@ type (
// NewMEVLane returns a new TOB lane.
func NewMEVLane(
cfg blockbuster.LaneConfig,
cfg block.LaneConfig,
factory Factory,
) *MEVLane {
lane := &MEVLane{

View File

@ -4,13 +4,13 @@ import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/block"
)
// TxPriority returns a TxPriority over mev lane transactions only. It
// is to be used in the mev index only.
func TxPriority(config Factory) blockbuster.TxPriority[string] {
return blockbuster.TxPriority[string]{
func TxPriority(config Factory) block.TxPriority[string] {
return block.TxPriority[string]{
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
bidInfo, err := config.GetAuctionBidInfo(tx)
if err != nil {

View File

@ -7,7 +7,7 @@ import (
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/block"
)
const (
@ -36,10 +36,10 @@ const (
// snd \ \ \ /
type Terminator struct{}
var _ blockbuster.Lane = (*Terminator)(nil)
var _ block.Lane = (*Terminator)(nil)
// PrepareLane is a no-op
func (t Terminator) PrepareLane(_ sdk.Context, proposal blockbuster.BlockProposal, _ int64, _ blockbuster.PrepareLanesHandler) (blockbuster.BlockProposal, error) {
func (t Terminator) PrepareLane(_ sdk.Context, proposal block.BlockProposal, _ int64, _ block.PrepareLanesHandler) (block.BlockProposal, error) {
return proposal, nil
}
@ -49,7 +49,7 @@ func (t Terminator) CheckOrder(sdk.Context, []sdk.Tx) error {
}
// ProcessLane is a no-op
func (t Terminator) ProcessLane(ctx sdk.Context, _ []sdk.Tx, _ blockbuster.ProcessLanesHandler) (sdk.Context, error) {
func (t Terminator) ProcessLane(ctx sdk.Context, _ []sdk.Tx, _ block.ProcessLanesHandler) (sdk.Context, error) {
return ctx, nil
}
@ -72,7 +72,7 @@ func (t Terminator) Name() string {
func (t Terminator) SetAnteHandler(sdk.AnteHandler) {}
// SetIgnoreList is a no-op
func (t Terminator) SetIgnoreList([]blockbuster.Lane) {}
func (t Terminator) SetIgnoreList([]block.Lane) {}
// Match is a no-op
func (t Terminator) Match(sdk.Context, sdk.Tx) bool {

View File

@ -3,20 +3,20 @@ package app
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/utils"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/utils"
builderante "github.com/skip-mev/pob/x/builder/ante"
builderkeeper "github.com/skip-mev/pob/x/builder/keeper"
)
type POBHandlerOptions struct {
BaseOptions ante.HandlerOptions
Mempool blockbuster.Mempool
Mempool block.Mempool
MEVLane builderante.MEVLane
TxDecoder sdk.TxDecoder
TxEncoder sdk.TxEncoder
BuilderKeeper builderkeeper.Keeper
FreeLane blockbuster.Lane
FreeLane block.Lane
}
// NewPOBAnteHandler wraps all of the default Cosmos SDK AnteDecorators with the POB AnteHandler.

View File

@ -62,8 +62,8 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/skip-mev/pob/abci"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/blockbuster/constructor"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/block/constructor"
"github.com/skip-mev/pob/lanes/base"
"github.com/skip-mev/pob/lanes/free"
"github.com/skip-mev/pob/lanes/mev"
@ -263,7 +263,7 @@ 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.
mevConfig := blockbuster.LaneConfig{
mevConfig := block.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
@ -276,7 +276,7 @@ func New(
)
// Free lane allows transactions to be included in the next block for free.
freeConfig := blockbuster.LaneConfig{
freeConfig := block.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
@ -290,7 +290,7 @@ func New(
)
// Default lane accepts all other transactions.
defaultConfig := blockbuster.LaneConfig{
defaultConfig := block.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
@ -300,12 +300,12 @@ func New(
defaultLane := base.NewDefaultLane(defaultConfig)
// Set the lanes into the mempool.
lanes := []blockbuster.Lane{
lanes := []block.Lane{
mevLane,
freeLane,
defaultLane,
}
mempool := blockbuster.NewLanedMempool(app.Logger(), true, lanes...)
mempool := block.NewLanedMempool(app.Logger(), true, lanes...)
app.App.SetMempool(mempool)
// Create a global ante handler that will be called on each transaction when

View File

@ -11,7 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/golang/mock/gomock"
"github.com/skip-mev/pob/blockbuster"
"github.com/skip-mev/pob/block"
"github.com/skip-mev/pob/lanes/base"
"github.com/skip-mev/pob/lanes/mev"
testutils "github.com/skip-mev/pob/testutils"
@ -39,10 +39,10 @@ type AnteTestSuite struct {
authorityAccount sdk.AccAddress
// mempool and lane set up
mempool blockbuster.Mempool
mempool block.Mempool
mevLane *mev.MEVLane
baseLane *base.DefaultLane
lanes []blockbuster.Lane
lanes []block.Lane
// Account set up
balance sdk.Coin
@ -83,7 +83,7 @@ func (suite *AnteTestSuite) SetupTest() {
// Lanes configuration
//
// TOB lane set up
mevConfig := blockbuster.LaneConfig{
mevConfig := block.LaneConfig{
Logger: suite.ctx.Logger(),
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
@ -96,19 +96,19 @@ func (suite *AnteTestSuite) SetupTest() {
)
// Base lane set up
baseConfig := blockbuster.LaneConfig{
baseConfig := block.LaneConfig{
Logger: suite.ctx.Logger(),
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
AnteHandler: suite.anteHandler,
MaxBlockSpace: math.LegacyZeroDec(),
IgnoreList: []blockbuster.Lane{suite.mevLane},
IgnoreList: []block.Lane{suite.mevLane},
}
suite.baseLane = base.NewDefaultLane(baseConfig)
// Mempool set up
suite.lanes = []blockbuster.Lane{suite.mevLane, suite.baseLane}
suite.mempool = blockbuster.NewLanedMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
suite.lanes = []block.Lane{suite.mevLane, suite.baseLane}
suite.mempool = block.NewLanedMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
}
func (suite *AnteTestSuite) anteHandler(ctx sdk.Context, tx sdk.Tx, _ bool) (sdk.Context, error) {