From 38b778fd588cf8a86b562a816be90a7b2dca9ee9 Mon Sep 17 00:00:00 2001 From: Rayden Ge Date: Thu, 12 Dec 2024 23:27:38 +0100 Subject: [PATCH] chore(staking): remove intermediate code of audit fix (#32) * chore(staking): remove intermediate code of audit fix * chore(staking): unit test --- x/staking/keeper/unbonding.go | 21 --------------------- x/staking/migrations/v3/json_test.go | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/x/staking/keeper/unbonding.go b/x/staking/keeper/unbonding.go index 19159a662203..f4f9aabc386f 100644 --- a/x/staking/keeper/unbonding.go +++ b/x/staking/keeper/unbonding.go @@ -10,27 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func (k Keeper) GetOldUnbondingID(ctx context.Context) (unbondingID uint64, err error) { - store := k.storeService.OpenKVStore(ctx) - // Old UnbondingID used same key as period delegation - bz, err := store.Get(types.PeriodDelegationKey) - if err != nil { - return 0, err - } - - if bz != nil { - unbondingID = binary.BigEndian.Uint64(bz) - } - - return unbondingID, err -} - -func (k Keeper) RemoveOldUnbondingID(ctx context.Context) error { - store := k.storeService.OpenKVStore(ctx) - // Old UnbondingID used same key as period delegation, which is not used independently. - return store.Delete(types.PeriodDelegationKey) -} - func (k Keeper) GetUnbondingID(ctx context.Context) (unbondingID uint64, err error) { store := k.storeService.OpenKVStore(ctx) bz, err := store.Get(types.UnbondingIDKey) diff --git a/x/staking/migrations/v3/json_test.go b/x/staking/migrations/v3/json_test.go index c32fd35f90b5..3ef76ae885ee 100644 --- a/x/staking/migrations/v3/json_test.go +++ b/x/staking/migrations/v3/json_test.go @@ -56,12 +56,12 @@ func TestMigrateJSON(t *testing.T) { "rewards_multiplier": "1.000000000000000000" }, { - "duration": "2592000s", + "duration": "7776000s", "period_type": 1, "rewards_multiplier": "1.051000000000000000" }, { - "duration": "31536000s", + "duration": "31104000s", "period_type": 2, "rewards_multiplier": "1.160000000000000000" },