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

chore: renaming KeyForwardRelayerAddress to KeyRelayerAddressForAsyncAck #1343

Merged
merged 3 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (transfer) [\#1250](https://github.com/cosmos/ibc-go/pull/1250) Deprecate `GetTransferAccount` since the `transfer` module account is never used.
* (modules/29-fee)[\#1338](https://github.com/cosmos/ibc-go/pull/1338) Renaming `Result` field in `IncentivizedAcknowledgement` to `AppAcknowledgement`.
* (modules/29-fee)[\#1343](https://github.com/cosmos/ibc-go/pull/1343) Renaming `KeyForwardRelayerAddress` to `KeyRelayerAddressForAsyncAck`, and `ParseKeyForwardRelayerAddress` to `ParseKeyRelayerAddressForAsyncAck`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably don't need a changelog since ics29 hasn't been released, but doesn't hurt


### State Machine Breaking

Expand Down
8 changes: 4 additions & 4 deletions modules/apps/29-fee/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []types.RegisteredRelaye
// SetRelayerAddressForAsyncAck sets the forward relayer address during OnRecvPacket in case of async acknowledgement
func (k Keeper) SetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId, address string) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyForwardRelayerAddress(packetID), []byte(address))
store.Set(types.KeyRelayerAddressForAsyncAck(packetID), []byte(address))
}

// GetRelayerAddressForAsyncAck gets forward relayer address for a particular packet
func (k Keeper) GetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId) (string, bool) {
store := ctx.KVStore(k.storeKey)
key := types.KeyForwardRelayerAddress(packetID)
key := types.KeyRelayerAddressForAsyncAck(packetID)
if !store.Has(key) {
return "", false
}
Expand All @@ -214,7 +214,7 @@ func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRe

var forwardRelayerAddr []types.ForwardRelayerAddress
for ; iterator.Valid(); iterator.Next() {
packetID, err := types.ParseKeyForwardRelayerAddress(string(iterator.Key()))
packetID, err := types.ParseKeyRelayerAddressForAsyncAck(string(iterator.Key()))
if err != nil {
panic(err)
}
Expand All @@ -233,7 +233,7 @@ func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRe
// Deletes the forwardRelayerAddr associated with the packetID
func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltypes.PacketId) {
store := ctx.KVStore(k.storeKey)
key := types.KeyForwardRelayerAddress(packetID)
key := types.KeyRelayerAddressForAsyncAck(packetID)
store.Delete(key)
}

Expand Down
8 changes: 4 additions & 4 deletions modules/apps/29-fee/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func ParseKeyCounterpartyRelayer(key string) (address string, channelID string,
return keySplit[1], keySplit[2], nil
}

// KeyForwardRelayerAddress returns the key for packetID -> forwardAddress mapping
func KeyForwardRelayerAddress(packetID channeltypes.PacketId) []byte {
// KeyRelayerAddressForAsyncAck returns the key for packetID -> forwardAddress mapping
func KeyRelayerAddressForAsyncAck(packetID channeltypes.PacketId) []byte {
return []byte(fmt.Sprintf("%s/%s/%s/%d", ForwardRelayerPrefix, packetID.PortId, packetID.ChannelId, packetID.Sequence))
}

// ParseKeyForwardRelayerAddress parses the key used to store the forward relayer address and returns the packetID
func ParseKeyForwardRelayerAddress(key string) (channeltypes.PacketId, error) {
// ParseKeyRelayerAddressForAsyncAck parses the key used to store the forward relayer address and returns the packetID
func ParseKeyRelayerAddressForAsyncAck(key string) (channeltypes.PacketId, error) {
keySplit := strings.Split(key, "/")
if len(keySplit) != 4 {
return channeltypes.PacketId{}, sdkerrors.Wrapf(
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestParseKeyForwardRelayerAddress(t *testing.T) {
}{
{
"success",
string(types.KeyForwardRelayerAddress(validPacketID)),
string(types.KeyRelayerAddressForAsyncAck(validPacketID)),
true,
},
{
Expand All @@ -129,7 +129,7 @@ func TestParseKeyForwardRelayerAddress(t *testing.T) {
}

for _, tc := range testCases {
packetID, err := types.ParseKeyForwardRelayerAddress(tc.key)
packetID, err := types.ParseKeyRelayerAddressForAsyncAck(tc.key)

if tc.expPass {
require.NoError(t, err)
Expand Down