-
Notifications
You must be signed in to change notification settings - Fork 624
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
ics29:fix: store source address for query later on WriteAck #912
Changes from 2 commits
53ecc94
c43ff9d
88cf2be
f4b6cd5
88eac60
9afb86d
64d6742
fb0625e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package keeper | |
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" | ||
|
||
"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" | ||
|
@@ -19,11 +20,17 @@ func (k Keeper) SendPacket(ctx sdk.Context, chanCap *capabilitytypes.Capability, | |
func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement []byte) error { | ||
// retrieve the forward relayer that was stored in `onRecvPacket` | ||
packetId := channeltypes.NewPacketId(packet.GetSourceChannel(), packet.GetSourcePort(), packet.GetSequence()) | ||
|
||
// relayer address returned here is the | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
relayer, _ := k.GetForwardRelayerAddress(ctx, packetId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AdityaSripal Can you remind me again why you don't want to error here? I'm throwing an error below if not found, wondering if you want to omit this also? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should throw an error here since that should never happen. |
||
forwardRelayer, found := k.GetCounterpartyAddress(ctx, relayer) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to ignore the error here. This is because its possible that relayer has not registered counterparty address. If they haven't then, we just write acknowledgement with an empty relayer address. We don't want to prevent writeacknowledgement from succeeding because relayer hasn't registered counterparty address. This effectively means that recv_fee will get refunded and not incentivized, but that's the relayer's fault There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be commented in the code ^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
if !found { | ||
return sdkerrors.Wrapf(types.ErrCounterpartyAddressEmpty, "counterparty address not found for address: %s", forwardRelayer) | ||
} | ||
|
||
k.DeleteForwardRelayerAddress(ctx, packetId) | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ack := types.NewIncentivizedAcknowledgement(relayer, acknowledgement) | ||
ack := types.NewIncentivizedAcknowledgement(forwardRelayer, acknowledgement) | ||
|
||
// ics4Wrapper may be core IBC or higher-level middleware | ||
return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're technically not setting the ForwardRelayerAddress anymore, I'm wondering if we should have a different setter for this use case specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes maybe we should name it something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side note: we can add a test for this after #927 is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mapping only used for async acks? Maybe the function name should take that into account?
SetRelayerAddressForAsyncAck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with
SetRelayerAddressForAsyncAck
& respective getter fn