Skip to content

feat: rate limit module #8268

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

feat: rate limit module #8268

wants to merge 9 commits into from

Conversation

mconcat
Copy link

@mconcat mconcat commented Apr 3, 2025

Description

ref: #7974


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.

@mconcat mconcat marked this pull request as ready for review April 24, 2025 09:38
@womensrights womensrights linked an issue Apr 24, 2025 that may be closed by this pull request
10 tasks
Comment on lines +53 to +56
ck, ok := ics4Wrapper.(*channelkeeper.Keeper)
if ok {
im.channelKeeper = ck
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this going to require ICS4Wrapper to be the channelkeeper. THis is wrong, we want ability to wrap ratelimiting with higher level middleware

Comment on lines +197 to +206
packetToCheck := channeltypes.Packet{
Sequence: seq,
SourcePort: sourcePort,
SourceChannel: sourceChannel,
TimeoutHeight: timeoutHeight,
TimeoutTimestamp: timeoutTimestamp,
Data: data,
}

err = im.keeper.SendRateLimitedPacket(ctx, packetToCheck)
Copy link
Member

Choose a reason for hiding this comment

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

Seems this can be refactored to not need to construct the packetToCheck

Copy link
Member

Choose a reason for hiding this comment

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

Just send in the data

Comment on lines +217 to +220
if actualSeq != seq {
return 0, errorsmod.Wrapf(channeltypes.ErrInvalidPacket, "sequence mismatch: expected %d, got %d", seq, actualSeq)
}

Copy link
Member

Choose a reason for hiding this comment

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

This can be then removed

@DeshErBojhaa DeshErBojhaa self-requested a review as a code owner May 27, 2025 06:26
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 18.27%. Comparing base (a5ad744) to head (26cc7cd).

❗ There is a different number of reports uploaded between BASE (a5ad744) and HEAD (26cc7cd). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (a5ad744) HEAD (26cc7cd)
ibc-go 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #8268       +/-   ##
===========================================
- Coverage   61.62%   18.27%   -43.36%     
===========================================
  Files         299       28      -271     
  Lines       21462     2643    -18819     
===========================================
- Hits        13227      483    -12744     
+ Misses       7643     2132     -5511     
+ Partials      592       28      -564     
Flag Coverage Δ
08-wasm 66.28% <ø> (ø)
e2e 1.18% <ø> (ø)
ibc-go ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Rate limiting middleware
3 participants