rename tob lane to mev lane
This commit is contained in:
parent
e9dd8259eb
commit
b2daf5acbb
12
README.md
12
README.md
@ -70,7 +70,7 @@ $ go install github.com/skip-mev/pob
|
||||
...
|
||||
"github.com/skip-mev/pob/blockbuster"
|
||||
"github.com/skip-mev/pob/blockbuster/abci"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/base"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/free"
|
||||
buildermodule "github.com/skip-mev/pob/x/builder"
|
||||
@ -82,7 +82,7 @@ $ go install github.com/skip-mev/pob
|
||||
2. Add your module to the the `AppModuleBasic` manager. This manager is in
|
||||
charge of setting up basic, non-dependent module elements such as codec
|
||||
registration and genesis verification. This will register the special
|
||||
`MsgAuctionBid` message. When users want to bid for top of block execution,
|
||||
`MsgAuctionBid` message. When users want to bid for MEV execution,
|
||||
they will submit a transaction - which we call an auction transaction - that
|
||||
includes a single `MsgAuctionBid`. We prevent any other messages from being
|
||||
included in auction transaction to prevent malicious behavior - such as front
|
||||
@ -99,7 +99,7 @@ $ go install github.com/skip-mev/pob
|
||||
```
|
||||
|
||||
3. The builder `Keeper` is POB's gateway to processing special `MsgAuctionBid`
|
||||
messages that allow users to participate in the top of block auction, distribute
|
||||
messages that allow users to participate in the MEV auction, distribute
|
||||
revenue to the auction house, and ensure the validity of auction transactions.
|
||||
|
||||
a. First add the keeper to the app's struct definition. We also want to add POB's custom
|
||||
@ -148,7 +148,7 @@ $ go install github.com/skip-mev/pob
|
||||
// indicates that the lane can use all available block space.
|
||||
MaxBlockSpace: sdk.ZeroDec(),
|
||||
}
|
||||
tobLane := auction.NewTOBLane(
|
||||
tobLane := auction.NewMEVLane(
|
||||
tobConfig,
|
||||
// the maximum number of transactions that the mempool can store. a value of 0 indicates
|
||||
// that the mempool can store an unlimited number of transactions.
|
||||
@ -233,7 +233,7 @@ $ go install github.com/skip-mev/pob
|
||||
options.FreeLane,
|
||||
),
|
||||
...
|
||||
builderante.NewBuilderDecorator(options.BuilderKeeper, options.TxEncoder, options.TOBLane, options.Mempool),
|
||||
builderante.NewBuilderDecorator(options.BuilderKeeper, options.TxEncoder, options.MEVLane, options.Mempool),
|
||||
}
|
||||
|
||||
anteHandler := sdk.ChainAnteDecorators(anteDecorators...)
|
||||
@ -280,7 +280,7 @@ $ go install github.com/skip-mev/pob
|
||||
will verify the contents of the block proposal by all validators. The
|
||||
combination of the `BlockBuster` mempool + `PrepareProposal`/`ProcessProposal`
|
||||
handlers allows the application to verifiably build valid blocks with
|
||||
top-of-block block space reserved for auctions and partial block for free transactions.
|
||||
mev block space reserved for auctions and partial block for free transactions.
|
||||
Additionally, we override the `BaseApp`'s `CheckTx` handler with our own custom
|
||||
`CheckTx` handler that will be responsible for checking the validity of transactions.
|
||||
We override the `CheckTx` handler so that we can verify auction transactions before they are
|
||||
|
||||
10
SPEC.md
10
SPEC.md
@ -4,11 +4,11 @@
|
||||
## Abstract
|
||||
|
||||
The `x/builder` module is a Cosmos SDK module that allows Cosmos chains to host
|
||||
top-of-block auctions directly in-protocol with auction revenue (MEV) being
|
||||
mev auctions directly in-protocol with auction revenue (MEV) being
|
||||
redistributed according to the preferences of the chain. The `x/builder` module
|
||||
introduces a new `MsgAuctionBid` message that allows users to submit a bid
|
||||
alongside an ordered list of transactions, i.e. a **bundle**, that they want
|
||||
executed at top-of-block before any other transactions are executed for that
|
||||
executed at mev before any other transactions are executed for that
|
||||
block. The `x/builder` module works alongside the `AuctionMempool` such that:
|
||||
|
||||
* Auctions are held directly in the `AuctionMempool`, where a winner is determined
|
||||
@ -169,7 +169,7 @@ Then, it will build the rest of the block by reaping and validating the transact
|
||||
in the global index. The second portion of block building iterates from highest
|
||||
to lowest priority transactions in the global index and adds them to the proposal
|
||||
if they are valid. If the proposer comes across a transaction that was already
|
||||
included in the top of block, it will be ignored.
|
||||
included in the MEV, it will be ignored.
|
||||
|
||||
### ProcessProposal
|
||||
|
||||
@ -183,7 +183,7 @@ transactions in the block in the order in which they were provided in the propos
|
||||
|
||||
### Ante Handler
|
||||
|
||||
When users want to bid for the rights for top-of-block execution they will submit
|
||||
When users want to bid for the rights for mev execution they will submit
|
||||
a normal `sdk.Tx` transaction with a single `MsgAuctionBid`. The ante handler is
|
||||
responsible for verification of this transaction. The ante handler will verify that:
|
||||
|
||||
@ -253,7 +253,7 @@ message Params {
|
||||
### MsgAuctionBid
|
||||
|
||||
POB defines a new Cosmos SDK `Message`, `MsgAuctionBid`, that allows users to
|
||||
create an auction bid and participate in a top-of-block auction. The `MsgAuctionBid`
|
||||
create an auction bid and participate in a mev auction. The `MsgAuctionBid`
|
||||
message defines a bidder and a series of embedded transactions, i.e. the bundle.
|
||||
|
||||
```protobuf
|
||||
|
||||
@ -29,8 +29,8 @@ together define the desired block structure of a chain.
|
||||
|
||||
A mempool with separate `lanes` can be used for:
|
||||
|
||||
1. **MEV mitigation**: a top of block lane could be designed to create an
|
||||
in-protocol top-of-block auction (as we are doing with POB) to recapture MEV
|
||||
1. **MEV mitigation**: a MEV lane could be designed to create an
|
||||
in-protocol mev auction (as we are doing with POB) to recapture MEV
|
||||
in a transparent and governable way.
|
||||
2. **Free/reduced fee txs**: transactions with certain properties (e.g.
|
||||
from trusted accounts or performing encouraged actions) could leverage a
|
||||
@ -63,7 +63,7 @@ desired lanes and their configurations (including lane ordering).
|
||||
Utilizing BlockBuster is a simple three step process:
|
||||
|
||||
* Determine the lanes desired. Currently, POB supports three different
|
||||
implementations of lanes: top of block lane, free lane, and a default lane.
|
||||
implementations of lanes: MEV lane, free lane, and a default lane.
|
||||
1. Top of block lane allows the top of every block to be auctioned off
|
||||
and constructed using logic defined by the `x/builder` module.
|
||||
2. Free lane allows base app to not charge certain types of transactions
|
||||
@ -111,7 +111,7 @@ three lanes:
|
||||
#### Preparing Proposals
|
||||
|
||||
When the current proposer starts building a block, it will first populate the
|
||||
proposal with transactions from the top of block lane, followed by free and
|
||||
proposal with transactions from the MEV lane, followed by free and
|
||||
default lane. Each lane proposes its own set of transactions using the lane’s
|
||||
`PrepareLane` (analogous to `PrepareProposal`). Each lane has a limit on the
|
||||
relative percentage of total block space that the lane can consume.
|
||||
@ -131,7 +131,7 @@ order relative to the ordering of lanes will be rejected. Following the
|
||||
example defined above, if a proposal contains the following transactions:
|
||||
|
||||
1. Default transaction (belonging to the default lane)
|
||||
2. Top of block transaction (belonging to the top of block lane)
|
||||
2. Top of block transaction (belonging to the MEV lane)
|
||||
3. Free transaction (belonging to the free lane)
|
||||
|
||||
It will be rejected because it does not respect the lane ordering.
|
||||
@ -221,7 +221,7 @@ Transactions within a lane are ordered in a proposal respecting the ordering
|
||||
defined on the lane’s mempool. Developers can define their own custom ordering
|
||||
by implementing a custom `TxPriority` struct that allows the lane’s mempool to
|
||||
determine the priority of a transaction `GetTxPriority` and relatively order
|
||||
two transactions given the priority `Compare`. The top of block lane includes
|
||||
two transactions given the priority `Compare`. The MEV lane includes
|
||||
an custom `TxPriority` that orders transactions in the mempool based on their
|
||||
bid.
|
||||
|
||||
@ -323,14 +323,14 @@ func (config *DefaultFreeFactory) IsFreeTx(tx sdk.Tx) bool {
|
||||
Lanes must implement a `Match` interface which determines whether a transaction
|
||||
should be considered for a given lane. Developer’s are encouraged to utilize the
|
||||
same interfaces defined in the `Factory` to match transactions to lanes. For
|
||||
example, developers might configure a top of block auction lane to accept
|
||||
example, developers might configure a MEV auction lane to accept
|
||||
transactions if they contain a single `MsgAuctionBid` message in the transaction.
|
||||
|
||||
### 4.1. [Optional] Transaction Validation
|
||||
|
||||
Transactions will be verified the lane’s `VerifyTx` function. This logic can be
|
||||
completely arbitrary. For example, the default lane verifies transactions
|
||||
using base app’s `AnteHandler` while the top of block lane verifies transactions
|
||||
using base app’s `AnteHandler` while the MEV lane verifies transactions
|
||||
by extracting all bundled transactions included in the bid transaction and then
|
||||
verifying the transaction iteratively given the bundle.
|
||||
|
||||
|
||||
@ -15,9 +15,9 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/skip-mev/pob/blockbuster"
|
||||
"github.com/skip-mev/pob/blockbuster/abci"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/base"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/free"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
@ -167,10 +167,10 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
})
|
||||
|
||||
s.Run("can build a proposal an empty proposal with multiple lanes", func() {
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{})
|
||||
s.Require().NoError(err)
|
||||
@ -192,15 +192,15 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Set up the TOB lane with the bid tx and the bundled tx
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
tx: true,
|
||||
bundleTxs[0]: true,
|
||||
})
|
||||
s.Require().NoError(tobLane.Insert(sdk.Context{}, tx))
|
||||
s.Require().NoError(mevLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
|
||||
s.Require().NoError(err)
|
||||
@ -224,11 +224,11 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Set up the TOB lane with the bid tx and the bundled tx
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
tx: true,
|
||||
bundleTxs[0]: true,
|
||||
})
|
||||
s.Require().NoError(tobLane.Insert(sdk.Context{}, tx))
|
||||
s.Require().NoError(mevLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
// Set up the default lane with the bid tx and the bundled tx
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
@ -238,7 +238,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{tobLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
|
||||
s.Require().NoError(err)
|
||||
@ -262,11 +262,11 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Set up the TOB lane with the bid tx and the bundled tx
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
tx: false,
|
||||
bundleTxs[0]: true,
|
||||
})
|
||||
s.Require().NoError(tobLane.Insert(sdk.Context{}, tx))
|
||||
s.Require().NoError(mevLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
// Set up the default lane with the bid tx and the bundled tx
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
@ -277,7 +277,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{tobLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestPrepareProposal{MaxTxBytes: 10000000000})
|
||||
s.Require().NoError(err)
|
||||
@ -301,11 +301,11 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Set up the TOB lane with the bid tx and the bundled tx
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), map[sdk.Tx]bool{
|
||||
tx: true,
|
||||
bundleTxs[0]: true,
|
||||
})
|
||||
s.Require().NoError(tobLane.Insert(sdk.Context{}, tx))
|
||||
s.Require().NoError(mevLane.Insert(sdk.Context{}, tx))
|
||||
|
||||
// Set up the default lane with the bid tx and the bundled tx
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.0"), map[sdk.Tx]bool{
|
||||
@ -316,7 +316,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{tobLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, defaultLane}).PrepareProposalHandler()
|
||||
proposal := s.getTxBytes(tx, bundleTxs[0])
|
||||
size := int64(len(proposal[0]) - 1)
|
||||
|
||||
@ -329,7 +329,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
})
|
||||
|
||||
s.Run("can build a proposal with single tx from middle lane", func() {
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), nil)
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), nil)
|
||||
|
||||
freeTx, err := testutils.CreateFreeTx(
|
||||
s.encodingConfig.TxConfig,
|
||||
@ -352,7 +352,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
})
|
||||
s.Require().NoError(freeLane.Insert(sdk.Context{}, freeTx))
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, freeLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).PrepareProposalHandler()
|
||||
|
||||
proposal := s.getTxBytes(freeTx)
|
||||
|
||||
@ -399,14 +399,14 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{
|
||||
tx: true,
|
||||
bundleTxs[0]: true,
|
||||
bundleTxs[1]: true,
|
||||
bundleTxs[2]: true,
|
||||
bundleTxs[3]: true,
|
||||
})
|
||||
tobLane.Insert(sdk.Context{}, tx)
|
||||
mevLane.Insert(sdk.Context{}, tx)
|
||||
|
||||
defaultLane := s.setUpDefaultLane(math.LegacyMustNewDecFromStr("0.0"), map[sdk.Tx]bool{
|
||||
normalTx: true,
|
||||
@ -418,7 +418,7 @@ func (s *ProposalsTestSuite) TestPrepareProposal() {
|
||||
})
|
||||
freeLane.Insert(sdk.Context{}, freeTx)
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, freeLane, defaultLane}).PrepareProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.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})
|
||||
@ -568,11 +568,11 @@ func (s *ProposalsTestSuite) TestPrepareProposalEdgeCases() {
|
||||
|
||||
func (s *ProposalsTestSuite) TestProcessProposal() {
|
||||
s.Run("can process a valid empty proposal", func() {
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
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{tobLane, freeLane, defaultLane}).ProcessProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: nil})
|
||||
s.Require().NoError(err)
|
||||
@ -581,11 +581,11 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
|
||||
})
|
||||
|
||||
s.Run("rejects a proposal with bad txs", func() {
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
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{tobLane, freeLane, defaultLane}).ProcessProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{mevLane, freeLane, defaultLane}).ProcessProposalHandler()
|
||||
|
||||
resp, err := proposalHandler(s.ctx, &cometabci.RequestProcessProposal{Txs: [][]byte{{0x01, 0x02, 0x03}}})
|
||||
s.Require().Error(err)
|
||||
@ -593,7 +593,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
|
||||
})
|
||||
|
||||
s.Run("rejects a proposal when a lane panics", func() {
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.25"), map[sdk.Tx]bool{})
|
||||
panicLane := s.setUpPanicLane(math.LegacyMustNewDecFromStr("0.0"))
|
||||
|
||||
txbz, err := testutils.CreateRandomTxBz(
|
||||
@ -605,7 +605,7 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, panicLane}).ProcessProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.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)
|
||||
@ -680,10 +680,10 @@ func (s *ProposalsTestSuite) TestProcessProposal() {
|
||||
defaultLane.SetProcessLaneHandler(blockbuster.NoOpProcessLaneHandler())
|
||||
|
||||
// Set up the TOB lane
|
||||
tobLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
tobLane.SetProcessLaneHandler(blockbuster.NoOpProcessLaneHandler())
|
||||
mevLane := s.setUpTOBLane(math.LegacyMustNewDecFromStr("0.5"), nil)
|
||||
mevLane.SetProcessLaneHandler(blockbuster.NoOpProcessLaneHandler())
|
||||
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.Lane{tobLane, defaultLane}).ProcessProposalHandler()
|
||||
proposalHandler := s.setUpProposalHandlers([]blockbuster.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)
|
||||
@ -735,7 +735,7 @@ func (s *ProposalsTestSuite) setUpDefaultLane(maxBlockSpace math.LegacyDec, expe
|
||||
return base.NewDefaultLane(cfg)
|
||||
}
|
||||
|
||||
func (s *ProposalsTestSuite) setUpTOBLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *auction.TOBLane {
|
||||
func (s *ProposalsTestSuite) setUpTOBLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *mev.MEVLane {
|
||||
cfg := blockbuster.LaneConfig{
|
||||
Logger: log.NewTestLogger(s.T()),
|
||||
TxEncoder: s.encodingConfig.TxConfig.TxEncoder(),
|
||||
@ -744,7 +744,7 @@ func (s *ProposalsTestSuite) setUpTOBLane(maxBlockSpace math.LegacyDec, expected
|
||||
MaxBlockSpace: maxBlockSpace,
|
||||
}
|
||||
|
||||
return auction.NewTOBLane(cfg, auction.NewDefaultAuctionFactory(cfg.TxDecoder))
|
||||
return mev.NewMEVLane(cfg, mev.NewDefaultAuctionFactory(cfg.TxDecoder))
|
||||
}
|
||||
|
||||
func (s *ProposalsTestSuite) setUpFreeLane(maxBlockSpace math.LegacyDec, expectedExecution map[sdk.Tx]bool) *free.FreeLane {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@ -14,7 +14,7 @@ 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 *TOBLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
|
||||
func (l *MEVLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
|
||||
return func(ctx sdk.Context, proposal blockbuster.BlockProposal, maxTxBytes int64) ([][]byte, []sdk.Tx, error) {
|
||||
// Define all of the info we need to select transactions for the partial proposal.
|
||||
var (
|
||||
@ -128,7 +128,7 @@ func (l *TOBLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
|
||||
txs = append(txs, bundledTxBz...)
|
||||
|
||||
// Write the cache context to the original context when we know we have a
|
||||
// valid top of block bundle.
|
||||
// valid bundle.
|
||||
write()
|
||||
|
||||
break selectBidTxLoop
|
||||
@ -146,8 +146,8 @@ func (l *TOBLane) PrepareLaneHandler() blockbuster.PrepareLaneHandler {
|
||||
}
|
||||
|
||||
// ProcessLaneHandler will ensure that block proposals that include transactions from
|
||||
// the top-of-block auction lane are valid.
|
||||
func (l *TOBLane) ProcessLaneHandler() blockbuster.ProcessLaneHandler {
|
||||
// the mev lane are valid.
|
||||
func (l *MEVLane) ProcessLaneHandler() blockbuster.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 *TOBLane) 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 *TOBLane) CheckOrderHandler() blockbuster.CheckOrderHandler {
|
||||
func (l *MEVLane) CheckOrderHandler() blockbuster.CheckOrderHandler {
|
||||
return func(ctx sdk.Context, txs []sdk.Tx) error {
|
||||
if len(txs) == 0 {
|
||||
return nil
|
||||
@ -241,7 +241,7 @@ func (l *TOBLane) CheckOrderHandler() blockbuster.CheckOrderHandler {
|
||||
// VerifyTx will verify that the bid transaction and all of its bundled
|
||||
// transactions are valid. It will return an error if any of the transactions
|
||||
// are invalid.
|
||||
func (l *TOBLane) VerifyTx(ctx sdk.Context, bidTx sdk.Tx, bidInfo *types.BidInfo) (err error) {
|
||||
func (l *MEVLane) VerifyTx(ctx sdk.Context, bidTx sdk.Tx, bidInfo *types.BidInfo) (err error) {
|
||||
if bidInfo == nil {
|
||||
return fmt.Errorf("bid info is nil")
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -26,9 +26,9 @@ type (
|
||||
// bid transactions.
|
||||
txDecoder sdk.TxDecoder
|
||||
|
||||
// TOBLane is utilized to retrieve the bid info of a transaction and to
|
||||
// MEVLane is utilized to retrieve the bid info of a transaction and to
|
||||
// insert a bid transaction into the application-side mempool.
|
||||
tobLane TOBLaneI
|
||||
mevLane MEVLaneI
|
||||
|
||||
// anteHandler is utilized to verify the bid transaction against the latest
|
||||
// committed state.
|
||||
@ -67,13 +67,13 @@ type (
|
||||
func NewCheckTxHandler(
|
||||
baseApp BaseApp,
|
||||
txDecoder sdk.TxDecoder,
|
||||
tobLane TOBLaneI,
|
||||
mevLane MEVLaneI,
|
||||
anteHandler sdk.AnteHandler,
|
||||
) *CheckTxHandler {
|
||||
return &CheckTxHandler{
|
||||
baseApp: baseApp,
|
||||
txDecoder: txDecoder,
|
||||
tobLane: tobLane,
|
||||
mevLane: mevLane,
|
||||
anteHandler: anteHandler,
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ func (handler *CheckTxHandler) CheckTx() CheckTx {
|
||||
}
|
||||
|
||||
// Attempt to get the bid info of the transaction.
|
||||
bidInfo, err := handler.tobLane.GetAuctionBidInfo(tx)
|
||||
bidInfo, err := handler.mevLane.GetAuctionBidInfo(tx)
|
||||
if err != nil {
|
||||
handler.baseApp.Logger().Info(
|
||||
"failed to get auction bid info",
|
||||
@ -173,7 +173,7 @@ func (handler *CheckTxHandler) CheckTx() CheckTx {
|
||||
}
|
||||
|
||||
// If the bid transaction is valid, we know we can insert it into the mempool for consideration in the next block.
|
||||
if err := handler.tobLane.Insert(ctx, tx); err != nil {
|
||||
if err := handler.mevLane.Insert(ctx, tx); err != nil {
|
||||
handler.baseApp.Logger().Info(
|
||||
"invalid bid tx; failed to insert bid transaction into mempool",
|
||||
"err", err,
|
||||
@ -212,13 +212,13 @@ func (handler *CheckTxHandler) ValidateBidTx(ctx sdk.Context, bidTx sdk.Tx, bidI
|
||||
|
||||
// Verify all of the bundled transactions.
|
||||
for _, tx := range bidInfo.Transactions {
|
||||
bundledTx, err := handler.tobLane.WrapBundleTransaction(tx)
|
||||
bundledTx, err := handler.mevLane.WrapBundleTransaction(tx)
|
||||
if err != nil {
|
||||
return gasInfo, fmt.Errorf("invalid bid tx; failed to decode bundled tx: %w", err)
|
||||
}
|
||||
|
||||
// bid txs cannot be included in bundled txs
|
||||
bidInfo, _ := handler.tobLane.GetAuctionBidInfo(bundledTx)
|
||||
bidInfo, _ := handler.mevLane.GetAuctionBidInfo(bundledTx)
|
||||
if bidInfo != nil {
|
||||
return gasInfo, fmt.Errorf("invalid bid tx; bundled tx cannot be a bid tx")
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -1,4 +1,4 @@
|
||||
package auction_test
|
||||
package mev_test
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
@ -8,7 +8,7 @@ import (
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
)
|
||||
|
||||
func (suite *IntegrationTestSuite) TestIsAuctionTx() {
|
||||
func (suite *MEVTestSuite) TestIsAuctionTx() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() sdk.Tx
|
||||
@ -92,7 +92,7 @@ func (suite *IntegrationTestSuite) TestIsAuctionTx() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestGetTransactionSigners() {
|
||||
func (suite *MEVTestSuite) TestGetTransactionSigners() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() sdk.Tx
|
||||
@ -176,7 +176,7 @@ func (suite *IntegrationTestSuite) TestGetTransactionSigners() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestWrapBundleTransaction() {
|
||||
func (suite *MEVTestSuite) TestWrapBundleTransaction() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createBundleTx func() (sdk.Tx, []byte)
|
||||
@ -229,7 +229,7 @@ func (suite *IntegrationTestSuite) TestWrapBundleTransaction() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestGetBidder() {
|
||||
func (suite *MEVTestSuite) TestGetBidder() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() sdk.Tx
|
||||
@ -304,7 +304,7 @@ func (suite *IntegrationTestSuite) TestGetBidder() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestGetBid() {
|
||||
func (suite *MEVTestSuite) TestGetBid() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() sdk.Tx
|
||||
@ -379,7 +379,7 @@ func (suite *IntegrationTestSuite) TestGetBid() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestGetBundledTransactions() {
|
||||
func (suite *MEVTestSuite) TestGetBundledTransactions() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() (sdk.Tx, [][]byte)
|
||||
@ -450,7 +450,7 @@ func (suite *IntegrationTestSuite) TestGetBundledTransactions() {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) TestGetTimeout() {
|
||||
func (suite *MEVTestSuite) TestGetTimeout() {
|
||||
testCases := []struct {
|
||||
name string
|
||||
createTx func() sdk.Tx
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -8,30 +8,30 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// LaneName defines the name of the top-of-block auction lane.
|
||||
LaneName = "top-of-block"
|
||||
// LaneName defines the name of the mev lane.
|
||||
LaneName = "mev"
|
||||
)
|
||||
|
||||
var (
|
||||
_ TOBLaneI = (*TOBLane)(nil)
|
||||
_ MEVLaneI = (*MEVLane)(nil)
|
||||
)
|
||||
|
||||
// TOBLane defines a top-of-block auction lane. The top of block auction lane
|
||||
// MEVLane defines a MEV (Maximal Extracted Value) auction lane. The MEV auction lane
|
||||
// hosts transactions that want to bid for inclusion at the top of the next block.
|
||||
// The top of block auction lane stores bid transactions that are sorted by
|
||||
// their bid price. The highest valid bid transaction is selected for inclusion in the
|
||||
// next block. The bundled transactions of the selected bid transaction are also
|
||||
// included in the next block.
|
||||
// The MEV auction lane stores bid transactions that are sorted by their bid price.
|
||||
// The highest valid bid transaction is selected for inclusion in the next block.
|
||||
// The bundled transactions of the selected bid transaction are also included in the
|
||||
// next block.
|
||||
type (
|
||||
// TOBLaneI defines the interface for the top-of-block auction lane. This interface
|
||||
// MEVLaneI defines the interface for the mev auction lane. This interface
|
||||
// is utilized by both the x/builder module and the checkTx handler.
|
||||
TOBLaneI interface {
|
||||
MEVLaneI interface {
|
||||
blockbuster.Lane
|
||||
Factory
|
||||
GetTopAuctionTx(ctx context.Context) sdk.Tx
|
||||
}
|
||||
|
||||
TOBLane struct {
|
||||
MEVLane struct {
|
||||
// LaneConfig defines the base lane configuration.
|
||||
*blockbuster.LaneConstructor[string]
|
||||
|
||||
@ -42,12 +42,12 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// NewTOBLane returns a new TOB lane.
|
||||
func NewTOBLane(
|
||||
// NewMEVLane returns a new TOB lane.
|
||||
func NewMEVLane(
|
||||
cfg blockbuster.LaneConfig,
|
||||
factory Factory,
|
||||
) *TOBLane {
|
||||
lane := &TOBLane{
|
||||
) *MEVLane {
|
||||
lane := &MEVLane{
|
||||
LaneConstructor: blockbuster.NewLaneConstructor[string](
|
||||
cfg,
|
||||
LaneName,
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"github.com/skip-mev/pob/blockbuster"
|
||||
)
|
||||
|
||||
// TxPriority returns a TxPriority over auction bid transactions only. It
|
||||
// is to be used in the auction index only.
|
||||
// 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]{
|
||||
GetTxPriority: func(goCtx context.Context, tx sdk.Tx) string {
|
||||
@ -52,7 +52,7 @@ func TxPriority(config Factory) blockbuster.TxPriority[string] {
|
||||
|
||||
// GetTopAuctionTx returns the highest bidding transaction in the auction mempool.
|
||||
// This is primarily a helper function for the x/builder module.
|
||||
func (l *TOBLane) GetTopAuctionTx(ctx context.Context) sdk.Tx {
|
||||
func (l *MEVLane) GetTopAuctionTx(ctx context.Context) sdk.Tx {
|
||||
iterator := l.Select(ctx, nil)
|
||||
if iterator == nil {
|
||||
return nil
|
||||
@ -1,4 +1,4 @@
|
||||
package auction_test
|
||||
package mev_test
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
@ -8,16 +8,16 @@ import (
|
||||
"cosmossdk.io/log"
|
||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type IntegrationTestSuite struct {
|
||||
type MEVTestSuite struct {
|
||||
suite.Suite
|
||||
|
||||
encCfg testutils.EncodingConfig
|
||||
config auction.Factory
|
||||
config mev.Factory
|
||||
ctx sdk.Context
|
||||
random *rand.Rand
|
||||
accounts []testutils.Account
|
||||
@ -25,13 +25,13 @@ type IntegrationTestSuite struct {
|
||||
}
|
||||
|
||||
func TestMempoolTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(IntegrationTestSuite))
|
||||
suite.Run(t, new(MEVTestSuite))
|
||||
}
|
||||
|
||||
func (suite *IntegrationTestSuite) SetupTest() {
|
||||
func (suite *MEVTestSuite) SetupTest() {
|
||||
// Mempool setup
|
||||
suite.encCfg = testutils.CreateTestEncodingConfig()
|
||||
suite.config = auction.NewDefaultAuctionFactory(suite.encCfg.TxConfig.TxDecoder())
|
||||
suite.config = mev.NewDefaultAuctionFactory(suite.encCfg.TxConfig.TxDecoder())
|
||||
suite.ctx = sdk.NewContext(nil, cmtproto.Header{}, false, log.NewTestLogger(suite.T()))
|
||||
|
||||
// Init accounts
|
||||
@ -1,4 +1,4 @@
|
||||
package auction
|
||||
package mev
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@ -1,10 +1,10 @@
|
||||
package auction_test
|
||||
package mev_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
buildertypes "github.com/skip-mev/pob/x/builder/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -16,7 +16,7 @@ func TestGetMsgAuctionBidFromTx_Valid(t *testing.T) {
|
||||
txBuilder := encCfg.TxConfig.NewTxBuilder()
|
||||
txBuilder.SetMsgs(&buildertypes.MsgAuctionBid{})
|
||||
|
||||
msg, err := auction.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
msg, err := mev.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, msg)
|
||||
}
|
||||
@ -31,7 +31,7 @@ func TestGetMsgAuctionBidFromTx_MultiMsgBid(t *testing.T) {
|
||||
&banktypes.MsgSend{},
|
||||
)
|
||||
|
||||
msg, err := auction.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
msg, err := mev.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
require.Error(t, err)
|
||||
require.Nil(t, msg)
|
||||
}
|
||||
@ -42,7 +42,7 @@ func TestGetMsgAuctionBidFromTx_NoBid(t *testing.T) {
|
||||
txBuilder := encCfg.TxConfig.NewTxBuilder()
|
||||
txBuilder.SetMsgs(&banktypes.MsgSend{})
|
||||
|
||||
msg, err := auction.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
msg, err := mev.GetMsgAuctionBidFromTx(txBuilder.GetTx())
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, msg)
|
||||
}
|
||||
@ -11,9 +11,9 @@ import (
|
||||
"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/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/base"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/free"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
buildertypes "github.com/skip-mev/pob/x/builder/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -27,7 +27,7 @@ type BlockBusterTestSuite struct {
|
||||
encodingConfig testutils.EncodingConfig
|
||||
|
||||
// Define all of the lanes utilized in the test suite
|
||||
tobLane *auction.TOBLane
|
||||
mevLane *mev.MEVLane
|
||||
baseLane *base.DefaultLane
|
||||
freeLane *free.FreeLane
|
||||
gasTokenDenom string
|
||||
@ -57,16 +57,16 @@ func (suite *BlockBusterTestSuite) SetupTest() {
|
||||
//
|
||||
// TOB lane set up
|
||||
suite.gasTokenDenom = "stake"
|
||||
tobConfig := blockbuster.LaneConfig{
|
||||
mevConfig := blockbuster.LaneConfig{
|
||||
Logger: log.NewNopLogger(),
|
||||
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
|
||||
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
|
||||
AnteHandler: nil,
|
||||
MaxBlockSpace: math.LegacyZeroDec(),
|
||||
}
|
||||
suite.tobLane = auction.NewTOBLane(
|
||||
tobConfig,
|
||||
auction.NewDefaultAuctionFactory(suite.encodingConfig.TxConfig.TxDecoder()),
|
||||
suite.mevLane = mev.NewMEVLane(
|
||||
mevConfig,
|
||||
mev.NewDefaultAuctionFactory(suite.encodingConfig.TxConfig.TxDecoder()),
|
||||
)
|
||||
|
||||
// Free lane set up
|
||||
@ -96,7 +96,7 @@ func (suite *BlockBusterTestSuite) SetupTest() {
|
||||
)
|
||||
|
||||
// Mempool set up
|
||||
suite.lanes = []blockbuster.Lane{suite.tobLane, suite.freeLane, suite.baseLane}
|
||||
suite.lanes = []blockbuster.Lane{suite.mevLane, suite.freeLane, suite.baseLane}
|
||||
suite.mempool = blockbuster.NewMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
|
||||
|
||||
// Accounts set up
|
||||
@ -113,15 +113,15 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
insertDistribution map[string]int
|
||||
}{
|
||||
{
|
||||
"insert 1 tob tx",
|
||||
"insert 1 mev tx",
|
||||
map[string]int{
|
||||
suite.tobLane.Name(): 1,
|
||||
suite.mevLane.Name(): 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"insert 10 tob txs",
|
||||
"insert 10 mev txs",
|
||||
map[string]int{
|
||||
suite.tobLane.Name(): 10,
|
||||
suite.mevLane.Name(): 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -131,24 +131,24 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
},
|
||||
},
|
||||
{
|
||||
"insert 10 base txs and 10 tob txs",
|
||||
"insert 10 base txs and 10 mev txs",
|
||||
map[string]int{
|
||||
suite.baseLane.Name(): 10,
|
||||
suite.tobLane.Name(): 10,
|
||||
suite.mevLane.Name(): 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
"insert 100 base txs and 100 tob txs",
|
||||
"insert 100 base txs and 100 mev txs",
|
||||
map[string]int{
|
||||
suite.baseLane.Name(): 100,
|
||||
suite.tobLane.Name(): 100,
|
||||
suite.mevLane.Name(): 100,
|
||||
},
|
||||
},
|
||||
{
|
||||
"insert 100 base txs, 100 tob txs, and 100 free txs",
|
||||
"insert 100 base txs, 100 mev txs, and 100 free txs",
|
||||
map[string]int{
|
||||
suite.baseLane.Name(): 100,
|
||||
suite.tobLane.Name(): 100,
|
||||
suite.mevLane.Name(): 100,
|
||||
suite.freeLane.Name(): 100,
|
||||
},
|
||||
},
|
||||
@ -166,9 +166,9 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
},
|
||||
},
|
||||
{
|
||||
"insert 10 tob txs and 10 free txs",
|
||||
"insert 10 mev txs and 10 free txs",
|
||||
map[string]int{
|
||||
suite.tobLane.Name(): 10,
|
||||
suite.mevLane.Name(): 10,
|
||||
suite.freeLane.Name(): 10,
|
||||
},
|
||||
},
|
||||
@ -182,7 +182,7 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
suite.fillBaseLane(tc.insertDistribution[suite.baseLane.Name()])
|
||||
|
||||
// Fill the TOB lane with numTobTxs transactions
|
||||
suite.fillTOBLane(tc.insertDistribution[suite.tobLane.Name()])
|
||||
suite.fillTOBLane(tc.insertDistribution[suite.mevLane.Name()])
|
||||
|
||||
// Fill the Free lane with numFreeTxs transactions
|
||||
suite.fillFreeLane(tc.insertDistribution[suite.freeLane.Name()])
|
||||
@ -196,7 +196,7 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
suite.Require().Equal(sum, suite.mempool.CountTx())
|
||||
|
||||
// Validate the lanes
|
||||
suite.Require().Equal(tc.insertDistribution[suite.tobLane.Name()], suite.tobLane.CountTx())
|
||||
suite.Require().Equal(tc.insertDistribution[suite.mevLane.Name()], suite.mevLane.CountTx())
|
||||
suite.Require().Equal(tc.insertDistribution[suite.baseLane.Name()], suite.baseLane.CountTx())
|
||||
suite.Require().Equal(tc.insertDistribution[suite.freeLane.Name()], suite.freeLane.CountTx())
|
||||
|
||||
@ -204,7 +204,7 @@ func (suite *BlockBusterTestSuite) TestInsert() {
|
||||
laneCounts := suite.mempool.GetTxDistribution()
|
||||
|
||||
// Ensure that the lane counts are correct
|
||||
suite.Require().Equal(tc.insertDistribution[suite.tobLane.Name()], laneCounts[suite.tobLane.Name()])
|
||||
suite.Require().Equal(tc.insertDistribution[suite.mevLane.Name()], laneCounts[suite.mevLane.Name()])
|
||||
suite.Require().Equal(tc.insertDistribution[suite.baseLane.Name()], laneCounts[suite.baseLane.Name()])
|
||||
suite.Require().Equal(tc.insertDistribution[suite.freeLane.Name()], laneCounts[suite.freeLane.Name()])
|
||||
})
|
||||
@ -218,12 +218,12 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
numBaseTxs int
|
||||
}{
|
||||
{
|
||||
"insert 1 tob tx",
|
||||
"insert 1 mev tx",
|
||||
1,
|
||||
0,
|
||||
},
|
||||
{
|
||||
"insert 10 tob txs",
|
||||
"insert 10 mev txs",
|
||||
10,
|
||||
0,
|
||||
},
|
||||
@ -233,12 +233,12 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
1,
|
||||
},
|
||||
{
|
||||
"insert 10 base txs and 10 tob txs",
|
||||
"insert 10 base txs and 10 mev txs",
|
||||
10,
|
||||
10,
|
||||
},
|
||||
{
|
||||
"insert 100 base txs and 100 tob txs",
|
||||
"insert 100 base txs and 100 mev txs",
|
||||
100,
|
||||
100,
|
||||
},
|
||||
@ -255,7 +255,7 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
suite.fillTOBLane(tc.numTobTxs)
|
||||
|
||||
// Remove all transactions from the lanes
|
||||
tobCount := tc.numTobTxs
|
||||
mevCount := tc.numTobTxs
|
||||
baseCount := tc.numBaseTxs
|
||||
for iterator := suite.baseLane.Select(suite.ctx, nil); iterator != nil; {
|
||||
tx := iterator.Tx()
|
||||
@ -277,10 +277,10 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
}
|
||||
|
||||
suite.Require().Equal(0, suite.baseLane.CountTx())
|
||||
suite.Require().Equal(tobCount, suite.tobLane.CountTx())
|
||||
suite.Require().Equal(mevCount, suite.mevLane.CountTx())
|
||||
|
||||
// Remove all transactions from the lanes
|
||||
for iterator := suite.tobLane.Select(suite.ctx, nil); iterator != nil; {
|
||||
for iterator := suite.mevLane.Select(suite.ctx, nil); iterator != nil; {
|
||||
tx := iterator.Tx()
|
||||
|
||||
// Remove the transaction from the mempool
|
||||
@ -290,16 +290,16 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
suite.Require().Equal(false, suite.mempool.Contains(tx))
|
||||
|
||||
// Ensure the number of transactions in the lane is correct
|
||||
tobCount--
|
||||
suite.Require().Equal(suite.tobLane.CountTx(), tobCount)
|
||||
mevCount--
|
||||
suite.Require().Equal(suite.mevLane.CountTx(), mevCount)
|
||||
|
||||
distribution := suite.mempool.GetTxDistribution()
|
||||
suite.Require().Equal(distribution[suite.tobLane.Name()], tobCount)
|
||||
suite.Require().Equal(distribution[suite.mevLane.Name()], mevCount)
|
||||
|
||||
iterator = suite.tobLane.Select(suite.ctx, nil)
|
||||
iterator = suite.mevLane.Select(suite.ctx, nil)
|
||||
}
|
||||
|
||||
suite.Require().Equal(0, suite.tobLane.CountTx())
|
||||
suite.Require().Equal(0, suite.mevLane.CountTx())
|
||||
suite.Require().Equal(0, suite.baseLane.CountTx())
|
||||
suite.Require().Equal(0, suite.mempool.CountTx())
|
||||
|
||||
@ -307,7 +307,7 @@ func (suite *BlockBusterTestSuite) TestRemove() {
|
||||
distribution := suite.mempool.GetTxDistribution()
|
||||
|
||||
// Ensure that the lane counts are correct
|
||||
suite.Require().Equal(distribution[suite.tobLane.Name()], 0)
|
||||
suite.Require().Equal(distribution[suite.mevLane.Name()], 0)
|
||||
suite.Require().Equal(distribution[suite.baseLane.Name()], 0)
|
||||
})
|
||||
}
|
||||
|
||||
@ -4,7 +4,9 @@ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLj
|
||||
github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8=
|
||||
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
|
||||
github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieELltZWHRmwPmPaZ8+XoL2Sj+A2YJlr8=
|
||||
github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY=
|
||||
github.com/getsentry/sentry-go v0.17.0 h1:UustVWnOoDFHBS7IJUB2QK/nB5pap748ZEp0swnQJak=
|
||||
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA=
|
||||
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
|
||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
type POBHandlerOptions struct {
|
||||
BaseOptions ante.HandlerOptions
|
||||
Mempool blockbuster.Mempool
|
||||
TOBLane builderante.TOBLane
|
||||
MEVLane builderante.MEVLane
|
||||
TxDecoder sdk.TxDecoder
|
||||
TxEncoder sdk.TxEncoder
|
||||
BuilderKeeper builderkeeper.Keeper
|
||||
@ -54,7 +54,7 @@ func NewPOBAnteHandler(options POBHandlerOptions) sdk.AnteHandler {
|
||||
ante.NewSigGasConsumeDecorator(options.BaseOptions.AccountKeeper, options.BaseOptions.SigGasConsumer),
|
||||
ante.NewSigVerificationDecorator(options.BaseOptions.AccountKeeper, options.BaseOptions.SignModeHandler),
|
||||
ante.NewIncrementSequenceDecorator(options.BaseOptions.AccountKeeper),
|
||||
builderante.NewBuilderDecorator(options.BuilderKeeper, options.TxEncoder, options.TOBLane, options.Mempool),
|
||||
builderante.NewBuilderDecorator(options.BuilderKeeper, options.TxEncoder, options.MEVLane, options.Mempool),
|
||||
}
|
||||
|
||||
return sdk.ChainAnteDecorators(anteDecorators...)
|
||||
|
||||
@ -63,9 +63,9 @@ import (
|
||||
|
||||
"github.com/skip-mev/pob/blockbuster"
|
||||
"github.com/skip-mev/pob/blockbuster/abci"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/base"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/free"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
buildermodule "github.com/skip-mev/pob/x/builder"
|
||||
builderkeeper "github.com/skip-mev/pob/x/builder/keeper"
|
||||
)
|
||||
@ -139,7 +139,7 @@ type TestApp struct {
|
||||
FeeGrantKeeper feegrantkeeper.Keeper
|
||||
|
||||
// custom checkTx handler
|
||||
checkTxHandler auction.CheckTx
|
||||
checkTxHandler mev.CheckTx
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -262,16 +262,16 @@ 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.LaneConfig{
|
||||
mevConfig := blockbuster.LaneConfig{
|
||||
Logger: app.Logger(),
|
||||
TxEncoder: app.txConfig.TxEncoder(),
|
||||
TxDecoder: app.txConfig.TxDecoder(),
|
||||
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,
|
||||
auction.NewDefaultAuctionFactory(app.txConfig.TxDecoder()),
|
||||
mevLane := mev.NewMEVLane(
|
||||
mevConfig,
|
||||
mev.NewDefaultAuctionFactory(app.txConfig.TxDecoder()),
|
||||
)
|
||||
|
||||
// Free lane allows transactions to be included in the next block for free.
|
||||
@ -300,7 +300,7 @@ func New(
|
||||
|
||||
// Set the lanes into the mempool.
|
||||
lanes := []blockbuster.Lane{
|
||||
tobLane,
|
||||
mevLane,
|
||||
freeLane,
|
||||
defaultLane,
|
||||
}
|
||||
@ -322,7 +322,7 @@ func New(
|
||||
TxDecoder: app.txConfig.TxDecoder(),
|
||||
TxEncoder: app.txConfig.TxEncoder(),
|
||||
FreeLane: freeLane,
|
||||
TOBLane: tobLane,
|
||||
MEVLane: mevLane,
|
||||
Mempool: mempool,
|
||||
}
|
||||
anteHandler := NewPOBAnteHandler(options)
|
||||
@ -343,10 +343,10 @@ func New(
|
||||
app.App.SetProcessProposal(proposalHandler.ProcessProposalHandler())
|
||||
|
||||
// Set the custom CheckTx handler on BaseApp.
|
||||
checkTxHandler := auction.NewCheckTxHandler(
|
||||
checkTxHandler := mev.NewCheckTxHandler(
|
||||
app.App,
|
||||
app.txConfig.TxDecoder(),
|
||||
tobLane,
|
||||
mevLane,
|
||||
anteHandler,
|
||||
)
|
||||
app.SetCheckTx(checkTxHandler.CheckTx())
|
||||
@ -392,7 +392,7 @@ func (app *TestApp) CheckTx(req *cometabci.RequestCheckTx) (*cometabci.ResponseC
|
||||
}
|
||||
|
||||
// SetCheckTx sets the checkTxHandler for the app.
|
||||
func (app *TestApp) SetCheckTx(handler auction.CheckTx) {
|
||||
func (app *TestApp) SetCheckTx(handler mev.CheckTx) {
|
||||
app.checkTxHandler = handler
|
||||
}
|
||||
|
||||
|
||||
@ -1003,7 +1003,7 @@ func (s *POBIntegrationTestSuite) TestLanes() {
|
||||
|
||||
params := QueryBuilderParams(s.T(), s.chain)
|
||||
|
||||
s.Run("block with tob, free, and normal tx", func() {
|
||||
s.Run("block with mev, free, and normal tx", func() {
|
||||
user2BalanceBefore := QueryAccountBalance(s.T(), s.chain.(*cosmos.CosmosChain), s.user2.FormattedAddress(), s.denom)
|
||||
|
||||
// create free-tx, bid-tx, and normal-tx\
|
||||
@ -1071,7 +1071,7 @@ func (s *POBIntegrationTestSuite) TestLanes() {
|
||||
require.Equal(s.T(), user2BalanceBefore, user2BalanceAfter+delegation.Amount.Int64())
|
||||
})
|
||||
|
||||
s.Run("failing top of block transaction, free, and normal tx", func() {
|
||||
s.Run("failing MEV transaction, free, and normal tx", func() {
|
||||
user2BalanceBefore := QueryAccountBalance(s.T(), s.chain.(*cosmos.CosmosChain), s.user2.FormattedAddress(), s.denom)
|
||||
user1Balance := QueryAccountBalance(s.T(), s.chain.(*cosmos.CosmosChain), s.user1.FormattedAddress(), s.denom)
|
||||
// create free-tx, bid-tx, and normal-tx\
|
||||
@ -1151,7 +1151,7 @@ func (s *POBIntegrationTestSuite) TestLanes() {
|
||||
require.Equal(s.T(), user2BalanceBefore, user2BalanceAfter+delegation.Amount.Int64())
|
||||
})
|
||||
|
||||
s.Run("top of block transaction that includes transactions from the free lane", func() {
|
||||
s.Run("MEV transaction that includes transactions from the free lane", func() {
|
||||
user2BalanceBefore := QueryAccountBalance(s.T(), s.chain.(*cosmos.CosmosChain), s.user2.FormattedAddress(), s.denom)
|
||||
|
||||
delegateTx := Tx{
|
||||
@ -1212,7 +1212,7 @@ func (s *POBIntegrationTestSuite) TestLanes() {
|
||||
VerifyBlock(s.T(), block, 0, TxHash(txs[0]), bundledTx)
|
||||
})
|
||||
|
||||
s.Run("top of block transaction that includes transaction from free lane + other free lane txs + normal txs", func() {
|
||||
s.Run("MEV transaction that includes transaction from free lane + other free lane txs + normal txs", func() {
|
||||
user2BalanceBefore := QueryAccountBalance(s.T(), s.chain.(*cosmos.CosmosChain), s.user2.FormattedAddress(), s.denom)
|
||||
|
||||
// create free-txs signed by user2 / 3
|
||||
|
||||
@ -14,9 +14,9 @@ import (
|
||||
var _ sdk.AnteDecorator = BuilderDecorator{}
|
||||
|
||||
type (
|
||||
// TOBLane is an interface that defines the methods required to interact with the top of block
|
||||
// MEVLane is an interface that defines the methods required to interact with the MEV
|
||||
// lane.
|
||||
TOBLane interface {
|
||||
MEVLane interface {
|
||||
GetAuctionBidInfo(tx sdk.Tx) (*types.BidInfo, error)
|
||||
GetTopAuctionTx(ctx context.Context) sdk.Tx
|
||||
}
|
||||
@ -30,12 +30,12 @@ type (
|
||||
BuilderDecorator struct {
|
||||
builderKeeper keeper.Keeper
|
||||
txEncoder sdk.TxEncoder
|
||||
lane TOBLane
|
||||
lane MEVLane
|
||||
mempool Mempool
|
||||
}
|
||||
)
|
||||
|
||||
func NewBuilderDecorator(ak keeper.Keeper, txEncoder sdk.TxEncoder, lane TOBLane, mempool Mempool) BuilderDecorator {
|
||||
func NewBuilderDecorator(ak keeper.Keeper, txEncoder sdk.TxEncoder, lane MEVLane, mempool Mempool) BuilderDecorator {
|
||||
return BuilderDecorator{
|
||||
builderKeeper: ak,
|
||||
txEncoder: txEncoder,
|
||||
|
||||
@ -12,8 +12,8 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/skip-mev/pob/blockbuster"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/auction"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/base"
|
||||
"github.com/skip-mev/pob/blockbuster/lanes/mev"
|
||||
testutils "github.com/skip-mev/pob/testutils"
|
||||
"github.com/skip-mev/pob/x/builder/ante"
|
||||
"github.com/skip-mev/pob/x/builder/keeper"
|
||||
@ -40,7 +40,7 @@ type AnteTestSuite struct {
|
||||
|
||||
// mempool and lane set up
|
||||
mempool blockbuster.Mempool
|
||||
tobLane *auction.TOBLane
|
||||
mevLane *mev.MEVLane
|
||||
baseLane *base.DefaultLane
|
||||
lanes []blockbuster.Lane
|
||||
|
||||
@ -83,16 +83,16 @@ func (suite *AnteTestSuite) SetupTest() {
|
||||
// Lanes configuration
|
||||
//
|
||||
// TOB lane set up
|
||||
tobConfig := blockbuster.LaneConfig{
|
||||
mevConfig := blockbuster.LaneConfig{
|
||||
Logger: suite.ctx.Logger(),
|
||||
TxEncoder: suite.encodingConfig.TxConfig.TxEncoder(),
|
||||
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
|
||||
AnteHandler: suite.anteHandler,
|
||||
MaxBlockSpace: math.LegacyZeroDec(),
|
||||
}
|
||||
suite.tobLane = auction.NewTOBLane(
|
||||
tobConfig,
|
||||
auction.NewDefaultAuctionFactory(suite.encodingConfig.TxConfig.TxDecoder()),
|
||||
suite.mevLane = mev.NewMEVLane(
|
||||
mevConfig,
|
||||
mev.NewDefaultAuctionFactory(suite.encodingConfig.TxConfig.TxDecoder()),
|
||||
)
|
||||
|
||||
// Base lane set up
|
||||
@ -102,12 +102,12 @@ func (suite *AnteTestSuite) SetupTest() {
|
||||
TxDecoder: suite.encodingConfig.TxConfig.TxDecoder(),
|
||||
AnteHandler: suite.anteHandler,
|
||||
MaxBlockSpace: math.LegacyZeroDec(),
|
||||
IgnoreList: []blockbuster.Lane{suite.tobLane},
|
||||
IgnoreList: []blockbuster.Lane{suite.mevLane},
|
||||
}
|
||||
suite.baseLane = base.NewDefaultLane(baseConfig)
|
||||
|
||||
// Mempool set up
|
||||
suite.lanes = []blockbuster.Lane{suite.tobLane, suite.baseLane}
|
||||
suite.lanes = []blockbuster.Lane{suite.mevLane, suite.baseLane}
|
||||
suite.mempool = blockbuster.NewMempool(log.NewTestLogger(suite.T()), true, suite.lanes...)
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
false,
|
||||
},
|
||||
{
|
||||
"valid auction bid tx",
|
||||
"valid mev bid tx",
|
||||
func() {
|
||||
balance = sdk.NewCoin("stake", math.NewInt(10000))
|
||||
bid = sdk.NewCoin("stake", math.NewInt(1000))
|
||||
@ -189,14 +189,14 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
true,
|
||||
},
|
||||
{
|
||||
"invalid auction bid tx with no timeout",
|
||||
"invalid mev bid tx with no timeout",
|
||||
func() {
|
||||
timeout = 0
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"auction tx is the top bidding tx",
|
||||
"mev tx is the top bidding tx",
|
||||
func() {
|
||||
timeout = 1000
|
||||
balance = sdk.NewCoin("stake", math.NewInt(10000))
|
||||
@ -211,7 +211,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
true,
|
||||
},
|
||||
{
|
||||
"invalid frontrunning auction bid tx",
|
||||
"invalid frontrunning mev bid tx",
|
||||
func() {
|
||||
randomAccount := testutils.RandomAccounts(suite.random, 2)
|
||||
bidder := randomAccount[0]
|
||||
@ -223,7 +223,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
false,
|
||||
},
|
||||
{
|
||||
"valid frontrunning auction bid tx",
|
||||
"valid frontrunning mev bid tx",
|
||||
func() {
|
||||
randomAccount := testutils.RandomAccounts(suite.random, 2)
|
||||
bidder := randomAccount[0]
|
||||
@ -235,7 +235,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
true,
|
||||
},
|
||||
{
|
||||
"invalid sandwiching auction bid tx",
|
||||
"invalid sandwiching mev bid tx",
|
||||
func() {
|
||||
randomAccount := testutils.RandomAccounts(suite.random, 2)
|
||||
bidder := randomAccount[0]
|
||||
@ -247,7 +247,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
false,
|
||||
},
|
||||
{
|
||||
"invalid auction bid tx with many signers",
|
||||
"invalid mev bid tx with many signers",
|
||||
func() {
|
||||
signers = testutils.RandomAccounts(suite.random, 10)
|
||||
frontRunningProtection = true
|
||||
@ -263,7 +263,7 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
|
||||
suite.ctx = suite.ctx.WithBlockHeight(1)
|
||||
|
||||
// Set the auction params
|
||||
// Set the mev params
|
||||
err := suite.builderKeeper.SetParams(suite.ctx, buildertypes.Params{
|
||||
MaxBundleSize: maxBundleSize,
|
||||
ReserveFee: reserveFee,
|
||||
@ -278,24 +278,24 @@ func (suite *AnteTestSuite) TestAnteHandler() {
|
||||
suite.Require().NoError(err)
|
||||
|
||||
distribution := suite.mempool.GetTxDistribution()
|
||||
suite.Require().Equal(0, distribution[auction.LaneName])
|
||||
suite.Require().Equal(0, distribution[mev.LaneName])
|
||||
suite.Require().Equal(0, distribution[base.LaneName])
|
||||
|
||||
suite.Require().NoError(suite.mempool.Insert(suite.ctx, topAuctionTx))
|
||||
|
||||
distribution = suite.mempool.GetTxDistribution()
|
||||
suite.Require().Equal(1, distribution[auction.LaneName])
|
||||
suite.Require().Equal(1, distribution[mev.LaneName])
|
||||
suite.Require().Equal(0, distribution[base.LaneName])
|
||||
}
|
||||
|
||||
// Create the actual auction tx and insert into the mempool
|
||||
auctionTx, err := testutils.CreateAuctionTxWithSigners(suite.encodingConfig.TxConfig, bidder, bid, 0, timeout, signers)
|
||||
// Create the actual mev tx and insert into the mempool
|
||||
mevTx, err := testutils.CreateAuctionTxWithSigners(suite.encodingConfig.TxConfig, bidder, bid, 0, timeout, signers)
|
||||
suite.Require().NoError(err)
|
||||
|
||||
// Execute the ante handler
|
||||
suite.balance = balance
|
||||
suite.builderDecorator = ante.NewBuilderDecorator(suite.builderKeeper, suite.encodingConfig.TxConfig.TxEncoder(), suite.tobLane, suite.mempool)
|
||||
_, err = suite.anteHandler(suite.ctx, auctionTx, false)
|
||||
suite.builderDecorator = ante.NewBuilderDecorator(suite.builderKeeper, suite.encodingConfig.TxConfig.TxEncoder(), suite.mevLane, suite.mempool)
|
||||
_, err = suite.anteHandler(suite.ctx, mevTx, false)
|
||||
if tc.pass {
|
||||
suite.Require().NoError(err)
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user