Skip to content

Commit

Permalink
fix(delayedack): acknowledgement not written in case of ackerr (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin authored and omritoptix committed Apr 14, 2024
1 parent e415fb5 commit b026d27
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 4 additions & 1 deletion x/common/types/rollapp_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ func (r RollappPacket) GetEvents() []sdk.Attribute {
sdk.NewAttribute(AttributeKeyPacketDestinationPort, r.Packet.DestinationPort),
sdk.NewAttribute(AttributeKeyPacketDestinationChannel, r.Packet.DestinationChannel),
sdk.NewAttribute(AttributeKeyPacketSequence, strconv.FormatUint(r.Packet.Sequence, 10)),
sdk.NewAttribute(AttributeKeyPacketError, r.Error),
}
if r.Error != "" {
eventAttributes = append(eventAttributes, sdk.NewAttribute(AttributeKeyPacketError, r.Error))
}

return eventAttributes
}

Expand Down
7 changes: 1 addition & 6 deletions x/delayedack/rollapp_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
commontypes "github.com/dymensionxyz/dymension/v3/x/common/types"
"github.com/dymensionxyz/dymension/v3/x/delayedack/keeper"
Expand Down Expand Up @@ -105,11 +104,7 @@ func (im IBCMiddleware) onRecvPacket(rollappPacket commontypes.RollappPacket, lo
if ack == nil {
return
}
// If sync, check if the acknowledgement is successful
if !ack.Success() {
err = sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, string(ack.Acknowledgement()))
return
}

// Write the acknowledgement to the chain only if it is synchronous
var chanCap *capabilitytypes.Capability
_, chanCap, err = im.keeper.LookupModuleByChannel(
Expand Down
6 changes: 4 additions & 2 deletions x/rollapp/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ func (k msgServer) TriggerGenesisEvent(goCtx context.Context, msg *types.MsgRoll
ctx := sdk.UnwrapSDKContext(goCtx)

// Get the sender and validate they are in the whitelist
if !k.IsAddressInDeployerWhiteList(ctx, msg.Address) {
return nil, sdkerrors.ErrUnauthorized
if whitelist := k.DeployerWhitelist(ctx); len(whitelist) > 0 {
if !k.IsAddressInDeployerWhiteList(ctx, msg.Address) {
return nil, sdkerrors.ErrUnauthorized
}
}

// Get the rollapp
Expand Down

0 comments on commit b026d27

Please sign in to comment.