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

imp: make event emission functions unexported #3205

Merged
merged 4 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions modules/apps/29-fee/keeper/escrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (k Keeper) escrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId,
packetFees := types.NewPacketFees(fees)
k.SetFeesInEscrow(ctx, packetID, packetFees)

EmitIncentivizedPacketEvent(ctx, packetID, packetFees)
emitIncentivizedPacketEvent(ctx, packetID, packetFees)

return nil
}
Expand Down Expand Up @@ -168,9 +168,9 @@ func (k Keeper) distributeFee(ctx sdk.Context, receiver, refundAccAddress sdk.Ac
return // if sending to the refund address fails, no-op
}

EmitDistributeFeeEvent(ctx, refundAccAddress.String(), fee)
emitDistributeFeeEvent(ctx, refundAccAddress.String(), fee)
} else {
EmitDistributeFeeEvent(ctx, receiver.String(), fee)
emitDistributeFeeEvent(ctx, receiver.String(), fee)
}

// write the cache
Expand Down
16 changes: 8 additions & 8 deletions modules/apps/29-fee/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
)

// EmitIncentivizedPacketEvent emits an event containing information on the total amount of fees incentivizing
// emitIncentivizedPacketEvent emits an event containing information on the total amount of fees incentivizing
// a specific packet. It should be emitted on every fee escrowed for the given packetID.
func EmitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId, packetFees types.PacketFees) {
func emitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId, packetFees types.PacketFees) {
var (
totalRecvFees sdk.Coins
totalAckFees sdk.Coins
Expand Down Expand Up @@ -44,8 +44,8 @@ func EmitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId
})
}

// EmitRegisterPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel
func EmitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) {
// emitRegisterPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel
func emitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeRegisterPayee,
Expand All @@ -60,8 +60,8 @@ func EmitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string) {
})
}

// EmitRegisterCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel
func EmitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPayee, channelID string) {
// emitRegisterCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel
func emitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPayee, channelID string) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeRegisterCounterpartyPayee,
Expand All @@ -76,8 +76,8 @@ func EmitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPa
})
}

// EmitDistributeFeeEvent emits an event containing a distribution fee and receiver address
func EmitDistributeFeeEvent(ctx sdk.Context, receiver string, fee sdk.Coins) {
// emitDistributeFeeEvent emits an event containing a distribution fee and receiver address
func emitDistributeFeeEvent(ctx sdk.Context, receiver string, fee sdk.Coins) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeDistributeFee,
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee

k.Logger(ctx).Info("registering payee address for relayer", "relayer", msg.Relayer, "payee", msg.Payee, "channel", msg.ChannelId)

EmitRegisterPayeeEvent(ctx, msg.Relayer, msg.Payee, msg.ChannelId)
emitRegisterPayeeEvent(ctx, msg.Relayer, msg.Payee, msg.ChannelId)

return &types.MsgRegisterPayeeResponse{}, nil
}
Expand All @@ -69,7 +69,7 @@ func (k Keeper) RegisterCounterpartyPayee(goCtx context.Context, msg *types.MsgR

k.Logger(ctx).Info("registering counterparty payee for relayer", "relayer", msg.Relayer, "counterparty payee", msg.CounterpartyPayee, "channel", msg.ChannelId)

EmitRegisterCounterpartyPayeeEvent(ctx, msg.Relayer, msg.CounterpartyPayee, msg.ChannelId)
emitRegisterCounterpartyPayeeEvent(ctx, msg.Relayer, msg.CounterpartyPayee, msg.ChannelId)

return &types.MsgRegisterCounterpartyPayeeResponse{}, nil
}
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/keeper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (k Keeper) CreateClient(
[]metrics.Label{telemetry.NewLabel(types.LabelClientType, clientState.ClientType())},
)

EmitCreateClientEvent(ctx, clientID, clientState)
emitCreateClientEvent(ctx, clientID, clientState)

return clientID, nil
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, clientMsg exporte
},
)

EmitSubmitMisbehaviourEvent(ctx, clientID, clientState)
emitSubmitMisbehaviourEvent(ctx, clientID, clientState)

return nil
}
Expand All @@ -97,7 +97,7 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, clientMsg exporte
)

// emitting events in the keeper emits for both begin block and handler client updates
EmitUpdateClientEvent(ctx, clientID, clientState.ClientType(), consensusHeights, k.cdc, clientMsg)
emitUpdateClientEvent(ctx, clientID, clientState.ClientType(), consensusHeights, k.cdc, clientMsg)

return nil
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e
},
)

EmitUpgradeClientEvent(ctx, clientID, upgradedClient)
emitUpgradeClientEvent(ctx, clientID, upgradedClient)

return nil
}
24 changes: 12 additions & 12 deletions modules/core/02-client/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/cosmos/ibc-go/v7/modules/core/exported"
)

// EmitCreateClientEvent emits a create client event
func EmitCreateClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
// emitCreateClientEvent emits a create client event
func emitCreateClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeCreateClient,
Expand All @@ -30,8 +30,8 @@ func EmitCreateClientEvent(ctx sdk.Context, clientID string, clientState exporte
})
}

// EmitUpdateClientEvent emits an update client event
func EmitUpdateClientEvent(ctx sdk.Context, clientID string, clientType string, consensusHeights []exported.Height, cdc codec.BinaryCodec, clientMsg exported.ClientMessage) {
// emitUpdateClientEvent emits an update client event
func emitUpdateClientEvent(ctx sdk.Context, clientID string, clientType string, consensusHeights []exported.Height, cdc codec.BinaryCodec, clientMsg exported.ClientMessage) {
// Marshal the ClientMessage as an Any and encode the resulting bytes to hex.
// This prevents the event value from containing invalid UTF-8 characters
// which may cause data to be lost when JSON encoding/decoding.
Expand Down Expand Up @@ -65,8 +65,8 @@ func EmitUpdateClientEvent(ctx sdk.Context, clientID string, clientType string,
})
}

// EmitUpdateClientEvent emits an upgrade client event
func EmitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
// emitUpgradeClientEvent emits an upgrade client event
func emitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeUpgradeClient,
Expand All @@ -81,8 +81,8 @@ func EmitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState export
})
}

// EmitUpdateClientProposalEvent emits an update client proposal event
func EmitUpdateClientProposalEvent(ctx sdk.Context, clientID, clientType string) {
// emitUpdateClientProposalEvent emits an update client proposal event
func emitUpdateClientProposalEvent(ctx sdk.Context, clientID, clientType string) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeUpdateClientProposal,
Expand All @@ -96,8 +96,8 @@ func EmitUpdateClientProposalEvent(ctx sdk.Context, clientID, clientType string)
})
}

// EmitUpgradeClientProposalEvent emits an upgrade client proposal event
func EmitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) {
// emitUpgradeClientProposalEvent emits an upgrade client proposal event
func emitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeUpgradeClientProposal,
Expand All @@ -111,8 +111,8 @@ func EmitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64)
})
}

// EmitSubmitMisbehaviourEvent emits a client misbehaviour event
func EmitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
// emitSubmitMisbehaviourEvent emits a client misbehaviour event
func emitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeSubmitMisbehaviour,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdatePropo
}()

// emitting events in the keeper for proposal updates to clients
EmitUpdateClientProposalEvent(ctx, p.SubjectClientId, substituteClientState.ClientType())
emitUpdateClientProposalEvent(ctx, p.SubjectClientId, substituteClientState.ClientType())

return nil
}
Expand Down Expand Up @@ -96,7 +96,7 @@ func (k Keeper) HandleUpgradeProposal(ctx sdk.Context, p *types.UpgradeProposal)
}

// emitting an event for handling client upgrade proposal
EmitUpgradeClientProposalEvent(ctx, p.Title, p.Plan.Height)
emitUpgradeClientProposalEvent(ctx, p.Title, p.Plan.Height)

return nil
}
16 changes: 8 additions & 8 deletions modules/core/03-connection/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
)

// EmitConnectionOpenInitEvent emits a connection open init event
func EmitConnectionOpenInitEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) {
// emitConnectionOpenInitEvent emits a connection open init event
func emitConnectionOpenInitEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeConnectionOpenInit,
Expand All @@ -23,8 +23,8 @@ func EmitConnectionOpenInitEvent(ctx sdk.Context, connectionID string, clientID
})
}

// EmitConnectionOpenTryEvent emits a connection open try event
func EmitConnectionOpenTryEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) {
// emitConnectionOpenTryEvent emits a connection open try event
func emitConnectionOpenTryEvent(ctx sdk.Context, connectionID string, clientID string, counterparty types.Counterparty) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeConnectionOpenTry,
Expand All @@ -40,8 +40,8 @@ func EmitConnectionOpenTryEvent(ctx sdk.Context, connectionID string, clientID s
})
}

// EmitConnectionOpenAckEvent emits a connection open acknowledge event
func EmitConnectionOpenAckEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) {
// emitConnectionOpenAckEvent emits a connection open acknowledge event
func emitConnectionOpenAckEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeConnectionOpenAck,
Expand All @@ -57,8 +57,8 @@ func EmitConnectionOpenAckEvent(ctx sdk.Context, connectionID string, connection
})
}

// EmitConnectionOpenConfirmEvent emits a connection open confirm event
func EmitConnectionOpenConfirmEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) {
// emitConnectionOpenConfirmEvent emits a connection open confirm event
func emitConnectionOpenConfirmEvent(ctx sdk.Context, connectionID string, connectionEnd types.ConnectionEnd) {
ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeConnectionOpenConfirm,
Expand Down
8 changes: 4 additions & 4 deletions modules/core/03-connection/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (k Keeper) ConnOpenInit(
telemetry.IncrCounter(1, "ibc", "connection", "open-init")
}()

EmitConnectionOpenInitEvent(ctx, connectionID, clientID, counterparty)
emitConnectionOpenInitEvent(ctx, connectionID, clientID, counterparty)

return connectionID, nil
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func (k Keeper) ConnOpenTry(
telemetry.IncrCounter(1, "ibc", "connection", "open-try")
}()

EmitConnectionOpenTryEvent(ctx, connectionID, clientID, counterparty)
emitConnectionOpenTryEvent(ctx, connectionID, clientID, counterparty)

return connectionID, nil
}
Expand Down Expand Up @@ -242,7 +242,7 @@ func (k Keeper) ConnOpenAck(
connection.Counterparty.ConnectionId = counterpartyConnectionID
k.SetConnection(ctx, connectionID, connection)

EmitConnectionOpenAckEvent(ctx, connectionID, connection)
emitConnectionOpenAckEvent(ctx, connectionID, connection)

return nil
}
Expand Down Expand Up @@ -292,7 +292,7 @@ func (k Keeper) ConnOpenConfirm(
telemetry.IncrCounter(1, "ibc", "connection", "open-confirm")
}()

EmitConnectionOpenConfirmEvent(ctx, connectionID, connection)
emitConnectionOpenConfirmEvent(ctx, connectionID, connection)

return nil
}
Loading