Skip to content

Commit 3488b55

Browse files
chore: soft fork ibc rate limit (backport #994) (#1010)
<hr>This is an automatic backport of pull request #994 done by [Mergify](https://mergify.com). --------- Co-authored-by: RafilxTenfen <rafaeltenfen.rt@gmail.com>
1 parent c502d20 commit 3488b55

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4949
### State Machine Breaking
5050

5151
- [#947](https://github.com/babylonlabs-io/babylon/pull/947) Improve signing info update upon fp activated
52+
- [#994](https://github.com/babylonlabs-io/babylon/pull/994) Soft fork ibcratelimit to call `BeginBlock`
5253

5354
## v2.0.0-rc.0
5455

app/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/CosmWasm/wasmd/x/wasm"
2424
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
2525
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
26+
ratelimiter "github.com/babylonlabs-io/babylon/v2/x/rate-limiting"
2627
abci "github.com/cometbft/cometbft/abci/types"
2728
cmtos "github.com/cometbft/cometbft/libs/os"
2829
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
@@ -80,7 +81,6 @@ import (
8081
"github.com/cosmos/gogoproto/proto"
8182
pfmrouter "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward"
8283
pfmroutertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
83-
ratelimiter "github.com/cosmos/ibc-apps/modules/rate-limiting/v8"
8484
ratelimittypes "github.com/cosmos/ibc-apps/modules/rate-limiting/v8/types"
8585
"github.com/cosmos/ibc-go/modules/capability"
8686
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

x/rate-limiting/module.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package ratelimit
2+
3+
import (
4+
"context"
5+
6+
ratelimit "github.com/cosmos/ibc-apps/modules/rate-limiting/v8"
7+
"github.com/cosmos/ibc-apps/modules/rate-limiting/v8/keeper"
8+
9+
"cosmossdk.io/core/appmodule"
10+
"github.com/cosmos/cosmos-sdk/codec"
11+
sdk "github.com/cosmos/cosmos-sdk/types"
12+
"github.com/cosmos/cosmos-sdk/types/module"
13+
)
14+
15+
var (
16+
_ module.AppModule = AppModule{}
17+
_ appmodule.HasBeginBlocker = AppModule{}
18+
)
19+
20+
// ----------------------------------------------------------------------------
21+
// AppModuleBasic
22+
// ----------------------------------------------------------------------------
23+
24+
// AppModule implements the AppModule interface for the capability module.
25+
type AppModule struct {
26+
ratelimit.AppModule
27+
28+
keeper keeper.Keeper
29+
}
30+
31+
func NewAppModule(
32+
cdc codec.Codec,
33+
keeper keeper.Keeper,
34+
) AppModule {
35+
return AppModule{
36+
AppModule: ratelimit.NewAppModule(cdc, keeper),
37+
keeper: keeper,
38+
}
39+
}
40+
41+
// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
42+
func (am AppModule) BeginBlock(context context.Context) error {
43+
ctx := sdk.UnwrapSDKContext(context)
44+
am.keeper.BeginBlocker(ctx)
45+
return nil
46+
}

0 commit comments

Comments
 (0)