Skip to content

Commit

Permalink
Remove msgServer type (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushinDaniil authored Aug 29, 2024
1 parent 0b72244 commit 6e976af
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
12 changes: 1 addition & 11 deletions x/rollup/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ import (
"github.com/samber/lo"
)

type msgServer struct {
*Keeper
}

// NewMsgServerImpl returns an implementation of the MsgServer interface
// for the provided Keeper.
func NewMsgServerImpl(keeper *Keeper) types.MsgServer {
return &msgServer{Keeper: keeper}
}

var _ types.MsgServer = msgServer{}
var _ types.MsgServer = &Keeper{}

// ApplyL1Txs implements types.MsgServer.
func (k *Keeper) ApplyL1Txs(goCtx context.Context, msg *types.MsgApplyL1Txs) (*types.MsgApplyL1TxsResponse, error) {
Expand Down
5 changes: 2 additions & 3 deletions x/rollup/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
gethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/golang/mock/gomock"
"github.com/polymerdao/monomer/testutils"
"github.com/polymerdao/monomer/x/rollup/keeper"
"github.com/polymerdao/monomer/x/rollup/types"
)

Expand Down Expand Up @@ -111,7 +110,7 @@ func (s *KeeperTestSuite) TestApplyL1Txs() {
}
s.mockMintETH()

resp, err := keeper.NewMsgServerImpl(s.rollupKeeper).ApplyL1Txs(s.ctx, &types.MsgApplyL1Txs{
resp, err := s.rollupKeeper.ApplyL1Txs(s.ctx, &types.MsgApplyL1Txs{
TxBytes: test.txBytes,
})

Expand Down Expand Up @@ -188,7 +187,7 @@ func (s *KeeperTestSuite) TestInitiateWithdrawal() {
}
s.mockBurnETH()

resp, err := keeper.NewMsgServerImpl(s.rollupKeeper).InitiateWithdrawal(s.ctx, &types.MsgInitiateWithdrawal{
resp, err := s.rollupKeeper.InitiateWithdrawal(s.ctx, &types.MsgInitiateWithdrawal{
Sender: test.sender,
Target: l1Target,
Value: withdrawalAmount,
Expand Down
4 changes: 2 additions & 2 deletions x/rollup/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/polymerdao/monomer/gen/rollup/module/v1"
modulev1 "github.com/polymerdao/monomer/gen/rollup/module/v1"
"github.com/polymerdao/monomer/x/rollup/keeper"
"github.com/polymerdao/monomer/x/rollup/types"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -148,7 +148,7 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute }
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterMsgServer(cfg.MsgServer(), am.keeper)
}

// RegisterInvariants registers the capability module's invariants.
Expand Down
2 changes: 1 addition & 1 deletion x/rollup/tests/integration/rollup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func setupIntegrationApp(t *testing.T) *integration.App {
rolluptypes.ModuleName: rollupModule,
},
)
rolluptypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), rollupkeeper.NewMsgServerImpl(rollupKeeper))
rolluptypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), rollupKeeper)
banktypes.RegisterQueryServer(integrationApp.QueryHelper(), bankkeeper.NewQuerier(&bankKeeper))

return integrationApp
Expand Down

0 comments on commit 6e976af

Please sign in to comment.