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

refactor: adding check if channel exists before register counterparty #1339

Merged
merged 5 commits into from
May 12, 2022

Conversation

seantking
Copy link
Contributor

@seantking seantking commented May 4, 2022

Description

In order to add this check we needed access to the PortID. I have added portID to the Msg + updated CLI etc. Wdyt?

closes: #1322


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

@seantking seantking marked this pull request as ready for review May 4, 2022 13:44
@codecov-commenter
Copy link

Codecov Report

Merging #1339 (cbaef64) into main (7bb609c) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1339      +/-   ##
==========================================
+ Coverage   80.27%   80.29%   +0.01%     
==========================================
  Files         166      166              
  Lines       12023    12034      +11     
==========================================
+ Hits         9652     9663      +11     
  Misses       1916     1916              
  Partials      455      455              
Impacted Files Coverage Δ
modules/apps/29-fee/keeper/msg_server.go 94.23% <100.00%> (+0.89%) ⬆️
modules/apps/29-fee/types/msgs.go 89.77% <100.00%> (+0.48%) ⬆️

@seantking seantking requested a review from colin-axner May 5, 2022 08:50
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.

Wahoo! Very clean work! :)

CHANGELOG.md Outdated
@@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (modules/app/29-fee) [\#1339](https://github.com/cosmos/ibc-go/pull/1339) The `RegisterCounterpartyAddress` gRPC endpoint now checks if the channel exists before registering.
Copy link
Contributor

Choose a reason for hiding this comment

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

Changelog entry isn't super necessary since we haven't release ics29, but guess it doesn't hurt

@seantking seantking enabled auto-merge (squash) May 12, 2022 11:43
@seantking seantking merged commit 9f70a07 into main May 12, 2022
@seantking seantking deleted the sean/issue#1322-check-channel-exists branch May 12, 2022 11:50
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.

Maybe we can address the reversal of parameters in a separate PR?

@@ -101,18 +101,18 @@ func NewPayPacketFeeAsyncTxCmd() *cobra.Command {
// NewRegisterCounterpartyAddress returns the command to create a MsgRegisterCounterpartyAddress
func NewRegisterCounterpartyAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "register-counterparty [address] [counterparty-address] [channel-id]",
Use: "register-counterparty [address] [counterparty-address] [channel-id] [port-id]",
Copy link
Contributor

@crodriguezvega crodriguezvega May 12, 2022

Choose a reason for hiding this comment

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

It would be more consistent with the rest of CLIs if the order of the arguments is reversed, so [port-id] [channel-id] instead of [channel-id] [port-id].

RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

msg := types.NewMsgRegisterCounterpartyAddress(args[0], args[1], args[2])
msg := types.NewMsgRegisterCounterpartyAddress(args[0], args[1], args[2], args[3])
Copy link
Contributor

@crodriguezvega crodriguezvega May 12, 2022

Choose a reason for hiding this comment

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

And I think this is wrong because args[3] is the port-id, but it should pass the channel-id as the last argument... But if we revert the order of the CLI parameters, then this will be fine. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

@seantking seantking mentioned this pull request May 13, 2022
9 tasks
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.

Check channel ID exists in RegisterCounterpartyAddress
5 participants