Skip to content

Commit

Permalink
free lane removed
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed Mar 3, 2024
1 parent 252b5f2 commit 919ae53
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 38 deletions.
7 changes: 1 addition & 6 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/skip-mev/block-sdk/block"
auctionanteskip "github.com/skip-mev/block-sdk/x/auction/ante"
auctionkeeperskip "github.com/skip-mev/block-sdk/x/auction/keeper"
)
Expand All @@ -31,7 +30,6 @@ type HandlerOptions struct {
TxDecoder sdk.TxDecoder
TxEncoder sdk.TxEncoder
auctionkeeperskip auctionkeeperskip.Keeper
FreeLane block.Lane
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
Expand Down Expand Up @@ -60,10 +58,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
block.NewIgnoreDecorator(
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
options.FreeLane,
),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down
8 changes: 2 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1269,14 +1269,14 @@ func New(
reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc)

// STEP 1-3: Create the Block SDK lanes.
mevLane, freeLane, defaultLane := CreateLanes(app)
mevLane, defaultLane := CreateLanes(app)

// STEP 4: Construct a mempool based off the lanes. Note that the order of the lanes
// matters. Blocks are constructed from the top lane to the bottom lane. The top lane
// is the first lane in the array and the bottom lane is the last lane in the array.
mempool, err := block.NewLanedMempool(
app.Logger(),
[]block.Lane{mevLane, freeLane, defaultLane},
[]block.Lane{mevLane, defaultLane},
)
if err != nil {
panic(err)
Expand Down Expand Up @@ -1306,7 +1306,6 @@ func New(
TxDecoder: encoding.TxConfig.TxDecoder(),
TxEncoder: encoding.TxConfig.TxEncoder(),
auctionkeeperskip: app.AuctionKeeperSkip,
FreeLane: freeLane,
},
)
if err != nil {
Expand All @@ -1322,9 +1321,6 @@ func New(
mevLane.WithOptions(
opt...,
)
freeLane.WithOptions(
opt...,
)
defaultLane.WithOptions(
opt...,
)
Expand Down
27 changes: 4 additions & 23 deletions app/lanes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (
signerextraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
"github.com/skip-mev/block-sdk/block/base"
defaultlane "github.com/skip-mev/block-sdk/lanes/base"
freelane "github.com/skip-mev/block-sdk/lanes/free"
mevlane "github.com/skip-mev/block-sdk/lanes/mev"
)

// CreateLanes walks through the process of creating the lanes for the block sdk. In this function
// we create three separate lanes - MEV, Free, and Default - and then return them.
//
// NOTE: Application Developers should closely replicate this function in their own application.
func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane, *base.BaseLane) {
func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane) {
// 1. Create the signer extractor. This is used to extract the expected signers from
// a transaction. Each lane can have a different signer extractor if needed.
signerAdapter := signerextraction.NewDefaultAdapter()
Expand All @@ -33,18 +32,7 @@ func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane, *base.BaseLane) {
Logger: app.Logger(),
TxEncoder: encodingConfig.TxConfig.TxEncoder(),
TxDecoder: encodingConfig.TxConfig.TxDecoder(),
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
SignerExtractor: signerAdapter,
MaxTxs: 0,
}

// Create a free configuration that accepts 1000 transactions and consumes 20% of the
// block space.
freeConfig := base.LaneConfig{
Logger: app.Logger(),
TxEncoder: encodingConfig.TxConfig.TxEncoder(),
TxDecoder: encodingConfig.TxConfig.TxDecoder(),
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.2"),
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.1"),
SignerExtractor: signerAdapter,
MaxTxs: 0,
}
Expand All @@ -55,7 +43,7 @@ func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane, *base.BaseLane) {
Logger: app.Logger(),
TxEncoder: encodingConfig.TxConfig.TxEncoder(),
TxDecoder: encodingConfig.TxConfig.TxDecoder(),
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.6"),
MaxBlockSpace: math.LegacyMustNewDecFromStr("0.9"),
SignerExtractor: signerAdapter,
MaxTxs: 0,
}
Expand All @@ -68,7 +56,6 @@ func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane, *base.BaseLane) {
mevMatchHandler := factory.MatchHandler()

// Create the final match handler for the free lane.
freeMatchHandler := freelane.DefaultMatchHandler()

// Create the final match handler for the default lane.
defaultMatchHandler := base.DefaultMatchHandler()
Expand All @@ -80,16 +67,10 @@ func CreateLanes(app *App) (*mevlane.MEVLane, *base.BaseLane, *base.BaseLane) {
mevMatchHandler,
)

freeLane := freelane.NewFreeLane(
freeConfig,
base.DefaultTxPriority(),
freeMatchHandler,
)

defaultLane := defaultlane.NewDefaultLane(
defaultConfig,
defaultMatchHandler,
)

return mevLane, freeLane, defaultLane
return mevLane, defaultLane
}
6 changes: 3 additions & 3 deletions app/upgrades/testnet/v14/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func setDefaultMEVParams(ctx sdk.Context, auctionkeeperskip auctionkeeperskip.Ke
// Skip MEV (x/auction)
return auctionkeeperskip.SetParams(ctx, auctionmoduleskiptypes.Params{
MaxBundleSize: auctionmoduleskiptypes.DefaultMaxBundleSize,
EscrowAccountAddress: authtypes.NewModuleAddress(auctionmoduleskiptypes.ModuleName),
ReserveFee: sdk.NewCoin(nativeDenom, sdk.NewInt(1)),
MinBidIncrement: sdk.NewCoin(nativeDenom, sdk.NewInt(1)),
EscrowAccountAddress: authtypes.NewModuleAddress(auctionmoduleskiptypes.ModuleName), // TODO: revisit
ReserveFee: sdk.NewCoin(nativeDenom, sdk.NewInt(10)),
MinBidIncrement: sdk.NewCoin(nativeDenom, sdk.NewInt(5)),
FrontRunningProtection: auctionmoduleskiptypes.DefaultFrontRunningProtection,
ProposerFee: auctionmoduleskiptypes.DefaultProposerFee,
})
Expand Down

0 comments on commit 919ae53

Please sign in to comment.