Skip to content

Commit

Permalink
refactore: update 09-localhost to use runtime.environment
Browse files Browse the repository at this point in the history
  • Loading branch information
bznein committed Dec 5, 2024
1 parent 0afd019 commit 9620934
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Keeper struct {
// NewKeeper creates a new NewKeeper instance
func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, legacySubspace types.ParamSubspace, uk types.UpgradeKeeper) *Keeper {
router := types.NewRouter()
localhostModule := localhost.NewLightClientModule(cdc, env.KVStoreService) // TODO: change to pass env
localhostModule := localhost.NewLightClientModule(cdc, env)
router.AddRoute(exported.Localhost, localhostModule)

return &Keeper{
Expand Down
16 changes: 8 additions & 8 deletions modules/light-clients/09-localhost/light_client_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"

corestore "cosmossdk.io/core/store"
"cosmossdk.io/core/appmodule"
errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -33,15 +33,15 @@ var _ exported.LightClientModule = (*LightClientModule)(nil)

// LightClientModule implements the core IBC api.LightClientModule interface.
type LightClientModule struct {
cdc codec.BinaryCodec
storeService corestore.KVStoreService
cdc codec.BinaryCodec
appmodule.Environment
}

// NewLightClientModule creates and returns a new 09-localhost LightClientModule.
func NewLightClientModule(cdc codec.BinaryCodec, storeService corestore.KVStoreService) *LightClientModule {
func NewLightClientModule(cdc codec.BinaryCodec, env appmodule.Environment) *LightClientModule {
return &LightClientModule{
cdc: cdc,
storeService: storeService,
cdc: cdc,
Environment: env,
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ func (l LightClientModule) VerifyMembership(
path exported.Path,
value []byte,
) error {
ibcStore := l.storeService.OpenKVStore(ctx)
ibcStore := l.KVStoreService.OpenKVStore(ctx)

// ensure the proof provided is the expected sentinel localhost client proof
if !bytes.Equal(proof, SentinelProof) {
Expand Down Expand Up @@ -127,7 +127,7 @@ func (l LightClientModule) VerifyNonMembership(
proof []byte,
path exported.Path,
) error {
ibcStore := l.storeService.OpenKVStore(ctx)
ibcStore := l.KVStoreService.OpenKVStore(ctx)

// ensure the proof provided is the expected sentinel localhost client proof
if !bytes.Equal(proof, SentinelProof) {
Expand Down

0 comments on commit 9620934

Please sign in to comment.