Skip to content

Commit

Permalink
Delete update status HostZoneUnbonding_EXIT_TRANSFER_QUEUE in UpdateH…
Browse files Browse the repository at this point in the history
…ostZoneUnbondings function (#542)

Co-authored-by: DongLieu <duongduydongtq@gmail.com>
Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
  • Loading branch information
3 people authored Feb 16, 2023
1 parent 42e2618 commit 0413e99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions x/stakeibc/keeper/icacallbacks_undelegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func (k Keeper) GetLatestCompletionTime(ctx sdk.Context, msgResponses [][]byte)
}

// UpdateHostZoneUnbondings does two things:
// 1. Update the status and time of each hostZoneUnbonding on each epochUnbondingRecord
// 2. Return the number of stTokens that need to be burned
// 1. Update the time of each hostZoneUnbonding on each epochUnbondingRecord
// 2. Return the number of stTokens that need to be burned
func (k Keeper) UpdateHostZoneUnbondings(
ctx sdk.Context,
latestCompletionTime time.Time,
Expand All @@ -196,8 +196,7 @@ func (k Keeper) UpdateHostZoneUnbondings(
stTokenAmount := hostZoneUnbonding.StTokenAmount
stTokenBurnAmount = stTokenBurnAmount.Add(stTokenAmount)

// Update the bonded status and time
hostZoneUnbonding.Status = recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE
// Update the bonded time
hostZoneUnbonding.UnbondingTime = cast.ToUint64(latestCompletionTime.UnixNano())
updatedEpochUnbondingRecord, success := k.RecordsKeeper.AddHostZoneToEpochUnbondingRecord(ctx, epochUnbondingRecord.EpochNumber, chainId, hostZoneUnbonding)
if !success {
Expand Down
2 changes: 0 additions & 2 deletions x/stakeibc/keeper/icacallbacks_undelegate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,13 @@ func (s *KeeperTestSuite) TestUpdateHostZoneUnbondings_Success() {
s.Require().True(found)

hzu1 := epochUnbondingRecord1.HostZoneUnbondings[0]
s.Require().Equal(recordtypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE, hzu1.Status, "hzu1 status is EXIT_TRANSFER_QUEUE")
s.Require().Equal(completionTime.UnixNano(), int64(hzu1.UnbondingTime), "hzu1 completion time is set")

hzu2 := epochUnbondingRecord1.HostZoneUnbondings[1]
s.Require().Equal(recordtypes.HostZoneUnbonding_UNBONDING_QUEUE, hzu2.Status, "hzu2 status is UNBONDING_QUEUE")
s.Require().Equal(int64(0), int64(hzu2.UnbondingTime), "hzu2 completion time is NOT set")

hzu3 := epochUnbondingRecord2.HostZoneUnbondings[0]
s.Require().Equal(recordtypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE, hzu3.Status, "hzu3 status is EXIT_TRANSFER_QUEUE")
s.Require().Equal(completionTime.UnixNano(), int64(hzu3.UnbondingTime), "hzu3 completion time is set")
}

Expand Down

0 comments on commit 0413e99

Please sign in to comment.