Skip to content

Commit

Permalink
remove globalfee (#536)
Browse files Browse the repository at this point in the history
* remove globalfee

* tidy price feeder

* remove stale const
  • Loading branch information
Reecepbcups authored Jan 26, 2023
1 parent 72f1c8a commit 08a5709
Show file tree
Hide file tree
Showing 13 changed files with 6,166 additions and 6,645 deletions.
22 changes: 8 additions & 14 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,25 @@ import (

feeshareante "github.com/CosmosContracts/juno/v12/x/feeshare/ante"
feesharekeeper "github.com/CosmosContracts/juno/v12/x/feeshare/keeper"
gaiafeeante "github.com/cosmos/gaia/v8/x/globalfee/ante"
)

func updateAppSimulationFlag(flag bool) {
decorators.DefaultIsAppSimulation = flag
}

const maxBypassMinFeeMsgGasUsage = 1_000_000

// HandlerOptions extends the SDK's AnteHandler options by requiring the IBC
// channel keeper and a BankKeeper with an added method for fee sharing.
type HandlerOptions struct {
ante.HandlerOptions

GovKeeper govkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
BankKeeperFork feeshareante.BankKeeper
TxCounterStoreKey sdk.StoreKey
WasmConfig wasmTypes.WasmConfig
Cdc codec.BinaryCodec
BypassMinFeeMsgTypes []string
GlobalFeeSubspace paramtypes.Subspace
StakingSubspace paramtypes.Subspace
GovKeeper govkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
BankKeeperFork feeshareante.BankKeeper
TxCounterStoreKey sdk.StoreKey
WasmConfig wasmTypes.WasmConfig
Cdc codec.BinaryCodec
StakingSubspace paramtypes.Subspace
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand Down Expand Up @@ -78,7 +73,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
gaiafeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeSubspace, options.StakingSubspace, maxBypassMinFeeMsgGasUsage),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
feeshareante.NewFeeSharePayoutDecorator(options.BankKeeperFork, options.FeeShareKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
Expand Down
38 changes: 8 additions & 30 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
ibcchanneltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
"github.com/ignite-hq/cli/ignite/pkg/openapiconsole"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
Expand All @@ -46,8 +43,6 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/gaia/v8/x/globalfee"

"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand All @@ -60,7 +55,6 @@ import (
v11 "github.com/CosmosContracts/juno/v12/app/upgrades/v11"
v12 "github.com/CosmosContracts/juno/v12/app/upgrades/v12"
oracleclient "github.com/CosmosContracts/juno/v12/x/oracle/client"
oracletypes "github.com/CosmosContracts/juno/v12/x/oracle/types"
)

const (
Expand Down Expand Up @@ -307,16 +301,14 @@ func New(
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},

GovKeeper: app.GovKeeper,
IBCKeeper: app.IBCKeeper,
FeeShareKeeper: app.FeeShareKeeper,
BankKeeperFork: app.BankKeeper, // since we need extra methods
TxCounterStoreKey: app.GetKey(wasm.StoreKey),
WasmConfig: wasmConfig,
Cdc: appCodec,
BypassMinFeeMsgTypes: GetDefaultBypassFeeMessages(),
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
StakingSubspace: app.GetSubspace(stakingtypes.ModuleName),
GovKeeper: app.GovKeeper,
IBCKeeper: app.IBCKeeper,
FeeShareKeeper: app.FeeShareKeeper,
BankKeeperFork: app.BankKeeper, // since we need extra methods
TxCounterStoreKey: app.GetKey(wasm.StoreKey),
WasmConfig: wasmConfig,
Cdc: appCodec,
StakingSubspace: app.GetSubspace(stakingtypes.ModuleName),
},
)
if err != nil {
Expand Down Expand Up @@ -366,20 +358,6 @@ func New(
return app
}

func GetDefaultBypassFeeMessages() []string {
return []string{
// IBC
sdk.MsgTypeURL(&ibcchanneltypes.MsgRecvPacket{}),
sdk.MsgTypeURL(&ibcchanneltypes.MsgAcknowledgement{}),
sdk.MsgTypeURL(&ibcclienttypes.MsgUpdateClient{}),
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}),

// Oracle
sdk.MsgTypeURL(&oracletypes.MsgAggregateExchangeRatePrevote{}),
sdk.MsgTypeURL(&oracletypes.MsgAggregateExchangeRateVote{}),
}
}

// Name returns the name of the App
func (app *App) Name() string {
return app.BaseApp.Name()
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ import (
icacontrollerkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"

"github.com/cosmos/gaia/v8/x/globalfee"
intertxkeeper "github.com/cosmos/interchain-accounts/x/inter-tx/keeper"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"

Expand Down Expand Up @@ -528,7 +527,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(oracletypes.ModuleName)
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(globalfee.ModuleName)
paramsKeeper.Subspace(feesharetypes.ModuleName)

return paramsKeeper
Expand Down
6 changes: 0 additions & 6 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/cosmos/gaia/v8/x/globalfee"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
ibcfee "github.com/cosmos/ibc-go/v4/modules/apps/29-fee"
Expand Down Expand Up @@ -106,7 +105,6 @@ var ModuleBasics = module.NewBasicManager(
intertx.AppModuleBasic{},
tokenfactory.AppModuleBasic{},
feeshare.AppModuleBasic{},
globalfee.AppModuleBasic{},
ibchooks.AppModuleBasic{},
packetforward.AppModuleBasic{},
)
Expand Down Expand Up @@ -142,7 +140,6 @@ func appModules(
transfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper),
globalfee.NewAppModule(app.GetSubspace(globalfee.ModuleName)),
feeshare.NewAppModule(app.FeeShareKeeper, app.AccountKeeper),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
Expand Down Expand Up @@ -214,7 +211,6 @@ func orderBeginBlockers() []string {
oracletypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
}
Expand Down Expand Up @@ -248,7 +244,6 @@ func orderEndBlockers() []string {
oracletypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
}
Expand Down Expand Up @@ -282,7 +277,6 @@ func orderInitBlockers() []string {
ibcfeetypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
}
Expand Down
2 changes: 0 additions & 2 deletions app/upgrades/v12/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
feesharetypes "github.com/CosmosContracts/juno/v12/x/feeshare/types"
oracletypes "github.com/CosmosContracts/juno/v12/x/oracle/types"
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/gaia/v8/x/globalfee"
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
Expand All @@ -24,7 +23,6 @@ var Upgrade = upgrades.Upgrade{
tokenfactorytypes.ModuleName,
oracletypes.ModuleName,
feesharetypes.ModuleName,
globalfee.ModuleName,
ibcfeetypes.ModuleName,
intertxtypes.ModuleName,
ibchookstypes.StoreKey,
Expand Down
15 changes: 0 additions & 15 deletions app/upgrades/v12/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
globalfeetypes "github.com/cosmos/gaia/v8/x/globalfee/types"
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"

packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
Expand Down Expand Up @@ -123,20 +122,6 @@ func CreateV12UpgradeHandler(
keepers.ICAControllerKeeper.SetParams(ctx, icacontrollertypes.Params{ControllerEnabled: true})
logger.Info("upgraded ICAHostKeeper params")

// GlobalFee
minGasPrices := sdk.DecCoins{
// 0.0025ujuno
sdk.NewDecCoinFromDec(nativeDenom, sdk.NewDecWithPrec(25, 4)),
// 0.001 ATOM CHANNEL-1 -> `junod q ibc-transfer denom-trace ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9`
sdk.NewDecCoinFromDec("ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9", sdk.NewDecWithPrec(1, 3)),
}
s, ok := keepers.ParamsKeeper.GetSubspace(globalfeetypes.ModuleName)
if !ok {
panic("global fee params subspace not found")
}
s.Set(ctx, globalfeetypes.ParamStoreKeyMinGasPrices, minGasPrices)
logger.Info(fmt.Sprintf("upgraded global fee params to %s", minGasPrices))

// Oracle
newOracleParams := oracletypes.DefaultParams()

Expand Down
Loading

0 comments on commit 08a5709

Please sign in to comment.