-
Notifications
You must be signed in to change notification settings - Fork 619
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
chore: making changes based on nits from 02-client refactor audit #1585
chore: making changes based on nits from 02-client refactor audit #1585
Conversation
…d movign marshalling of client message inside of EmitUpdateClientEvent
[]metrics.Label{telemetry.NewLabel(types.LabelClientType, clientState.ClientType())}, | ||
) | ||
}() | ||
defer telemetry.IncrCounterWithLabels( |
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.
this was not mentioned in the audit however we are wrapping these calls with an anonymous function which is not required unless we want to not evaluate clientState.ClientType()
until function execution for some reason.
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.
Ah, nice catch. I think then this improvement could be applied to other places of the codebase as well.
@@ -26,7 +28,13 @@ 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, clientMsgStr string) { | |||
func EmitUpdateClientEvent(ctx sdk.Context, clientID string, clientType string, consensusHeights []exported.Height, cdc codec.BinaryCodec, clientMsg exported.ClientMessage) { |
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.
cdc codec.BinaryCodec
was added as an argument to prevent this function being added to the Keeper
or accepting a keeper as an argument
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.
LGTM!
[]metrics.Label{telemetry.NewLabel(types.LabelClientType, clientState.ClientType())}, | ||
) | ||
}() | ||
defer telemetry.IncrCounterWithLabels( |
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.
Ah, nice catch. I think then this improvement could be applied to other places of the codebase as well.
@@ -198,6 +178,9 @@ func (cs ClientState) pruneOldestConsensusState(ctx sdk.Context, cdc codec.Binar | |||
// this error should never occur | |||
if !found { | |||
pruneError = sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "failed to retrieve consensus state at height: %s", height) | |||
if pruneError != nil { |
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.
I guess we can safely remove the if
condition because pruneError
will always be not nil
here, right?
…t-02-client-refactor-audit-
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.
Thanks @chatton! 🚀
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Description
closes: #1581
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes