Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Aug 29, 2024
1 parent 1c82a81 commit d45cea5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (k Keeper) registerInterchainAccount(ctx context.Context, connectionID, por
}
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
msg := channeltypes.NewMsgChannelOpenInit(portID, version, ordering, []string{connectionID}, icatypes.HostPortID, authtypes.NewModuleAddress(icatypes.ModuleName).String())
handler := k.msgRouter.Handler(msg)
res, err := handler(sdkCtx, msg)
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/keeper/escrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (k Keeper) distributePacketFeeOnTimeout(ctx context.Context, refundAddr, ti
// the state changes will be discarded.
func (k Keeper) distributeFee(ctx context.Context, receiver, refundAccAddress sdk.AccAddress, fee sdk.Coins) {
// cache context before trying to distribute fees
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
cacheCtx, writeFn := sdkCtx.CacheContext()

err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, receiver, fee)
Expand Down
8 changes: 4 additions & 4 deletions modules/apps/29-fee/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func emitIncentivizedPacketEvent(ctx context.Context, packetID channeltypes.Pack
totalTimeoutFees = totalTimeoutFees.Add(fee.Fee.TimeoutFee...)
}
}
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeIncentivizedPacket,
Expand All @@ -47,7 +47,7 @@ func emitIncentivizedPacketEvent(ctx context.Context, packetID channeltypes.Pack

// emitRegisterPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel
func emitRegisterPayeeEvent(ctx context.Context, relayer, payee, channelID string) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeRegisterPayee,
Expand All @@ -64,7 +64,7 @@ func emitRegisterPayeeEvent(ctx context.Context, relayer, payee, channelID strin

// emitRegisterCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel
func emitRegisterCounterpartyPayeeEvent(ctx context.Context, relayer, counterpartyPayee, channelID string) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeRegisterCounterpartyPayee,
Expand All @@ -81,7 +81,7 @@ func emitRegisterCounterpartyPayeeEvent(ctx context.Context, relayer, counterpar

// emitDistributeFeeEvent emits an event containing a distribution fee and receiver address
func emitDistributeFeeEvent(ctx context.Context, receiver string, fee sdk.Coins) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove when Upgrading to 52
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeDistributeFee,
Expand Down
4 changes: 2 additions & 2 deletions modules/capability/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (k *Keeper) IsSealed() bool {
// can't initialize it in a constructor.
func (k *Keeper) InitMemStore(ctx context.Context) {
// create context with no block gas meter to ensure we do not consume gas during local initialization logic.
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after 52 upgrade
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
noGasCtx := sdkCtx.WithBlockGasMeter(storetypes.NewInfiniteGasMeter()).WithGasMeter(storetypes.NewInfiniteGasMeter())

// check if memory store has not been initialized yet by checking if initialized flag is nil.
Expand Down Expand Up @@ -544,6 +544,6 @@ func (sk ScopedKeeper) getOwners(ctx context.Context, cap *types.Capability) *ty
}

func logger(ctx context.Context) log.Logger {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: remove after 52 upgrade
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
return sdkCtx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}
2 changes: 1 addition & 1 deletion modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (k *Keeper) WriteAcknowledgement(
"dst_channel", packet.GetDestChannel(),
)

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
emitWriteAcknowledgementEvent(sdkCtx, packet.(types.Packet), channel, bz)

return nil
Expand Down
6 changes: 3 additions & 3 deletions testing/mock/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (im IBCModule) OnRecvPacket(ctx context.Context, channelVersion string, pac
panic(err)
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvent(NewMockRecvPacketEvent())

if bytes.Equal(MockPacketData, packet.GetData()) {
Expand All @@ -162,7 +162,7 @@ func (im IBCModule) OnAcknowledgementPacket(ctx context.Context, channelVersion
panic(err)
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvent(NewMockAckPacketEvent())

return nil
Expand All @@ -181,7 +181,7 @@ func (im IBCModule) OnTimeoutPacket(ctx context.Context, channelVersion string,
panic(err)
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/7223
sdkCtx.EventManager().EmitEvent(NewMockTimeoutPacketEvent())

return nil
Expand Down

0 comments on commit d45cea5

Please sign in to comment.