-
Notifications
You must be signed in to change notification settings - Fork 751
feat: delete forwarded packet when it is not needed anymore #6621
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
Merged
bznein
merged 40 commits into
feat/ics20-v2-path-forwarding
from
bznein/6546/deletepacket
Jun 21, 2024
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
013f883
Create ontimeoutpacket test for forwarding
83f4582
Propagate ack on A
59b93ed
Refactoring
ff35ada
Minor changes
926d8da
Added comments
8a3dd36
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6384/ontimeo…
3f5dc6c
Fix type name.
10592e1
Gofumpt
907de8e
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6384/ontimeo…
bznein 6787c74
Update modules/apps/transfer/keeper/relay_forwarding_test.go
bznein 37375ba
Update modules/apps/transfer/keeper/relay_forwarding_test.go
bznein 65a0d0a
Update modules/apps/transfer/keeper/relay_forwarding_test.go
bznein ca59adf
Update modules/apps/transfer/keeper/relay_forwarding_test.go
bznein 1492378
Add godoc to test.
288f5f6
Changed trace construction
d4e9b59
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6384/ontimeo…
bznein a70e56d
Update modules/apps/transfer/keeper/relay_forwarding_test.go
bznein 6a33a57
remove error msg parameter from helper function
7fb5569
Add test for forwarded packet
774d971
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6384/ontimeo…
bznein d1736dc
Delete packet when not needed anymore.
8c8feeb
Move deletion of packet in a single place.
24f82d6
Reintroduce newline
6528515
Do not ignore error.
caa3902
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
bznein bec616f
PR feedback.
ad4e6f6
Construct packet for B ack check.
3acd732
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6384/ontimeo…
bznein 61884f0
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
bznein 139facf
PR feedback
f9c1e70
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
gjermundgaraba fdd769f
Pass packet to acknowledgeforwardedpacket
d532007
revert unwanted change
db52296
Another unwanted change
8d06bc3
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
bznein b6684da
Better signature and fix source/dest
a5c8729
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
crodriguezvega 432fd1f
Added one more test.
265de48
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
fc5410e
Merge branch 'feat/ics20-v2-path-forwarding' into bznein/6546/deletep…
bznein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -317,6 +317,10 @@ func (suite *KeeperTestSuite) TestSimplifiedHappyPathForwarding() { | |
| err = path2.EndpointB.UpdateClient() | ||
| suite.Require().NoError(err) | ||
|
|
||
| // B should now have deleted the forwarded packet. | ||
| _, found := suite.chainB.GetSimApp().TransferKeeper.GetForwardedPacket(suite.chainB.GetContext(), packetFromAtoB.DestinationPort, packetFromAtoB.DestinationChannel, packetFromAtoB.Sequence) | ||
| suite.Require().False(found, "Chain B should have deleted its forwarded packet") | ||
|
|
||
| result, err = path2.EndpointB.RecvPacketWithResult(packetFromBtoC) | ||
| suite.Require().NoError(err) | ||
| suite.Require().NotNil(result) | ||
|
|
@@ -562,6 +566,10 @@ func (suite *KeeperTestSuite) TestAcknowledgementFailureScenario5Forwarding() { | |
| err = path1.EndpointB.AcknowledgePacket(packetFromBtoA, errorAckOnA.Acknowledgement()) | ||
| suite.Require().NoError(err) | ||
|
|
||
| // Check that B deleted the forwarded packet. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably add this check to some other tests as well (like the happy path).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, done! |
||
| _, found = suite.chainB.GetSimApp().TransferKeeper.GetForwardedPacket(suite.chainB.GetContext(), forwardedPacket.SourcePort, forwardedPacket.SourceChannel, forwardedPacket.Sequence) | ||
| suite.Require().False(found, "chain B should have deleted the forwarded packet mapping") | ||
|
|
||
| // Check that Escrow B has been refunded amount | ||
| coin = sdk.NewCoin(denomAB.IBCDenom(), amount) | ||
| totalEscrowChainB = suite.chainB.GetSimApp().TransferKeeper.GetTotalEscrowForDenom(suite.chainB.GetContext(), coin.GetDenom()) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There is some improvement we can do with the naming since "forwarded packet" here in the name of the function refers to the packet that was received by the middle chain, but in the places where this function is called "forwarded packet" refers to the packet that was sent from the middle chain. Anyway, no need to change it for now, we can make a proposal for other naming in a separate PR.
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.
Yeah I agree. I chose a name which is consistent with what we use in the rest of the file (which in my understanding refer to the same concept), but I'm happy to find a better name.