chore: migrate core to gogoproto.Message (#20781)
This commit is contained in:
parent
5d54274775
commit
c7375f7cd3
@ -9,7 +9,6 @@ import (
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/protobuf/reflect/protodesc"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
"cosmossdk.io/core/registry"
|
||||
"cosmossdk.io/x/tx/signing"
|
||||
@ -152,7 +151,7 @@ func NewInterfaceRegistryWithOptions(options InterfaceRegistryOptions) (Interfac
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (registry *interfaceRegistry) RegisterInterface(protoName string, iface interface{}, impls ...protoiface.MessageV1) {
|
||||
func (registry *interfaceRegistry) RegisterInterface(protoName string, iface interface{}, impls ...proto.Message) {
|
||||
typ := reflect.TypeOf(iface)
|
||||
if typ.Elem().Kind() != reflect.Interface {
|
||||
panic(fmt.Errorf("%T is not an interface type", iface))
|
||||
@ -182,7 +181,7 @@ func (registry *interfaceRegistry) EnsureRegistered(impl interface{}) error {
|
||||
//
|
||||
// This function PANICs if different concrete types are registered under the
|
||||
// same typeURL.
|
||||
func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, impls ...protoiface.MessageV1) {
|
||||
func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, impls ...proto.Message) {
|
||||
for _, impl := range impls {
|
||||
typeURL := MsgTypeURL(impl)
|
||||
registry.registerImpl(iface, typeURL, impl)
|
||||
|
||||
@ -13,6 +13,7 @@ require (
|
||||
github.com/cosmos/gogoproto v1.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/tidwall/btree v1.7.0 // indirect
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o=
|
||||
github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
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/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
|
||||
@ -2,15 +2,12 @@ package appmodule
|
||||
|
||||
import (
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
protov2 "google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type Message = gogoproto.Message
|
||||
|
||||
func messageName[M Message]() string {
|
||||
switch m := any(*new(M)).(type) {
|
||||
case protov2.Message:
|
||||
return string(m.ProtoReflect().Descriptor().FullName())
|
||||
case gogoproto.Message:
|
||||
return gogoproto.MessageName(m)
|
||||
default:
|
||||
|
||||
@ -4,7 +4,7 @@ package event
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
)
|
||||
|
||||
// Service represents an event service which can retrieve and set an event manager in a context.
|
||||
@ -19,7 +19,7 @@ type Manager interface {
|
||||
// Emit emits events represented as a protobuf message (as described in ADR 032).
|
||||
//
|
||||
// Callers SHOULD assume that these events will not be included in consensus.
|
||||
Emit(event protoiface.MessageV1) error
|
||||
Emit(event gogoproto.Message) error
|
||||
|
||||
// EmitKV emits an event based on an event and kv-pair attributes.
|
||||
//
|
||||
|
||||
@ -6,7 +6,6 @@ require (
|
||||
github.com/cosmos/gogoproto v1.5.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
google.golang.org/grpc v1.64.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
@ -20,6 +19,7 @@ require (
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
)
|
||||
|
||||
type InterfaceRegistrar interface {
|
||||
@ -14,12 +14,12 @@ type InterfaceRegistrar interface {
|
||||
//
|
||||
// Ex:
|
||||
// registry.RegisterInterface("cosmos.base.v1beta1.Msg", (*sdk.Msg)(nil))
|
||||
RegisterInterface(protoName string, iface interface{}, impls ...protoiface.MessageV1)
|
||||
RegisterInterface(protoName string, iface interface{}, impls ...gogoproto.Message)
|
||||
|
||||
// RegisterImplementations registers impls as concrete implementations of
|
||||
// the interface iface.
|
||||
//
|
||||
// Ex:
|
||||
// registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{})
|
||||
RegisterImplementations(iface interface{}, impls ...protoiface.MessageV1)
|
||||
RegisterImplementations(iface interface{}, impls ...gogoproto.Message)
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
)
|
||||
|
||||
// Service is the interface that wraps the basic methods for a router.
|
||||
@ -12,7 +12,7 @@ type Service interface {
|
||||
// CanInvoke returns an error if the given request cannot be invoked.
|
||||
CanInvoke(ctx context.Context, typeURL string) error
|
||||
// InvokeTyped execute a message or query. It should be used when the called knows the type of the response.
|
||||
InvokeTyped(ctx context.Context, req, res protoiface.MessageV1) error
|
||||
InvokeTyped(ctx context.Context, req, res gogoproto.Message) error
|
||||
// InvokeUntyped execute a message or query. It should be used when the called doesn't know the type of the response.
|
||||
InvokeUntyped(ctx context.Context, req protoiface.MessageV1) (res protoiface.MessageV1, err error)
|
||||
InvokeUntyped(ctx context.Context, req gogoproto.Message) (res gogoproto.Message, err error)
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package coretesting
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/store"
|
||||
@ -15,7 +15,7 @@ func Context() context.Context {
|
||||
dummy := &dummyCtx{
|
||||
stores: map[string]store.KVStore{},
|
||||
events: map[string][]event.Event{},
|
||||
protoEvents: map[string][]protoiface.MessageV1{},
|
||||
protoEvents: map[string][]gogoproto.Message{},
|
||||
}
|
||||
|
||||
ctx := context.WithValue(context.Background(), dummyKey{}, dummy)
|
||||
@ -28,7 +28,7 @@ type dummyCtx struct {
|
||||
// maps event emitted by the actor.
|
||||
events map[string][]event.Event
|
||||
// maps proto events emitted by the actor.
|
||||
protoEvents map[string][]protoiface.MessageV1
|
||||
protoEvents map[string][]gogoproto.Message
|
||||
}
|
||||
|
||||
func unwrap(ctx context.Context) *dummyCtx {
|
||||
|
||||
@ -3,7 +3,7 @@ package coretesting
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
)
|
||||
@ -30,7 +30,7 @@ func (e MemEventsService) GetEvents(ctx context.Context) []event.Event {
|
||||
return unwrap(ctx).events[e.moduleName]
|
||||
}
|
||||
|
||||
func (e MemEventsService) GetProtoEvents(ctx context.Context) []protoiface.MessageV1 {
|
||||
func (e MemEventsService) GetProtoEvents(ctx context.Context) []gogoproto.Message {
|
||||
return unwrap(ctx).protoEvents[e.moduleName]
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ type eventManager struct {
|
||||
ctx *dummyCtx
|
||||
}
|
||||
|
||||
func (e eventManager) Emit(event protoiface.MessageV1) error {
|
||||
func (e eventManager) Emit(event gogoproto.Message) error {
|
||||
e.ctx.protoEvents[e.moduleName] = append(e.ctx.protoEvents[e.moduleName], event)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package coretesting
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
gogotypes "github.com/cosmos/gogoproto/types"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
)
|
||||
@ -14,25 +13,37 @@ func TestEventsService(t *testing.T) {
|
||||
ctx := Context()
|
||||
es := EventsService(ctx, "auth")
|
||||
|
||||
wantProtoEvent := &wrapperspb.BoolValue{Value: true}
|
||||
wantProtoEvent := &gogotypes.BoolValue{Value: true}
|
||||
err := es.EventManager(ctx).Emit(wantProtoEvent)
|
||||
require.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("failed to emit proto event: %s", err)
|
||||
}
|
||||
|
||||
wantEvent := event.NewEvent("new-account", event.Attribute{
|
||||
Key: "number",
|
||||
Value: "1",
|
||||
})
|
||||
err = es.EventManager(ctx).EmitKV(wantEvent.Type, wantEvent.Attributes...)
|
||||
require.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("failed to emit event: %s", err)
|
||||
}
|
||||
|
||||
gotProtoEvents := es.GetProtoEvents(ctx)
|
||||
require.Equal(t, []protoiface.MessageV1{wantProtoEvent}, gotProtoEvents)
|
||||
if len(gotProtoEvents) != 1 || gotProtoEvents[0] != wantProtoEvent {
|
||||
t.Errorf("unexpected proto events: got %v, want %v", gotProtoEvents, wantProtoEvent)
|
||||
}
|
||||
|
||||
gotEvents := es.GetEvents(ctx)
|
||||
require.Equal(t, []event.Event{wantEvent}, gotEvents)
|
||||
if len(gotEvents) != 1 || !reflect.DeepEqual(gotEvents[0], wantEvent) {
|
||||
t.Errorf("unexpected events: got %v, want %v", gotEvents, wantEvent)
|
||||
}
|
||||
|
||||
// test reset
|
||||
es = EventsService(ctx, "auth")
|
||||
require.Nil(t, es.GetEvents(ctx))
|
||||
require.Nil(t, es.GetProtoEvents(ctx))
|
||||
if es.GetEvents(ctx) != nil {
|
||||
t.Errorf("expected nil events after reset, got %v", es.GetEvents(ctx))
|
||||
}
|
||||
if es.GetProtoEvents(ctx) != nil {
|
||||
t.Errorf("expected nil proto events after reset, got %v", es.GetProtoEvents(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,14 +6,12 @@ replace cosmossdk.io/core => ../
|
||||
|
||||
require (
|
||||
cosmossdk.io/core v0.12.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/cosmos/gogoproto v1.5.0
|
||||
github.com/tidwall/btree v1.7.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
)
|
||||
|
||||
@ -1,20 +1,11 @@
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
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/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o=
|
||||
github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
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/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI=
|
||||
github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
package coretesting
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/core/store"
|
||||
)
|
||||
|
||||
@ -13,47 +12,89 @@ func TestMemDB(t *testing.T) {
|
||||
var db store.KVStore = NewMemKV()
|
||||
|
||||
key, value := []byte("key"), []byte("value")
|
||||
require.NoError(t, db.Set(key, value))
|
||||
if err := db.Set(key, value); err != nil {
|
||||
t.Errorf("Error setting value: %s", err)
|
||||
}
|
||||
val, err := db.Get(key)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, value, val)
|
||||
require.NoError(t, db.Delete(key))
|
||||
if err != nil {
|
||||
t.Errorf("Error getting value: %s", err)
|
||||
}
|
||||
if !bytes.Equal(value, val) {
|
||||
t.Errorf("Expected value %s, got %s", value, val)
|
||||
}
|
||||
if err := db.Delete(key); err != nil {
|
||||
t.Errorf("Error deleting value: %s", err)
|
||||
}
|
||||
has, err := db.Has(key)
|
||||
require.NoError(t, err)
|
||||
require.False(t, has)
|
||||
if err != nil {
|
||||
t.Errorf("Error checking if key exists: %s", err)
|
||||
}
|
||||
if has {
|
||||
t.Errorf("Expected key to be deleted, but it still exists")
|
||||
}
|
||||
|
||||
// test iter
|
||||
makeKey := func(i int) []byte {
|
||||
return []byte(fmt.Sprintf("key_%d", i))
|
||||
}
|
||||
for i := 0; i < 10; i++ {
|
||||
require.NoError(t, db.Set(makeKey(i), makeKey(i)))
|
||||
if err := db.Set(makeKey(i), makeKey(i)); err != nil {
|
||||
t.Errorf("Error setting value: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
iter, err := db.Iterator(nil, nil)
|
||||
require.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("Error creating iterator: %s", err)
|
||||
}
|
||||
key = iter.Key()
|
||||
value = iter.Value()
|
||||
require.Equal(t, makeKey(0), key)
|
||||
require.Equal(t, makeKey(0), value)
|
||||
require.NoError(t, iter.Error())
|
||||
if !bytes.Equal(makeKey(0), key) {
|
||||
t.Errorf("Expected key %s, got %s", makeKey(0), key)
|
||||
}
|
||||
if !bytes.Equal(makeKey(0), value) {
|
||||
t.Errorf("Expected value %s, got %s", makeKey(0), value)
|
||||
}
|
||||
if err := iter.Error(); err != nil {
|
||||
t.Errorf("Iterator error: %s", err)
|
||||
}
|
||||
iter.Next()
|
||||
key, value = iter.Key(), iter.Value()
|
||||
require.Equal(t, makeKey(1), key)
|
||||
require.Equal(t, makeKey(1), value)
|
||||
require.NoError(t, iter.Close())
|
||||
if !bytes.Equal(makeKey(1), key) {
|
||||
t.Errorf("Expected key %s, got %s", makeKey(1), key)
|
||||
}
|
||||
if !bytes.Equal(makeKey(1), value) {
|
||||
t.Errorf("Expected value %s, got %s", makeKey(1), value)
|
||||
}
|
||||
if err := iter.Close(); err != nil {
|
||||
t.Errorf("Error closing iterator: %s", err)
|
||||
}
|
||||
|
||||
// test reverse iter
|
||||
iter, err = db.ReverseIterator(nil, nil)
|
||||
require.NoError(t, err)
|
||||
if err != nil {
|
||||
t.Errorf("Error creating reverse iterator: %s", err)
|
||||
}
|
||||
key = iter.Key()
|
||||
value = iter.Value()
|
||||
require.Equal(t, makeKey(9), key)
|
||||
require.Equal(t, makeKey(9), value)
|
||||
require.NoError(t, iter.Error())
|
||||
if !bytes.Equal(makeKey(9), key) {
|
||||
t.Errorf("Expected key %s, got %s", makeKey(9), key)
|
||||
}
|
||||
if !bytes.Equal(makeKey(9), value) {
|
||||
t.Errorf("Expected value %s, got %s", makeKey(9), value)
|
||||
}
|
||||
if err := iter.Error(); err != nil {
|
||||
t.Errorf("Iterator error: %s", err)
|
||||
}
|
||||
iter.Next()
|
||||
key, value = iter.Key(), iter.Value()
|
||||
require.Equal(t, makeKey(8), key)
|
||||
require.Equal(t, makeKey(8), value)
|
||||
require.NoError(t, iter.Close())
|
||||
if !bytes.Equal(makeKey(8), key) {
|
||||
t.Errorf("Expected key %s, got %s", makeKey(8), key)
|
||||
}
|
||||
if !bytes.Equal(makeKey(8), value) {
|
||||
t.Errorf("Expected value %s, got %s", makeKey(8), value)
|
||||
}
|
||||
if err := iter.Close(); err != nil {
|
||||
t.Errorf("Error closing iterator: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,6 @@ package coretesting
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestKVStoreService(t *testing.T) {
|
||||
@ -13,23 +11,37 @@ func TestKVStoreService(t *testing.T) {
|
||||
|
||||
// must panic
|
||||
t.Run("must panic on invalid ctx", func(t *testing.T) {
|
||||
require.Panics(t, func() {
|
||||
svc1.OpenKVStore(context.Background())
|
||||
})
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Errorf("expected panic, but got none")
|
||||
}
|
||||
}()
|
||||
|
||||
svc1.OpenKVStore(context.Background())
|
||||
})
|
||||
|
||||
t.Run("success", func(t *testing.T) {
|
||||
kv := svc1.OpenKVStore(ctx)
|
||||
require.NoError(t, kv.Set([]byte("key"), []byte("value")))
|
||||
err := kv.Set([]byte("key"), []byte("value"))
|
||||
if err != nil {
|
||||
t.Errorf("failed to set value: %v", err)
|
||||
}
|
||||
|
||||
value, err := kv.Get([]byte("key"))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []byte("value"), value)
|
||||
if err != nil {
|
||||
t.Errorf("failed to get value: %v", err)
|
||||
}
|
||||
|
||||
if string(value) != "value" {
|
||||
t.Errorf("expected value 'value', but got '%s'", string(value))
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("contains module name", func(t *testing.T) {
|
||||
KVStoreService(ctx, "auth")
|
||||
_, ok := unwrap(ctx).stores["auth"]
|
||||
require.True(t, ok)
|
||||
if !ok {
|
||||
t.Errorf("expected store 'auth' to exist, but it doesn't")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package runtime
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
|
||||
@ -34,7 +34,7 @@ func NewEventManager(ctx context.Context) event.Manager {
|
||||
|
||||
// Emit emits an typed event that is defined in the protobuf file.
|
||||
// In the future these events will be added to consensus.
|
||||
func (e Events) Emit(event protoiface.MessageV1) error {
|
||||
func (e Events) Emit(event gogoproto.Message) error {
|
||||
return e.EventManagerI.EmitTypedEvent(event)
|
||||
}
|
||||
|
||||
|
||||
@ -6,9 +6,8 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
protov2 "google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
"cosmossdk.io/core/router"
|
||||
|
||||
@ -48,7 +47,7 @@ func (m *msgRouterService) CanInvoke(ctx context.Context, typeURL string) error
|
||||
// InvokeTyped execute a message and fill-in a response.
|
||||
// The response must be known and passed as a parameter.
|
||||
// Use InvokeUntyped if the response type is not known.
|
||||
func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp protoiface.MessageV1) error {
|
||||
func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp gogoproto.Message) error {
|
||||
messageName := msgTypeURL(msg)
|
||||
handler := m.router.HybridHandlerByMsgName(messageName)
|
||||
if handler == nil {
|
||||
@ -59,7 +58,7 @@ func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp protoiface
|
||||
}
|
||||
|
||||
// InvokeUntyped execute a message and returns a response.
|
||||
func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg protoiface.MessageV1) (protoiface.MessageV1, error) {
|
||||
func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) {
|
||||
messageName := msgTypeURL(msg)
|
||||
respName := m.router.ResponseNameByMsgName(messageName)
|
||||
if respName == "" {
|
||||
@ -67,11 +66,11 @@ func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg protoiface.Mes
|
||||
}
|
||||
|
||||
// get response type
|
||||
typ := proto.MessageType(respName)
|
||||
typ := gogoproto.MessageType(respName)
|
||||
if typ == nil {
|
||||
return nil, fmt.Errorf("no message type found for %s", respName)
|
||||
}
|
||||
msgResp, ok := reflect.New(typ.Elem()).Interface().(protoiface.MessageV1)
|
||||
msgResp, ok := reflect.New(typ.Elem()).Interface().(gogoproto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("could not create response message %s", respName)
|
||||
}
|
||||
@ -113,7 +112,7 @@ func (m *queryRouterService) CanInvoke(ctx context.Context, typeURL string) erro
|
||||
// InvokeTyped execute a message and fill-in a response.
|
||||
// The response must be known and passed as a parameter.
|
||||
// Use InvokeUntyped if the response type is not known.
|
||||
func (m *queryRouterService) InvokeTyped(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
func (m *queryRouterService) InvokeTyped(ctx context.Context, req, resp gogoproto.Message) error {
|
||||
reqName := msgTypeURL(req)
|
||||
handlers := m.router.HybridHandlerByRequestName(reqName)
|
||||
if len(handlers) == 0 {
|
||||
@ -126,7 +125,7 @@ func (m *queryRouterService) InvokeTyped(ctx context.Context, req, resp protoifa
|
||||
}
|
||||
|
||||
// InvokeUntyped execute a message and returns a response.
|
||||
func (m *queryRouterService) InvokeUntyped(ctx context.Context, req protoiface.MessageV1) (protoiface.MessageV1, error) {
|
||||
func (m *queryRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Message) (gogoproto.Message, error) {
|
||||
reqName := msgTypeURL(req)
|
||||
respName := m.router.ResponseNameByRequestName(reqName)
|
||||
if respName == "" {
|
||||
@ -134,11 +133,11 @@ func (m *queryRouterService) InvokeUntyped(ctx context.Context, req protoiface.M
|
||||
}
|
||||
|
||||
// get response type
|
||||
typ := proto.MessageType(respName)
|
||||
typ := gogoproto.MessageType(respName)
|
||||
if typ == nil {
|
||||
return nil, fmt.Errorf("no message type found for %s", respName)
|
||||
}
|
||||
reqResp, ok := reflect.New(typ.Elem()).Interface().(protoiface.MessageV1)
|
||||
reqResp, ok := reflect.New(typ.Elem()).Interface().(gogoproto.Message)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("could not create response request %s", respName)
|
||||
}
|
||||
@ -147,10 +146,10 @@ func (m *queryRouterService) InvokeUntyped(ctx context.Context, req protoiface.M
|
||||
}
|
||||
|
||||
// msgTypeURL returns the TypeURL of a proto message.
|
||||
func msgTypeURL(msg proto.Message) string {
|
||||
func msgTypeURL(msg gogoproto.Message) string {
|
||||
if m, ok := msg.(protov2.Message); ok {
|
||||
return string(m.ProtoReflect().Descriptor().FullName())
|
||||
}
|
||||
|
||||
return proto.MessageName(msg)
|
||||
return gogoproto.MessageName(msg)
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ type Consensus[T transaction.Tx] struct {
|
||||
|
||||
// this is only available after this node has committed a block (in FinalizeBlock),
|
||||
// otherwise it will be empty and we will need to query the app for the last
|
||||
// committed block. TODO(tip): check if concurrency is really needed
|
||||
lastCommittedBlock atomic.Pointer[BlockData]
|
||||
// committed block.
|
||||
lastCommittedHeight atomic.Int64
|
||||
|
||||
prepareProposalHandler handlers.PrepareHandler[T]
|
||||
processProposalHandler handlers.ProcessHandler[T]
|
||||
@ -90,15 +90,6 @@ func (c *Consensus[T]) RegisterExtensions(extensions ...snapshots.ExtensionSnaps
|
||||
}
|
||||
}
|
||||
|
||||
// BlockData is used to keep some data about the last committed block. Currently
|
||||
// we only use the height, the rest is not needed right now and might get removed
|
||||
// in the future.
|
||||
type BlockData struct {
|
||||
Height int64
|
||||
Hash []byte
|
||||
StateChanges []store.StateChanges
|
||||
}
|
||||
|
||||
// CheckTx implements types.Application.
|
||||
// It is called by cometbft to verify transaction validity
|
||||
func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error) {
|
||||
@ -407,10 +398,7 @@ func (c *Consensus[T]) FinalizeBlock(
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to commit the changeset: %w", err)
|
||||
}
|
||||
c.lastCommittedBlock.Store(&BlockData{
|
||||
Height: req.Height,
|
||||
Hash: appHash,
|
||||
})
|
||||
c.lastCommittedHeight.Store(req.Height)
|
||||
return &abciproto.FinalizeBlockResponse{
|
||||
AppHash: appHash,
|
||||
}, nil
|
||||
@ -482,11 +470,7 @@ func (c *Consensus[T]) FinalizeBlock(
|
||||
return nil, fmt.Errorf("unable to remove txs: %w", err)
|
||||
}
|
||||
|
||||
c.lastCommittedBlock.Store(&BlockData{
|
||||
Height: req.Height,
|
||||
Hash: appHash,
|
||||
StateChanges: stateChanges,
|
||||
})
|
||||
c.lastCommittedHeight.Store(req.Height)
|
||||
|
||||
cp, err := c.GetConsensusParams(ctx) // we get the consensus params from the latest state because we committed state above
|
||||
if err != nil {
|
||||
@ -499,9 +483,9 @@ func (c *Consensus[T]) FinalizeBlock(
|
||||
// Commit implements types.Application.
|
||||
// It is called by cometbft to notify the application that a block was committed.
|
||||
func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error) {
|
||||
lastCommittedBlock := c.lastCommittedBlock.Load()
|
||||
lastCommittedHeight := c.lastCommittedHeight.Load()
|
||||
|
||||
c.snapshotManager.SnapshotIfApplicable(lastCommittedBlock.Height)
|
||||
c.snapshotManager.SnapshotIfApplicable(lastCommittedHeight)
|
||||
|
||||
cp, err := c.GetConsensusParams(ctx)
|
||||
if err != nil {
|
||||
@ -509,7 +493,7 @@ func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (
|
||||
}
|
||||
|
||||
return &abci.CommitResponse{
|
||||
RetainHeight: c.GetBlockRetentionHeight(cp, lastCommittedBlock.Height),
|
||||
RetainHeight: c.GetBlockRetentionHeight(cp, lastCommittedHeight),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
gogotypes "github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
appmodulev2 "cosmossdk.io/core/appmodule/v2"
|
||||
"cosmossdk.io/server/v2/stf/branch"
|
||||
@ -38,7 +38,7 @@ func TestBranchService(t *testing.T) {
|
||||
makeGasMeter: gas.DefaultGasMeter,
|
||||
makeGasMeteredState: gas.DefaultWrapWithGasMeter,
|
||||
}
|
||||
addMsgHandlerToSTF(t, s, func(ctx context.Context, msg *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) {
|
||||
addMsgHandlerToSTF(t, s, func(ctx context.Context, msg *gogotypes.BoolValue) (*gogotypes.BoolValue, error) {
|
||||
kvSet(t, ctx, "exec")
|
||||
return nil, nil
|
||||
})
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"golang.org/x/exp/maps"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
)
|
||||
@ -31,7 +30,7 @@ type eventManager struct {
|
||||
|
||||
// Emit emits an typed event that is defined in the protobuf file.
|
||||
// In the future these events will be added to consensus.
|
||||
func (em *eventManager) Emit(tev protoiface.MessageV1) error {
|
||||
func (em *eventManager) Emit(tev gogoproto.Message) error {
|
||||
res, err := TypedEventToEvent(tev)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -49,7 +48,7 @@ func (em *eventManager) EmitKV(eventType string, attrs ...event.Attribute) error
|
||||
|
||||
// EmitNonConsensus emits an typed event that is defined in the protobuf file.
|
||||
// These events will not be added to consensus.
|
||||
func (em *eventManager) EmitNonConsensus(event protoiface.MessageV1) error {
|
||||
func (em *eventManager) EmitNonConsensus(event gogoproto.Message) error {
|
||||
return em.Emit(event)
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package stf
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/core/router"
|
||||
"cosmossdk.io/core/transaction"
|
||||
@ -31,12 +31,12 @@ func (m msgRouterService) CanInvoke(ctx context.Context, typeURL string) error {
|
||||
// InvokeTyped execute a message and fill-in a response.
|
||||
// The response must be known and passed as a parameter.
|
||||
// Use InvokeUntyped if the response type is not known.
|
||||
func (m msgRouterService) InvokeTyped(ctx context.Context, msg, resp protoiface.MessageV1) error {
|
||||
func (m msgRouterService) InvokeTyped(ctx context.Context, msg, resp gogoproto.Message) error {
|
||||
return ctx.(*executionContext).msgRouter.InvokeTyped(ctx, msg, resp)
|
||||
}
|
||||
|
||||
// InvokeUntyped execute a message and returns a response.
|
||||
func (m msgRouterService) InvokeUntyped(ctx context.Context, msg protoiface.MessageV1) (protoiface.MessageV1, error) {
|
||||
func (m msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) {
|
||||
return ctx.(*executionContext).msgRouter.InvokeUntyped(ctx, msg)
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ func (m queryRouterService) CanInvoke(ctx context.Context, typeURL string) error
|
||||
// Use InvokeUntyped if the response type is not known.
|
||||
func (m queryRouterService) InvokeTyped(
|
||||
ctx context.Context,
|
||||
req, resp protoiface.MessageV1,
|
||||
req, resp gogoproto.Message,
|
||||
) error {
|
||||
return ctx.(*executionContext).queryRouter.InvokeTyped(ctx, req, resp)
|
||||
}
|
||||
@ -67,7 +67,7 @@ func (m queryRouterService) InvokeTyped(
|
||||
// InvokeUntyped execute a message and returns a response.
|
||||
func (m queryRouterService) InvokeUntyped(
|
||||
ctx context.Context,
|
||||
req protoiface.MessageV1,
|
||||
) (protoiface.MessageV1, error) {
|
||||
req gogoproto.Message,
|
||||
) (gogoproto.Message, error) {
|
||||
return ctx.(*executionContext).queryRouter.InvokeUntyped(ctx, req)
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ require (
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tidwall/btree v1.7.0
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
@ -18,5 +17,6 @@ require (
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/kr/text v0.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"reflect"
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
appmodulev2 "cosmossdk.io/core/appmodule/v2"
|
||||
"cosmossdk.io/core/router"
|
||||
@ -155,7 +154,7 @@ func (r Router) CanInvoke(_ context.Context, typeURL string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Router) InvokeTyped(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
func (r Router) InvokeTyped(ctx context.Context, req, resp gogoproto.Message) error {
|
||||
handlerResp, err := r.InvokeUntyped(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -164,11 +163,11 @@ func (r Router) InvokeTyped(ctx context.Context, req, resp protoiface.MessageV1)
|
||||
return nil
|
||||
}
|
||||
|
||||
func merge(src, dst protoiface.MessageV1) {
|
||||
func merge(src, dst gogoproto.Message) {
|
||||
reflect.Indirect(reflect.ValueOf(dst)).Set(reflect.Indirect(reflect.ValueOf(src)))
|
||||
}
|
||||
|
||||
func (r Router) InvokeUntyped(ctx context.Context, req protoiface.MessageV1) (res protoiface.MessageV1, err error) {
|
||||
func (r Router) InvokeUntyped(ctx context.Context, req gogoproto.Message) (res gogoproto.Message, err error) {
|
||||
typeName := msgTypeURL(req)
|
||||
handler, exists := r.handlers[typeName]
|
||||
if !exists {
|
||||
|
||||
@ -8,8 +8,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
gogotypes "github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
appmanager "cosmossdk.io/core/app"
|
||||
appmodulev2 "cosmossdk.io/core/appmodule/v2"
|
||||
@ -57,7 +57,7 @@ func TestSTF(t *testing.T) {
|
||||
state := mock.DB()
|
||||
mockTx := mock.Tx{
|
||||
Sender: []byte("sender"),
|
||||
Msg: wrapperspb.Bool(true),
|
||||
Msg: &gogotypes.BoolValue{Value: true},
|
||||
GasLimit: 100_000,
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ func TestSTF(t *testing.T) {
|
||||
makeGasMeteredState: gas.DefaultWrapWithGasMeter,
|
||||
}
|
||||
|
||||
addMsgHandlerToSTF(t, s, func(ctx context.Context, msg *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) {
|
||||
addMsgHandlerToSTF(t, s, func(ctx context.Context, msg *gogotypes.BoolValue) (*gogotypes.BoolValue, error) {
|
||||
kvSet(t, ctx, "exec")
|
||||
return nil, nil
|
||||
})
|
||||
@ -128,8 +128,8 @@ func TestSTF(t *testing.T) {
|
||||
|
||||
mockTx := mock.Tx{
|
||||
Sender: []byte("sender"),
|
||||
Msg: wrapperspb.Bool(true), // msg does not matter at all because our handler does nothing.
|
||||
GasLimit: 0, // NO GAS!
|
||||
Msg: &gogotypes.BoolValue{Value: true}, // msg does not matter at all because our handler does nothing.
|
||||
GasLimit: 0, // NO GAS!
|
||||
}
|
||||
|
||||
// this handler will propagate the storage error back, we expect
|
||||
@ -157,7 +157,7 @@ func TestSTF(t *testing.T) {
|
||||
t.Run("fail exec tx", func(t *testing.T) {
|
||||
// update the stf to fail on the handler
|
||||
s := s.clone()
|
||||
addMsgHandlerToSTF(t, &s, func(ctx context.Context, msg *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) {
|
||||
addMsgHandlerToSTF(t, &s, func(ctx context.Context, msg *gogotypes.BoolValue) (*gogotypes.BoolValue, error) {
|
||||
return nil, fmt.Errorf("failure")
|
||||
})
|
||||
|
||||
@ -200,7 +200,7 @@ func TestSTF(t *testing.T) {
|
||||
|
||||
t.Run("tx failed and post tx failed", func(t *testing.T) {
|
||||
s := s.clone()
|
||||
addMsgHandlerToSTF(t, &s, func(ctx context.Context, msg *wrapperspb.BoolValue) (*wrapperspb.BoolValue, error) {
|
||||
addMsgHandlerToSTF(t, &s, func(ctx context.Context, msg *gogotypes.BoolValue) (*gogotypes.BoolValue, error) {
|
||||
return nil, fmt.Errorf("exec failure")
|
||||
})
|
||||
s.postTxExec = func(ctx context.Context, tx mock.Tx, success bool) error { return fmt.Errorf("post tx failure") }
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
"github.com/golang/mock/gomock"
|
||||
"gotest.tools/v3/assert"
|
||||
|
||||
@ -326,7 +325,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
|
||||
|
||||
nci := comet.Info{Evidence: []comet.Evidence{{
|
||||
Validator: comet.Validator{Address: valpubkey.Address(), Power: power},
|
||||
Type: comet.MisbehaviorType(abci.MISBEHAVIOR_TYPE_DUPLICATE_VOTE),
|
||||
Type: comet.DuplicateVote, //
|
||||
Time: ctx.HeaderInfo().Time,
|
||||
Height: 0,
|
||||
}}}
|
||||
@ -407,7 +406,7 @@ func TestHandleDoubleSignAfterRotation(t *testing.T) {
|
||||
nci := comet.Info{
|
||||
Evidence: []comet.Evidence{{
|
||||
Validator: comet.Validator{Address: valpubkey.Address(), Power: power},
|
||||
Type: comet.MisbehaviorType(abci.MISBEHAVIOR_TYPE_DUPLICATE_VOTE),
|
||||
Type: comet.DuplicateVote,
|
||||
Time: time.Unix(0, 0),
|
||||
Height: 0,
|
||||
}},
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/address"
|
||||
@ -37,8 +37,8 @@ var (
|
||||
)
|
||||
|
||||
type InterfaceRegistry interface {
|
||||
RegisterInterface(name string, iface any, impls ...protoiface.MessageV1)
|
||||
RegisterImplementations(iface any, impls ...protoiface.MessageV1)
|
||||
RegisterInterface(name string, iface any, impls ...gogoproto.Message)
|
||||
RegisterImplementations(iface any, impls ...gogoproto.Message)
|
||||
}
|
||||
|
||||
func NewKeeper(
|
||||
|
||||
@ -7,14 +7,13 @@ import (
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
|
||||
"cosmossdk.io/core/address"
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/core/log"
|
||||
"cosmossdk.io/core/testing"
|
||||
coretesting "cosmossdk.io/core/testing"
|
||||
coretransaction "cosmossdk.io/core/transaction"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
"cosmossdk.io/x/tx/signing"
|
||||
@ -34,7 +33,7 @@ func (a addressCodec) BytesToString(bz []byte) (string, error) { return string
|
||||
|
||||
type eventService struct{}
|
||||
|
||||
func (e eventService) Emit(event protoiface.MessageV1) error { return nil }
|
||||
func (e eventService) Emit(event gogoproto.Message) error { return nil }
|
||||
|
||||
func (e eventService) EmitKV(eventType string, attrs ...event.Attribute) error {
|
||||
return nil
|
||||
|
||||
Loading…
Reference in New Issue
Block a user