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

[Utility] Add servicer module mock #960

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add servicer module mock
  • Loading branch information
adshmh committed Aug 2, 2023
commit 5b0cfb2f3ae551f5b3f911f6e4836bc5f4ef3169
16 changes: 16 additions & 0 deletions shared/modules/servicer_module.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package modules

//go:generate mockgen -destination=./mocks/servicer_module_mock.go github.com/pokt-network/pocket/shared/modules ServicerModule

import (
coreTypes "github.com/pokt-network/pocket/shared/core/types"
)

const (
ServicerModuleName = "servicer"
)

type ServicerModule interface {
Module
HandleRelay(*coreTypes.Relay) (*coreTypes.RelayResponse, error)
}
5 changes: 0 additions & 5 deletions shared/modules/utility_module.go
Original file line number Diff line number Diff line change
@@ -62,11 +62,6 @@ type FishermanModule interface {
Module
}

type ServicerModule interface {
Module
HandleRelay(*coreTypes.Relay) (*coreTypes.RelayResponse, error)
}

type ValidatorModule interface {
Module
}
4 changes: 2 additions & 2 deletions utility/module.go
Original file line number Diff line number Diff line change
@@ -142,10 +142,10 @@ func (u *utilityModule) GetActorModules() map[string]modules.Module {
}

func (u *utilityModule) GetServicerModule() (modules.ServicerModule, error) {
if u.actorModules[servicer.ServicerModuleName] == nil {
if u.actorModules[modules.ServicerModuleName] == nil {
return nil, errors.New("servicer module not enabled")
}
if m, ok := u.actorModules[servicer.ServicerModuleName].(modules.ServicerModule); ok {
if m, ok := u.actorModules[modules.ServicerModuleName].(modules.ServicerModule); ok {
return m, nil
}
return nil, errors.New("failed to cast servicer module")