Skip to content

Commit

Permalink
chore(staking): remove intermediate code of audit fix (#32)
Browse files Browse the repository at this point in the history
* chore(staking): remove intermediate code of audit fix

* chore(staking): unit test
  • Loading branch information
ezreal1997 authored Dec 12, 2024
1 parent badc47d commit 38b778f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
21 changes: 0 additions & 21 deletions x/staking/keeper/unbonding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x/staking/migrations/v3/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 38b778f

Please sign in to comment.