Skip to content

Commit

Permalink
unwire block sdk (#6918)
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic authored Nov 23, 2023
1 parent 73d0141 commit 8ce7db5
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 158 deletions.
7 changes: 0 additions & 7 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import (

txfeeskeeper "github.com/osmosis-labs/osmosis/v20/x/txfees/keeper"
txfeestypes "github.com/osmosis-labs/osmosis/v20/x/txfees/types"

auctionante "github.com/skip-mev/block-sdk/x/auction/ante"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
)

// Link to default ante handler used by cosmos sdk:
Expand All @@ -36,9 +33,6 @@ func NewAnteHandler(
sigGasConsumer ante.SignatureVerificationGasConsumer,
signModeHandler signing.SignModeHandler,
channelKeeper *ibckeeper.Keeper,
auctionKeeper *auctionkeeper.Keeper,
txEncoder sdk.TxEncoder,
mevLane auctionante.MEVLane,
) sdk.AnteHandler {
mempoolFeeOptions := txfeestypes.NewMempoolFeeOptions(appOpts)
mempoolFeeDecorator := txfeeskeeper.NewMempoolFeeDecorator(*txFeesKeeper, mempoolFeeOptions)
Expand Down Expand Up @@ -66,6 +60,5 @@ func NewAnteHandler(
ante.NewSigVerificationDecorator(ak, signModeHandler),
ante.NewIncrementSequenceDecorator(ak),
ibcante.NewRedundantRelayDecorator(channelKeeper),
auctionante.NewAuctionDecorator(*auctionKeeper, txEncoder, mevLane),
)
}
90 changes: 0 additions & 90 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,6 @@ import (
v9 "github.com/osmosis-labs/osmosis/v20/app/upgrades/v9"
_ "github.com/osmosis-labs/osmosis/v20/client/docs/statik"
"github.com/osmosis-labs/osmosis/v20/x/mint"

// skipabci "github.com/skip-mev/block-sdk/abci"
// signer_extraction "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
// "github.com/skip-mev/block-sdk/block"
// "github.com/skip-mev/block-sdk/block/base"
// defaultlane "github.com/skip-mev/block-sdk/lanes/base"
// "github.com/skip-mev/block-sdk/lanes/free"
// "github.com/skip-mev/block-sdk/lanes/mev"

// Block-sdk imports
blocksdkabci "github.com/skip-mev/block-sdk/abci"
signer_extraction_adapter "github.com/skip-mev/block-sdk/adapters/signer_extraction_adapter"
blocksdk "github.com/skip-mev/block-sdk/block"
blocksdkbase "github.com/skip-mev/block-sdk/block/base"
base_lane "github.com/skip-mev/block-sdk/lanes/base"
mev_lane "github.com/skip-mev/block-sdk/lanes/mev"
auctionante "github.com/skip-mev/block-sdk/x/auction/ante"
)

const appName = "OsmosisApp"
Expand Down Expand Up @@ -189,12 +172,6 @@ type OsmosisApp struct {
sm *module.SimulationManager
configurator module.Configurator
homePath string

// custom checkTx handler
checkTxHandler mev_lane.CheckTx

// lanes
MEVLane auctionante.MEVLane
}

// init sets DefaultNodeHome to default osmosisd install location.
Expand Down Expand Up @@ -374,37 +351,6 @@ func NewOsmosisApp(
app.MountTransientStores(app.GetTransientStoreKey())
app.MountMemoryStores(app.GetMemoryStoreKey())

// initialize block-sdk Mempool
maxTxs := 0 // no limit
cfg := blocksdkbase.LaneConfig{
Logger: app.Logger(),
TxDecoder: app.GetTxConfig().TxDecoder(),
TxEncoder: app.GetTxConfig().TxEncoder(),
SignerExtractor: signer_extraction_adapter.NewDefaultAdapter(),
MaxBlockSpace: sdk.ZeroDec(),
MaxTxs: maxTxs,
}

baseLane := base_lane.NewDefaultLane(cfg)

mevLane := mev_lane.NewMEVLane(
cfg,
mev_lane.NewDefaultAuctionFactory(app.GetTxConfig().TxDecoder(), signer_extraction_adapter.NewDefaultAdapter()),
)
app.MEVLane = mevLane
// initialize mempool
mempool := blocksdk.NewLanedMempool(
app.Logger(),
true,
[]blocksdk.Lane{
mevLane, // mev-lane is first to prioritize bids being placed at the TOB
baseLane, // finally, all the rest of txs...
}...,
)

// set the mempool first
app.SetMempool(mempool)

anteHandler := NewAnteHandler(
appOpts,
wasmConfig,
Expand All @@ -416,38 +362,15 @@ func NewOsmosisApp(
ante.DefaultSigVerificationGasConsumer,
encodingConfig.TxConfig.SignModeHandler(),
app.IBCKeeper,
app.AuctionKeeper,
app.GetTxConfig().TxEncoder(),
mevLane,
)

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetAnteHandler(anteHandler)
mevLane.SetAnteHandler(anteHandler)
baseLane.SetAnteHandler(anteHandler)
app.SetPostHandler(NewPostHandler(app.ProtoRevKeeper))
app.SetEndBlocker(app.EndBlocker)

handler := blocksdkabci.NewProposalHandler(
app.Logger(),
app.GetTxConfig().TxDecoder(),
app.GetTxConfig().TxEncoder(),
mempool,
)
app.SetPrepareProposal(handler.PrepareProposalHandler())
app.SetProcessProposal(handler.ProcessProposalHandler())

checkTxHandler := mev_lane.NewCheckTxHandler(
app.BaseApp,
encodingConfig.TxConfig.TxDecoder(),
mevLane,
anteHandler,
app.ChainID(),
)
app.SetCheckTx(checkTxHandler.CheckTx())

// Register snapshot extensions to enable state-sync for wasm.
if manager := app.SnapshotManager(); manager != nil {
err := manager.RegisterExtensions(
Expand Down Expand Up @@ -484,19 +407,6 @@ func (app *OsmosisApp) GetBaseApp() *baseapp.BaseApp {
return app.BaseApp
}

// CheckTx will check the transaction with the provided checkTxHandler. We override the default
// handler so that we can verify bid transactions before they are inserted into the mempool.
// With the POB CheckTx, we can verify the bid transaction and all of the bundled transactions
// before inserting the bid transaction into the mempool.
func (app *OsmosisApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
return app.checkTxHandler(req)
}

// SetCheckTx sets the checkTxHandler for the app.
func (app *OsmosisApp) SetCheckTx(handler mev_lane.CheckTx) {
app.checkTxHandler = handler
}

// Name returns the name of the App.
func (app *OsmosisApp) Name() string { return app.BaseApp.Name() }

Expand Down
17 changes: 0 additions & 17 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"

appparams "github.com/osmosis-labs/osmosis/v20/app/params"
"github.com/osmosis-labs/osmosis/v20/x/cosmwasmpool"
Expand Down Expand Up @@ -106,7 +105,6 @@ import (
epochstypes "github.com/osmosis-labs/osmosis/x/epochs/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
auctionkeeper "github.com/skip-mev/block-sdk/x/auction/keeper"
)

const (
Expand All @@ -133,7 +131,6 @@ type AppKeepers struct {
AccountKeeper *authkeeper.AccountKeeper
BankKeeper bankkeeper.BaseKeeper
AuthzKeeper *authzkeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
DistrKeeper *distrkeeper.Keeper
DowntimeKeeper *downtimedetector.Keeper
Expand Down Expand Up @@ -461,18 +458,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
)
appKeepers.TokenFactoryKeeper = &tokenFactoryKeeper

// Create the Skip Auction Keeper
auctionKeeper := auctionkeeper.NewKeeper(
appCodec,
appKeepers.keys[auctiontypes.StoreKey],
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.DistrKeeper,
stakingKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
appKeepers.AuctionKeeper = &auctionKeeper

validatorSetPreferenceKeeper := valsetpref.NewKeeper(
appKeepers.keys[valsetpreftypes.StoreKey],
appKeepers.GetSubspace(valsetpreftypes.ModuleName),
Expand Down Expand Up @@ -718,7 +703,6 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac
paramsKeeper.Subspace(poolmanagertypes.ModuleName)
paramsKeeper.Subspace(gammtypes.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(auctiontypes.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(twaptypes.ModuleName)
paramsKeeper.Subspace(ibcratelimittypes.ModuleName)
Expand Down Expand Up @@ -847,6 +831,5 @@ func KVStoreKeys() []string {
icqtypes.StoreKey,
packetforwardtypes.StoreKey,
cosmwasmpooltypes.StoreKey,
auctiontypes.StoreKey,
}
}
3 changes: 0 additions & 3 deletions app/keepers/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ import (
valsetprefmodule "github.com/osmosis-labs/osmosis/v20/x/valset-pref/valpref-module"
"github.com/osmosis-labs/osmosis/x/epochs"
ibc_hooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"

"github.com/skip-mev/block-sdk/x/auction"
)

// AppModuleBasics returns ModuleBasics for the module BasicManager.
Expand Down Expand Up @@ -104,7 +102,6 @@ var AppModuleBasics = []module.AppModuleBasic{
slashing.AppModuleBasic{},
authzmodule.AppModuleBasic{},
consensus.AppModuleBasic{},
auction.AppModuleBasic{},
ibc.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
Expand Down
6 changes: 0 additions & 6 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"

auction "github.com/skip-mev/block-sdk/x/auction"
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"

ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
Expand Down Expand Up @@ -129,7 +126,6 @@ var moduleAccountPermissions = map[string][]string{
valsetpreftypes.ModuleName: {authtypes.Staking},
poolmanagertypes.ModuleName: nil,
cosmwasmpooltypes.ModuleName: nil,
auctiontypes.ModuleName: nil,
}

// appModules return modules to initialize module manager.
Expand Down Expand Up @@ -159,7 +155,6 @@ func appModules(
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(app.UpgradeKeeper),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper, *app.AccountKeeper, app.BankKeeper, app.BaseApp.MsgServiceRouter(), app.GetSubspace(wasm.ModuleName)),
auction.NewAppModule(appCodec, *app.AuctionKeeper),
evidence.NewAppModule(*app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, *app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
ibc.NewAppModule(app.IBCKeeper),
Expand Down Expand Up @@ -265,7 +260,6 @@ func OrderInitGenesis(allModuleNames []string) []string {
vestingtypes.ModuleName,
ibctransfertypes.ModuleName,
consensusparamtypes.ModuleName,
auctiontypes.ModuleName,
poolincentivestypes.ModuleName,
superfluidtypes.ModuleName,
tokenfactorytypes.ModuleName,
Expand Down
5 changes: 0 additions & 5 deletions app/upgrades/v21/constants.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package v21

import (
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"

"github.com/osmosis-labs/osmosis/v20/app/upgrades"

store "github.com/cosmos/cosmos-sdk/store/types"
Expand All @@ -21,9 +19,6 @@ var Upgrade = upgrades.Upgrade{
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{
// new modules
auctiontypes.ModuleName,

// v47 modules
crisistypes.ModuleName,
consensustypes.ModuleName,
Expand Down
27 changes: 0 additions & 27 deletions app/upgrades/v21/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package v21

import (
"cosmossdk.io/math"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
auctiontypes "github.com/skip-mev/block-sdk/x/auction/types"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -99,11 +97,6 @@ func CreateUpgradeHandler(
case wasmtypes.ModuleName:
keyTable = wasmtypes.ParamKeyTable() //nolint:staticcheck

// POB
case auctiontypes.ModuleName:
// already SDK v47
continue

// osmosis modules
case protorevtypes.ModuleName:
keyTable = protorevtypes.ParamKeyTable() //nolint:staticcheck
Expand Down Expand Up @@ -150,12 +143,6 @@ func CreateUpgradeHandler(
return nil, err
}

// Set POB Params:
err = setAuctionParams(ctx, keepers)
if err != nil {
return nil, err
}

// Set expedited proposal param:
govParams := keepers.GovKeeper.GetParams(ctx)
govParams.ExpeditedMinDeposit = sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(5000000000)))
Expand Down Expand Up @@ -187,17 +174,3 @@ func CreateUpgradeHandler(
return migrations, nil
}
}

func setAuctionParams(ctx sdk.Context, keepers *keepers.AppKeepers) error {
pobAddr := keepers.AccountKeeper.GetModuleAddress(auctiontypes.ModuleName)

auctionParams := auctiontypes.Params{
MaxBundleSize: 2,
EscrowAccountAddress: pobAddr,
ReserveFee: sdk.Coin{Denom: "uosmo", Amount: sdk.NewInt(1_000_000)},
MinBidIncrement: sdk.Coin{Denom: "uosmo", Amount: sdk.NewInt(1_000_000)},
FrontRunningProtection: true,
ProposerFee: math.LegacyNewDecWithPrec(25, 2),
}
return keepers.AuctionKeeper.SetParams(ctx, auctionParams)
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ require (
github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.9-0.20231108202153-af031b1367bb
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/skip-mev/block-sdk v1.1.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,6 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt
github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY=
github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak=
github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg=
github.com/skip-mev/block-sdk v1.1.0 h1:cYEO/ASxhtasdRStMXhw1cWOjCJ78Z3J+K01n++OHkU=
github.com/skip-mev/block-sdk v1.1.0/go.mod h1:G/ryMdo70R1xOJehV1RqDyTH0x7gffwB1wU9MLMzIHE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand Down

0 comments on commit 8ce7db5

Please sign in to comment.