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

Merged
merged 53 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5f0d0e1
add rate limiting module
mconcat Apr 1, 2025
f37fad0
fix genesis test
mconcat Apr 3, 2025
ac2f487
add grpc, make the porting match with the reference repo
mconcat Apr 11, 2025
430f88d
add simulation, add middleware
mconcat Apr 17, 2025
cdd2c6b
add beginblocker, remove legacy subspace, add tests
mconcat Apr 17, 2025
b892b09
fix test
mconcat Apr 18, 2025
6dc01fd
fix middleware issue
mconcat Apr 25, 2025
7e95085
cleanup
mconcat Apr 25, 2025
ddafb18
fix: ICS4 wrapper for transfer keeper
DeshErBojhaa May 27, 2025
b62a82b
chore: Refactor code (#8442)
DeshErBojhaa May 31, 2025
79ffae0
feat: add field in callbacks data for custom calldata (#8353)
AdityaSripal May 28, 2025
59a6329
fix lint
DeshErBojhaa Jun 6, 2025
ab464b5
e2e: Rate limit (#8455)
DeshErBojhaa Jun 7, 2025
14b627c
fix: remove param subspace
DeshErBojhaa Jun 10, 2025
d0fdfc2
refactor: address rev comment
DeshErBojhaa Jun 10, 2025
4575f50
refactor: remove comments
DeshErBojhaa Jun 12, 2025
fc65694
add test for packet direction lowercase
DeshErBojhaa Jun 13, 2025
d7df27c
add client id to err msg
DeshErBojhaa Jun 13, 2025
4b5950d
add more context to error
DeshErBojhaa Jun 13, 2025
9605e3a
Updated error
DeshErBojhaa Jun 13, 2025
bf923ae
Remove low impact optional refactoring
DeshErBojhaa Jun 13, 2025
28af1fe
refactor: rearrange code, remove comment
DeshErBojhaa Jun 13, 2025
14f7afb
refactor: move test types closer to use
DeshErBojhaa Jun 13, 2025
45240ef
uncomment tests
DeshErBojhaa Jun 15, 2025
e801c7d
ncomment test
DeshErBojhaa Jun 15, 2025
ce00063
removed invalid prams tests
DeshErBojhaa Jun 15, 2025
2a143a8
remove nvalid test params
DeshErBojhaa Jun 15, 2025
38d8d48
duplicate test from modules/apps/27-interchain-accounts/host/keeper/k…
DeshErBojhaa Jun 15, 2025
e04c07c
refactor: rename suite -> s for all test methids
DeshErBojhaa Jun 15, 2025
29b07b4
Removed unused params
DeshErBojhaa Jun 15, 2025
8ee3412
refactor: reorder code
DeshErBojhaa Jun 15, 2025
91796ea
implemented v2 for middleware
DeshErBojhaa Jun 15, 2025
0f032eb
refactor
DeshErBojhaa Jun 15, 2025
6ebbf6d
refactor
DeshErBojhaa Jun 17, 2025
27f31e5
update dep
DeshErBojhaa Jun 17, 2025
ad5d0ac
refactor: fix e2e test
DeshErBojhaa Jun 17, 2025
de9cd30
fix dep
DeshErBojhaa Jun 17, 2025
2162db7
Refactor: move code to proper files
DeshErBojhaa Jun 18, 2025
1aeb834
elaborate short cli msg
DeshErBojhaa Jun 18, 2025
3056584
Refactor: Store keys
DeshErBojhaa Jun 18, 2025
431aa00
refactor: remove non relavant tests
DeshErBojhaa Jun 18, 2025
5f6e5c6
refactor: make sure beginblocker does not panic
DeshErBojhaa Jun 18, 2025
ebb296a
refactor: fix format
DeshErBojhaa Jun 18, 2025
786486a
refactor: Check authority == signer required
DeshErBojhaa Jun 18, 2025
91599ae
Added test
DeshErBojhaa Jun 18, 2025
4378fa5
fix: Lint and dependencies
DeshErBojhaa Jun 18, 2025
eb9048e
added test for no panic
DeshErBojhaa Jun 18, 2025
83e7ce2
refactor: remove ics4 wrapper
DeshErBojhaa Jun 18, 2025
c164649
remove channel keeper from ratelimit IBC Middleware
DeshErBojhaa Jun 18, 2025
06511b8
added test for epoch in the past
DeshErBojhaa Jun 19, 2025
bde442e
added fix me comment
DeshErBojhaa Jun 19, 2025
003f71b
minor refactors
DeshErBojhaa Jun 19, 2025
3e80458
minor cleanup
gjermundgaraba Jun 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 259 additions & 0 deletions e2e/tests/rate_limiting/rate_limiting_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
//go:build !test_e2e

package ratelimiting

import (
"context"
"testing"

interchaintest "github.com/cosmos/interchaintest/v10"
ibc "github.com/cosmos/interchaintest/v10/ibc"
testutil "github.com/cosmos/interchaintest/v10/testutil"
testifysuite "github.com/stretchr/testify/suite"

sdkmath "cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

"github.com/cosmos/ibc-go/e2e/testsuite"
"github.com/cosmos/ibc-go/e2e/testsuite/query"
"github.com/cosmos/ibc-go/e2e/testvalues"
ratelimitingtypes "github.com/cosmos/ibc-go/v10/modules/apps/rate-limiting/types"
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)

type RateLimTestSuite struct {
testsuite.E2ETestSuite
}

func TestRateLimitSuite(t *testing.T) {
testifysuite.Run(t, new(RateLimTestSuite))
}

func (s *RateLimTestSuite) SetupSuite() {
s.SetupChains(context.TODO(), 2, nil, func(options *testsuite.ChainOptions) {
options.RelayerCount = 1
})
}

func (s *RateLimTestSuite) TestRateLimit() {
t := s.T()
ctx := context.TODO()
testName := t.Name()

chainA, chainB := s.GetChains()

userA := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount)
userB := s.CreateUserOnChainB(ctx, testvalues.StartingTokenAmount)

authority, err := query.ModuleAccountAddress(ctx, govtypes.ModuleName, chainA)
s.Require().NoError(err)
s.Require().NotNil(authority)

s.CreatePaths(ibc.DefaultClientOpts(), s.TransferChannelOptions(), testName)
relayer := s.GetRelayerForTest(testName)
s.StartRelayer(relayer, testName)

chanAB := s.GetChannelBetweenChains(testName, chainA, chainB)

escrowAddrA := transfertypes.GetEscrowAddress(chanAB.PortID, chanAB.ChannelID)
denomA := chainA.Config().Denom

ibcTokenB := testsuite.GetIBCToken(denomA, chanAB.PortID, chanAB.ChannelID)

t.Run("No rate limit set: transfer succeeds", func(_ *testing.T) {
userABalBefore, err := s.GetChainANativeBalance(ctx, userA)
s.Require().NoError(err)
userBBalBefore, err := query.Balance(ctx, chainB, userB.FormattedAddress(), ibcTokenB.IBCDenom())
s.Require().NoError(err)
s.Require().Zero(userBBalBefore.Int64())

txResp := s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, testvalues.DefaultTransferAmount(denomA), userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(txResp)

packet, err := ibctesting.ParseV1PacketFromEvents(txResp.Events)
s.Require().NoError(err)
s.Require().NotNil(packet)

s.Require().NoError(testutil.WaitForBlocks(ctx, 5, chainA, chainB), "failed to wait for blocks")
s.AssertPacketRelayed(ctx, chainA, chanAB.PortID, chanAB.ChannelID, packet.Sequence)

userABalAfter, err := s.GetChainANativeBalance(ctx, userA)
s.Require().NoError(err)

// Balanced moved form userA to userB
s.Require().Equal(userABalBefore-testvalues.IBCTransferAmount, userABalAfter)
escrowBalA, err := query.Balance(ctx, chainA, escrowAddrA.String(), denomA)
s.Require().NoError(err)
s.Require().Equal(testvalues.IBCTransferAmount, escrowBalA.Int64())

userBBalAfter, err := query.Balance(ctx, chainB, userB.FormattedAddress(), ibcTokenB.IBCDenom())
s.Require().NoError(err)
s.Require().Equal(testvalues.IBCTransferAmount, userBBalAfter.Int64())
})

t.Run("Add outgoing rate limit on ChainA", func(_ *testing.T) {
resp, err := query.GRPCQuery[ratelimitingtypes.QueryAllRateLimitsResponse](ctx, chainA, &ratelimitingtypes.QueryAllRateLimitsRequest{})
s.Require().NoError(err)
s.Require().Nil(resp.RateLimits)

sendPercentage := int64(10)
recvPercentage := int64(0)
s.addRateLimit(ctx, chainA, userA, denomA, chanAB.ChannelID, authority.String(), sendPercentage, recvPercentage, 1)

resp, err = query.GRPCQuery[ratelimitingtypes.QueryAllRateLimitsResponse](ctx, chainA, &ratelimitingtypes.QueryAllRateLimitsRequest{})
s.Require().NoError(err)
s.Require().Len(resp.RateLimits, 1)

rateLimit := resp.RateLimits[0]
s.Require().Equal(rateLimit.Flow.Outflow.Int64(), int64(0))
s.Require().Equal(rateLimit.Flow.Inflow.Int64(), int64(0))
s.Require().Equal(rateLimit.Quota.MaxPercentSend.Int64(), sendPercentage)
s.Require().Equal(rateLimit.Quota.MaxPercentRecv.Int64(), recvPercentage)
s.Require().Equal(rateLimit.Quota.DurationHours, uint64(1))
})

t.Run("Transfer updates the rate limit flow", func(_ *testing.T) {
userABalBefore, err := s.GetChainANativeBalance(ctx, userA)
s.Require().NoError(err)

txResp := s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, testvalues.DefaultTransferAmount(denomA), userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(txResp)

packet, err := ibctesting.ParseV1PacketFromEvents(txResp.Events)
s.Require().NoError(err)
s.Require().NotNil(packet)

s.Require().NoError(testutil.WaitForBlocks(ctx, 5, chainA, chainB), "failed to wait for blocks")
s.AssertPacketRelayed(ctx, chainA, chanAB.PortID, chanAB.ChannelID, packet.Sequence)

userABalAfter, err := s.GetChainANativeBalance(ctx, userA)
s.Require().NoError(err)

// Balanced moved form userA to userB
s.Require().Equal(userABalBefore-testvalues.IBCTransferAmount, userABalAfter)
userBBalAfter, err := query.Balance(ctx, chainB, userB.FormattedAddress(), ibcTokenB.IBCDenom())
s.Require().NoError(err)
s.Require().Equal(2*testvalues.IBCTransferAmount, userBBalAfter.Int64())

// Check the flow has been updated.
rateLimit := s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
s.Require().NotNil(rateLimit)
s.Require().Equal(rateLimit.Flow.Outflow.Int64(), testvalues.IBCTransferAmount)
})

t.Run("Fill and exceed quota", func(_ *testing.T) {
rateLim := s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
sendPercentage := rateLim.Quota.MaxPercentSend.Int64()

// Create an account that can almost exhause the outflow limit.
richKidAmt := rateLim.Flow.ChannelValue.MulRaw(sendPercentage).QuoRaw(100).Sub(rateLim.Flow.Outflow)
richKid := interchaintest.GetAndFundTestUsers(t, ctx, "richkid", richKidAmt, chainA)[0]
s.Require().NoError(testutil.WaitForBlocks(ctx, 4, chainA))

sendCoin := sdk.NewCoin(denomA, richKidAmt)

// Fill the quota
txResp := s.Transfer(ctx, chainA, richKid, chanAB.PortID, chanAB.ChannelID, sendCoin, richKid.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(txResp)

// Sending even 10denomA fails due to exceeding the quota
sendCoin = sdk.NewInt64Coin(denomA, 10)
txResp = s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, sendCoin, userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxFailure(txResp, ratelimitingtypes.ErrQuotaExceeded)
})

t.Run("Reset rate limit: transfer succeeds", func(_ *testing.T) {
rateLimit := s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
sendPercentage := rateLimit.Quota.MaxPercentSend.Int64()
recvPercentage := rateLimit.Quota.MaxPercentRecv.Int64()

s.resetRateLimit(ctx, chainA, userA, denomA, chanAB.ChannelID, authority.String())

rateLimit = s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
// Resetting only clears the flow. It does not change the quota
s.Require().Zero(rateLimit.Flow.Outflow.Int64())
s.Require().Equal(rateLimit.Quota.MaxPercentSend.Int64(), sendPercentage)
s.Require().Equal(rateLimit.Quota.MaxPercentRecv.Int64(), recvPercentage)

txResp := s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, testvalues.DefaultTransferAmount(denomA), userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(txResp)
})

t.Run("Set outflow quota to 0: transfer fails", func(_ *testing.T) {
sendPercentage := int64(0)
recvPercentage := int64(1)
s.updateRateLimit(ctx, chainA, userA, denomA, chanAB.ChannelID, authority.String(), sendPercentage, recvPercentage)

rateLimit := s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
s.Require().Equal(rateLimit.Quota.MaxPercentSend.Int64(), sendPercentage)
s.Require().Equal(rateLimit.Quota.MaxPercentRecv.Int64(), recvPercentage)

txResp := s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, testvalues.DefaultTransferAmount(denomA), userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxFailure(txResp, ratelimitingtypes.ErrQuotaExceeded)
})

t.Run("Remove rate limit -> transfer succeeds again", func(_ *testing.T) {
s.removeRateLimit(ctx, chainA, userA, denomA, chanAB.ChannelID, authority.String())

rateLimit := s.rateLimit(ctx, chainA, denomA, chanAB.ChannelID)
s.Require().Nil(rateLimit)

// Transfer works again
txResp := s.Transfer(ctx, chainA, userA, chanAB.PortID, chanAB.ChannelID, testvalues.DefaultTransferAmount(denomA), userA.FormattedAddress(), userB.FormattedAddress(), s.GetTimeoutHeight(ctx, chainA), 0, "")
s.AssertTxSuccess(txResp)
})
}

func (s *RateLimTestSuite) rateLimit(ctx context.Context, chain ibc.Chain, denom, chanID string) *ratelimitingtypes.RateLimit {
respRateLim, err := query.GRPCQuery[ratelimitingtypes.QueryRateLimitResponse](ctx, chain, &ratelimitingtypes.QueryRateLimitRequest{
Denom: denom,
ChannelOrClientId: chanID,
})
s.Require().NoError(err)
return respRateLim.RateLimit
}

func (s *RateLimTestSuite) addRateLimit(ctx context.Context, chain ibc.Chain, user ibc.Wallet, denom, chanID, authority string, sendPercent, recvPercent, duration int64) {
msg := &ratelimitingtypes.MsgAddRateLimit{
Signer: authority,
Denom: denom,
ChannelOrClientId: chanID,
MaxPercentSend: sdkmath.NewInt(sendPercent),
MaxPercentRecv: sdkmath.NewInt(recvPercent),
DurationHours: uint64(duration),
}
s.ExecuteAndPassGovV1Proposal(ctx, msg, chain, user)
}

func (s *RateLimTestSuite) resetRateLimit(ctx context.Context, chain ibc.Chain, user ibc.Wallet, denom, chanID, authority string) {
msg := &ratelimitingtypes.MsgResetRateLimit{
Signer: authority,
Denom: denom,
ChannelOrClientId: chanID,
}
s.ExecuteAndPassGovV1Proposal(ctx, msg, chain, user)
}

func (s *RateLimTestSuite) updateRateLimit(ctx context.Context, chain ibc.Chain, user ibc.Wallet, denom, chanID, authority string, sendPercent, recvPercent int64) {
msg := &ratelimitingtypes.MsgUpdateRateLimit{
Signer: authority,
Denom: denom,
ChannelOrClientId: chanID,
MaxPercentSend: sdkmath.NewInt(sendPercent),
MaxPercentRecv: sdkmath.NewInt(recvPercent),
DurationHours: 1,
}
s.ExecuteAndPassGovV1Proposal(ctx, msg, chain, user)
}

func (s *RateLimTestSuite) removeRateLimit(ctx context.Context, chain ibc.Chain, user ibc.Wallet, denom, chanID, authority string) {
msg := &ratelimitingtypes.MsgRemoveRateLimit{
Signer: authority,
Denom: denom,
ChannelOrClientId: chanID,
}
s.ExecuteAndPassGovV1Proposal(ctx, msg, chain, user)
}
2 changes: 2 additions & 0 deletions e2e/testsuite/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types"
icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"
packetforwardtypes "github.com/cosmos/ibc-go/v10/modules/apps/packet-forward-middleware/types"
ratelimitingtypes "github.com/cosmos/ibc-go/v10/modules/apps/rate-limiting/types"
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
v7migrations "github.com/cosmos/ibc-go/v10/modules/core/02-client/migrations/v7"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
Expand Down Expand Up @@ -73,6 +74,7 @@
wasmtypes.RegisterInterfaces(cfg.InterfaceRegistry)
channeltypesv2.RegisterInterfaces(cfg.InterfaceRegistry)
packetforwardtypes.RegisterInterfaces(cfg.InterfaceRegistry)
ratelimitingtypes.RegisterInterfaces(cfg.InterfaceRegistry)

Check warning on line 77 in e2e/testsuite/codec.go

View check run for this annotation

Codecov / codecov/patch

e2e/testsuite/codec.go#L77

Added line #L77 was not covered by tests

// all other types
upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
cloud.google.com/go/iam v1.2.2 // indirect
cloud.google.com/go/monitoring v1.21.2 // indirect
cloud.google.com/go/storage v1.49.0 // indirect
cosmossdk.io/collections v1.3.0 // indirect
cosmossdk.io/collections v1.3.1 // indirect
cosmossdk.io/depinject v1.2.1 // indirect
cosmossdk.io/schema v1.1.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/getsentry/sentry-go v0.32.0 // indirect
github.com/getsentry/sentry-go v0.33.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT
cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw=
cosmossdk.io/api v0.9.2 h1:9i9ptOBdmoIEVEVWLtYYHjxZonlF/aOVODLFaxpmNtg=
cosmossdk.io/api v0.9.2/go.mod h1:CWt31nVohvoPMTlPv+mMNCtC0a7BqRdESjCsstHcTkU=
cosmossdk.io/collections v1.3.0 h1:RUY23xXBy/bu5oSHZ5y+mkJRyA4ZboKDO4Yvx4+g2uc=
cosmossdk.io/collections v1.3.0/go.mod h1:cqVpBMDGEYhuNmNSXIOmqpnQ7Eav43hpJIetzLuEkns=
cosmossdk.io/collections v1.3.1 h1:09e+DUId2brWsNOQ4nrk+bprVmMUaDH9xvtZkeqIjVw=
cosmossdk.io/collections v1.3.1/go.mod h1:ynvkP0r5ruAjbmedE+vQ07MT6OtJ0ZIDKrtJHK7Q/4c=
cosmossdk.io/core v0.11.3 h1:mei+MVDJOwIjIniaKelE3jPDqShCc/F4LkNNHh+4yfo=
cosmossdk.io/core v0.11.3/go.mod h1:9rL4RE1uDt5AJ4Tg55sYyHWXA16VmpHgbe0PbJc6N2Y=
cosmossdk.io/depinject v1.2.1 h1:eD6FxkIjlVaNZT+dXTQuwQTKZrFZ4UrfCq1RKgzyhMw=
Expand Down Expand Up @@ -909,8 +909,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/getsentry/sentry-go v0.32.0 h1:YKs+//QmwE3DcYtfKRH8/KyOOF/I6Qnx7qYGNHCGmCY=
github.com/getsentry/sentry-go v0.32.0/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
github.com/getsentry/sentry-go v0.33.0 h1:YWyDii0KGVov3xOaamOnF0mjOrqSjBqwv48UEzn7QFg=
github.com/getsentry/sentry-go v0.33.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
Expand Down
10 changes: 10 additions & 0 deletions modules/apps/packet-forward-middleware/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@
k.transferKeeper = transferKeeper
}

// SetICS4Wrapper sets the ICS4 wrapper.
func (k *Keeper) SetICS4Wrapper(ics4Wrapper porttypes.ICS4Wrapper) {
k.ics4Wrapper = ics4Wrapper
}

// ICS4Wrapper gets the ICS4 Wrapper for PFM.
func (k *Keeper) ICS4Wrapper() porttypes.ICS4Wrapper {
return k.ics4Wrapper

Check warning on line 84 in modules/apps/packet-forward-middleware/keeper/keeper.go

View check run for this annotation

Codecov / codecov/patch

modules/apps/packet-forward-middleware/keeper/keeper.go#L83-L84

Added lines #L83 - L84 were not covered by tests
}

// Logger returns a module-specific logger.
func (*Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName)
Expand Down
27 changes: 27 additions & 0 deletions modules/apps/rate-limiting/client/cli/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cli

import (
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
)

// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "ratelimiting",
Short: "IBC ratelimiting querying subcommands",
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

cmd.AddCommand(
GetCmdQueryRateLimit(),
GetCmdQueryAllRateLimits(),
GetCmdQueryRateLimitsByChainID(),
GetCmdQueryAllBlacklistedDenoms(),
GetCmdQueryAllWhitelistedAddresses(),
)
return cmd

Check warning on line 26 in modules/apps/rate-limiting/client/cli/cli.go

View check run for this annotation

Codecov / codecov/patch

modules/apps/rate-limiting/client/cli/cli.go#L10-L26

Added lines #L10 - L26 were not covered by tests
}
Loading
Loading