-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
move packet executed call to ibc handler #6312
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6312 +/- ##
==========================================
- Coverage 55.61% 55.61% -0.01%
==========================================
Files 448 448
Lines 26941 26947 +6
==========================================
+ Hits 14984 14987 +3
- Misses 10883 10886 +3
Partials 1074 1074 |
@@ -61,7 +61,7 @@ type IBCModule interface { | |||
OnRecvPacket( | |||
ctx sdk.Context, | |||
packet channeltypes.Packet, | |||
) (*sdk.Result, error) | |||
) (*sdk.Result, []byte, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to modify the callback interface because
- it is more clear to the application developer the contract required to fulfill this function securely
- using
sdk.Result.Data
would be messy because you would need to require some specified format for the ack such as being prefixed by some string ie[]byte("acknowledgement")+ack.GetBytes()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I think this is cleaner for the time being.
Can we just also check (but not increment) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK although see comment. It's not a correctness requirement to check in RecvPacket
but it might be nice.
@@ -61,7 +61,7 @@ type IBCModule interface { | |||
OnRecvPacket( | |||
ctx sdk.Context, | |||
packet channeltypes.Packet, | |||
) (*sdk.Result, error) | |||
) (*sdk.Result, []byte, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I think this is cleaner for the time being.
Description
I am leaving the check that the msg recv is in the correct order in
PacketExecuted
rather than doing this check inRecvPacket
because after this check is made, the nextRecvSeq is incremented, so it is cleaner to leave it in the...Executed
func. The downside of this is application logic will be executed (but not persisted) even if the packet is to fail because it was received out of order. Any opinions on this?closes: #6301
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.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer