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

feat(core/eureka): add writeack, ack handler. #7049

Merged
merged 7 commits into from
Aug 7, 2024

Conversation

DimitrisJim
Copy link
Contributor

@DimitrisJim DimitrisJim commented Aug 5, 2024

Description

closes: #6969


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 the 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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@DimitrisJim DimitrisJim force-pushed the jim/recv-packet-eureka branch 3 times, most recently from d8a7adc to 7c982ec Compare August 6, 2024 04:48
@DimitrisJim DimitrisJim force-pushed the jim/ack-packet-eureka branch from 9296097 to 859161b Compare August 6, 2024 07:19
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.

utACK. minor request

// NOTE: IBC app modules might have written the acknowledgement synchronously on
// the OnRecvPacket callback so we need to check if the acknowledgement is already
// set on the store and return an error if so.
if k.ChannelKeeper.HasPacketAcknowledgement(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.

We should be also checking that a receipt does exist. Otherwise, you can write an acknowledgement for a packet you never received

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can see utility of check but can't see steps to get there? Is the idea that something other than the msg server handler will invoke this basically?

Also, this was not present previously unless I'm feeling a bit blind this day

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, I see in docs for WriteAck that it assumes a packet receipt has been written

https://github.com/cosmos/ibc-go/blob/2028e9a34891221b56717abb9201f3f19bf130c2/modules/core/04-channel/keeper/packet.go#L291C4-L291C64

guess we can stop assuming hah

Copy link
Member

Choose a reason for hiding this comment

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

It was not previously present. Remains to be seen with how it gets called with port-router-refactor, but generally i would expect this to be called by an app. Perhaps not directly but through the msg server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Base automatically changed from jim/recv-packet-eureka to feat/ibc-eureka August 6, 2024 12:18
@DimitrisJim DimitrisJim force-pushed the jim/ack-packet-eureka branch from ec02c8d to 24356d0 Compare August 6, 2024 12:38
@DimitrisJim DimitrisJim force-pushed the jim/ack-packet-eureka branch from 998ff78 to a3e70ed Compare August 6, 2024 14:51
packetI exported.PacketI,
ack exported.Acknowledgement,
) error {
packet, ok := packetI.(channeltypes.Packet)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

preemptively before #5774 lands, didn't want to need to add to the interface func for PacketI just to get the ProtocolVersion. (Plus, I do not like having to use getters everywhere)

(can rename to chanPacket if we want)


// TODO: Clean up code when msg server handler routes correctly.

// need to update chainA's client representing chainB to prove missing ack
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally replaced soon with a err = path.EndpointB.RecvPacket(packet) call

@DimitrisJim DimitrisJim marked this pull request as ready for review August 6, 2024 14:53
@DimitrisJim DimitrisJim force-pushed the jim/ack-packet-eureka branch from a3e70ed to 203f0a6 Compare August 6, 2024 15:41
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.

just a couple ignorable nits

modules/core/packet-server/keeper/keeper_test.go Outdated Show resolved Hide resolved
_, err := suite.chainA.App.GetPacketServer().SendPacket(suite.chainA.GetContext(), nil, packet.SourceChannel, packet.SourcePort, packet.DestinationPort, packet.TimeoutHeight, packet.TimeoutTimestamp, packet.AppVersion, packet.Data)
suite.Require().NoError(err)

// TODO: Clean up code when msg server handler routes correctly.
Copy link
Member

Choose a reason for hiding this comment

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

Should we create an issue to track?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes! will do

Copy link

sonarqubecloud bot commented Aug 7, 2024

@DimitrisJim DimitrisJim merged commit 2b8a96d into feat/ibc-eureka Aug 7, 2024
61 of 65 checks passed
@DimitrisJim DimitrisJim deleted the jim/ack-packet-eureka branch August 7, 2024 06:43
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.

2 participants