Skip to content

Conversation

mconcat
Copy link
Contributor

@mconcat mconcat commented Apr 3, 2025

Description

ref: #7974 [Github]
closes: IBCGO-11 [Linear]


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
7 tasks
@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

Attention: Patch coverage is 56.54618% with 541 lines in your changes missing coverage. Please review.

Project coverage is 57.57%. Comparing base (2d98792) to head (3e80458).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
modules/apps/rate-limiting/client/cli/query.go 0.00% 137 Missing ⚠️
modules/apps/rate-limiting/types/msgs.go 23.38% 94 Missing and 1 partial ⚠️
modules/apps/rate-limiting/v2/ibc_middleware.go 29.26% 57 Missing and 1 partial ⚠️
modules/apps/rate-limiting/ibc_middleware.go 0.00% 51 Missing ⚠️
modules/apps/rate-limiting/module.go 0.00% 43 Missing ⚠️
modules/apps/rate-limiting/keeper/grpc_query.go 55.55% 22 Missing and 10 partials ⚠️
modules/apps/rate-limiting/keeper/packet.go 77.03% 23 Missing and 8 partials ⚠️
modules/apps/rate-limiting/types/flow.go 0.00% 24 Missing ⚠️
modules/apps/rate-limiting/client/cli/cli.go 0.00% 17 Missing ⚠️
modules/apps/rate-limiting/keeper/epoch.go 62.50% 10 Missing and 5 partials ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##            main    #8268       +/-   ##
==========================================
+ Coverage   1.13%   57.57%   +56.43%     
==========================================
  Files         14      317      +303     
  Lines       2019    22673    +20654     
==========================================
+ Hits          23    13053    +13030     
- Misses      1995     9012     +7017     
- Partials       1      608      +607     
Flag Coverage Δ
08-wasm 66.13% <ø> (?)
e2e 1.13% <0.00%> (-0.01%) ⬇️
ibc-go 62.98% <56.59%> (?)

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.

@DeshErBojhaa DeshErBojhaa self-assigned this May 31, 2025
Copy link

linear bot commented Jun 2, 2025

@DeshErBojhaa DeshErBojhaa marked this pull request as draft June 2, 2025 09:39
@DeshErBojhaa DeshErBojhaa force-pushed the feature/rate-limit branch 4 times, most recently from 0013e4f to defbff0 Compare June 9, 2025 06:11
@DeshErBojhaa DeshErBojhaa force-pushed the feature/rate-limit branch 2 times, most recently from 6cec140 to d8959b3 Compare June 12, 2025 06:15
@DeshErBojhaa DeshErBojhaa marked this pull request as ready for review June 12, 2025 08:51
@gjermundgaraba gjermundgaraba requested a review from Copilot June 12, 2025 14:39
Copilot

This comment was marked as outdated.

Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Starting to come together, but looks like we're not quite done yet :)

k.transferKeeper = transferKeeper
}

// SetICS4Wrapper sets the ICS4 Wrapper to pass packets downstream.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why this was added now, and why it worked without it in the past?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I understand this PR may not be the best place to add this, but the reason was, I wanted to all the middleware to have similar setup style.

Something like,

RateLimit(PFM(Transfer(Chan)))

then

RateLim.ICS4(Chan)
PFM.ICS4(RateLim)
Transfer.ICS4(PFM)

But all the functionality still works if we remove this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not add it if it's not used now, it will be added in #8528

Copy link
Contributor

Choose a reason for hiding this comment

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

removed here 83e7ce2

Copy link
Contributor

Choose a reason for hiding this comment

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

Aparently this is required here https://github.com/cosmos/ibc-go/blob/feature/rate-limit/modules/apps/rate-limiting/keeper/packet_test.go#L743

So I am re introducing SetICS4Wrapper for PFM

@DeshErBojhaa DeshErBojhaa force-pushed the feature/rate-limit branch 2 times, most recently from eaf5d3c to fd27174 Compare June 17, 2025 08:39
@gjermundgaraba gjermundgaraba requested a review from Copilot June 17, 2025 09:09
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

YES! Now I think we are there 💪

I'll merge this now, and after we get ibc v2 e2e tests in, I will ask @AdityaSripal to review both middlewares holistically.

@gjermundgaraba gjermundgaraba requested a review from Copilot June 19, 2025 15:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new rate-limiting module to the IBC-go codebase. Key changes include new middleware and keeper implementations for enforcing throughput limits on IBC transfers, comprehensive proto definitions for the rate limit APIs, and extensive unit and integration tests ensuring proper behavior.

Reviewed Changes

Copilot reviewed 63 out of 72 changed files in this pull request and generated 1 comment.

File Description
modules/apps/rate-limiting/types/keys.go Defines key prefixes used for storing module state; review of prefix value
modules/apps/rate-limiting/keeper/*.go New keeper logic with repeated KV store adapter instantiation for state access
Comments suppressed due to low confidence (1)

modules/apps/rate-limiting/types/keys.go:30

  • The key prefix for whitelisted addresses is set to 'address-blacklist', which appears inconsistent with its purpose. Consider renaming it to 'address-whitelist' to accurately reflect its usage.
	AddressWhitelistKeyPrefix = bytes("address-blacklist")

@gjermundgaraba gjermundgaraba merged commit 4dc2e77 into main Jun 19, 2025
53 checks passed
@gjermundgaraba gjermundgaraba deleted the feature/rate-limit branch June 19, 2025 18:56
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

4 participants