Skip to content

Commit

Permalink
addressed riley pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sampocs committed Aug 27, 2024
1 parent c3642aa commit 90d4085
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
12 changes: 6 additions & 6 deletions x/icacallbacks/migrations/v2/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ func convertCallbackData(oldCallbackData icacallbacktypes.CallbackData) (icacall
// Deserialize the callback args with the old DelegateCallback type
oldDelegateCallback := oldstakeibctypes.DelegateCallback{}
if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldDelegateCallback); err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to unmarshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to unmarshal")
}

// Convert and serialize with the new DelegateCallback type
newDelegateCallback := convertDelegateCallback(oldDelegateCallback)
newDelegateCallbackBz, err := proto.Marshal(&newDelegateCallback)
if err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to marshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to marshal")
}

// Update the CallbackData with the new args
Expand All @@ -91,14 +91,14 @@ func convertCallbackData(oldCallbackData icacallbacktypes.CallbackData) (icacall
// Deserialize the callback args with the old UndelegateCallback type
oldUndelegateCallback := oldstakeibctypes.UndelegateCallback{}
if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldUndelegateCallback); err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to unmarshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to unmarshal")
}

// Convert and serialize with the new UndelegateCallback type
newUndelegateCallback := convertUndelegateCallback(oldUndelegateCallback)
newUndelegateCallbackBz, err := proto.Marshal(&newUndelegateCallback)
if err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to marshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to marshal")
}

// Update the CallbackData with the new args
Expand All @@ -108,14 +108,14 @@ func convertCallbackData(oldCallbackData icacallbacktypes.CallbackData) (icacall
// Deserialize the callback args with the old RebalanceCallback type
oldRebalanceCallback := oldstakeibctypes.RebalanceCallback{}
if err := proto.Unmarshal(oldCallbackData.CallbackArgs, &oldRebalanceCallback); err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to unmarshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to unmarshal")
}

// Convert and serialize with the new RebalanceCallback type
newRebalanceCallback := convertRebalanceCallback(oldRebalanceCallback)
newRebalanceCallbackBz, err := proto.Marshal(&newRebalanceCallback)
if err != nil {
return icacallbacktypes.CallbackData{}, errorsmod.Wrapf(err, "failed to marshal")
return icacallbacktypes.CallbackData{}, errorsmod.Wrap(err, "failed to marshal")
}

// Update the CallbackData with the new args
Expand Down
10 changes: 5 additions & 5 deletions x/icaoracle/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ func DefaultGenesis() *GenesisState {
// failure.
func (gs GenesisState) Validate() error {
if err := gs.Params.Validate(); err != nil {
return errorsmod.Wrapf(err, "invalid genesis state")
return errorsmod.Wrap(err, "invalid genesis state")
}
for _, oracle := range gs.Oracles {
if oracle.ChainId == "" {
return errorsmod.Wrapf(ErrInvalidGenesisState, "oracle has empty chain ID")
return errorsmod.Wrap(ErrInvalidGenesisState, "oracle has empty chain ID")
}
}
for _, metric := range gs.Metrics {
if metric.Key == "" {
return errorsmod.Wrapf(ErrInvalidGenesisState, "metric has missing key")
return errorsmod.Wrap(ErrInvalidGenesisState, "metric has missing key")
}
if metric.UpdateTime == 0 {
return errorsmod.Wrapf(ErrInvalidGenesisState, "metric has missing time")
return errorsmod.Wrap(ErrInvalidGenesisState, "metric has missing time")
}
if metric.DestinationOracle == "" {
return errorsmod.Wrapf(ErrInvalidGenesisState, "metric has missing destination oracle chain ID")
return errorsmod.Wrap(ErrInvalidGenesisState, "metric has missing destination oracle chain ID")
}
}

Expand Down
6 changes: 3 additions & 3 deletions x/interchainquery/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ func (k *Keeper) SubmitICQRequest(ctx sdk.Context, query types.Query, forceUniqu
// In the query response, this will be used to verify that the query wasn't historical
connection, found := k.IBCKeeper.ConnectionKeeper.GetConnection(ctx, query.ConnectionId)
if !found {
return errorsmod.Wrapf(connectiontypes.ErrConnectionNotFound, "%s", query.ConnectionId)
return errorsmod.Wrap(connectiontypes.ErrConnectionNotFound, query.ConnectionId)
}
clientState, found := k.IBCKeeper.ClientKeeper.GetClientState(ctx, connection.ClientId)
if !found {
return errorsmod.Wrapf(clienttypes.ErrClientNotFound, "%s", connection.ClientId)
return errorsmod.Wrap(clienttypes.ErrClientNotFound, connection.ClientId)
}
query.SubmissionHeight = clientState.GetLatestHeight().GetRevisionHeight()

Expand All @@ -96,7 +96,7 @@ func (k *Keeper) RetryICQRequest(ctx sdk.Context, query types.Query) error {

// Submit a new query (with a new ID)
if err := k.SubmitICQRequest(ctx, query, true); err != nil {
return errorsmod.Wrapf(err, "failed to retry query")
return errorsmod.Wrap(err, types.ErrFailedToRetryQuery.Error())
}

return nil
Expand Down
3 changes: 1 addition & 2 deletions x/stakeibc/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ func (k msgServer) ClaimUndelegatedTokens(goCtx context.Context, msg *types.MsgC
}

// Confirm host zone is not halted
_, err = k.GetActiveHostZone(ctx, msg.HostZoneId)
if err != nil {
if _, err = k.GetActiveHostZone(ctx, msg.HostZoneId); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion x/stakeibc/keeper/epoch_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (k Keeper) GetStrideEpochElapsedShare(ctx sdk.Context) (sdk.Dec, error) {
}
epochEndTime, err := cast.ToInt64E(epochTracker.NextEpochStartTime)
if err != nil {
return sdk.ZeroDec(), errorsmod.Wrapf(err, "unable to convert next epoch start time to int64")
return sdk.ZeroDec(), errorsmod.Wrap(err, "unable to convert next epoch start time to int64")
}
epochStartTime := epochEndTime - epochDuration

Expand Down
2 changes: 1 addition & 1 deletion x/stakeibc/keeper/icacallbacks_redemption.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (k Keeper) RedemptionCallback(ctx sdk.Context, packet channeltypes.Packet,
icacallbackstypes.AckResponseStatus_FAILURE, packet))

// Reset unbondings record status
err := k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE)
err = k.RecordsKeeper.SetHostZoneUnbondingStatus(ctx, chainId, redemptionCallback.EpochUnbondingRecordIds, recordstypes.HostZoneUnbonding_EXIT_TRANSFER_QUEUE)
if err != nil {
return err
}
Expand Down

0 comments on commit 90d4085

Please sign in to comment.