Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime): message router service #19571

Merged
merged 20 commits into from
Mar 4, 2024
1 change: 1 addition & 0 deletions core/router/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

// Service is the interface that wraps the basic methods for a router service.
// This service allows to invoke messages and queries via a message router.
type Service interface {
InvokeTyped(ctx context.Context, req, res protoiface.MessageV1) error
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
InvokeUntyped(ctx context.Context, req protoiface.MessageV1) (res protoiface.MessageV1, err error)
Expand Down
4 changes: 1 addition & 3 deletions runtime/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import (
"context"
"fmt"
"reflect"

Check notice

Code scanning / CodeQL

Sensitive package import Note

Certain system packages contain functions which may be a possible source of non-determinism

"github.com/cosmos/gogoproto/proto"
protov2 "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoregistry"
"google.golang.org/protobuf/runtime/protoiface"

"cosmossdk.io/core/router"
Expand All @@ -16,18 +15,17 @@
"github.com/cosmos/cosmos-sdk/baseapp"
)

// NewMsgRouterService creates a router.Service which allows to invoke messages and queries using the msg router.
func NewMsgRouterService(storeService store.KVStoreService, router baseapp.MessageRouter) router.Service {
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
return &msgRouterService{
storeService: storeService,
router: router,
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
resolver: protoregistry.GlobalTypes,
}
}

type msgRouterService struct {
storeService store.KVStoreService
router baseapp.MessageRouter
resolver protoregistry.MessageTypeResolver
}

// InvokeTyped execute a message and fill-in a response.
Expand Down
Loading