Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(delayedack): acknowledgement not written in case of ackerr #824

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading