Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete update status HostZoneUnbonding_EXIT_TRANSFER_QUEUE in UpdateHostZoneUnbondings function #542

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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