ibc-apps icon indicating copy to clipboard operation
ibc-apps copied to clipboard

(ibc-hooks): Integration Readme seems incorrect

Open puneet2019 opened this issue 5 months ago • 1 comments

Readme mentions the integration of ibc-hooks as ->

...

	// 'ibc-hooks' module - depends on
	// 1. 'auth'
	// 2. 'bank'
	// 3. 'distr'
	app.keys[ibchookstypes.StoreKey] = storetypes.NewKVStoreKey(ibchookstypes.StoreKey)
	app.IBCHooksKeeper = ibchookskeeper.NewKeeper(
		app.keys[ibchookstypes.StoreKey],
	)
	app.Ics20WasmHooks = ibchooks.NewWasmHooks(&app.IBCHooksKeeper, nil, AccountAddressPrefix) // The contract keeper needs to be set later

	// initialize the wasm keeper with
	// wasmKeeper := wasm.NewKeeper( ... )
	app.WasmKeeper = &wasmKeeper

	// Pass the contract keeper to all the structs (generally ICS4Wrappers for ibc middlewares) that need it
	app.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper)
	app.Ics20WasmHooks.ContractKeeper = app.ContractKeeper
	app.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
		app.IBCKeeper.ChannelKeeper,
		app.Ics20WasmHooks,
	)
	// Hooks Middleware
	transferIBCModule := ibctransfer.NewIBCModule(app.TransferKeeper)
	app.TransferStack = ibchooks.NewIBCMiddleware(&transferIBCModule, &app.HooksICS4Wrapper)

...

But this integration doesn't make sure that Hooks corresponding to ICS4Wrapper are triggered, only the hooks corresponding to IBCModule are triggered.

// Basiclly Middleware has both IBCModule and ICS4Wrapper
type Middleware interface {
	IBCModule // these hooks are triggered as they are part of the "transferStack"
	ICS4Wrapper // these hooks are not triggered as ICS4Wrapper is not passed into TransferKeeper Or PFM keeper
}

puneet2019 avatar Sep 05 '24 14:09 puneet2019