Skip to content

Commit e06aea3

Browse files
authored
[CORE-824] Add upgrade handler for ratelimit keeper (#1019)
1 parent 13c29f9 commit e06aea3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

protocol/app/upgrades.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func (app *App) setupUpgradeHandlers() {
2929
v4_0_0.CreateUpgradeHandler(
3030
app.ModuleManager,
3131
app.configurator,
32+
app.RatelimitKeeper,
3233
),
3334
)
3435
}

protocol/app/upgrades/v4.0.0/upgrade.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,26 @@ import (
77
upgradetypes "cosmossdk.io/x/upgrade/types"
88
sdk "github.com/cosmos/cosmos-sdk/types"
99
"github.com/cosmos/cosmos-sdk/types/module"
10+
11+
ratelimitkeeper "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/keeper"
12+
ratelimittypes "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types"
1013
)
1114

1215
func CreateUpgradeHandler(
1316
mm *module.Manager,
1417
configurator module.Configurator,
18+
rateLimitKeepr ratelimitkeeper.Keeper,
1519
) upgradetypes.UpgradeHandler {
1620
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
1721
sdkCtx := sdk.UnwrapSDKContext(ctx)
1822
sdkCtx.Logger().Info(fmt.Sprintf("Running %s Upgrade...", UpgradeName))
1923

20-
// TODO(CORE-824): Initialize ratelimit module params to desired state.
24+
if err := rateLimitKeepr.SetLimitParams(
25+
sdkCtx,
26+
ratelimittypes.DefaultUsdcRateLimitParams(),
27+
); err != nil {
28+
panic(fmt.Sprintf("failed to set default x/ratelimit params: %s", err))
29+
}
2130

2231
return mm.RunMigrations(ctx, configurator, vm)
2332
}

0 commit comments

Comments
 (0)