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

chore: mini nits from ics29 audit #1348

Merged
merged 5 commits into from
May 23, 2022
Merged

chore: mini nits from ics29 audit #1348

merged 5 commits into from
May 23, 2022

Conversation

seantking
Copy link
Contributor

Description

There is a call for adding a var declaration in the issue as well but I wasn't sure of the reasoning.

closes: #1325


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

I left some nits of these nits... :)

The reasoning to do var declaration here was to just be consistent with the rest of the codebase.

modules/apps/29-fee/keeper/escrow.go Outdated Show resolved Hide resolved
modules/apps/29-fee/keeper/msg_server.go Outdated Show resolved Hide resolved
seantking and others added 2 commits May 12, 2022 10:54
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

LGTM, it'd be great if you could add the var declaration as well

@@ -165,6 +166,7 @@ func (k Keeper) distributeFee(ctx sdk.Context, receiver, refundAccAddress sdk.Ac
// then attempt to refund the fee to the original sender
err := k.bankKeeper.SendCoinsFromModuleToAccount(cacheCtx, types.ModuleName, refundAccAddress, fee)
if err != nil {
k.Logger(ctx).Error("error refunding fee to the original sender", "refund address", refundAccAddress, "fee", fee)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should log the first failed distribution. I think it is very unlikely refunding the fee fails, but trying to distribute to a relayer could definitely fail. It'd be useful for that relayer to notice and see that the fee got refunded after the failed distribution

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Agree with @colin-axner re. moving logging up one level of scope.

About the var declaration, it's misleading in the issue and linked code because of recent changes. The code to be changed is the ack initialisation here.

Removing the new() func and using the var declaration

ack := new(types.IncentivizedAcknowledgement)
if err := types.ModuleCdc.UnmarshalJSON(acknowledgement, ack); err != nil {
	return sdkerrors.Wrapf(err, "cannot unmarshal ICS-29 incentivized packet acknowledgement: %v", ack)
}

@seantking seantking enabled auto-merge (squash) May 23, 2022 15:29
@seantking seantking merged commit 79ddb9d into main May 23, 2022
@seantking seantking deleted the sean/ics29-audit-nits branch May 23, 2022 15:37
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.

(chore) Logging, comment, code hygiene nits for 29-fee
4 participants