Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed consumer param store updates #892

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4. Whitelist missing param keys and register stTokens as consumer fees ([#881](https://github.com/Stride-Labs/stride/pull/881))
5. Add v13 Upgrade Handler ([#886](https://github.com/Stride-Labs/stride/pull/886))
6. Change paths to point towards v13 ([#891](https://github.com/Stride-Labs/stride/pull/888))
7. Removed consumer param store updates ([#892](https://github.com/Stride-Labs/stride/pull/892))

### Off-Chain changes
1. Add `build-linux` command ([#859](https://github.com/Stride-Labs/stride/pull/859))
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/v13/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
4. Whitelist missing param keys and register stTokens as consumer fees ([#881](https://github.com/Stride-Labs/stride/pull/881))
5. Add v13 Upgrade Handler ([#886](https://github.com/Stride-Labs/stride/pull/886))
6. Change paths to point towards v13 ([#891](https://github.com/Stride-Labs/stride/pull/888))
7. Removed consumer param store updates ([#892](https://github.com/Stride-Labs/stride/pull/892))
18 changes: 0 additions & 18 deletions app/upgrades/v13/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package v13

import (
errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

stakeibckeeper "github.com/Stride-Labs/stride/v13/x/stakeibc/keeper"
stakeibctypes "github.com/Stride-Labs/stride/v13/x/stakeibc/types"
)

var (
Expand All @@ -23,21 +20,6 @@ func CreateUpgradeHandler(
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting upgrade v13...")

ctx.Logger().Info("Registering stTokens to consumer reward denom whitelist...")
hostZones := stakeibcKeeper.GetAllHostZone(ctx)
allDenoms := []string{}

// get all stToken denoms
for _, zone := range hostZones {
allDenoms = append(allDenoms, stakeibctypes.StAssetDenomFromHostZoneDenom(zone.HostDenom))
}

err := stakeibcKeeper.RegisterStTokenDenomsToWhitelist(ctx, allDenoms)
if err != nil {
return nil, errorsmod.Wrapf(err, "unable to register stTokens to whitelist")
}

return mm.RunMigrations(ctx, configurator, vm)
}
}
23 changes: 0 additions & 23 deletions app/upgrades/v13/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/suite"

"github.com/Stride-Labs/stride/v13/app/apptesting"
stakeibctypes "github.com/Stride-Labs/stride/v13/x/stakeibc/types"
)

type UpgradeTestSuite struct {
Expand All @@ -23,27 +22,5 @@ func TestKeeperTestSuite(t *testing.T) {

func (s *UpgradeTestSuite) TestUpgrade() {
dummyUpgradeHeight := int64(5)

// Clear the reward denoms in the consumer keeper
consumerParams := s.App.ConsumerKeeper.GetConsumerParams(s.Ctx)
consumerParams.RewardDenoms = []string{"denomA", "denomB"}
s.App.ConsumerKeeper.SetParams(s.Ctx, consumerParams)

// Add host zones
hostZones := []stakeibctypes.HostZone{
{ChainId: "cosmoshub-4", HostDenom: "uatom"},
{ChainId: "osmosis-1", HostDenom: "uosmo"},
{ChainId: "juno-1", HostDenom: "ujuno"},
}
for _, hostZone := range hostZones {
s.App.StakeibcKeeper.SetHostZone(s.Ctx, hostZone)
}

// Submit the upgrade which should register the new host denoms
s.ConfirmUpgradeSucceededs("v13", dummyUpgradeHeight)

// Confirm the new reward denoms were registered
expectedRewardDenoms := []string{"denomA", "denomB", "stuatom", "stuosmo", "stujuno"}
consumerParams = s.App.ConsumerKeeper.GetConsumerParams(s.Ctx)
s.Require().ElementsMatch(expectedRewardDenoms, consumerParams.RewardDenoms)
}
7 changes: 6 additions & 1 deletion x/stakeibc/keeper/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ func (s *KeeperTestSuite) TestRegisterStTokenDenomsToWhitelist() {
_, err := s.GetMsgServer().RegisterHostZone(sdk.WrapSDKContext(s.Ctx), &tc.validMsg)
s.Require().NoError(err, "able to successfully register host zone")

// RegisterHostZone should have already registered stToken to consumer reward denom whitelist
// TODO: Remove this change after ICS consumer keeper validation is fixed
params := s.App.ConsumerKeeper.GetConsumerParams(s.Ctx)
params.RewardDenoms = []string{"stuatom"}
s.App.ConsumerKeeper.SetParams(s.Ctx, params)

// RegisterHostZone should have already registered stToken to consumer reward denom whitelist
params = s.App.ConsumerKeeper.GetConsumerParams(s.Ctx)
stDenom := stakeibctypes.StAssetDenomFromHostZoneDenom(tc.validMsg.HostDenom)
expectedWhitelist := []string{stDenom}
s.Require().Equal([]string{stDenom}, params.RewardDenoms)
Expand Down
9 changes: 0 additions & 9 deletions x/stakeibc/keeper/msg_server_register_host_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ func (k msgServer) RegisterHostZone(goCtx context.Context, msg *types.MsgRegiste
}
k.RecordsKeeper.AppendDepositRecord(ctx, depositRecord)

// register stToken to consumer reward denom whitelist so that
// stToken rewards can be distributed to provider validators
err = k.RegisterStTokenDenomsToWhitelist(ctx, []string{types.StAssetDenomFromHostZoneDenom(zone.HostDenom)})
if err != nil {
errMsg := fmt.Sprintf("unable to register reward denom, err: %s", err.Error())
k.Logger(ctx).Error(errMsg)
return nil, errorsmod.Wrapf(types.ErrFailedToRegisterHostZone, errMsg)
}

// emit events
ctx.EventManager().EmitEvent(
sdk.NewEvent(
Expand Down