Skip to content

Commit

Permalink
fix(indexer): the issues during simapp v1 integration (#22413)
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-develope authored Nov 6, 2024
1 parent fdccc84 commit 2290c5e
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 26 deletions.
14 changes: 7 additions & 7 deletions collections/codec/indexing.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ValueSchemaCodec[V any](cdc ValueCodec[V]) (SchemaCodec[V], error) {

// FallbackSchemaCodec returns a fallback schema codec for T when one isn't explicitly
// specified with HasSchemaCodec. It maps all simple types directly to schema kinds
// and converts everything else to JSON.
// and converts everything else to JSON String.
func FallbackSchemaCodec[T any]() SchemaCodec[T] {
var t T
kind := schema.KindForGoValue(t)
Expand All @@ -81,20 +81,20 @@ func FallbackSchemaCodec[T any]() SchemaCodec[T] {
FromSchemaType: nil,
}
} else {
// we default to encoding everything to JSON
// we default to encoding everything to JSON String
return SchemaCodec[T]{
Fields: []schema.Field{{Kind: schema.JSONKind}},
Fields: []schema.Field{{Kind: schema.StringKind}},
ToSchemaType: func(t T) (any, error) {
bz, err := json.Marshal(t)
return json.RawMessage(bz), err
return string(json.RawMessage(bz)), err
},
FromSchemaType: func(a any) (T, error) {
var t T
bz, ok := a.(json.RawMessage)
sz, ok := a.(string)
if !ok {
return t, fmt.Errorf("expected json.RawMessage, got %T", a)
return t, fmt.Errorf("expected string, got %T", a)
}
err := json.Unmarshal(bz, &t)
err := json.Unmarshal([]byte(sz), &t)
return t, err
},
}
Expand Down
17 changes: 15 additions & 2 deletions collections/indexes/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,26 @@ func NewMulti[ReferenceKey, PrimaryKey, Value any](
if o.uncheckedValue {
return &Multi[ReferenceKey, PrimaryKey, Value]{
getRefKey: getRefKeyFunc,
refKeys: collections.NewKeySet(schema, prefix, name, collections.PairKeyCodec(refCodec, pkCodec), collections.WithKeySetUncheckedValue()),
refKeys: collections.NewKeySet(
schema,
prefix,
name,
collections.PairKeyCodec(refCodec, pkCodec),
collections.WithKeySetUncheckedValue(),
collections.WithKeySetSecondaryIndex(),
),
}
}

return &Multi[ReferenceKey, PrimaryKey, Value]{
getRefKey: getRefKeyFunc,
refKeys: collections.NewKeySet(schema, prefix, name, collections.PairKeyCodec(refCodec, pkCodec)),
refKeys: collections.NewKeySet(
schema,
prefix,
name,
collections.PairKeyCodec(refCodec, pkCodec),
collections.WithKeySetSecondaryIndex(),
),
}
}

Expand Down
17 changes: 15 additions & 2 deletions collections/indexes/reverse_pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,25 @@ func NewReversePair[Value, K1, K2 any](
}
if o.uncheckedValue {
return &ReversePair[K1, K2, Value]{
refKeys: collections.NewKeySet(sb, prefix, name, collections.PairKeyCodec(pkc.KeyCodec2(), pkc.KeyCodec1()), collections.WithKeySetUncheckedValue()),
refKeys: collections.NewKeySet(
sb,
prefix,
name,
collections.PairKeyCodec(pkc.KeyCodec2(), pkc.KeyCodec1()),
collections.WithKeySetUncheckedValue(),
collections.WithKeySetSecondaryIndex(),
),
}
}

mi := &ReversePair[K1, K2, Value]{
refKeys: collections.NewKeySet(sb, prefix, name, collections.PairKeyCodec(pkc.KeyCodec2(), pkc.KeyCodec1())),
refKeys: collections.NewKeySet(
sb,
prefix,
name,
collections.PairKeyCodec(pkc.KeyCodec2(), pkc.KeyCodec1()),
collections.WithKeySetSecondaryIndex(),
),
}

return mi
Expand Down
3 changes: 3 additions & 0 deletions collections/indexing.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) {
if err != nil {
return nil, err
}
if keyDecoder.ToSchemaType == nil {
return x, nil
}
return keyDecoder.ToSchemaType(x)
}
ensureFieldNames(c.m.kc, "key", res.objectType.KeyFields)
Expand Down
14 changes: 12 additions & 2 deletions collections/keyset.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ func WithKeySetUncheckedValue() func(opt *keySetOptions) {
}
}

type keySetOptions struct{ uncheckedValue bool }
// WithKeySetSecondaryIndex changes the behavior of the KeySet to be a secondary index.
func WithKeySetSecondaryIndex() func(opt *keySetOptions) {
return func(opt *keySetOptions) {
opt.isSecondaryIndex = true
}
}

type keySetOptions struct {
uncheckedValue bool
isSecondaryIndex bool
}

// KeySet builds on top of a Map and represents a collection retaining only a set
// of keys and no value. It can be used, for example, in an allow list.
Expand All @@ -44,7 +54,7 @@ func NewKeySet[K any](
if o.uncheckedValue {
vc = codec.NewAltValueCodec(vc, func(_ []byte) (NoValue, error) { return NoValue{}, nil })
}
return (KeySet[K])(NewMap(schema, prefix, name, keyCodec, vc))
return (KeySet[K])(NewMap(schema, prefix, name, keyCodec, vc, withMapSecondaryIndex(o.isSecondaryIndex)))
}

// Set adds the key to the KeySet. Errors on encoding problems.
Expand Down
27 changes: 22 additions & 5 deletions collections/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ type Map[K, V any] struct {
isSecondaryIndex bool
}

// withMapSecondaryIndex changes the behavior of the Map to be a secondary index.
func withMapSecondaryIndex(isSecondaryIndex bool) func(opt *mapOptions) {
return func(opt *mapOptions) {
opt.isSecondaryIndex = isSecondaryIndex
}
}

type mapOptions struct {
isSecondaryIndex bool
}

// NewMap returns a Map given a StoreKey, a Prefix, human-readable name and the relative value and key encoders.
// Name and prefix must be unique within the schema and name must match the format specified by NameRegex, or
// else this method will panic.
Expand All @@ -36,13 +47,19 @@ func NewMap[K, V any](
name string,
keyCodec codec.KeyCodec[K],
valueCodec codec.ValueCodec[V],
options ...func(opt *mapOptions),
) Map[K, V] {
o := new(mapOptions)
for _, opt := range options {
opt(o)
}
m := Map[K, V]{
kc: keyCodec,
vc: valueCodec,
sa: schemaBuilder.schema.storeAccessor,
prefix: prefix.Bytes(),
name: name,
kc: keyCodec,
vc: valueCodec,
sa: schemaBuilder.schema.storeAccessor,
prefix: prefix.Bytes(),
name: name,
isSecondaryIndex: o.isSecondaryIndex,
}
schemaBuilder.addCollection(collectionImpl[K, V]{m})
return m
Expand Down
10 changes: 10 additions & 0 deletions collections/pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ func (p pairKeyCodec[K1, K2]) SchemaCodec() (codec.SchemaCodec[Pair[K1, K2]], er

return codec.SchemaCodec[Pair[K1, K2]]{
Fields: []schema.Field{field1, field2},
ToSchemaType: func(pair Pair[K1, K2]) (any, error) {
return []interface{}{pair.K1(), pair.K2()}, nil
},
FromSchemaType: func(a any) (Pair[K1, K2], error) {
aSlice, ok := a.([]interface{})
if !ok || len(aSlice) != 2 {
return Pair[K1, K2]{}, fmt.Errorf("expected slice of length 2, got %T", a)
}
return Join(aSlice[0].(K1), aSlice[1].(K2)), nil
},
}, nil
}

Expand Down
10 changes: 10 additions & 0 deletions collections/quad.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,16 @@ func (t quadKeyCodec[K1, K2, K3, K4]) SchemaCodec() (codec.SchemaCodec[Quad[K1,

return codec.SchemaCodec[Quad[K1, K2, K3, K4]]{
Fields: []schema.Field{field1, field2, field3, field4},
ToSchemaType: func(q Quad[K1, K2, K3, K4]) (any, error) {
return []interface{}{q.K1(), q.K2(), q.K3(), q.K4()}, nil
},
FromSchemaType: func(a any) (Quad[K1, K2, K3, K4], error) {
aSlice, ok := a.([]interface{})
if !ok || len(aSlice) != 4 {
return Quad[K1, K2, K3, K4]{}, fmt.Errorf("expected slice of length 4, got %T", a)
}
return Join4(aSlice[0].(K1), aSlice[1].(K2), aSlice[2].(K3), aSlice[3].(K4)), nil
},
}, nil
}

Expand Down
10 changes: 10 additions & 0 deletions collections/triple.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ func (t tripleKeyCodec[K1, K2, K3]) SchemaCodec() (codec.SchemaCodec[Triple[K1,

return codec.SchemaCodec[Triple[K1, K2, K3]]{
Fields: []schema.Field{field1, field2, field3},
ToSchemaType: func(t Triple[K1, K2, K3]) (any, error) {
return []interface{}{t.K1(), t.K2(), t.K3()}, nil
},
FromSchemaType: func(a any) (Triple[K1, K2, K3], error) {
aSlice, ok := a.([]interface{})
if !ok || len(aSlice) != 3 {
return Triple[K1, K2, K3]{}, fmt.Errorf("expected slice of length 3, got %T", a)
}
return Join3(aSlice[0].(K1), aSlice[1].(K2), aSlice[2].(K3)), nil
},
}, nil
}

Expand Down
9 changes: 8 additions & 1 deletion runtime/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ func (a *AppBuilder) registerIndexer() error {
if indexerOpts := a.appOptions.Get("indexer"); indexerOpts != nil {
moduleSet := map[string]any{}
for modName, mod := range a.app.ModuleManager.Modules {
moduleSet[modName] = mod
storeKey := modName
for _, cfg := range a.app.config.OverrideStoreKeys {
if cfg.ModuleName == modName {
storeKey = cfg.KvStoreKey
break
}
}
moduleSet[storeKey] = mod
}

return a.app.EnableIndexer(indexerOpts, a.kvStoreKeys(), moduleSet)
Expand Down
3 changes: 3 additions & 0 deletions simapp/app_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import (
"fmt"
"io"

_ "github.com/jackc/pgx/v5/stdlib" // Import and register pgx driver

clienthelpers "cosmossdk.io/client/v2/helpers"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/registry"
corestore "cosmossdk.io/core/store"
"cosmossdk.io/depinject"
_ "cosmossdk.io/indexer/postgres" // register the postgres indexer
"cosmossdk.io/log"
"cosmossdk.io/x/accounts"
basedepinject "cosmossdk.io/x/accounts/defaults/base/depinject"
Expand Down
7 changes: 7 additions & 0 deletions simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
cosmossdk.io/core v1.0.0-alpha.5
cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29
cosmossdk.io/depinject v1.1.0
cosmossdk.io/indexer/postgres v0.1.0
cosmossdk.io/log v1.4.1
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.1
Expand Down Expand Up @@ -49,6 +50,8 @@ require (
google.golang.org/protobuf v1.35.1
)

require github.com/jackc/pgx/v5 v5.7.1

require (
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.1-20240701160653-fedbb9acfd2f.1 // indirect
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.1-20240130113600-88ef6483f90f.1 // indirect
Expand Down Expand Up @@ -147,6 +150,9 @@ require (
github.com/huandu/skiplist v1.2.1 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
Expand Down Expand Up @@ -240,6 +246,7 @@ replace (
cosmossdk.io/api => ../api
cosmossdk.io/client/v2 => ../client/v2
cosmossdk.io/collections => ../collections
cosmossdk.io/indexer/postgres => ../indexer/postgres
cosmossdk.io/store => ../store
cosmossdk.io/tools/confix => ../tools/confix
cosmossdk.io/x/accounts => ../x/accounts
Expand Down
9 changes: 9 additions & 0 deletions simapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM=
cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU=
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc=
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
Expand Down Expand Up @@ -600,6 +601,14 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs=
github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down
6 changes: 6 additions & 0 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ require (
cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect
cosmossdk.io/indexer/postgres v0.1.0 // indirect
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac // indirect
cosmossdk.io/server/v2/appmanager v0.0.0-00010101000000-000000000000 // indirect
cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f // indirect
Expand Down Expand Up @@ -157,6 +158,10 @@ require (
github.com/huandu/skiplist v1.2.1 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
Expand Down Expand Up @@ -243,6 +248,7 @@ replace (
cosmossdk.io/api => ../api
cosmossdk.io/client/v2 => ../client/v2
cosmossdk.io/collections => ../collections
cosmossdk.io/indexer/postgres => ../indexer/postgres
cosmossdk.io/runtime/v2 => ../runtime/v2
cosmossdk.io/server/v2/appmanager => ../server/v2/appmanager
cosmossdk.io/server/v2/stf => ../server/v2/stf
Expand Down
9 changes: 9 additions & 0 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM=
cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU=
cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE=
cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k=
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc=
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
Expand Down Expand Up @@ -597,6 +598,14 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.7.1 h1:x7SYsPBYDkHDksogeSmZZ5xzThcTgRz++I5E+ePFUcs=
github.com/jackc/pgx/v5 v5.7.1/go.mod h1:e7O26IywZZ+naJtWWos6i6fvWK+29etgITqrqHLfoZA=
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94=
github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down
7 changes: 0 additions & 7 deletions x/bank/keeper/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"cosmossdk.io/core/appmodule"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"
"cosmossdk.io/schema"
"cosmossdk.io/x/bank/types"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -257,9 +256,3 @@ func (k BaseViewKeeper) ValidateBalance(ctx context.Context, addr sdk.AccAddress

return nil
}

// ModuleCodec implements `schema.HasModuleCodec` interface.
// It allows the indexer to decode the module's KVPairUpdate.
func (k BaseViewKeeper) ModuleCodec() (schema.ModuleCodec, error) {
return k.Schema.ModuleCodec(collections.IndexingOptions{})
}
Loading

0 comments on commit 2290c5e

Please sign in to comment.