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

Add RegisterInvariants to Configuration #273

Merged
merged 105 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
e31c19a
adding RegisterInvariants to Configuration
likhita-809 Feb 22, 2021
6d2092a
fixing failed tests
likhita-809 Feb 22, 2021
9c19e84
fix failing tests
likhita-809 Feb 23, 2021
1e51704
fix lint issues
likhita-809 Feb 23, 2021
a5338df
add-TallyVotesInvariant
likhita-809 Feb 26, 2021
f353d41
remove temp
likhita-809 Feb 26, 2021
89a43db
fix lint issues
likhita-809 Feb 26, 2021
74aabf7
Merge branch 'master' of github.com:regen-network/regen-ledger into l…
likhita-809 Mar 1, 2021
0a64ab2
adding invariants
likhita-809 Mar 2, 2021
ad719bf
changes to invariant
likhita-809 Mar 2, 2021
0c1556a
fix lint issues
likhita-809 Mar 2, 2021
822d61d
addressing requested changes
likhita-809 Mar 4, 2021
a60f625
"Remove getAllProposals"
likhita-809 Mar 4, 2021
fd08c73
"Remove invariant.go"
likhita-809 Mar 4, 2021
3f6c079
"Change naming conventions"
likhita-809 Mar 4, 2021
96c61f2
"Fix lint issues"
likhita-809 Mar 4, 2021
ec7fba5
Merge branch 'master' into likhita/add-invariants
likhita-809 Mar 4, 2021
8f39c1e
change naming conventions
likhita-809 Mar 5, 2021
d223200
"Change naming conventions"
likhita-809 Mar 5, 2021
23c0167
Merge branch 'master' into likhita/add-invariants
likhita-809 Mar 5, 2021
d62f5e9
Merge branch 'master' into likhita/add-invariants
likhita-809 Mar 6, 2021
76be926
Merge branch 'master' into likhita/add-invariants
likhita-809 Mar 6, 2021
ef878de
Merge branch 'master' into likhita/add-invariants
anilcse Mar 8, 2021
68a0e0f
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
af62bac
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
95f27b3
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
6783ecd
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
94e8b93
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
3b8328e
Update types/module/server/manager.go
likhita-809 Mar 9, 2021
3dd8029
Update x/group/server/server.go
likhita-809 Mar 9, 2021
7c3ebe5
Update types/module/server/module.go
likhita-809 Mar 9, 2021
09c1dde
Update x/group/server/invariants.go
likhita-809 Mar 9, 2021
a365a4b
Update x/group/server/invariants.go
likhita-809 Mar 9, 2021
bd7b116
Update x/group/server/invariants.go
likhita-809 Mar 9, 2021
bc555a9
Update invariants and fix naming conventions
likhita-809 Mar 9, 2021
7b9886b
update naming convetions
likhita-809 Mar 9, 2021
30e9857
update types/module/server/manager.go
likhita-809 Mar 9, 2021
1a11a87
Fix failed tests
likhita-809 Mar 9, 2021
849a31b
fix failing tests
likhita-809 Mar 9, 2021
0062f9d
fix failed tests
likhita-809 Mar 9, 2021
594c142
WIP
likhita-809 Mar 9, 2021
d790e96
changes to manager
likhita-809 Mar 9, 2021
b257000
fix failed tests
likhita-809 Mar 9, 2021
3bd1dcf
Update invariants in group module
likhita-809 Mar 10, 2021
f16a4c2
Update x/group/server/invariants.go
likhita-809 Mar 10, 2021
cd739de
changes to invariants
likhita-809 Mar 10, 2021
3a4f33c
Change naming convention for invariants
likhita-809 Mar 18, 2021
4a0f031
Remove `invariant` as param in types/module/server/testutil.go
likhita-809 Mar 18, 2021
42763c9
Remove `invar` in `FixtureFactory`
likhita-809 Mar 18, 2021
7daac2e
Code cleaning
likhita-809 Mar 18, 2021
f5df08b
Implement tallyVotesInvariant without using serverImpl
likhita-809 Mar 19, 2021
e4327fc
invariant test in progress
likhita-809 Mar 20, 2021
a45380d
invariant test in progress
likhita-809 Mar 20, 2021
30386f8
Invariants test in progress
likhita-809 Mar 20, 2021
074e9bc
Modify invariants
likhita-809 Mar 22, 2021
9e31ebf
change invariants
likhita-809 Mar 23, 2021
7bc6181
invariants test in progress
likhita-809 Mar 26, 2021
1910ed9
fix invariants
likhita-809 Mar 26, 2021
308f639
Invariants test added
likhita-809 Mar 26, 2021
16b5832
resolve merge conflict
likhita-809 Mar 26, 2021
60ac9b2
update files
likhita-809 Mar 26, 2021
52a0eb1
fix failed tests
likhita-809 Mar 26, 2021
17edac2
fix failed tests
likhita-809 Mar 26, 2021
c5e5e72
fix
likhita-809 Mar 26, 2021
9fb38fd
fix errors
likhita-809 Mar 26, 2021
5fd97fb
fix errors
likhita-809 Mar 26, 2021
b7ea6f3
Register Invariants in configurator
likhita-809 Mar 26, 2021
58d65e5
remove serverImpl in invariants test
likhita-809 Mar 30, 2021
09568a6
add table tests for invariants
likhita-809 Mar 30, 2021
d647651
change table test name
likhita-809 Mar 30, 2021
9910747
change params in tallyVotesInvariant func
likhita-809 Mar 30, 2021
adbc7e5
add changes to invariants_test
likhita-809 Mar 30, 2021
9e75372
Merge branch 'master' of https://github.com/regen-network/regen-ledge…
likhita-809 Mar 30, 2021
5e4754e
update stable_appconfig
likhita-809 Mar 30, 2021
89227a0
change GroupAccount filed to Address
likhita-809 Mar 30, 2021
42dcecf
address changes
likhita-809 Mar 30, 2021
d7806b1
Update with CacheContext
likhita-809 Mar 30, 2021
9ba1404
remove unnecessary code
likhita-809 Mar 31, 2021
c8c69be
resolve requested changes
likhita-809 Mar 31, 2021
71b1d89
remove redundant return in experimental_appconfig
likhita-809 Mar 31, 2021
df3e7f4
address requested changes
likhita-809 Apr 1, 2021
be7952c
remove AllInvariants function
likhita-809 Apr 1, 2021
7ef6cb5
changes to invariant
likhita-809 Apr 2, 2021
97c8c7c
remove unncessary changes
likhita-809 Apr 2, 2021
15ce9a9
add votesInvariant const
likhita-809 Apr 2, 2021
084c33b
add tallyTotalWeightInvariant
likhita-809 Apr 3, 2021
b340653
change naming conventions in tallyTotalWeightInvariant
likhita-809 Apr 3, 2021
a2df03e
fix lint issues
likhita-809 Apr 3, 2021
8bbd8e4
fix something
likhita-809 Apr 5, 2021
622565d
change naming conventions and add improvements to invariants
likhita-809 Apr 8, 2021
c520fd6
fix lint issue
likhita-809 Apr 8, 2021
2da5355
fix lint issues
likhita-809 Apr 8, 2021
c29b9d1
changes in groupTotalWeightInvariant
likhita-809 Apr 8, 2021
ead7312
code refactoring in invariants_Test
likhita-809 Apr 9, 2021
4f1b50d
changes in invariants_test
likhita-809 Apr 9, 2021
5503918
remove ReadAll and add LoadNext in invariants
likhita-809 Apr 12, 2021
d8316df
close iterator
likhita-809 Apr 12, 2021
6d4af82
fix lint issues
likhita-809 Apr 12, 2021
51c239d
changes to invariants
likhita-809 Apr 14, 2021
ee43a70
use groupIt with LoadNext
likhita-809 Apr 14, 2021
9f00995
remove unecessary lines
likhita-809 Apr 14, 2021
51dcff5
refactoring code
likhita-809 Apr 15, 2021
32bd9e4
refactor code
likhita-809 Apr 15, 2021
5878b58
fix lint issues
likhita-809 Apr 15, 2021
d706766
Merge branch 'master' into likhita/add-invariants
blushi Apr 16, 2021
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ DOCKER_BUF := docker run -v $(shell pwd):/workspace --workdir /workspace bufbuil
export GO111MODULE = on

# process build tags

build_tags = netgo

ifeq ($(EXPERIMENTAL),true)
Expand Down
12 changes: 11 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"os"
"path/filepath"

servermodule "github.com/regen-network/regen-ledger/types/module/server"

wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -190,6 +192,13 @@ type RegenApp struct {

// simulation manager
sm *module.SimulationManager

// new module manager
// XXX We will likely want to make this new manager compatible
// with module.Manager so that we can have existing cosmos-sdk modules
// use ADR 33 approach without the need for removing their keepers
// and a larger refactoring.
nm *servermodule.Manager
}

// NewRegenApp returns a reference to an initialized RegenApp.
Expand Down Expand Up @@ -344,7 +353,8 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
)

// register experimental modules here
setCustomModules(app, interfaceRegistry)
app.nm = setCustomModules(app, interfaceRegistry)
app.nm.RegisterInvariants(&app.CrisisKeeper)

app.mm = module.NewManager(
genutil.NewAppModule(
Expand Down
4 changes: 3 additions & 1 deletion app/experimental_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func setCustomModuleBasics() []module.AppModuleBasic {
}
}

func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry) {
func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry) *servermodule.Manager {

/* New Module Wiring START */
newModuleManager := servermodule.NewManager(app.BaseApp, codec.NewProtoCodec(interfaceRegistry))
Expand All @@ -48,6 +48,8 @@ func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry)
panic(err)
}
/* New Module Wiring END */

return newModuleManager
}

func (app *RegenApp) registerUpgradeHandlers() {
Expand Down
5 changes: 4 additions & 1 deletion app/stable_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ package app
import (
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/module"
servermodule "github.com/regen-network/regen-ledger/types/module/server"
)

func setCustomModuleBasics() []module.AppModuleBasic {
return []module.AppModuleBasic{}
}

func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry) {}
func setCustomModules(app *RegenApp, interfaceRegistry types.InterfaceRegistry) *servermodule.Manager {
return &servermodule.Manager{}
}

func (app *RegenApp) registerUpgradeHandlers() {}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.3
github.com/tendermint/tm-db v0.6.3
golang.org/x/tools v0.1.0 // indirect
google.golang.org/genproto v0.0.0-20210212180131-e7f2df4ecc2d // indirect
google.golang.org/grpc v1.35.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8=
github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
Expand Down Expand Up @@ -700,6 +701,8 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -744,6 +747,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -789,6 +793,8 @@ golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f h1:QdHQnPce6K4XQewki9WNbG5KOROuDzqO3NaYjI1cXJ0=
golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
Expand Down Expand Up @@ -826,9 +832,13 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200110213125-a7a6caa82ab2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa h1:5E4dL8+NgFOgjwbTKz+OOEGGhP+ectTmF842l6KjupQ=
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
47 changes: 33 additions & 14 deletions types/module/server/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,30 @@ import (

// Manager is the server module manager
type Manager struct {
baseApp *baseapp.BaseApp
cdc *codec.ProtoCodec
keys map[string]ModuleKey
router *router
requiredServices map[reflect.Type]bool
baseApp *baseapp.BaseApp
cdc *codec.ProtoCodec
keys map[string]ModuleKey
router *router
requiredServices map[reflect.Type]bool
registerInvariants map[string]RegisterInvariantsHandler
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
}

// RegisterInvariants registers all module routes and module querier routes
func (mm *Manager) RegisterInvariants(ir sdk.InvariantRegistry) {
for _, moduleName := range mm.registerInvariants {
if moduleName != nil { //TODO: Remove if condition
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
moduleName(ir)
}
}
}

// NewManager creates a new Manager
func NewManager(baseApp *baseapp.BaseApp, cdc *codec.ProtoCodec) *Manager {
return &Manager{
baseApp: baseApp,
cdc: cdc,
keys: map[string]ModuleKey{},
baseApp: baseApp,
cdc: cdc,
keys: map[string]ModuleKey{},
registerInvariants: map[string]RegisterInvariantsHandler{},
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
router: &router{
handlers: map[string]handler{},
providedServices: map[reflect.Type]bool{},
Expand Down Expand Up @@ -97,6 +108,7 @@ func (mm *Manager) RegisterModules(modules []module.Module) error {
}

serverMod.RegisterServices(cfg)
mm.registerInvariants[name] = cfg.registerInvariants
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved

// If mod implements LegacyRouteModule, register module route.
// This is currently used for the group module as part of #218.
Expand Down Expand Up @@ -137,13 +149,16 @@ func (mm *Manager) CompleteInitialization() error {
return nil
}

type RegisterInvariantsHandler func(ir sdk.InvariantRegistry)

type configurator struct {
msgServer gogogrpc.Server
queryServer gogogrpc.Server
key *rootModuleKey
cdc codec.Marshaler
requiredServices map[reflect.Type]bool
router sdk.Router
msgServer gogogrpc.Server
queryServer gogogrpc.Server
key *rootModuleKey
cdc codec.Marshaler
requiredServices map[reflect.Type]bool
router sdk.Router
registerInvariants RegisterInvariantsHandler
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
}

var _ Configurator = &configurator{}
Expand All @@ -156,6 +171,10 @@ func (c *configurator) QueryServer() gogogrpc.Server {
return c.queryServer
}

func (c *configurator) RegisterInvariants(registry RegisterInvariantsHandler) {
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
c.registerInvariants = registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.registerInvariants = registry
c.registerInvariantsHandler = registry

}

func (c *configurator) ModuleKey() RootModuleKey {
return c.key
}
Expand Down
2 changes: 1 addition & 1 deletion types/module/server/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Configurator interface {
ModuleKey() RootModuleKey
Marshaler() codec.Marshaler
RequireServer(interface{})

RegisterInvariants(registry RegisterInvariantsHandler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RegisterInvariants(registry RegisterInvariantsHandler)
RegisterInvariantsHandler(registry RegisterInvariantsHandler)

// Router() is temporarily added here to use in the group module.
// TODO: remove once #225 addressed
Router() sdk.Router
Expand Down
4 changes: 3 additions & 1 deletion types/module/server/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ type FixtureFactory struct {
signers []sdk.AccAddress
cdc *codec.ProtoCodec
baseApp *baseapp.BaseApp
invar *sdk.InvariantRegistry
}

func NewFixtureFactory(t *testing.T, numSigners int) *FixtureFactory {
func NewFixtureFactory(t *testing.T, numSigners int, invariant sdk.InvariantRegistry) *FixtureFactory {
likhita-809 marked this conversation as resolved.
Show resolved Hide resolved
signers := makeTestAddresses(numSigners)
return &FixtureFactory{
t: t,
Expand All @@ -39,6 +40,7 @@ func NewFixtureFactory(t *testing.T, numSigners int) *FixtureFactory {
// TODO: remove once all code using this uses ADR 033 module wiring
cdc: codec.NewProtoCodec(types.NewInterfaceRegistry()),
baseApp: baseapp.NewBaseApp("test", log.NewNopLogger(), dbm.NewMemDB(), nil),
invar: &invariant,
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/data/server/query_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (s serverImpl) ByHash(ctx types.Context, request *data.QueryByHashRequest)

func (s serverImpl) BySigner(ctx types.Context, request *data.QueryBySignerRequest) (*data.QueryBySignerResponse, error) {
return nil, fmt.Errorf("not implemented")
//store := prefix.NewStore(ctx.KVStore(s.storeKey), SignerCIDIndexPrefix(request.Signer))
// store := prefix.NewStore(ctx.KVStore(s.storeKey), SignerCIDIndexPrefix(request.Signer))
//
//var cids [][]byte
//pageRes, err := query.Paginate(store, request.Pagination, func(key []byte, value []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion x/data/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestServer(t *testing.T) {
ff := server.NewFixtureFactory(t, 2)
ff := server.NewFixtureFactory(t, 2, nil)
ff.SetModules([]module.Module{datamodule.Module{}})
s := testsuite.NewIntegrationTestSuite(ff)
suite.Run(t, s)
Expand Down
Loading