From 8e36da4d90460cb027273c2ccdee3b872d6ca660 Mon Sep 17 00:00:00 2001 From: Alexgao001 Date: Wed, 8 Nov 2023 17:36:30 +0800 Subject: [PATCH] feat: disable sp exit and bucket migration msg --- app/upgrade.go | 14 +++++++++++--- e2e/tests/permission_test.go | 4 ++-- x/storage/keeper/keeper.go | 1 - 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/upgrade.go b/app/upgrade.go index 1bc7023e0..48185de08 100644 --- a/app/upgrade.go +++ b/app/upgrade.go @@ -4,7 +4,6 @@ import ( serverconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/gashub/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" bridgemoduletypes "github.com/bnb-chain/greenfield/x/bridge/types" @@ -80,8 +79,17 @@ func (app *App) registerPampasUpgradeHandler() { app.CrossChainKeeper.SetChannelSendPermission(ctx, sdk.ChainID(app.appConfig.CrossChain.DestOpChainId), storagemoduletypes.ObjectChannelId, sdk.ChannelAllow) app.CrossChainKeeper.SetChannelSendPermission(ctx, sdk.ChainID(app.appConfig.CrossChain.DestOpChainId), storagemoduletypes.GroupChannelId, sdk.ChannelAllow) - // register MsgRejectMigrateBucket Gas param - app.GashubKeeper.SetMsgGasParams(ctx, *types.NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgRejectMigrateBucket", 1.2e3)) + // disable sp exit + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.virtualgroup.MsgSwapOut") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.virtualgroup.MsgCompleteSwapOut") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.virtualgroup.MsgCancelSwapOut") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.virtualgroup.MsgStorageProviderExit") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.virtualgroup.MsgCompleteStorageProviderExit") + + // disable bucket migration. + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.storage.MsgMigrateBucket") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.storage.MsgCancelMigrateBucket") + app.GashubKeeper.DeleteMsgGasParams(ctx, "/greenfield.storage.MsgCompleteMigrateBucket") return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) diff --git a/e2e/tests/permission_test.go b/e2e/tests/permission_test.go index 699d4f1b8..bf998799e 100644 --- a/e2e/tests/permission_test.go +++ b/e2e/tests/permission_test.go @@ -1925,7 +1925,7 @@ func (s *StorageTestSuite) TestExpiredAccountPolicyGCAndRePut() { Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, Effect: types.EFFECT_ALLOW, } - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) msgPutBucketPolicy := storagetypes.NewMsgPutPolicy(owner.GetAddr(), types2.NewBucketGRN(bucketName).String(), principal, []*types.Statement{bucketStatement}, &expirationTime) @@ -1990,7 +1990,7 @@ func (s *StorageTestSuite) TestExpiredGroupPolicyGCAndRePut() { principal := types.NewPrincipalWithGroupId(headGroupResponse.GroupInfo.Id) // Put bucket policy for group - expirationTime := time.Now().Add(5 * time.Second) + expirationTime := time.Now().Add(3 * time.Second) bucketStatement := &types.Statement{ Actions: []types.ActionType{types.ACTION_DELETE_BUCKET}, diff --git a/x/storage/keeper/keeper.go b/x/storage/keeper/keeper.go index ba8033826..6e7c4f2c2 100644 --- a/x/storage/keeper/keeper.go +++ b/x/storage/keeper/keeper.go @@ -569,7 +569,6 @@ func (k Keeper) CreateObject( operator.String(), bucketName) } - // We use the last address in SecondarySpAddresses to store the creator so that it can be identified when canceling create var creator sdk.AccAddress if !operator.Equals(sdk.MustAccAddressFromHex(bucketInfo.Owner)) { creator = operator