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

docs: Add docs to Acknowledgement.Success #3515

Merged
merged 12 commits into from
May 16, 2023

Conversation

webmaster128
Copy link
Member

@webmaster128 webmaster128 commented Apr 24, 2023

Closes #3434

Co-authored-by: Alexander Peters <alpe@users.noreply.github.com>
Copy link
Contributor

@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.

Thanks @webmaster128 🙏

Small suggestion to be slightly more explicit :)

Perhaps we could be even more explicit:

Note: IBC application callback events are always persisted so long as RecvPacket succeeds without error.

modules/core/exported/channel.go Outdated Show resolved Hide resolved
webmaster128 and others added 2 commits May 3, 2023 11:21
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
@webmaster128
Copy link
Member Author

webmaster128 commented May 3, 2023

Thank you for the review and suggestion, @damiannolan! I applied your expanded note and structured the text a bit better. I'm not familiar with Go doc comment conventions (seems like no markdown here), so feel free to further polish that if needed.

Copy link
Contributor

@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.

Looks great! Thanks again @webmaster128 :)

LGTM!

modules/core/exported/channel.go Outdated Show resolved Hide resolved
modules/core/exported/channel.go Outdated Show resolved Hide resolved
//
// Note 1: IBC application callback events are always persisted so long as `RecvPacket` succeeds without error.
//
// Note 2: This method is independent of application level success/error which is encoded in the acknowledgement bytes in a protocol specific way.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what this note means? Could you elaborate?

Copy link
Member Author

Choose a reason for hiding this comment

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

You have a public type called "Acknowledgement" which is not an IBC acknowledgement. And acknowledgement.Success has nothing to do with success acknowledgements. This is a source of confusion for users that I tried to resolve.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, by "This method is independent of application level success/error" this is referencing result and error acknowledgements, not the success/error of a transaction at the application layer?

And acknowledgement.Success has nothing to do with success acknowledgements

Hmm, I'm not sure I agree with this point. If by "success acknowledgement" you mean "result acknowledgement" then the only reason it is referred to "success" is because it returns true when fulfilling the acknowledgement.Success() interface function. The response/error acknowledgements are not required, they are sane default acknowledgements IBC apps may use if they wish not to define their own custom types

After reading this again, are you referring to this?

Copy link
Member Author

Choose a reason for hiding this comment

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

by "This method is independent of application level success/error" this is referencing result and error acknowledgements, not the success/error of a transaction at the application layer?

Right. I used "success" as the opposite to an error acknowledgement.

I think my primary source of confusion is that the "Acknowledgement" interface is not the acknowledgement but contains the acknowledgement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay I see now. Thanks for the followup comments. I see how this can be confusing, especially given that an acknowledgement can wrap other acknowledgements. The idea of the interface is to convey information about the acknowledgements so that core IBC can do some useful logic without having reference to the actual type. That's why we need the Success() function and the Acknowledgement() function. So that core IBC can do some useful handling of state during receive packets and also set the marshalled bytes

Maybe we could make some more adjustments to clear up the confusion (I also see we need to add docs about wrapping acknowledgements). I will add some suggestions

@colin-axner
Copy link
Contributor

Thank you @webmaster128! This is a great addition, we definitely should have added this earlier!

webmaster128 and others added 2 commits May 3, 2023 12:13
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
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.

Thanks again for you patience @webmaster128. I added some additional suggestions that should hopefully clear up any confusion for readers. Let me know what you think!

modules/core/exported/channel.go Outdated Show resolved Hide resolved
//
// Note 1: IBC application callback events are always persisted so long as `RecvPacket` succeeds without error.
//
// Note 2: This method is independent of application level success/error which is encoded in the acknowledgement bytes in a protocol specific way.
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay I see now. Thanks for the followup comments. I see how this can be confusing, especially given that an acknowledgement can wrap other acknowledgements. The idea of the interface is to convey information about the acknowledgements so that core IBC can do some useful logic without having reference to the actual type. That's why we need the Success() function and the Acknowledgement() function. So that core IBC can do some useful handling of state during receive packets and also set the marshalled bytes

Maybe we could make some more adjustments to clear up the confusion (I also see we need to add docs about wrapping acknowledgements). I will add some suggestions

modules/core/exported/channel.go Outdated Show resolved Hide resolved
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.

Thanks @webmaster128! Sorry for the back and forth

@colin-axner colin-axner merged commit 0da2318 into cosmos:main May 16, 2023
@webmaster128 webmaster128 deleted the Success-documentation branch May 22, 2023 08:33
@webmaster128
Copy link
Member Author

Merci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Define what Success() in the Acknowledgement interface means
6 participants