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

Rework channel events #1859

Merged

Conversation

Wizdave97
Copy link
Contributor

@Wizdave97 Wizdave97 commented Feb 9, 2022

Closes: https://github.com/informalsystems/ibc-rs/issues/718

Description

Refactor events channel events

PR author checklist:

  • Linked to GitHub issue.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.


impl CloseInit {
pub fn attributes(&self) -> Attributes {
Copy link
Member

Choose a reason for hiding this comment

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

imho this method should take ownership of self rather than perform a bunch of clones hidden to the caller.

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, we could implement From<CloseInit> for Attributes for these events and remove this method.

This would make a nice parallel to the Protobuf instances we have all over the codebase where we have: SomeDomainType: TryFrom<RawProtobufType> and RawProtobufType: From<SomeDomainType>.

What do you think @hu55a1n1?

Copy link
Member

Choose a reason for hiding this comment

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

I think that's a great idea. 👍 I just looked up usages of the attributes() method and it seems we usually don't use the event after calling this function, so it's good to consume the event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll do that.

modules/src/events.rs Outdated Show resolved Hide resolved
@Wizdave97 Wizdave97 requested a review from romac February 23, 2022 20:15
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

Great work @Wizdave97, thank you :)

@romac
Copy link
Member

romac commented Feb 24, 2022

Let's merge this for 0.12.1, ie. after #1870 has been merged and released.

@adizere adizere merged commit b9530db into informalsystems:master Mar 7, 2022
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* refactor events

* fmt

* chore: cleanup

* clippy fixes

* Formatting

* update channel event attributes conversion

* cargo clippy

* minor fix

* add changelog

Co-authored-by: Romain Ruetschi <romain.ruetschi@gmail.com>
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.

6 participants