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

Skip distribution if refund fails to send on channel closure #1523

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Jun 10, 2022

Description

closes: #1396

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

Comment on lines 218 to 220
if k.bankKeeper.BlockedAddr(refundAddr) {
continue
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this blocked check happens in SendCoinsFromModuleToAccount now instead

}

k.DeleteFeesInEscrow(cacheCtx, identifiedPacketFee.PacketId)
if !failedToSendCoins {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's possible an error occurred sending the coins, we don't want to remove them unless they were actually sent.

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2022

Codecov Report

Merging #1523 (59a42df) into main (5e5e2cd) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1523      +/-   ##
==========================================
+ Coverage   80.27%   80.29%   +0.02%     
==========================================
  Files         166      166              
  Lines       12252    12252              
==========================================
+ Hits         9835     9838       +3     
+ Misses       1954     1952       -2     
+ Partials      463      462       -1     
Impacted Files Coverage Δ
modules/apps/29-fee/keeper/escrow.go 95.03% <100.00%> (+1.86%) ⬆️

…n-if-refund-fails-to-send-on-channel-closure' into cian/issue#1396-skip-distribution-if-refund-fails-to-send-on-channel-closure
@@ -214,21 +215,16 @@ func (k Keeper) RefundFeesOnChannelClosure(ctx sdk.Context, portID, channelID st
return err
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 this error also still needs to be handled so improperly formatted refund addr doesnt stop channel closure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah that's a good point, it's effectively the same situation. Nice catch!

Copy link
Contributor

Choose a reason for hiding this comment

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

🤝

Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

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

lgtm! 🎉

@chatton chatton merged commit 11297aa into main Jun 13, 2022
@chatton chatton deleted the cian/issue#1396-skip-distribution-if-refund-fails-to-send-on-channel-closure branch June 13, 2022 10:59
Comment on lines -5 to +8
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"
transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
"github.com/tendermint/tendermint/crypto/secp256k1"
Copy link
Member

Choose a reason for hiding this comment

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

nit: group imports by type, see #382

import (
        // standard library imports
	"fmt"
	"testing"
        
        // external library imports
	"github.com/stretchr/testify/require"
	abci "github.com/tendermint/tendermint/abci/types"
        
         // ibc-go library imports
	"github.com/cosmos/ibc-go/modules/core/23-commitment/types"
)

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.

Skip distribution if refund fails to send on channel closure
4 participants