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

add UpdateChannel method to Endpoint #5725

Merged
merged 16 commits into from
Feb 8, 2024

Conversation

charleenfei
Copy link
Contributor

Description

closes: #3984

Commit Message / Changelog Entry

type: commit message

see the guidelines for commit messages. (view raw markdown for examples)


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 the 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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@charleenfei charleenfei changed the title add method/update usage add UpdateChannel method to Endpoint Jan 25, 2024
Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

lgtm! 🚀 One thing I'd suggest is ideally going through tests and updating the current pattern of GetChannel -> modify -> SetChannel. Did that in connection case by grepping for the Set mostly (Get can be done for other reasons).

grep -inr "SetChannel" . --include="*_test.go" should find most!

testing/endpoint.go Outdated Show resolved Hide resolved
@@ -772,6 +772,17 @@ func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error {
return endpoint.Counterparty.UpdateClient()
}

// UpdateChannelState updates a channel
func (endpoint *Endpoint) UpdateChannel(updater func(channel *channeltypes.Channel)) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to mark SetChannelState as deprecated? We could say they'll be removed in v10. Can open issue to track it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, I can mark it as deprecated, good call :)


endpoint.Chain.Coordinator.CommitBlock(endpoint.Chain)

return endpoint.Counterparty.UpdateClient()
Copy link
Contributor

Choose a reason for hiding this comment

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

wonder if people would prefer this to be a require.NotNil instead of returning the error? We always seem to require this error not be nil when using it (unless I missed something in diff) and can't really think of why we'd want to actually handle the error if one is returned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think having the Require set in the test makes more sense in the context of the naming of the function (unless we rename to something like MustUpdateChannel?), also then the condition is more explicit when you read the test itself?

but tbh not so opinionated, I'd be fine with updating this if other people find it better.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, fine either way too. just feels weird always asserting no error here, can't see a case where we'd want to assert one

@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d330de7) 81.55% compared to head (6a8dbc2) 81.54%.
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5725      +/-   ##
==========================================
- Coverage   81.55%   81.54%   -0.01%     
==========================================
  Files         199      199              
  Lines       15180    15175       -5     
==========================================
- Hits        12380    12375       -5     
  Misses       2334     2334              
  Partials      466      466              
Files Coverage Δ
modules/core/03-connection/types/codec.go 100.00% <ø> (ø)
modules/core/03-connection/types/connection.go 79.10% <0.00%> (ø)

…hub.com:cosmos/ibc-go into charly/issue#3984-add-updatechannel-to-endpoint
testing/endpoint.go Outdated Show resolved Hide resolved
Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

ACK changes, thanks @charleenfei and @crodriguezvega for final push!

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for picking this one up

@crodriguezvega crodriguezvega merged commit 71fa5c9 into main Feb 8, 2024
66 checks passed
@crodriguezvega crodriguezvega deleted the charly/issue#3984-add-updatechannel-to-endpoint branch February 8, 2024 18:39
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.

Add UpdateChannel to Endpoint
6 participants