Skip to content

Commit

Permalink
Revert "feat: tax2gas" (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrathCole authored Sep 5, 2024
1 parent 8bd7278 commit 203aa53
Show file tree
Hide file tree
Showing 63 changed files with 1,842 additions and 5,617 deletions.
13 changes: 2 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import (
v7_1 "github.com/classic-terra/core/v3/app/upgrades/v7_1"
v8 "github.com/classic-terra/core/v3/app/upgrades/v8"
v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1"
v9 "github.com/classic-terra/core/v3/app/upgrades/v9"

customante "github.com/classic-terra/core/v3/custom/auth/ante"
custompost "github.com/classic-terra/core/v3/custom/auth/post"
Expand Down Expand Up @@ -88,7 +87,6 @@ var (
v7_1.Upgrade,
v8.Upgrade,
v8_1.Upgrade,
v9.Upgrade,
}

// Forks defines forks to be applied to the network
Expand Down Expand Up @@ -242,7 +240,6 @@ func NewTerraApp(
TXCounterStoreKey: app.GetKey(wasmtypes.StoreKey),
DyncommKeeper: app.DyncommKeeper,
StakingKeeper: app.StakingKeeper,
Tax2Gaskeeper: app.Tax2gasKeeper,
Cdc: app.appCodec,
},
)
Expand All @@ -252,13 +249,7 @@ func NewTerraApp(

postHandler, err := custompost.NewPostHandler(
custompost.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
FeegrantKeeper: app.FeeGrantKeeper,
DistrKeeper: app.DistrKeeper,
DyncommKeeper: app.DyncommKeeper,
TreasuryKeeper: app.TreasuryKeeper,
Tax2Gaskeeper: app.Tax2gasKeeper,
DyncommKeeper: app.DyncommKeeper,
},
)
if err != nil {
Expand Down Expand Up @@ -407,7 +398,7 @@ func (app *TerraApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC
// RegisterTxService implements the Application.RegisterTxService method.
func (app *TerraApp) RegisterTxService(clientCtx client.Context) {
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
customauthtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.TreasuryKeeper, app.Tax2gasKeeper)
customauthtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.TreasuryKeeper)
}

// RegisterTendermintService implements the Application.RegisterTendermintService method.
Expand Down
18 changes: 4 additions & 14 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ import (
markettypes "github.com/classic-terra/core/v3/x/market/types"
oraclekeeper "github.com/classic-terra/core/v3/x/oracle/keeper"
oracletypes "github.com/classic-terra/core/v3/x/oracle/types"
tax2gasKeeper "github.com/classic-terra/core/v3/x/tax2gas/keeper"
tax2gasTypes "github.com/classic-terra/core/v3/x/tax2gas/types"
treasurykeeper "github.com/classic-terra/core/v3/x/treasury/keeper"
treasurytypes "github.com/classic-terra/core/v3/x/treasury/types"
)
Expand Down Expand Up @@ -105,10 +103,10 @@ type AppKeepers struct {
DyncommKeeper dyncommkeeper.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
Tax2gasKeeper tax2gasKeeper.Keeper
Ics20WasmHooks *ibchooks.WasmHooks
IBCHooksWrapper *ibchooks.ICS4Middleware
TransferStack ibctransfer.IBCModule

Ics20WasmHooks *ibchooks.WasmHooks
IBCHooksWrapper *ibchooks.ICS4Middleware
TransferStack ibctransfer.IBCModule

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -158,7 +156,6 @@ func NewAppKeepers(
treasurytypes.StoreKey,
wasmtypes.StoreKey,
dyncommtypes.StoreKey,
tax2gasTypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -279,12 +276,6 @@ func NewAppKeepers(
stakingtypes.NewMultiStakingHooks(appKeepers.DistrKeeper.Hooks(), appKeepers.SlashingKeeper.Hooks()),
)

appKeepers.Tax2gasKeeper = tax2gasKeeper.NewKeeper(
appCodec,
appKeepers.keys[tax2gasTypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// Create IBC Keeper
appKeepers.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
Expand Down Expand Up @@ -399,7 +390,6 @@ func NewAppKeepers(
appKeepers.BankKeeper,
appKeepers.TreasuryKeeper,
appKeepers.AccountKeeper,
appKeepers.Tax2gasKeeper,
appCodec,
appKeepers.TransferKeeper,
)
Expand Down
7 changes: 0 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
markettypes "github.com/classic-terra/core/v3/x/market/types"
"github.com/classic-terra/core/v3/x/oracle"
oracletypes "github.com/classic-terra/core/v3/x/oracle/types"
tax2gas "github.com/classic-terra/core/v3/x/tax2gas"
tax2gasTypes "github.com/classic-terra/core/v3/x/tax2gas/types"
"github.com/classic-terra/core/v3/x/treasury"
treasuryclient "github.com/classic-terra/core/v3/x/treasury/client"
treasurytypes "github.com/classic-terra/core/v3/x/treasury/types"
Expand Down Expand Up @@ -125,7 +123,6 @@ var (
customwasm.AppModuleBasic{},
ibcfee.AppModuleBasic{},
dyncomm.AppModuleBasic{},
tax2gas.AppModuleBasic{},
ibchooks.AppModuleBasic{},
consensus.AppModuleBasic{},
)
Expand Down Expand Up @@ -187,7 +184,6 @@ func appModules(
treasury.NewAppModule(appCodec, app.TreasuryKeeper),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
dyncomm.NewAppModule(appCodec, app.DyncommKeeper, app.StakingKeeper),
tax2gas.NewAppModule(appCodec, app.Tax2gasKeeper),
ibchooks.NewAppModule(app.AccountKeeper),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
Expand Down Expand Up @@ -254,7 +250,6 @@ func orderBeginBlockers() []string {
markettypes.ModuleName,
wasmtypes.ModuleName,
dyncommtypes.ModuleName,
tax2gasTypes.ModuleName,
// consensus module
consensusparamtypes.ModuleName,
}
Expand Down Expand Up @@ -289,7 +284,6 @@ func orderEndBlockers() []string {
markettypes.ModuleName,
wasmtypes.ModuleName,
dyncommtypes.ModuleName,
tax2gasTypes.ModuleName,
// consensus module
consensusparamtypes.ModuleName,
}
Expand Down Expand Up @@ -324,7 +318,6 @@ func orderInitGenesis() []string {
treasurytypes.ModuleName,
wasmtypes.ModuleName,
dyncommtypes.ModuleName,
tax2gasTypes.ModuleName,
// consensus module
consensusparamtypes.ModuleName,
}
Expand Down
24 changes: 2 additions & 22 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli"

tax2gastypes "github.com/classic-terra/core/v3/x/tax2gas/types"
)

// SimAppChainID hardcoded chainID for simulation
Expand Down Expand Up @@ -145,33 +142,16 @@ func TestAppStateDeterminism(t *testing.T) {
simtestutil.EmptyAppOptions{}, emptyWasmOpts, interBlockCacheOpt(), fauxMerkleModeOpt(),
)

appGenState := app.DefaultGenesis()
tax2gasGenState := tax2gastypes.GenesisState{}
err := app.AppCodec().UnmarshalJSON(appGenState[tax2gastypes.ModuleName], &tax2gasGenState)
require.NoError(t, err)

tax2gasGenState.Params = tax2gastypes.Params{
Enabled: true,
GasPrices: sdk.DecCoins{
sdk.NewDecCoinFromDec("stake", sdk.NewDecWithPrec(0, 3)),
},
}
newGenState := tax2gasGenState
bz, err := app.AppCodec().MarshalJSON(&newGenState)
require.NoError(t, err)

appGenState[tax2gastypes.ModuleName] = bz

fmt.Printf(
"running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n",
config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed,
)

_, _, err = simulation.SimulateFromSeed(
_, _, err := simulation.SimulateFromSeed(
t,
os.Stdout,
app.BaseApp,
AppStateFn(app.AppCodec(), app.SimulationManager(), appGenState),
AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()),
simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1
simtestutil.SimulationOperations(app, app.AppCodec(), config),
app.ModuleAccountAddrs(),
Expand Down
20 changes: 0 additions & 20 deletions app/upgrades/v9/constants.go

This file was deleted.

31 changes: 0 additions & 31 deletions app/upgrades/v9/upgrades.go

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/updates/prepare_cosmovisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# These fields should be fetched automatically in the future
# Need to do more upgrade to see upgrade patterns
OLD_VERSION=v3.1.3
OLD_VERSION=v3.0.3
# this command will retrieve the folder with the largest number in format v<number>
SOFTWARE_UPGRADE_NAME=$(ls -d -- ./app/upgrades/v* | sort -Vr | head -n 1 | xargs basename)
BUILDDIR=$1
Expand Down
8 changes: 2 additions & 6 deletions custom/auth/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import (

dyncommante "github.com/classic-terra/core/v3/x/dyncomm/ante"
dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper"
tax2gasante "github.com/classic-terra/core/v3/x/tax2gas/ante"
tax2gaskeeper "github.com/classic-terra/core/v3/x/tax2gas/keeper"
tax2gastypes "github.com/classic-terra/core/v3/x/tax2gas/types"
"github.com/cosmos/cosmos-sdk/codec"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
Expand All @@ -29,7 +26,7 @@ type HandlerOptions struct {
AccountKeeper ante.AccountKeeper
BankKeeper BankKeeper
ExtensionOptionChecker ante.ExtensionOptionChecker
FeegrantKeeper tax2gastypes.FeegrantKeeper
FeegrantKeeper ante.FeegrantKeeper
OracleKeeper OracleKeeper
TreasuryKeeper TreasuryKeeper
SignModeHandler signing.SignModeHandler
Expand All @@ -43,7 +40,6 @@ type HandlerOptions struct {
TXCounterStoreKey storetypes.StoreKey
DyncommKeeper dyncommkeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
Tax2Gaskeeper tax2gaskeeper.Keeper
Cdc codec.BinaryCodec
}

Expand Down Expand Up @@ -92,7 +88,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
// MinInitialDepositDecorator prevents submitting governance proposal low initial deposit
NewMinInitialDepositDecorator(options.GovKeeper, options.TreasuryKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
tax2gasante.NewFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TreasuryKeeper, options.Tax2Gaskeeper),
NewFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TreasuryKeeper, options.DistributionKeeper),
dyncommante.NewDyncommDecorator(options.Cdc, options.DyncommKeeper, options.StakingKeeper),

// Do not add any other decorators below this point unless explicitly explain.
Expand Down
6 changes: 0 additions & 6 deletions custom/auth/ante/expected_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ type OracleKeeper interface {

// BankKeeper defines the contract needed for supply related APIs (noalias)
type BankKeeper interface {
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error
SendCoins(ctx sdk.Context, from, to sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}

type DistrKeeper interface {
Expand All @@ -44,7 +42,3 @@ type DistrKeeper interface {
type GovKeeper interface {
GetDepositParams(ctx sdk.Context) govv1.DepositParams
}

type Tax2GasKeeper interface {
GetBurnTaxRate(ctx sdk.Context) (burnTaxRate sdk.Dec)
}
Loading

0 comments on commit 203aa53

Please sign in to comment.