The scopedKeeper
in all Keeper
s in ibc-go has at the moment a concrete type (i.e. capabilitykeeper.ScopedKeeper
), but there is no good reason why we should not use an interface instead. Other keepers in the Keeper
types are already using interfaces.
Proposal
- Add
ScopedKeeper
interface.
For 05-port create an expected_keepers.go
file in package types
and add the following interface:
type ScopedKeeper interface {
NewCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, error)
GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error)
}
For 04-channel
add the following interface to expected_keepers.go
:
type ScopedKeeper interface {
NewCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, error)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error)
}
For transfer
add the following interface to expected_keepers.go
:
type ScopedKeeper interface {
GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error)
}
For 27-interchain-accounts
add the following interface to expected_keepers.go
:
type ScopedKeeper interface {
GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error)
}
where capabilitytypes
is alias for github.com/cosmos/cosmos-sdk/x/capability/types
.
- Change the type for the
scopedKeeper
field in the Keeper
type of:
to the corresponding interface type created on step 1.
Notes
- Consider opening different PRs for the changes affecting each part of the codebase.
- This is an API breaking change.
help wanted core 20-transfer 27-interchain-accounts improvement 04-channel API breaking