-
Notifications
You must be signed in to change notification settings - Fork 156
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
Changes from 17 commits
dfb052e
b59e623
a0a7591
53c85ec
f952b57
0c7205b
0d06793
b603a5e
dea4b63
a3c92c3
e61d050
a0d604a
e3a2a31
811805e
21ac2a2
f6c9e4d
7ae537f
163fe28
62d2aeb
bc4e4c6
ed038d4
defb3ef
50aed10
f0b1721
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,6 +35,7 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new | |||||
// the first packet from the provider chain | ||||||
// - mark the CCV channel as established | ||||||
k.SetProviderChannel(ctx, packet.DestinationChannel) | ||||||
k.Logger(ctx).Info("CCV channel established", "port", packet.DestinationPort, "channel", packet.DestinationChannel) | ||||||
|
||||||
// emit event on first VSC packet to signal that CCV is working | ||||||
ctx.EventManager().EmitEvent( | ||||||
|
@@ -65,16 +66,28 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new | |||||
// Save maturity time and packet | ||||||
maturityTime := ctx.BlockTime().Add(k.GetUnbondingPeriod(ctx)) | ||||||
k.SetPacketMaturityTime(ctx, newChanges.ValsetUpdateId, maturityTime) | ||||||
k.Logger(ctx).Debug("packet maturity time was set", | ||||||
"vscID", newChanges.ValsetUpdateId, | ||||||
"ts (utc)", maturityTime.UTC(), | ||||||
mpoke marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
"ts (nano)", uint64(maturityTime.UnixNano()), | ||||||
) | ||||||
|
||||||
// set height to VSC id mapping | ||||||
k.SetHeightValsetUpdateID(ctx, uint64(ctx.BlockHeight())+1, newChanges.ValsetUpdateId) | ||||||
blockHeight := uint64(ctx.BlockHeight()) + 1 | ||||||
k.SetHeightValsetUpdateID(ctx, blockHeight, newChanges.ValsetUpdateId) | ||||||
k.Logger(ctx).Debug("block height was mapped to vscID", "height", blockHeight, "vscID", newChanges.ValsetUpdateId) | ||||||
|
||||||
// remove outstanding slashing flags of the validators | ||||||
// for which the slashing was acknowledged by the provider chain | ||||||
for _, addr := range newChanges.GetSlashAcks() { | ||||||
k.DeleteOutstandingDowntime(ctx, addr) | ||||||
} | ||||||
|
||||||
k.Logger(ctx).Info("finished receiving/handling VSCPacket", | ||||||
"vscID", newChanges.ValsetUpdateId, | ||||||
"len updates", len(newChanges.ValidatorUpdates), | ||||||
"len slash acks", len(newChanges.SlashAcks), | ||||||
) | ||||||
ack := channeltypes.NewResultAcknowledgement([]byte{byte(1)}) | ||||||
return ack | ||||||
} | ||||||
|
@@ -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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(Packet enqueue is implementation detail, the info parts are when you send a packet IMO) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||||||
|
||||||
ctx.EventManager().EmitEvent( | ||||||
sdk.NewEvent( | ||||||
ccv.EventTypeVSCMatured, | ||||||
|
@@ -143,6 +158,12 @@ func (k Keeper) QueueSlashPacket(ctx sdk.Context, validator abci.Validator, vals | |||||
}, | ||||||
}) | ||||||
|
||||||
k.Logger(ctx).Info("SlashPacket enqueued", | ||||||
"vscID", slashPacket.ValsetUpdateId, | ||||||
"validator cons addr", sdk.ConsAddress(slashPacket.Validator.Address).String(), | ||||||
"infraction", slashPacket.Infraction, | ||||||
) | ||||||
|
||||||
ctx.EventManager().EmitEvent( | ||||||
sdk.NewEvent( | ||||||
ccv.EventTypeConsumerSlashRequest, | ||||||
|
@@ -185,6 +206,7 @@ func (k Keeper) SendPackets(ctx sdk.Context) { | |||||
|
||||||
if err != nil { | ||||||
if clienttypes.ErrClientNotActive.Is(err) { | ||||||
k.Logger(ctx).Debug("IBC client is inactive, packet remains in queue", "type", p.Type.String()) | ||||||
// leave the packet data stored to be sent once the client is upgraded | ||||||
return | ||||||
} | ||||||
|
@@ -204,7 +226,7 @@ func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Pac | |||||
if err := ack.GetError(); err != "" { | ||||||
// Reasons for ErrorAcknowledgment | ||||||
// - packet data could not be successfully decoded | ||||||
// - the Slash packet was ill-formed (errors while handling it) | ||||||
// - invalid Slash packet | ||||||
// None of these should ever happen. | ||||||
k.Logger(ctx).Error( | ||||||
"recv ErrorAcknowledgement", | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,11 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign | |
if err := k.Keeper.AssignConsumerKey(ctx, msg.ChainId, validator, consumerTMPublicKey); err != nil { | ||
return nil, err | ||
} | ||
k.Logger(ctx).Info("assigned consumer key", | ||
"chainID", msg.ChainId, | ||
mpoke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"validator", msg.ProviderAddr, | ||
shaspitz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"consumer-key", consumerSDKPublicKey.String(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't recall the difference, but is it useful to specify this as an "sdk public key", not a "tendermint public key"? The latter is used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's too much detail I think :) |
||
) | ||
|
||
ctx.EventManager().EmitEvents(sdk.Events{ | ||
sdk.NewEvent( | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.