Skip to content

Commit

Permalink
calibration: do not block ICAs
Browse files Browse the repository at this point in the history
  • Loading branch information
riley-stride committed Oct 11, 2023
1 parent 57d61c6 commit 9463f14
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
30 changes: 0 additions & 30 deletions x/stakeibc/keeper/icqcallbacks_callibrate_delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,6 @@ func CalibrateDelegationCallback(k Keeper, ctx sdk.Context, args []byte, query i
return errorsmod.Wrapf(types.ErrValidatorNotFound, "no registered validator for address (%s)", queriedDelegation.ValidatorAddress)
}

// Check if the ICQ overlapped a delegation, undelegation, or detokenization ICA
// that would have modfied the number of delegated tokens
prevInternalDelegation := callbackData.InitialValidatorDelegation
currInternalDelegation := validator.Delegation
icaOverlappedIcq, err := k.CheckDelegationChangedDuringQuery(ctx, validator, prevInternalDelegation, currInternalDelegation)
if err != nil {
return err
}

// If the ICA/ICQ overlapped, submit a new query
if icaOverlappedIcq {
// Store the updated validator delegation amount
callbackDataBz, err := proto.Marshal(&types.DelegatorSharesQueryCallback{
InitialValidatorDelegation: currInternalDelegation,
})
if err != nil {
return errorsmod.Wrapf(err, "unable to marshal delegator shares callback data")
}
query.CallbackData = callbackDataBz

if err := k.InterchainQueryKeeper.RetryICQRequest(ctx, query); err != nil {
return errorsmod.Wrapf(err, "unable to resubmit delegator shares query")
}
return nil
}

// If there was no ICA/ICQ overlap, update the validator to indicate that the query
// is no longer in progress (which will unblock LSM liquid stakes to that validator)
validator.SlashQueryInProgress = false

// Calculate the number of tokens delegated (using the internal sharesToTokensRate)
// note: truncateInt per https://github.com/cosmos/cosmos-sdk/blob/cb31043d35bad90c4daa923bb109f38fd092feda/x/staking/types/validator.go#L431
delegatedTokens := queriedDelegation.Shares.Mul(validator.SharesToTokensRate).TruncateInt()
Expand Down
5 changes: 0 additions & 5 deletions x/stakeibc/keeper/msg_server_submit_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,11 +526,6 @@ func (k Keeper) SubmitCalibrationICQ(ctx sdk.Context, hostZone types.HostZone, v
return errorsmod.Wrapf(err, "unable to marshal delegator shares callback data")
}

// Update the validator to indicate that the slash query is in progress
validator.SlashQueryInProgress = true
hostZone.Validators[valIndex] = &validator
k.SetHostZone(ctx, hostZone)

// Submit delegator shares ICQ
query := icqtypes.Query{
ChainId: hostZone.ChainId,
Expand Down

0 comments on commit 9463f14

Please sign in to comment.