Skip to content

Commit edd41da

Browse files
nit: remove needless logger definitions (#6262)
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
1 parent 478f4c6 commit edd41da

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

modules/apps/27-interchain-accounts/controller/keeper/migrations.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,23 @@ func NewMigrator(k *Keeper) Migrator {
2929
// are owned by the controller submodule and ibc.
3030
func (m Migrator) AssertChannelCapabilityMigrations(ctx sdk.Context) error {
3131
if m.keeper != nil {
32-
logger := m.keeper.Logger(ctx)
3332
filteredChannels := m.keeper.channelKeeper.GetAllChannelsWithPortPrefix(ctx, icatypes.ControllerPortPrefix)
3433
for _, ch := range filteredChannels {
3534
name := host.ChannelCapabilityPath(ch.PortId, ch.ChannelId)
3635
capability, found := m.keeper.scopedKeeper.GetCapability(ctx, name)
3736
if !found {
38-
logger.Error(fmt.Sprintf("failed to find capability: %s", name))
37+
m.keeper.Logger(ctx).Error(fmt.Sprintf("failed to find capability: %s", name))
3938
return errorsmod.Wrapf(capabilitytypes.ErrCapabilityNotFound, "failed to find capability: %s", name)
4039
}
4140

4241
isAuthenticated := m.keeper.scopedKeeper.AuthenticateCapability(ctx, capability, name)
4342
if !isAuthenticated {
44-
logger.Error(fmt.Sprintf("expected capability owner: %s", controllertypes.SubModuleName))
43+
m.keeper.Logger(ctx).Error(fmt.Sprintf("expected capability owner: %s", controllertypes.SubModuleName))
4544
return errorsmod.Wrapf(capabilitytypes.ErrCapabilityNotOwned, "expected capability owner: %s", controllertypes.SubModuleName)
4645
}
4746

4847
m.keeper.SetMiddlewareEnabled(ctx, ch.PortId, ch.ConnectionHops[0])
49-
logger.Info("successfully migrated channel capability", "name", name)
48+
m.keeper.Logger(ctx).Info("successfully migrated channel capability", "name", name)
5049
}
5150
}
5251
return nil

modules/apps/27-interchain-accounts/host/ibc_module.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ func (im IBCModule) OnRecvPacket(
116116
packet channeltypes.Packet,
117117
_ sdk.AccAddress,
118118
) ibcexported.Acknowledgement {
119-
logger := im.keeper.Logger(ctx)
120119
if !im.keeper.GetParams(ctx).HostEnabled {
121-
logger.Info("host submodule is disabled")
120+
im.keeper.Logger(ctx).Info("host submodule is disabled")
122121
keeper.EmitHostDisabledEvent(ctx, packet)
123122
return channeltypes.NewErrorAcknowledgement(types.ErrHostSubModuleDisabled)
124123
}
@@ -127,9 +126,9 @@ func (im IBCModule) OnRecvPacket(
127126
ack := channeltypes.NewResultAcknowledgement(txResponse)
128127
if err != nil {
129128
ack = channeltypes.NewErrorAcknowledgement(err)
130-
logger.Error(fmt.Sprintf("%s sequence %d", err.Error(), packet.Sequence))
129+
im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", err.Error(), packet.Sequence))
131130
} else {
132-
logger.Info("successfully handled packet", "sequence", packet.Sequence)
131+
im.keeper.Logger(ctx).Info("successfully handled packet", "sequence", packet.Sequence)
133132
}
134133

135134
// Emit an event indicating a successful or failed acknowledgement.

modules/apps/27-interchain-accounts/host/keeper/handshake.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func (k Keeper) OnChanOpenTry(
3030
counterparty channeltypes.Counterparty,
3131
counterpartyVersion string,
3232
) (string, error) {
33-
logger := k.Logger(ctx)
3433
if portID != icatypes.HostPortID {
3534
return "", errorsmod.Wrapf(icatypes.ErrInvalidHostPort, "expected %s, got %s", icatypes.HostPortID, portID)
3635
}
@@ -43,7 +42,7 @@ func (k Keeper) OnChanOpenTry(
4342
return "", errorsmod.Wrapf(err, "failed to retrieve connection %s", connectionHops[0])
4443
}
4544

46-
logger.Debug("counterparty version is invalid, proposing default metadata")
45+
k.Logger(ctx).Debug("counterparty version is invalid, proposing default metadata")
4746
metadata = icatypes.NewDefaultMetadata(connection.Counterparty.ConnectionId, connectionHops[0])
4847
}
4948

modules/apps/transfer/ibc_module.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,13 @@ func (im IBCModule) OnRecvPacket(
180180
packet channeltypes.Packet,
181181
relayer sdk.AccAddress,
182182
) ibcexported.Acknowledgement {
183-
logger := im.keeper.Logger(ctx)
184183
ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)})
185184

186185
var data types.FungibleTokenPacketData
187186
var ackErr error
188187
if err := json.Unmarshal(packet.GetData(), &data); err != nil {
189188
ackErr = errorsmod.Wrapf(ibcerrors.ErrInvalidType, "cannot unmarshal ICS-20 transfer packet data")
190-
logger.Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence))
189+
im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence))
191190
ack = channeltypes.NewErrorAcknowledgement(ackErr)
192191
}
193192

@@ -198,9 +197,9 @@ func (im IBCModule) OnRecvPacket(
198197
if err != nil {
199198
ack = channeltypes.NewErrorAcknowledgement(err)
200199
ackErr = err
201-
logger.Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence))
200+
im.keeper.Logger(ctx).Error(fmt.Sprintf("%s sequence %d", ackErr.Error(), packet.Sequence))
202201
} else {
203-
logger.Info("successfully handled ICS-20 packet", "sequence", packet.Sequence)
202+
im.keeper.Logger(ctx).Info("successfully handled ICS-20 packet", "sequence", packet.Sequence)
204203
}
205204
}
206205

modules/light-clients/07-tendermint/migrations/migrations.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ func PruneExpiredConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, clientK
4040
totalPruned += ibctm.PruneAllExpiredConsensusStates(ctx, clientStore, cdc, tmClientState)
4141
}
4242

43-
clientLogger := clientKeeper.Logger(ctx)
44-
clientLogger.Info("pruned expired tendermint consensus states", "total", totalPruned)
43+
clientKeeper.Logger(ctx).Info("pruned expired tendermint consensus states", "total", totalPruned)
4544

4645
return totalPruned, nil
4746
}

0 commit comments

Comments
 (0)