-
Notifications
You must be signed in to change notification settings - Fork 96
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
ibc rate limit module NTRN-393 #706
Merged
+4,746
−102
Merged
Changes from 78 commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
0d8817f
basic integration of ibc-rate-limit module
quasisamurai 95f27b0
init ibc-rate-limit module
quasisamurai fcb1313
insert midlleware properly
quasisamurai 9192032
set pfm & ibc rate middleware init earlier
quasisamurai 03ddf4c
init modules in proper order
quasisamurai 316a82f
wip adapting tests
quasisamurai 829a63a
wip msg server
quasisamurai b2931d7
modify init once again
quasisamurai 5e3a161
update testutil w some helpers
quasisamurai 4523a1a
play w initialization 1 more time
quasisamurai b8725a5
upd tests
quasisamurai 8a58c2d
fix hooks init)
quasisamurai 8dc0bf9
wip
quasisamurai 0e5e0b9
archeologic works on unit tests
quasisamurai 0316a8a
rewrite kepeers & ibnc module init
quasisamurai 3eb0a8f
add commit block, fix tests
quasisamurai aa66712
proper order of init once again
quasisamurai ddb904c
fix
pr0n00gler a3c7e8c
fix
pr0n00gler 3c30c75
chain works
quasisamurai 12353cc
Merge remote-tracking branch 'origin/feat/ibc-rate-limit' into feat/i…
quasisamurai 1969117
some debug: contract addr set and exists in tests, but not exist on r…
quasisamurai ae40a29
finalize tests & app go: tests are passing
quasisamurai 45e1993
proto-format
quasisamurai bf02dc6
init feekeeper before transfer keeper
quasisamurai b451f01
make all unit tests pass
quasisamurai f820184
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai 9c7588f
modify transfer stack order
quasisamurai 2e0af84
upd comment
quasisamurai 987a288
wip debug
quasisamurai 65036e4
wip migration of neutron specific ibc-rate-limit changes
bonedaddy 48edf99
rate-limiter: fix tests to work with 2.x of cosmwasm-std
bonedaddy aee1dde
rate-limit: update cargo.lock
bonedaddy b03a01f
wip debug
quasisamurai f64d22d
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai 8d11458
tidy
quasisamurai 9ca43ad
ranme .cargo/config to .cargo/config.toml
bonedaddy 8c20064
replace osmosis addresses in tests with neutron addresses
bonedaddy 676c58e
update comments to reference neutron instead of osmosis where applicable
bonedaddy 124320a
remove feature activation deprecated in cosmwasm-std 2
bonedaddy fd13486
rm debug logs
quasisamurai d0a672a
partial lint
quasisamurai b24769d
second iteration of lint
quasisamurai 29109e6
final iteration of lint: gofumpt w -extra
quasisamurai 051a12f
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai c5f61f0
move .cargo folder to workspace root
bonedaddy 4199b61
Merge remote-tracking branch 'origin/feat/ibc-rate-limit' into feat/i…
bonedaddy 0148c5c
recompile rate limit wasm contract
bonedaddy 3d01fec
remove unnecessary resolver set
bonedaddy 44b08d0
prepare proto
quasisamurai e683d1d
regen proto & create necc files for keeper/msgserver
quasisamurai 0017250
integrate keeper
quasisamurai 226ed4e
wip
quasisamurai 270a0a1
rate_limit: use grpc query helper when extracting channel value
bonedaddy 008a2f8
rate-limit: recompile rate limiter contract
bonedaddy 0c0dffb
Merge pull request #716 from rangesecurity/feat/ibc-rate-limit
pr0n00gler e0360d0
Merge branch 'feat/ibc-rate-limit' into feat/rate-limit-params
quasisamurai afd556c
register everything, add simulation etc
quasisamurai 36117b4
rm unused
quasisamurai 71477cc
lint
quasisamurai 81f6303
return err on set params
quasisamurai d0c167f
Merge pull request #718 from neutron-org/feat/rate-limit-params
quasisamurai c3996f8
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai f929592
resolve conflicts & gomodtidy
quasisamurai f782178
Update x/ibc-rate-limit/keeper/keeper.go
quasisamurai 4212295
Update x/ibc-rate-limit/types/codec.go
quasisamurai 25378cf
get rid of osmosis mentions & move proto to neutron folder
quasisamurai ff6fe4a
update code comments
quasisamurai d24b352
add more comments to app.go
quasisamurai b654088
modify ibcrl module to store pointers, should help avoid problems in …
quasisamurai 9a44936
move max supported ibc reciever addr len to const
quasisamurai 931cab8
whitelists rl update params
quasisamurai 76a73d5
make contract address field nullable
quasisamurai 37af5de
rm print from tests
quasisamurai 166daf2
uncomment cli
quasisamurai 9cb8580
rm contract code from module bc we have moved it to separate repo
quasisamurai 7f205d3
some refactoring and new tests
quasisamurai 743d590
regen proto & rm unused file
quasisamurai 3c9e990
rm unoptimised file and right multi-quota init
quasisamurai be12fd8
move some values to constants, wrap some errors
quasisamurai 437843a
modify readme to get rid of osmo mentions
quasisamurai 460a742
rework module structure: unify it acc to rest modules
quasisamurai f7e6f63
use unoptimised wasm file bc optimised thow an err in tests
quasisamurai af15a0a
upd constants
quasisamurai 4672c4b
avoid pure strings in code & store unoptimised wasm file bc optimised…
quasisamurai 30f6557
add comment explaining stack
quasisamurai 29b59ed
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai a234457
upgrade rl to v5
quasisamurai 2ec4d09
make channel constant
quasisamurai 146dce5
ref: simple return instead of branching
quasisamurai cfa5400
add ibc rate limits into upgrade handler
pr0n00gler b1d32a8
use channel keeper instead of rl wrapper in wasm & ica
quasisamurai ef2d0b0
add ibc rate limit contract init to upgrade
quasisamurai e6aea28
Merge branch 'main' into feat/ibc-rate-limit
quasisamurai ddff618
aftermerge fix
quasisamurai c435888
rm prints. here we dont like prints
quasisamurai f15be55
check weekly used out as well + send 2untrn instead of 1
quasisamurai 772156b
add upgrade test just in case
quasisamurai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ data | |
.mutagen.yml | ||
vendor/ | ||
.testchains | ||
|
||
x/ibc-rate-limit/contracts/rate-limiter/target/ | ||
|
||
x/ibc-rate-limit/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,13 +10,14 @@ import ( | |||||
"path/filepath" | ||||||
"time" | ||||||
|
||||||
"github.com/neutron-org/neutron/v4/x/dynamicfees" | ||||||
dynamicfeestypes "github.com/neutron-org/neutron/v4/x/dynamicfees/types" | ||||||
|
||||||
"github.com/skip-mev/feemarket/x/feemarket" | ||||||
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper" | ||||||
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" | ||||||
|
||||||
"github.com/neutron-org/neutron/v4/x/dynamicfees" | ||||||
dynamicfeestypes "github.com/neutron-org/neutron/v4/x/dynamicfees/types" | ||||||
"github.com/neutron-org/neutron/v4/x/ibc-rate-limit/ibcratelimitmodule" | ||||||
|
||||||
"cosmossdk.io/client/v2/autocli" | ||||||
"cosmossdk.io/core/appmodule" | ||||||
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" | ||||||
|
@@ -131,6 +132,9 @@ import ( | |||||
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck | ||||||
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" | ||||||
|
||||||
ibcratelimit "github.com/neutron-org/neutron/v4/x/ibc-rate-limit" | ||||||
ibcratelimitkeeper "github.com/neutron-org/neutron/v4/x/ibc-rate-limit/keeper" | ||||||
ibcratelimittypes "github.com/neutron-org/neutron/v4/x/ibc-rate-limit/types" | ||||||
//nolint:staticcheck | ||||||
ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" | ||||||
ibchost "github.com/cosmos/ibc-go/v8/modules/core/exported" | ||||||
|
@@ -268,6 +272,7 @@ var ( | |||||
), | ||||||
ibchooks.AppModuleBasic{}, | ||||||
packetforward.AppModuleBasic{}, | ||||||
ibcratelimitmodule.AppModuleBasic{}, | ||||||
auction.AppModuleBasic{}, | ||||||
globalfee.AppModule{}, | ||||||
feemarket.AppModuleBasic{}, | ||||||
|
@@ -368,8 +373,10 @@ type App struct { | |||||
|
||||||
PFMModule packetforward.AppModule | ||||||
|
||||||
HooksTransferIBCModule *ibchooks.IBCMiddleware | ||||||
HooksICS4Wrapper ibchooks.ICS4Middleware | ||||||
TransferStack *ibchooks.IBCMiddleware | ||||||
Ics20WasmHooks *ibchooks.WasmHooks | ||||||
RateLimitingICS4Wrapper *ibcratelimit.ICS4Wrapper | ||||||
HooksICS4Wrapper ibchooks.ICS4Middleware | ||||||
|
||||||
// make scoped keepers public for test purposes | ||||||
ScopedIBCKeeper capabilitykeeper.ScopedKeeper | ||||||
|
@@ -384,7 +391,8 @@ type App struct { | |||||
|
||||||
ConsensusParamsKeeper consensusparamkeeper.Keeper | ||||||
|
||||||
WasmKeeper wasmkeeper.Keeper | ||||||
WasmKeeper wasmkeeper.Keeper | ||||||
ContractKeeper *wasmkeeper.PermissionedKeeper | ||||||
|
||||||
// slinky | ||||||
MarketMapKeeper *marketmapkeeper.Keeper | ||||||
|
@@ -475,7 +483,7 @@ func New( | |||||
icahosttypes.StoreKey, capabilitytypes.StoreKey, | ||||||
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasmtypes.StoreKey, feetypes.StoreKey, | ||||||
feeburnertypes.StoreKey, adminmoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, pfmtypes.StoreKey, | ||||||
crontypes.StoreKey, ibchookstypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, dextypes.StoreKey, auctiontypes.StoreKey, | ||||||
crontypes.StoreKey, ibcratelimittypes.ModuleName, ibchookstypes.StoreKey, consensusparamtypes.StoreKey, crisistypes.StoreKey, dextypes.StoreKey, auctiontypes.StoreKey, | ||||||
oracletypes.StoreKey, marketmaptypes.StoreKey, feemarkettypes.StoreKey, dynamicfeestypes.StoreKey, globalfeetypes.StoreKey, | ||||||
) | ||||||
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey, dextypes.TStoreKey) | ||||||
|
@@ -507,6 +515,7 @@ func New( | |||||
scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) | ||||||
scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) | ||||||
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) | ||||||
app.ScopedTransferKeeper = scopedTransferKeeper | ||||||
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) | ||||||
scopedInterTxKeeper := app.CapabilityKeeper.ScopeToModule(interchaintxstypes.ModuleName) | ||||||
scopedCCVConsumerKeeper := app.CapabilityKeeper.ScopeToModule(ccvconsumertypes.ModuleName) | ||||||
|
@@ -588,41 +597,45 @@ func New( | |||||
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), &app.ConsumerKeeper, app.UpgradeKeeper, scopedIBCKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
// Feekeeper needs to be initialized before middlewares injection | ||||||
app.FeeKeeper = feekeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[feetypes.StoreKey], | ||||||
memKeys[feetypes.MemStoreKey], | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.BankKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
feeModule := feerefunder.NewAppModule(appCodec, *app.FeeKeeper, app.AccountKeeper, app.BankKeeper) | ||||||
|
||||||
app.ContractManagerKeeper = *contractmanagermodulekeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[contractmanagermoduletypes.StoreKey], | ||||||
keys[contractmanagermoduletypes.MemStoreKey], | ||||||
&app.WasmKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
app.WireICS20PreWasmKeeper(appCodec) | ||||||
app.PFMModule = packetforward.NewAppModule(app.PFMKeeper, app.GetSubspace(pfmtypes.ModuleName)) | ||||||
|
||||||
app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( | ||||||
appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), | ||||||
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 feerefunder | ||||||
app.RateLimitingICS4Wrapper, // defiened in wireisc20 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, | ||||||
scopedICAControllerKeeper, app.MsgServiceRouter(), | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
app.ICAHostKeeper = icahostkeeper.NewKeeper( | ||||||
appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), | ||||||
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 feerefunder | ||||||
app.RateLimitingICS4Wrapper, // defiened in wireisc20 | ||||||
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, | ||||||
app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter()) | ||||||
|
||||||
app.ContractManagerKeeper = *contractmanagermodulekeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[contractmanagermoduletypes.StoreKey], | ||||||
keys[contractmanagermoduletypes.MemStoreKey], | ||||||
&app.WasmKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
app.FeeKeeper = feekeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[feetypes.StoreKey], | ||||||
memKeys[feetypes.MemStoreKey], | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.BankKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
feeModule := feerefunder.NewAppModule(appCodec, *app.FeeKeeper, app.AccountKeeper, app.BankKeeper) | ||||||
|
||||||
app.FeeBurnerKeeper = feeburnerkeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[feeburnertypes.StoreKey], | ||||||
|
@@ -635,44 +648,6 @@ func New( | |||||
|
||||||
app.GlobalFeeKeeper = globalfeekeeper.NewKeeper(appCodec, keys[globalfeetypes.StoreKey], authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String()) | ||||||
|
||||||
// PFMKeeper must be created before TransferKeeper | ||||||
app.PFMKeeper = pfmkeeper.NewKeeper( | ||||||
appCodec, | ||||||
app.keys[pfmtypes.StoreKey], | ||||||
app.TransferKeeper.Keeper, | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.FeeBurnerKeeper, | ||||||
&app.BankKeeper, | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
wasmHooks := ibchooks.NewWasmHooks(nil, sdk.GetConfig().GetBech32AccountAddrPrefix()) // The contract keeper needs to be set later | ||||||
app.HooksICS4Wrapper = ibchooks.NewICS4Middleware( | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.PFMKeeper, | ||||||
&wasmHooks, | ||||||
) | ||||||
|
||||||
// Create Transfer Keepers | ||||||
app.TransferKeeper = wrapkeeper.NewKeeper( | ||||||
appCodec, | ||||||
keys[ibctransfertypes.StoreKey], | ||||||
app.GetSubspace(ibctransfertypes.ModuleName), | ||||||
app.HooksICS4Wrapper, // essentially still app.IBCKeeper.ChannelKeeper under the hood because no hook overrides | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.IBCKeeper.PortKeeper, | ||||||
app.AccountKeeper, | ||||||
&app.BankKeeper, | ||||||
scopedTransferKeeper, | ||||||
app.FeeKeeper, | ||||||
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper), | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
app.PFMKeeper.SetTransferKeeper(app.TransferKeeper.Keeper) | ||||||
|
||||||
transferModule := transferSudo.NewAppModule(app.TransferKeeper) | ||||||
|
||||||
// Create evidence Keeper for to register the IBC light client misbehaviour evidence route | ||||||
evidenceKeeper := evidencekeeper.NewKeeper( | ||||||
appCodec, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), &app.ConsumerKeeper, app.SlashingKeeper, | ||||||
|
@@ -846,7 +821,7 @@ func New( | |||||
&app.BankKeeper, | ||||||
nil, | ||||||
nil, | ||||||
app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 feerefunder | ||||||
app.RateLimitingICS4Wrapper, // defiened in wireisc20 | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.IBCKeeper.PortKeeper, | ||||||
scopedWasmKeeper, | ||||||
|
@@ -859,19 +834,10 @@ func New( | |||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
wasmOpts..., | ||||||
) | ||||||
wasmHooks.ContractKeeper = &app.WasmKeeper | ||||||
|
||||||
app.CronKeeper.WasmMsgServer = wasmkeeper.NewMsgServerImpl(&app.WasmKeeper) | ||||||
cronModule := cron.NewAppModule(appCodec, app.CronKeeper) | ||||||
|
||||||
transferIBCModule := transferSudo.NewIBCModule( | ||||||
app.TransferKeeper, | ||||||
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper), | ||||||
) | ||||||
// receive call order: wasmHooks#OnRecvPacketOverride(transferIbcModule#OnRecvPacket()) | ||||||
ibcHooksMiddleware := ibchooks.NewIBCMiddleware(&transferIBCModule, &app.HooksICS4Wrapper) | ||||||
app.HooksTransferIBCModule = &ibcHooksMiddleware | ||||||
|
||||||
// Create static IBC router, add transfer route, then set and seal it | ||||||
ibcRouter := ibcporttypes.NewRouter() | ||||||
|
||||||
|
@@ -893,23 +859,18 @@ func New( | |||||
) | ||||||
interchainTxsModule := interchaintxs.NewAppModule(appCodec, app.InterchainTxsKeeper, app.AccountKeeper, app.BankKeeper) | ||||||
contractManagerModule := contractmanager.NewAppModule(appCodec, app.ContractManagerKeeper) | ||||||
ibcRateLimitmodule := ibcratelimitmodule.NewAppModule(appCodec, app.RateLimitingICS4Wrapper.IbcratelimitKeeper, app.RateLimitingICS4Wrapper) | ||||||
ibcHooksModule := ibchooks.NewAppModule(app.AccountKeeper) | ||||||
|
||||||
app.PFMModule = packetforward.NewAppModule(app.PFMKeeper, app.GetSubspace(pfmtypes.ModuleName)) | ||||||
|
||||||
var ibcStack ibcporttypes.IBCModule = packetforward.NewIBCMiddleware( | ||||||
app.HooksTransferIBCModule, | ||||||
app.PFMKeeper, | ||||||
0, | ||||||
pfmkeeper.DefaultForwardTransferPacketTimeoutTimestamp, | ||||||
pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp, | ||||||
) | ||||||
transferModule := transferSudo.NewAppModule(app.TransferKeeper) | ||||||
app.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper) | ||||||
|
||||||
ibcStack = gmpmiddleware.NewIBCMiddleware(ibcStack) | ||||||
app.RateLimitingICS4Wrapper.ContractKeeper = app.ContractKeeper | ||||||
app.Ics20WasmHooks.ContractKeeper = &app.WasmKeeper | ||||||
|
||||||
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). | ||||||
AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). | ||||||
AddRoute(ibctransfertypes.ModuleName, ibcStack). | ||||||
AddRoute(ibctransfertypes.ModuleName, app.TransferStack). | ||||||
AddRoute(interchaintxstypes.ModuleName, icaControllerStack). | ||||||
AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper)). | ||||||
AddRoute(ccvconsumertypes.ModuleName, consumerModule) | ||||||
|
@@ -949,6 +910,7 @@ func New( | |||||
feeBurnerModule, | ||||||
contractManagerModule, | ||||||
adminModule, | ||||||
ibcRateLimitmodule, | ||||||
ibcHooksModule, | ||||||
tokenfactory.NewAppModule(appCodec, *app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper), | ||||||
cronModule, | ||||||
|
@@ -997,6 +959,7 @@ func New( | |||||
feetypes.ModuleName, | ||||||
feeburnertypes.ModuleName, | ||||||
adminmoduletypes.ModuleName, | ||||||
ibcratelimittypes.ModuleName, | ||||||
ibchookstypes.ModuleName, | ||||||
pfmtypes.ModuleName, | ||||||
crontypes.ModuleName, | ||||||
|
@@ -1033,6 +996,7 @@ func New( | |||||
feetypes.ModuleName, | ||||||
feeburnertypes.ModuleName, | ||||||
adminmoduletypes.ModuleName, | ||||||
ibcratelimittypes.ModuleName, | ||||||
ibchookstypes.ModuleName, | ||||||
pfmtypes.ModuleName, | ||||||
crontypes.ModuleName, | ||||||
|
@@ -1074,6 +1038,7 @@ func New( | |||||
feetypes.ModuleName, | ||||||
feeburnertypes.ModuleName, | ||||||
adminmoduletypes.ModuleName, | ||||||
ibcratelimittypes.ModuleName, | ||||||
ibchookstypes.ModuleName, // after auth keeper | ||||||
pfmtypes.ModuleName, | ||||||
crontypes.ModuleName, | ||||||
|
@@ -1108,6 +1073,7 @@ func New( | |||||
ibc.NewAppModule(app.IBCKeeper), | ||||||
params.NewAppModule(app.ParamsKeeper), | ||||||
transferModule, | ||||||
ibcRateLimitmodule, | ||||||
consumerModule, | ||||||
icaModule, | ||||||
app.PFMModule, | ||||||
|
@@ -1673,3 +1639,78 @@ func overrideWasmVariables() { | |||||
wasmtypes.MaxWasmSize = 1_677_722 // ~1.6 mb (1024 * 1024 * 1.6) | ||||||
wasmtypes.MaxProposalWasmSize = wasmtypes.MaxWasmSize | ||||||
} | ||||||
|
||||||
func (app *App) WireICS20PreWasmKeeper( | ||||||
appCodec codec.Codec, | ||||||
) { | ||||||
// PFMKeeper must be created before TransferKeeper | ||||||
app.PFMKeeper = pfmkeeper.NewKeeper( | ||||||
appCodec, | ||||||
app.keys[pfmtypes.StoreKey], | ||||||
app.TransferKeeper.Keeper, // set later | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.FeeBurnerKeeper, | ||||||
&app.BankKeeper, | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
wasmHooks := ibchooks.NewWasmHooks(nil, sdk.GetConfig().GetBech32AccountAddrPrefix()) // The contract keeper needs to be set later | ||||||
app.Ics20WasmHooks = &wasmHooks | ||||||
app.HooksICS4Wrapper = ibchooks.NewICS4Middleware( | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.PFMKeeper, | ||||||
&wasmHooks, | ||||||
) | ||||||
|
||||||
ibcratelimitKeeper := ibcratelimitkeeper.NewKeeper(appCodec, app.keys[ibcratelimittypes.ModuleName], authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String()) | ||||||
// ChannelKeeper wrapper for rate limiting SendPacket(). The wasmKeeper needs to be added after it's created | ||||||
rateLimitingICS4Wrapper := ibcratelimit.NewICS4Middleware( | ||||||
app.HooksICS4Wrapper, | ||||||
&app.AccountKeeper, | ||||||
// wasm keeper we set later, right after wasmkeeper init. line 868 | ||||||
nil, | ||||||
&app.BankKeeper, | ||||||
&ibcratelimitKeeper, | ||||||
) | ||||||
app.RateLimitingICS4Wrapper = &rateLimitingICS4Wrapper | ||||||
|
||||||
// Create Transfer Keepers | ||||||
app.TransferKeeper = wrapkeeper.NewKeeper( | ||||||
appCodec, | ||||||
app.keys[ibctransfertypes.StoreKey], | ||||||
app.GetSubspace(ibctransfertypes.ModuleName), | ||||||
app.RateLimitingICS4Wrapper, | ||||||
app.IBCKeeper.ChannelKeeper, | ||||||
app.IBCKeeper.PortKeeper, | ||||||
app.AccountKeeper, | ||||||
&app.BankKeeper, | ||||||
app.ScopedTransferKeeper, | ||||||
app.FeeKeeper, | ||||||
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper), | ||||||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||||||
) | ||||||
|
||||||
app.PFMKeeper.SetTransferKeeper(app.TransferKeeper.Keeper) | ||||||
|
||||||
// Packet Forward Middleware | ||||||
// Initialize packet forward middleware router | ||||||
var ibcStack ibcporttypes.IBCModule = packetforward.NewIBCMiddleware( | ||||||
transferSudo.NewIBCModule( | ||||||
app.TransferKeeper, | ||||||
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper), | ||||||
), | ||||||
app.PFMKeeper, | ||||||
0, | ||||||
pfmkeeper.DefaultForwardTransferPacketTimeoutTimestamp, | ||||||
pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp, | ||||||
) | ||||||
|
||||||
ibcStack = gmpmiddleware.NewIBCMiddleware(ibcStack) | ||||||
// RateLimiting IBC Middleware | ||||||
rateLimitingTransferModule := ibcratelimit.NewIBCModule(ibcStack, app.RateLimitingICS4Wrapper) | ||||||
|
||||||
// Hooks Middleware | ||||||
hooksTransferModule := ibchooks.NewIBCMiddleware(&rateLimitingTransferModule, &app.HooksICS4Wrapper) | ||||||
app.TransferStack = &hooksTransferModule | ||||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these paths and what generates [files in] them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract code was stored and built right in a module, this is a rudiment