From 24879d0d2b9cb341bd4f283c61d215a5a841970f Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 18 Nov 2024 11:08:23 +0100 Subject: [PATCH 01/26] progress --- baseapp/abci.go | 13 +++++- codec/collections.go | 69 +++++++++++++++++++++++++++- codec/proto_codec.go | 1 + codec/types/interface_registry.go | 7 +++ collections/indexing.go | 9 ++++ indexer/postgres/create_table.go | 2 +- indexer/postgres/listener.go | 24 +++++++++- schema/appdata/async.go | 11 +++-- schema/field.go | 4 ++ schema/state_object.go | 2 +- simapp/go.mod | 2 + types/collections.go | 18 ++++++-- x/bank/keeper/view.go | 8 ++-- x/bank/module.go | 1 + x/staking/keeper/keeper.go | 74 ++++++++++++++++++++++++------- x/staking/module.go | 9 ++++ x/staking/types/validator.go | 1 + 17 files changed, 221 insertions(+), 34 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 979089c5c86d..957511c73bd7 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "os" "sort" "strconv" "strings" @@ -905,6 +906,9 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin for _, streamingListener := range app.streamingManager.ABCIListeners { if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.Context(), *req, *res); err != nil { app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) + if app.streamingManager.StopNodeOnErr { + os.Exit(1) + } } } }() @@ -976,8 +980,6 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { rms.SetCommitHeader(header) } - app.cms.Commit() - resp := &abci.CommitResponse{ RetainHeight: retainHeight, } @@ -991,10 +993,17 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { for _, abciListener := range abciListeners { if err := abciListener.ListenCommit(ctx, *resp, changeSet); err != nil { app.logger.Error("Commit listening hook failed", "height", blockHeight, "err", err) + if app.streamingManager.StopNodeOnErr { + os.Exit(1) + } } } } + // Commit after all listeners have been called, in case they error and we + // need to stop before committing. + app.cms.Commit() + // Reset the CheckTx state to the latest committed. // // NOTE: This is safe because CometBFT holds a lock on the mempool for diff --git a/codec/collections.go b/codec/collections.go index 0137a989e790..9b1849b22e6c 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -1,16 +1,19 @@ package codec import ( + "encoding/json" "fmt" "reflect" "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" + gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/protobuf/encoding/protojson" protov2 "google.golang.org/protobuf/proto" "cosmossdk.io/collections" collcodec "cosmossdk.io/collections/codec" + "cosmossdk.io/schema" ) // BoolValue implements a ValueCodec that saves the bool value @@ -51,12 +54,17 @@ type protoMessage[T any] interface { proto.Message } +type protoCollValueCodec[T any] interface { + collcodec.HasSchemaCodec[T] + collcodec.ValueCodec[T] +} + // CollValue inits a collections.ValueCodec for a generic gogo protobuf message. func CollValue[T any, PT protoMessage[T]](cdc interface { Marshal(proto.Message) ([]byte, error) Unmarshal([]byte, proto.Message) error }, -) collcodec.ValueCodec[T] { +) protoCollValueCodec[T] { return &collValue[T, PT]{cdc.(Codec), proto.MessageName(PT(new(T)))} } @@ -91,6 +99,65 @@ func (c collValue[T, PT]) ValueType() string { return "github.com/cosmos/gogoproto/" + c.messageName } +type hasUnpackInterfaces interface { + UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error // Replace `AnyUnpacker` with the actual type from gogoprotoany +} + +func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { + return FallbackSchemaCodec[T]( + func(v T) error { + if unpackable, ok := any(v).(hasUnpackInterfaces); ok { + return unpackable.UnpackInterfaces(c.cdc) + } + return nil + }, + ), nil +} + +// 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 String. +func FallbackSchemaCodec[T any](unpacker func(T) error) collcodec.SchemaCodec[T] { + var t T + kind := schema.KindForGoValue(t) + if err := kind.Validate(); err == nil { + return collcodec.SchemaCodec[T]{ + Fields: []schema.Field{{ + // we don't set any name so that this can be set to a good default by the caller + Name: "", + Kind: kind, + }}, + // these can be nil because T maps directly to a schema value for this kind + ToSchemaType: nil, + FromSchemaType: nil, + } + } else { + // we default to encoding everything to JSON String + return collcodec.SchemaCodec[T]{ + Fields: []schema.Field{{Kind: schema.StringKind}}, + ToSchemaType: func(t T) (any, error) { + fmt.Println("type of t: ", reflect.TypeOf(t)) + if unpacker != nil { + if err := unpacker(t); err != nil { + return nil, err + } + } + bz, err := json.Marshal(t) + return string(json.RawMessage(bz)), err + }, + FromSchemaType: func(a any) (T, error) { + var t T + sz, ok := a.(string) + if !ok { + return t, fmt.Errorf("expected string, got %T", a) + } + err := json.Unmarshal([]byte(sz), &t) + return t, err + }, + } + } +} + type protoMessageV2[T any] interface { *T protov2.Message diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 2c0c081896b1..09e40fe3b71e 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -291,6 +291,7 @@ func (pc *ProtoCodec) UnmarshalInterfaceJSON(bz []byte, iface interface{}) error // it unpacks the value in any to the interface pointer passed in as // iface. func (pc *ProtoCodec) UnpackAny(any *types.Any, iface interface{}) error { + fmt.Println("HERE?? aaaaa") return pc.interfaceRegistry.UnpackAny(any, iface) } diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index 04c94c4394a9..dde6ff1ce762 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -230,6 +230,7 @@ func (registry *interfaceRegistry) ListImplementations(ifaceName string) []strin } func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { + fmt.Println("HERE??!!! 4444", reflect.TypeOf(iface)) // here we gracefully handle the case in which `any` itself is `nil`, which may occur in message decoding if any == nil { return nil @@ -239,6 +240,7 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error // if TypeUrl is empty return nil because without it we can't actually unpack anything return nil } + fmt.Println("HERE??!!! 6666", reflect.TypeOf(iface)) rv := reflect.ValueOf(iface) if rv.Kind() != reflect.Ptr { @@ -249,12 +251,15 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error cachedValue := any.GetCachedValue() if cachedValue != nil { + fmt.Println("HERE??!!! 8888eee") if reflect.TypeOf(cachedValue).AssignableTo(rt) { rv.Elem().Set(reflect.ValueOf(cachedValue)) return nil } } + fmt.Println("HERE??!!! 7777", reflect.TypeOf(iface)) + imap, found := registry.interfaceImpls[rt] if !found { return fmt.Errorf("no registered implementations of type %+v", rt) @@ -276,6 +281,7 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error if err != nil { return err } + fmt.Println("HERE??!!! 8888", reflect.TypeOf(iface)) err = UnpackInterfaces(msg, registry) if err != nil { @@ -289,6 +295,7 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error return err } + fmt.Println("HERE??!!! 5555", newAnyWithCache) *any = *newAnyWithCache return nil } diff --git a/collections/indexing.go b/collections/indexing.go index bb039e7be256..f2f45fdbf7fb 100644 --- a/collections/indexing.go +++ b/collections/indexing.go @@ -106,6 +106,7 @@ func (c collectionSchemaCodec) decodeKVPair(update schema.KVPairUpdate) ([]schem } v, err := c.valueDecoder(update.Value) + fmt.Println("HERE??", err, k, c.coll.GetName()) if err != nil { return []schema.StateObjectUpdate{ {TypeName: c.coll.GetName(), Key: k}, @@ -146,6 +147,14 @@ func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) { } res.objectType.ValueFields = valueDecoder.Fields res.valueDecoder = func(i []byte) (any, error) { + // gogoprotoany "github.com/cosmos/gogoproto/types/any" gogoprotoany.AnyUnpacker + // if unpacker, ok := c.m.vc.(gogoprotoany.AnyUnpacker); ok { + // err := unpacker.UnpackAny(i, V) + // if err != nil { + // return nil, err + // } + // } + x, err := c.m.vc.Decode(i) if err != nil { return nil, err diff --git a/indexer/postgres/create_table.go b/indexer/postgres/create_table.go index 0f8dc652190e..58a5177fde2d 100644 --- a/indexer/postgres/create_table.go +++ b/indexer/postgres/create_table.go @@ -17,7 +17,7 @@ func (tm *objectIndexer) createTable(ctx context.Context, conn dbConn) error { sqlStr := buf.String() if tm.options.logger != nil { - tm.options.logger.Debug("Creating table %s", "table", tm.tableName(), "sql", sqlStr) + tm.options.logger.Debug("Creating table", "table", tm.tableName(), "sql", sqlStr) } _, err = conn.ExecContext(ctx, sqlStr) return err diff --git a/indexer/postgres/listener.go b/indexer/postgres/listener.go index 21d08a736af7..f7ceb05a4c19 100644 --- a/indexer/postgres/listener.go +++ b/indexer/postgres/listener.go @@ -22,7 +22,26 @@ func (i *indexerImpl) listener() appdata.Listener { return mm.initializeSchema(i.ctx, i.tx) }, StartBlock: func(data appdata.StartBlockData) error { - _, err := i.tx.Exec("INSERT INTO block (number) VALUES ($1)", data.Height) + var ( + headerBz []byte + err error + ) + + if data.HeaderJSON != nil { + headerBz, err = data.HeaderJSON() + if err != nil { + return err + } + } else if data.HeaderBytes != nil { + headerBz, err = data.HeaderBytes() + if err != nil { + return err + } + } + + // TODO: verify the format of headerBz, otherwise we'll get `ERROR: invalid input syntax for type json (SQLSTATE 22P02)` + _, err = i.tx.Exec("INSERT INTO block (number, header) VALUES ($1, $2)", data.Height, headerBz) + return err }, OnObjectUpdate: func(data appdata.ObjectUpdateData) error { @@ -54,12 +73,15 @@ func (i *indexerImpl) listener() appdata.Listener { return nil }, Commit: func(data appdata.CommitData) (func() error, error) { + fmt.Println("Commit ERROR 000") err := i.tx.Commit() + fmt.Println("Commit ERROR 111", err) if err != nil { return nil, err } i.tx, err = i.db.BeginTx(i.ctx, nil) + fmt.Println("Commit ERROR 2222", err) return nil, err }, } diff --git a/schema/appdata/async.go b/schema/appdata/async.go index b85d0e492e90..d16216b56dd7 100644 --- a/schema/appdata/async.go +++ b/schema/appdata/async.go @@ -46,6 +46,13 @@ func AsyncListener(opts AsyncListenerOptions, listener Listener) Listener { done := ctx.Done() go func() { + defer func() { + close(packetChan) + if opts.DoneWaitGroup != nil { + opts.DoneWaitGroup.Done() + } + }() + if opts.DoneWaitGroup != nil { opts.DoneWaitGroup.Add(1) } @@ -74,10 +81,6 @@ func AsyncListener(opts AsyncListenerOptions, listener Listener) Listener { } case <-done: - close(packetChan) - if opts.DoneWaitGroup != nil { - opts.DoneWaitGroup.Done() - } return } } diff --git a/schema/field.go b/schema/field.go index b2bc76a2e3b6..d76e91b56792 100644 --- a/schema/field.go +++ b/schema/field.go @@ -35,6 +35,10 @@ type Field struct { // Validate validates the field. func (c Field) Validate(typeSet TypeSet) error { // valid name + if c.Name == "" { + return fmt.Errorf("field name cannot be empty, might be missing the named key codec") + } + if !ValidateName(c.Name) { return fmt.Errorf("invalid field name %q", c.Name) } diff --git a/schema/state_object.go b/schema/state_object.go index eff8d1f98459..b64e58919f02 100644 --- a/schema/state_object.go +++ b/schema/state_object.go @@ -53,7 +53,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error { for _, field := range o.KeyFields { if err := field.Validate(typeSet); err != nil { - return fmt.Errorf("invalid key field %q: %v", field.Name, err) //nolint:errorlint // false positive due to using go1.12 + return fmt.Errorf("invalid key field %q in type %q: %v", field.Name, o.Name, err) //nolint:errorlint // false positive due to using go1.12 } if !field.Kind.ValidKeyKind() { diff --git a/simapp/go.mod b/simapp/go.mod index 64c80a7d2798..6a680dc76ebc 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -286,6 +286,8 @@ replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk github.com/cosmos/cosmos-sdk => ../. + cosmossdk.io/schema => ../schema + cosmossdk.io/indexer/postgres => ../indexer/postgres // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 diff --git a/types/collections.go b/types/collections.go index df1e27617abb..18ed47ef45d4 100644 --- a/types/collections.go +++ b/types/collections.go @@ -44,7 +44,7 @@ var ( // Deprecated: exists only for state compatibility reasons, should not // be used for new storage keys using time. Please use the time KeyCodec // provided in the collections package. - TimeKey collcodec.KeyCodec[time.Time] = timeKeyCodec{} + TimeKey collcodec.NameableKeyCodec[time.Time] = timeKeyCodec{} // LEUint64Key is a collections KeyCodec that encodes uint64 using little endian. // NOTE: it MUST NOT be used by other modules, distribution relies on this only for @@ -56,7 +56,7 @@ var ( // Deprecated: exists only for state compatibility reasons, should not be // used for new storage keys using []byte. Please use the BytesKey provided // in the collections package. - LengthPrefixedBytesKey collcodec.KeyCodec[[]byte] = lengthPrefixedBytesKey{collections.BytesKey} + LengthPrefixedBytesKey collcodec.NameableKeyCodec[[]byte] = lengthPrefixedBytesKey{collections.BytesKey} ) const ( @@ -139,6 +139,10 @@ func (g lengthPrefixedAddressKey[T]) Size(key T) int { return g.SizeNonTerminal( func (g lengthPrefixedAddressKey[T]) KeyType() string { return "index_key/" + g.KeyCodec.KeyType() } +func (g lengthPrefixedAddressKey[T]) WithName(name string) collcodec.KeyCodec[T] { + return collcodec.NamedKeyCodec[T]{KeyCodec: g, Name: name} +} + // Deprecated: LengthPrefixedAddressKey implements an SDK backwards compatible indexing key encoder // for addresses. // The status quo in the SDK is that address keys are length prefixed even when they're the @@ -148,7 +152,7 @@ func (g lengthPrefixedAddressKey[T]) KeyType() string { return "index_key/" + g. // byte to the string, then when you know when the string part finishes, it's logical that the // part which remains is the address key. In the SDK instead we prepend to the address key its // length too. -func LengthPrefixedAddressKey[T addressUnion](keyCodec collcodec.KeyCodec[T]) collcodec.KeyCodec[T] { +func LengthPrefixedAddressKey[T addressUnion](keyCodec collcodec.KeyCodec[T]) collcodec.NameableKeyCodec[T] { return lengthPrefixedAddressKey[T]{ keyCodec, } @@ -176,6 +180,10 @@ func (g lengthPrefixedBytesKey) KeyType() string { return "index_key/" + g.KeyCodec.KeyType() } +func (g lengthPrefixedBytesKey) WithName(name string) collcodec.KeyCodec[[]byte] { + return collcodec.NamedKeyCodec[[]byte]{KeyCodec: g, Name: name} +} + // Collection Codecs type intValueCodec struct{} @@ -329,6 +337,10 @@ func (t timeKeyCodec) DecodeNonTerminal(buffer []byte) (int, time.Time, error) { } func (t timeKeyCodec) SizeNonTerminal(key time.Time) int { return t.Size(key) } +func (t timeKeyCodec) WithName(name string) collcodec.KeyCodec[time.Time] { + return collcodec.NamedKeyCodec[time.Time]{KeyCodec: t, Name: name} +} + type leUint64Key struct{} func (l leUint64Key) Encode(buffer []byte, key uint64) (int, error) { diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 31620246518e..6eff40e1388d 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -78,10 +78,10 @@ func NewBaseViewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak type cdc: cdc, ak: ak, addrCdc: ak.AddressCodec(), - Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey.WithName("supply"), sdk.IntValue), - DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey.WithName("denom_metadata"), codec.CollValue[types.Metadata](cdc)), - SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey.WithName("send_enabled"), codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat - Balances: collections.NewIndexedMap(sb, types.BalancesPrefix, "balances", collections.NamedPairKeyCodec("address", sdk.AccAddressKey, "balances", collections.StringKey), types.BalanceValueCodec, newBalancesIndexes(sb)), + Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey.WithName("denom"), sdk.IntValue), + DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey.WithName("denom"), codec.CollValue[types.Metadata](cdc)), + SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey.WithName("denom"), codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat + Balances: collections.NewIndexedMap(sb, types.BalancesPrefix, "balances", collections.NamedPairKeyCodec("address", sdk.AccAddressKey, "denom", collections.StringKey), types.BalanceValueCodec, newBalancesIndexes(sb)), Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), } diff --git a/x/bank/module.go b/x/bank/module.go index f387903c5886..cc459f23b340 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -39,6 +39,7 @@ var ( _ appmodule.HasMigrations = AppModule{} _ appmodule.HasGenesis = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} + _ schema.HasModuleCodec = AppModule{} ) // AppModule implements an application module for the bank module. diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index b85bab1bbc8b..bcdb30f6307f 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -159,8 +159,10 @@ func NewKeeper( LastTotalPower: collections.NewItem(sb, types.LastTotalPowerKey, "last_total_power", sdk.IntValue), Delegations: collections.NewMap( sb, types.DelegationKey, "delegations", - collections.PairKeyCodec( + collections.NamedPairKeyCodec( + "delegator", sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + "validator_address", sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility ), codec.CollValue[types.Delegation](cdc), @@ -168,67 +170,94 @@ func NewKeeper( DelegationsByValidator: collections.NewMap( sb, types.DelegationByValIndexKey, "delegations_by_validator", - collections.PairKeyCodec(sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), sdk.AccAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + collections.NamedPairKeyCodec( + "validator_address", + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + "delegator", + sdk.AccAddressKey, + ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility collections.BytesValue, ), UnbondingID: collections.NewSequence(sb, types.UnbondingIDKey, "unbonding_id"), ValidatorByConsensusAddress: collections.NewMap( sb, types.ValidatorsByConsAddrKey, "validator_by_cons_addr", - sdk.LengthPrefixedAddressKey(sdk.ConsAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + sdk.LengthPrefixedAddressKey(sdk.ConsAddressKey).WithName("cons_address"), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility collcodec.KeyToValueCodec(sdk.ValAddressKey), ), - UnbondingType: collections.NewMap(sb, types.UnbondingTypeKey, "unbonding_type", collections.Uint64Key, collections.Uint64Value), + UnbondingType: collections.NewMap(sb, types.UnbondingTypeKey, "unbonding_type", collections.Uint64Key.WithName("unbonding_id"), collections.Uint64Value), // key format is: 52 | lengthPrefixedBytes(AccAddr) | lengthPrefixedBytes(SrcValAddr) | lengthPrefixedBytes(DstValAddr) Redelegations: collections.NewMap( sb, types.RedelegationKey, "redelegations", - collections.TripleKeyCodec( + collections.NamedTripleKeyCodec( + "delegator", collections.BytesKey, + "src_validator", collections.BytesKey, + "dst_validator", sdk.LengthPrefixedBytesKey, // sdk.LengthPrefixedBytesKey is needed to retain state compatibility ), codec.CollValue[types.Redelegation](cdc), ), - UnbondingIndex: collections.NewMap(sb, types.UnbondingIndexKey, "unbonding_index", collections.Uint64Key, collections.BytesValue), + UnbondingIndex: collections.NewMap(sb, types.UnbondingIndexKey, "unbonding_index", collections.Uint64Key.WithName("index"), collections.BytesValue.WithName("ubd_key")), UnbondingDelegationByValIndex: collections.NewMap( sb, types.UnbondingDelegationByValIndexKey, "unbonding_delegation_by_val_index", - collections.PairKeyCodec(sdk.LengthPrefixedBytesKey, sdk.LengthPrefixedBytesKey), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility + collections.NamedPairKeyCodec( + "validator_address", + sdk.LengthPrefixedBytesKey, + "delegator", + sdk.LengthPrefixedBytesKey, + ), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility collections.BytesValue, ), - UnbondingQueue: collections.NewMap(sb, types.UnbondingQueueKey, "unbonidng_queue", sdk.TimeKey, codec.CollValue[types.DVPairs](cdc)), + UnbondingQueue: collections.NewMap(sb, types.UnbondingQueueKey, "unbonidng_queue", sdk.TimeKey.WithName("unbonding_time"), codec.CollValue[types.DVPairs](cdc)), // key format is: 53 | lengthPrefixedBytes(SrcValAddr) | lengthPrefixedBytes(AccAddr) | lengthPrefixedBytes(DstValAddr) RedelegationsByValSrc: collections.NewMap( sb, types.RedelegationByValSrcIndexKey, "redelegations_by_val_src", - collections.TripleKeyCodec( + collections.NamedTripleKeyCodec( + "src_validator", collections.BytesKey, + "delegator", collections.BytesKey, + "dst_validator", sdk.LengthPrefixedBytesKey, // sdk.LengthPrefixedBytesKey is needed to retain state compatibility ), collections.BytesValue, ), // key format is: 17 | lengthPrefixedBytes(valAddr) | power - LastValidatorPower: collections.NewMap(sb, types.LastValidatorPowerKey, "last_validator_power", sdk.LengthPrefixedBytesKey, codec.CollValue[gogotypes.Int64Value](cdc)), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility + LastValidatorPower: collections.NewMap(sb, types.LastValidatorPowerKey, "last_validator_power", sdk.LengthPrefixedBytesKey.WithName("validator_address"), codec.CollValue[gogotypes.Int64Value](cdc)), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility // key format is: 54 | lengthPrefixedBytes(DstValAddr) | lengthPrefixedBytes(AccAddr) | lengthPrefixedBytes(SrcValAddr) RedelegationsByValDst: collections.NewMap( sb, types.RedelegationByValDstIndexKey, "redelegations_by_val_dst", - collections.TripleKeyCodec( + collections.NamedTripleKeyCodec( + "dst_validator", collections.BytesKey, + "delegator", collections.BytesKey, + "src_validator", sdk.LengthPrefixedBytesKey, // sdk.LengthPrefixedBytesKey is needed to retain state compatibility ), collections.BytesValue, ), - RedelegationQueue: collections.NewMap(sb, types.RedelegationQueueKey, "redelegation_queue", sdk.TimeKey, codec.CollValue[types.DVVTriplets](cdc)), - Validators: collections.NewMap(sb, types.ValidatorsKey, "validators", sdk.LengthPrefixedBytesKey, codec.CollValue[types.Validator](cdc)), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility + RedelegationQueue: collections.NewMap(sb, types.RedelegationQueueKey, "redelegation_queue", sdk.TimeKey.WithName("completion_time"), codec.CollValue[types.DVVTriplets](cdc)), + Validators: collections.NewMap( + sb, + types.ValidatorsKey, + "validators", + sdk.LengthPrefixedBytesKey.WithName("validator_address"), // sdk.LengthPrefixedBytesKey is needed to retain state compatibility + codec.CollValue[types.Validator](cdc), + ), UnbondingDelegations: collections.NewMap( sb, types.UnbondingDelegationKey, "unbonding_delegation", - collections.PairKeyCodec( + collections.NamedPairKeyCodec( + "delegator", collections.BytesKey, + "validator", sdk.LengthPrefixedBytesKey, // sdk.LengthPrefixedBytesKey is needed to retain state compatibility ), codec.CollValue[types.UnbondingDelegation](cdc), @@ -238,9 +267,12 @@ func NewKeeper( ValidatorQueue: collections.NewMap( sb, types.ValidatorQueueKey, "validator_queue", - collections.TripleKeyCodec( + collections.NamedTripleKeyCodec( + "ts_length", collections.Uint64Key, + "timestamp", sdk.TimeKey, + "height", collections.Uint64Key, ), codec.CollValue[types.ValAddresses](cdc), @@ -252,7 +284,11 @@ func NewKeeper( ValidatorConsensusKeyRotationRecordIndexKey: collections.NewKeySet( sb, types.ValidatorConsensusKeyRotationRecordIndexKey, "cons_pub_rotation_index", - collections.PairKeyCodec(collections.BytesKey, sdk.TimeKey), + collections.NamedPairKeyCodec( + "validator_address", + collections.BytesKey, + "time", + sdk.TimeKey), ), // key format is: 103 | time @@ -285,7 +321,11 @@ func NewKeeper( sb, types.ValidatorConsPubKeyRotationHistoryKey, "cons_pub_rotation_history", - collections.PairKeyCodec(collections.BytesKey, collections.Uint64Key), + collections.NamedPairKeyCodec( + "validator_address", + collections.BytesKey, + "height", + collections.Uint64Key), codec.CollValue[types.ConsPubKeyRotationHistory](cdc), NewRotationHistoryIndexes(sb), ), diff --git a/x/staking/module.go b/x/staking/module.go index 52b5313ed15b..041906ad1c03 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -9,9 +9,11 @@ import ( "github.com/spf13/cobra" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/registry" "cosmossdk.io/depinject" + "cosmossdk.io/schema" "cosmossdk.io/x/staking/client/cli" "cosmossdk.io/x/staking/keeper" "cosmossdk.io/x/staking/types" @@ -37,6 +39,7 @@ var ( _ appmodule.AppModule = AppModule{} _ appmodule.HasMigrations = AppModule{} _ appmodule.HasRegisterInterfaces = AppModule{} + _ schema.HasModuleCodec = AppModule{} _ depinject.OnePerModuleType = AppModule{} ) @@ -163,3 +166,9 @@ func (AppModule) ConsensusVersion() uint64 { return consensusVersion } func (am AppModule) EndBlock(ctx context.Context) ([]appmodule.ValidatorUpdate, error) { return am.keeper.EndBlocker(ctx) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 6665c037b793..e73dffb3497c 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -539,5 +539,6 @@ func (v Validator) GetDelegatorShares() math.LegacyDec { return v.DelegatorShare // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (v Validator) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pk cryptotypes.PubKey + fmt.Println("CALLING UNPACK INTERFACES") return unpacker.UnpackAny(v.ConsensusPubkey, &pk) } From 8047466fab58a9f676cb32ba17498a123518fb89 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 18 Nov 2024 11:09:39 +0100 Subject: [PATCH 02/26] progress --- collections/indexing.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/collections/indexing.go b/collections/indexing.go index f2f45fdbf7fb..bb039e7be256 100644 --- a/collections/indexing.go +++ b/collections/indexing.go @@ -106,7 +106,6 @@ func (c collectionSchemaCodec) decodeKVPair(update schema.KVPairUpdate) ([]schem } v, err := c.valueDecoder(update.Value) - fmt.Println("HERE??", err, k, c.coll.GetName()) if err != nil { return []schema.StateObjectUpdate{ {TypeName: c.coll.GetName(), Key: k}, @@ -147,14 +146,6 @@ func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) { } res.objectType.ValueFields = valueDecoder.Fields res.valueDecoder = func(i []byte) (any, error) { - // gogoprotoany "github.com/cosmos/gogoproto/types/any" gogoprotoany.AnyUnpacker - // if unpacker, ok := c.m.vc.(gogoprotoany.AnyUnpacker); ok { - // err := unpacker.UnpackAny(i, V) - // if err != nil { - // return nil, err - // } - // } - x, err := c.m.vc.Decode(i) if err != nil { return nil, err From 5a529704b13ef9a8c9a6ca5857989879ab0157d6 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 18 Nov 2024 12:26:14 +0100 Subject: [PATCH 03/26] progress --- codec/collections.go | 30 ++++++------------------------ codec/proto_codec.go | 1 - codec/types/interface_registry.go | 7 ------- collections/codec/indexing.go | 4 +++- x/staking/types/validator.go | 1 - 5 files changed, 9 insertions(+), 34 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index 9b1849b22e6c..c2cecb24e257 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -104,20 +104,6 @@ type hasUnpackInterfaces interface { } func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { - return FallbackSchemaCodec[T]( - func(v T) error { - if unpackable, ok := any(v).(hasUnpackInterfaces); ok { - return unpackable.UnpackInterfaces(c.cdc) - } - return nil - }, - ), nil -} - -// 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 String. -func FallbackSchemaCodec[T any](unpacker func(T) error) collcodec.SchemaCodec[T] { var t T kind := schema.KindForGoValue(t) if err := kind.Validate(); err == nil { @@ -128,21 +114,17 @@ func FallbackSchemaCodec[T any](unpacker func(T) error) collcodec.SchemaCodec[T] Kind: kind, }}, // these can be nil because T maps directly to a schema value for this kind - ToSchemaType: nil, + ToSchemaType: func(t T) (any, error) { + return nil, nil + }, FromSchemaType: nil, - } + }, nil } else { // we default to encoding everything to JSON String return collcodec.SchemaCodec[T]{ Fields: []schema.Field{{Kind: schema.StringKind}}, ToSchemaType: func(t T) (any, error) { - fmt.Println("type of t: ", reflect.TypeOf(t)) - if unpacker != nil { - if err := unpacker(t); err != nil { - return nil, err - } - } - bz, err := json.Marshal(t) + bz, err := c.EncodeJSON(t) return string(json.RawMessage(bz)), err }, FromSchemaType: func(a any) (T, error) { @@ -154,7 +136,7 @@ func FallbackSchemaCodec[T any](unpacker func(T) error) collcodec.SchemaCodec[T] err := json.Unmarshal([]byte(sz), &t) return t, err }, - } + }, nil } } diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 09e40fe3b71e..2c0c081896b1 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -291,7 +291,6 @@ func (pc *ProtoCodec) UnmarshalInterfaceJSON(bz []byte, iface interface{}) error // it unpacks the value in any to the interface pointer passed in as // iface. func (pc *ProtoCodec) UnpackAny(any *types.Any, iface interface{}) error { - fmt.Println("HERE?? aaaaa") return pc.interfaceRegistry.UnpackAny(any, iface) } diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index dde6ff1ce762..04c94c4394a9 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -230,7 +230,6 @@ func (registry *interfaceRegistry) ListImplementations(ifaceName string) []strin } func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { - fmt.Println("HERE??!!! 4444", reflect.TypeOf(iface)) // here we gracefully handle the case in which `any` itself is `nil`, which may occur in message decoding if any == nil { return nil @@ -240,7 +239,6 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error // if TypeUrl is empty return nil because without it we can't actually unpack anything return nil } - fmt.Println("HERE??!!! 6666", reflect.TypeOf(iface)) rv := reflect.ValueOf(iface) if rv.Kind() != reflect.Ptr { @@ -251,15 +249,12 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error cachedValue := any.GetCachedValue() if cachedValue != nil { - fmt.Println("HERE??!!! 8888eee") if reflect.TypeOf(cachedValue).AssignableTo(rt) { rv.Elem().Set(reflect.ValueOf(cachedValue)) return nil } } - fmt.Println("HERE??!!! 7777", reflect.TypeOf(iface)) - imap, found := registry.interfaceImpls[rt] if !found { return fmt.Errorf("no registered implementations of type %+v", rt) @@ -281,7 +276,6 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error if err != nil { return err } - fmt.Println("HERE??!!! 8888", reflect.TypeOf(iface)) err = UnpackInterfaces(msg, registry) if err != nil { @@ -295,7 +289,6 @@ func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error return err } - fmt.Println("HERE??!!! 5555", newAnyWithCache) *any = *newAnyWithCache return nil } diff --git a/collections/codec/indexing.go b/collections/codec/indexing.go index 01f3740bd588..e9cdf327945a 100644 --- a/collections/codec/indexing.go +++ b/collections/codec/indexing.go @@ -77,7 +77,9 @@ func FallbackSchemaCodec[T any]() SchemaCodec[T] { Kind: kind, }}, // these can be nil because T maps directly to a schema value for this kind - ToSchemaType: nil, + ToSchemaType: func(t T) (any, error) { + return t, nil + }, FromSchemaType: nil, } } else { diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index e73dffb3497c..6665c037b793 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -539,6 +539,5 @@ func (v Validator) GetDelegatorShares() math.LegacyDec { return v.DelegatorShare // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (v Validator) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error { var pk cryptotypes.PubKey - fmt.Println("CALLING UNPACK INTERFACES") return unpacker.UnpackAny(v.ConsensusPubkey, &pk) } From ce8b93116133dd10d7bce30ffceca668c4c0e0fb Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 19 Nov 2024 13:37:20 +0100 Subject: [PATCH 04/26] progress, need to revisit enums --- codec/collections.go | 185 +++++++++++++++++++++++++++++++++++-- schema/state_object.go | 4 +- x/staking/keeper/keeper.go | 4 +- 3 files changed, 182 insertions(+), 11 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index c2cecb24e257..ed3fc5d5fa5b 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -10,6 +10,10 @@ import ( gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/protobuf/encoding/protojson" protov2 "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/dynamicpb" + "google.golang.org/protobuf/types/known/durationpb" + "google.golang.org/protobuf/types/known/timestamppb" "cosmossdk.io/collections" collcodec "cosmossdk.io/collections/codec" @@ -104,7 +108,17 @@ type hasUnpackInterfaces interface { } func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { - var t T + var ( + t T + pt PT + ) + msgName := proto.MessageName(pt) + desc, err := proto.HybridResolver.FindDescriptorByName(protoreflect.FullName(msgName)) + if err != nil { + panic(fmt.Errorf("could not find descriptor for %s: %w", msgName, err)) + } + schemaFields := protoCols(desc.(protoreflect.MessageDescriptor)) + kind := schema.KindForGoValue(t) if err := kind.Validate(); err == nil { return collcodec.SchemaCodec[T]{ @@ -114,18 +128,108 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { Kind: kind, }}, // these can be nil because T maps directly to a schema value for this kind - ToSchemaType: func(t T) (any, error) { - return nil, nil - }, + ToSchemaType: nil, FromSchemaType: nil, }, nil } else { // we default to encoding everything to JSON String return collcodec.SchemaCodec[T]{ - Fields: []schema.Field{{Kind: schema.StringKind}}, + Fields: schemaFields, ToSchemaType: func(t T) (any, error) { - bz, err := c.EncodeJSON(t) - return string(json.RawMessage(bz)), err + values := []interface{}{} + nm := dynamicpb.NewMessage(desc.(protoreflect.MessageDescriptor)) + bz, err := c.cdc.Marshal(any(&t).(PT)) + if err != nil { + return nil, err + } + + err = c.cdc.Unmarshal(bz, nm) + if err != nil { + return nil, err + } + + for _, field := range schemaFields { + // Find the field descriptor by the Protobuf field name + fieldDesc := desc.(protoreflect.MessageDescriptor).Fields().ByName(protoreflect.Name(field.Name)) + if fieldDesc == nil { + return nil, fmt.Errorf("field %q not found in message %s", field.Name, desc.FullName()) + } + + val := nm.ProtoReflect().Get(fieldDesc) + + // convert to the right type + if fieldDesc.IsList() { + // figure out this + repeatedVals := []interface{}{} + list := val.List() + for i := 0; i < list.Len(); i++ { + repeatedVals = append(repeatedVals, list.Get(i).Interface()) + } + values = append(values, repeatedVals) + continue + } + + switch fieldDesc.Kind() { + case protoreflect.BoolKind: + values = append(values, val.Bool()) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, + protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + values = append(values, val.Int()) + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, + protoreflect.Fixed64Kind: + values = append(values, val.Uint()) + case protoreflect.FloatKind, protoreflect.DoubleKind: + values = append(values, val.Float()) + case protoreflect.StringKind: + values = append(values, val.String()) + case protoreflect.BytesKind: + values = append(values, val.Bytes()) + case protoreflect.EnumKind: + // TODO: support enums + values = append(values, string(fieldDesc.Enum().Values().ByNumber(val.Enum()).Name())) + case protoreflect.MessageKind: + // figure out this + msg := val.Interface().(*dynamicpb.Message) + msgbz, err := c.cdc.Marshal(msg) + if err != nil { + return nil, err + } + + if field.Kind == schema.TimeKind { + // make it a time.Time + ts := ×tamppb.Timestamp{} + err = c.cdc.Unmarshal(msgbz, ts) + if err != nil { + return nil, fmt.Errorf("error unmarshalling timestamp: %w %x %s", err, msgbz, fieldDesc.FullName()) + } + values = append(values, ts.AsTime()) + } else if field.Kind == schema.DurationKind { + // make it a time.Duration + dur := &durationpb.Duration{} + err = c.cdc.Unmarshal(msgbz, dur) + if err != nil { + return nil, fmt.Errorf("error unmarshalling duration: %w", err) + } + values = append(values, dur.AsDuration()) + } else { + // if not a time or duration, just keep it as a JSON object + // we might want to change this to include the entire object as separate fields + bz, err := c.cdc.MarshalJSON(msg) + if err != nil { + return nil, fmt.Errorf("error marshalling message: %w", err) + } + + values = append(values, json.RawMessage(bz)) + } + } + + } + + // if there's only one value, return it directly + if len(values) == 1 { + return values[0], nil + } + return values, nil }, FromSchemaType: func(a any) (T, error) { var t T @@ -228,3 +332,70 @@ func (c collInterfaceValue[T]) ValueType() string { var t T return fmt.Sprintf("%T", t) } + +func protoCols(desc protoreflect.MessageDescriptor) []schema.Field { + nFields := desc.Fields() + cols := make([]schema.Field, 0, nFields.Len()) + for i := 0; i < nFields.Len(); i++ { + f := nFields.Get(i) + cols = append(cols, protoCol(f)) + } + return cols +} + +func protoCol(f protoreflect.FieldDescriptor) schema.Field { + col := schema.Field{Name: string(f.Name())} + if f.IsMap() || f.IsList() { + col.Kind = schema.JSONKind + col.Nullable = true + } else { + switch f.Kind() { + case protoreflect.BoolKind: + col.Kind = schema.BoolKind + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + col.Kind = schema.Int32Kind + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + col.Kind = schema.Int64Kind + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + col.Kind = schema.Int64Kind + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + col.Kind = schema.Uint64Kind + case protoreflect.FloatKind: + col.Kind = schema.Float32Kind + case protoreflect.DoubleKind: + col.Kind = schema.Float64Kind + case protoreflect.StringKind: + col.Kind = schema.StringKind + case protoreflect.BytesKind: + col.Kind = schema.BytesKind + case protoreflect.EnumKind: + // for now we'll use a string for enums. + col.Kind = schema.StringKind + // TODO: support enums + // ERROR: "invalid value field \"status\": can't find enum type \"BondStatus\" referenced by field \"status\"" + // col.Kind = schema.EnumKind + // enumDesc := f.Enum() + // var vals []string + // n := enumDesc.Values().Len() + // for i := 0; i < n; i++ { + // vals = append(vals, string(enumDesc.Values().Get(i).Name())) + // } + // col.ReferencedType = string(enumDesc.Name()) + case protoreflect.MessageKind: + col.Nullable = true + fullName := f.Message().FullName() + if fullName == "google.protobuf.Timestamp" { + col.Kind = schema.TimeKind + } else if fullName == "google.protobuf.Duration" { + col.Kind = schema.DurationKind + } else { + col.Kind = schema.JSONKind + } + } + if f.HasPresence() { + col.Nullable = true + } + } + + return col +} diff --git a/schema/state_object.go b/schema/state_object.go index b64e58919f02..3367d8337b7f 100644 --- a/schema/state_object.go +++ b/schema/state_object.go @@ -65,7 +65,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error { } if fieldNames[field.Name] { - return fmt.Errorf("duplicate field name %q", field.Name) + return fmt.Errorf("duplicate key field name %q for stateObjectType: %s", field.Name, o.Name) } fieldNames[field.Name] = true } @@ -76,7 +76,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error { } if fieldNames[field.Name] { - return fmt.Errorf("duplicate field name %q", field.Name) + return fmt.Errorf("duplicate field name %q for stateObjectType: %s", field.Name, o.Name) } fieldNames[field.Name] = true } diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index bcdb30f6307f..eebc01c00008 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -162,7 +162,7 @@ func NewKeeper( collections.NamedPairKeyCodec( "delegator", sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility - "validator_address", + "validator_address_key", sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility ), codec.CollValue[types.Delegation](cdc), @@ -324,7 +324,7 @@ func NewKeeper( collections.NamedPairKeyCodec( "validator_address", collections.BytesKey, - "height", + "height_key", collections.Uint64Key), codec.CollValue[types.ConsPubKeyRotationHistory](cdc), NewRotationHistoryIndexes(sb), From 86fc09abff94ec55a4a7cc47887b70e570f6524e Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 19 Nov 2024 16:38:36 +0100 Subject: [PATCH 05/26] progrss --- codec/collections.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index ed3fc5d5fa5b..1bc77c1f7c65 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -115,7 +115,7 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { msgName := proto.MessageName(pt) desc, err := proto.HybridResolver.FindDescriptorByName(protoreflect.FullName(msgName)) if err != nil { - panic(fmt.Errorf("could not find descriptor for %s: %w", msgName, err)) + return collcodec.SchemaCodec[T]{}, fmt.Errorf("could not find descriptor for %s: %w", msgName, err) } schemaFields := protoCols(desc.(protoreflect.MessageDescriptor)) @@ -137,7 +137,12 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { Fields: schemaFields, ToSchemaType: func(t T) (any, error) { values := []interface{}{} - nm := dynamicpb.NewMessage(desc.(protoreflect.MessageDescriptor)) + msgDesc, ok := desc.(protoreflect.MessageDescriptor) + if !ok { + return nil, fmt.Errorf("expected message descriptor, got %T", desc) + } + + nm := dynamicpb.NewMessage(msgDesc) bz, err := c.cdc.Marshal(any(&t).(PT)) if err != nil { return nil, err @@ -150,16 +155,15 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { for _, field := range schemaFields { // Find the field descriptor by the Protobuf field name - fieldDesc := desc.(protoreflect.MessageDescriptor).Fields().ByName(protoreflect.Name(field.Name)) + fieldDesc := msgDesc.Fields().ByName(protoreflect.Name(field.Name)) if fieldDesc == nil { return nil, fmt.Errorf("field %q not found in message %s", field.Name, desc.FullName()) } val := nm.ProtoReflect().Get(fieldDesc) - // convert to the right type + // if the field is a map or list, we need to convert it to a slice of values if fieldDesc.IsList() { - // figure out this repeatedVals := []interface{}{} list := val.List() for i := 0; i < list.Len(); i++ { @@ -185,10 +189,9 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { case protoreflect.BytesKind: values = append(values, val.Bytes()) case protoreflect.EnumKind: - // TODO: support enums + // TODO: support enums better, with actual enums values = append(values, string(fieldDesc.Enum().Values().ByNumber(val.Enum()).Name())) case protoreflect.MessageKind: - // figure out this msg := val.Interface().(*dynamicpb.Message) msgbz, err := c.cdc.Marshal(msg) if err != nil { @@ -372,7 +375,6 @@ func protoCol(f protoreflect.FieldDescriptor) schema.Field { // for now we'll use a string for enums. col.Kind = schema.StringKind // TODO: support enums - // ERROR: "invalid value field \"status\": can't find enum type \"BondStatus\" referenced by field \"status\"" // col.Kind = schema.EnumKind // enumDesc := f.Enum() // var vals []string From 7e5a665875a939f6e14591b7ac1904309814123b Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 19 Nov 2024 16:40:49 +0100 Subject: [PATCH 06/26] remove debug prints --- indexer/postgres/listener.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/indexer/postgres/listener.go b/indexer/postgres/listener.go index f7ceb05a4c19..c2e982e2b02f 100644 --- a/indexer/postgres/listener.go +++ b/indexer/postgres/listener.go @@ -73,15 +73,12 @@ func (i *indexerImpl) listener() appdata.Listener { return nil }, Commit: func(data appdata.CommitData) (func() error, error) { - fmt.Println("Commit ERROR 000") err := i.tx.Commit() - fmt.Println("Commit ERROR 111", err) if err != nil { return nil, err } i.tx, err = i.db.BeginTx(i.ctx, nil) - fmt.Println("Commit ERROR 2222", err) return nil, err }, } From 4ebf63f2b13af5ce32d40d0b423dc662049c5886 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 19 Nov 2024 16:47:21 +0100 Subject: [PATCH 07/26] small fix --- codec/collections.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index 1bc77c1f7c65..7e68e05fd725 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -7,7 +7,6 @@ import ( "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" - gogoprotoany "github.com/cosmos/gogoproto/types/any" "google.golang.org/protobuf/encoding/protojson" protov2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -103,10 +102,6 @@ func (c collValue[T, PT]) ValueType() string { return "github.com/cosmos/gogoproto/" + c.messageName } -type hasUnpackInterfaces interface { - UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error // Replace `AnyUnpacker` with the actual type from gogoprotoany -} - func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { var ( t T From 38fcf4c5637f236c19900b23acd8df9aea4e8671 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 21 Nov 2024 15:24:49 +0100 Subject: [PATCH 08/26] add enums --- codec/collections.go | 17 ++--- collections/go.mod | 11 +++- collections/go.sum | 12 +++- collections/indexing.go | 76 +++++++++++++++++++++- collections/protocodec/collections.go | 2 +- collections/protocodec/collections_test.go | 2 +- indexer/postgres/enum.go | 1 + 7 files changed, 103 insertions(+), 18 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index 7e68e05fd725..c4c92c92ed43 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "reflect" + "strings" "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" @@ -184,7 +185,7 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { case protoreflect.BytesKind: values = append(values, val.Bytes()) case protoreflect.EnumKind: - // TODO: support enums better, with actual enums + // TODO: postgres uses the enum name, not the number values = append(values, string(fieldDesc.Enum().Values().ByNumber(val.Enum()).Name())) case protoreflect.MessageKind: msg := val.Interface().(*dynamicpb.Message) @@ -367,17 +368,11 @@ func protoCol(f protoreflect.FieldDescriptor) schema.Field { case protoreflect.BytesKind: col.Kind = schema.BytesKind case protoreflect.EnumKind: - // for now we'll use a string for enums. - col.Kind = schema.StringKind // TODO: support enums - // col.Kind = schema.EnumKind - // enumDesc := f.Enum() - // var vals []string - // n := enumDesc.Values().Len() - // for i := 0; i < n; i++ { - // vals = append(vals, string(enumDesc.Values().Get(i).Name())) - // } - // col.ReferencedType = string(enumDesc.Name()) + col.Kind = schema.EnumKind + // use the full name to avoid collissions + col.ReferencedType = string(f.Enum().FullName()) + col.ReferencedType = strings.ReplaceAll(col.ReferencedType, ".", "_") case protoreflect.MessageKind: col.Nullable = true fullName := f.Message().FullName() diff --git a/collections/go.mod b/collections/go.mod index 13d244d609f0..d82af96444c7 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -1,11 +1,14 @@ module cosmossdk.io/collections -go 1.23 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/core v1.0.0-alpha.6 cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 cosmossdk.io/schema v0.3.0 + github.com/cosmos/gogoproto v1.7.0 github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 pgregory.net/rapid v1.1.0 @@ -13,6 +16,10 @@ require ( require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + diff --git a/collections/go.sum b/collections/go.sum index a3adb2c7a335..9084f580b1b3 100644 --- a/collections/go.sum +++ b/collections/go.sum @@ -4,14 +4,22 @@ cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0 cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29/go.mod h1:8s2tPeJtSiQuoyPmr2Ag7meikonISO4Fv4MoO8+ORrs= cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c= cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/collections/indexing.go b/collections/indexing.go index bb039e7be256..9b699cd823cc 100644 --- a/collections/indexing.go +++ b/collections/indexing.go @@ -3,9 +3,12 @@ package collections import ( "bytes" "fmt" + "reflect" "strings" + "github.com/cosmos/gogoproto/proto" "github.com/tidwall/btree" + "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/collections/codec" "cosmossdk.io/schema" @@ -46,8 +49,48 @@ func (s Schema) ModuleCodec(opts IndexingOptions) (schema.ModuleCodec, error) { cdc.objectType.RetainDeletions = true } - types = append(types, cdc.objectType) + // this part below is a bit hacky, it will try to convert to a proto.Message + // in order to get any enum types inside of it. + emptyVal, err := coll.ValueCodec().Decode([]byte{}) + if err == nil { + // convert to proto.Message + pt, err := toProtoMessage(emptyVal) + if err == nil { + msgName := proto.MessageName(pt) + desc, err := proto.HybridResolver.FindDescriptorByName(protoreflect.FullName(msgName)) + if err != nil { + return schema.ModuleCodec{}, fmt.Errorf("could not find descriptor for %s: %w", msgName, err) + } + msgDesc := desc.(protoreflect.MessageDescriptor) + + // go through enum descriptors and add them to types + fmt.Println("msgDesc", msgDesc.FullName()) + + for i := 0; i < msgDesc.Fields().Len(); i++ { + + field := msgDesc.Fields().Get(i) + enum := field.Enum() + if enum == nil { + continue + } + + enumType := schema.EnumType{ + Name: strings.ReplaceAll(string(enum.FullName()), ".", "_"), // make it compatible with schema + } + for j := 0; j < enum.Values().Len(); j++ { + val := enum.Values().Get(j) + enumType.Values = append(enumType.Values, schema.EnumValueDefinition{ + Name: string(val.Name()), + Value: int32(val.Number()), + }) + } + types = append(types, enumType) + } + } + } + + types = append(types, cdc.objectType) decoder.collectionLookup.Set(string(coll.GetPrefix()), cdc) } @@ -180,3 +223,34 @@ func ensureFieldNames(x any, defaultName string, cols []schema.Field) { cols[i] = col } } + +// toProtoMessage is a helper to convert a value to a proto.Message. +func toProtoMessage(value interface{}) (proto.Message, error) { + if value == nil { + return nil, fmt.Errorf("value is nil") + } + + // Check if the value already implements proto.Message + if msg, ok := value.(proto.Message); ok { + return msg, nil + } + + // Use reflection to handle non-pointer values + v := reflect.ValueOf(value) + if v.Kind() == reflect.Ptr { + // Already a pointer, but doesn't implement proto.Message + return nil, fmt.Errorf("value is a pointer but does not implement proto.Message") + } + + // If not a pointer, create a pointer to the value dynamically + ptr := reflect.New(v.Type()) + ptr.Elem().Set(v) + + // Assert if the pointer implements proto.Message + msg, ok := ptr.Interface().(proto.Message) + if !ok { + return nil, fmt.Errorf("value does not implement proto.Message") + } + + return msg, nil +} diff --git a/collections/protocodec/collections.go b/collections/protocodec/collections.go index 0b6c2c230f6e..f989cddbcd0f 100644 --- a/collections/protocodec/collections.go +++ b/collections/protocodec/collections.go @@ -1,4 +1,4 @@ -package codec +package protocodec import ( "fmt" diff --git a/collections/protocodec/collections_test.go b/collections/protocodec/collections_test.go index f98e3d3d7409..cf2af632f788 100644 --- a/collections/protocodec/collections_test.go +++ b/collections/protocodec/collections_test.go @@ -1,4 +1,4 @@ -package codec_test +package protocodec_test import ( "testing" diff --git a/indexer/postgres/enum.go b/indexer/postgres/enum.go index 62332f67d0e8..10ce2bd13269 100644 --- a/indexer/postgres/enum.go +++ b/indexer/postgres/enum.go @@ -21,6 +21,7 @@ func (m *moduleIndexer) createEnumType(ctx context.Context, conn dbConn, enum sc } } else { // the enum type already exists + // TODO: add a check to ensure the existing enum type matches the expected values, and update it if necessary? return nil } From ee06bf22f2d2bc9c476e1c9c8709203e686f9f41 Mon Sep 17 00:00:00 2001 From: Facundo Date: Fri, 22 Nov 2024 14:26:56 +0100 Subject: [PATCH 09/26] add x/auth + CollInterfaceValue schemaCodec --- codec/collections.go | 50 ++++++++++++++++++++++++++++++++++------- collections/indexing.go | 3 --- x/auth/module.go | 8 +++++++ 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index c4c92c92ed43..a0438645f693 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -128,7 +128,6 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { FromSchemaType: nil, }, nil } else { - // we default to encoding everything to JSON String return collcodec.SchemaCodec[T]{ Fields: schemaFields, ToSchemaType: func(t T) (any, error) { @@ -231,13 +230,7 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { return values, nil }, FromSchemaType: func(a any) (T, error) { - var t T - sz, ok := a.(string) - if !ok { - return t, fmt.Errorf("expected string, got %T", a) - } - err := json.Unmarshal([]byte(sz), &t) - return t, err + panic("not implemented") }, }, nil } @@ -332,6 +325,47 @@ func (c collInterfaceValue[T]) ValueType() string { return fmt.Sprintf("%T", t) } +// SchemaCodec returns a schema codec, which will always have a single JSON field +// as there is no way to know in advance the necessary fields for an interface. +func (c collInterfaceValue[T]) SchemaCodec() (collcodec.SchemaCodec[T], error) { + var ( + pt T + ) + + kind := schema.KindForGoValue(pt) + if err := kind.Validate(); err == nil { + return collcodec.SchemaCodec[T]{ + Fields: []schema.Field{{ + // we don't set any name so that this can be set to a good default by the caller + Name: "", + Kind: kind, + }}, + // these can be nil because T maps directly to a schema value for this kind + ToSchemaType: nil, + FromSchemaType: nil, + }, nil + } else { + return collcodec.SchemaCodec[T]{ + Fields: []schema.Field{{ + Name: "value", + Kind: schema.JSONKind, + }}, + ToSchemaType: func(t T) (any, error) { + bz, err := c.codec.MarshalInterfaceJSON(t) + if err != nil { + return nil, err + } + + return json.RawMessage(bz), nil + }, + FromSchemaType: func(a any) (T, error) { + panic("not implemented") + }, + }, nil + } + +} + func protoCols(desc protoreflect.MessageDescriptor) []schema.Field { nFields := desc.Fields() cols := make([]schema.Field, 0, nFields.Len()) diff --git a/collections/indexing.go b/collections/indexing.go index 9b699cd823cc..25acd3f5385f 100644 --- a/collections/indexing.go +++ b/collections/indexing.go @@ -64,10 +64,7 @@ func (s Schema) ModuleCodec(opts IndexingOptions) (schema.ModuleCodec, error) { msgDesc := desc.(protoreflect.MessageDescriptor) // go through enum descriptors and add them to types - fmt.Println("msgDesc", msgDesc.FullName()) - for i := 0; i < msgDesc.Fields().Len(); i++ { - field := msgDesc.Fields().Get(i) enum := field.Enum() if enum == nil { diff --git a/x/auth/module.go b/x/auth/module.go index b959fcde5408..45e845a02527 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -8,10 +8,12 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" + "cosmossdk.io/schema" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -198,3 +200,9 @@ func (AppModule) ProposalMsgsX(weights simsx.WeightSource, reg simsx.Registry) { func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[types.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(am.accountKeeper.Schema) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.accountKeeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} From 538182360062be47b2a865393e47bbc6db052860 Mon Sep 17 00:00:00 2001 From: Facundo Date: Fri, 22 Nov 2024 14:48:22 +0100 Subject: [PATCH 10/26] add some more modules just to make sure these things work --- client/v2/go.mod | 6 ++++-- client/v2/go.sum | 4 ++-- collections/go.mod | 3 +-- go.mod | 6 ++++-- go.sum | 4 ++-- schema/decoding/sync.go | 3 +++ server/v2/cometbft/go.mod | 6 ++++-- server/v2/cometbft/go.sum | 4 ++-- simapp/go.mod | 11 ++++++----- simapp/go.sum | 7 ++----- simapp/v2/go.mod | 6 ++++-- simapp/v2/go.sum | 4 ++-- tests/go.mod | 6 ++++-- tests/go.sum | 4 ++-- x/accounts/defaults/base/go.mod | 6 ++++-- x/accounts/defaults/base/go.sum | 4 ++-- x/accounts/defaults/lockup/go.mod | 6 ++++-- x/accounts/defaults/lockup/go.sum | 4 ++-- x/accounts/defaults/multisig/go.mod | 6 ++++-- x/accounts/defaults/multisig/go.sum | 4 ++-- x/accounts/go.mod | 6 ++++-- x/accounts/go.sum | 4 ++-- x/authz/go.mod | 6 ++++-- x/authz/go.sum | 4 ++-- x/bank/go.mod | 6 ++++-- x/bank/go.sum | 4 ++-- x/circuit/go.mod | 8 ++++++-- x/circuit/go.sum | 4 ++-- x/circuit/module.go | 8 ++++++++ x/consensus/go.mod | 7 +++++-- x/consensus/go.sum | 4 ++-- x/consensus/keeper/keeper.go | 12 +++++++++++- x/consensus/module.go | 8 ++++++++ x/distribution/go.mod | 6 ++++-- x/distribution/go.sum | 4 ++-- x/distribution/keeper/keeper.go | 23 ++++++++++++++++++++--- x/distribution/module.go | 8 ++++++++ x/epochs/go.mod | 8 ++++++-- x/epochs/go.sum | 4 ++-- x/epochs/module.go | 8 ++++++++ x/evidence/go.mod | 6 ++++-- x/evidence/go.sum | 4 ++-- x/feegrant/go.mod | 6 ++++-- x/feegrant/go.sum | 4 ++-- x/gov/go.mod | 6 ++++-- x/gov/go.sum | 4 ++-- x/group/go.mod | 6 ++++-- x/group/go.sum | 4 ++-- x/mint/go.mod | 6 ++++-- x/mint/go.sum | 4 ++-- x/nft/go.mod | 6 ++++-- x/nft/go.sum | 4 ++-- x/params/go.mod | 6 ++++-- x/params/go.sum | 4 ++-- x/protocolpool/go.mod | 6 ++++-- x/protocolpool/go.sum | 4 ++-- x/slashing/go.mod | 6 ++++-- x/slashing/go.sum | 4 ++-- x/staking/go.mod | 9 ++++++--- x/staking/go.sum | 4 ++-- x/upgrade/go.mod | 6 ++++-- x/upgrade/go.sum | 4 ++-- 62 files changed, 238 insertions(+), 121 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index e0d910542455..6170d7f3384e 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/client/v2 -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -15,7 +17,7 @@ require ( github.com/spf13/pflag v1.0.5 go.uber.org/mock v0.5.0 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gotest.tools/v3 v3.5.1 sigs.k8s.io/yaml v1.4.0 ) diff --git a/client/v2/go.sum b/client/v2/go.sum index eaeb024d2af1..3a5335621095 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -690,8 +690,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/collections/go.mod b/collections/go.mod index d82af96444c7..f5643d1d885d 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -11,6 +11,7 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/stretchr/testify v1.9.0 github.com/tidwall/btree v1.7.0 + google.golang.org/protobuf v1.35.2 pgregory.net/rapid v1.1.0 ) @@ -19,7 +20,5 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - diff --git a/go.mod b/go.mod index c7f990f403a3..3c56938a3733 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,6 @@ -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 module github.com/cosmos/cosmos-sdk @@ -58,7 +60,7 @@ require ( golang.org/x/sync v0.9.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 sigs.k8s.io/yaml v1.4.0 diff --git a/go.sum b/go.sum index 7e3b45320ad9..85e326ba1572 100644 --- a/go.sum +++ b/go.sum @@ -671,8 +671,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/schema/decoding/sync.go b/schema/decoding/sync.go index 68690b5716c9..2f19a904ebb6 100644 --- a/schema/decoding/sync.go +++ b/schema/decoding/sync.go @@ -1,6 +1,8 @@ package decoding import ( + "fmt" + "cosmossdk.io/schema" "cosmossdk.io/schema/appdata" ) @@ -28,6 +30,7 @@ func Sync(listener appdata.Listener, source SyncSource, resolver DecoderResolver } return resolver.AllDecoders(func(moduleName string, cdc schema.ModuleCodec) error { + fmt.Println("Syncing module", moduleName) if opts.ModuleFilter != nil && !opts.ModuleFilter(moduleName) { // ignore this module return nil diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index dc67fb063260..5f952e6a7604 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/server/v2/cometbft -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 replace ( cosmossdk.io/api => ../../../api @@ -37,7 +39,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 sigs.k8s.io/yaml v1.4.0 ) diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 299ed8257f76..571e7e81a979 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -680,8 +680,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/simapp/go.mod b/simapp/go.mod index 6a680dc76ebc..2e97f18c7901 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/simapp -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -47,7 +49,7 @@ require ( github.com/stretchr/testify v1.9.0 go.uber.org/mock v0.5.0 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require github.com/jackc/pgx/v5 v5.7.1 @@ -253,7 +255,6 @@ 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 @@ -282,12 +283,12 @@ replace ( // Below are the long-lived replace of the SimApp replace ( + cosmossdk.io/indexer/postgres => ../indexer/postgres + cosmossdk.io/schema => ../schema // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk github.com/cosmos/cosmos-sdk => ../. - cosmossdk.io/schema => ../schema - cosmossdk.io/indexer/postgres => ../indexer/postgres // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.1 diff --git a/simapp/go.sum b/simapp/go.sum index a56253768474..b399ec80b2a8 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -204,9 +204,6 @@ cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g= cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI= 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= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -1419,8 +1416,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 0a4d37094bb8..8b115c35a58d 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/simapp/v2 -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -39,7 +41,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index ecbd317c4ee5..cb5a9dcc606e 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -1412,8 +1412,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tests/go.mod b/tests/go.mod index 60b2cdc972ec..7ec4f5b1cd8f 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,6 +1,8 @@ module github.com/cosmos/cosmos-sdk/tests -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -26,7 +28,7 @@ require ( github.com/stretchr/testify v1.9.0 go.uber.org/mock v0.5.0 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gotest.tools/v3 v3.5.1 pgregory.net/rapid v1.1.0 ) diff --git a/tests/go.sum b/tests/go.sum index 7d1f3ac98125..40f06640f3cb 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -1410,8 +1410,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index 8ea1d1306447..10aed07c90be 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/accounts/defaults/base -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -13,7 +15,7 @@ require ( github.com/cosmos/gogoproto v1.7.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 1ec7e553b306..045d30728293 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/accounts/defaults/lockup -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/collections v0.4.0 @@ -146,7 +148,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/grpc v1.68.0 // indirect - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index ec99eb7013b7..a1a0846866d5 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -592,8 +592,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 90ebcbfd82bc..15a4dbad9b5f 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/accounts/defaults/multisig -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/collections v0.4.0 @@ -12,7 +14,7 @@ require ( github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 github.com/stretchr/testify v1.9.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 716f4d4dc053..a1c91d93160e 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/accounts -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -15,7 +17,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/authz/go.mod b/x/authz/go.mod index 4dfa69b0d29c..2e5f7d85286d 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/authz -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -23,7 +25,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/authz/go.sum b/x/authz/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/bank/go.mod b/x/bank/go.mod index 37bfdf2ce98f..c11ca8c1a28c 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/bank -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -153,7 +155,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect pgregory.net/rapid v1.1.0 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index e2054f5cd304..5e8b3175b61c 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/circuit -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -165,7 +167,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -179,6 +181,8 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/api => ../../api cosmossdk.io/store => ../../store + cosmossdk.io/schema => ../../schema + cosmossdk.io/collections => ../../collections cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking cosmossdk.io/x/tx => ../tx diff --git a/x/circuit/go.sum b/x/circuit/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/circuit/module.go b/x/circuit/module.go index 91645aaee6cc..da69333716bf 100644 --- a/x/circuit/module.go +++ b/x/circuit/module.go @@ -8,10 +8,12 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" appmodulev2 "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/registry" "cosmossdk.io/core/transaction" + "cosmossdk.io/schema" "cosmossdk.io/x/circuit/ante" "cosmossdk.io/x/circuit/keeper" "cosmossdk.io/x/circuit/types" @@ -117,3 +119,9 @@ func (am AppModule) TxValidator(ctx context.Context, tx transaction.Tx) error { validator := ante.NewCircuitBreakerDecorator(&am.keeper) return validator.ValidateTx(ctx, tx) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 3fb044b96901..b6759802d363 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/consensus -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -164,7 +166,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -176,6 +178,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking diff --git a/x/consensus/go.sum b/x/consensus/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 28f94270a38e..1b1b5ac49ed8 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -26,6 +26,7 @@ type Keeper struct { authority string ParamsStore collections.Item[cmtproto.ConsensusParams] + Schema collections.Schema } var _ exported.ConsensusParamSetter = Keeper{}.ParamsStore @@ -33,11 +34,20 @@ var _ exported.ConsensusParamSetter = Keeper{}.ParamsStore // NewKeeper creates a new Keeper instance. func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, authority string) Keeper { sb := collections.NewSchemaBuilder(env.KVStoreService) - return Keeper{ + k := Keeper{ Environment: env, authority: authority, ParamsStore: collections.NewItem(sb, collections.NewPrefix("Consensus"), "params", codec.CollValue[cmtproto.ConsensusParams](cdc)), } + + var err error + k.Schema, err = sb.Build() + + if err != nil { + panic(fmt.Sprintf("failed to build schema: %v", err)) + } + + return k } // GetAuthority returns the authority address for the consensus module. diff --git a/x/consensus/module.go b/x/consensus/module.go index 298a80bad428..7a21619980be 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -7,8 +7,10 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/registry" + "cosmossdk.io/schema" "cosmossdk.io/x/consensus/keeper" "cosmossdk.io/x/consensus/types" @@ -96,3 +98,9 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { // ConsensusVersion implements HasConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 5ad5cce08e9a..2f3a8df369c9 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/distribution -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -165,7 +167,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index a44285055dd4..18dfb5b261c7 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -104,7 +104,12 @@ func NewKeeper( sb, types.DelegatorStartingInfoPrefix, "delegators_starting_info", - collections.PairKeyCodec(sdk.ValAddressKey, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + collections.NamedPairKeyCodec( + "validator_address", + sdk.ValAddressKey, + "delegator_address", + sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), + ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility codec.CollValue[types.DelegatorStartingInfo](cdc), ), ValidatorsAccumulatedCommission: collections.NewMap( @@ -126,14 +131,26 @@ func NewKeeper( sb, types.ValidatorHistoricalRewardsPrefix, "validator_historical_rewards", - collections.PairKeyCodec(sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), sdk.LEUint64Key), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + collections.NamedPairKeyCodec( + "validator_address", + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + "period", + sdk.LEUint64Key, + ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility codec.CollValue[types.ValidatorHistoricalRewards](cdc), ), ValidatorSlashEvents: collections.NewMap( sb, types.ValidatorSlashEventPrefix, "validator_slash_events", - collections.TripleKeyCodec(sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), collections.Uint64Key, collections.Uint64Key), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + collections.NamedTripleKeyCodec( + "validator_address", + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + "height", + collections.Uint64Key, + "period", + collections.Uint64Key, + ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility codec.CollValue[types.ValidatorSlashEvent](cdc), ), } diff --git a/x/distribution/module.go b/x/distribution/module.go index eb7de978c6d1..ae1ae85e82c9 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -9,8 +9,10 @@ import ( "github.com/spf13/cobra" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/registry" + "cosmossdk.io/schema" "cosmossdk.io/x/distribution/client/cli" "cosmossdk.io/x/distribution/keeper" "cosmossdk.io/x/distribution/simulation" @@ -182,3 +184,9 @@ func (am AppModule) WeightedOperationsX(weights simsx.WeightSource, reg simsx.Re reg.Add(weights.Get("msg_withdraw_delegation_reward", 50), simulation.MsgWithdrawDelegatorRewardFactory(am.keeper, am.stakingKeeper)) reg.Add(weights.Get("msg_withdraw_validator_commission", 50), simulation.MsgWithdrawValidatorCommissionFactory(am.keeper, am.stakingKeeper)) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} diff --git a/x/epochs/go.mod b/x/epochs/go.mod index 2e4c6e9f82ab..6f4f1e7bb150 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/epochs -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -156,7 +158,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect @@ -181,6 +183,8 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections + cosmossdk.io/schema => ../../schema cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking diff --git a/x/epochs/go.sum b/x/epochs/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/epochs/module.go b/x/epochs/module.go index 2fba7c0de141..aeb7947b4ec1 100644 --- a/x/epochs/module.go +++ b/x/epochs/module.go @@ -8,8 +8,10 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/registry" + "cosmossdk.io/schema" "cosmossdk.io/x/epochs/keeper" "cosmossdk.io/x/epochs/simulation" "cosmossdk.io/x/epochs/types" @@ -125,3 +127,9 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[types.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(am.keeper.Schema) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 2b280d0707bd..2671a259fb16 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/evidence -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -21,7 +23,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/evidence/go.sum b/x/evidence/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index f0de3ae94d2e..b04dea716253 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/feegrant -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -24,7 +26,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gotest.tools/v3 v3.5.1 ) diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 2e8b78985122..4d352fe37728 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -688,8 +688,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/gov/go.mod b/x/gov/go.mod index 97ea2acff001..b850488b9a64 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/gov -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -29,7 +31,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/gov/go.sum b/x/gov/go.sum index e8ea170d71b6..5a1af85bce6b 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -686,8 +686,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/group/go.mod b/x/group/go.mod index f07af8eb867b..be8984f3c1a1 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/group -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -30,7 +32,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 pgregory.net/rapid v1.1.0 ) diff --git a/x/group/go.sum b/x/group/go.sum index 0bb7c6c4278d..e29c3f0297a4 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -688,8 +688,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/mint/go.mod b/x/mint/go.mod index 8f3007b062da..076c7084d066 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/mint -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -156,7 +158,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect pgregory.net/rapid v1.1.0 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/nft/go.mod b/x/nft/go.mod index 5a30611d6eaa..7db8897ffaa9 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/nft -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -165,7 +167,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/params/go.mod b/x/params/go.mod index 6a177350ec6c..c0a43a156031 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/params -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -157,7 +159,7 @@ require ( golang.org/x/tools v0.22.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index 1315daba45c0..30b242e0f7b2 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -651,8 +651,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index e4d57da53da6..38782f38016f 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/protocolpool -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -20,7 +22,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index ba31726f4f64..f03945e4dbac 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -678,8 +678,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 9f0be32344c0..a6c538cd8d33 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/slashing -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -22,7 +24,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 gotest.tools/v3 v3.5.1 ) diff --git a/x/slashing/go.sum b/x/slashing/go.sum index ce8dfa791869..413174ba9c6f 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -680,8 +680,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/staking/go.mod b/x/staking/go.mod index 4ab3db054143..24325c397a8e 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/staking -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -25,7 +27,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( @@ -161,8 +163,9 @@ require ( go.opencensus.io v0.24.0 // indirect ) +require cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 + require ( - cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect github.com/bytedance/sonic v1.12.4 // indirect github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 315102153bd4..ce3611aa50c2 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -676,8 +676,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 02f99edc3a19..02e4a6ef946d 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -1,6 +1,8 @@ module cosmossdk.io/x/upgrade -go 1.23.1 +go 1.23.2 + +toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 @@ -28,7 +30,7 @@ require ( go.uber.org/mock v0.5.0 google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 google.golang.org/grpc v1.68.0 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.35.2 ) require ( diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index bc467fefa083..e1378fe2b67b 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -1399,8 +1399,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 748bac9c5775bae779b060c1d8487d50e87c2e76 Mon Sep 17 00:00:00 2001 From: Facundo Date: Fri, 22 Nov 2024 16:00:43 +0100 Subject: [PATCH 11/26] added mint --- x/mint/go.mod | 2 ++ x/mint/module.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/x/mint/go.mod b/x/mint/go.mod index 076c7084d066..90962e0cfc29 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -184,6 +184,8 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections + cosmossdk.io/schema => ../../schema cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/consensus => ../consensus diff --git a/x/mint/module.go b/x/mint/module.go index 52c6324b4a11..fa572bdbc90d 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -8,8 +8,10 @@ import ( gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc" + "cosmossdk.io/collections" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/registry" + "cosmossdk.io/schema" "cosmossdk.io/x/mint/keeper" "cosmossdk.io/x/mint/simulation" "cosmossdk.io/x/mint/types" @@ -165,3 +167,9 @@ func (AppModule) ProposalMsgsX(weights simsx.WeightSource, reg simsx.Registry) { func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[types.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(am.keeper.Schema) } + +// ModuleCodec implements schema.HasModuleCodec. +// It allows the indexer to decode the module's KVPairUpdate. +func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) { + return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{}) +} From 3cd02777ab83a50ea2ff294b04df2dc2fc9da070 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 25 Nov 2024 10:59:45 +0100 Subject: [PATCH 12/26] handle nil schematype --- collections/codec/indexing.go | 4 +--- collections/indexing.go | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/collections/codec/indexing.go b/collections/codec/indexing.go index e9cdf327945a..01f3740bd588 100644 --- a/collections/codec/indexing.go +++ b/collections/codec/indexing.go @@ -77,9 +77,7 @@ func FallbackSchemaCodec[T any]() SchemaCodec[T] { Kind: kind, }}, // these can be nil because T maps directly to a schema value for this kind - ToSchemaType: func(t T) (any, error) { - return t, nil - }, + ToSchemaType: nil, FromSchemaType: nil, } } else { diff --git a/collections/indexing.go b/collections/indexing.go index 25acd3f5385f..8a482c39810f 100644 --- a/collections/indexing.go +++ b/collections/indexing.go @@ -190,6 +190,11 @@ func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) { if err != nil { return nil, err } + + if valueDecoder.ToSchemaType == nil { + return x, nil + } + return valueDecoder.ToSchemaType(x) } ensureFieldNames(c.m.vc, "value", res.objectType.ValueFields) From 4b3b800d2457f679597ceef6aa01499d370e2cf3 Mon Sep 17 00:00:00 2001 From: Facundo Date: Mon, 25 Nov 2024 11:27:21 +0100 Subject: [PATCH 13/26] remove print --- schema/decoding/sync.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/schema/decoding/sync.go b/schema/decoding/sync.go index 2f19a904ebb6..68690b5716c9 100644 --- a/schema/decoding/sync.go +++ b/schema/decoding/sync.go @@ -1,8 +1,6 @@ package decoding import ( - "fmt" - "cosmossdk.io/schema" "cosmossdk.io/schema/appdata" ) @@ -30,7 +28,6 @@ func Sync(listener appdata.Listener, source SyncSource, resolver DecoderResolver } return resolver.AllDecoders(func(moduleName string, cdc schema.ModuleCodec) error { - fmt.Println("Syncing module", moduleName) if opts.ModuleFilter != nil && !opts.ModuleFilter(moduleName) { // ignore this module return nil From ebd73977c5d129d5728405b6faaefc25e356b212 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 10:51:05 +0100 Subject: [PATCH 14/26] return errors instead of os.Exit --- baseapp/abci.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 957511c73bd7..05eb2abbc307 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "os" "sort" "strconv" "strings" @@ -904,10 +903,11 @@ func (app *BaseApp) FinalizeBlock(req *abci.FinalizeBlockRequest) (res *abci.Fin defer func() { // call the streaming service hooks with the FinalizeBlock messages for _, streamingListener := range app.streamingManager.ABCIListeners { - if err := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.Context(), *req, *res); err != nil { + if streamErr := streamingListener.ListenFinalizeBlock(app.finalizeBlockState.Context(), *req, *res); streamErr != nil { app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) if app.streamingManager.StopNodeOnErr { - os.Exit(1) + // if StopNodeOnErr is set, we should return the streamErr in order to stop the node + err = streamErr } } } @@ -994,7 +994,7 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { if err := abciListener.ListenCommit(ctx, *resp, changeSet); err != nil { app.logger.Error("Commit listening hook failed", "height", blockHeight, "err", err) if app.streamingManager.StopNodeOnErr { - os.Exit(1) + return nil, err } } } From 5196e56c2af85703c1719dba3d1a4188146d2044 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 10:55:49 +0100 Subject: [PATCH 15/26] remove toolchain updates --- client/v2/go.mod | 2 -- collections/go.mod | 2 -- go.mod | 2 -- server/v2/cometbft/go.mod | 2 -- simapp/go.mod | 2 -- simapp/v2/go.mod | 2 -- tests/go.mod | 2 -- x/accounts/defaults/base/go.mod | 2 -- x/accounts/defaults/lockup/go.mod | 2 -- x/accounts/defaults/multisig/go.mod | 2 -- x/accounts/go.mod | 2 -- x/authz/go.mod | 2 -- x/bank/go.mod | 2 -- x/circuit/go.mod | 2 -- x/consensus/go.mod | 2 -- x/distribution/go.mod | 2 -- x/epochs/go.mod | 2 -- x/evidence/go.mod | 2 -- x/feegrant/go.mod | 2 -- x/gov/go.mod | 2 -- x/group/go.mod | 2 -- x/mint/go.mod | 2 -- x/nft/go.mod | 2 -- x/params/go.mod | 2 -- x/protocolpool/go.mod | 1 - x/slashing/go.mod | 1 - x/staking/go.mod | 2 -- x/upgrade/go.mod | 1 - 28 files changed, 53 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index d37eeff070ab..6379eb9e642a 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/client/v2 go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/collections/go.mod b/collections/go.mod index 31a9ace6d487..9ea5cd3f6acf 100644 --- a/collections/go.mod +++ b/collections/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/collections go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/core v1.0.0-alpha.6 cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 diff --git a/go.mod b/go.mod index 3a95c45447e2..54a9677f063c 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,5 @@ go 1.23.2 -toolchain go1.23.3 - module github.com/cosmos/cosmos-sdk require ( diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index a0d28fec715e..a838b1a1cc9e 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/server/v2/cometbft go 1.23.2 -toolchain go1.23.3 - replace ( cosmossdk.io/api => ../../../api cosmossdk.io/core/testing => ../../../core/testing diff --git a/simapp/go.mod b/simapp/go.mod index 8edbb8dd9f9d..922a0d952eef 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/simapp go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index d6f531cbe56f..e56c57cabe52 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/simapp/v2 go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/client/v2 v2.0.0-00010101000000-000000000000 diff --git a/tests/go.mod b/tests/go.mod index ec1d80a37c43..86fc8c587b71 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -2,8 +2,6 @@ module github.com/cosmos/cosmos-sdk/tests go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.1-0.20241104084251-838f1557af0a diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index 2ba8e733110a..090be6161b4c 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/accounts/defaults/base go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 951b477bd5ff..9c0c80ca3821 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/accounts/defaults/lockup go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/collections v0.4.0 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 1dc94e4f0b9b..9caeb51b97fb 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/accounts/defaults/multisig go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/collections v0.4.0 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/accounts/go.mod b/x/accounts/go.mod index cbbd78574d60..672fa514b1e5 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/accounts go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/authz/go.mod b/x/authz/go.mod index 85de6a3a2fb0..e42df0329a1c 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/authz go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/bank/go.mod b/x/bank/go.mod index e40f333c0e27..1d6ac3f57f00 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/bank go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 11af55be1057..8d781613f49d 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/circuit go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 89e4e26c019b..c6ec92524617 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/consensus go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/distribution/go.mod b/x/distribution/go.mod index d42a0ad06003..4ad2cb7f4a3d 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/distribution go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/epochs/go.mod b/x/epochs/go.mod index c22c56095295..c084e04da1c9 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/epochs go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 195994dccc5f..1eef10051307 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/evidence go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index e6dd7dcd2ae6..acc857daf621 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/feegrant go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/gov/go.mod b/x/gov/go.mod index 49272b6015f7..23c29648a247 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/gov go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/group/go.mod b/x/group/go.mod index 85fcb3d90114..d0e1c284dbb3 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/group go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/mint/go.mod b/x/mint/go.mod index 1829415e6700..a78c2c74201a 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/mint go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/nft/go.mod b/x/nft/go.mod index 24ae6e45bcda..5994d4f4327c 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/nft go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/params/go.mod b/x/params/go.mod index 3cdb8a746e0f..ff5fe159d4e8 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/params go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/core v1.0.0-alpha.6 diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 202fffb59554..af7d2b4597c5 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -2,7 +2,6 @@ module cosmossdk.io/x/protocolpool go 1.23.2 -toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 17d4ca5ac046..75c77998c47e 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -2,7 +2,6 @@ module cosmossdk.io/x/slashing go 1.23.2 -toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/staking/go.mod b/x/staking/go.mod index baf69cb0ba6e..4f626e1fc01d 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -2,8 +2,6 @@ module cosmossdk.io/x/staking go 1.23.2 -toolchain go1.23.3 - require ( cosmossdk.io/api v0.7.6 cosmossdk.io/collections v0.4.0 diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 149f26c90d2c..26864bb44251 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -2,7 +2,6 @@ module cosmossdk.io/x/upgrade go 1.23.2 -toolchain go1.23.3 require ( cosmossdk.io/api v0.7.6 From 6ed03b52023c04211c0b189a69435d025f974af2 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 11:03:53 +0100 Subject: [PATCH 16/26] add cl --- collections/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/collections/CHANGELOG.md b/collections/CHANGELOG.md index d0da0dcfa533..3e42eaf64760 100644 --- a/collections/CHANGELOG.md +++ b/collections/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#21090](https://github.com/cosmos/cosmos-sdk/pull/21090) Introduces `Quad`, a composite key with four keys. * [#20704](https://github.com/cosmos/cosmos-sdk/pull/20704) Add `ModuleCodec` method to `Schema` and `HasSchemaCodec` interface in order to support `cosmossdk.io/schema` compatible indexing. * [#20538](https://github.com/cosmos/cosmos-sdk/pull/20538) Add `Nameable` variations to `KeyCodec` and `ValueCodec` to allow for better indexing of `collections` types. +* [#22544](https://github.com/cosmos/cosmos-sdk/pull/22544) Schema's `ModuleCodec` will now also return Enum descriptors to be registered with the indexer. ## [v0.4.0](https://github.com/cosmos/cosmos-sdk/releases/tag/collections%2Fv0.4.0) From 6c039304a249953e704d3084108d9690918fb81e Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 11:10:02 +0100 Subject: [PATCH 17/26] lint fix --- codec/collections.go | 7 ++----- math/legacy_dec_test.go | 8 ++++---- store/cachekv/branch_bench_test.go | 1 - x/consensus/keeper/keeper.go | 1 - x/distribution/keeper/keeper.go | 8 ++++---- x/staking/keeper/keeper.go | 4 ++-- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/codec/collections.go b/codec/collections.go index a0438645f693..3694558ad5c3 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -214,7 +214,7 @@ func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { // we might want to change this to include the entire object as separate fields bz, err := c.cdc.MarshalJSON(msg) if err != nil { - return nil, fmt.Errorf("error marshalling message: %w", err) + return nil, fmt.Errorf("error marshaling message: %w", err) } values = append(values, json.RawMessage(bz)) @@ -328,9 +328,7 @@ func (c collInterfaceValue[T]) ValueType() string { // SchemaCodec returns a schema codec, which will always have a single JSON field // as there is no way to know in advance the necessary fields for an interface. func (c collInterfaceValue[T]) SchemaCodec() (collcodec.SchemaCodec[T], error) { - var ( - pt T - ) + var pt T kind := schema.KindForGoValue(pt) if err := kind.Validate(); err == nil { @@ -363,7 +361,6 @@ func (c collInterfaceValue[T]) SchemaCodec() (collcodec.SchemaCodec[T], error) { }, }, nil } - } func protoCols(desc protoreflect.MessageDescriptor) []schema.Field { diff --git a/math/legacy_dec_test.go b/math/legacy_dec_test.go index 66a971186cff..4f3897a0867e 100644 --- a/math/legacy_dec_test.go +++ b/math/legacy_dec_test.go @@ -632,10 +632,10 @@ func BenchmarkMarshalTo(b *testing.B) { }{ { math.LegacyNewDec(1e8), []byte{ - 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, - }, + 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, + }, }, {math.LegacyNewDec(0), []byte{0x30}}, } diff --git a/store/cachekv/branch_bench_test.go b/store/cachekv/branch_bench_test.go index 6cb393aa9b43..0001d416585c 100644 --- a/store/cachekv/branch_bench_test.go +++ b/store/cachekv/branch_bench_test.go @@ -74,7 +74,6 @@ func Benchmark_GetSparse(b *testing.B) { var keySink, valueSink any func Benchmark_Iterate(b *testing.B) { - for _, stackSize := range stackSizes { b.Run(fmt.Sprintf("StackSize%d", stackSize), func(b *testing.B) { bs := makeBranchStack(b, stackSize) diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 1b1b5ac49ed8..53858707f9fe 100644 --- a/x/consensus/keeper/keeper.go +++ b/x/consensus/keeper/keeper.go @@ -42,7 +42,6 @@ func NewKeeper(cdc codec.BinaryCodec, env appmodule.Environment, authority strin var err error k.Schema, err = sb.Build() - if err != nil { panic(fmt.Sprintf("failed to build schema: %v", err)) } diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 18dfb5b261c7..9a8223a83c45 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -108,8 +108,8 @@ func NewKeeper( "validator_address", sdk.ValAddressKey, "delegator_address", - sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), - ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + ), codec.CollValue[types.DelegatorStartingInfo](cdc), ), ValidatorsAccumulatedCommission: collections.NewMap( @@ -136,7 +136,7 @@ func NewKeeper( sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), "period", sdk.LEUint64Key, - ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + ), codec.CollValue[types.ValidatorHistoricalRewards](cdc), ), ValidatorSlashEvents: collections.NewMap( @@ -150,7 +150,7 @@ func NewKeeper( collections.Uint64Key, "period", collections.Uint64Key, - ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + ), codec.CollValue[types.ValidatorSlashEvent](cdc), ), } diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index eebc01c00008..876c9ae97df3 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -172,10 +172,10 @@ func NewKeeper( "delegations_by_validator", collections.NamedPairKeyCodec( "validator_address", - sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility "delegator", sdk.AccAddressKey, - ), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + ), collections.BytesValue, ), UnbondingID: collections.NewSequence(sb, types.UnbondingIDKey, "unbonding_id"), From f4a3aa01150626482d554ca385d30a47dd60bcb6 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 11:12:31 +0100 Subject: [PATCH 18/26] fix tests --- schema/field_test.go | 2 +- schema/state_object_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/field_test.go b/schema/field_test.go index 0756f5a7ca86..1fa6413b790c 100644 --- a/schema/field_test.go +++ b/schema/field_test.go @@ -27,7 +27,7 @@ func TestField_Validate(t *testing.T) { Name: "", Kind: StringKind, }, - errContains: "invalid field name", + errContains: "name cannot be empty, might be missing the named key codec", }, { name: "invalid kind", diff --git a/schema/state_object_test.go b/schema/state_object_test.go index 407586dd76e2..03bb402adf46 100644 --- a/schema/state_object_test.go +++ b/schema/state_object_test.go @@ -93,7 +93,7 @@ func TestObjectType_Validate(t *testing.T) { }, }, }, - errContains: "invalid field name", + errContains: "field name cannot be empty, might be missing the named key codec", }, { name: "invalid value field", @@ -105,7 +105,7 @@ func TestObjectType_Validate(t *testing.T) { }, }, }, - errContains: "invalid field name", + errContains: "field name cannot be empty, might be missing the named key codec", }, { name: "no fields", @@ -146,7 +146,7 @@ func TestObjectType_Validate(t *testing.T) { }, }, }, - errContains: "duplicate field name", + errContains: "duplicate key field name \"field1\" for stateObjectType: object1", }, { name: "nullable key field", From 5bb37a31c85f9071fe90865729403c096267cc05 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 11:32:24 +0100 Subject: [PATCH 19/26] fixing stuff --- x/evidence/go.mod | 1 + x/nft/go.mod | 1 + x/protocolpool/go.mod | 1 + 3 files changed, 3 insertions(+) diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 1eef10051307..af036156f329 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking diff --git a/x/nft/go.mod b/x/nft/go.mod index 5994d4f4327c..bc33d20e3270 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index af7d2b4597c5..8f77f4d79667 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -178,6 +178,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking From de642e1a7af91c718355846200fcb97455ae9ae7 Mon Sep 17 00:00:00 2001 From: Facundo Date: Tue, 26 Nov 2024 11:44:42 +0100 Subject: [PATCH 20/26] fix more tests --- server/v2/cometbft/go.mod | 1 + x/slashing/go.mod | 1 + x/upgrade/go.mod | 1 + 3 files changed, 3 insertions(+) diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index a838b1a1cc9e..f1baa8038d49 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -4,6 +4,7 @@ go 1.23.2 replace ( cosmossdk.io/api => ../../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/core/testing => ../../../core/testing cosmossdk.io/server/v2 => ../ cosmossdk.io/server/v2/appmanager => ../appmanager diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 75c77998c47e..7be94a559bca 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -179,6 +179,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/staking => ../staking diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 26864bb44251..77a78052fb7d 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -209,6 +209,7 @@ replace github.com/cosmos/cosmos-sdk => ../../. replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/gov => ../gov From 668838ff26e25594c7345ed3fcda591d32e6ffc3 Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 27 Nov 2024 11:21:06 +0100 Subject: [PATCH 21/26] rollback instead --- baseapp/abci.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 05eb2abbc307..3929aeffe990 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -971,6 +971,8 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { header := app.finalizeBlockState.Context().BlockHeader() retainHeight := app.GetBlockRetentionHeight(header.Height) + fmt.Println("Commit", header.Height) + if app.precommiter != nil { app.precommiter(app.finalizeBlockState.Context()) } @@ -984,6 +986,8 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { RetainHeight: retainHeight, } + app.cms.Commit() + abciListeners := app.streamingManager.ABCIListeners if len(abciListeners) > 0 { ctx := app.finalizeBlockState.Context() @@ -994,16 +998,16 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { if err := abciListener.ListenCommit(ctx, *resp, changeSet); err != nil { app.logger.Error("Commit listening hook failed", "height", blockHeight, "err", err) if app.streamingManager.StopNodeOnErr { + rollbackErr := app.cms.RollbackToVersion(blockHeight - 1) + if rollbackErr != nil { + return nil, rollbackErr + } return nil, err } } } } - // Commit after all listeners have been called, in case they error and we - // need to stop before committing. - app.cms.Commit() - // Reset the CheckTx state to the latest committed. // // NOTE: This is safe because CometBFT holds a lock on the mempool for From f3cd58f394522fb0edb1cf2137dbb7254dd86552 Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 27 Nov 2024 12:11:43 +0100 Subject: [PATCH 22/26] fix more stuff --- baseapp/abci.go | 2 -- indexer/postgres/tests/testdata/init_schema.txt | 6 +++--- .../tests/testdata/init_schema_no_retain_delete.txt | 6 +++--- server/v2/cometbft/go.mod | 2 +- x/params/go.mod | 1 + 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 3929aeffe990..7897f5a60882 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -971,8 +971,6 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { header := app.finalizeBlockState.Context().BlockHeader() retainHeight := app.GetBlockRetentionHeight(header.Height) - fmt.Println("Commit", header.Height) - if app.precommiter != nil { app.precommiter(app.finalizeBlockState.Context()) } diff --git a/indexer/postgres/tests/testdata/init_schema.txt b/indexer/postgres/tests/testdata/init_schema.txt index 43b91a6a7a83..d188c41c9264 100644 --- a/indexer/postgres/tests/testdata/init_schema.txt +++ b/indexer/postgres/tests/testdata/init_schema.txt @@ -6,7 +6,7 @@ DEBUG: Creating enum type sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); DEBUG: Creating enum type sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); -DEBUG: Creating table %s +DEBUG: Creating table table: test_all_kinds sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" ( "id" BIGINT NOT NULL, @@ -36,7 +36,7 @@ DEBUG: Creating table %s PRIMARY KEY ("id", "ts_nanos") ); GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC; -DEBUG: Creating table %s +DEBUG: Creating table table: test_singleton sql: CREATE TABLE IF NOT EXISTS "test_singleton" ( _id INTEGER NOT NULL CHECK (_id = 1), @@ -46,7 +46,7 @@ DEBUG: Creating table %s PRIMARY KEY (_id) ); GRANT SELECT ON TABLE "test_singleton" TO PUBLIC; -DEBUG: Creating table %s +DEBUG: Creating table table: test_vote sql: CREATE TABLE IF NOT EXISTS "test_vote" ( "proposal" BIGINT NOT NULL, diff --git a/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt b/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt index 71dfd4d08290..a1adcb0c0c25 100644 --- a/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt +++ b/indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt @@ -6,7 +6,7 @@ DEBUG: Creating enum type sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c'); DEBUG: Creating enum type sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain'); -DEBUG: Creating table %s +DEBUG: Creating table table: test_all_kinds sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" ( "id" BIGINT NOT NULL, @@ -36,7 +36,7 @@ DEBUG: Creating table %s PRIMARY KEY ("id", "ts_nanos") ); GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC; -DEBUG: Creating table %s +DEBUG: Creating table table: test_singleton sql: CREATE TABLE IF NOT EXISTS "test_singleton" ( _id INTEGER NOT NULL CHECK (_id = 1), @@ -46,7 +46,7 @@ DEBUG: Creating table %s PRIMARY KEY (_id) ); GRANT SELECT ON TABLE "test_singleton" TO PUBLIC; -DEBUG: Creating table %s +DEBUG: Creating table table: test_vote sql: CREATE TABLE IF NOT EXISTS "test_vote" ( "proposal" BIGINT NOT NULL, diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index f1baa8038d49..c3f9a70d3903 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -4,7 +4,7 @@ go 1.23.2 replace ( cosmossdk.io/api => ../../../api - cosmossdk.io/collections => ../../collections + cosmossdk.io/collections => ../../../collections cosmossdk.io/core/testing => ../../../core/testing cosmossdk.io/server/v2 => ../ cosmossdk.io/server/v2/appmanager => ../appmanager diff --git a/x/params/go.mod b/x/params/go.mod index ff5fe159d4e8..c40157302f57 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -169,6 +169,7 @@ replace github.com/cosmos/cosmos-sdk => ../.. // TODO remove post spinning out all modules replace ( cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections cosmossdk.io/store => ../../store cosmossdk.io/x/bank => ../bank cosmossdk.io/x/distribution => ../distribution From 91674b18f360ec9b1f8a3ac1d09fa7ac13ad0dcb Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 27 Nov 2024 14:42:30 +0100 Subject: [PATCH 23/26] lint --- tests/integration/v2/auth/app_test.go | 3 ++- tests/integration/v2/services.go | 3 +-- x/distribution/keeper/keeper.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/v2/auth/app_test.go b/tests/integration/v2/auth/app_test.go index 01aba394c808..5c3c5a7e95cf 100644 --- a/tests/integration/v2/auth/app_test.go +++ b/tests/integration/v2/auth/app_test.go @@ -4,6 +4,8 @@ import ( "context" "testing" + "github.com/stretchr/testify/require" + "cosmossdk.io/core/router" "cosmossdk.io/core/transaction" "cosmossdk.io/depinject" @@ -26,7 +28,6 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring`` _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring _ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring - "github.com/stretchr/testify/require" ) type suite struct { diff --git a/tests/integration/v2/services.go b/tests/integration/v2/services.go index 56dbf63341e5..8cffbc0445ee 100644 --- a/tests/integration/v2/services.go +++ b/tests/integration/v2/services.go @@ -128,8 +128,7 @@ func (e *eventManager) EmitKV(eventType string, attrs ...event.Attribute) error var _ branch.Service = &BranchService{} // custom branch service for integration tests -type BranchService struct { -} +type BranchService struct{} func (bs *BranchService) Execute(ctx context.Context, f func(ctx context.Context) error) error { _, ok := ctx.Value(contextKey).(*integrationContext) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 9a8223a83c45..2df55c435ca2 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -133,7 +133,7 @@ func NewKeeper( "validator_historical_rewards", collections.NamedPairKeyCodec( "validator_address", - sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility "period", sdk.LEUint64Key, ), @@ -145,7 +145,7 @@ func NewKeeper( "validator_slash_events", collections.NamedTripleKeyCodec( "validator_address", - sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), + sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility "height", collections.Uint64Key, "period", From 228ffb5a11a42909b2f7805dff5db31efb49f91f Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 27 Nov 2024 15:01:43 +0100 Subject: [PATCH 24/26] rollback some go mod changes --- client/v2/go.mod | 2 +- x/accounts/defaults/base/go.mod | 2 +- x/accounts/defaults/lockup/go.mod | 2 +- x/accounts/defaults/multisig/go.mod | 2 +- x/accounts/go.mod | 2 +- x/authz/go.mod | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index a01fa4fa99af..4ba6d7b479ed 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/client/v2 -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/api v0.7.6 diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index b80e1751cf21..e15b033d6aa5 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/base -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/api v0.7.6 diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index e20194e08ee8..d61421cb0d4c 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/lockup -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/collections v0.4.0 diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index f8ff9a4c6462..6a75ddea9db3 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/multisig -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/collections v0.4.0 diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 6522735e461e..acdfdc692317 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/api v0.7.6 diff --git a/x/authz/go.mod b/x/authz/go.mod index 7f394a42e1b3..6b5471cda55a 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/authz -go 1.23.2 +go 1.23.1 require ( cosmossdk.io/api v0.7.6 From e320f48cf7490899b5e6faf28ddda2d50763bd5b Mon Sep 17 00:00:00 2001 From: Facundo Date: Wed, 27 Nov 2024 15:14:25 +0100 Subject: [PATCH 25/26] go mod --- client/v2/go.mod | 2 +- server/v2/cometbft/go.sum | 2 -- simapp/go.mod | 2 +- simapp/v2/go.mod | 2 +- tests/go.mod | 2 +- x/accounts/defaults/base/go.mod | 2 +- x/accounts/defaults/lockup/go.mod | 2 +- x/accounts/defaults/multisig/go.mod | 2 +- x/accounts/go.mod | 2 +- x/authz/go.mod | 2 +- x/evidence/go.sum | 2 -- x/feegrant/go.mod | 2 +- x/gov/go.mod | 2 +- x/group/go.mod | 2 +- x/nft/go.sum | 2 -- x/params/go.mod | 2 +- x/params/go.sum | 2 -- x/protocolpool/go.mod | 3 +-- x/protocolpool/go.sum | 2 -- x/slashing/go.mod | 3 +-- x/slashing/go.sum | 2 -- x/upgrade/go.mod | 3 +-- x/upgrade/go.sum | 2 -- 23 files changed, 16 insertions(+), 33 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index 4ba6d7b479ed..639fcf32666a 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/client/v2 -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 173298ead2e9..dd420b5e2a62 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= diff --git a/simapp/go.mod b/simapp/go.mod index 533cb2960d65..7de23fba36bf 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/simapp -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 63fd9e07aa8d..83eb8b79cf78 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/simapp/v2 -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/tests/go.mod b/tests/go.mod index a72819774b86..0f64c06e6a15 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,6 +1,6 @@ module github.com/cosmos/cosmos-sdk/tests -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index e15b033d6aa5..c4a10bf35e4f 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/base -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index d61421cb0d4c..4f715b86ccdb 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/lockup -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/collections v0.4.0 diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 6a75ddea9db3..e6de34cee263 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts/defaults/multisig -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/collections v0.4.0 diff --git a/x/accounts/go.mod b/x/accounts/go.mod index acdfdc692317..3a64b6806dbe 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/accounts -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/authz/go.mod b/x/authz/go.mod index 6b5471cda55a..fd8811df9912 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/authz -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 42b2170efbf4..ff76711e650f 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 327f983c71fb..d938184417a2 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/feegrant -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/gov/go.mod b/x/gov/go.mod index 6f701abdeeb6..78d50b5c9759 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/gov -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/group/go.mod b/x/group/go.mod index 56cc2fe251a7..cbfa558f38df 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/group -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/nft/go.sum b/x/nft/go.sum index 42b2170efbf4..ff76711e650f 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= diff --git a/x/params/go.mod b/x/params/go.mod index 1aca30770a71..791a55d7949e 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/params -go 1.23.2 +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/params/go.sum b/x/params/go.sum index 31188c0bab68..aac0123354df 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 0356c17ce918..7ef25cc9449e 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -1,7 +1,6 @@ module cosmossdk.io/x/protocolpool -go 1.23.2 - +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 42b2170efbf4..ff76711e650f 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 8ba060de8258..f247839e8203 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -1,7 +1,6 @@ module cosmossdk.io/x/slashing -go 1.23.2 - +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 7ba2dc64cb49..462fbea83843 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 1d650cd2fe92..ce12fe12e451 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -1,7 +1,6 @@ module cosmossdk.io/x/upgrade -go 1.23.2 - +go 1.23.3 require ( cosmossdk.io/api v0.7.6 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 7a901fa02d2f..33caed9ce32c 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -192,8 +192,6 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= -cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E= cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY= cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs= From d94bde6ef1207c316057c9d680bf7615784d1e12 Mon Sep 17 00:00:00 2001 From: Facundo Date: Thu, 28 Nov 2024 10:32:00 +0100 Subject: [PATCH 26/26] suggestions from Julien --- baseapp/abci.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/baseapp/abci.go b/baseapp/abci.go index 7897f5a60882..d9921a8e13d5 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -996,9 +996,10 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { if err := abciListener.ListenCommit(ctx, *resp, changeSet); err != nil { app.logger.Error("Commit listening hook failed", "height", blockHeight, "err", err) if app.streamingManager.StopNodeOnErr { + err = fmt.Errorf("Commit listening hook failed: %w", err) rollbackErr := app.cms.RollbackToVersion(blockHeight - 1) if rollbackErr != nil { - return nil, rollbackErr + return nil, errors.Join(err, rollbackErr) } return nil, err }