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: Add defensive replay protection check into WriteAcknowledgement #5880

Conversation

hoangdv2429
Copy link
Contributor

Description

closes: #5740


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/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

@hoangdv2429
Copy link
Contributor Author

I think the e2e test is flaking again, can someone rerun it

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thank you, @hoangdv2429. I think the original intention of the issue is to add the check in 04-channel's WriteAcknowledgement, so that all middleware/applications can benefit from it. If we add the check only in ics29 middleware, then only the fee middleware will be protected against the replay attack.

@hoangdv2429
Copy link
Contributor Author

Thank you, @hoangdv2429. I think the original intention of the issue is to add the check in 04-channel's WriteAcknowledgement, so that all middleware/applications can benefit from it. If we add the check only in ics29 middleware, then only the fee middleware will be protected against the replay attack.

Got it sir. I'll update it

@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.61%. Comparing base (1c0c756) to head (1bfdfe4).
Report is 51 commits behind head on main.

❗ Current head 1bfdfe4 differs from pull request most recent head ee7a95d. Consider uploading reports for the commit ee7a95d to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5880      +/-   ##
==========================================
+ Coverage   81.59%   81.61%   +0.02%     
==========================================
  Files         199      198       -1     
  Lines       15167    12114    -3053     
==========================================
- Hits        12375     9887    -2488     
+ Misses       2326     1765     -561     
+ Partials      466      462       -4     
Files Coverage Δ
modules/core/04-channel/keeper/packet.go 99.17% <100.00%> (+0.07%) ⬆️

... and 171 files with indirect coverage changes

@crodriguezvega
Copy link
Contributor

Thanks for changing the code, @hoangdv2429. It would fantastic if you could also a test. You can take as example the test that was added for the same check in RecvPacket here. Thank you!

Copy link
Contributor

@crodriguezvega crodriguezvega 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, @hoangdv2429!

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Looks good! LGTM! Thank you @hoangdv2429 🙏🏻

modules/core/04-channel/keeper/packet_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.

Thanks @hoangdv2429! LGTM, I left a suggested improvement for the in code documentation

modules/core/04-channel/keeper/packet.go Outdated Show resolved Hide resolved
hoangdv2429 and others added 3 commits February 27, 2024 21:43
Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
@crodriguezvega crodriguezvega merged commit 829d06f into cosmos:main Feb 27, 2024
70 checks passed
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.

Add defensive replay protection check into WriteAcknowledgement
5 participants