diff --git a/baseapp/abci.go b/baseapp/abci.go index 979089c5c86d..d9921a8e13d5 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -903,8 +903,12 @@ 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 { + // if StopNodeOnErr is set, we should return the streamErr in order to stop the node + err = streamErr + } } } }() @@ -976,12 +980,12 @@ func (app *BaseApp) Commit() (*abci.CommitResponse, error) { rms.SetCommitHeader(header) } - app.cms.Commit() - resp := &abci.CommitResponse{ RetainHeight: retainHeight, } + app.cms.Commit() + abciListeners := app.streamingManager.ABCIListeners if len(abciListeners) > 0 { ctx := app.finalizeBlockState.Context() @@ -991,6 +995,14 @@ 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 { + err = fmt.Errorf("Commit listening hook failed: %w", err) + rollbackErr := app.cms.RollbackToVersion(blockHeight - 1) + if rollbackErr != nil { + return nil, errors.Join(err, rollbackErr) + } + return nil, err + } } } } diff --git a/client/v2/go.mod b/client/v2/go.mod index 1441cc286e44..6c8756c014a2 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.8.0 @@ -34,7 +34,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.5.0 diff --git a/client/v2/go.sum b/client/v2/go.sum index da9df57637d8..d9f46b6525d1 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/codec/collections.go b/codec/collections.go index 0137a989e790..3694558ad5c3 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -1,16 +1,23 @@ package codec import ( + "encoding/json" "fmt" "reflect" + "strings" "github.com/cosmos/gogoproto/proto" gogotypes "github.com/cosmos/gogoproto/types" "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" + "cosmossdk.io/schema" ) // BoolValue implements a ValueCodec that saves the bool value @@ -51,12 +58,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 +103,139 @@ func (c collValue[T, PT]) ValueType() string { return "github.com/cosmos/gogoproto/" + c.messageName } +func (c collValue[T, PT]) SchemaCodec() (collcodec.SchemaCodec[T], error) { + var ( + t T + pt PT + ) + msgName := proto.MessageName(pt) + desc, err := proto.HybridResolver.FindDescriptorByName(protoreflect.FullName(msgName)) + if err != nil { + return collcodec.SchemaCodec[T]{}, 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]{ + 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: schemaFields, + ToSchemaType: func(t T) (any, error) { + values := []interface{}{} + 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 + } + + 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 := 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) + + // if the field is a map or list, we need to convert it to a slice of values + if fieldDesc.IsList() { + 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: 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) + 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 marshaling 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) { + panic("not implemented") + }, + }, nil + } +} + type protoMessageV2[T any] interface { *T protov2.Message @@ -179,3 +324,101 @@ func (c collInterfaceValue[T]) ValueType() string { var t T 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()) + 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: + // TODO: support enums + 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() + 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/go.mod b/go.mod index bb0272aad4b7..cf1f03646f7d 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ -go 1.23.1 +go 1.23.2 module github.com/cosmos/cosmos-sdk require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/go.sum b/go.sum index 1a2d0132fc0f..9753dd2dc54e 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20241127063259-f296a5005ce8 h1:KCi0Wq5M0JST0I01HebEDHt7//tZMx2bW4tmlc4IRnI= cosmossdk.io/api v0.7.3-0.20241127063259-f296a5005ce8/go.mod h1:vZy0Ev95gwANXt5ssiDui4L5nlMYO5bzqR77hCjIz9s= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 6e1833cef155..d3b6c03dca98 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/server/v2/cometbft -go 1.23.1 +go 1.23.2 replace ( // pseudo version lower than the latest tag @@ -15,10 +15,11 @@ replace ( require ( cosmossdk.io/api v0.8.0 - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 cosmossdk.io/log v1.5.0 + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b //main cosmossdk.io/server/v2 v2.0.0-20241119134933-d697a3de0f95 // main cosmossdk.io/server/v2/appmanager v0.0.0-20241119134933-d697a3de0f95 // main cosmossdk.io/server/v2/stf v0.0.0-20241119134933-d697a3de0f95 // main @@ -43,7 +44,6 @@ require ( cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/math v1.4.0 // indirect - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 3a9598890364..b38893cb1d08 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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/simapp/go.mod b/simapp/go.mod index f1223dc539f1..325a17d264f3 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -1,15 +1,15 @@ module cosmossdk.io/simapp -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e // main cosmossdk.io/depinject v1.1.0 - cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee + cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b // main cosmossdk.io/log v1.5.0 cosmossdk.io/math v1.4.0 cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 // main @@ -38,9 +38,10 @@ require ( github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9 github.com/cometbft/cometbft/api v1.0.0-rc2 // this version is not used as it is always replaced by the latest Cosmos SDK version - github.com/cosmos/cosmos-sdk v0.52.0 + github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 github.com/golang/mock v1.6.0 + github.com/jackc/pgx/v5 v5.7.1 github.com/spf13/cast v1.7.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 @@ -50,8 +51,6 @@ require ( google.golang.org/protobuf v1.35.2 ) -require github.com/jackc/pgx/v5 v5.7.1 - require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index bba78474ebb4..5c23ee722ad2 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -194,8 +194,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.3-0.20241127063259-f296a5005ce8 h1:KCi0Wq5M0JST0I01HebEDHt7//tZMx2bW4tmlc4IRnI= cosmossdk.io/api v0.7.3-0.20241127063259-f296a5005ce8/go.mod h1:vZy0Ev95gwANXt5ssiDui4L5nlMYO5bzqR77hCjIz9s= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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= @@ -204,8 +204,8 @@ cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee h1:BfzybkpW7xSpRSQPSvv4T6MbEYtcezJMFZ16hZcftDE= -cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee/go.mod h1:vb5uiIC3rDjz+V7UaSLNA3g5TpbRygWi652qtMugWHA= +cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b h1:/5zsEUbJNY6guf7a8y0k6Fk7bUlpCgaZuy8bZNMCXTs= +cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b/go.mod h1:vb5uiIC3rDjz+V7UaSLNA3g5TpbRygWi652qtMugWHA= 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.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 16dd1083d8a5..3f956733c339 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/simapp/v2 -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main @@ -34,7 +34,7 @@ require ( cosmossdk.io/x/upgrade v0.0.0-20230613133644-0a778132a60f github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9 // this version is not used as it is always replaced by the latest Cosmos SDK version - github.com/cosmos/cosmos-sdk v0.52.0 + github.com/cosmos/cosmos-sdk v0.53.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 @@ -67,7 +67,7 @@ require ( cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.8 // indirect cloud.google.com/go/storage v1.42.0 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect; main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect; main cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index b0df99e41903..6451c882621a 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -194,8 +194,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.3-0.20241119134933-d697a3de0f95 h1:nkbou1MO8ho3i+MJ+yehGTqaxGCC/L+sc+7sEAzBy0Y= cosmossdk.io/api v0.7.3-0.20241119134933-d697a3de0f95/go.mod h1:9XEDkRZgZGm1XxHL7Sj2DMXZurCk1pY4x06eR5wyfM0= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20241119134933-d697a3de0f95 h1:2WlnVICuVVx8AY70ueEHyfHJ8ctjFU9RnJsz4U263Fw= diff --git a/tests/go.mod b/tests/go.mod index 279e933af3b2..1735b220bff0 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,10 +1,10 @@ module github.com/cosmos/cosmos-sdk/tests -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0 // main cosmossdk.io/depinject v1.1.0 @@ -23,7 +23,7 @@ require ( github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9 github.com/cosmos/cosmos-proto v1.0.0-beta.5 // this version is not used as it is always replaced by the latest Cosmos SDK version - github.com/cosmos/cosmos-sdk v0.52.0 + github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 github.com/spf13/cobra v1.8.1 // indirect github.com/stretchr/testify v1.10.0 @@ -72,7 +72,7 @@ require ( cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect - cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee // indirect + cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b // indirect cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/server/v2/appmanager v0.0.0-20241107153845-4e240908dd60 // indirect cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f // indirect diff --git a/tests/go.sum b/tests/go.sum index 3e99dc3bd13b..af5945ed7c89 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -194,8 +194,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20241107153845-4e240908dd60 h1:owHSnQ2LZ4Kqgb1qhl8HeOTgebR04FwKHrZk4Q2d50Y= @@ -206,8 +206,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 h1:IQNdY2kB+k+1OM2DvqFG1+UgeU1JzZrWtwuWzI3ZfwA= cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5/go.mod h1:0CuYKkFHxc1vw2JC+t21THBCALJVROrWVR/3PQ1urpc= -cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee h1:BfzybkpW7xSpRSQPSvv4T6MbEYtcezJMFZ16hZcftDE= -cosmossdk.io/indexer/postgres v0.0.0-20241107084833-00f3065e70ee/go.mod h1:vb5uiIC3rDjz+V7UaSLNA3g5TpbRygWi652qtMugWHA= +cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b h1:/5zsEUbJNY6guf7a8y0k6Fk7bUlpCgaZuy8bZNMCXTs= +cosmossdk.io/indexer/postgres v0.0.0-20241128094659-bd76b47e1d8b/go.mod h1:vb5uiIC3rDjz+V7UaSLNA3g5TpbRygWi652qtMugWHA= 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.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= diff --git a/types/collections.go b/types/collections.go index 47d975e89bf3..cb7490af137b 100644 --- a/types/collections.go +++ b/types/collections.go @@ -43,7 +43,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 @@ -55,7 +55,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 ( @@ -138,6 +138,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 @@ -147,7 +151,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, } @@ -175,6 +179,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{} @@ -328,6 +336,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/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index 94f784183706..3a9bafc4624e 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/accounts/defaults/base -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/x/accounts v0.0.0-20240913065641-0064ccbce64e cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index ee8ea4752eeb..098079b5b073 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index dbd8c636e984..ba5c877bdd2c 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -1,9 +1,9 @@ module cosmossdk.io/x/accounts/defaults/lockup -go 1.23.1 +go 1.23.3 require ( - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/x/accounts v0.0.0-20240226161501-23359a0b6d91 cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index edc8d0145d63..d0cdd12477fb 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index 0f8f9392413a..33ecb57f6700 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -1,9 +1,9 @@ module cosmossdk.io/x/accounts/defaults/multisig -go 1.23.1 +go 1.23.3 require ( - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/math v1.4.0 cosmossdk.io/x/accounts v0.0.0-00010101000000-000000000000 diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index ee8ea4752eeb..098079b5b073 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index b714ca6f7dc3..a7fe5f87d97a 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/accounts -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/accounts/go.sum b/x/accounts/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= 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{}) +} diff --git a/x/authz/go.mod b/x/authz/go.mod index a5ad735b020b..bbe49192b234 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.8.0 // main @@ -29,7 +29,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index 033d550462f5..a894413ae54c 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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/bank/go.mod b/x/bank/go.mod index 1a3109cfc7a6..291953490ecb 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/bank -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/bank/go.sum b/x/bank/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index bd43ee7be09c..a6a71da4b909 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -75,10 +75,10 @@ func NewBaseViewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak type Environment: env, cdc: cdc, ak: ak, - 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/circuit/go.mod b/x/circuit/go.mod index 35e12c361a7c..7667fc39183e 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -1,16 +1,17 @@ module cosmossdk.io/x/circuit -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 // main - github.com/cosmos/cosmos-sdk v0.52.0 + github.com/cosmos/cosmos-sdk v0.53.0 github.com/cosmos/gogoproto v1.7.0 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -24,7 +25,6 @@ require ( buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.5.0 // indirect cosmossdk.io/math v1.4.0 // indirect - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v1.0.0-alpha.2 // indirect; main diff --git a/x/circuit/go.sum b/x/circuit/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= 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 e67126c792f0..413182d78cce 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -1,14 +1,14 @@ module cosmossdk.io/x/consensus -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9 github.com/cometbft/cometbft/api v1.0.0-rc2 diff --git a/x/consensus/go.sum b/x/consensus/go.sum index ee8ea4752eeb..098079b5b073 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/consensus/keeper/keeper.go b/x/consensus/keeper/keeper.go index 28f94270a38e..53858707f9fe 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,19 @@ 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 d6aa91260a1a..2650e1d382d4 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -1,15 +1,16 @@ module cosmossdk.io/x/distribution -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.4.0 + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 @@ -30,7 +31,6 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.5.0 // indirect - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/tx v1.0.0-alpha.2 // indirect filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 6ee76320f982..a289898b8ed3 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -101,7 +101,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( @@ -123,14 +128,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), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + "period", + sdk.LEUint64Key, + ), 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), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + "height", + collections.Uint64Key, + "period", + collections.Uint64Key, + ), 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 a77fc2355157..0246421bcf35 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/epochs -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 @@ -20,7 +20,7 @@ require ( google.golang.org/grpc v1.68.0 ) -require cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect +require cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect diff --git a/x/epochs/go.sum b/x/epochs/go.sum index ee8ea4752eeb..098079b5b073 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= 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 f87e0227861f..3c96bec5187c 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/evidence -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 19871cbe1675..59fffeb8919e 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/feegrant -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 5b31c11155d1..fedc43ae0c6a 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/gov/go.mod b/x/gov/go.mod index fe16363becde..a37bab064bf4 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/gov -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/gov/go.sum b/x/gov/go.sum index 74e28c06e1d4..87e808a0b33e 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/group/go.mod b/x/group/go.mod index 14f44956a9ee..785e6e9bbf84 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/group -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main @@ -36,7 +36,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect; main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect; main cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e // main cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index d5ebe7b0e980..4c4a41bc153e 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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/mint/go.mod b/x/mint/go.mod index 3dd19a7e095e..1f8efbd1d00b 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/mint -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 @@ -29,7 +29,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/tx v1.0.0-alpha.2 // indirect; main diff --git a/x/mint/go.sum b/x/mint/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/mint/module.go b/x/mint/module.go index 826dba01f6fc..6a11db35c5d8 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" @@ -178,3 +180,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{}) +} diff --git a/x/nft/go.mod b/x/nft/go.mod index 507854d11878..32868efca3e3 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/nft -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main @@ -24,7 +24,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect; main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect; main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // indirect cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/params/go.mod b/x/params/go.mod index 2eb771f004a8..bf6d093cd1dc 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/params -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main @@ -28,7 +28,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect; main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect; main cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/tx v1.0.0-alpha.2 // indirect; main filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index 0d8b626e84e9..a7395f70f605 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 55067b81250a..a5739befaf4e 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/protocolpool -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 0bdb0d1ae01c..1c1791ef6806 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -1,10 +1,10 @@ module cosmossdk.io/x/slashing -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index d6e72abe05c5..762fb68b8997 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/staking/go.mod b/x/staking/go.mod index 62273dde4ac4..53b654273287 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -1,15 +1,16 @@ module cosmossdk.io/x/staking -go 1.23.1 +go 1.23.2 require ( cosmossdk.io/api v0.8.0 // main - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // main + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // main cosmossdk.io/core v1.0.0-alpha.6 // main cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 // main cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.4.0 + cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b cosmossdk.io/store v1.1.1-0.20240909133312-50288938d1b6 github.com/cometbft/cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9 // indirect github.com/cometbft/cometbft/api v1.0.0-rc2 @@ -33,7 +34,6 @@ require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/log v1.5.0 - cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/tx v1.0.0-alpha.2 // indirect; main filippo.io/edwards25519 v1.1.0 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index a49575b05369..e8162dc96ad0 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY= diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index b85bab1bbc8b..876c9ae97df3 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_key", 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), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility + "delegator", + sdk.AccAddressKey, + ), 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_key", + 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/upgrade/go.mod b/x/upgrade/go.mod index 36cbd176af04..bdaa5c9fc891 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -1,6 +1,6 @@ module cosmossdk.io/x/upgrade -go 1.23.1 +go 1.23.3 require ( cosmossdk.io/api v0.8.0 @@ -40,7 +40,7 @@ require ( cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.8 // indirect cloud.google.com/go/storage v1.42.0 // indirect - cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee // indirect + cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/math v1.4.0 // indirect cosmossdk.io/schema v0.3.1-0.20241128094659-bd76b47e1d8b // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index f437c5325057..670491f8bd87 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -194,8 +194,8 @@ cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1V cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf h1:CttA/mEIxGm4E7vwrjUpju7/Iespns08d9bOza70cIc= cosmossdk.io/api v0.7.3-0.20240924065902-eb7653cfecdf/go.mod h1:YMfx2ATpgITsoydD3hIBa8IkDHtyXp/14rmG0d3sEew= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee h1:OLqvi9ekfShobmdgr4Q/8pu+LjzYJSrNl9tiadPg2xY= -cosmossdk.io/collections v0.4.1-0.20241107084833-00f3065e70ee/go.mod h1:DcD++Yfcq0OFtM3CJNYLIBjfZ+4DEyeJ/AUk6gkwlOE= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b h1:MgU4EDOo/pXgepHCUFQFnIfUCxk/JO0AJGDTUQhhEhg= +cosmossdk.io/collections v0.4.1-0.20241128094659-bd76b47e1d8b/go.mod h1:uf12i1yKvzEIHt2ok7poNqFDQTb71O00RQLitSynmrg= 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-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0R70e3cbn9eFTEuMr7ev1AFvypdY=