Skip to content

Commit

Permalink
fix: discontinued bucket can't be migrated (#625)
Browse files Browse the repository at this point in the history
* fix: discontinued bucket can't be migrated

* fix: check veld upgrade
  • Loading branch information
BarryTong65 authored May 28, 2024
1 parent 37eb89f commit 70e5d61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ replace (
github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.3.0
github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.7.2
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/greenfield-cosmos-sdk v1.7.3-0.20240527082454-48d116d99ca4
github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ github.com/bnb-chain/greenfield-cometbft v1.3.0 h1:v3nZ16ledTZGF5Csys7fTQGZcEV78
github.com/bnb-chain/greenfield-cometbft v1.3.0/go.mod h1:0D+VPivZTeBldjtGGi9LKbBnKEO/RtMRJikie92LkYI=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI=
github.com/bnb-chain/greenfield-cosmos-sdk v1.7.2 h1:Xr7NLxXZKHhRX1ccVCgOwo1miw4HcQ+POirvMKzKLLo=
github.com/bnb-chain/greenfield-cosmos-sdk v1.7.2/go.mod h1:2bwmwdXYBISnQoMwgAcZTVGt21lMsHZSeeeMByTvDlQ=
github.com/bnb-chain/greenfield-cosmos-sdk v1.7.3-0.20240527082454-48d116d99ca4 h1:0UFOOdVKbiIEfKkL15NJ/VtE6TSdlwM4HtJJuukJfio=
github.com/bnb-chain/greenfield-cosmos-sdk v1.7.3-0.20240527082454-48d116d99ca4/go.mod h1:2bwmwdXYBISnQoMwgAcZTVGt21lMsHZSeeeMByTvDlQ=
github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210 h1:GHPbV2bC+gmuO6/sG0Tm8oGal3KKSRlyE+zPscDjlA8=
github.com/bnb-chain/greenfield-cosmos-sdk/api v0.0.0-20230816082903-b48770f5e210/go.mod h1:vhsZxXE9tYJeYB5JR4hPhd6Pc/uPf7j1T8IJ7p9FdeM=
github.com/bnb-chain/greenfield-cosmos-sdk/math v0.0.0-20230816082903-b48770f5e210 h1:FLVOn4+OVbsKi2+YJX5kmD27/4dRu4FW7xCXFhzDO5s=
Expand Down
6 changes: 6 additions & 0 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,12 @@ func (k Keeper) MigrateBucket(ctx sdk.Context, operator sdk.AccAddress, bucketNa
return types.ErrInvalidBucketStatus.Wrapf("The bucket already been migrating")
}

if ctx.IsUpgraded(upgradetypes.Veld) {
if bucketInfo.BucketStatus == types.BUCKET_STATUS_DISCONTINUED {
return types.ErrInvalidBucketStatus.Wrapf("The discontinued bucket cannot be migrated")
}
}

srcSP := k.MustGetPrimarySPForBucket(ctx, bucketInfo)

dstSP, found := k.spKeeper.GetStorageProvider(ctx, dstPrimarySPID)
Expand Down

0 comments on commit 70e5d61

Please sign in to comment.