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

ibc: async acknowledgements #7361

Merged
merged 24 commits into from Oct 1, 2020
Merged

ibc: async acknowledgements #7361

merged 24 commits into from Oct 1, 2020

Conversation

fedekunze
Copy link
Collaborator

Description

closes: #7254


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

@codecov
Copy link

codecov bot commented Sep 22, 2020

Codecov Report

Merging #7361 into master will increase coverage by 0.02%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##           master    #7361      +/-   ##
==========================================
+ Coverage   54.96%   54.99%   +0.02%     
==========================================
  Files         588      588              
  Lines       36631    36664      +33     
==========================================
+ Hits        20135    20163      +28     
- Misses      14406    14409       +3     
- Partials     2090     2092       +2     

@fedekunze fedekunze changed the title ibc: Async acknowledgements ibc: async acknowledgements Sep 22, 2020
x/ibc/handler.go Outdated Show resolved Hide resolved
x/ibc/handler.go Outdated Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Outdated Show resolved Hide resolved
x/ibc/09-localhost/types/client_state_test.go Outdated Show resolved Hide resolved
x/ibc/09-localhost/types/client_state_test.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.

LGTM, left mostly typo fixes and nits

x/ibc/07-tendermint/types/client_state.go Outdated Show resolved Hide resolved
x/ibc/04-channel/types/errors.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/verify.go Outdated Show resolved Hide resolved
x/ibc/03-connection/keeper/verify_test.go Outdated Show resolved Hide resolved
x/ibc/04-channel/keeper/keeper.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Outdated Show resolved Hide resolved
x/ibc/light-clients/solomachine/types/proof.go Outdated Show resolved Hide resolved
x/ibc/handler.go Outdated Show resolved Hide resolved
// is the case.
if ack != nil {
if err := k.ChannelKeeper.WriteAcknowledgement(ctx, msg.Packet, ack); err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

test case?

x/ibc/24-host/keys.go Outdated Show resolved Hide resolved
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

Nice work!! Think there's some issues with how packet receipt is being processed

if channel.Ordering == types.UNORDERED {
switch channel.Ordering {
case types.UNORDERED:
// check if the packet acknowledgement has been received already for unordered channels
_, found := k.GetPacketAcknowledgement(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we be checking for packet receipts now instead of packet acknowledgements?

Copy link
Contributor

Choose a reason for hiding this comment

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

x/ibc/04-channel/keeper/packet.go Outdated Show resolved Hide resolved
@@ -280,15 +280,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() {
_, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED)
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, disabledTimeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano()))
}, false},
{"acknowledgement already received", func() {
Copy link
Member

Choose a reason for hiding this comment

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

should be replaced by receipt already written test case

x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet_test.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/07-tendermint/types/client_state_test.go Outdated Show resolved Hide resolved
x/ibc/handler.go Outdated Show resolved Hide resolved
}

// commit changes
chain.App.Commit()
Copy link
Member

Choose a reason for hiding this comment

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

Is doing this ok? @colin-axner

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is ok as it represents the asynchrony of the acknowledgment?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's ok because no message is being sent to the chain (we are simulating one) and this function is called by the coordinator which immediately increments time afterwards. It isn't great design though (my bad) because it is counter-intuitive. It must be done though because otherwise the state change won't be updated on the client

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Thanks; see comments.

x/ibc/04-channel/keeper/keeper.go Show resolved Hide resolved
if channel.Ordering == types.UNORDERED {
switch channel.Ordering {
case types.UNORDERED:
// check if the packet acknowledgement has been received already for unordered channels
_, found := k.GetPacketAcknowledgement(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
Copy link
Contributor

Choose a reason for hiding this comment

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

x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Show resolved Hide resolved
x/ibc/04-channel/keeper/packet.go Outdated Show resolved Hide resolved
Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

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

ACK, Nice work!!!

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

ACK, nice work 👍

@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Oct 1, 2020
@mergify mergify bot merged commit dcf3b54 into master Oct 1, 2020
@mergify mergify bot deleted the fedekunze/7254-async-acks branch October 1, 2020 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asynchronous acknowledgements
5 participants