Add MsgServer to Configurator for ADR 031 wiring (#7584)
* Add MsgServer to Configurator for ADR 031 wiring * Add docs, wire up evidence & staking * Add integration test * Add comments * Doc strings * Update types/module/configurator.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update types/module/configurator.go Co-authored-by: Cory <cjlevinson@gmail.com> * Wire up vesting * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> Co-authored-by: Cory <cjlevinson@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Aleksandr Bezobchuk
Cory
Amaury Martiny
mergify[bot]
parent
ba2799ec6d
commit
9e7eb0da00
@@ -7,20 +7,33 @@ import "github.com/gogo/protobuf/grpc"
|
||||
// support module object capabilities isolation as described in
|
||||
// https://github.com/cosmos/cosmos-sdk/issues/7093
|
||||
type Configurator interface {
|
||||
// MsgServer returns a grpc.Server instance which allows registering services
|
||||
// that will handle TxBody.messages in transactions. These Msg's WILL NOT
|
||||
// be exposed as gRPC services.
|
||||
MsgServer() grpc.Server
|
||||
|
||||
// QueryServer returns a grpc.Server instance which allows registering services
|
||||
// that will be exposed as gRPC services as well as ABCI query handlers.
|
||||
QueryServer() grpc.Server
|
||||
}
|
||||
|
||||
type configurator struct {
|
||||
msgServer grpc.Server
|
||||
queryServer grpc.Server
|
||||
}
|
||||
|
||||
// NewConfigurator returns a new Configurator instance
|
||||
func NewConfigurator(queryServer grpc.Server) Configurator {
|
||||
return configurator{queryServer: queryServer}
|
||||
func NewConfigurator(msgServer grpc.Server, queryServer grpc.Server) Configurator {
|
||||
return configurator{msgServer: msgServer, queryServer: queryServer}
|
||||
}
|
||||
|
||||
var _ Configurator = configurator{}
|
||||
|
||||
// MsgServer implements the Configurator.MsgServer method
|
||||
func (c configurator) MsgServer() grpc.Server {
|
||||
return c.msgServer
|
||||
}
|
||||
|
||||
// QueryServer implements the Configurator.QueryServer method
|
||||
func (c configurator) QueryServer() grpc.Server {
|
||||
return c.queryServer
|
||||
|
||||
@@ -181,8 +181,9 @@ func TestManager_RegisterQueryServices(t *testing.T) {
|
||||
require.NotNil(t, mm)
|
||||
require.Equal(t, 2, len(mm.Modules))
|
||||
|
||||
msgRouter := mocks.NewMockServer(mockCtrl)
|
||||
queryRouter := mocks.NewMockServer(mockCtrl)
|
||||
cfg := module.NewConfigurator(queryRouter)
|
||||
cfg := module.NewConfigurator(msgRouter, queryRouter)
|
||||
mockAppModule1.EXPECT().RegisterServices(cfg).Times(1)
|
||||
mockAppModule2.EXPECT().RegisterServices(cfg).Times(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user