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

add provider and consumer logging #628

Merged
merged 24 commits into from
Jan 5, 2023
Merged

add provider and consumer logging #628

merged 24 commits into from
Jan 5, 2023

Conversation

MSalopek
Copy link
Contributor

Description

Add logging to provider and consumer.
This is a continuation of efforts in #577.

Linked issues

Closes: #576

Type of change

  • Feature: Changes and/or adds code behavior, irrelevant to bug fixes

@MSalopek MSalopek marked this pull request as ready for review January 3, 2023 15:09
Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

Locations of logging look great, thanks for this! I've added some comments on the strings being logged

@@ -499,7 +499,7 @@ gas_multiplier = 1.1
grpc_addr = "%s"
id = "%s"
key_name = "%s"
max_gas = 2000000
max_gas = 20000000
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change have to do with logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason integration tests were failing after I added logging on my local machine, this seemed to have fixed it.

x/ccv/consumer/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/consumer/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/consumer/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/consumer/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/throttle.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/throttle.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/throttle.go Outdated Show resolved Hide resolved
Copy link
Contributor

@danwt danwt left a comment

Choose a reason for hiding this comment

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

LGTM1

x/ccv/consumer/keeper/distribution.go Outdated Show resolved Hide resolved
x/ccv/consumer/keeper/distribution.go Outdated Show resolved Hide resolved
@@ -102,6 +115,8 @@ func (k Keeper) QueueVSCMaturedPackets(ctx sdk.Context) {

k.DeletePacketMaturityTimes(ctx, maturityTime.VscId, maturityTime.MaturityTime)

k.Logger(ctx).Info("VSCMaturedPacket enqueued", "vscID", vscPacket.ValsetUpdateId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
k.Logger(ctx).Info("VSCMaturedPacket enqueued", "vscID", vscPacket.ValsetUpdateId)
k.Logger(ctx).Debug("VSCMaturedPacket enqueued", "vscID", vscPacket.ValsetUpdateId)

(Packet enqueue is implementation detail, the info parts are when you send a packet IMO)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sending the packet is logged by the IBC module. Queueing the packet is important as that should result in an IBC send. Also, it's the only place where we can log the data without having to unmarshal it in SendPackets

Comment on lines +81 to 84
k.Logger(ctx).Debug("unbonding operation matured on consumer", "chainID", chainID, "opID", unbondingOp.Id)

// If unbonding op is completely unbonded from all relevant consumer chains
if len(unbondingOp.UnbondingConsumerChains) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps only log the case when len(unbondingOp.UnbondingConsumerChains) == 0, it might be too noisy otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's debug, it's okay to be noisy :)

x/ccv/provider/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/consumer/module.go Outdated Show resolved Hide resolved
@mpoke mpoke requested a review from shaspitz January 4, 2023 18:42
Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

Sorry if these comments seem nitpicky :), there's just been a lot of times I've said to myself, damn I wish I logged that better

x/ccv/consumer/keeper/relay.go Outdated Show resolved Hide resolved

k.Logger(ctx).Info("sent block rewards to provider",
"fee pool", fpTokens.String(),
"sent", remainingTokens.String(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the sent field here similar to remaining tokens in fee pool? If so the latter is prob more descriptive

Copy link
Contributor

Choose a reason for hiding this comment

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

sent is the amount actually transferred. I've replaced remainingTokens with tstProviderTokens.

@@ -85,6 +85,11 @@ func (k Keeper) DistributeToProviderValidatorSet(ctx sdk.Context) error {
return err
}
}

k.Logger(ctx).Info("sent block rewards to provider",
"fee pool", fpTokens.String(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this field is fee pool before being decremented, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. Replaced with "total fee pool"

x/ccv/consumer/keeper/validators.go Outdated Show resolved Hide resolved
x/ccv/consumer/module.go Show resolved Hide resolved
@@ -127,12 +147,14 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac
func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error {
chainID, found := k.GetChannelToChain(ctx, packet.SourceChannel)
if !found {
k.Logger(ctx).Error("packet timeout, unknown channel:", "channel", packet.SourceChannel)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -250,10 +281,20 @@ func (k Keeper) OnRecvSlashPacket(ctx sdk.Context, packet channeltypes.Packet, d
if !found {
// SlashPacket packet was sent on a channel different than any of the established CCV channels;
// this should never happen
k.Logger(ctx).Error("SlashPacket received on unknown channel",
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, could log src channel ID

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

x/ccv/provider/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/relay.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/throttle.go Outdated Show resolved Hide resolved
@mpoke
Copy link
Contributor

mpoke commented Jan 5, 2023

make test passes on my machine

@mpoke mpoke merged commit bbb892f into main Jan 5, 2023
@mpoke mpoke deleted the 576-add-logging branch January 5, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logging
5 participants