Skip to content

Commit

Permalink
feat(v2.9): remove pob
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Dec 18, 2023
1 parent 93b2cd0 commit 6e5cceb
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 264 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,11 @@ benchmark:
simulate:
@go test -bench BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true -Seed 1

test-e2e-pob:
cd interchaintest && go test -race -v -run TestPOB .

test-e2e-pmf:
cd interchaintest && go test -race -v -run TestPMF .

.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pob test-e2e-pmf
.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pmf

###############################################################################
### Linting ###
Expand Down
12 changes: 0 additions & 12 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package ante
import (
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/skip-mev/pob/mempool"
pobante "github.com/skip-mev/pob/x/builder/ante"
pobkeeper "github.com/skip-mev/pob/x/builder/keeper"
feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"

"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -29,9 +26,7 @@ type HandlerOptions struct {
BankKeeper bankKeeper.Keeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmTypes.WasmConfig
PobBuilderKeeper pobkeeper.Keeper
TxConfig client.TxConfig
PobMempool mempool.Mempool
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand All @@ -55,14 +50,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

auctionDecorator := pobante.NewBuilderDecorator(
options.PobBuilderKeeper,
options.TxConfig.TxEncoder(),
options.PobMempool,
)

anteDecorators := []sdk.AnteDecorator{
auctionDecorator,
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
Expand Down
57 changes: 1 addition & 56 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"
"os"
"path/filepath"
"reflect" // #nosec G702

// #nosec G702
"github.com/prometheus/client_golang/prometheus"

authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -89,9 +89,6 @@ import (
feeshare "github.com/terra-money/core/v2/x/feeshare"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"

pobabci "github.com/skip-mev/pob/abci"
pobmempool "github.com/skip-mev/pob/mempool"

tmjson "github.com/cometbft/cometbft/libs/json"

"github.com/terra-money/core/v2/app/ante"
Expand Down Expand Up @@ -156,9 +153,6 @@ type TerraApp struct {

invCheckPeriod uint

// Custom checkTx handler
checkTxHandler pobabci.CheckTx

// the module manager
mm *module.Manager
basicManager module.BasicManager
Expand Down Expand Up @@ -256,10 +250,6 @@ func NewTerraApp(
app.RegisterUpgradeHandlers()
app.RegisterUpgradeStores()

config := pobmempool.NewDefaultAuctionFactory(encodingConfig.TxConfig.TxDecoder())
// when maxTx is set as 0, there won't be a limit on the number of txs in this mempool
pobMempool := pobmempool.NewAuctionMempool(encodingConfig.TxConfig.TxDecoder(), encodingConfig.TxConfig.TxEncoder(), 0, config)

anteHandler, err := ante.NewAnteHandler(
ante.HandlerOptions{
HandlerOptions: cosmosante.HandlerOptions{
Expand All @@ -274,9 +264,6 @@ func NewTerraApp(
IBCkeeper: app.Keepers.IBCKeeper,
TxCounterStoreKey: app.keys[wasmtypes.StoreKey],
WasmConfig: wasmConfig,
PobBuilderKeeper: app.Keepers.BuilderKeeper,
TxConfig: encodingConfig.TxConfig,
PobMempool: pobMempool,
},
)
if err != nil {
Expand All @@ -290,34 +277,12 @@ func NewTerraApp(
},
)

// Create the proposal handler that will be used to build and validate blocks.
handler := pobabci.NewProposalHandler(
pobMempool,
bApp.Logger(),
anteHandler,
encodingConfig.TxConfig.TxEncoder(),
encodingConfig.TxConfig.TxDecoder(),
)
app.SetPrepareProposal(handler.PrepareProposalHandler())
app.SetProcessProposal(handler.ProcessProposalHandler())

// Set the custom CheckTx handler on BaseApp.
checkTxHandler := pobabci.NewCheckTxHandler(
app.BaseApp,
encodingConfig.TxConfig.TxDecoder(),
pobMempool,
anteHandler,
app.ChainID(),
)

// initialize BaseApp
app.SetInitChainer(app.InitChainer)
app.SetBeginBlocker(app.BeginBlocker)
app.SetAnteHandler(anteHandler)
app.SetPostHandler(postHandler)
app.SetEndBlocker(app.EndBlocker)
app.SetMempool(pobMempool)
app.SetCheckTx(checkTxHandler.CheckTx())

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down Expand Up @@ -585,26 +550,6 @@ func (app *TerraApp) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

// ChainID gets chainID from private fields of BaseApp
// Should be removed once SDK 0.50.x will be adopted
func (app *TerraApp) ChainID() string {
field := reflect.ValueOf(app.BaseApp).Elem().FieldByName("chainID")
return field.String()
}

// 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 *TerraApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
return app.checkTxHandler(req)
}

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

func (app *TerraApp) GetWasmOpts(appOpts servertypes.AppOptions) []wasmkeeper.Option {
var wasmOpts []wasmkeeper.Option
if cast.ToBool(appOpts.Get("telemetry.enabled")) {
Expand Down
1 change: 0 additions & 1 deletion app/app_test/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ func TestInitGenesisOnMigration(t *testing.T) {
"auth": 4,
"authz": 2,
"bank": 4,
"builder": 1,
"capability": 1,
"consensus": 1,
"crisis": 2,
Expand Down
1 change: 0 additions & 1 deletion app/config/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ const (
QueryDenomAuthorityMetadata = "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata"
QueryDenomsFromCreator = "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator"
QueryTokeFactoryParams = "/osmosis.tokenfactory.v1beta1.Query/Params"
QueryPobParams = "/pob.builder.v1.Query/Params"
QueryPFMParams = "/router.v1.Query/Params"

// UpgradeName gov proposal name
Expand Down
8 changes: 0 additions & 8 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
icagenesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
buildertypes "github.com/skip-mev/pob/x/builder/types"
"github.com/terra-money/core/v2/app/config"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

Expand Down Expand Up @@ -63,12 +62,6 @@ func (genState GenesisState) SetDefaultTerraConfig(cdc codec.JSONCodec) GenesisS
tokenFactoryGenState.Params.DenomCreationFee = sdk.NewCoins(sdk.NewCoin(config.BondDenom, sdk.NewInt(10000000)))
genState[tokenfactorytypes.ModuleName] = cdc.MustMarshalJSON(&tokenFactoryGenState)

var builderGenState buildertypes.GenesisState
cdc.MustUnmarshalJSON(genState[buildertypes.ModuleName], &builderGenState)
builderGenState.Params.ReserveFee = sdk.NewCoin(config.BondDenom, sdk.NewInt(1))
builderGenState.Params.MinBidIncrement = sdk.NewCoin(config.BondDenom, sdk.NewInt(1))
genState[buildertypes.ModuleName] = cdc.MustMarshalJSON(&builderGenState)

var icqGenState icqtypes.GenesisState
cdc.MustUnmarshalJSON(genState[icqtypes.ModuleName], &icqGenState)
icqGenState.Params.HostEnabled = true
Expand Down Expand Up @@ -281,7 +274,6 @@ func icqAllowedQueries() []string {
config.QueryDenomAuthorityMetadata,
config.QueryDenomsFromCreator,
config.QueryTokeFactoryParams,
config.QueryPobParams,
config.QueryPFMParams,
}
}
17 changes: 0 additions & 17 deletions app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@ func TestGenesis(t *testing.T) {
"denom_metadata": [],
"send_enabled": []
},
"builder": {
"params": {
"max_bundle_size": 2,
"escrow_account_address": "32sHF2qbF8xMmvwle9QEcy59Cbc=",
"reserve_fee": {
"denom": "uluna",
"amount": "1"
},
"min_bid_increment": {
"denom": "uluna",
"amount": "1"
},
"front_running_protection": true,
"proposer_fee": "0.000000000000000000"
}
},
"capability": {
"index": "1",
"owners": []
Expand Down Expand Up @@ -396,7 +380,6 @@ func TestGenesis(t *testing.T) {
"/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata",
"/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator",
"/osmosis.tokenfactory.v1beta1.Query/Params",
"/pob.builder.v1.Query/Params",
"/router.v1.Query/Params"
]
}
Expand Down
17 changes: 0 additions & 17 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,13 @@ import (
tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

pobtype "github.com/skip-mev/pob/x/builder/types"
"github.com/terra-money/alliance/x/alliance"
alliancekeeper "github.com/terra-money/alliance/x/alliance/keeper"
alliancetypes "github.com/terra-money/alliance/x/alliance/types"
custombankkeeper "github.com/terra-money/core/v2/x/bank/keeper"
feesharekeeper "github.com/terra-money/core/v2/x/feeshare/keeper"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"

pobkeeper "github.com/skip-mev/pob/x/builder/keeper"

terraappconfig "github.com/terra-money/core/v2/app/config"
// unnamed import of statik for swagger UI support
_ "github.com/terra-money/core/v2/client/docs/statik"
Expand All @@ -126,7 +123,6 @@ var maccPerms = map[string][]string{
tokenfactorytypes.ModuleName: {authtypes.Burner, authtypes.Minter},
alliancetypes.ModuleName: {authtypes.Burner, authtypes.Minter},
alliancetypes.RewardsPoolName: nil,
pobtype.ModuleName: nil,
}

type TerraAppKeepers struct {
Expand Down Expand Up @@ -177,9 +173,6 @@ type TerraAppKeepers struct {

WasmKeeper customwasmkeeper.Keeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper

// BuilderKeeper is the keeper that handles processing auction transactions
BuilderKeeper pobkeeper.Keeper
}

func NewTerraAppKeepers(
Expand Down Expand Up @@ -534,16 +527,6 @@ func NewTerraAppKeepers(
),
)

keepers.BuilderKeeper = pobkeeper.NewKeeper(
appCodec,
keys[pobtype.StoreKey],
keepers.AccountKeeper,
keepers.BankKeeper,
keepers.DistrKeeper,
keepers.StakingKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

return keepers
}

Expand Down
4 changes: 1 addition & 3 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ import (
alliancetypes "github.com/terra-money/alliance/x/alliance/types"
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"

pobtype "github.com/skip-mev/pob/x/builder/types"

// unnamed import of statik for swagger UI support
_ "github.com/terra-money/core/v2/client/docs/statik"
)
Expand All @@ -62,7 +60,7 @@ func (keepers *TerraAppKeepers) GenerateKeys() {
icahosttypes.StoreKey, icacontrollertypes.StoreKey, routertypes.StoreKey,
consensusparamtypes.StoreKey, tokenfactorytypes.StoreKey, wasmtypes.StoreKey,
ibcfeetypes.StoreKey, ibchookstypes.StoreKey, crisistypes.StoreKey,
alliancetypes.StoreKey, feesharetypes.StoreKey, pobtype.StoreKey, icqtypes.StoreKey,
alliancetypes.StoreKey, feesharetypes.StoreKey, icqtypes.StoreKey,
)

keepers.tkeys = sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down
8 changes: 0 additions & 8 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ import (
"github.com/terra-money/alliance/x/alliance"
feeshare "github.com/terra-money/core/v2/x/feeshare"

pob "github.com/skip-mev/pob/x/builder"
pobtype "github.com/skip-mev/pob/x/builder/types"

ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
terrappsparams "github.com/terra-money/core/v2/app/params"

Expand Down Expand Up @@ -119,7 +116,6 @@ var ModuleBasics = module.NewBasicManager(
consensus.AppModuleBasic{},
alliance.AppModuleBasic{},
feeshare.AppModuleBasic{},
pob.AppModuleBasic{},
icq.AppModuleBasic{},
)

Expand Down Expand Up @@ -157,7 +153,6 @@ func appModules(app *TerraApp, encodingConfig terrappsparams.EncodingConfig, ski
tokenfactory.NewAppModule(app.Keepers.TokenFactoryKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
alliance.NewAppModule(app.appCodec, app.Keepers.AllianceKeeper, app.Keepers.StakingKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, app.interfaceRegistry, app.GetSubspace(alliancetypes.ModuleName)),
feeshare.NewAppModule(app.Keepers.FeeShareKeeper, app.Keepers.AccountKeeper, app.GetSubspace(feesharetypes.ModuleName)),
pob.NewAppModule(app.appCodec, app.Keepers.BuilderKeeper),
icq.NewAppModule(app.Keepers.ICQKeeper),
}
}
Expand Down Expand Up @@ -196,7 +191,6 @@ var initGenesisOrder = []string{
feesharetypes.ModuleName,
consensusparamtypes.ModuleName,
icqtypes.ModuleName,
pobtype.ModuleName,
}

var beginBlockersOrder = []string{
Expand Down Expand Up @@ -229,7 +223,6 @@ var beginBlockersOrder = []string{
feesharetypes.ModuleName,
consensusparamtypes.ModuleName,
icqtypes.ModuleName,
pobtype.ModuleName,
}

var endBlockerOrder = []string{
Expand Down Expand Up @@ -262,5 +255,4 @@ var endBlockerOrder = []string{
feesharetypes.ModuleName,
consensusparamtypes.ModuleName,
icqtypes.ModuleName,
pobtype.ModuleName,
}
Loading

0 comments on commit 6e5cceb

Please sign in to comment.