From 178ba981ff7ebb9ede5d03b2214d2b4c4dc50c1c Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Aug 2024 21:38:06 +0000 Subject: [PATCH 1/3] refactor(core,stf,x)!: remove InvokeTyped from router (#21224) (cherry picked from commit a554a21a0e846dc4b5edae2fc365e158c23365c2) # Conflicts: # core/router/service.go # schema/appdata/batch_test.go # schema/diff/diff_test.go # server/v2/stf/core_router_service.go # server/v2/stf/stf.go # server/v2/stf/stf_router.go # server/v2/stf/stf_router_test.go # tools/cosmovisor/cmd/cosmovisor/version_test.go # x/accounts/defaults/lockup/go.mod # x/accounts/go.mod # x/accounts/go.sum # x/group/go.sum --- core/router/service.go | 16 + docs/rfc/rfc-006-handlers.md | 16 +- runtime/router.go | 62 +- runtime/router_test.go | 55 +- schema/appdata/batch_test.go | 85 +++ schema/diff/diff_test.go | 335 ++++++++++ scripts/mockgen.sh | 4 +- server/v2/stf/core_router_service.go | 74 +++ server/v2/stf/stf.go | 625 ++++++++++++++++++ server/v2/stf/stf_router.go | 170 +++++ server/v2/stf/stf_router_test.go | 48 ++ simapp/mint_fn.go | 31 +- tests/e2e/accounts/lockup/utils.go | 6 +- tests/e2e/accounts/multisig/test_suite.go | 6 +- testutil/mock/types_module_module.go | 62 ++ .../cosmovisor/cmd/cosmovisor/version_test.go | 27 + types/module/module.go | 2 +- x/accounts/account_test.go | 29 +- x/accounts/accountstd/exports.go | 18 +- x/accounts/accountstd/test_util.go | 5 +- x/accounts/coin_transfer.go | 48 +- x/accounts/defaults/base/account.go | 9 +- x/accounts/defaults/base/utils_test.go | 19 +- x/accounts/defaults/lockup/go.mod | 18 + x/accounts/defaults/lockup/lockup.go | 22 +- x/accounts/defaults/lockup/utils_test.go | 38 +- x/accounts/defaults/multisig/account_test.go | 20 +- x/accounts/defaults/multisig/utils_test.go | 21 +- x/accounts/go.mod | 13 + x/accounts/go.sum | 5 + .../internal/implementation/api_builder.go | 18 +- x/accounts/internal/implementation/context.go | 63 +- .../internal/implementation/context_test.go | 29 +- .../internal/implementation/encoding.go | 21 +- .../internal/implementation/implementation.go | 15 +- .../internal/implementation/protoaccount.go | 8 +- x/accounts/keeper.go | 61 +- x/auth/ante/setup.go | 9 +- x/auth/client/cli/tx_multisign.go | 2 +- x/auth/keeper/keeper.go | 2 +- x/auth/keeper/msg_server_test.go | 2 +- x/auth/testutil/expected_keepers_mocks.go | 16 +- x/auth/types/expected_keepers.go | 4 +- .../testutil/expected_keepers_mocks.go | 16 +- x/authz/client/cli/tx.go | 4 +- x/authz/keeper/keeper.go | 2 +- x/evidence/keeper/infraction.go | 9 +- x/gov/keeper/abci.go | 2 +- x/gov/keeper/abci_internal_test.go | 2 +- x/gov/keeper/msg_server.go | 7 +- x/group/go.mod | 2 + x/group/go.sum | 5 + x/group/keeper/proposal_executor.go | 2 +- x/staking/keeper/msg_server.go | 18 +- x/upgrade/keeper/abci.go | 10 +- 55 files changed, 1809 insertions(+), 409 deletions(-) create mode 100644 core/router/service.go create mode 100644 schema/appdata/batch_test.go create mode 100644 schema/diff/diff_test.go create mode 100644 server/v2/stf/core_router_service.go create mode 100644 server/v2/stf/stf.go create mode 100644 server/v2/stf/stf_router.go create mode 100644 server/v2/stf/stf_router_test.go create mode 100644 tools/cosmovisor/cmd/cosmovisor/version_test.go diff --git a/core/router/service.go b/core/router/service.go new file mode 100644 index 000000000000..95c65f851e0c --- /dev/null +++ b/core/router/service.go @@ -0,0 +1,16 @@ +package router + +import ( + "context" + + "cosmossdk.io/core/transaction" +) + +// Service is the interface that wraps the basic methods for a router. +// A router can be a query router or a message router. +type Service interface { + // CanInvoke returns an error if the given request cannot be invoked. + CanInvoke(ctx context.Context, typeURL string) error + // Invoke execute a message or query. The response should be type casted by the caller to the expected response. + Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) +} diff --git a/docs/rfc/rfc-006-handlers.md b/docs/rfc/rfc-006-handlers.md index 479b2006300f..a22992ccdb0c 100644 --- a/docs/rfc/rfc-006-handlers.md +++ b/docs/rfc/rfc-006-handlers.md @@ -79,11 +79,11 @@ import ( type PreMsgHandlerRouter interface { // RegisterGlobalPreMsgHandler will register a pre msg handler that hooks before any message executes. // Handler will be called before ANY message executes. - RegisterGlobalPreMsgHandler(handler func(ctx context.Context, msg protoiface.MessageV1) error) + RegisterGlobalPreMsgHandler(handler func(ctx context.Context, msg transaction.Msg) error) // RegisterPreMsgHandler will register a pre msg handler that hooks before the provided message // with the given message name executes. Handler will be called before the message is executed // by the module. - RegisterPreMsgHandler(msgName string, handler func(ctx context.Context, msg protoiface.MessageV1) error) + RegisterPreMsgHandler(msgName string, handler func(ctx context.Context, msg transaction.Msg) error) } type HasPreMsgHandler interface { @@ -105,11 +105,11 @@ import ( type PostMsgHandlerRouter interface { // RegisterGlobalPostMsgHandler will register a post msg handler that hooks after any message executes. // Handler will be called after ANY message executes, alongside the response. - RegisterGlobalPostMsgHandler(handler func(ctx context.Context, msg, msgResp protoiface.MessageV1) error) + RegisterGlobalPostMsgHandler(handler func(ctx context.Context, msg, msgResp transaction.Msg) error) // RegisterPostMsgHandler will register a pre msg handler that hooks after the provided message // with the given message name executes. Handler will be called after the message is executed // by the module, alongside the response returned by the module. - RegisterPostMsgHandler(msgName string, handler func(ctx context.Context, msg, msgResp protoiface.MessageV1) error) + RegisterPostMsgHandler(msgName string, handler func(ctx context.Context, msg, msgResp transaction.Msg) error) } type HasPostMsgHandler interface { @@ -142,7 +142,7 @@ import ( ) type MsgHandlerRouter interface { - RegisterMsgHandler(msgName string, handler func(ctx context.Context, msg protoiface.MessageV1) (msgResp protoiface.MessageV1, err error)) + RegisterMsgHandler(msgName string, handler func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error)) } type HasMsgHandler interface { @@ -150,7 +150,7 @@ type HasMsgHandler interface { } // RegisterMsgHandler is a helper function to retain type safety when creating handlers, so we do not need to cast messages. -func RegisterMsgHandler[Req, Resp protoiface.MessageV1](router MsgHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { +func RegisterMsgHandler[Req, Resp transaction.Msg](router MsgHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { // impl detail } ``` @@ -186,7 +186,7 @@ import ( ) type QueryHandlerRouter interface { - RegisterQueryHandler(msgName string, handler func(ctx context.Context, req protoiface.MessageV1) (resp protoiface.MessageV1, err error)) + RegisterQueryHandler(msgName string, handler func(ctx context.Context, req transaction.Msg) (resp transaction.Msg, err error)) } type HasQueryHandler interface { @@ -194,7 +194,7 @@ type HasQueryHandler interface { } // RegisterQueryHandler is a helper function to retain type safety when creating handlers, so we do not need to cast messages. -func RegisterQueryHandler[Req, Resp protoiface.MessageV1](router QueryHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { +func RegisterQueryHandler[Req, Resp transaction.Msg](router QueryHandlerRouter, handler func(ctx context.Context, req Req) (resp Resp, err error)) { // impl detail } diff --git a/runtime/router.go b/runtime/router.go index 8c30f2a27929..86ba89289d47 100644 --- a/runtime/router.go +++ b/runtime/router.go @@ -45,21 +45,8 @@ func (m *msgRouterService) CanInvoke(ctx context.Context, typeURL string) error return nil } -// 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 gogoproto.Message) error { - messageName := msgTypeURL(msg) - handler := m.router.HybridHandlerByMsgName(messageName) - if handler == nil { - return fmt.Errorf("unknown message: %s", messageName) - } - - return handler(ctx, msg, resp) -} - -// InvokeUntyped execute a message and returns a response. -func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) { +// Invoke execute a message and returns a response. +func (m *msgRouterService) Invoke(ctx context.Context, msg gogoproto.Message) (gogoproto.Message, error) { messageName := msgTypeURL(msg) respName := m.router.ResponseNameByMsgName(messageName) if respName == "" { @@ -76,7 +63,16 @@ func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg gogoproto.Mess return nil, fmt.Errorf("could not create response message %s", respName) } - return msgResp, m.InvokeTyped(ctx, msg, msgResp) + handler := m.router.HybridHandlerByMsgName(messageName) + if handler == nil { + return nil, fmt.Errorf("unknown message: %s", messageName) + } + + if err := handler(ctx, msg, msgResp); err != nil { + return nil, err + } + + return msgResp, nil } // NewQueryRouterService implements router.Service. @@ -110,27 +106,12 @@ func (m *queryRouterService) CanInvoke(ctx context.Context, typeURL string) erro return nil } -// 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 gogoproto.Message) error { - reqName := msgTypeURL(req) - handlers := m.router.HybridHandlerByRequestName(reqName) - if len(handlers) == 0 { - return fmt.Errorf("unknown request: %s", reqName) - } else if len(handlers) > 1 { - return fmt.Errorf("ambiguous request, query have multiple handlers: %s", reqName) - } - - return handlers[0](ctx, req, resp) -} - -// InvokeUntyped execute a message and returns a response. -func (m *queryRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Message) (gogoproto.Message, error) { +// Invoke execute a message and returns a response. +func (m *queryRouterService) Invoke(ctx context.Context, req gogoproto.Message) (gogoproto.Message, error) { reqName := msgTypeURL(req) respName := m.router.ResponseNameByRequestName(reqName) if respName == "" { - return nil, fmt.Errorf("could not find response type for request %s (%T)", reqName, req) + return nil, fmt.Errorf("unknown request: could not find response type for request %s (%T)", reqName, req) } // get response type @@ -143,7 +124,18 @@ func (m *queryRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Me return nil, fmt.Errorf("could not create response request %s", respName) } - return reqResp, m.InvokeTyped(ctx, req, reqResp) + handlers := m.router.HybridHandlerByRequestName(reqName) + if len(handlers) == 0 { + return nil, fmt.Errorf("unknown request: %s", reqName) + } else if len(handlers) > 1 { + return nil, fmt.Errorf("ambiguous request, query have multiple handlers: %s", reqName) + } + + if err := handlers[0](ctx, req, reqResp); err != nil { + return nil, err + } + + return reqResp, nil } // msgTypeURL returns the TypeURL of a proto message. diff --git a/runtime/router_test.go b/runtime/router_test.go index 2eec2197a4db..00e20ccdd091 100644 --- a/runtime/router_test.go +++ b/runtime/router_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - counterv1 "cosmossdk.io/api/cosmos/counter/v1" coretesting "cosmossdk.io/core/testing" storetypes "cosmossdk.io/store/types" @@ -38,12 +37,12 @@ func TestRouterService(t *testing.T) { // Messages t.Run("invalid msg", func(t *testing.T) { - _, err := messageRouterService.InvokeUntyped(testCtx.Ctx, &bankv1beta1.MsgSend{}) + _, err := messageRouterService.Invoke(testCtx.Ctx, &bankv1beta1.MsgSend{}) require.ErrorContains(t, err, "could not find response type for message cosmos.bank.v1beta1.MsgSend") }) - t.Run("invoke untyped: valid msg (proto v1)", func(t *testing.T) { - resp, err := messageRouterService.InvokeUntyped(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ + t.Run("invoke: valid msg (proto v1)", func(t *testing.T) { + resp, err := messageRouterService.Invoke(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ Signer: "cosmos1", Count: 42, }) @@ -51,57 +50,17 @@ func TestRouterService(t *testing.T) { require.NotNil(t, resp) }) - t.Run("invoke typed: valid msg (proto v1)", func(t *testing.T) { - resp := &countertypes.MsgIncreaseCountResponse{} - err := messageRouterService.InvokeTyped(testCtx.Ctx, &countertypes.MsgIncreaseCounter{ - Signer: "cosmos1", - Count: 42, - }, resp) - require.NoError(t, err) - require.NotNil(t, resp) - }) - - t.Run("invoke typed: valid msg (proto v2)", func(t *testing.T) { - resp := &counterv1.MsgIncreaseCountResponse{} - err := messageRouterService.InvokeTyped(testCtx.Ctx, &counterv1.MsgIncreaseCounter{ - Signer: "cosmos1", - Count: 42, - }, resp) - require.NoError(t, err) - require.NotNil(t, resp) - }) - // Queries t.Run("invalid query", func(t *testing.T) { - err := queryRouterService.InvokeTyped(testCtx.Ctx, &bankv1beta1.QueryBalanceRequest{}, &bankv1beta1.QueryBalanceResponse{}) - require.ErrorContains(t, err, "unknown request: cosmos.bank.v1beta1.QueryBalanceRequest") - }) - - t.Run("invoke typed: valid query (proto v1)", func(t *testing.T) { - _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - - resp := &countertypes.QueryGetCountResponse{} - err := queryRouterService.InvokeTyped(testCtx.Ctx, &countertypes.QueryGetCountRequest{}, resp) - require.NoError(t, err) - require.NotNil(t, resp) - require.Equal(t, int64(42), resp.TotalCount) - }) - - t.Run("invoke typed: valid query (proto v2)", func(t *testing.T) { - _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - - resp := &counterv1.QueryGetCountResponse{} - err := queryRouterService.InvokeTyped(testCtx.Ctx, &counterv1.QueryGetCountRequest{}, resp) - require.NoError(t, err) - require.NotNil(t, resp) - require.Equal(t, int64(42), resp.TotalCount) + _, err := queryRouterService.Invoke(testCtx.Ctx, &bankv1beta1.QueryBalanceRequest{}) + require.ErrorContains(t, err, "could not find response type for request cosmos.bank.v1beta1.QueryBalanceRequest") }) - t.Run("invoke untyped: valid query (proto v1)", func(t *testing.T) { + t.Run("invoke: valid query (proto v1)", func(t *testing.T) { _ = counterKeeper.CountStore.Set(testCtx.Ctx, 42) - resp, err := queryRouterService.InvokeUntyped(testCtx.Ctx, &countertypes.QueryGetCountRequest{}) + resp, err := queryRouterService.Invoke(testCtx.Ctx, &countertypes.QueryGetCountRequest{}) require.NoError(t, err) require.NotNil(t, resp) respVal, ok := resp.(*countertypes.QueryGetCountResponse) diff --git a/schema/appdata/batch_test.go b/schema/appdata/batch_test.go new file mode 100644 index 000000000000..0f43f07ba063 --- /dev/null +++ b/schema/appdata/batch_test.go @@ -0,0 +1,85 @@ +package appdata + +import ( + "context" + "reflect" + "testing" +) + +func TestBatch(t *testing.T) { + l, got := batchListener() + + if err := l.SendPacket(testBatch); err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(*got, testBatch) { + t.Errorf("got %v, expected %v", *got, testBatch) + } +} + +var testBatch = PacketBatch{ + ModuleInitializationData{}, + StartBlockData{}, + TxData{}, + EventData{}, + KVPairData{}, + ObjectUpdateData{}, +} + +func batchListener() (Listener, *PacketBatch) { + got := new(PacketBatch) + l := Listener{ + InitializeModuleData: func(m ModuleInitializationData) error { + *got = append(*got, m) + return nil + }, + StartBlock: func(b StartBlockData) error { + *got = append(*got, b) + return nil + }, + OnTx: func(t TxData) error { + *got = append(*got, t) + return nil + }, + OnEvent: func(e EventData) error { + *got = append(*got, e) + return nil + }, + OnKVPair: func(k KVPairData) error { + *got = append(*got, k) + return nil + }, + OnObjectUpdate: func(o ObjectUpdateData) error { + *got = append(*got, o) + return nil + }, + } + + return l, got +} + +func TestBatchAsync(t *testing.T) { + l, got := batchListener() + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + l = AsyncListenerMux(AsyncListenerOptions{Context: ctx}, l) + + if err := l.SendPacket(testBatch); err != nil { + t.Error(err) + } + + // commit to synchronize + cb, err := l.Commit(CommitData{}) + if err != nil { + t.Error(err) + } + if err := cb(); err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(*got, testBatch) { + t.Errorf("got %v, expected %v", *got, testBatch) + } +} diff --git a/schema/diff/diff_test.go b/schema/diff/diff_test.go new file mode 100644 index 000000000000..159d85c3500c --- /dev/null +++ b/schema/diff/diff_test.go @@ -0,0 +1,335 @@ +package diff + +import ( + "reflect" + "testing" + + "cosmossdk.io/schema" +) + +func TestCompareModuleSchemas(t *testing.T) { + tt := []struct { + name string + oldSchema schema.ModuleSchema + newSchema schema.ModuleSchema + diff ModuleSchemaDiff + hasCompatibleChanges bool + empty bool + }{ + { + name: "no change", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{}, + hasCompatibleChanges: true, + empty: true, + }, + { + name: "object type added", + oldSchema: mustModuleSchema(t), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + AddedObjectTypes: []schema.ObjectType{ + { + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "object type removed", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t), + diff: ModuleSchemaDiff{ + RemovedObjectTypes: []schema.ObjectType{ + { + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, key field added", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + KeyFieldsDiff: FieldsDiff{ + Added: []schema.Field{ + {Name: "key2", Kind: schema.StringKind}, + }, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, nullable value field added", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, + }, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "object type changed, non-nullable value field added", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, + ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type changed, fields reordered", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key2", Kind: schema.StringKind}, {Name: "key1", Kind: schema.StringKind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + KeyFieldsDiff: FieldsDiff{ + OldOrder: []string{"key1", "key2"}, + NewOrder: []string{"key2", "key1"}, + }, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "enum type added, nullable value field added", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + ValueFields: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, + Nullable: true, + }, + }, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Added: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, + Nullable: true, + }, + }, + }, + }, + }, + AddedEnumTypes: []schema.EnumType{ + {Name: "enum1", Values: []string{"a", "b"}}, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "enum type removed", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + ValueFields: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, + }, + }, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, + }), + diff: ModuleSchemaDiff{ + ChangedObjectTypes: []ObjectTypeDiff{ + { + Name: "object1", + ValueFieldsDiff: FieldsDiff{ + Removed: []schema.Field{ + { + Name: "value1", + Kind: schema.EnumKind, + EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, + }, + }, + }, + }, + }, + RemovedEnumTypes: []schema.EnumType{ + {Name: "enum1", Values: []string{"a", "b"}}, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "enum value added", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a"}}}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}}}, + }), + diff: ModuleSchemaDiff{ + ChangedEnumTypes: []EnumTypeDiff{ + { + Name: "enum1", + AddedValues: []string{"b"}, + }, + }, + }, + hasCompatibleChanges: true, + }, + { + name: "enum value removed", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b", "c"}}}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "object1", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}}}, + }), + diff: ModuleSchemaDiff{ + ChangedEnumTypes: []EnumTypeDiff{ + { + Name: "enum1", + RemovedValues: []string{"c"}, + }, + }, + }, + hasCompatibleChanges: false, + }, + { + name: "object type and enum type name switched", + oldSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "foo", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "bar", Values: []string{"a"}}}}, + }), + newSchema: mustModuleSchema(t, schema.ObjectType{ + Name: "bar", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "foo", Values: []string{"a"}}}}, + }), + diff: ModuleSchemaDiff{ + RemovedObjectTypes: []schema.ObjectType{ + { + Name: "foo", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "bar", Values: []string{"a"}}}}, + }, + }, + AddedObjectTypes: []schema.ObjectType{ + { + Name: "bar", + KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "foo", Values: []string{"a"}}}}, + }, + }, + RemovedEnumTypes: []schema.EnumType{ + {Name: "bar", Values: []string{"a"}}, + }, + AddedEnumTypes: []schema.EnumType{ + {Name: "foo", Values: []string{"a"}}, + }, + }, + hasCompatibleChanges: false, + }, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + got := CompareModuleSchemas(tc.oldSchema, tc.newSchema) + if !reflect.DeepEqual(got, tc.diff) { + t.Errorf("CompareModuleSchemas() = %v, want %v", got, tc.diff) + } + hasCompatibleChanges := got.HasCompatibleChanges() + if hasCompatibleChanges != tc.hasCompatibleChanges { + t.Errorf("HasCompatibleChanges() = %v, want %v", hasCompatibleChanges, tc.hasCompatibleChanges) + } + if tc.empty != got.Empty() { + t.Errorf("Empty() = %v, want %v", got.Empty(), tc.empty) + } + }) + } +} + +func mustModuleSchema(t *testing.T, objectTypes ...schema.ObjectType) schema.ModuleSchema { + s, err := schema.NewModuleSchema(objectTypes) + if err != nil { + t.Fatal(err) + } + return s +} diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index eef0730c881a..f13f02349663 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -13,7 +13,7 @@ $mockgen_cmd -source=x/nft/expected_keepers.go -package testutil -destination x/ $mockgen_cmd -source=x/feegrant/expected_keepers.go -package testutil -destination x/feegrant/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/mint/types/expected_keepers.go -package testutil -destination x/mint/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/tx/config/expected_keepers.go -package testutil -destination x/auth/tx/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go +# $mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go @@ -24,5 +24,5 @@ $mockgen_cmd -source=x/slashing/types/expected_keepers.go -package testutil -des $mockgen_cmd -source=x/genutil/types/expected_keepers.go -package testutil -destination x/genutil/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/gov/testutil/expected_keepers.go -package testutil -destination x/gov/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/staking/types/expected_keepers.go -package testutil -destination x/staking/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go +# $mockgen_cmd -source=x/auth/vesting/types/expected_keepers.go -package testutil -destination x/auth/vesting/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/protocolpool/types/expected_keepers.go -package testutil -destination x/protocolpool/testutil/expected_keepers_mocks.go diff --git a/server/v2/stf/core_router_service.go b/server/v2/stf/core_router_service.go new file mode 100644 index 000000000000..e3a3f95940a6 --- /dev/null +++ b/server/v2/stf/core_router_service.go @@ -0,0 +1,74 @@ +package stf + +import ( + "context" + + "cosmossdk.io/core/router" + "cosmossdk.io/core/transaction" +) + +// NewMsgRouterService implements router.Service. +func NewMsgRouterService(identity transaction.Identity) router.Service { + return msgRouterService{identity: identity} +} + +var _ router.Service = (*msgRouterService)(nil) + +type msgRouterService struct { + // TODO(tip): the identity sits here for the purpose of disallowing modules to impersonate others (sudo). + // right now this is not used, but it serves the reminder of something that we should be eventually + // looking into. + identity []byte +} + +// CanInvoke returns an error if the given message cannot be invoked. +func (m msgRouterService) CanInvoke(ctx context.Context, typeURL string) error { + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return err + } + + return exCtx.msgRouter.CanInvoke(ctx, typeURL) +} + +// Invoke execute a message and returns a response. +func (m msgRouterService) Invoke(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return nil, err + } + + return exCtx.msgRouter.Invoke(ctx, msg) +} + +// NewQueryRouterService implements router.Service. +func NewQueryRouterService() router.Service { + return queryRouterService{} +} + +var _ router.Service = (*queryRouterService)(nil) + +type queryRouterService struct{} + +// CanInvoke returns an error if the given request cannot be invoked. +func (m queryRouterService) CanInvoke(ctx context.Context, typeURL string) error { + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return err + } + + return exCtx.queryRouter.CanInvoke(ctx, typeURL) +} + +// InvokeUntyped execute a message and returns a response. +func (m queryRouterService) Invoke( + ctx context.Context, + req transaction.Msg, +) (transaction.Msg, error) { + exCtx, err := getExecutionCtxFromContext(ctx) + if err != nil { + return nil, err + } + + return exCtx.queryRouter.Invoke(ctx, req) +} diff --git a/server/v2/stf/stf.go b/server/v2/stf/stf.go new file mode 100644 index 000000000000..43fa6bcf9c3f --- /dev/null +++ b/server/v2/stf/stf.go @@ -0,0 +1,625 @@ +package stf + +import ( + "context" + "errors" + "fmt" + + appmanager "cosmossdk.io/core/app" + appmodulev2 "cosmossdk.io/core/appmodule/v2" + corecontext "cosmossdk.io/core/context" + "cosmossdk.io/core/event" + "cosmossdk.io/core/gas" + "cosmossdk.io/core/header" + "cosmossdk.io/core/log" + "cosmossdk.io/core/router" + "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" + stfgas "cosmossdk.io/server/v2/stf/gas" + "cosmossdk.io/server/v2/stf/internal" +) + +// Identity defines STF's bytes identity and it's used by STF to store things in its own state. +var Identity = []byte("stf") + +type eContextKey struct{} + +var executionContextKey = eContextKey{} + +// STF is a struct that manages the state transition component of the app. +type STF[T transaction.Tx] struct { + logger log.Logger + + msgRouter coreRouterImpl + queryRouter coreRouterImpl + + doPreBlock func(ctx context.Context, txs []T) error + doBeginBlock func(ctx context.Context) error + doEndBlock func(ctx context.Context) error + doValidatorUpdate func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error) + + doTxValidation func(ctx context.Context, tx T) error + postTxExec func(ctx context.Context, tx T, success bool) error + + branchFn branchFn // branchFn is a function that given a readonly state it returns a writable version of it. + makeGasMeter makeGasMeterFn + makeGasMeteredState makeGasMeteredStateFn +} + +// NewSTF returns a new STF instance. +func NewSTF[T transaction.Tx]( + logger log.Logger, + msgRouterBuilder *MsgRouterBuilder, + queryRouterBuilder *MsgRouterBuilder, + doPreBlock func(ctx context.Context, txs []T) error, + doBeginBlock func(ctx context.Context) error, + doEndBlock func(ctx context.Context) error, + doTxValidation func(ctx context.Context, tx T) error, + doValidatorUpdate func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error), + postTxExec func(ctx context.Context, tx T, success bool) error, + branch func(store store.ReaderMap) store.WriterMap, +) (*STF[T], error) { + msgRouter, err := msgRouterBuilder.Build() + if err != nil { + return nil, fmt.Errorf("build msg router: %w", err) + } + queryRouter, err := queryRouterBuilder.Build() + if err != nil { + return nil, fmt.Errorf("build query router: %w", err) + } + + return &STF[T]{ + logger: logger, + msgRouter: msgRouter, + queryRouter: queryRouter, + doPreBlock: doPreBlock, + doBeginBlock: doBeginBlock, + doEndBlock: doEndBlock, + doValidatorUpdate: doValidatorUpdate, + doTxValidation: doTxValidation, + postTxExec: postTxExec, // TODO + branchFn: branch, + makeGasMeter: stfgas.DefaultGasMeter, + makeGasMeteredState: stfgas.DefaultWrapWithGasMeter, + }, nil +} + +// DeliverBlock is our state transition function. +// It takes a read only view of the state to apply the block to, +// executes the block and returns the block results and the new state. +func (s STF[T]) DeliverBlock( + ctx context.Context, + block *appmanager.BlockRequest[T], + state store.ReaderMap, +) (blockResult *appmanager.BlockResponse, newState store.WriterMap, err error) { + // creates a new branchFn state, from the readonly view of the state + // that can be written to. + newState = s.branchFn(state) + hi := header.Info{ + Hash: block.Hash, + AppHash: block.AppHash, + ChainID: block.ChainId, + Time: block.Time, + Height: int64(block.Height), + } + // set header info + err = s.setHeaderInfo(newState, hi) + if err != nil { + return nil, nil, fmt.Errorf("unable to set initial header info, %w", err) + } + + exCtx := s.makeContext(ctx, appmanager.ConsensusIdentity, newState, internal.ExecModeFinalize) + exCtx.setHeaderInfo(hi) + + // reset events + exCtx.events = make([]event.Event, 0) + // pre block is called separate from begin block in order to prepopulate state + preBlockEvents, err := s.preBlock(exCtx, block.Txs) + if err != nil { + return nil, nil, err + } + + if err = isCtxCancelled(ctx); err != nil { + return nil, nil, err + } + + // reset events + exCtx.events = make([]event.Event, 0) + + // begin block + var beginBlockEvents []event.Event + if !block.IsGenesis { + // begin block + beginBlockEvents, err = s.beginBlock(exCtx) + if err != nil { + return nil, nil, err + } + } + + // check if we need to return early + if err = isCtxCancelled(ctx); err != nil { + return nil, nil, err + } + + // execute txs + txResults := make([]appmanager.TxResult, len(block.Txs)) + // TODO: skip first tx if vote extensions are enabled (marko) + for i, txBytes := range block.Txs { + // check if we need to return early or continue delivering txs + if err = isCtxCancelled(ctx); err != nil { + return nil, nil, err + } + txResults[i] = s.deliverTx(exCtx, newState, txBytes, transaction.ExecModeFinalize, hi) + } + // reset events + exCtx.events = make([]event.Event, 0) + // end block + endBlockEvents, valset, err := s.endBlock(exCtx) + if err != nil { + return nil, nil, err + } + + return &appmanager.BlockResponse{ + Apphash: nil, + ValidatorUpdates: valset, + PreBlockEvents: preBlockEvents, + BeginBlockEvents: beginBlockEvents, + TxResults: txResults, + EndBlockEvents: endBlockEvents, + }, newState, nil +} + +// deliverTx executes a TX and returns the result. +func (s STF[T]) deliverTx( + ctx context.Context, + state store.WriterMap, + tx T, + execMode transaction.ExecMode, + hi header.Info, +) appmanager.TxResult { + // recover in the case of a panic + var recoveryError error + defer func() { + if r := recover(); r != nil { + recoveryError = fmt.Errorf("panic during transaction execution: %s", r) + s.logger.Error("panic during transaction execution", "error", recoveryError) + } + }() + // handle error from GetGasLimit + gasLimit, gasLimitErr := tx.GetGasLimit() + if gasLimitErr != nil { + return appmanager.TxResult{ + Error: gasLimitErr, + } + } + + if recoveryError != nil { + return appmanager.TxResult{ + Error: recoveryError, + } + } + + validateGas, validationEvents, err := s.validateTx(ctx, state, gasLimit, tx, execMode) + if err != nil { + return appmanager.TxResult{ + Error: err, + } + } + + execResp, execGas, execEvents, err := s.execTx(ctx, state, gasLimit-validateGas, tx, execMode, hi) + return appmanager.TxResult{ + Events: append(validationEvents, execEvents...), + GasUsed: execGas + validateGas, + GasWanted: gasLimit, + Resp: execResp, + Error: err, + } +} + +// validateTx validates a transaction given the provided WritableState and gas limit. +// If the validation is successful, state is committed +func (s STF[T]) validateTx( + ctx context.Context, + state store.WriterMap, + gasLimit uint64, + tx T, + execMode transaction.ExecMode, +) (gasUsed uint64, events []event.Event, err error) { + validateState := s.branchFn(state) + hi, err := s.getHeaderInfo(validateState) + if err != nil { + return 0, nil, err + } + validateCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, validateState, execMode) + validateCtx.setHeaderInfo(hi) + validateCtx.setGasLimit(gasLimit) + err = s.doTxValidation(validateCtx, tx) + if err != nil { + return 0, nil, err + } + + consumed := validateCtx.meter.Limit() - validateCtx.meter.Remaining() + + return consumed, validateCtx.events, applyStateChanges(state, validateState) +} + +// execTx executes the tx messages on the provided state. If the tx fails then the state is discarded. +func (s STF[T]) execTx( + ctx context.Context, + state store.WriterMap, + gasLimit uint64, + tx T, + execMode transaction.ExecMode, + hi header.Info, +) ([]transaction.Msg, uint64, []event.Event, error) { + execState := s.branchFn(state) + + msgsResp, gasUsed, runTxMsgsEvents, txErr := s.runTxMsgs(ctx, execState, gasLimit, tx, execMode, hi) + if txErr != nil { + // in case of error during message execution, we do not apply the exec state. + // instead we run the post exec handler in a new branchFn from the initial state. + postTxState := s.branchFn(state) + postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, postTxState, execMode) + postTxCtx.setHeaderInfo(hi) + + postTxErr := s.postTxExec(postTxCtx, tx, false) + if postTxErr != nil { + // if the post tx handler fails, then we do not apply any state change to the initial state. + // we just return the exec gas used and a joined error from TX error and post TX error. + return nil, gasUsed, nil, errors.Join(txErr, postTxErr) + } + // in case post tx is successful, then we commit the post tx state to the initial state, + // and we return post tx events alongside exec gas used and the error of the tx. + applyErr := applyStateChanges(state, postTxState) + if applyErr != nil { + return nil, 0, nil, applyErr + } + return nil, gasUsed, postTxCtx.events, txErr + } + // tx execution went fine, now we use the same state to run the post tx exec handler, + // in case the execution of the post tx fails, then no state change is applied and the + // whole execution step is rolled back. + postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, execState, execMode) // NO gas limit. + postTxCtx.setHeaderInfo(hi) + postTxErr := s.postTxExec(postTxCtx, tx, true) + if postTxErr != nil { + // if post tx fails, then we do not apply any state change, we return the post tx error, + // alongside the gas used. + return nil, gasUsed, nil, postTxErr + } + // both the execution and post tx execution step were successful, so we apply the state changes + // to the provided state, and we return responses, and events from exec tx and post tx exec. + applyErr := applyStateChanges(state, execState) + if applyErr != nil { + return nil, 0, nil, applyErr + } + + return msgsResp, gasUsed, append(runTxMsgsEvents, postTxCtx.events...), nil +} + +// runTxMsgs will execute the messages contained in the TX with the provided state. +func (s STF[T]) runTxMsgs( + ctx context.Context, + state store.WriterMap, + gasLimit uint64, + tx T, + execMode transaction.ExecMode, + hi header.Info, +) ([]transaction.Msg, uint64, []event.Event, error) { + txSenders, err := tx.GetSenders() + if err != nil { + return nil, 0, nil, err + } + msgs, err := tx.GetMessages() + if err != nil { + return nil, 0, nil, err + } + msgResps := make([]transaction.Msg, len(msgs)) + + execCtx := s.makeContext(ctx, nil, state, execMode) + execCtx.setHeaderInfo(hi) + execCtx.setGasLimit(gasLimit) + for i, msg := range msgs { + execCtx.sender = txSenders[i] + resp, err := s.msgRouter.Invoke(execCtx, msg) + if err != nil { + return nil, 0, nil, fmt.Errorf("message execution at index %d failed: %w", i, err) + } + msgResps[i] = resp + } + + consumed := execCtx.meter.Limit() - execCtx.meter.Remaining() + return msgResps, consumed, execCtx.events, nil +} + +// preBlock executes the pre block logic. +func (s STF[T]) preBlock( + ctx *executionContext, + txs []T, +) ([]event.Event, error) { + err := s.doPreBlock(ctx, txs) + if err != nil { + return nil, err + } + + for i, e := range ctx.events { + ctx.events[i].Attributes = append( + e.Attributes, + event.Attribute{Key: "mode", Value: "PreBlock"}, + ) + } + + return ctx.events, nil +} + +// beginBlock executes the begin block logic. +func (s STF[T]) beginBlock( + ctx *executionContext, +) (beginBlockEvents []event.Event, err error) { + err = s.doBeginBlock(ctx) + if err != nil { + return nil, err + } + + for i, e := range ctx.events { + ctx.events[i].Attributes = append( + e.Attributes, + event.Attribute{Key: "mode", Value: "BeginBlock"}, + ) + } + + return ctx.events, nil +} + +// endBlock executes the end block logic. +func (s STF[T]) endBlock( + ctx *executionContext, +) ([]event.Event, []appmodulev2.ValidatorUpdate, error) { + err := s.doEndBlock(ctx) + if err != nil { + return nil, nil, err + } + + events, valsetUpdates, err := s.validatorUpdates(ctx) + if err != nil { + return nil, nil, err + } + + ctx.events = append(ctx.events, events...) + + for i, e := range ctx.events { + ctx.events[i].Attributes = append( + e.Attributes, + event.Attribute{Key: "mode", Value: "BeginBlock"}, + ) + } + + return ctx.events, valsetUpdates, nil +} + +// validatorUpdates returns the validator updates for the current block. It is called by endBlock after the endblock execution has concluded +func (s STF[T]) validatorUpdates( + ctx *executionContext, +) ([]event.Event, []appmodulev2.ValidatorUpdate, error) { + valSetUpdates, err := s.doValidatorUpdate(ctx) + if err != nil { + return nil, nil, err + } + return ctx.events, valSetUpdates, nil +} + +// Simulate simulates the execution of a tx on the provided state. +func (s STF[T]) Simulate( + ctx context.Context, + state store.ReaderMap, + gasLimit uint64, + tx T, +) (appmanager.TxResult, store.WriterMap) { + simulationState := s.branchFn(state) + hi, err := s.getHeaderInfo(simulationState) + if err != nil { + return appmanager.TxResult{}, nil + } + txr := s.deliverTx(ctx, simulationState, tx, internal.ExecModeSimulate, hi) + + return txr, simulationState +} + +// ValidateTx will run only the validation steps required for a transaction. +// Validations are run over the provided state, with the provided gas limit. +func (s STF[T]) ValidateTx( + ctx context.Context, + state store.ReaderMap, + gasLimit uint64, + tx T, +) appmanager.TxResult { + validationState := s.branchFn(state) + gasUsed, events, err := s.validateTx(ctx, validationState, gasLimit, tx, transaction.ExecModeCheck) + return appmanager.TxResult{ + Events: events, + GasUsed: gasUsed, + Error: err, + } +} + +// Query executes the query on the provided state with the provided gas limits. +func (s STF[T]) Query( + ctx context.Context, + state store.ReaderMap, + gasLimit uint64, + req transaction.Msg, +) (transaction.Msg, error) { + queryState := s.branchFn(state) + hi, err := s.getHeaderInfo(queryState) + if err != nil { + return nil, err + } + queryCtx := s.makeContext(ctx, nil, queryState, internal.ExecModeSimulate) + queryCtx.setHeaderInfo(hi) + queryCtx.setGasLimit(gasLimit) + return s.queryRouter.Invoke(queryCtx, req) +} + +// RunWithCtx is made to support genesis, if genesis was just the execution of messages instead +// of being something custom then we would not need this. PLEASE DO NOT USE. +// TODO: Remove +func (s STF[T]) RunWithCtx( + ctx context.Context, + state store.ReaderMap, + closure func(ctx context.Context) error, +) (store.WriterMap, error) { + branchedState := s.branchFn(state) + stfCtx := s.makeContext(ctx, nil, branchedState, internal.ExecModeFinalize) + return branchedState, closure(stfCtx) +} + +// clone clones STF. +func (s STF[T]) clone() STF[T] { + return STF[T]{ + logger: s.logger, + msgRouter: s.msgRouter, + queryRouter: s.queryRouter, + doPreBlock: s.doPreBlock, + doBeginBlock: s.doBeginBlock, + doEndBlock: s.doEndBlock, + doValidatorUpdate: s.doValidatorUpdate, + doTxValidation: s.doTxValidation, + postTxExec: s.postTxExec, + branchFn: s.branchFn, + makeGasMeter: s.makeGasMeter, + makeGasMeteredState: s.makeGasMeteredState, + } +} + +// executionContext is a struct that holds the context for the execution of a tx. +type executionContext struct { + context.Context + + // unmeteredState is storage without metering. Changes here are propagated to state which is the metered + // version. + unmeteredState store.WriterMap + // state is the gas metered state. + state store.WriterMap + // meter is the gas meter. + meter gas.Meter + // events are the current events. + events []event.Event + // sender is the causer of the state transition. + sender transaction.Identity + // headerInfo contains the block info. + headerInfo header.Info + // execMode retains information about the exec mode. + execMode transaction.ExecMode + + branchFn branchFn + makeGasMeter makeGasMeterFn + makeGasMeteredStore makeGasMeteredStateFn + + msgRouter router.Service + queryRouter router.Service +} + +// setHeaderInfo sets the header info in the state to be used by queries in the future. +func (e *executionContext) setHeaderInfo(hi header.Info) { + e.headerInfo = hi +} + +// setGasLimit will update the gas limit of the *executionContext +func (e *executionContext) setGasLimit(limit uint64) { + meter := e.makeGasMeter(limit) + meteredState := e.makeGasMeteredStore(meter, e.unmeteredState) + + e.meter = meter + e.state = meteredState +} + +func (e *executionContext) Value(key any) any { + if key == executionContextKey { + return e + } + + return e.Context.Value(key) +} + +// TODO: too many calls to makeContext can be expensive +// makeContext creates and returns a new execution context for the STF[T] type. +// It takes in the following parameters: +// - ctx: The context.Context object for the execution. +// - sender: The transaction.Identity object representing the sender of the transaction. +// - state: The store.WriterMap object for accessing and modifying the state. +// - gasLimit: The maximum amount of gas allowed for the execution. +// - execMode: The corecontext.ExecMode object representing the execution mode. +// +// It returns a pointer to the executionContext struct +func (s STF[T]) makeContext( + ctx context.Context, + sender transaction.Identity, + store store.WriterMap, + execMode transaction.ExecMode, +) *executionContext { + valuedCtx := context.WithValue(ctx, corecontext.ExecModeKey, execMode) + return newExecutionContext( + valuedCtx, + s.makeGasMeter, + s.makeGasMeteredState, + s.branchFn, + sender, + store, + execMode, + s.msgRouter, + s.queryRouter, + ) +} + +func newExecutionContext( + ctx context.Context, + makeGasMeterFn makeGasMeterFn, + makeGasMeteredStoreFn makeGasMeteredStateFn, + branchFn branchFn, + sender transaction.Identity, + state store.WriterMap, + execMode transaction.ExecMode, + msgRouter coreRouterImpl, + queryRouter coreRouterImpl, +) *executionContext { + meter := makeGasMeterFn(gas.NoGasLimit) + meteredState := makeGasMeteredStoreFn(meter, state) + + return &executionContext{ + Context: ctx, + unmeteredState: state, + state: meteredState, + meter: meter, + events: make([]event.Event, 0), + sender: sender, + headerInfo: header.Info{}, + execMode: execMode, + branchFn: branchFn, + makeGasMeter: makeGasMeterFn, + makeGasMeteredStore: makeGasMeteredStoreFn, + msgRouter: msgRouter, + queryRouter: queryRouter, + } +} + +// applyStateChanges applies the state changes from the source store to the destination store. +// It retrieves the state changes from the source store using GetStateChanges method, +// and then applies those changes to the destination store using ApplyStateChanges method. +// If an error occurs during the retrieval or application of state changes, it is returned. +func applyStateChanges(dst, src store.WriterMap) error { + changes, err := src.GetStateChanges() + if err != nil { + return err + } + return dst.ApplyStateChanges(changes) +} + +// isCtxCancelled reports if the context was canceled. +func isCtxCancelled(ctx context.Context) error { + select { + case <-ctx.Done(): + return ctx.Err() + default: + return nil + } +} diff --git a/server/v2/stf/stf_router.go b/server/v2/stf/stf_router.go new file mode 100644 index 000000000000..0593dddf71b4 --- /dev/null +++ b/server/v2/stf/stf_router.go @@ -0,0 +1,170 @@ +package stf + +import ( + "context" + "errors" + "fmt" + "strings" + + gogoproto "github.com/cosmos/gogoproto/proto" + + appmodulev2 "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/router" + "cosmossdk.io/core/transaction" +) + +var ErrNoHandler = errors.New("no handler") + +// NewMsgRouterBuilder is a router that routes messages to their respective handlers. +func NewMsgRouterBuilder() *MsgRouterBuilder { + return &MsgRouterBuilder{ + handlers: make(map[string]appmodulev2.Handler), + preHandlers: make(map[string][]appmodulev2.PreMsgHandler), + postHandlers: make(map[string][]appmodulev2.PostMsgHandler), + } +} + +type MsgRouterBuilder struct { + handlers map[string]appmodulev2.Handler + globalPreHandlers []appmodulev2.PreMsgHandler + preHandlers map[string][]appmodulev2.PreMsgHandler + postHandlers map[string][]appmodulev2.PostMsgHandler + globalPostHandlers []appmodulev2.PostMsgHandler +} + +func (b *MsgRouterBuilder) RegisterHandler(msgType string, handler appmodulev2.Handler) error { + // panic on override + if _, ok := b.handlers[msgType]; ok { + return fmt.Errorf("handler already registered: %s", msgType) + } + b.handlers[msgType] = handler + return nil +} + +func (b *MsgRouterBuilder) RegisterGlobalPreHandler(handler appmodulev2.PreMsgHandler) { + b.globalPreHandlers = append(b.globalPreHandlers, handler) +} + +func (b *MsgRouterBuilder) RegisterPreHandler(msgType string, handler appmodulev2.PreMsgHandler) { + b.preHandlers[msgType] = append(b.preHandlers[msgType], handler) +} + +func (b *MsgRouterBuilder) RegisterPostHandler(msgType string, handler appmodulev2.PostMsgHandler) { + b.postHandlers[msgType] = append(b.postHandlers[msgType], handler) +} + +func (b *MsgRouterBuilder) RegisterGlobalPostHandler(handler appmodulev2.PostMsgHandler) { + b.globalPostHandlers = append(b.globalPostHandlers, handler) +} + +func (b *MsgRouterBuilder) HandlerExists(msgType string) bool { + _, ok := b.handlers[msgType] + return ok +} + +func (b *MsgRouterBuilder) Build() (coreRouterImpl, error) { + handlers := make(map[string]appmodulev2.Handler) + + globalPreHandler := func(ctx context.Context, msg transaction.Msg) error { + for _, h := range b.globalPreHandlers { + err := h(ctx, msg) + if err != nil { + return err + } + } + return nil + } + + globalPostHandler := func(ctx context.Context, msg, msgResp transaction.Msg) error { + for _, h := range b.globalPostHandlers { + err := h(ctx, msg, msgResp) + if err != nil { + return err + } + } + return nil + } + + for msgType, handler := range b.handlers { + // find pre handler + preHandlers := b.preHandlers[msgType] + // find post handler + postHandlers := b.postHandlers[msgType] + // build the handler + handlers[msgType] = buildHandler(handler, preHandlers, globalPreHandler, postHandlers, globalPostHandler) + } + + return coreRouterImpl{ + handlers: handlers, + }, nil +} + +func buildHandler( + handler appmodulev2.Handler, + preHandlers []appmodulev2.PreMsgHandler, + globalPreHandler appmodulev2.PreMsgHandler, + postHandlers []appmodulev2.PostMsgHandler, + globalPostHandler appmodulev2.PostMsgHandler, +) appmodulev2.Handler { + return func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) { + if len(preHandlers) != 0 { + for _, preHandler := range preHandlers { + if err := preHandler(ctx, msg); err != nil { + return nil, err + } + } + } + err = globalPreHandler(ctx, msg) + if err != nil { + return nil, err + } + msgResp, err = handler(ctx, msg) + if err != nil { + return nil, err + } + + if len(postHandlers) != 0 { + for _, postHandler := range postHandlers { + if err := postHandler(ctx, msg, msgResp); err != nil { + return nil, err + } + } + } + err = globalPostHandler(ctx, msg, msgResp) + return msgResp, err + } +} + +// msgTypeURL returns the TypeURL of a proto message. +func msgTypeURL(msg gogoproto.Message) string { + return gogoproto.MessageName(msg) +} + +var _ router.Service = (*coreRouterImpl)(nil) + +// coreRouterImpl implements the STF router for msg and query handlers. +type coreRouterImpl struct { + handlers map[string]appmodulev2.Handler +} + +func (r coreRouterImpl) CanInvoke(_ context.Context, typeURL string) error { + // trimming prefixes is a backwards compatibility strategy that we use + // for baseapp components that did routing through type URL rather + // than protobuf message names. + typeURL = strings.TrimPrefix(typeURL, "/") + _, exists := r.handlers[typeURL] + if !exists { + return fmt.Errorf("%w: %s", ErrNoHandler, typeURL) + } + return nil +} + +func (r coreRouterImpl) Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) { + typeName := msgTypeURL(req) + handler, exists := r.handlers[typeName] + if !exists { + return nil, fmt.Errorf("%w: %s", ErrNoHandler, typeName) + } + + return handler(ctx, req) +} diff --git a/server/v2/stf/stf_router_test.go b/server/v2/stf/stf_router_test.go new file mode 100644 index 000000000000..91d6c9417176 --- /dev/null +++ b/server/v2/stf/stf_router_test.go @@ -0,0 +1,48 @@ +package stf + +import ( + "context" + "testing" + + gogoproto "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" + "github.com/stretchr/testify/require" + + "cosmossdk.io/core/appmodule/v2" + "cosmossdk.io/core/transaction" +) + +func TestRouter(t *testing.T) { + expectedMsg := &gogotypes.BoolValue{Value: true} + expectedMsgName := gogoproto.MessageName(expectedMsg) + + expectedResp := &gogotypes.StringValue{Value: "test"} + + router := coreRouterImpl{handlers: map[string]appmodule.Handler{ + gogoproto.MessageName(expectedMsg): func(ctx context.Context, gotMsg transaction.Msg) (msgResp transaction.Msg, err error) { + require.Equal(t, expectedMsg, gotMsg) + return expectedResp, nil + }, + }} + + t.Run("can invoke message by name", func(t *testing.T) { + err := router.CanInvoke(context.Background(), expectedMsgName) + require.NoError(t, err, "must be invocable") + }) + + t.Run("can invoke message by type URL", func(t *testing.T) { + err := router.CanInvoke(context.Background(), "/"+expectedMsgName) + require.NoError(t, err) + }) + + t.Run("cannot invoke unknown message", func(t *testing.T) { + err := router.CanInvoke(context.Background(), "not exist") + require.Error(t, err) + }) + + t.Run("invoke", func(t *testing.T) { + gotResp, err := router.Invoke(context.Background(), expectedMsg) + require.NoError(t, err) + require.Equal(t, expectedResp, gotResp) + }) +} diff --git a/simapp/mint_fn.go b/simapp/mint_fn.go index dcb9f96c7ff6..1ed53166b345 100644 --- a/simapp/mint_fn.go +++ b/simapp/mint_fn.go @@ -3,6 +3,7 @@ package simapp import ( "context" "encoding/binary" + "fmt" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/event" @@ -29,31 +30,45 @@ func ProvideExampleMintFn(bankKeeper MintBankKeeper) minttypes.MintFn { return nil } - var stakingParams stakingtypes.QueryParamsResponse - err := env.QueryRouterService.InvokeTyped(ctx, &stakingtypes.QueryParamsRequest{}, &stakingParams) + resp, err := env.QueryRouterService.Invoke(ctx, &stakingtypes.QueryParamsRequest{}) if err != nil { return err } + stakingParams, ok := resp.(*stakingtypes.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } - var bankSupply banktypes.QuerySupplyOfResponse - err = env.QueryRouterService.InvokeTyped(ctx, &banktypes.QuerySupplyOfRequest{Denom: stakingParams.Params.BondDenom}, &bankSupply) + resp, err = env.QueryRouterService.Invoke(ctx, &banktypes.QuerySupplyOfRequest{Denom: stakingParams.Params.BondDenom}) if err != nil { return err } + bankSupply, ok := resp.(*banktypes.QuerySupplyOfResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + stakingTokenSupply := bankSupply.Amount - var mintParams minttypes.QueryParamsResponse - err = env.QueryRouterService.InvokeTyped(ctx, &minttypes.QueryParamsRequest{}, &mintParams) + resp, err = env.QueryRouterService.Invoke(ctx, &minttypes.QueryParamsRequest{}) if err != nil { return err } + mintParams, ok := resp.(*minttypes.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } - var stakingPool stakingtypes.QueryPoolResponse - err = env.QueryRouterService.InvokeTyped(ctx, &stakingtypes.QueryPoolRequest{}, &stakingPool) + resp, err = env.QueryRouterService.Invoke(ctx, &stakingtypes.QueryPoolRequest{}) if err != nil { return err } + stakingPool, ok := resp.(*stakingtypes.QueryPoolResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + // bondedRatio bondedRatio := math.LegacyNewDecFromInt(stakingPool.Pool.BondedTokens).QuoInt(stakingTokenSupply.Amount) minter.Inflation = minter.NextInflationRate(mintParams.Params, bondedRatio) diff --git a/tests/e2e/accounts/lockup/utils.go b/tests/e2e/accounts/lockup/utils.go index b1a90d7ece72..69606d58d743 100644 --- a/tests/e2e/accounts/lockup/utils.go +++ b/tests/e2e/accounts/lockup/utils.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" "cosmossdk.io/simapp" "cosmossdk.io/x/accounts/defaults/lockup/types" "cosmossdk.io/x/bank/testutil" @@ -15,8 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var ( ownerAddr = secp256k1.GenPrivKey().PubKey().Address() accOwner = sdk.AccAddress(ownerAddr) @@ -52,7 +50,7 @@ func (s *E2ETestSuite) executeTx(ctx sdk.Context, msg sdk.Msg, app *simapp.SimAp return err } -func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (ProtoMsg, error) { +func (s *E2ETestSuite) queryAcc(ctx sdk.Context, req sdk.Msg, app *simapp.SimApp, accAddr []byte) (transaction.Msg, error) { resp, err := app.AccountsKeeper.Query(ctx, accAddr, req) return resp, err } diff --git a/tests/e2e/accounts/multisig/test_suite.go b/tests/e2e/accounts/multisig/test_suite.go index 1f333cf2a0c7..3aa23f147d25 100644 --- a/tests/e2e/accounts/multisig/test_suite.go +++ b/tests/e2e/accounts/multisig/test_suite.go @@ -6,8 +6,8 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/simapp" multisigaccount "cosmossdk.io/x/accounts/defaults/multisig" @@ -19,8 +19,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - type E2ETestSuite struct { suite.Suite @@ -59,7 +57,7 @@ func (s *E2ETestSuite) executeTx(ctx context.Context, msg sdk.Msg, accAddr, send return err } -func (s *E2ETestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (ProtoMsg, error) { +func (s *E2ETestSuite) queryAcc(ctx context.Context, req sdk.Msg, accAddr []byte) (transaction.Msg, error) { resp, err := s.app.AccountsKeeper.Query(ctx, accAddr, req) return resp, err } diff --git a/testutil/mock/types_module_module.go b/testutil/mock/types_module_module.go index 6e8832ec9cfc..be1de62e6626 100644 --- a/testutil/mock/types_module_module.go +++ b/testutil/mock/types_module_module.go @@ -14,6 +14,7 @@ import ( module "github.com/cosmos/cosmos-sdk/types/module" gomock "github.com/golang/mock/gomock" runtime "github.com/grpc-ecosystem/grpc-gateway/runtime" + grpc "google.golang.org/grpc" ) // MockAppModuleBasic is a mock of AppModuleBasic interface. @@ -264,6 +265,67 @@ func (mr *MockHasServicesMockRecorder) RegisterServices(arg0 interface{}) *gomoc return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockHasServices)(nil).RegisterServices), arg0) } +// MockhasServicesV1 is a mock of hasServicesV1 interface. +type MockhasServicesV1 struct { + ctrl *gomock.Controller + recorder *MockhasServicesV1MockRecorder +} + +// MockhasServicesV1MockRecorder is the mock recorder for MockhasServicesV1. +type MockhasServicesV1MockRecorder struct { + mock *MockhasServicesV1 +} + +// NewMockhasServicesV1 creates a new mock instance. +func NewMockhasServicesV1(ctrl *gomock.Controller) *MockhasServicesV1 { + mock := &MockhasServicesV1{ctrl: ctrl} + mock.recorder = &MockhasServicesV1MockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockhasServicesV1) EXPECT() *MockhasServicesV1MockRecorder { + return m.recorder +} + +// IsAppModule mocks base method. +func (m *MockhasServicesV1) IsAppModule() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IsAppModule") +} + +// IsAppModule indicates an expected call of IsAppModule. +func (mr *MockhasServicesV1MockRecorder) IsAppModule() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAppModule", reflect.TypeOf((*MockhasServicesV1)(nil).IsAppModule)) +} + +// IsOnePerModuleType mocks base method. +func (m *MockhasServicesV1) IsOnePerModuleType() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "IsOnePerModuleType") +} + +// IsOnePerModuleType indicates an expected call of IsOnePerModuleType. +func (mr *MockhasServicesV1MockRecorder) IsOnePerModuleType() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsOnePerModuleType", reflect.TypeOf((*MockhasServicesV1)(nil).IsOnePerModuleType)) +} + +// RegisterServices mocks base method. +func (m *MockhasServicesV1) RegisterServices(arg0 grpc.ServiceRegistrar) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegisterServices", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RegisterServices indicates an expected call of RegisterServices. +func (mr *MockhasServicesV1MockRecorder) RegisterServices(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterServices", reflect.TypeOf((*MockhasServicesV1)(nil).RegisterServices), arg0) +} + // MockHasABCIEndBlock is a mock of HasABCIEndBlock interface. type MockHasABCIEndBlock struct { ctrl *gomock.Controller diff --git a/tools/cosmovisor/cmd/cosmovisor/version_test.go b/tools/cosmovisor/cmd/cosmovisor/version_test.go new file mode 100644 index 000000000000..8f51ea47dafb --- /dev/null +++ b/tools/cosmovisor/cmd/cosmovisor/version_test.go @@ -0,0 +1,27 @@ +package main + +import ( + "bytes" + "context" + "testing" + + "github.com/stretchr/testify/require" + + "cosmossdk.io/log" +) + +func TestVersionCommand_Error(t *testing.T) { + logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmovisor") + + rootCmd := NewRootCmd() + rootCmd.SetArgs([]string{"version"}) + + out := bytes.NewBufferString("") + rootCmd.SetOut(out) + rootCmd.SetErr(out) + + ctx := context.WithValue(context.Background(), log.ContextKey, logger) + + require.Error(t, rootCmd.ExecuteContext(ctx)) + require.Contains(t, out.String(), "DAEMON_NAME is not set") +} diff --git a/types/module/module.go b/types/module/module.go index e24bc4f64f30..7d06c7ce2109 100644 --- a/types/module/module.go +++ b/types/module/module.go @@ -97,7 +97,7 @@ type HasServices interface { // hasServicesV1 is the interface for registering service in baseapp Cosmos SDK. // This API is part of core/appmodule but commented out for dependencies. type hasServicesV1 interface { - appmodule.AppModule + appmodulev2.AppModule RegisterServices(grpc.ServiceRegistrar) error } diff --git a/x/accounts/account_test.go b/x/accounts/account_test.go index 6d6834b90fa7..f5b7b8117125 100644 --- a/x/accounts/account_test.go +++ b/x/accounts/account_test.go @@ -2,15 +2,18 @@ package accounts import ( "context" + "fmt" "strconv" "github.com/cosmos/gogoproto/types" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/collections" + "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" "cosmossdk.io/x/accounts/internal/implementation" + banktypes "cosmossdk.io/x/bank/types" + + sdk "github.com/cosmos/cosmos-sdk/types" ) var _ implementation.Account = (*TestAccount)(nil) @@ -28,7 +31,7 @@ type TestAccount struct { func (t TestAccount) RegisterInitHandler(builder *implementation.InitBuilder) { implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *types.Empty) (*types.Empty, error) { // we also force a module call here to test things work as expected. - _, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ + _, err := implementation.QueryModule(ctx, &banktypes.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: "atom", }) @@ -52,15 +55,10 @@ func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuil // this is for intermodule comms testing, we simulate a bank send implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.Int64Value) (*types.Empty, error) { - resp, err := implementation.ExecModule[bankv1beta1.MsgSendResponse](ctx, &bankv1beta1.MsgSend{ + resp, err := implementation.ExecModule(ctx, &banktypes.MsgSend{ FromAddress: string(implementation.Whoami(ctx)), ToAddress: "recipient", - Amount: []*basev1beta1.Coin{ - { - Denom: "test", - Amount: strconv.FormatInt(req.Value, 10), - }, - }, + Amount: sdk.NewCoins(sdk.NewCoin("test", math.NewInt(req.Value))), }) if err != nil { return nil, err @@ -90,7 +88,7 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) // test intermodule comms, we simulate someone is sending the account a request for the accounts balance // of a given denom. implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *types.StringValue) (*types.Int64Value, error) { - resp, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{ + resp, err := implementation.QueryModule(ctx, &banktypes.QueryBalanceRequest{ Address: string(implementation.Whoami(ctx)), Denom: req.Value, }) @@ -98,11 +96,12 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) return nil, err } - amt, err := strconv.ParseInt(resp.Balance.Amount, 10, 64) - if err != nil { - return nil, err + r, ok := resp.(*banktypes.QueryBalanceResponse) + if !ok { + panic(fmt.Sprintf("unexpected response type: %T", resp)) } - return &types.Int64Value{Value: amt}, nil + + return &types.Int64Value{Value: r.Balance.Amount.Int64()}, nil }) // genesis testing; DoubleValue does not make sense as a request type for this query, but empty is already taken diff --git a/x/accounts/accountstd/exports.go b/x/accounts/accountstd/exports.go index ea181db0a6b0..24ffc17c1e98 100644 --- a/x/accounts/accountstd/exports.go +++ b/x/accounts/accountstd/exports.go @@ -6,6 +6,7 @@ import ( "context" "fmt" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/internal/implementation" sdk "github.com/cosmos/cosmos-sdk/types" @@ -90,18 +91,13 @@ func SenderIsAccountsModule(ctx context.Context) bool { // returns nil. func Funds(ctx context.Context) sdk.Coins { return implementation.Funds(ctx) } -// ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { - return implementation.ExecModule[Resp, RespProto, Req, ReqProto](ctx, msg) -} - -func ExecModuleUntyped(ctx context.Context, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { - return implementation.ExecModuleUntyped(ctx, msg) +func ExecModule(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { + return implementation.ExecModule(ctx, msg) } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { - return implementation.QueryModule[Resp, RespProto, Req, ReqProto](ctx, req) +func QueryModule(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return implementation.QueryModule(ctx, req) } // UnpackAny unpacks a protobuf Any message generically. @@ -110,7 +106,7 @@ func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsgG[Msg]](any *implementat } // PackAny packs a protobuf Any message generically. -func PackAny(msg implementation.ProtoMsg) (*implementation.Any, error) { +func PackAny(msg transaction.Msg) (*implementation.Any, error) { return implementation.PackAny(msg) } @@ -124,7 +120,7 @@ func ExecModuleAnys(ctx context.Context, msgs []*implementation.Any) ([]*impleme if err != nil { return nil, fmt.Errorf("error unpacking message %d: %w", i, err) } - resp, err := ExecModuleUntyped(ctx, concreteMessage) + resp, err := ExecModule(ctx, concreteMessage) if err != nil { return nil, fmt.Errorf("error executing message %d: %w", i, err) } diff --git a/x/accounts/accountstd/test_util.go b/x/accounts/accountstd/test_util.go index 0ab912868820..6188c265a972 100644 --- a/x/accounts/accountstd/test_util.go +++ b/x/accounts/accountstd/test_util.go @@ -4,7 +4,7 @@ import ( "context" "cosmossdk.io/core/store" - "cosmossdk.io/core/testing" + coretesting "cosmossdk.io/core/testing" "cosmossdk.io/x/accounts/internal/implementation" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,14 +16,13 @@ func NewMockContext( sender []byte, funds sdk.Coins, moduleExec implementation.ModuleExecFunc, - moduleExecUntyped implementation.ModuleExecUntypedFunc, moduleQuery implementation.ModuleQueryFunc, ) (context.Context, store.KVStoreService) { ctx := coretesting.Context() ss := coretesting.KVStoreService(ctx, "test") return implementation.MakeAccountContext( - ctx, ss, accNumber, accountAddr, sender, funds, moduleExec, moduleExecUntyped, moduleQuery, + ctx, ss, accNumber, accountAddr, sender, funds, moduleExec, moduleQuery, ), ss } diff --git a/x/accounts/coin_transfer.go b/x/accounts/coin_transfer.go index 3f0c852bb39d..096498867da1 100644 --- a/x/accounts/coin_transfer.go +++ b/x/accounts/coin_transfer.go @@ -1,12 +1,9 @@ package accounts import ( - "google.golang.org/protobuf/proto" - - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/core/address" - "cosmossdk.io/x/accounts/internal/implementation" + "cosmossdk.io/core/transaction" + banktypes "cosmossdk.io/x/bank/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -14,49 +11,22 @@ import ( // coinsTransferMsgFunc defines a function that creates a message to send coins from one // address to the other, and also a message that parses such response. // This in most cases will be implemented as a bank.MsgSend creator, but we keep x/accounts independent of bank. -type coinsTransferMsgFunc = func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) - -type gogoProtoPlusV2 interface { - proto.Message - implementation.ProtoMsg -} - -// protoV2GogoWrapper is a wrapper of a protov2 message into a gogo message. -// this is exceptionally allowed to enable accounts to be decoupled from -// the SDK, since x/accounts can support only protov1 in its APIs. -// But in order to keep it decoupled from the SDK we need to use the API module. -// This is a hack to make an API module type work in x/accounts. Once the SDK -// has protov2 support, we can migrate internal/implementation/encoding.go to -// work with protov2. -type protoV2GogoWrapper struct { - gogoProtoPlusV2 -} - -func (h protoV2GogoWrapper) XXX_MessageName() string { - return string(proto.MessageName(h.gogoProtoPlusV2)) -} +type coinsTransferMsgFunc = func(from, to []byte, coins sdk.Coins) (transaction.Msg, error) func defaultCoinsTransferMsgFunc(addrCdc address.Codec) coinsTransferMsgFunc { - return func(from, to []byte, coins sdk.Coins) (implementation.ProtoMsg, implementation.ProtoMsg, error) { + return func(from, to []byte, coins sdk.Coins) (transaction.Msg, error) { fromAddr, err := addrCdc.BytesToString(from) if err != nil { - return nil, nil, err + return nil, err } toAddr, err := addrCdc.BytesToString(to) if err != nil { - return nil, nil, err - } - v2Coins := make([]*v1beta1.Coin, len(coins)) - for i, coin := range coins { - v2Coins[i] = &v1beta1.Coin{ - Denom: coin.Denom, - Amount: coin.Amount.String(), - } + return nil, err } - return protoV2GogoWrapper{&bankv1beta1.MsgSend{ + return &banktypes.MsgSend{ FromAddress: fromAddr, ToAddress: toAddr, - Amount: v2Coins, - }}, new(bankv1beta1.MsgSendResponse), nil + Amount: coins, + }, nil } } diff --git a/x/accounts/defaults/base/account.go b/x/accounts/defaults/base/account.go index 731658db403d..550227599f36 100644 --- a/x/accounts/defaults/base/account.go +++ b/x/accounts/defaults/base/account.go @@ -163,12 +163,17 @@ func (a Account) computeSignerData(ctx context.Context) (secp256k1.PubKey, signi } func (a Account) getNumber(ctx context.Context, addrStr string) (uint64, error) { - accNum, err := accountstd.QueryModule[accountsv1.AccountNumberResponse](ctx, &accountsv1.AccountNumberRequest{Address: addrStr}) + accNum, err := accountstd.QueryModule(ctx, &accountsv1.AccountNumberRequest{Address: addrStr}) if err != nil { return 0, err } - return accNum.Number, nil + resp, ok := accNum.(*accountsv1.AccountNumberResponse) + if !ok { + return 0, fmt.Errorf("unexpected response type: %T", accNum) + } + + return resp.Number, nil } func (a Account) getTxData(msg *aa_interface_v1.MsgAuthenticate) (signing.TxData, error) { diff --git a/x/accounts/defaults/base/utils_test.go b/x/accounts/defaults/base/utils_test.go index 90c2c9deb5a2..1be354d04358 100644 --- a/x/accounts/defaults/base/utils_test.go +++ b/x/accounts/defaults/base/utils_test.go @@ -5,8 +5,6 @@ import ( "testing" gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/runtime/protoiface" signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" "cosmossdk.io/collections" @@ -14,6 +12,7 @@ import ( "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" accountsv1 "cosmossdk.io/x/accounts/v1" "cosmossdk.io/x/tx/signing" @@ -24,8 +23,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx" ) -type ProtoMsg = protoiface.MessageV1 - // mock statecodec type mockStateCodec struct { codec.Codec @@ -58,17 +55,13 @@ func (a addressCodec) BytesToString(bz []byte) (string, error) { return string func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("mock_base_account"), []byte("sender"), nil, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("mock_base_account"), []byte("sender"), nil, + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - _, ok := req.(*accountsv1.AccountNumberRequest) - require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &accountsv1.AccountNumberResponse{ + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return &accountsv1.AccountNumberResponse{ Number: 1, - }) - return nil + }, nil }, ) } diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 9f222705588c..a2da55ab2a40 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -13,11 +13,21 @@ require ( github.com/cosmos/gogoproto v1.7.0 ) +<<<<<<< HEAD require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/api v0.8.0 // indirect cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 // indirect; main +======= +require github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + +require ( + buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect + buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect + cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 @@ -25,7 +35,11 @@ require ( cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect +<<<<<<< HEAD cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 // indirect; main +======= + cosmossdk.io/x/tx v0.13.3 // indirect +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -66,8 +80,12 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.1 // indirect +<<<<<<< HEAD github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 +======= + github.com/golang/protobuf v1.5.4 // indirect +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect diff --git a/x/accounts/defaults/lockup/lockup.go b/x/accounts/defaults/lockup/lockup.go index 060e656aa273..826f51c5a9a3 100644 --- a/x/accounts/defaults/lockup/lockup.go +++ b/x/accounts/defaults/lockup/lockup.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "errors" + "fmt" "time" "github.com/cosmos/gogoproto/proto" @@ -386,7 +387,7 @@ func (bva *BaseLockup) checkSender(ctx context.Context, sender string) error { } func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, error) { - response, err := accountstd.ExecModuleUntyped(ctx, msg) + response, err := accountstd.ExecModule(ctx, msg) if err != nil { return nil, err } @@ -401,13 +402,16 @@ func sendMessage(ctx context.Context, msg proto.Message) ([]*codectypes.Any, err func getStakingDenom(ctx context.Context) (string, error) { // Query account balance for the sent denom - paramsQueryReq := &stakingtypes.QueryParamsRequest{} - resp, err := accountstd.QueryModule[stakingtypes.QueryParamsResponse](ctx, paramsQueryReq) + resp, err := accountstd.QueryModule(ctx, &stakingtypes.QueryParamsRequest{}) if err != nil { return "", err } + res, ok := resp.(*stakingtypes.QueryParamsResponse) + if !ok { + return "", fmt.Errorf("unexpected response type: %T", resp) + } - return resp.Params.BondDenom, nil + return res.Params.BondDenom, nil } // TrackDelegation tracks a delegation amount for any given lockup account type @@ -532,13 +536,17 @@ func (bva *BaseLockup) TrackUndelegation(ctx context.Context, amount sdk.Coins) func (bva BaseLockup) getBalance(ctx context.Context, sender, denom string) (*sdk.Coin, error) { // Query account balance for the sent denom - balanceQueryReq := &banktypes.QueryBalanceRequest{Address: sender, Denom: denom} - resp, err := accountstd.QueryModule[banktypes.QueryBalanceResponse](ctx, balanceQueryReq) + resp, err := accountstd.QueryModule(ctx, &banktypes.QueryBalanceRequest{Address: sender, Denom: denom}) if err != nil { return nil, err } - return resp.Balance, nil + res, ok := resp.(*banktypes.QueryBalanceResponse) + if !ok { + return nil, fmt.Errorf("unexpected response type: %T", resp) + } + + return res.Balance, nil } func (bva BaseLockup) checkTokensSendable(ctx context.Context, sender string, amount, lockedCoins sdk.Coins) error { diff --git a/x/accounts/defaults/lockup/utils_test.go b/x/accounts/defaults/lockup/utils_test.go index a7032ceedeb3..79104e356fc1 100644 --- a/x/accounts/defaults/lockup/utils_test.go +++ b/x/accounts/defaults/lockup/utils_test.go @@ -6,14 +6,13 @@ import ( "testing" gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "github.com/stretchr/testify/require" - "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections" "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" banktypes "cosmossdk.io/x/bank/types" @@ -24,8 +23,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var TestFunds = sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))) // mock statecodec @@ -52,9 +49,9 @@ func (c mockStateCodec) Unmarshal(bz []byte, ptr gogoproto.Message) error { } type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp transaction.Msg) error + ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp transaction.Msg) error ) // mock address codec @@ -73,9 +70,8 @@ func (h headerService) HeaderInfo(ctx context.Context) header.Info { func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("lockup_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("lockup_account"), []byte("sender"), TestFunds, + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { typeUrl := sdk.MsgTypeURL(msg) switch typeUrl { case "/cosmos.staking.v1beta1.MsgDelegate": @@ -89,28 +85,24 @@ func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { default: return nil, errors.New("unrecognized request type") } - }, func(ctx context.Context, req, resp ProtoMsg) error { + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { _, ok := req.(*banktypes.QueryBalanceRequest) if !ok { _, ok = req.(*stakingtypes.QueryParamsRequest) require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &stakingtypes.QueryParamsResponse{ + return &stakingtypes.QueryParamsResponse{ Params: stakingtypes.Params{ BondDenom: "test", }, - }) - } else { - // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but - // using proto.Merge with gogo messages seems to work fine. - proto.Merge(resp.(gogoproto.Message), &banktypes.QueryBalanceResponse{ - Balance: &(sdk.Coin{ - Denom: "test", - Amount: TestFunds.AmountOf("test"), - }), - }) + }, nil } - return nil + return &banktypes.QueryBalanceResponse{ + Balance: &(sdk.Coin{ + Denom: "test", + Amount: TestFunds.AmountOf("test"), + }), + }, nil }, ) } diff --git a/x/accounts/defaults/multisig/account_test.go b/x/accounts/defaults/multisig/account_test.go index 58d3e11a4457..a53b57f6884f 100644 --- a/x/accounts/defaults/multisig/account_test.go +++ b/x/accounts/defaults/multisig/account_test.go @@ -10,12 +10,13 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" v1 "cosmossdk.io/x/accounts/defaults/multisig/v1" accountsv1 "cosmossdk.io/x/accounts/v1" ) -func setup(t *testing.T, ctx context.Context, ss store.KVStoreService, timefn func() time.Time) *Account { +func setup(t *testing.T, _ context.Context, ss store.KVStoreService, timefn func() time.Time) *Account { t.Helper() deps := makeMockDependencies(ss, timefn) @@ -442,15 +443,13 @@ func TestProposal_NotPassing(t *testing.T) { } ctx, ss := accountstd.NewMockContext( - 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { if _, ok := msg.(*v1.MsgUpdateConfig); ok { return &v1.MsgUpdateConfigResponse{}, nil } return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - return nil + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return nil, nil }, ) @@ -565,9 +564,8 @@ func TestProposalPassing(t *testing.T) { var ctx context.Context var ss store.KVStoreService ctx, ss = accountstd.NewMockContext( - 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ictx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("multisig_acc"), []byte("addr1"), TestFunds, + func(ictx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { if execmsg, ok := msg.(*accountsv1.MsgExecute); ok { updateCfg, err := accountstd.UnpackAny[v1.MsgUpdateConfig](execmsg.GetMessage()) if err != nil { @@ -578,8 +576,8 @@ func TestProposalPassing(t *testing.T) { return acc.UpdateConfig(ctx, updateCfg) } return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { - return nil + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + return nil, nil }, ) diff --git a/x/accounts/defaults/multisig/utils_test.go b/x/accounts/defaults/multisig/utils_test.go index 47f185fef1cd..86f6c62551d6 100644 --- a/x/accounts/defaults/multisig/utils_test.go +++ b/x/accounts/defaults/multisig/utils_test.go @@ -9,13 +9,13 @@ import ( types "github.com/cosmos/gogoproto/types/any" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections" "cosmossdk.io/core/appmodule/v2" "cosmossdk.io/core/event" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/math" "cosmossdk.io/x/accounts/accountstd" banktypes "cosmossdk.io/x/bank/types" @@ -26,8 +26,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -type ProtoMsg = protoiface.MessageV1 - var TestFunds = sdk.NewCoins(sdk.NewCoin("test", math.NewInt(10))) // mock statecodec @@ -149,9 +147,9 @@ func (c mockStateCodec) Unmarshal(bz []byte, ptr gogoproto.Message) error { } type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp transaction.Msg) error + ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp transaction.Msg) error ) // mock address codec @@ -163,20 +161,19 @@ func (a addressCodec) BytesToString(bz []byte) (string, error) { return string func newMockContext(t *testing.T) (context.Context, store.KVStoreService) { t.Helper() return accountstd.NewMockContext( - 0, []byte("mock_multisig_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - return nil - }, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + 0, []byte("mock_multisig_account"), []byte("sender"), TestFunds, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, nil - }, func(ctx context.Context, req, resp ProtoMsg) error { + }, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { + var resp transaction.Msg _, ok := req.(*banktypes.QueryBalanceRequest) require.True(t, ok) - gogoproto.Merge(resp.(gogoproto.Message), &banktypes.QueryBalanceResponse{ + gogoproto.Merge(resp, &banktypes.QueryBalanceResponse{ Balance: &sdk.Coin{ Denom: "test", Amount: math.NewInt(5), }, }) - return nil + return resp, nil }, ) } diff --git a/x/accounts/go.mod b/x/accounts/go.mod index f6c85a3e5c0e..b3f544067508 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -27,10 +27,15 @@ require ( cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 cosmossdk.io/schema v0.1.1 // indirect +<<<<<<< HEAD cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 // indirect +======= + cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/x/distribution v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -176,12 +181,20 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( +<<<<<<< HEAD // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main +======= + cosmossdk.io/api => ../../api + cosmossdk.io/collections => ../../collections + cosmossdk.io/core => ../../core + cosmossdk.io/core/testing => ../../core/testing + cosmossdk.io/x/accounts/defaults/lockup => ./defaults/lockup +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/accounts/defaults/multisig => ./defaults/multisig cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/accounts/go.sum b/x/accounts/go.sum index ddaaed329b15..6f6e12c4c45d 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -22,12 +22,17 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +<<<<<<< HEAD cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA= cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 h1:J3vS3G41JtTWkUX3wVKcXdy1yPUca0d3QnexCR52PeY= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897/go.mod h1:5+Hpds6bhT6CdR7DqPh0dVOqyqL7NJkq+x+yjLdYSQU= +======= +cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= +cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) 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= diff --git a/x/accounts/internal/implementation/api_builder.go b/x/accounts/internal/implementation/api_builder.go index bd6e408215ea..fd554dad6e75 100644 --- a/x/accounts/internal/implementation/api_builder.go +++ b/x/accounts/internal/implementation/api_builder.go @@ -4,6 +4,8 @@ import ( "context" "errors" "fmt" + + "cosmossdk.io/core/transaction" ) var ( @@ -22,7 +24,7 @@ type InitBuilder struct { // handler is the handler function that will be called when the smart account is initialized. // Although the function here is defined to take an any, the smart account will work // with a typed version of it. - handler func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) + handler func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error) // schema is the schema of the message that will be passed to the handler function. schema HandlerSchema @@ -30,7 +32,7 @@ type InitBuilder struct { // makeHandler returns the handler function that will be called when the smart account is initialized. // It returns an error if no handler was registered. -func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error), error) { +func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error), error) { if i.handler == nil { return nil, errNoInitHandler } @@ -40,7 +42,7 @@ func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest Proto // NewExecuteBuilder creates a new ExecuteBuilder instance. func NewExecuteBuilder() *ExecuteBuilder { return &ExecuteBuilder{ - handlers: make(map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error)), + handlers: make(map[string]func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error)), handlersSchema: make(map[string]HandlerSchema), } } @@ -49,7 +51,7 @@ func NewExecuteBuilder() *ExecuteBuilder { // to a handler function for a specific account. type ExecuteBuilder struct { // handlers is a map of handler functions that will be called when the smart account is executed. - handlers map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) + handlers map[string]func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) // handlersSchema is a map of schemas for the messages that will be passed to the handler functions // and the messages that will be returned by the handler functions. @@ -59,10 +61,10 @@ type ExecuteBuilder struct { err error } -func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error), error) { +func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error), error) { // if no handler is registered it's fine, it means the account will not be accepting execution or query messages. if len(r.handlers) == 0 { - return func(ctx context.Context, _ ProtoMsg) (_ ProtoMsg, err error) { + return func(ctx context.Context, _ transaction.Msg) (_ transaction.Msg, err error) { return nil, errNoExecuteHandler }, nil } @@ -72,7 +74,7 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest } // build the real execution handler - return func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { + return func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) { messageName := MessageName(executeRequest) handler, ok := r.handlers[messageName] if !ok { @@ -96,7 +98,7 @@ type QueryBuilder struct { er *ExecuteBuilder } -func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest ProtoMsg) (queryResponse ProtoMsg, err error), error) { +func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest transaction.Msg) (queryResponse transaction.Msg, err error), error) { return r.er.makeHandler() } diff --git a/x/accounts/internal/implementation/context.go b/x/accounts/internal/implementation/context.go index 64ba2820d6cd..8a24ea7cd034 100644 --- a/x/accounts/internal/implementation/context.go +++ b/x/accounts/internal/implementation/context.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/store" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/internal/prefixstore" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,22 +15,20 @@ import ( var AccountStatePrefix = collections.NewPrefix(255) type ( - ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) - ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error - ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error + ModuleExecFunc = func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) + ModuleQueryFunc = func(ctx context.Context, queryReq transaction.Msg) (transaction.Msg, error) ) type contextKey struct{} type contextValue struct { - store store.KVStore // store is the prefixed store for the account. - sender []byte // sender is the address of the entity invoking the account action. - whoami []byte // whoami is the address of the account being invoked. - funds sdk.Coins // funds reports the coins sent alongside the request. - parentContext context.Context // parentContext that was used to build the account context. - moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is known. - moduleExecUntyped ModuleExecUntypedFunc // moduleExecUntyped is a function that executes a module message, when the resp type is unknown. - moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module. + store store.KVStore // store is the prefixed store for the account. + sender []byte // sender is the address of the entity invoking the account action. + whoami []byte // whoami is the address of the account being invoked. + funds sdk.Coins // funds reports the coins sent alongside the request. + parentContext context.Context // parentContext that was used to build the account context. + moduleExec ModuleExecFunc // moduleExec is a function that executes a module message, when the resp type is unknown. + moduleQuery ModuleQueryFunc // moduleQuery is a function that queries a module. } func addCtx(ctx context.Context, value contextValue) context.Context { @@ -55,18 +54,16 @@ func MakeAccountContext( sender []byte, funds sdk.Coins, moduleExec ModuleExecFunc, - moduleExecUntyped ModuleExecUntypedFunc, moduleQuery ModuleQueryFunc, ) context.Context { return addCtx(ctx, contextValue{ - store: makeAccountStore(ctx, storeSvc, accNumber), - sender: sender, - whoami: accountAddr, - funds: funds, - parentContext: ctx, - moduleExec: moduleExec, - moduleExecUntyped: moduleExecUntyped, - moduleQuery: moduleQuery, + store: makeAccountStore(ctx, storeSvc, accNumber), + sender: sender, + whoami: accountAddr, + funds: funds, + parentContext: ctx, + moduleExec: moduleExec, + moduleQuery: moduleQuery, }) } @@ -85,27 +82,12 @@ func makeAccountStore(ctx context.Context, storeSvc store.KVStoreService, accNum return prefixstore.New(storeSvc.OpenKVStore(ctx), append(AccountStatePrefix, prefix...)) } -// ExecModuleUntyped can be used to execute a message towards a module, when the response type is unknown. -func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) { +// ExecModule can be used to execute a message towards a module, when the response type is unknown. +func ExecModule(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { // get sender v := getCtx(ctx) - resp, err := v.moduleExecUntyped(v.parentContext, v.whoami, msg) - if err != nil { - return nil, err - } - - return resp, nil -} - -// ExecModule can be used to execute a message towards a module. -func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) { - // get sender - v := getCtx(ctx) - - // execute module, unwrapping the original context. - resp := RespProto(new(Resp)) - err := v.moduleExec(v.parentContext, v.whoami, msg, resp) + resp, err := v.moduleExec(v.parentContext, v.whoami, msg) if err != nil { return nil, err } @@ -114,12 +96,11 @@ func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG } // QueryModule can be used by an account to execute a module query. -func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) { +func QueryModule(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { // we do not need to check the sender in a query because it is not a state transition. // we also unwrap the original context. v := getCtx(ctx) - resp := RespProto(new(Resp)) - err := v.moduleQuery(v.parentContext, req, resp) + resp, err := v.moduleQuery(v.parentContext, req) if err != nil { return nil, err } diff --git a/x/accounts/internal/implementation/context_test.go b/x/accounts/internal/implementation/context_test.go index ff47b50c89ef..9cf1108401aa 100644 --- a/x/accounts/internal/implementation/context_test.go +++ b/x/accounts/internal/implementation/context_test.go @@ -9,7 +9,8 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/collections" - "cosmossdk.io/core/testing" + coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/core/transaction" ) func TestMakeAccountContext(t *testing.T) { @@ -19,7 +20,7 @@ func TestMakeAccountContext(t *testing.T) { sender := []byte("sender") sb := collections.NewSchemaBuilderFromAccessor(openKVStore) - accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil, nil) + accountCtx := MakeAccountContext(originalContext, storeService, 1, accountAddr, sender, nil, nil, nil) // ensure whoami require.Equal(t, accountAddr, Whoami(accountCtx)) @@ -43,38 +44,24 @@ func TestMakeAccountContext(t *testing.T) { value, err := store.Get(append(AccountStatePrefix, append(binary.BigEndian.AppendUint64(nil, 1), itemPrefix...)...)) require.NoError(t, err) require.Equal(t, []byte{0, 0, 0, 0, 0, 0, 3, 232}, value) - - // ensure calling ExecModule works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error { - // ensure we unwrapped the context when invoking a module call - require.Equal(t, originalContext, ctx) - Merge(msgResp, &types.StringValue{Value: "module exec was called"}) - return nil - }, nil, nil) - - resp, err := ExecModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) - require.NoError(t, err) - require.True(t, Equal(&types.StringValue{Value: "module exec was called"}, resp)) - // ensure calling ExecModuleUntyped works - accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) { + accountCtx = MakeAccountContext(originalContext, storeService, 1, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { require.Equal(t, originalContext, ctx) return &types.StringValue{Value: "module exec untyped was called"}, nil }, nil) - respUntyped, err := ExecModuleUntyped(accountCtx, &types.UInt64Value{Value: 1000}) + respUntyped, err := ExecModule(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) require.True(t, Equal(&types.StringValue{Value: "module exec untyped was called"}, respUntyped)) // ensure calling QueryModule works, also by setting everything else communication related to nil // we can guarantee that exec paths do not impact query paths. - accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error { + accountCtx = MakeAccountContext(originalContext, storeService, 1, nil, nil, nil, nil, func(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { require.Equal(t, originalContext, ctx) - Merge(resp, &types.StringValue{Value: "module query was called"}) - return nil + return &types.StringValue{Value: "module query was called"}, nil }) - resp, err = QueryModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000}) + resp, err := QueryModule(accountCtx, &types.UInt64Value{Value: 1000}) require.NoError(t, err) require.True(t, Equal(&types.StringValue{Value: "module query was called"}, resp)) } diff --git a/x/accounts/internal/implementation/encoding.go b/x/accounts/internal/implementation/encoding.go index 167ecb38aa9e..9b08d00bf862 100644 --- a/x/accounts/internal/implementation/encoding.go +++ b/x/accounts/internal/implementation/encoding.go @@ -6,35 +6,34 @@ import ( "strings" "github.com/cosmos/gogoproto/proto" - "google.golang.org/protobuf/runtime/protoiface" + + "cosmossdk.io/core/transaction" codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) -type ProtoMsg = protoiface.MessageV1 - // ProtoMsgG is a generic interface for protobuf messages. type ProtoMsgG[T any] interface { *T - protoiface.MessageV1 + transaction.Msg } type Any = codectypes.Any -func FindMessageByName(name string) (ProtoMsg, error) { +func FindMessageByName(name string) (transaction.Msg, error) { typ := proto.MessageType(name) if typ == nil { return nil, fmt.Errorf("no message type found for %s", name) } - return reflect.New(typ.Elem()).Interface().(ProtoMsg), nil + return reflect.New(typ.Elem()).Interface().(transaction.Msg), nil } -func MessageName(msg ProtoMsg) string { +func MessageName(msg transaction.Msg) string { return proto.MessageName(msg) } // PackAny packs a proto message into an anypb.Any. -func PackAny(msg ProtoMsg) (*Any, error) { +func PackAny(msg transaction.Msg) (*Any, error) { return codectypes.NewAnyWithValue(msg) } @@ -44,7 +43,7 @@ func UnpackAny[T any, PT ProtoMsgG[T]](anyPB *Any) (PT, error) { return to, UnpackAnyTo(anyPB, PT(to)) } -func UnpackAnyTo(anyPB *Any, to ProtoMsg) error { +func UnpackAnyTo(anyPB *Any, to transaction.Msg) error { return proto.Unmarshal(anyPB.Value, to) } @@ -59,10 +58,10 @@ func UnpackAnyRaw(anyPB *Any) (proto.Message, error) { return to, UnpackAnyTo(anyPB, to) } -func Merge(a, b ProtoMsg) { +func Merge(a, b transaction.Msg) { proto.Merge(a, b) } -func Equal(a, b ProtoMsg) bool { +func Equal(a, b transaction.Msg) bool { return proto.Equal(a, b) } diff --git a/x/accounts/internal/implementation/implementation.go b/x/accounts/internal/implementation/implementation.go index 47457af718d1..6ee1edc39927 100644 --- a/x/accounts/internal/implementation/implementation.go +++ b/x/accounts/internal/implementation/implementation.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/transaction" "github.com/cosmos/cosmos-sdk/codec" ) @@ -107,11 +108,11 @@ func newImplementation(schemaBuilder *collections.SchemaBuilder, account Account // and non-generic implementation usable by the x/accounts module. type Implementation struct { // Init defines the initialisation handler for the smart account. - Init func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Init func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // Execute defines the execution handler for the smart account. - Execute func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Execute func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // Query defines the query handler for the smart account. - Query func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error) + Query func(ctx context.Context, msg transaction.Msg) (resp transaction.Msg, err error) // CollectionsSchema represents the state schema. CollectionsSchema collections.Schema // InitHandlerSchema represents the init handler schema. @@ -123,19 +124,19 @@ type Implementation struct { } // HasExec returns true if the account can execute the given msg. -func (i Implementation) HasExec(m ProtoMsg) bool { +func (i Implementation) HasExec(m transaction.Msg) bool { _, ok := i.ExecuteHandlersSchema[MessageName(m)] return ok } // HasQuery returns true if the account can execute the given request. -func (i Implementation) HasQuery(m ProtoMsg) bool { +func (i Implementation) HasQuery(m transaction.Msg) bool { _, ok := i.QueryHandlersSchema[MessageName(m)] return ok } // HasInit returns true if the account uses the provided init message. -func (i Implementation) HasInit(m ProtoMsg) bool { +func (i Implementation) HasInit(m transaction.Msg) bool { return i.InitHandlerSchema.RequestSchema.Name == MessageName(m) } @@ -145,7 +146,7 @@ type MessageSchema struct { // Name identifies the message name, this must be queryable from some reflection service. Name string // New is used to create a new message instance for the schema. - New func() ProtoMsg + New func() transaction.Msg } // HandlerSchema defines the schema of a handler. diff --git a/x/accounts/internal/implementation/protoaccount.go b/x/accounts/internal/implementation/protoaccount.go index 122ec1168827..e17c793316f2 100644 --- a/x/accounts/internal/implementation/protoaccount.go +++ b/x/accounts/internal/implementation/protoaccount.go @@ -5,6 +5,8 @@ import ( "fmt" "google.golang.org/protobuf/proto" + + "cosmossdk.io/core/transaction" ) // RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf. @@ -14,7 +16,7 @@ func RegisterInitHandler[ ) { reqName := MessageName(ProtoReq(new(Req))) - router.handler = func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) { + router.handler = func(ctx context.Context, initRequest transaction.Msg) (initResponse transaction.Msg, err error) { concrete, ok := initRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, initRequest) @@ -40,7 +42,7 @@ func RegisterExecuteHandler[ return } - router.handlers[reqName] = func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) { + router.handlers[reqName] = func(ctx context.Context, executeRequest transaction.Msg) (executeResponse transaction.Msg, err error) { concrete, ok := executeRequest.(ProtoReq) if !ok { return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, executeRequest) @@ -69,7 +71,7 @@ func NewProtoMessageSchema[T any, PT ProtoMsgG[T]]() *MessageSchema { } return &MessageSchema{ Name: MessageName(msg), - New: func() ProtoMsg { + New: func() transaction.Msg { return PT(new(T)) }, } diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index 91ef5d707c82..fee356a7736f 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -13,6 +13,7 @@ import ( "cosmossdk.io/collections" "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/transaction" "cosmossdk.io/x/accounts/accountstd" "cosmossdk.io/x/accounts/internal/implementation" v1 "cosmossdk.io/x/accounts/v1" @@ -137,9 +138,9 @@ func (k Keeper) Init( ctx context.Context, accountType string, creator []byte, - initRequest implementation.ProtoMsg, + initRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, []byte, error) { +) (transaction.Msg, []byte, error) { // get the next account number num, err := k.AccountNumber.Next(ctx) if err != nil { @@ -158,7 +159,7 @@ func (k Keeper) Init( } // initFromMsg is a helper which inits an account given a v1.MsgInit. -func (k Keeper) initFromMsg(ctx context.Context, initMsg *v1.MsgInit) (implementation.ProtoMsg, []byte, error) { +func (k Keeper) initFromMsg(ctx context.Context, initMsg *v1.MsgInit) (transaction.Msg, []byte, error) { creator, err := k.addressCodec.StringToBytes(initMsg.Sender) if err != nil { return nil, nil, err @@ -182,9 +183,9 @@ func (k Keeper) init( creator []byte, accountNum uint64, accountAddr []byte, - initRequest implementation.ProtoMsg, + initRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, error) { +) (transaction.Msg, error) { impl, ok := k.accounts[accountType] if !ok { return nil, fmt.Errorf("%w: not found %s", errAccountTypeNotFound, accountType) @@ -223,8 +224,8 @@ func (k Keeper) MigrateLegacyAccount( addr []byte, // The current address of the account accNum uint64, // The current account number accType string, // The account type to migrate to - msg implementation.ProtoMsg, // The init msg of the account type we're migrating to -) (implementation.ProtoMsg, error) { + msg transaction.Msg, // The init msg of the account type we're migrating to +) (transaction.Msg, error) { return k.init(ctx, accType, addr, accNum, addr, msg, nil) } @@ -233,9 +234,9 @@ func (k Keeper) Execute( ctx context.Context, accountAddr []byte, sender []byte, - execRequest implementation.ProtoMsg, + execRequest transaction.Msg, funds sdk.Coins, -) (implementation.ProtoMsg, error) { +) (transaction.Msg, error) { // get account implementation impl, err := k.getImplementation(ctx, accountAddr) if err != nil { @@ -265,8 +266,8 @@ func (k Keeper) Execute( func (k Keeper) Query( ctx context.Context, accountAddr []byte, - queryRequest implementation.ProtoMsg, -) (implementation.ProtoMsg, error) { + queryRequest transaction.Msg, +) (transaction.Msg, error) { // get account implementation impl, err := k.getImplementation(ctx, accountAddr) if err != nil { @@ -315,8 +316,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountAddr, sender, funds, - k.sendModuleMessage, - k.SendModuleMessageUntyped, + k.SendModuleMessage, k.queryModule, ) } @@ -330,10 +330,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac accountAddr, nil, nil, - func(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { - return errors.New("cannot execute in query context") - }, - func(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { + func(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { return nil, errors.New("cannot execute in query context") }, k.queryModule, @@ -350,7 +347,7 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages if err != nil { return nil, err } - resp, err := k.SendModuleMessageUntyped(ctx, sender, msg) + resp, err := k.SendModuleMessage(ctx, sender, msg) if err != nil { return nil, fmt.Errorf("failed to execute message %d: %s", i, err.Error()) } @@ -363,9 +360,9 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages return anyResponses, nil } -// SendModuleMessageUntyped can be used to send a message towards a module. +// SendModuleMessage can be used to send a message towards a module. // It should be used when the response type is not known by the caller. -func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { +func (k Keeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { // do sender assertions. wantSenders, _, err := k.codec.GetMsgSigners(msg) if err != nil { @@ -377,7 +374,7 @@ func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg if !bytes.Equal(sender, wantSenders[0]) { return nil, fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) } - resp, err := k.MsgRouterService.InvokeUntyped(ctx, msg) + resp, err := k.MsgRouterService.Invoke(ctx, msg) if err != nil { return nil, err } @@ -388,26 +385,27 @@ func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg // sendModuleMessage can be used to send a message towards a module. It expects the // response type to be known by the caller. It will also assert the sender has the right // is not trying to impersonate another account. -func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { +func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { // do sender assertions. wantSenders, _, err := k.codec.GetMsgSigners(msg) if err != nil { - return fmt.Errorf("cannot get signers: %w", err) + return nil, fmt.Errorf("cannot get signers: %w", err) } if len(wantSenders) != 1 { - return fmt.Errorf("expected only one signer, got %d", len(wantSenders)) + return nil, fmt.Errorf("expected only one signer, got %d", len(wantSenders)) } if !bytes.Equal(sender, wantSenders[0]) { - return fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) + return nil, fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized) } - return k.MsgRouterService.InvokeTyped(ctx, msg, msgResp) + + return k.MsgRouterService.Invoke(ctx, msg) } // queryModule is the entrypoint for an account to query a module. // It will try to find the query handler for the given query and execute it. // If multiple query handlers are found, it will return an error. -func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp implementation.ProtoMsg) error { - return k.QueryRouterService.InvokeTyped(ctx, queryReq, queryResp) +func (k Keeper) queryModule(ctx context.Context, queryReq transaction.Msg) (transaction.Msg, error) { + return k.QueryRouterService.Invoke(ctx, queryReq) } // maybeSendFunds will send the provided coins between the provided addresses, if amt @@ -417,23 +415,24 @@ func (k Keeper) maybeSendFunds(ctx context.Context, from, to []byte, amt sdk.Coi return nil } - msg, msgResp, err := k.makeSendCoinsMsg(from, to, amt) + msg, err := k.makeSendCoinsMsg(from, to, amt) if err != nil { return err } // send module message ensures that "from" cannot impersonate. - err = k.sendModuleMessage(ctx, from, msg, msgResp) + _, err = k.sendModuleMessage(ctx, from, msg) if err != nil { return err } + return nil } const msgInterfaceName = "cosmos.accounts.v1.MsgInterface" // creates a new interface type which is an alias of the proto message interface to avoid conflicts with sdk.Msg -type msgInterface implementation.ProtoMsg +type msgInterface transaction.Msg var msgInterfaceType = (*msgInterface)(nil) diff --git a/x/auth/ante/setup.go b/x/auth/ante/setup.go index f048bb139324..e81a7cba5051 100644 --- a/x/auth/ante/setup.go +++ b/x/auth/ante/setup.go @@ -46,11 +46,16 @@ func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, _ bool, newCtx = SetGasMeter(ctx, gasTx.GetGas()) // TODO: possibly cache the result of this query for other antehandlers to use - var res consensusv1.QueryParamsResponse - if err := sud.env.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := sud.env.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return newCtx, err } + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return newCtx, fmt.Errorf("unexpected response type: %T", resp) + } + if res.Params.Block != nil { // If there exists a maximum block gas limit, we must ensure that the tx // does not exceed it. diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index d98cae0ca1e8..497cc50d8850 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -29,7 +29,7 @@ import ( // GetMultiSignCommand returns the multi-sign command func GetMultiSignCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "multi-sign [...]", + Use: "multi-sign [...]", Aliases: []string{"multisign"}, Short: "Generate multisig signatures for transactions generated offline", Long: strings.TrimSpace( diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 00240e8f9a65..5a8c35fda61f 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -315,7 +315,7 @@ func (ak AccountKeeper) NonAtomicMsgsExec(ctx context.Context, signer sdk.AccAdd } if err := ak.BranchService.Execute(ctx, func(ctx context.Context) error { - result, err := ak.AccountsModKeeper.SendModuleMessageUntyped(ctx, signer, msg) + result, err := ak.AccountsModKeeper.SendModuleMessage(ctx, signer, msg) if err != nil { // If an error occurs during message execution, append error response response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()} diff --git a/x/auth/keeper/msg_server_test.go b/x/auth/keeper/msg_server_test.go index 43a17bc13bc0..b6789421ed18 100644 --- a/x/auth/keeper/msg_server_test.go +++ b/x/auth/keeper/msg_server_test.go @@ -185,7 +185,7 @@ func (s *KeeperTestSuite) TestNonAtomicExec() { }, } - s.acctsModKeeper.EXPECT().SendModuleMessageUntyped(gomock.Any(), gomock.Any(), gomock.Any()). + s.acctsModKeeper.EXPECT().SendModuleMessage(gomock.Any(), gomock.Any(), gomock.Any()). DoAndReturn(func(_ context.Context, sender []byte, msg proto.Message) (protoiface.MessageV1, error) { return msg, nil }).AnyTimes() diff --git a/x/auth/testutil/expected_keepers_mocks.go b/x/auth/testutil/expected_keepers_mocks.go index a53fb9b61b85..348a1740378a 100644 --- a/x/auth/testutil/expected_keepers_mocks.go +++ b/x/auth/testutil/expected_keepers_mocks.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" + transaction "cosmossdk.io/core/transaction" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" - protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -149,17 +149,17 @@ func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAccountNumber", reflect.TypeOf((*MockAccountsModKeeper)(nil).NextAccountNumber), ctx) } -// SendModuleMessageUntyped mocks base method. -func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { +// SendModuleMessage mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) - ret0, _ := ret[0].(protoiface.MessageV1) + ret := m.ctrl.Call(m, "SendModuleMessage", ctx, sender, msg) + ret0, _ := ret[0].(transaction.Msg) ret1, _ := ret[1].(error) return ret0, ret1 } -// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. -func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { +// SendModuleMessage indicates an expected call of SendModuleMessage. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessage", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessage), ctx, sender, msg) } diff --git a/x/auth/types/expected_keepers.go b/x/auth/types/expected_keepers.go index 401988a7d00d..7fb82e89ed8a 100644 --- a/x/auth/types/expected_keepers.go +++ b/x/auth/types/expected_keepers.go @@ -3,7 +3,7 @@ package types import ( "context" - "google.golang.org/protobuf/runtime/protoiface" + "cosmossdk.io/core/transaction" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -17,7 +17,7 @@ type BankKeeper interface { // AccountsModKeeper defines the contract for x/accounts APIs type AccountsModKeeper interface { - SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) + SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool NextAccountNumber(ctx context.Context) (accNum uint64, err error) diff --git a/x/auth/vesting/testutil/expected_keepers_mocks.go b/x/auth/vesting/testutil/expected_keepers_mocks.go index 3446770eceae..7612d81e200b 100644 --- a/x/auth/vesting/testutil/expected_keepers_mocks.go +++ b/x/auth/vesting/testutil/expected_keepers_mocks.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" + transaction "cosmossdk.io/core/transaction" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" - protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -149,17 +149,17 @@ func (mr *MockAccountsModKeeperMockRecorder) NextAccountNumber(ctx interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextAccountNumber", reflect.TypeOf((*MockAccountsModKeeper)(nil).NextAccountNumber), ctx) } -// SendModuleMessageUntyped mocks base method. -func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { +// SendModuleMessage mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessage(ctx context.Context, sender []byte, msg transaction.Msg) (transaction.Msg, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) - ret0, _ := ret[0].(protoiface.MessageV1) + ret := m.ctrl.Call(m, "SendModuleMessage", ctx, sender, msg) + ret0, _ := ret[0].(transaction.Msg) ret1, _ := ret[1].(error) return ret0, ret1 } -// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. -func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { +// SendModuleMessage indicates an expected call of SendModuleMessage. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessage(ctx, sender, msg interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessage", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessage), ctx, sender, msg) } diff --git a/x/authz/client/cli/tx.go b/x/authz/client/cli/tx.go index f8cc4b26a165..515efb5aa95a 100644 --- a/x/authz/client/cli/tx.go +++ b/x/authz/client/cli/tx.go @@ -58,8 +58,8 @@ func GetTxCmd() *cobra.Command { // but it will be removed in future versions. func NewCmdExecAuthorization() *cobra.Command { cmd := &cobra.Command{ - Use: "legacy-exec --from ", - Short: "Execute tx on behalf of granter account. Deprecated, use exec instead.", + Use: "legacy-exec --from ", + Short: "Execute tx on behalf of granter account. Deprecated, use exec instead.", Example: fmt.Sprintf("$ %s tx authz exec tx.json --from grantee\n $ %[1]s tx bank send [granter] [recipient] [amount] --generate-only tx.json && %[1]s tx authz exec tx.json --from grantee", version.AppName), Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/authz/keeper/keeper.go b/x/authz/keeper/keeper.go index e2708a55ff31..8e24fff495c4 100644 --- a/x/authz/keeper/keeper.go +++ b/x/authz/keeper/keeper.go @@ -146,7 +146,7 @@ func (k Keeper) DispatchActions(ctx context.Context, grantee sdk.AccAddress, msg } // no need to use the branch service here, as if the transaction fails, the transaction will be reverted - resp, err := k.MsgRouterService.InvokeUntyped(ctx, msg) + resp, err := k.MsgRouterService.Invoke(ctx, msg) if err != nil { return nil, fmt.Errorf("failed to execute message %d; message %v: %w", i, msg, err) } diff --git a/x/evidence/keeper/infraction.go b/x/evidence/keeper/infraction.go index 713d21ad62b8..ac417aa6c664 100644 --- a/x/evidence/keeper/infraction.go +++ b/x/evidence/keeper/infraction.go @@ -73,10 +73,15 @@ func (k Keeper) handleEquivocationEvidence(ctx context.Context, evidence *types. // Reject evidence if the double-sign is too old. Evidence is considered stale // if the difference in time and number of blocks is greater than the allowed // parameters defined. - var res consensusv1.QueryParamsResponse - if err := k.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := k.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return fmt.Errorf("failed to query consensus params: %w", err) } + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + if res.Params.Evidence != nil { if ageDuration > res.Params.Evidence.MaxAgeDuration && ageBlocks > res.Params.Evidence.MaxAgeNumBlocks { k.Logger.Info( diff --git a/x/gov/keeper/abci.go b/x/gov/keeper/abci.go index f45c3d4c0a66..c0e4120528ab 100644 --- a/x/gov/keeper/abci.go +++ b/x/gov/keeper/abci.go @@ -288,7 +288,7 @@ func safeExecuteHandler(ctx context.Context, msg sdk.Msg, router router.Service) } }() - res, err = router.InvokeUntyped(ctx, msg) + res, err = router.Invoke(ctx, msg) return } diff --git a/x/gov/keeper/abci_internal_test.go b/x/gov/keeper/abci_internal_test.go index 47a6a197a0f9..fc1315dc73cf 100644 --- a/x/gov/keeper/abci_internal_test.go +++ b/x/gov/keeper/abci_internal_test.go @@ -16,7 +16,7 @@ type mockRouterService struct { panic bool } -func (m *mockRouterService) InvokeUntyped(ctx context.Context, req gogoproto.Message) (res gogoproto.Message, err error) { +func (m *mockRouterService) Invoke(ctx context.Context, req gogoproto.Message) (res gogoproto.Message, err error) { if m.panic { panic("test-fail") } diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 5c7b623f045f..8dca8c094fe1 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -5,10 +5,9 @@ import ( "encoding/json" "fmt" - "google.golang.org/protobuf/runtime/protoiface" - corecontext "cosmossdk.io/core/context" "cosmossdk.io/core/event" + "cosmossdk.io/core/transaction" "cosmossdk.io/errors" "cosmossdk.io/math" govtypes "cosmossdk.io/x/gov/types" @@ -379,14 +378,14 @@ func (k msgServer) SudoExec(ctx context.Context, msg *v1.MsgSudoExec) (*v1.MsgSu } } - var msgResp protoiface.MessageV1 + var msgResp transaction.Msg if err := k.BranchService.Execute(ctx, func(ctx context.Context) error { // TODO add route check here if err := k.MsgRouterService.CanInvoke(ctx, sdk.MsgTypeURL(sudoedMsg)); err != nil { return errors.Wrap(govtypes.ErrInvalidProposal, err.Error()) } - msgResp, err = k.MsgRouterService.InvokeUntyped(ctx, sudoedMsg) + msgResp, err = k.MsgRouterService.Invoke(ctx, sudoedMsg) if err != nil { return errors.Wrapf(err, "failed to execute sudo-ed message; message %v", sudoedMsg) } diff --git a/x/group/go.mod b/x/group/go.mod index e45f397fdd67..b1914af1edf4 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -45,6 +45,7 @@ require ( cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect + cosmossdk.io/x/distribution v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 // indirect cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 // indirect; main filippo.io/edwards25519 v1.1.0 // indirect @@ -191,6 +192,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts + cosmossdk.io/x/accounts/defaults/lockup => ../accounts/defaults/lockup cosmossdk.io/x/accounts/defaults/multisig => ../accounts/defaults/multisig cosmossdk.io/x/auth => ../auth cosmossdk.io/x/authz => ../authz diff --git a/x/group/go.sum b/x/group/go.sum index 4f224f22008a..f71b223c0c13 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -22,10 +22,15 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= +<<<<<<< HEAD cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA= cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o= +======= +cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= +cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= +>>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 h1:GuBrfHsK3RD5vlD4DuBz3DXslR6VlnzrYmHOC3L679Q= cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337/go.mod h1:PhLn1pMBilyRC4GfRkoYhm+XVAYhF4adVrzut8AdpJI= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 h1:J3vS3G41JtTWkUX3wVKcXdy1yPUca0d3QnexCR52PeY= diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index ffa9f4657ea1..4ecef52d1927 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -45,7 +45,7 @@ func (k Keeper) doExecuteMsgs(ctx context.Context, proposal group.Proposal, grou } for i, msg := range msgs { - if _, err := k.MsgRouterService.InvokeUntyped(ctx, msg); err != nil { + if _, err := k.MsgRouterService.Invoke(ctx, msg); err != nil { return errorsmod.Wrapf(err, "message %s at position %d", sdk.MsgTypeURL(msg), i) } } diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 166f5a1ef62b..cd8fc499c012 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -69,10 +69,15 @@ func (k msgServer) CreateValidator(ctx context.Context, msg *types.MsgCreateVali return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidType, "Expecting cryptotypes.PubKey, got %T", msg.Pubkey.GetCachedValue()) } - res := consensusv1.QueryParamsResponse{} - if err := k.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := k.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "failed to query consensus params: %s", err) } + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "unexpected response type: %T", resp) + } + if res.Params.Validator != nil { pkType := pk.Type() if !slices.Contains(res.Params.Validator.PubKeyTypes, pkType) { @@ -652,10 +657,15 @@ func (k msgServer) RotateConsPubKey(ctx context.Context, msg *types.MsgRotateCon } // check if the new public key type is valid - paramsRes := consensusv1.QueryParamsResponse{} - if err := k.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, ¶msRes); err != nil { + resp, err := k.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "failed to query consensus params: %s", err) } + paramsRes, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "unexpected response type: %T", resp) + } + if paramsRes.Params.Validator != nil { pkType := pk.Type() if !slices.Contains(paramsRes.Params.Validator.PubKeyTypes, pkType) { diff --git a/x/upgrade/keeper/abci.go b/x/upgrade/keeper/abci.go index e6bed2f5e6ae..926dd4afec09 100644 --- a/x/upgrade/keeper/abci.go +++ b/x/upgrade/keeper/abci.go @@ -45,10 +45,16 @@ func (k Keeper) PreBlocker(ctx context.Context) error { if lastAppliedPlan != "" && !k.HasHandler(lastAppliedPlan) { var appVersion uint64 - var res consensusv1.QueryParamsResponse - if err := k.QueryRouterService.InvokeTyped(ctx, &consensusv1.QueryParamsRequest{}, &res); err != nil { + resp, err := k.QueryRouterService.Invoke(ctx, &consensusv1.QueryParamsRequest{}) + if err != nil { return errors.New("failed to query consensus params") } + + res, ok := resp.(*consensusv1.QueryParamsResponse) + if !ok { + return fmt.Errorf("unexpected response type: %T", resp) + } + if res.Params.Version != nil { appVersion = res.Params.Version.App } From f78a775ceb9982593b9807e0b299487334528d0a Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Aug 2024 23:46:58 +0200 Subject: [PATCH 2/3] conflicts --- core/router/service.go | 16 - schema/appdata/batch_test.go | 85 --- schema/diff/diff_test.go | 335 ---------- server/v2/stf/core_router_service.go | 74 --- server/v2/stf/stf.go | 625 ------------------ server/v2/stf/stf_router.go | 170 ----- server/v2/stf/stf_router_test.go | 48 -- .../cosmovisor/cmd/cosmovisor/version_test.go | 27 - x/accounts/defaults/lockup/go.mod | 18 - x/accounts/go.mod | 11 - x/accounts/go.sum | 7 - x/group/go.sum | 7 - 12 files changed, 1423 deletions(-) delete mode 100644 core/router/service.go delete mode 100644 schema/appdata/batch_test.go delete mode 100644 schema/diff/diff_test.go delete mode 100644 server/v2/stf/core_router_service.go delete mode 100644 server/v2/stf/stf.go delete mode 100644 server/v2/stf/stf_router.go delete mode 100644 server/v2/stf/stf_router_test.go delete mode 100644 tools/cosmovisor/cmd/cosmovisor/version_test.go diff --git a/core/router/service.go b/core/router/service.go deleted file mode 100644 index 95c65f851e0c..000000000000 --- a/core/router/service.go +++ /dev/null @@ -1,16 +0,0 @@ -package router - -import ( - "context" - - "cosmossdk.io/core/transaction" -) - -// Service is the interface that wraps the basic methods for a router. -// A router can be a query router or a message router. -type Service interface { - // CanInvoke returns an error if the given request cannot be invoked. - CanInvoke(ctx context.Context, typeURL string) error - // Invoke execute a message or query. The response should be type casted by the caller to the expected response. - Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) -} diff --git a/schema/appdata/batch_test.go b/schema/appdata/batch_test.go deleted file mode 100644 index 0f43f07ba063..000000000000 --- a/schema/appdata/batch_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package appdata - -import ( - "context" - "reflect" - "testing" -) - -func TestBatch(t *testing.T) { - l, got := batchListener() - - if err := l.SendPacket(testBatch); err != nil { - t.Error(err) - } - - if !reflect.DeepEqual(*got, testBatch) { - t.Errorf("got %v, expected %v", *got, testBatch) - } -} - -var testBatch = PacketBatch{ - ModuleInitializationData{}, - StartBlockData{}, - TxData{}, - EventData{}, - KVPairData{}, - ObjectUpdateData{}, -} - -func batchListener() (Listener, *PacketBatch) { - got := new(PacketBatch) - l := Listener{ - InitializeModuleData: func(m ModuleInitializationData) error { - *got = append(*got, m) - return nil - }, - StartBlock: func(b StartBlockData) error { - *got = append(*got, b) - return nil - }, - OnTx: func(t TxData) error { - *got = append(*got, t) - return nil - }, - OnEvent: func(e EventData) error { - *got = append(*got, e) - return nil - }, - OnKVPair: func(k KVPairData) error { - *got = append(*got, k) - return nil - }, - OnObjectUpdate: func(o ObjectUpdateData) error { - *got = append(*got, o) - return nil - }, - } - - return l, got -} - -func TestBatchAsync(t *testing.T) { - l, got := batchListener() - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - l = AsyncListenerMux(AsyncListenerOptions{Context: ctx}, l) - - if err := l.SendPacket(testBatch); err != nil { - t.Error(err) - } - - // commit to synchronize - cb, err := l.Commit(CommitData{}) - if err != nil { - t.Error(err) - } - if err := cb(); err != nil { - t.Error(err) - } - - if !reflect.DeepEqual(*got, testBatch) { - t.Errorf("got %v, expected %v", *got, testBatch) - } -} diff --git a/schema/diff/diff_test.go b/schema/diff/diff_test.go deleted file mode 100644 index 159d85c3500c..000000000000 --- a/schema/diff/diff_test.go +++ /dev/null @@ -1,335 +0,0 @@ -package diff - -import ( - "reflect" - "testing" - - "cosmossdk.io/schema" -) - -func TestCompareModuleSchemas(t *testing.T) { - tt := []struct { - name string - oldSchema schema.ModuleSchema - newSchema schema.ModuleSchema - diff ModuleSchemaDiff - hasCompatibleChanges bool - empty bool - }{ - { - name: "no change", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - diff: ModuleSchemaDiff{}, - hasCompatibleChanges: true, - empty: true, - }, - { - name: "object type added", - oldSchema: mustModuleSchema(t), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - diff: ModuleSchemaDiff{ - AddedObjectTypes: []schema.ObjectType{ - { - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }, - }, - }, - hasCompatibleChanges: true, - }, - { - name: "object type removed", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t), - diff: ModuleSchemaDiff{ - RemovedObjectTypes: []schema.ObjectType{ - { - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "object type changed, key field added", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - KeyFieldsDiff: FieldsDiff{ - Added: []schema.Field{ - {Name: "key2", Kind: schema.StringKind}, - }, - }, - }, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "object type changed, nullable value field added", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - ValueFieldsDiff: FieldsDiff{ - Added: []schema.Field{{Name: "value1", Kind: schema.StringKind, Nullable: true}}, - }, - }, - }, - }, - hasCompatibleChanges: true, - }, - { - name: "object type changed, non-nullable value field added", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}}, - ValueFields: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - ValueFieldsDiff: FieldsDiff{ - Added: []schema.Field{{Name: "value1", Kind: schema.StringKind}}, - }, - }, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "object type changed, fields reordered", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.StringKind}, {Name: "key2", Kind: schema.StringKind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key2", Kind: schema.StringKind}, {Name: "key1", Kind: schema.StringKind}}, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - KeyFieldsDiff: FieldsDiff{ - OldOrder: []string{"key1", "key2"}, - NewOrder: []string{"key2", "key1"}, - }, - }, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "enum type added, nullable value field added", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, - ValueFields: []schema.Field{ - { - Name: "value1", - Kind: schema.EnumKind, - EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, - Nullable: true, - }, - }, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - ValueFieldsDiff: FieldsDiff{ - Added: []schema.Field{ - { - Name: "value1", - Kind: schema.EnumKind, - EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, - Nullable: true, - }, - }, - }, - }, - }, - AddedEnumTypes: []schema.EnumType{ - {Name: "enum1", Values: []string{"a", "b"}}, - }, - }, - hasCompatibleChanges: true, - }, - { - name: "enum type removed", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, - ValueFields: []schema.Field{ - { - Name: "value1", - Kind: schema.EnumKind, - EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, - }, - }, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.Int32Kind}}, - }), - diff: ModuleSchemaDiff{ - ChangedObjectTypes: []ObjectTypeDiff{ - { - Name: "object1", - ValueFieldsDiff: FieldsDiff{ - Removed: []schema.Field{ - { - Name: "value1", - Kind: schema.EnumKind, - EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}, - }, - }, - }, - }, - }, - RemovedEnumTypes: []schema.EnumType{ - {Name: "enum1", Values: []string{"a", "b"}}, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "enum value added", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a"}}}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}}}, - }), - diff: ModuleSchemaDiff{ - ChangedEnumTypes: []EnumTypeDiff{ - { - Name: "enum1", - AddedValues: []string{"b"}, - }, - }, - }, - hasCompatibleChanges: true, - }, - { - name: "enum value removed", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b", "c"}}}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "object1", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "enum1", Values: []string{"a", "b"}}}}, - }), - diff: ModuleSchemaDiff{ - ChangedEnumTypes: []EnumTypeDiff{ - { - Name: "enum1", - RemovedValues: []string{"c"}, - }, - }, - }, - hasCompatibleChanges: false, - }, - { - name: "object type and enum type name switched", - oldSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "foo", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "bar", Values: []string{"a"}}}}, - }), - newSchema: mustModuleSchema(t, schema.ObjectType{ - Name: "bar", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "foo", Values: []string{"a"}}}}, - }), - diff: ModuleSchemaDiff{ - RemovedObjectTypes: []schema.ObjectType{ - { - Name: "foo", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "bar", Values: []string{"a"}}}}, - }, - }, - AddedObjectTypes: []schema.ObjectType{ - { - Name: "bar", - KeyFields: []schema.Field{{Name: "key1", Kind: schema.EnumKind, EnumType: schema.EnumType{Name: "foo", Values: []string{"a"}}}}, - }, - }, - RemovedEnumTypes: []schema.EnumType{ - {Name: "bar", Values: []string{"a"}}, - }, - AddedEnumTypes: []schema.EnumType{ - {Name: "foo", Values: []string{"a"}}, - }, - }, - hasCompatibleChanges: false, - }, - } - - for _, tc := range tt { - t.Run(tc.name, func(t *testing.T) { - got := CompareModuleSchemas(tc.oldSchema, tc.newSchema) - if !reflect.DeepEqual(got, tc.diff) { - t.Errorf("CompareModuleSchemas() = %v, want %v", got, tc.diff) - } - hasCompatibleChanges := got.HasCompatibleChanges() - if hasCompatibleChanges != tc.hasCompatibleChanges { - t.Errorf("HasCompatibleChanges() = %v, want %v", hasCompatibleChanges, tc.hasCompatibleChanges) - } - if tc.empty != got.Empty() { - t.Errorf("Empty() = %v, want %v", got.Empty(), tc.empty) - } - }) - } -} - -func mustModuleSchema(t *testing.T, objectTypes ...schema.ObjectType) schema.ModuleSchema { - s, err := schema.NewModuleSchema(objectTypes) - if err != nil { - t.Fatal(err) - } - return s -} diff --git a/server/v2/stf/core_router_service.go b/server/v2/stf/core_router_service.go deleted file mode 100644 index e3a3f95940a6..000000000000 --- a/server/v2/stf/core_router_service.go +++ /dev/null @@ -1,74 +0,0 @@ -package stf - -import ( - "context" - - "cosmossdk.io/core/router" - "cosmossdk.io/core/transaction" -) - -// NewMsgRouterService implements router.Service. -func NewMsgRouterService(identity transaction.Identity) router.Service { - return msgRouterService{identity: identity} -} - -var _ router.Service = (*msgRouterService)(nil) - -type msgRouterService struct { - // TODO(tip): the identity sits here for the purpose of disallowing modules to impersonate others (sudo). - // right now this is not used, but it serves the reminder of something that we should be eventually - // looking into. - identity []byte -} - -// CanInvoke returns an error if the given message cannot be invoked. -func (m msgRouterService) CanInvoke(ctx context.Context, typeURL string) error { - exCtx, err := getExecutionCtxFromContext(ctx) - if err != nil { - return err - } - - return exCtx.msgRouter.CanInvoke(ctx, typeURL) -} - -// Invoke execute a message and returns a response. -func (m msgRouterService) Invoke(ctx context.Context, msg transaction.Msg) (transaction.Msg, error) { - exCtx, err := getExecutionCtxFromContext(ctx) - if err != nil { - return nil, err - } - - return exCtx.msgRouter.Invoke(ctx, msg) -} - -// NewQueryRouterService implements router.Service. -func NewQueryRouterService() router.Service { - return queryRouterService{} -} - -var _ router.Service = (*queryRouterService)(nil) - -type queryRouterService struct{} - -// CanInvoke returns an error if the given request cannot be invoked. -func (m queryRouterService) CanInvoke(ctx context.Context, typeURL string) error { - exCtx, err := getExecutionCtxFromContext(ctx) - if err != nil { - return err - } - - return exCtx.queryRouter.CanInvoke(ctx, typeURL) -} - -// InvokeUntyped execute a message and returns a response. -func (m queryRouterService) Invoke( - ctx context.Context, - req transaction.Msg, -) (transaction.Msg, error) { - exCtx, err := getExecutionCtxFromContext(ctx) - if err != nil { - return nil, err - } - - return exCtx.queryRouter.Invoke(ctx, req) -} diff --git a/server/v2/stf/stf.go b/server/v2/stf/stf.go deleted file mode 100644 index 43fa6bcf9c3f..000000000000 --- a/server/v2/stf/stf.go +++ /dev/null @@ -1,625 +0,0 @@ -package stf - -import ( - "context" - "errors" - "fmt" - - appmanager "cosmossdk.io/core/app" - appmodulev2 "cosmossdk.io/core/appmodule/v2" - corecontext "cosmossdk.io/core/context" - "cosmossdk.io/core/event" - "cosmossdk.io/core/gas" - "cosmossdk.io/core/header" - "cosmossdk.io/core/log" - "cosmossdk.io/core/router" - "cosmossdk.io/core/store" - "cosmossdk.io/core/transaction" - stfgas "cosmossdk.io/server/v2/stf/gas" - "cosmossdk.io/server/v2/stf/internal" -) - -// Identity defines STF's bytes identity and it's used by STF to store things in its own state. -var Identity = []byte("stf") - -type eContextKey struct{} - -var executionContextKey = eContextKey{} - -// STF is a struct that manages the state transition component of the app. -type STF[T transaction.Tx] struct { - logger log.Logger - - msgRouter coreRouterImpl - queryRouter coreRouterImpl - - doPreBlock func(ctx context.Context, txs []T) error - doBeginBlock func(ctx context.Context) error - doEndBlock func(ctx context.Context) error - doValidatorUpdate func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error) - - doTxValidation func(ctx context.Context, tx T) error - postTxExec func(ctx context.Context, tx T, success bool) error - - branchFn branchFn // branchFn is a function that given a readonly state it returns a writable version of it. - makeGasMeter makeGasMeterFn - makeGasMeteredState makeGasMeteredStateFn -} - -// NewSTF returns a new STF instance. -func NewSTF[T transaction.Tx]( - logger log.Logger, - msgRouterBuilder *MsgRouterBuilder, - queryRouterBuilder *MsgRouterBuilder, - doPreBlock func(ctx context.Context, txs []T) error, - doBeginBlock func(ctx context.Context) error, - doEndBlock func(ctx context.Context) error, - doTxValidation func(ctx context.Context, tx T) error, - doValidatorUpdate func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error), - postTxExec func(ctx context.Context, tx T, success bool) error, - branch func(store store.ReaderMap) store.WriterMap, -) (*STF[T], error) { - msgRouter, err := msgRouterBuilder.Build() - if err != nil { - return nil, fmt.Errorf("build msg router: %w", err) - } - queryRouter, err := queryRouterBuilder.Build() - if err != nil { - return nil, fmt.Errorf("build query router: %w", err) - } - - return &STF[T]{ - logger: logger, - msgRouter: msgRouter, - queryRouter: queryRouter, - doPreBlock: doPreBlock, - doBeginBlock: doBeginBlock, - doEndBlock: doEndBlock, - doValidatorUpdate: doValidatorUpdate, - doTxValidation: doTxValidation, - postTxExec: postTxExec, // TODO - branchFn: branch, - makeGasMeter: stfgas.DefaultGasMeter, - makeGasMeteredState: stfgas.DefaultWrapWithGasMeter, - }, nil -} - -// DeliverBlock is our state transition function. -// It takes a read only view of the state to apply the block to, -// executes the block and returns the block results and the new state. -func (s STF[T]) DeliverBlock( - ctx context.Context, - block *appmanager.BlockRequest[T], - state store.ReaderMap, -) (blockResult *appmanager.BlockResponse, newState store.WriterMap, err error) { - // creates a new branchFn state, from the readonly view of the state - // that can be written to. - newState = s.branchFn(state) - hi := header.Info{ - Hash: block.Hash, - AppHash: block.AppHash, - ChainID: block.ChainId, - Time: block.Time, - Height: int64(block.Height), - } - // set header info - err = s.setHeaderInfo(newState, hi) - if err != nil { - return nil, nil, fmt.Errorf("unable to set initial header info, %w", err) - } - - exCtx := s.makeContext(ctx, appmanager.ConsensusIdentity, newState, internal.ExecModeFinalize) - exCtx.setHeaderInfo(hi) - - // reset events - exCtx.events = make([]event.Event, 0) - // pre block is called separate from begin block in order to prepopulate state - preBlockEvents, err := s.preBlock(exCtx, block.Txs) - if err != nil { - return nil, nil, err - } - - if err = isCtxCancelled(ctx); err != nil { - return nil, nil, err - } - - // reset events - exCtx.events = make([]event.Event, 0) - - // begin block - var beginBlockEvents []event.Event - if !block.IsGenesis { - // begin block - beginBlockEvents, err = s.beginBlock(exCtx) - if err != nil { - return nil, nil, err - } - } - - // check if we need to return early - if err = isCtxCancelled(ctx); err != nil { - return nil, nil, err - } - - // execute txs - txResults := make([]appmanager.TxResult, len(block.Txs)) - // TODO: skip first tx if vote extensions are enabled (marko) - for i, txBytes := range block.Txs { - // check if we need to return early or continue delivering txs - if err = isCtxCancelled(ctx); err != nil { - return nil, nil, err - } - txResults[i] = s.deliverTx(exCtx, newState, txBytes, transaction.ExecModeFinalize, hi) - } - // reset events - exCtx.events = make([]event.Event, 0) - // end block - endBlockEvents, valset, err := s.endBlock(exCtx) - if err != nil { - return nil, nil, err - } - - return &appmanager.BlockResponse{ - Apphash: nil, - ValidatorUpdates: valset, - PreBlockEvents: preBlockEvents, - BeginBlockEvents: beginBlockEvents, - TxResults: txResults, - EndBlockEvents: endBlockEvents, - }, newState, nil -} - -// deliverTx executes a TX and returns the result. -func (s STF[T]) deliverTx( - ctx context.Context, - state store.WriterMap, - tx T, - execMode transaction.ExecMode, - hi header.Info, -) appmanager.TxResult { - // recover in the case of a panic - var recoveryError error - defer func() { - if r := recover(); r != nil { - recoveryError = fmt.Errorf("panic during transaction execution: %s", r) - s.logger.Error("panic during transaction execution", "error", recoveryError) - } - }() - // handle error from GetGasLimit - gasLimit, gasLimitErr := tx.GetGasLimit() - if gasLimitErr != nil { - return appmanager.TxResult{ - Error: gasLimitErr, - } - } - - if recoveryError != nil { - return appmanager.TxResult{ - Error: recoveryError, - } - } - - validateGas, validationEvents, err := s.validateTx(ctx, state, gasLimit, tx, execMode) - if err != nil { - return appmanager.TxResult{ - Error: err, - } - } - - execResp, execGas, execEvents, err := s.execTx(ctx, state, gasLimit-validateGas, tx, execMode, hi) - return appmanager.TxResult{ - Events: append(validationEvents, execEvents...), - GasUsed: execGas + validateGas, - GasWanted: gasLimit, - Resp: execResp, - Error: err, - } -} - -// validateTx validates a transaction given the provided WritableState and gas limit. -// If the validation is successful, state is committed -func (s STF[T]) validateTx( - ctx context.Context, - state store.WriterMap, - gasLimit uint64, - tx T, - execMode transaction.ExecMode, -) (gasUsed uint64, events []event.Event, err error) { - validateState := s.branchFn(state) - hi, err := s.getHeaderInfo(validateState) - if err != nil { - return 0, nil, err - } - validateCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, validateState, execMode) - validateCtx.setHeaderInfo(hi) - validateCtx.setGasLimit(gasLimit) - err = s.doTxValidation(validateCtx, tx) - if err != nil { - return 0, nil, err - } - - consumed := validateCtx.meter.Limit() - validateCtx.meter.Remaining() - - return consumed, validateCtx.events, applyStateChanges(state, validateState) -} - -// execTx executes the tx messages on the provided state. If the tx fails then the state is discarded. -func (s STF[T]) execTx( - ctx context.Context, - state store.WriterMap, - gasLimit uint64, - tx T, - execMode transaction.ExecMode, - hi header.Info, -) ([]transaction.Msg, uint64, []event.Event, error) { - execState := s.branchFn(state) - - msgsResp, gasUsed, runTxMsgsEvents, txErr := s.runTxMsgs(ctx, execState, gasLimit, tx, execMode, hi) - if txErr != nil { - // in case of error during message execution, we do not apply the exec state. - // instead we run the post exec handler in a new branchFn from the initial state. - postTxState := s.branchFn(state) - postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, postTxState, execMode) - postTxCtx.setHeaderInfo(hi) - - postTxErr := s.postTxExec(postTxCtx, tx, false) - if postTxErr != nil { - // if the post tx handler fails, then we do not apply any state change to the initial state. - // we just return the exec gas used and a joined error from TX error and post TX error. - return nil, gasUsed, nil, errors.Join(txErr, postTxErr) - } - // in case post tx is successful, then we commit the post tx state to the initial state, - // and we return post tx events alongside exec gas used and the error of the tx. - applyErr := applyStateChanges(state, postTxState) - if applyErr != nil { - return nil, 0, nil, applyErr - } - return nil, gasUsed, postTxCtx.events, txErr - } - // tx execution went fine, now we use the same state to run the post tx exec handler, - // in case the execution of the post tx fails, then no state change is applied and the - // whole execution step is rolled back. - postTxCtx := s.makeContext(ctx, appmanager.RuntimeIdentity, execState, execMode) // NO gas limit. - postTxCtx.setHeaderInfo(hi) - postTxErr := s.postTxExec(postTxCtx, tx, true) - if postTxErr != nil { - // if post tx fails, then we do not apply any state change, we return the post tx error, - // alongside the gas used. - return nil, gasUsed, nil, postTxErr - } - // both the execution and post tx execution step were successful, so we apply the state changes - // to the provided state, and we return responses, and events from exec tx and post tx exec. - applyErr := applyStateChanges(state, execState) - if applyErr != nil { - return nil, 0, nil, applyErr - } - - return msgsResp, gasUsed, append(runTxMsgsEvents, postTxCtx.events...), nil -} - -// runTxMsgs will execute the messages contained in the TX with the provided state. -func (s STF[T]) runTxMsgs( - ctx context.Context, - state store.WriterMap, - gasLimit uint64, - tx T, - execMode transaction.ExecMode, - hi header.Info, -) ([]transaction.Msg, uint64, []event.Event, error) { - txSenders, err := tx.GetSenders() - if err != nil { - return nil, 0, nil, err - } - msgs, err := tx.GetMessages() - if err != nil { - return nil, 0, nil, err - } - msgResps := make([]transaction.Msg, len(msgs)) - - execCtx := s.makeContext(ctx, nil, state, execMode) - execCtx.setHeaderInfo(hi) - execCtx.setGasLimit(gasLimit) - for i, msg := range msgs { - execCtx.sender = txSenders[i] - resp, err := s.msgRouter.Invoke(execCtx, msg) - if err != nil { - return nil, 0, nil, fmt.Errorf("message execution at index %d failed: %w", i, err) - } - msgResps[i] = resp - } - - consumed := execCtx.meter.Limit() - execCtx.meter.Remaining() - return msgResps, consumed, execCtx.events, nil -} - -// preBlock executes the pre block logic. -func (s STF[T]) preBlock( - ctx *executionContext, - txs []T, -) ([]event.Event, error) { - err := s.doPreBlock(ctx, txs) - if err != nil { - return nil, err - } - - for i, e := range ctx.events { - ctx.events[i].Attributes = append( - e.Attributes, - event.Attribute{Key: "mode", Value: "PreBlock"}, - ) - } - - return ctx.events, nil -} - -// beginBlock executes the begin block logic. -func (s STF[T]) beginBlock( - ctx *executionContext, -) (beginBlockEvents []event.Event, err error) { - err = s.doBeginBlock(ctx) - if err != nil { - return nil, err - } - - for i, e := range ctx.events { - ctx.events[i].Attributes = append( - e.Attributes, - event.Attribute{Key: "mode", Value: "BeginBlock"}, - ) - } - - return ctx.events, nil -} - -// endBlock executes the end block logic. -func (s STF[T]) endBlock( - ctx *executionContext, -) ([]event.Event, []appmodulev2.ValidatorUpdate, error) { - err := s.doEndBlock(ctx) - if err != nil { - return nil, nil, err - } - - events, valsetUpdates, err := s.validatorUpdates(ctx) - if err != nil { - return nil, nil, err - } - - ctx.events = append(ctx.events, events...) - - for i, e := range ctx.events { - ctx.events[i].Attributes = append( - e.Attributes, - event.Attribute{Key: "mode", Value: "BeginBlock"}, - ) - } - - return ctx.events, valsetUpdates, nil -} - -// validatorUpdates returns the validator updates for the current block. It is called by endBlock after the endblock execution has concluded -func (s STF[T]) validatorUpdates( - ctx *executionContext, -) ([]event.Event, []appmodulev2.ValidatorUpdate, error) { - valSetUpdates, err := s.doValidatorUpdate(ctx) - if err != nil { - return nil, nil, err - } - return ctx.events, valSetUpdates, nil -} - -// Simulate simulates the execution of a tx on the provided state. -func (s STF[T]) Simulate( - ctx context.Context, - state store.ReaderMap, - gasLimit uint64, - tx T, -) (appmanager.TxResult, store.WriterMap) { - simulationState := s.branchFn(state) - hi, err := s.getHeaderInfo(simulationState) - if err != nil { - return appmanager.TxResult{}, nil - } - txr := s.deliverTx(ctx, simulationState, tx, internal.ExecModeSimulate, hi) - - return txr, simulationState -} - -// ValidateTx will run only the validation steps required for a transaction. -// Validations are run over the provided state, with the provided gas limit. -func (s STF[T]) ValidateTx( - ctx context.Context, - state store.ReaderMap, - gasLimit uint64, - tx T, -) appmanager.TxResult { - validationState := s.branchFn(state) - gasUsed, events, err := s.validateTx(ctx, validationState, gasLimit, tx, transaction.ExecModeCheck) - return appmanager.TxResult{ - Events: events, - GasUsed: gasUsed, - Error: err, - } -} - -// Query executes the query on the provided state with the provided gas limits. -func (s STF[T]) Query( - ctx context.Context, - state store.ReaderMap, - gasLimit uint64, - req transaction.Msg, -) (transaction.Msg, error) { - queryState := s.branchFn(state) - hi, err := s.getHeaderInfo(queryState) - if err != nil { - return nil, err - } - queryCtx := s.makeContext(ctx, nil, queryState, internal.ExecModeSimulate) - queryCtx.setHeaderInfo(hi) - queryCtx.setGasLimit(gasLimit) - return s.queryRouter.Invoke(queryCtx, req) -} - -// RunWithCtx is made to support genesis, if genesis was just the execution of messages instead -// of being something custom then we would not need this. PLEASE DO NOT USE. -// TODO: Remove -func (s STF[T]) RunWithCtx( - ctx context.Context, - state store.ReaderMap, - closure func(ctx context.Context) error, -) (store.WriterMap, error) { - branchedState := s.branchFn(state) - stfCtx := s.makeContext(ctx, nil, branchedState, internal.ExecModeFinalize) - return branchedState, closure(stfCtx) -} - -// clone clones STF. -func (s STF[T]) clone() STF[T] { - return STF[T]{ - logger: s.logger, - msgRouter: s.msgRouter, - queryRouter: s.queryRouter, - doPreBlock: s.doPreBlock, - doBeginBlock: s.doBeginBlock, - doEndBlock: s.doEndBlock, - doValidatorUpdate: s.doValidatorUpdate, - doTxValidation: s.doTxValidation, - postTxExec: s.postTxExec, - branchFn: s.branchFn, - makeGasMeter: s.makeGasMeter, - makeGasMeteredState: s.makeGasMeteredState, - } -} - -// executionContext is a struct that holds the context for the execution of a tx. -type executionContext struct { - context.Context - - // unmeteredState is storage without metering. Changes here are propagated to state which is the metered - // version. - unmeteredState store.WriterMap - // state is the gas metered state. - state store.WriterMap - // meter is the gas meter. - meter gas.Meter - // events are the current events. - events []event.Event - // sender is the causer of the state transition. - sender transaction.Identity - // headerInfo contains the block info. - headerInfo header.Info - // execMode retains information about the exec mode. - execMode transaction.ExecMode - - branchFn branchFn - makeGasMeter makeGasMeterFn - makeGasMeteredStore makeGasMeteredStateFn - - msgRouter router.Service - queryRouter router.Service -} - -// setHeaderInfo sets the header info in the state to be used by queries in the future. -func (e *executionContext) setHeaderInfo(hi header.Info) { - e.headerInfo = hi -} - -// setGasLimit will update the gas limit of the *executionContext -func (e *executionContext) setGasLimit(limit uint64) { - meter := e.makeGasMeter(limit) - meteredState := e.makeGasMeteredStore(meter, e.unmeteredState) - - e.meter = meter - e.state = meteredState -} - -func (e *executionContext) Value(key any) any { - if key == executionContextKey { - return e - } - - return e.Context.Value(key) -} - -// TODO: too many calls to makeContext can be expensive -// makeContext creates and returns a new execution context for the STF[T] type. -// It takes in the following parameters: -// - ctx: The context.Context object for the execution. -// - sender: The transaction.Identity object representing the sender of the transaction. -// - state: The store.WriterMap object for accessing and modifying the state. -// - gasLimit: The maximum amount of gas allowed for the execution. -// - execMode: The corecontext.ExecMode object representing the execution mode. -// -// It returns a pointer to the executionContext struct -func (s STF[T]) makeContext( - ctx context.Context, - sender transaction.Identity, - store store.WriterMap, - execMode transaction.ExecMode, -) *executionContext { - valuedCtx := context.WithValue(ctx, corecontext.ExecModeKey, execMode) - return newExecutionContext( - valuedCtx, - s.makeGasMeter, - s.makeGasMeteredState, - s.branchFn, - sender, - store, - execMode, - s.msgRouter, - s.queryRouter, - ) -} - -func newExecutionContext( - ctx context.Context, - makeGasMeterFn makeGasMeterFn, - makeGasMeteredStoreFn makeGasMeteredStateFn, - branchFn branchFn, - sender transaction.Identity, - state store.WriterMap, - execMode transaction.ExecMode, - msgRouter coreRouterImpl, - queryRouter coreRouterImpl, -) *executionContext { - meter := makeGasMeterFn(gas.NoGasLimit) - meteredState := makeGasMeteredStoreFn(meter, state) - - return &executionContext{ - Context: ctx, - unmeteredState: state, - state: meteredState, - meter: meter, - events: make([]event.Event, 0), - sender: sender, - headerInfo: header.Info{}, - execMode: execMode, - branchFn: branchFn, - makeGasMeter: makeGasMeterFn, - makeGasMeteredStore: makeGasMeteredStoreFn, - msgRouter: msgRouter, - queryRouter: queryRouter, - } -} - -// applyStateChanges applies the state changes from the source store to the destination store. -// It retrieves the state changes from the source store using GetStateChanges method, -// and then applies those changes to the destination store using ApplyStateChanges method. -// If an error occurs during the retrieval or application of state changes, it is returned. -func applyStateChanges(dst, src store.WriterMap) error { - changes, err := src.GetStateChanges() - if err != nil { - return err - } - return dst.ApplyStateChanges(changes) -} - -// isCtxCancelled reports if the context was canceled. -func isCtxCancelled(ctx context.Context) error { - select { - case <-ctx.Done(): - return ctx.Err() - default: - return nil - } -} diff --git a/server/v2/stf/stf_router.go b/server/v2/stf/stf_router.go deleted file mode 100644 index 0593dddf71b4..000000000000 --- a/server/v2/stf/stf_router.go +++ /dev/null @@ -1,170 +0,0 @@ -package stf - -import ( - "context" - "errors" - "fmt" - "strings" - - gogoproto "github.com/cosmos/gogoproto/proto" - - appmodulev2 "cosmossdk.io/core/appmodule/v2" - "cosmossdk.io/core/router" - "cosmossdk.io/core/transaction" -) - -var ErrNoHandler = errors.New("no handler") - -// NewMsgRouterBuilder is a router that routes messages to their respective handlers. -func NewMsgRouterBuilder() *MsgRouterBuilder { - return &MsgRouterBuilder{ - handlers: make(map[string]appmodulev2.Handler), - preHandlers: make(map[string][]appmodulev2.PreMsgHandler), - postHandlers: make(map[string][]appmodulev2.PostMsgHandler), - } -} - -type MsgRouterBuilder struct { - handlers map[string]appmodulev2.Handler - globalPreHandlers []appmodulev2.PreMsgHandler - preHandlers map[string][]appmodulev2.PreMsgHandler - postHandlers map[string][]appmodulev2.PostMsgHandler - globalPostHandlers []appmodulev2.PostMsgHandler -} - -func (b *MsgRouterBuilder) RegisterHandler(msgType string, handler appmodulev2.Handler) error { - // panic on override - if _, ok := b.handlers[msgType]; ok { - return fmt.Errorf("handler already registered: %s", msgType) - } - b.handlers[msgType] = handler - return nil -} - -func (b *MsgRouterBuilder) RegisterGlobalPreHandler(handler appmodulev2.PreMsgHandler) { - b.globalPreHandlers = append(b.globalPreHandlers, handler) -} - -func (b *MsgRouterBuilder) RegisterPreHandler(msgType string, handler appmodulev2.PreMsgHandler) { - b.preHandlers[msgType] = append(b.preHandlers[msgType], handler) -} - -func (b *MsgRouterBuilder) RegisterPostHandler(msgType string, handler appmodulev2.PostMsgHandler) { - b.postHandlers[msgType] = append(b.postHandlers[msgType], handler) -} - -func (b *MsgRouterBuilder) RegisterGlobalPostHandler(handler appmodulev2.PostMsgHandler) { - b.globalPostHandlers = append(b.globalPostHandlers, handler) -} - -func (b *MsgRouterBuilder) HandlerExists(msgType string) bool { - _, ok := b.handlers[msgType] - return ok -} - -func (b *MsgRouterBuilder) Build() (coreRouterImpl, error) { - handlers := make(map[string]appmodulev2.Handler) - - globalPreHandler := func(ctx context.Context, msg transaction.Msg) error { - for _, h := range b.globalPreHandlers { - err := h(ctx, msg) - if err != nil { - return err - } - } - return nil - } - - globalPostHandler := func(ctx context.Context, msg, msgResp transaction.Msg) error { - for _, h := range b.globalPostHandlers { - err := h(ctx, msg, msgResp) - if err != nil { - return err - } - } - return nil - } - - for msgType, handler := range b.handlers { - // find pre handler - preHandlers := b.preHandlers[msgType] - // find post handler - postHandlers := b.postHandlers[msgType] - // build the handler - handlers[msgType] = buildHandler(handler, preHandlers, globalPreHandler, postHandlers, globalPostHandler) - } - - return coreRouterImpl{ - handlers: handlers, - }, nil -} - -func buildHandler( - handler appmodulev2.Handler, - preHandlers []appmodulev2.PreMsgHandler, - globalPreHandler appmodulev2.PreMsgHandler, - postHandlers []appmodulev2.PostMsgHandler, - globalPostHandler appmodulev2.PostMsgHandler, -) appmodulev2.Handler { - return func(ctx context.Context, msg transaction.Msg) (msgResp transaction.Msg, err error) { - if len(preHandlers) != 0 { - for _, preHandler := range preHandlers { - if err := preHandler(ctx, msg); err != nil { - return nil, err - } - } - } - err = globalPreHandler(ctx, msg) - if err != nil { - return nil, err - } - msgResp, err = handler(ctx, msg) - if err != nil { - return nil, err - } - - if len(postHandlers) != 0 { - for _, postHandler := range postHandlers { - if err := postHandler(ctx, msg, msgResp); err != nil { - return nil, err - } - } - } - err = globalPostHandler(ctx, msg, msgResp) - return msgResp, err - } -} - -// msgTypeURL returns the TypeURL of a proto message. -func msgTypeURL(msg gogoproto.Message) string { - return gogoproto.MessageName(msg) -} - -var _ router.Service = (*coreRouterImpl)(nil) - -// coreRouterImpl implements the STF router for msg and query handlers. -type coreRouterImpl struct { - handlers map[string]appmodulev2.Handler -} - -func (r coreRouterImpl) CanInvoke(_ context.Context, typeURL string) error { - // trimming prefixes is a backwards compatibility strategy that we use - // for baseapp components that did routing through type URL rather - // than protobuf message names. - typeURL = strings.TrimPrefix(typeURL, "/") - _, exists := r.handlers[typeURL] - if !exists { - return fmt.Errorf("%w: %s", ErrNoHandler, typeURL) - } - return nil -} - -func (r coreRouterImpl) Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error) { - typeName := msgTypeURL(req) - handler, exists := r.handlers[typeName] - if !exists { - return nil, fmt.Errorf("%w: %s", ErrNoHandler, typeName) - } - - return handler(ctx, req) -} diff --git a/server/v2/stf/stf_router_test.go b/server/v2/stf/stf_router_test.go deleted file mode 100644 index 91d6c9417176..000000000000 --- a/server/v2/stf/stf_router_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package stf - -import ( - "context" - "testing" - - gogoproto "github.com/cosmos/gogoproto/proto" - gogotypes "github.com/cosmos/gogoproto/types" - "github.com/stretchr/testify/require" - - "cosmossdk.io/core/appmodule/v2" - "cosmossdk.io/core/transaction" -) - -func TestRouter(t *testing.T) { - expectedMsg := &gogotypes.BoolValue{Value: true} - expectedMsgName := gogoproto.MessageName(expectedMsg) - - expectedResp := &gogotypes.StringValue{Value: "test"} - - router := coreRouterImpl{handlers: map[string]appmodule.Handler{ - gogoproto.MessageName(expectedMsg): func(ctx context.Context, gotMsg transaction.Msg) (msgResp transaction.Msg, err error) { - require.Equal(t, expectedMsg, gotMsg) - return expectedResp, nil - }, - }} - - t.Run("can invoke message by name", func(t *testing.T) { - err := router.CanInvoke(context.Background(), expectedMsgName) - require.NoError(t, err, "must be invocable") - }) - - t.Run("can invoke message by type URL", func(t *testing.T) { - err := router.CanInvoke(context.Background(), "/"+expectedMsgName) - require.NoError(t, err) - }) - - t.Run("cannot invoke unknown message", func(t *testing.T) { - err := router.CanInvoke(context.Background(), "not exist") - require.Error(t, err) - }) - - t.Run("invoke", func(t *testing.T) { - gotResp, err := router.Invoke(context.Background(), expectedMsg) - require.NoError(t, err) - require.Equal(t, expectedResp, gotResp) - }) -} diff --git a/tools/cosmovisor/cmd/cosmovisor/version_test.go b/tools/cosmovisor/cmd/cosmovisor/version_test.go deleted file mode 100644 index 8f51ea47dafb..000000000000 --- a/tools/cosmovisor/cmd/cosmovisor/version_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package main - -import ( - "bytes" - "context" - "testing" - - "github.com/stretchr/testify/require" - - "cosmossdk.io/log" -) - -func TestVersionCommand_Error(t *testing.T) { - logger := log.NewTestLogger(t).With(log.ModuleKey, "cosmovisor") - - rootCmd := NewRootCmd() - rootCmd.SetArgs([]string{"version"}) - - out := bytes.NewBufferString("") - rootCmd.SetOut(out) - rootCmd.SetErr(out) - - ctx := context.WithValue(context.Background(), log.ContextKey, logger) - - require.Error(t, rootCmd.ExecuteContext(ctx)) - require.Contains(t, out.String(), "DAEMON_NAME is not set") -} diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index a2da55ab2a40..66bce2e03e10 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -13,21 +13,11 @@ require ( github.com/cosmos/gogoproto v1.7.0 ) -<<<<<<< HEAD require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect cosmossdk.io/api v0.8.0 // indirect cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 // indirect; main -======= -require github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - -require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.34.2-20240701160653-fedbb9acfd2f.2 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.34.2-20240130113600-88ef6483f90f.2 // indirect - cosmossdk.io/api v0.7.5 // indirect - cosmossdk.io/core/testing v0.0.0-00010101000000-000000000000 // indirect ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 @@ -35,11 +25,7 @@ require ( cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 // indirect cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect -<<<<<<< HEAD cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 // indirect; main -======= - cosmossdk.io/x/tx v0.13.3 // indirect ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -80,12 +66,8 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.1 // indirect -<<<<<<< HEAD github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 -======= github.com/golang/protobuf v1.5.4 // indirect ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect diff --git a/x/accounts/go.mod b/x/accounts/go.mod index b3f544067508..0b074a16fedd 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -27,11 +27,7 @@ require ( cosmossdk.io/log v1.4.1 // indirect cosmossdk.io/math v1.3.0 cosmossdk.io/schema v0.1.1 // indirect -<<<<<<< HEAD cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 // indirect -======= - cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc // indirect ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/consensus v0.0.0-00010101000000-000000000000 // indirect @@ -181,20 +177,13 @@ replace github.com/cosmos/cosmos-sdk => ../../. // TODO remove post spinning out all modules replace ( -<<<<<<< HEAD // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main -======= - cosmossdk.io/api => ../../api - cosmossdk.io/collections => ../../collections - cosmossdk.io/core => ../../core - cosmossdk.io/core/testing => ../../core/testing cosmossdk.io/x/accounts/defaults/lockup => ./defaults/lockup ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/accounts/defaults/multisig => ./defaults/multisig cosmossdk.io/x/auth => ../auth cosmossdk.io/x/bank => ../bank diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 6f6e12c4c45d..aa16718b2fd9 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -22,17 +22,10 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -<<<<<<< HEAD cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 h1:J3vS3G41JtTWkUX3wVKcXdy1yPUca0d3QnexCR52PeY= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897/go.mod h1:5+Hpds6bhT6CdR7DqPh0dVOqyqL7NJkq+x+yjLdYSQU= -======= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) 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= diff --git a/x/group/go.sum b/x/group/go.sum index f71b223c0c13..277a52086bfa 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -22,15 +22,8 @@ cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= -<<<<<<< HEAD cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 h1:eb0kcGyaYHSS0do7+MIWg7UKlskSH01biRNENbm/zDA= -cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5/go.mod h1:drzY4oVisyWvSgpsM7ccQ7IX3efMuVIvd9Eij1Gm/6o= -======= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc h1:R9O9d75e0qZYUsVV0zzi+D7cNLnX2JrUOQNoIPaF0Bg= -cosmossdk.io/store v1.1.1-0.20240418092142-896cdf1971bc/go.mod h1:amTTatOUV3u1PsKmNb87z6/galCxrRbz9kRdJkL0DyU= ->>>>>>> a554a21a0 (refactor(core,stf,x)!: remove InvokeTyped from router (#21224)) cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337 h1:GuBrfHsK3RD5vlD4DuBz3DXslR6VlnzrYmHOC3L679Q= cosmossdk.io/x/epochs v0.0.0-20240522060652-a1ae4c3e0337/go.mod h1:PhLn1pMBilyRC4GfRkoYhm+XVAYhF4adVrzut8AdpJI= cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897 h1:J3vS3G41JtTWkUX3wVKcXdy1yPUca0d3QnexCR52PeY= From 6f7701b90a3c8acdca38641c637c4beb3834d1a9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Fri, 23 Aug 2024 23:51:26 +0200 Subject: [PATCH 3/3] updates --- client/v2/go.mod | 2 +- client/v2/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- server/v2/cometbft/go.mod | 2 +- server/v2/cometbft/go.sum | 4 ++-- simapp/go.mod | 2 +- simapp/go.sum | 4 ++-- simapp/v2/go.mod | 8 ++++---- simapp/v2/go.sum | 16 ++++++++-------- tests/go.mod | 2 +- tests/go.sum | 4 ++-- x/accounts/defaults/lockup/go.mod | 2 +- x/accounts/defaults/lockup/go.sum | 4 ++-- x/accounts/defaults/multisig/go.mod | 2 +- x/accounts/defaults/multisig/go.sum | 4 ++-- x/accounts/go.mod | 2 +- x/accounts/go.sum | 4 ++-- x/auth/go.mod | 2 +- x/auth/go.sum | 4 ++-- x/authz/go.mod | 2 +- x/authz/go.sum | 4 ++-- x/bank/go.mod | 2 +- x/bank/go.sum | 4 ++-- x/circuit/go.mod | 2 +- x/circuit/go.sum | 4 ++-- x/consensus/go.mod | 2 +- x/consensus/go.sum | 4 ++-- x/distribution/go.mod | 2 +- x/distribution/go.sum | 4 ++-- x/epochs/go.mod | 2 +- x/epochs/go.sum | 4 ++-- x/evidence/go.mod | 2 +- x/evidence/go.sum | 4 ++-- x/feegrant/go.mod | 2 +- x/feegrant/go.sum | 4 ++-- x/gov/go.mod | 2 +- x/gov/go.sum | 4 ++-- x/group/go.mod | 2 +- x/group/go.sum | 4 ++-- x/mint/go.mod | 2 +- x/mint/go.sum | 4 ++-- x/nft/go.mod | 2 +- x/nft/go.sum | 4 ++-- x/params/go.mod | 2 +- x/params/go.sum | 4 ++-- x/protocolpool/go.mod | 2 +- x/protocolpool/go.sum | 4 ++-- x/slashing/go.mod | 2 +- x/slashing/go.sum | 4 ++-- x/staking/go.mod | 2 +- x/staking/go.sum | 4 ++-- x/upgrade/go.mod | 2 +- x/upgrade/go.sum | 4 ++-- 54 files changed, 90 insertions(+), 90 deletions(-) diff --git a/client/v2/go.mod b/client/v2/go.mod index cd9449f2cb36..470143ceadcf 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -179,7 +179,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ./../../x/accounts diff --git a/client/v2/go.sum b/client/v2/go.sum index 889c46f79e76..828f5bf8eb67 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/go.mod b/go.mod index 8786b11aa1e2..d1d3c4edf905 100644 --- a/go.mod +++ b/go.mod @@ -187,7 +187,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ./x/accounts diff --git a/go.sum b/go.sum index 0e42e6382413..4f881e2ce7a0 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index e9873b324bbb..b6f2336a8ff1 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -6,7 +6,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../../../x/accounts diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index 198bae0e2246..db8025962092 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/simapp/go.mod b/simapp/go.mod index 370483a9ea3a..3bedfe49a9f5 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -243,7 +243,7 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main cosmossdk.io/client/v2 => ../client/v2 // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/tools/confix => ../tools/confix diff --git a/simapp/go.sum b/simapp/go.sum index 9d6a51480da1..d6ac7e2f3c38 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -196,8 +196,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 59f9a5c189ae..83ae92c78504 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -10,7 +10,7 @@ require ( cosmossdk.io/depinject v1.0.0 cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/runtime/v2 v2.0.0-20240816111545-aeeaca64da2c // main + cosmossdk.io/runtime/v2 v2.0.0-20240823213806-a554a21a0e84 // main cosmossdk.io/server/v2 v2.0.0-20240815194237-858ec2fcb897 // main cosmossdk.io/server/v2/cometbft v0.0.0-00010101000000-000000000000 cosmossdk.io/store/v2 v2.0.0-20240815194237-858ec2fcb897 // main @@ -57,7 +57,7 @@ require ( cosmossdk.io/errors/v2 v2.0.0-20240731132947-df72853b3ca5 // indirect cosmossdk.io/schema v0.1.1 // indirect cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c // indirect; main - cosmossdk.io/server/v2/stf v0.0.0-20240815194237-858ec2fcb897 // indirect; main + cosmossdk.io/server/v2/stf v0.0.0-20240823213806-a554a21a0e84 // indirect; main cosmossdk.io/store v1.1.1-0.20240815194237-858ec2fcb897 // indirect; main cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5 // indirect cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000 // indirect @@ -183,7 +183,7 @@ require ( github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.20.0 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect @@ -252,7 +252,7 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main cosmossdk.io/client/v2 => ../../client/v2 // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main cosmossdk.io/server/v2/cometbft => ../../server/v2/cometbft // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 45d670679232..2b064b37d24f 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -196,8 +196,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= @@ -210,16 +210,16 @@ cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/runtime/v2 v2.0.0-20240816111545-aeeaca64da2c h1:G1ZYl1rCI/8aGES3KZBXBBvoBEr3mLdTMATgDQHJ9a4= -cosmossdk.io/runtime/v2 v2.0.0-20240816111545-aeeaca64da2c/go.mod h1:bFme7eCFsnWvMRYR23kheaWpSuZGJmx7ucnEE9Bo9PU= +cosmossdk.io/runtime/v2 v2.0.0-20240823213806-a554a21a0e84 h1:LW6gh9tS1gF0O8s29DjukYXobAcL7Qe78xFOTpXXsio= +cosmossdk.io/runtime/v2 v2.0.0-20240823213806-a554a21a0e84/go.mod h1:YkwJ41+DM7INqLziPRFqudlqzRly29F1m3Yb8VemLMk= cosmossdk.io/schema v0.1.1 h1:I0M6pgI7R10nq+/HCQfbO6BsGBZA8sQy+duR1Y3aKcA= cosmossdk.io/schema v0.1.1/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ= cosmossdk.io/server/v2 v2.0.0-20240815194237-858ec2fcb897 h1:0+G0h2TUKqZdtr36Xse+HABj6clPQjYCB6afAefc5BA= cosmossdk.io/server/v2 v2.0.0-20240815194237-858ec2fcb897/go.mod h1:fVFP3ER/Wwg69A2YzGyBLwBD/xNJLrjtaoJhW+WIjAI= cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c h1:sxMoOFQvf5g1Wl1D2HidVtLpQhK1YCVq0YiDeT6qTNQ= cosmossdk.io/server/v2/appmanager v0.0.0-20240816111545-aeeaca64da2c/go.mod h1:fJDDnWJCBRxLLIyu2byqtf3KTRYIVS4OxKwdZozJi20= -cosmossdk.io/server/v2/stf v0.0.0-20240815194237-858ec2fcb897 h1:wI05I4dFEGpzyiq50Sl3Wh0Nqo0A/bg2OFIljGEa7ME= -cosmossdk.io/server/v2/stf v0.0.0-20240815194237-858ec2fcb897/go.mod h1:jkbBZd+xq+SjX8L65GjvToWq1MQ0fjvQFp2dwVbhnk0= +cosmossdk.io/server/v2/stf v0.0.0-20240823213806-a554a21a0e84 h1:w2yxPzzwltor54uV6mHuJ788yhmrbN+EV1zLAJDJBzI= +cosmossdk.io/server/v2/stf v0.0.0-20240823213806-a554a21a0e84/go.mod h1:lAejzCkeM9z7WGrWoDzv7peXtyghW84Sys4hE3LlVXs= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 h1:o024zaPHYtmUGL2BCX1ns9rfZmMc19U4hQ2CAPt2Xgg= cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897/go.mod h1:Ma4uny4RFegWTbU71fBmkSIoHrWHlLC/JwwgWgehZm4= cosmossdk.io/store/v2 v2.0.0-20240815194237-858ec2fcb897 h1:i2KoUy2254WwK671eROhHyRGk60W7Omv7nax6gybCKQ= @@ -754,8 +754,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI= -github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/tests/go.mod b/tests/go.mod index 8a514eaca160..cc69cb67fcf7 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -240,7 +240,7 @@ replace ( cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main cosmossdk.io/client/v2 => ../client/v2 // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../x/accounts diff --git a/tests/go.sum b/tests/go.sum index f26d32bb17ab..b108bbb50802 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -196,8 +196,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 66bce2e03e10..6d32ae22133a 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -153,7 +153,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../../. diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 5fcd9351faf5..748b91adae9c 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index b403be7ea45d..858a8e5a15e0 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../../. diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index 9e82d3a4d9f8..1fc69e0223ec 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 0b074a16fedd..e6187c0e3d78 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -180,7 +180,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts/defaults/lockup => ./defaults/lockup diff --git a/x/accounts/go.sum b/x/accounts/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/auth/go.mod b/x/auth/go.mod index c762a899b8f5..cbfdf6bfe588 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/auth/go.sum b/x/auth/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/authz/go.mod b/x/authz/go.mod index 38f5adeff19b..41730b16ab89 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -177,7 +177,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/authz/go.sum b/x/authz/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/bank/go.mod b/x/bank/go.mod index e444125b250e..4ff8f993ecc7 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/bank/go.sum b/x/bank/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 4a37df8c80a8..5d908da264ff 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -177,7 +177,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/circuit/go.sum b/x/circuit/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 7051500e52b8..2bb5b47d4c96 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -174,7 +174,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/consensus/go.sum b/x/consensus/go.sum index 9e82d3a4d9f8..1fc69e0223ec 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 8a8f2226deea..ef39cea5480f 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -178,7 +178,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/distribution/go.sum b/x/distribution/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index 894d97dd70fd..02db40c4d4e2 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/epochs/go.sum b/x/epochs/go.sum index 9e82d3a4d9f8..1fc69e0223ec 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 135f2fe33b11..f0b95f9edbd6 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -177,7 +177,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/evidence/go.sum b/x/evidence/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 3ecb97a97e99..a811500b4abc 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -181,7 +181,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 3e8443cae356..ade1ba605cd9 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/gov/go.mod b/x/gov/go.mod index 7948a793fbc1..5bc572f23111 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -180,7 +180,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/gov/go.sum b/x/gov/go.sum index 889c46f79e76..828f5bf8eb67 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/group/go.mod b/x/group/go.mod index b1914af1edf4..3f1868ca2689 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -188,7 +188,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/group/go.sum b/x/group/go.sum index 277a52086bfa..901c309fb124 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/mint/go.mod b/x/mint/go.mod index 1d44493e594f..4472e1b4d8b1 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -181,7 +181,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/mint/go.sum b/x/mint/go.sum index 465a3a00fd9b..dbe16610d646 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/nft/go.mod b/x/nft/go.mod index 0c15bc8dd166..9a2d68628cfd 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/nft/go.sum b/x/nft/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/params/go.mod b/x/params/go.mod index 8bf14b5e0590..05f58071fcef 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -177,7 +177,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/params/go.sum b/x/params/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index c49e3a1fb29f..37c4e1966f78 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -177,7 +177,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index d61a871fd743..98a3b82869df 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -178,7 +178,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/slashing/go.sum b/x/slashing/go.sum index acc32600cc21..be74efebc3d1 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/staking/go.mod b/x/staking/go.mod index c2098a9bff72..8560493121e8 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -176,7 +176,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/staking/go.sum b/x/staking/go.sum index aa16718b2fd9..4fc124fee3e7 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -8,8 +8,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 49bf34dc3479..c53420808dc2 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -208,7 +208,7 @@ replace ( // pseudo version lower than the latest tag cosmossdk.io/api => cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 // main // pseudo version lower than the latest tag - cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 // main + cosmossdk.io/core => cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 // main // pseudo version lower than the latest tag cosmossdk.io/store => cosmossdk.io/store v1.0.0-rc.0.0.20240815194237-858ec2fcb897 // main cosmossdk.io/x/accounts => ../accounts diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index aee7082cff6e..53411b81bf24 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -196,8 +196,8 @@ cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897 h1:YV9M+9pClbzPncO5XMSc3kI cosmossdk.io/api v0.7.3-0.20240815194237-858ec2fcb897/go.mod h1:oqpDMZQpEgSo0Cm4F+0yxoC9UQbo/SlodZR4zeOqBsE= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab h1:E/IWad76v1Nc4Atswaccpt7twJ0VwHkbY94/PhmZfTo= cosmossdk.io/collections v0.4.1-0.20240802064046-23fac2f1b8ab/go.mod h1:Or+5eVAo1aiS1DnPK90eQykGc59LGBWtqwBoJcxXTmw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897 h1:LZ0K/+vMVP/DMD+key8mZ3VN1hj8CVq6Wz2OrM9MiOw= -cosmossdk.io/core v0.12.1-0.20240815194237-858ec2fcb897/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84 h1:BQwKXixfOweuJrGtXUZN3iToOfl/WGRO1H9jW8dWJAo= +cosmossdk.io/core v0.12.1-0.20240823213806-a554a21a0e84/go.mod h1:abgLjeFLhtuKIYZWSPlVUgQBrKObO7ULV35KYfexE90= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897 h1:gmixMHnBIgk3d65paDohDPrZQsFq00EI7jSTNfrApH0= cosmossdk.io/core/testing v0.0.0-20240815194237-858ec2fcb897/go.mod h1:sZWK1RejJogkZEDof+UTMyl2mrUxAXcX+IIQ0ZHk5WQ= cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050=