Skip to content

Commit

Permalink
Fixes (#519)
Browse files Browse the repository at this point in the history
* debug

* fix: ensure we choose the correct transfer channel; it must be open

* dont attempt to handle rewards if no withdraw account exists yet

* remove debug lines

* formatting

---------

Co-authored-by: Ajaz Ahmed Ansari <[email protected]>
  • Loading branch information
Joe Bowman and ajansari95 authored Aug 2, 2023
1 parent 204ea95 commit 68e3ac7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions x/interchainstaking/keeper/ibc_packet_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types"
"github.com/golang/protobuf/proto" //nolint:staticcheck
lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types"

"github.com/ingenuity-build/quicksilver/utils"
"github.com/ingenuity-build/quicksilver/utils/addressutils"
queryTypes "github.com/ingenuity-build/quicksilver/x/interchainquery/types"
"github.com/ingenuity-build/quicksilver/x/interchainstaking/types"
lsmstakingtypes "github.com/iqlusioninc/liquidity-staking-module/x/staking/types"
)

type TypedMsg struct {
Expand Down Expand Up @@ -320,7 +319,7 @@ func (k *Keeper) HandleMsgTransfer(ctx sdk.Context, msg sdk.Msg) error {

var channel *channeltypes.IdentifiedChannel
k.IBCKeeper.ChannelKeeper.IterateChannels(ctx, func(ic channeltypes.IdentifiedChannel) bool {
if ic.Counterparty.ChannelId == sMsg.SourceChannel && ic.Counterparty.PortId == sMsg.SourcePort && len(ic.ConnectionHops) == 1 && ic.ConnectionHops[0] == zone.ConnectionId {
if ic.Counterparty.ChannelId == sMsg.SourceChannel && ic.Counterparty.PortId == sMsg.SourcePort && len(ic.ConnectionHops) == 1 && ic.ConnectionHops[0] == zone.ConnectionId && ic.State == channeltypes.OPEN {
channel = &ic
return true
}
Expand Down
10 changes: 6 additions & 4 deletions x/participationrewards/keeper/rewards_holdings.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ func (k Keeper) AllocateHoldingsRewards(ctx sdk.Context) error {
}
}

if err := k.DistributeToUsersFromAddress(ctx, icsRewardsAllocations, zone.WithdrawalAddress.Address); err != nil {
k.Logger(ctx).Error("failed to distribute to users", "ua", userAllocations, "err", err)
// we might want to do a soft fail here so that all zones are not affected...
return false
if zone.WithdrawalAddress != nil {
if err := k.DistributeToUsersFromAddress(ctx, icsRewardsAllocations, zone.WithdrawalAddress.Address); err != nil {
k.Logger(ctx).Error("failed to distribute to users", "ua", userAllocations, "err", err)
// we might want to do a soft fail here so that all zones are not affected...
return false
}
}

k.ClaimsManagerKeeper.ArchiveAndGarbageCollectClaims(ctx, zone.ChainId)
Expand Down

0 comments on commit 68e3ac7

Please sign in to comment.