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

Async Ack Fixes #7735

Merged
merged 15 commits into from
Nov 2, 2020
Merged

Async Ack Fixes #7735

merged 15 commits into from
Nov 2, 2020

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Oct 29, 2020

Description

Asynchronous acks had a number of issues in it:

  1. The queries were not implemented (PacketReceipt/Acknowledgements) or implemented incorrectly (UnreceivedPackets). These were necessary for proper relayer function
  2. Packet receipts were not included in genesis

Other issue involved swagger files not being updated because of incorrect config


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 Oct 29, 2020

Codecov Report

Merging #7735 into master will decrease coverage by 0.20%.
The diff coverage is 21.78%.

@@            Coverage Diff             @@
##           master    #7735      +/-   ##
==========================================
- Coverage   54.34%   54.13%   -0.21%     
==========================================
  Files         610      610              
  Lines       38627    38848     +221     
==========================================
+ Hits        20990    21029      +39     
- Misses      15493    15671     +178     
- Partials     2144     2148       +4     

@@ -94,31 +94,31 @@
}
},
{
"url": "./tmp-swagger-gen/ibc/channel/query.swagger.json",
"url": "./tmp-swagger-gen/ibc/core/channel/v1/query.swagger.json",
Copy link
Member Author

Choose a reason for hiding this comment

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

This misconfiguration is why proto-swagger-gen errored

// packet commitments, acknowledgments, and receipts
// Caller is responsible for knowing the context necessary to interpret this
// state as a commitment, acknowledgement, or a receipt
message PacketState {
Copy link
Member Author

Choose a reason for hiding this comment

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

PacketAckCommitment was a confusing name, changed it to PacketState with docs

repeated PacketState acknowledgements = 2
[(gogoproto.casttype) = "PacketState", (gogoproto.nullable) = false];
repeated PacketState commitments = 3 [(gogoproto.nullable) = false];
repeated PacketState receipts = 4 [(gogoproto.nullable) = false];
Copy link
Member Author

Choose a reason for hiding this comment

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

We did not include receipts in GenesisState 😱

// list of commitment sequences
repeated uint64 packet_commitment_sequences = 3;
// list of acknowledgment sequences
repeated uint64 packet_ack_sequences = 3;
}

// QueryUnrelayedAcksResponse is the response type for the
Copy link
Member Author

Choose a reason for hiding this comment

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

Personally believe QueryUnrelayedAcks should be renamed to QueryUnreceivedAcks since this should be sent to original sending chain which is waiting to receive acks

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it a RPC sent to the chain writing acknowledgements? see previous discussion

Copy link
Member Author

Choose a reason for hiding this comment

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

I was wrong back then. Definitely this RPC is meant to go to the chain receiving acknowledgements since that is the original sender chain which still has packet commitments in it if ack hasn't been received

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed it along with docs, please double check the implementation to confirm my thinking here.

QueryUnreceivedAcks is being passed in a list of ack sequences and it will then check if the executing chain still has a packet commitment for that sequence. If it does, then the sequence is added to unreceived acks. Thus, the executing chain must be the original sender since it stores the packet commitments

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for the flipflop!! Hopefully the last change!

@colin-axner
Copy link
Contributor

does this fix #7651?

@AdityaSripal
Copy link
Member Author

does this fix #7651?

Yes it does

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.

I think the discussion we had previously notes pros/cons for doing unrelayed acks vs unreceived acks. I don't have strong opinions since this is entirely a helper function for the relayer, so whatever would make it easiest. The relayer should also primarily rely on event streaming since received packets may never have a written ack

I do think the point I made last time makes a lot of sense for using unrelayed acks

How does a relayer determine which acknowledgement sequences to send? Unlike packet commitments, acknowledgements live forever so a relayer would have to already know which acknowledgements have not been acknowledged on the original chain, which is the purpose of this function.

Maybe that doesn't change anything. As long as this helps the relayer then LGTM

proto/ibc/core/channel/v1/genesis.proto Outdated Show resolved Hide resolved
proto/ibc/core/channel/v1/query.proto Outdated Show resolved Hide resolved
x/ibc/core/04-channel/client/cli/query.go Outdated Show resolved Hide resolved
x/ibc/core/04-channel/client/utils/utils.go Outdated Show resolved Hide resolved
x/ibc/core/04-channel/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/ibc/core/04-channel/keeper/grpc_query_test.go Outdated Show resolved Hide resolved
x/ibc/core/04-channel/keeper/keeper.go Outdated Show resolved Hide resolved
x/ibc/core/04-channel/types/genesis.go Show resolved Hide resolved
proto/ibc/core/channel/v1/channel.proto Outdated Show resolved Hide resolved
proto/ibc/core/channel/v1/channel.proto Outdated Show resolved Hide resolved
proto/ibc/core/channel/v1/genesis.proto Outdated Show resolved Hide resolved
@clevinson clevinson mentioned this pull request Oct 31, 2020
9 tasks
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 but see comments (and previous ones)

proto/ibc/core/channel/v1/query.proto Outdated Show resolved Hide resolved
AdityaSripal and others added 2 commits November 2, 2020 14:25
@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 2, 2020
@mergify mergify bot merged commit e9801ed into master Nov 2, 2020
@mergify mergify bot deleted the aditya/async-ack-fixes branch November 2, 2020 15:13
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.

5 participants