feat(indexer): add to modules and implement proto fields (#22544)
This commit is contained in:
parent
18dcdb8f45
commit
bd76b47e1d
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/client/v2
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* [#21090](https://github.com/cosmos/cosmos-sdk/pull/21090) Introduces `Quad`, a composite key with four keys.
|
||||
* [#20704](https://github.com/cosmos/cosmos-sdk/pull/20704) Add `ModuleCodec` method to `Schema` and `HasSchemaCodec` interface in order to support `cosmossdk.io/schema` compatible indexing.
|
||||
* [#20538](https://github.com/cosmos/cosmos-sdk/pull/20538) Add `Nameable` variations to `KeyCodec` and `ValueCodec` to allow for better indexing of `collections` types.
|
||||
* [#22544](https://github.com/cosmos/cosmos-sdk/pull/22544) Schema's `ModuleCodec` will now also return Enum descriptors to be registered with the indexer.
|
||||
|
||||
## [v0.4.0](https://github.com/cosmos/cosmos-sdk/releases/tag/collections%2Fv0.4.0)
|
||||
|
||||
|
||||
@ -1,18 +1,22 @@
|
||||
module cosmossdk.io/collections
|
||||
|
||||
go 1.23
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/core v1.0.0-alpha.6
|
||||
cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29
|
||||
cosmossdk.io/schema v0.3.0
|
||||
github.com/cosmos/gogoproto v1.7.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tidwall/btree v1.7.0
|
||||
google.golang.org/protobuf v1.35.2
|
||||
pgregory.net/rapid v1.1.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@ -4,14 +4,22 @@ cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29 h1:NxxUo0GMJUbIuVg0
|
||||
cosmossdk.io/core/testing v0.0.0-20240923163230-04da382a9f29/go.mod h1:8s2tPeJtSiQuoyPmr2Ag7meikonISO4Fv4MoO8+ORrs=
|
||||
cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c=
|
||||
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
|
||||
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
|
||||
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
|
||||
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
|
||||
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
||||
@ -3,9 +3,12 @@ package collections
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"github.com/tidwall/btree"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
"cosmossdk.io/collections/codec"
|
||||
"cosmossdk.io/schema"
|
||||
@ -46,8 +49,45 @@ func (s Schema) ModuleCodec(opts IndexingOptions) (schema.ModuleCodec, error) {
|
||||
cdc.objectType.RetainDeletions = true
|
||||
}
|
||||
|
||||
types = append(types, cdc.objectType)
|
||||
// this part below is a bit hacky, it will try to convert to a proto.Message
|
||||
// in order to get any enum types inside of it.
|
||||
emptyVal, err := coll.ValueCodec().Decode([]byte{})
|
||||
if err == nil {
|
||||
// convert to proto.Message
|
||||
pt, err := toProtoMessage(emptyVal)
|
||||
if err == nil {
|
||||
msgName := proto.MessageName(pt)
|
||||
desc, err := proto.HybridResolver.FindDescriptorByName(protoreflect.FullName(msgName))
|
||||
if err != nil {
|
||||
return schema.ModuleCodec{}, fmt.Errorf("could not find descriptor for %s: %w", msgName, err)
|
||||
}
|
||||
msgDesc := desc.(protoreflect.MessageDescriptor)
|
||||
|
||||
// go through enum descriptors and add them to types
|
||||
for i := 0; i < msgDesc.Fields().Len(); i++ {
|
||||
field := msgDesc.Fields().Get(i)
|
||||
enum := field.Enum()
|
||||
if enum == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
enumType := schema.EnumType{
|
||||
Name: strings.ReplaceAll(string(enum.FullName()), ".", "_"), // make it compatible with schema
|
||||
}
|
||||
for j := 0; j < enum.Values().Len(); j++ {
|
||||
val := enum.Values().Get(j)
|
||||
enumType.Values = append(enumType.Values, schema.EnumValueDefinition{
|
||||
Name: string(val.Name()),
|
||||
Value: int32(val.Number()),
|
||||
})
|
||||
}
|
||||
types = append(types, enumType)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
types = append(types, cdc.objectType)
|
||||
decoder.collectionLookup.Set(string(coll.GetPrefix()), cdc)
|
||||
}
|
||||
|
||||
@ -150,6 +190,11 @@ func (c collectionImpl[K, V]) schemaCodec() (*collectionSchemaCodec, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if valueDecoder.ToSchemaType == nil {
|
||||
return x, nil
|
||||
}
|
||||
|
||||
return valueDecoder.ToSchemaType(x)
|
||||
}
|
||||
ensureFieldNames(c.m.vc, "value", res.objectType.ValueFields)
|
||||
@ -180,3 +225,34 @@ func ensureFieldNames(x any, defaultName string, cols []schema.Field) {
|
||||
cols[i] = col
|
||||
}
|
||||
}
|
||||
|
||||
// toProtoMessage is a helper to convert a value to a proto.Message.
|
||||
func toProtoMessage(value interface{}) (proto.Message, error) {
|
||||
if value == nil {
|
||||
return nil, fmt.Errorf("value is nil")
|
||||
}
|
||||
|
||||
// Check if the value already implements proto.Message
|
||||
if msg, ok := value.(proto.Message); ok {
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
// Use reflection to handle non-pointer values
|
||||
v := reflect.ValueOf(value)
|
||||
if v.Kind() == reflect.Ptr {
|
||||
// Already a pointer, but doesn't implement proto.Message
|
||||
return nil, fmt.Errorf("value is a pointer but does not implement proto.Message")
|
||||
}
|
||||
|
||||
// If not a pointer, create a pointer to the value dynamically
|
||||
ptr := reflect.New(v.Type())
|
||||
ptr.Elem().Set(v)
|
||||
|
||||
// Assert if the pointer implements proto.Message
|
||||
msg, ok := ptr.Interface().(proto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("value does not implement proto.Message")
|
||||
}
|
||||
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package codec
|
||||
package protocodec
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package codec_test
|
||||
package protocodec_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
@ -17,7 +17,7 @@ func (tm *objectIndexer) createTable(ctx context.Context, conn dbConn) error {
|
||||
|
||||
sqlStr := buf.String()
|
||||
if tm.options.logger != nil {
|
||||
tm.options.logger.Debug("Creating table %s", "table", tm.tableName(), "sql", sqlStr)
|
||||
tm.options.logger.Debug("Creating table", "table", tm.tableName(), "sql", sqlStr)
|
||||
}
|
||||
_, err = conn.ExecContext(ctx, sqlStr)
|
||||
return err
|
||||
|
||||
@ -21,6 +21,7 @@ func (m *moduleIndexer) createEnumType(ctx context.Context, conn dbConn, enum sc
|
||||
}
|
||||
} else {
|
||||
// the enum type already exists
|
||||
// TODO: add a check to ensure the existing enum type matches the expected values, and update it if necessary?
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,26 @@ func (i *indexerImpl) listener() appdata.Listener {
|
||||
return mm.initializeSchema(i.ctx, i.tx)
|
||||
},
|
||||
StartBlock: func(data appdata.StartBlockData) error {
|
||||
_, err := i.tx.Exec("INSERT INTO block (number) VALUES ($1)", data.Height)
|
||||
var (
|
||||
headerBz []byte
|
||||
err error
|
||||
)
|
||||
|
||||
if data.HeaderJSON != nil {
|
||||
headerBz, err = data.HeaderJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if data.HeaderBytes != nil {
|
||||
headerBz, err = data.HeaderBytes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: verify the format of headerBz, otherwise we'll get `ERROR: invalid input syntax for type json (SQLSTATE 22P02)`
|
||||
_, err = i.tx.Exec("INSERT INTO block (number, header) VALUES ($1, $2)", data.Height, headerBz)
|
||||
|
||||
return err
|
||||
},
|
||||
OnObjectUpdate: func(data appdata.ObjectUpdateData) error {
|
||||
|
||||
@ -6,7 +6,7 @@ DEBUG: Creating enum type
|
||||
sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c');
|
||||
DEBUG: Creating enum type
|
||||
sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain');
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_all_kinds
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" (
|
||||
"id" BIGINT NOT NULL,
|
||||
@ -36,7 +36,7 @@ DEBUG: Creating table %s
|
||||
PRIMARY KEY ("id", "ts_nanos")
|
||||
);
|
||||
GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC;
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_singleton
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_singleton" (
|
||||
_id INTEGER NOT NULL CHECK (_id = 1),
|
||||
@ -46,7 +46,7 @@ DEBUG: Creating table %s
|
||||
PRIMARY KEY (_id)
|
||||
);
|
||||
GRANT SELECT ON TABLE "test_singleton" TO PUBLIC;
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_vote
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_vote" (
|
||||
"proposal" BIGINT NOT NULL,
|
||||
|
||||
@ -6,7 +6,7 @@ DEBUG: Creating enum type
|
||||
sql: CREATE TYPE "test_my_enum" AS ENUM ('a', 'b', 'c');
|
||||
DEBUG: Creating enum type
|
||||
sql: CREATE TYPE "test_vote_type" AS ENUM ('yes', 'no', 'abstain');
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_all_kinds
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_all_kinds" (
|
||||
"id" BIGINT NOT NULL,
|
||||
@ -36,7 +36,7 @@ DEBUG: Creating table %s
|
||||
PRIMARY KEY ("id", "ts_nanos")
|
||||
);
|
||||
GRANT SELECT ON TABLE "test_all_kinds" TO PUBLIC;
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_singleton
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_singleton" (
|
||||
_id INTEGER NOT NULL CHECK (_id = 1),
|
||||
@ -46,7 +46,7 @@ DEBUG: Creating table %s
|
||||
PRIMARY KEY (_id)
|
||||
);
|
||||
GRANT SELECT ON TABLE "test_singleton" TO PUBLIC;
|
||||
DEBUG: Creating table %s
|
||||
DEBUG: Creating table
|
||||
table: test_vote
|
||||
sql: CREATE TABLE IF NOT EXISTS "test_vote" (
|
||||
"proposal" BIGINT NOT NULL,
|
||||
|
||||
@ -632,10 +632,10 @@ func BenchmarkMarshalTo(b *testing.B) {
|
||||
}{
|
||||
{
|
||||
math.LegacyNewDec(1e8), []byte{
|
||||
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
},
|
||||
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||
},
|
||||
},
|
||||
{math.LegacyNewDec(0), []byte{0x30}},
|
||||
}
|
||||
|
||||
@ -46,6 +46,13 @@ func AsyncListener(opts AsyncListenerOptions, listener Listener) Listener {
|
||||
done := ctx.Done()
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
close(packetChan)
|
||||
if opts.DoneWaitGroup != nil {
|
||||
opts.DoneWaitGroup.Done()
|
||||
}
|
||||
}()
|
||||
|
||||
if opts.DoneWaitGroup != nil {
|
||||
opts.DoneWaitGroup.Add(1)
|
||||
}
|
||||
@ -74,10 +81,6 @@ func AsyncListener(opts AsyncListenerOptions, listener Listener) Listener {
|
||||
}
|
||||
|
||||
case <-done:
|
||||
close(packetChan)
|
||||
if opts.DoneWaitGroup != nil {
|
||||
opts.DoneWaitGroup.Done()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,10 @@ type Field struct {
|
||||
// Validate validates the field.
|
||||
func (c Field) Validate(typeSet TypeSet) error {
|
||||
// valid name
|
||||
if c.Name == "" {
|
||||
return fmt.Errorf("field name cannot be empty, might be missing the named key codec")
|
||||
}
|
||||
|
||||
if !ValidateName(c.Name) {
|
||||
return fmt.Errorf("invalid field name %q", c.Name)
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func TestField_Validate(t *testing.T) {
|
||||
Name: "",
|
||||
Kind: StringKind,
|
||||
},
|
||||
errContains: "invalid field name",
|
||||
errContains: "name cannot be empty, might be missing the named key codec",
|
||||
},
|
||||
{
|
||||
name: "invalid kind",
|
||||
|
||||
@ -53,7 +53,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error {
|
||||
|
||||
for _, field := range o.KeyFields {
|
||||
if err := field.Validate(typeSet); err != nil {
|
||||
return fmt.Errorf("invalid key field %q: %v", field.Name, err) //nolint:errorlint // false positive due to using go1.12
|
||||
return fmt.Errorf("invalid key field %q in type %q: %v", field.Name, o.Name, err) //nolint:errorlint // false positive due to using go1.12
|
||||
}
|
||||
|
||||
if !field.Kind.ValidKeyKind() {
|
||||
@ -65,7 +65,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error {
|
||||
}
|
||||
|
||||
if fieldNames[field.Name] {
|
||||
return fmt.Errorf("duplicate field name %q", field.Name)
|
||||
return fmt.Errorf("duplicate key field name %q for stateObjectType: %s", field.Name, o.Name)
|
||||
}
|
||||
fieldNames[field.Name] = true
|
||||
}
|
||||
@ -76,7 +76,7 @@ func (o StateObjectType) Validate(typeSet TypeSet) error {
|
||||
}
|
||||
|
||||
if fieldNames[field.Name] {
|
||||
return fmt.Errorf("duplicate field name %q", field.Name)
|
||||
return fmt.Errorf("duplicate field name %q for stateObjectType: %s", field.Name, o.Name)
|
||||
}
|
||||
fieldNames[field.Name] = true
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func TestObjectType_Validate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
errContains: "invalid field name",
|
||||
errContains: "field name cannot be empty, might be missing the named key codec",
|
||||
},
|
||||
{
|
||||
name: "invalid value field",
|
||||
@ -105,7 +105,7 @@ func TestObjectType_Validate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
errContains: "invalid field name",
|
||||
errContains: "field name cannot be empty, might be missing the named key codec",
|
||||
},
|
||||
{
|
||||
name: "no fields",
|
||||
@ -146,7 +146,7 @@ func TestObjectType_Validate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
errContains: "duplicate field name",
|
||||
errContains: "duplicate key field name \"field1\" for stateObjectType: object1",
|
||||
},
|
||||
{
|
||||
name: "nullable key field",
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
module cosmossdk.io/server/v2/cometbft
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
replace (
|
||||
cosmossdk.io/api => ../../../api
|
||||
cosmossdk.io/collections => ../../../collections
|
||||
cosmossdk.io/core/testing => ../../../core/testing
|
||||
cosmossdk.io/server/v2 => ../
|
||||
cosmossdk.io/server/v2/appmanager => ../appmanager
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/simapp
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -252,7 +252,6 @@ replace (
|
||||
cosmossdk.io/api => ../api
|
||||
cosmossdk.io/client/v2 => ../client/v2
|
||||
cosmossdk.io/collections => ../collections
|
||||
cosmossdk.io/indexer/postgres => ../indexer/postgres
|
||||
cosmossdk.io/store => ../store
|
||||
cosmossdk.io/tools/confix => ../tools/confix
|
||||
cosmossdk.io/x/accounts => ../x/accounts
|
||||
@ -281,6 +280,8 @@ replace (
|
||||
|
||||
// Below are the long-lived replace of the SimApp
|
||||
replace (
|
||||
cosmossdk.io/indexer/postgres => ../indexer/postgres
|
||||
cosmossdk.io/schema => ../schema
|
||||
// use cosmos fork of keyring
|
||||
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
|
||||
// Simapp always use the latest version of the cosmos-sdk
|
||||
|
||||
@ -204,9 +204,6 @@ cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g=
|
||||
cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI=
|
||||
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
|
||||
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
|
||||
cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac h1:3joNZZWZ3k7fMsrBDL1ktuQ2xQwYLZOaDhkruadDFmc=
|
||||
cosmossdk.io/schema v0.3.1-0.20241010135032-192601639cac/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/simapp/v2
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -74,7 +74,6 @@ func Benchmark_GetSparse(b *testing.B) {
|
||||
var keySink, valueSink any
|
||||
|
||||
func Benchmark_Iterate(b *testing.B) {
|
||||
|
||||
for _, stackSize := range stackSizes {
|
||||
b.Run(fmt.Sprintf("StackSize%d", stackSize), func(b *testing.B) {
|
||||
bs := makeBranchStack(b, stackSize)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module github.com/cosmos/cosmos-sdk/tests
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/router"
|
||||
"cosmossdk.io/core/transaction"
|
||||
"cosmossdk.io/depinject"
|
||||
@ -26,7 +28,6 @@ import (
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import as blank for app wiring``
|
||||
_ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import as blank for app wiring
|
||||
_ "github.com/cosmos/cosmos-sdk/x/genutil" // import as blank for app wiring
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type suite struct {
|
||||
|
||||
@ -128,8 +128,7 @@ func (e *eventManager) EmitKV(eventType string, attrs ...event.Attribute) error
|
||||
var _ branch.Service = &BranchService{}
|
||||
|
||||
// custom branch service for integration tests
|
||||
type BranchService struct {
|
||||
}
|
||||
type BranchService struct{}
|
||||
|
||||
func (bs *BranchService) Execute(ctx context.Context, f func(ctx context.Context) error) error {
|
||||
_, ok := ctx.Value(contextKey).(*integrationContext)
|
||||
|
||||
@ -44,7 +44,7 @@ var (
|
||||
// Deprecated: exists only for state compatibility reasons, should not
|
||||
// be used for new storage keys using time. Please use the time KeyCodec
|
||||
// provided in the collections package.
|
||||
TimeKey collcodec.KeyCodec[time.Time] = timeKeyCodec{}
|
||||
TimeKey collcodec.NameableKeyCodec[time.Time] = timeKeyCodec{}
|
||||
|
||||
// LEUint64Key is a collections KeyCodec that encodes uint64 using little endian.
|
||||
// NOTE: it MUST NOT be used by other modules, distribution relies on this only for
|
||||
@ -56,7 +56,7 @@ var (
|
||||
// Deprecated: exists only for state compatibility reasons, should not be
|
||||
// used for new storage keys using []byte. Please use the BytesKey provided
|
||||
// in the collections package.
|
||||
LengthPrefixedBytesKey collcodec.KeyCodec[[]byte] = lengthPrefixedBytesKey{collections.BytesKey}
|
||||
LengthPrefixedBytesKey collcodec.NameableKeyCodec[[]byte] = lengthPrefixedBytesKey{collections.BytesKey}
|
||||
)
|
||||
|
||||
const (
|
||||
@ -139,6 +139,10 @@ func (g lengthPrefixedAddressKey[T]) Size(key T) int { return g.SizeNonTerminal(
|
||||
|
||||
func (g lengthPrefixedAddressKey[T]) KeyType() string { return "index_key/" + g.KeyCodec.KeyType() }
|
||||
|
||||
func (g lengthPrefixedAddressKey[T]) WithName(name string) collcodec.KeyCodec[T] {
|
||||
return collcodec.NamedKeyCodec[T]{KeyCodec: g, Name: name}
|
||||
}
|
||||
|
||||
// Deprecated: LengthPrefixedAddressKey implements an SDK backwards compatible indexing key encoder
|
||||
// for addresses.
|
||||
// The status quo in the SDK is that address keys are length prefixed even when they're the
|
||||
@ -148,7 +152,7 @@ func (g lengthPrefixedAddressKey[T]) KeyType() string { return "index_key/" + g.
|
||||
// byte to the string, then when you know when the string part finishes, it's logical that the
|
||||
// part which remains is the address key. In the SDK instead we prepend to the address key its
|
||||
// length too.
|
||||
func LengthPrefixedAddressKey[T addressUnion](keyCodec collcodec.KeyCodec[T]) collcodec.KeyCodec[T] {
|
||||
func LengthPrefixedAddressKey[T addressUnion](keyCodec collcodec.KeyCodec[T]) collcodec.NameableKeyCodec[T] {
|
||||
return lengthPrefixedAddressKey[T]{
|
||||
keyCodec,
|
||||
}
|
||||
@ -176,6 +180,10 @@ func (g lengthPrefixedBytesKey) KeyType() string {
|
||||
return "index_key/" + g.KeyCodec.KeyType()
|
||||
}
|
||||
|
||||
func (g lengthPrefixedBytesKey) WithName(name string) collcodec.KeyCodec[[]byte] {
|
||||
return collcodec.NamedKeyCodec[[]byte]{KeyCodec: g, Name: name}
|
||||
}
|
||||
|
||||
// Collection Codecs
|
||||
|
||||
type intValueCodec struct{}
|
||||
@ -329,6 +337,10 @@ func (t timeKeyCodec) DecodeNonTerminal(buffer []byte) (int, time.Time, error) {
|
||||
}
|
||||
func (t timeKeyCodec) SizeNonTerminal(key time.Time) int { return t.Size(key) }
|
||||
|
||||
func (t timeKeyCodec) WithName(name string) collcodec.KeyCodec[time.Time] {
|
||||
return collcodec.NamedKeyCodec[time.Time]{KeyCodec: t, Name: name}
|
||||
}
|
||||
|
||||
type leUint64Key struct{}
|
||||
|
||||
func (l leUint64Key) Encode(buffer []byte, key uint64) (int, error) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/accounts/defaults/base
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/accounts/defaults/lockup
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/collections v0.4.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/accounts/defaults/multisig
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/collections v0.4.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/accounts
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/authz
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/bank
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -78,10 +78,10 @@ func NewBaseViewKeeper(env appmodule.Environment, cdc codec.BinaryCodec, ak type
|
||||
cdc: cdc,
|
||||
ak: ak,
|
||||
addrCdc: ak.AddressCodec(),
|
||||
Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey.WithName("supply"), sdk.IntValue),
|
||||
DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey.WithName("denom_metadata"), codec.CollValue[types.Metadata](cdc)),
|
||||
SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey.WithName("send_enabled"), codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat
|
||||
Balances: collections.NewIndexedMap(sb, types.BalancesPrefix, "balances", collections.NamedPairKeyCodec("address", sdk.AccAddressKey, "balances", collections.StringKey), types.BalanceValueCodec, newBalancesIndexes(sb)),
|
||||
Supply: collections.NewMap(sb, types.SupplyKey, "supply", collections.StringKey.WithName("denom"), sdk.IntValue),
|
||||
DenomMetadata: collections.NewMap(sb, types.DenomMetadataPrefix, "denom_metadata", collections.StringKey.WithName("denom"), codec.CollValue[types.Metadata](cdc)),
|
||||
SendEnabled: collections.NewMap(sb, types.SendEnabledPrefix, "send_enabled", collections.StringKey.WithName("denom"), codec.BoolValue), // NOTE: we use a bool value which uses protobuf to retain state backwards compat
|
||||
Balances: collections.NewIndexedMap(sb, types.BalancesPrefix, "balances", collections.NamedPairKeyCodec("address", sdk.AccAddressKey, "denom", collections.StringKey), types.BalanceValueCodec, newBalancesIndexes(sb)),
|
||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/circuit
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -9,6 +9,7 @@ require (
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/errors v1.0.1
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
|
||||
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc
|
||||
github.com/cosmos/cosmos-sdk v0.53.0
|
||||
github.com/cosmos/gogoproto v1.7.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.20240930054013-7c6e0388a3f9 // 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.1 // indirect
|
||||
@ -177,6 +177,8 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/schema => ../../schema
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
@ -18,8 +16,6 @@ cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g=
|
||||
cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI=
|
||||
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
|
||||
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/consensus
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -8,6 +8,7 @@ require (
|
||||
cosmossdk.io/core v1.0.0-alpha.6
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e
|
||||
cosmossdk.io/depinject v1.1.0
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
|
||||
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc
|
||||
github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f
|
||||
github.com/cometbft/cometbft/api v1.0.0-rc.1
|
||||
@ -27,7 +28,6 @@ require (
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/log v1.5.0 // indirect
|
||||
cosmossdk.io/math v1.4.0 // indirect
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // 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.1 // indirect
|
||||
@ -175,6 +175,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/distribution
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -10,6 +10,7 @@ require (
|
||||
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.20240930054013-7c6e0388a3f9
|
||||
cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc
|
||||
cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.5
|
||||
@ -29,7 +30,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.20240930054013-7c6e0388a3f9 // indirect
|
||||
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect
|
||||
cosmossdk.io/x/tx v1.0.0-alpha.1 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
|
||||
@ -104,7 +104,12 @@ func NewKeeper(
|
||||
sb,
|
||||
types.DelegatorStartingInfoPrefix,
|
||||
"delegators_starting_info",
|
||||
collections.PairKeyCodec(sdk.ValAddressKey, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility
|
||||
collections.NamedPairKeyCodec(
|
||||
"validator_address",
|
||||
sdk.ValAddressKey,
|
||||
"delegator_address",
|
||||
sdk.LengthPrefixedAddressKey(sdk.AccAddressKey), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility
|
||||
),
|
||||
codec.CollValue[types.DelegatorStartingInfo](cdc),
|
||||
),
|
||||
ValidatorsAccumulatedCommission: collections.NewMap(
|
||||
@ -126,14 +131,26 @@ func NewKeeper(
|
||||
sb,
|
||||
types.ValidatorHistoricalRewardsPrefix,
|
||||
"validator_historical_rewards",
|
||||
collections.PairKeyCodec(sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), sdk.LEUint64Key), //nolint: staticcheck // sdk.LengthPrefixedAddressKey is needed to retain state compatibility
|
||||
collections.NamedPairKeyCodec(
|
||||
"validator_address",
|
||||
sdk.LengthPrefixedAddressKey(sdk.ValAddressKey), //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),
|
||||
),
|
||||
}
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/epochs
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -20,7 +20,7 @@ require (
|
||||
google.golang.org/grpc v1.68.0
|
||||
)
|
||||
|
||||
require cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect
|
||||
require cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
|
||||
|
||||
require (
|
||||
buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.35.2-20241120201313-68e42a58b301.1 // indirect
|
||||
@ -180,6 +180,8 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/schema => ../../schema
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
@ -18,8 +16,6 @@ cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g=
|
||||
cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI=
|
||||
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
|
||||
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/evidence
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/feegrant
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/gov
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/group
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/mint
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -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.20240930054013-7c6e0388a3f9 // indirect
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
|
||||
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.1 // indirect
|
||||
@ -181,6 +181,8 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/schema => ../../schema
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/consensus => ../consensus
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
@ -18,8 +16,6 @@ cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g=
|
||||
cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI=
|
||||
cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ=
|
||||
cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 h1:DmOoS/1PeY6Ih0hAVlJ69kLMUrLV+TCbfICrZtB1vdU=
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs=
|
||||
|
||||
@ -8,8 +8,10 @@ import (
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/registry"
|
||||
"cosmossdk.io/schema"
|
||||
"cosmossdk.io/x/mint/keeper"
|
||||
"cosmossdk.io/x/mint/simulation"
|
||||
"cosmossdk.io/x/mint/types"
|
||||
@ -165,3 +167,9 @@ func (AppModule) ProposalMsgsX(weights simsx.WeightSource, reg simsx.Registry) {
|
||||
func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) {
|
||||
sdr[types.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(am.keeper.Schema)
|
||||
}
|
||||
|
||||
// ModuleCodec implements schema.HasModuleCodec.
|
||||
// It allows the indexer to decode the module's KVPairUpdate.
|
||||
func (am AppModule) ModuleCodec() (schema.ModuleCodec, error) {
|
||||
return am.keeper.Schema.ModuleCodec(collections.IndexingOptions{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/nft
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/params
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -169,6 +169,7 @@ replace github.com/cosmos/cosmos-sdk => ../..
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/distribution => ../distribution
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/protocolpool
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -177,6 +177,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/slashing
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -178,6 +178,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
// TODO remove post spinning out all modules
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/staking => ../staking
|
||||
|
||||
@ -4,8 +4,6 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88e
|
||||
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.35.2-20240130113600-88ef6483f90f.1/go.mod h1:17Ax38yd8pg56din4ecwSDBRCSX0qLcif5Cdf8ayto4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/staking
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.2
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -160,8 +160,9 @@ require (
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
)
|
||||
|
||||
require cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9
|
||||
|
||||
require (
|
||||
cosmossdk.io/schema v0.3.1-0.20240930054013-7c6e0388a3f9 // indirect
|
||||
github.com/bytedance/sonic v1.12.4 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
|
||||
@ -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),
|
||||
),
|
||||
|
||||
@ -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{})
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
module cosmossdk.io/x/upgrade
|
||||
|
||||
go 1.23.1
|
||||
go 1.23.3
|
||||
|
||||
require (
|
||||
cosmossdk.io/api v0.7.6
|
||||
@ -208,6 +208,7 @@ replace github.com/cosmos/cosmos-sdk => ../../.
|
||||
|
||||
replace (
|
||||
cosmossdk.io/api => ../../api
|
||||
cosmossdk.io/collections => ../../collections
|
||||
cosmossdk.io/store => ../../store
|
||||
cosmossdk.io/x/bank => ../bank
|
||||
cosmossdk.io/x/gov => ../gov
|
||||
|
||||
@ -192,8 +192,6 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX
|
||||
cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=
|
||||
cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=
|
||||
cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=
|
||||
cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
|
||||
cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
|
||||
cosmossdk.io/core v1.0.0-alpha.6 h1:5ukC4JcQKmemLQXcAgu/QoOvJI50hpBkIIg4ZT2EN8E=
|
||||
cosmossdk.io/core v1.0.0-alpha.6/go.mod h1:3u9cWq1FAVtiiCrDPpo4LhR+9V6k/ycSG4/Y/tREWCY=
|
||||
cosmossdk.io/core/testing v0.0.0-20241108153815-606544c7be7e h1:F+ScucYxwrrDJU8guJXQXpGhdpziYSbxW6HMP2wCNxs=
|
||||
|
||||
Loading…
Reference in New Issue
Block a user