Skip to content

Commit

Permalink
adding error wrapping to AuthenticateTx
Browse files Browse the repository at this point in the history
  • Loading branch information
damiannolan committed Nov 3, 2021
1 parent 0c51aff commit 8e5664e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modules/apps/27-interchain-accounts/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ func (k Keeper) createOutgoingPacket(
func (k Keeper) AuthenticateTx(ctx sdk.Context, msgs []sdk.Msg, portID string) error {
interchainAccountAddr, found := k.GetInterchainAccountAddress(ctx, portID)
if !found {
return sdkerrors.ErrUnauthorized
return sdkerrors.Wrapf(types.ErrInterchainAccountNotFound, "failed to retrieve interchain account on port %s", portID)
}

for _, msg := range msgs {
for _, signer := range msg.GetSigners() {
if interchainAccountAddr != signer.String() {
return sdkerrors.ErrUnauthorized
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "failed to authenticate interchain account transaction")
}
}
}
Expand Down Expand Up @@ -143,8 +143,7 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet) error
return err
}

err = k.executeTx(ctx, packet.SourcePort, packet.DestinationPort, packet.DestinationChannel, msgs)
if err != nil {
if err = k.executeTx(ctx, packet.SourcePort, packet.DestinationPort, packet.DestinationChannel, msgs); err != nil {
return err
}

Expand Down

0 comments on commit 8e5664e

Please sign in to comment.