Skip to content

Commit

Permalink
removed val-set creation fee
Browse files Browse the repository at this point in the history
  • Loading branch information
stackman27 committed Oct 31, 2022
1 parent bdff9b3 commit e488471
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 889 deletions.
3 changes: 1 addition & 2 deletions app/upgrades/v13/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package v13
import (
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/osmosis-labs/osmosis/v12/app/upgrades"
validatorpreferencetypes "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types"
)

// UpgradeName defines the on-chain upgrade name for the Osmosis v9 upgrade.
Expand All @@ -13,7 +12,7 @@ var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{validatorpreferencetypes.StoreKey},
Added: []string{},
Deleted: []string{}, // double check bech32ibc
},
}
3 changes: 0 additions & 3 deletions app/upgrades/v13/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/osmosis-labs/osmosis/v12/app/keepers"
"github.com/osmosis-labs/osmosis/v12/app/upgrades"
lockuptypes "github.com/osmosis-labs/osmosis/v12/x/lockup/types"
validatorpreferencetypes "github.com/osmosis-labs/osmosis/v12/x/valset-pref/types"
)

func CreateUpgradeHandler(
Expand All @@ -20,8 +19,6 @@ func CreateUpgradeHandler(
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
keepers.LockupKeeper.SetParams(ctx, lockuptypes.DefaultParams())

keepers.ValidatorPreferenceKeeper.SetParams(ctx, validatorpreferencetypes.DefaultParams())

return mm.RunMigrations(ctx, configurator, fromVM)
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/CosmWasm/wasmd v0.28.0-osmo-v12
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.1
github.com/cosmos/cosmos-sdk v0.46.3
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/iavl v0.19.1
github.com/cosmos/ibc-go/v3 v3.3.0
Expand Down
15 changes: 0 additions & 15 deletions proto/osmosis/valset-pref/v1beta1/genesis.proto

This file was deleted.

17 changes: 0 additions & 17 deletions proto/osmosis/valset-pref/v1beta1/params.proto

This file was deleted.

20 changes: 0 additions & 20 deletions x/valset-pref/genesis.go

This file was deleted.

15 changes: 0 additions & 15 deletions x/valset-pref/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ func NewKeeper(storeKey sdk.StoreKey,
bankKeeper types.BankInterface,
distrKeeper types.DistrInterface,
) Keeper {
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
}

return Keeper{
storeKey: storeKey,
paramSpace: paramSpace,
Expand Down Expand Up @@ -64,14 +60,3 @@ func (k Keeper) GetValidatorSetPreference(ctx sdk.Context, delegator string) (ty

return validatorSet, true
}

// GetParams returns the total set params.
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
k.paramSpace.GetParamSet(ctx, &params)
return params
}

// SetParams sets the total set of params.
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramSpace.SetParamSet(ctx, &params)
}
42 changes: 4 additions & 38 deletions x/valset-pref/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
name string
delegator sdk.AccAddress
preferences []types.ValidatorPreference
creationFee sdk.Coins
expectPass bool
}{
{
Expand All @@ -36,8 +35,7 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
Weight: sdk.NewDecWithPrec(2, 1),
},
},
creationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))),
expectPass: true,
expectPass: true,
},
{
name: "update existing validator with same valAddr and weights",
Expand All @@ -56,8 +54,7 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
Weight: sdk.NewDecWithPrec(2, 1),
},
},
creationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))),
expectPass: false,
expectPass: false,
},
{
name: "update existing validator with same valAddr but different weights",
Expand All @@ -76,8 +73,7 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
Weight: sdk.NewDecWithPrec(5, 1),
},
},
creationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))),
expectPass: true,
expectPass: true,
},
{
name: "create validator set with unknown validator address",
Expand All @@ -88,40 +84,14 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
Weight: sdk.NewDec(1),
},
},
creationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))),
expectPass: false,
},
{
name: "creation of new validator set with 0 fees",
delegator: sdk.AccAddress([]byte("addr3---------------")),
preferences: []types.ValidatorPreference{
{
ValOperAddress: valAddrs[0],
Weight: sdk.NewDecWithPrec(5, 1),
},
{
ValOperAddress: valAddrs[1],
Weight: sdk.NewDecWithPrec(5, 1),
},
},
creationFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(0))),
expectPass: false,
expectPass: false,
},
}

for _, test := range tests {
suite.Run(test.name, func() {

bankKeeper := suite.App.BankKeeper

// fund the account that is trying to delegate
suite.FundAcc(test.delegator, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100)})
initialBalance := bankKeeper.GetBalance(suite.Ctx, test.delegator, sdk.DefaultBondDenom).Amount

// set the creation fee
suite.App.ValidatorPreferenceKeeper.SetParams(suite.Ctx, types.Params{
ValsetCreationFee: test.creationFee,
})

// setup message server
msgServer := valPref.NewMsgServerImpl(suite.App.ValidatorPreferenceKeeper)
Expand All @@ -131,10 +101,6 @@ func (suite *KeeperTestSuite) TestSetValidatorSetPreference() {
_, err := msgServer.SetValidatorSetPreference(c, types.NewMsgSetValidatorSetPreference(test.delegator, test.preferences))
if test.expectPass {
suite.Require().NoError(err)

// check if the fee has been used
balance := bankKeeper.GetBalance(suite.Ctx, test.delegator, sdk.DefaultBondDenom).Amount
suite.Require().True(balance.LT(initialBalance))
} else {
suite.Require().Error(err)
}
Expand Down
17 changes: 0 additions & 17 deletions x/valset-pref/types/genesis.go

This file was deleted.

Loading

0 comments on commit e488471

Please sign in to comment.