Skip to content

Commit

Permalink
cleanup lanes and bump initiavm
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Dec 13, 2023
1 parent 571b047 commit 6520dda
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
19 changes: 10 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ import (
signer_extraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
"github.com/skip-mev/block-sdk/block"
blockbase "github.com/skip-mev/block-sdk/block/base"
"github.com/skip-mev/block-sdk/lanes/mev"
mevlane "github.com/skip-mev/block-sdk/lanes/mev"
"github.com/skip-mev/block-sdk/x/auction"
auctionante "github.com/skip-mev/block-sdk/x/auction/ante"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
Expand Down Expand Up @@ -314,7 +314,7 @@ type InitiaApp struct {
configurator module.Configurator

// Override of BaseApp's CheckTx
checkTxHandler mev.CheckTx
checkTxHandler mevlane.CheckTx
}

// NewInitiaApp returns a reference to an initialized Initia.
Expand Down Expand Up @@ -986,8 +986,8 @@ func NewInitiaApp(
MaxTxs: 100,
SignerExtractor: signerExtractor,
}
factor := mev.NewDefaultAuctionFactory(app.txConfig.TxDecoder(), signerExtractor)
mevLane := mev.NewMEVLane(
factor := mevlane.NewDefaultAuctionFactory(app.txConfig.TxDecoder(), signerExtractor)
mevLane := mevlane.NewMEVLane(
mevConfig,
factor,
factor.MatchHandler(),
Expand All @@ -1003,21 +1003,22 @@ func NewInitiaApp(
}
freeLane := applanes.NewFreeLane(freeConfig, applanes.FreeLaneMatchHandler())

priorityLaneConfig := blockbase.LaneConfig{
defaultLaneConfig := blockbase.LaneConfig{
Logger: app.Logger(),
TxEncoder: app.txConfig.TxEncoder(),
TxDecoder: app.txConfig.TxDecoder(),
MaxBlockSpace: math.LegacyZeroDec(),
MaxTxs: 0,
SignerExtractor: signerExtractor,
}
priorityLane := applanes.NewPriorityLane(priorityLaneConfig)
defaultLane := applanes.NewDefaultLane(defaultLaneConfig)

lanes := []block.Lane{mevLane, freeLane, priorityLane}
lanes := []block.Lane{mevLane, freeLane, defaultLane}
mempool, err := block.NewLanedMempool(app.Logger(), lanes)
if err != nil {
panic(err)
}

app.SetMempool(mempool)
anteHandler := app.setAnteHandler(mevLane, freeLane)

Expand All @@ -1034,7 +1035,7 @@ func NewInitiaApp(
app.SetProcessProposal(proposalHandlers.ProcessProposalHandler())

// overrde base-app's CheckTx
checkTxHandler := mev.NewCheckTxHandler(
checkTxHandler := mevlane.NewCheckTxHandler(
app.BaseApp,
app.txConfig.TxDecoder(),
mevLane,
Expand Down Expand Up @@ -1070,7 +1071,7 @@ func (app *InitiaApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
}

// SetCheckTx sets the checkTxHandler for the app.
func (app *InitiaApp) SetCheckTx(handler mev.CheckTx) {
func (app *InitiaApp) SetCheckTx(handler mevlane.CheckTx) {
app.checkTxHandler = handler
}

Expand Down
14 changes: 7 additions & 7 deletions app/lanes/priority.go → app/lanes/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import (
)

const (
// PriorityLaneName defines the name of the priority lane.
PriorityLaneName = "priority"
// DefaultName defines the name of the priority lane.
DefaultName = "default"
)

// PriorityLane defines a priority lane implementation. The priority lane orders
// transactions by the transaction fees. The priority lane accepts any transaction
// DefaultLane defines a default lane implementation. The default lane orders
// transactions by the transaction fees. The default lane accepts any transaction
// that should not be ignored (as defined by the IgnoreList in the LaneConfig).
// The priority lane builds and verifies blocks in a similar fashion to how the
// The default lane builds and verifies blocks in a similar fashion to how the
// CometBFT/Tendermint consensus engine builds and verifies blocks pre SDK version
// 0.47.0.
func NewPriorityLane(cfg blockbase.LaneConfig) block.Lane {
func NewDefaultLane(cfg blockbase.LaneConfig) block.Lane {
lane, err := blockbase.NewBaseLane(
cfg,
PriorityLaneName,
DefaultName,
blockbase.WithMempool(NewMempool(blockbase.NewDefaultTxPriority(), cfg.SignerExtractor, cfg.MaxTxs)),
)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions app/lanes/free.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package lanes
import (
sdk "github.com/cosmos/cosmos-sdk/types"

clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"

"github.com/skip-mev/block-sdk/block"
Expand All @@ -11,15 +12,14 @@ import (

// FreeLaneMatchHandler returns the default match handler for the free lane. The
// default implementation matches transactions that are ibc related. In particular,
// any transaction that is a MsgTimeout, MsgAcknowledgement.
// any transaction that is a MsgUpdateClient, MsgTimeout, MsgAcknowledgement.
func FreeLaneMatchHandler() blockbase.MatchHandler {
return func(ctx sdk.Context, tx sdk.Tx) bool {
for _, msg := range tx.GetMsgs() {
switch msg.(type) {
case *clienttypes.MsgUpdateClient:
case *channeltypes.MsgTimeout:
continue
case *channeltypes.MsgAcknowledgement:
continue
default:
return false
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/initiad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

initiaapp "github.com/initia-labs/initia/app"
"github.com/initia-labs/initia/app/params"
movecmd "github.com/initia-labs/initia/cmd/move"
genutilcli "github.com/initia-labs/initia/x/genutil/client/cli"
moveconfig "github.com/initia-labs/initia/x/move/config"
)
Expand Down Expand Up @@ -150,7 +151,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))

// add move commands
rootCmd.AddCommand(MoveCommand())
rootCmd.AddCommand(movecmd.MoveCommand())
}

func addModuleInitFlags(startCmd *cobra.Command) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/initiad/move.go → cmd/move/move.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package movecmd

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion cmd/initiad/verify.go → cmd/move/verify.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package movecmd

import (
"archive/zip"
Expand Down
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ github.com/initia-labs/OPinit v0.1.0-beta.3 h1:DY/ItJTUAujNhqrzjgAFFzSLn/IGrIN1F
github.com/initia-labs/OPinit v0.1.0-beta.3/go.mod h1:MPnFU2x4xzeT3L8K3lc0wkOl09o/oekEabPHIwWdqJg=
github.com/initia-labs/cosmos-sdk v0.47.7-0.20231208103644-7bba6b092b8c h1:XdQVkEp/PoWGz/ykzQmiKmBK50X8+ToV/briOTz2vT0=
github.com/initia-labs/cosmos-sdk v0.47.7-0.20231208103644-7bba6b092b8c/go.mod h1:fIhY9qlXZNvlWz8lAB2YcSRf2dCAi8VEJrq5GY/v2yE=
github.com/initia-labs/initiavm v0.1.2-beta.5 h1:/pmtEdgSfNBhuifpQ4VEc/GxBhJCZ8LxzAAhPmnUTT0=
github.com/initia-labs/initiavm v0.1.2-beta.5 h1:JkXXeTY/d6Ftikbu22WrIAkimy+Yg4Ye6Fvcd5ism4U=
github.com/initia-labs/initiavm v0.1.2-beta.5/go.mod h1:aQt4lImZWF9xj7Fm978n0IoeDdKWXTg1CSq6O4WoSD8=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU=
Expand Down

0 comments on commit 6520dda

Please sign in to comment.